diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fd38b3dc61..36eb001212 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,7 +3,7 @@ "hostRequirements": { "cpus": 4 }, - "onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/1ebffeb0-f090-4001-9f13-69f112936a70/5dbc249b375cca13ec4d97d48ea93b28/dotnet-sdk-8.0.402-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && dotnet dev-certs https --trust && find . -type f -name '*.csproj' -exec sed -i 's/Microsoft.NET.Sdk.BlazorWebAssembly/Microsoft.NET.Sdk.Web/g' {} \\;", + "onCreateCommand": "wget https://download.visualstudio.microsoft.com/download/pr/308f16a9-2ecf-4a42-b8bb-c1233de985fd/be6e87045ab21935bd8bb98ce69026c4/dotnet-sdk-9.0.100-linux-x64.tar.gz -O $HOME/dotnet.tar.gz && export DOTNET_ROOT=$HOME/.dotnet && mkdir -p \"$DOTNET_ROOT\" && tar zxf $HOME/dotnet.tar.gz -C \"$DOTNET_ROOT\" && export PATH=$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH && find . -type f -name '*.csproj' -exec sed -i 's/Microsoft.NET.Sdk.BlazorWebAssembly/Microsoft.NET.Sdk.Web/g' {} \\;", "waitFor": "onCreateCommand", "customizations": { "codespaces": { diff --git a/.github/workflows/admin-sample.cd.yml b/.github/workflows/admin-sample.cd.yml index 62ec9234e3..3df32a5f0b 100644 --- a/.github/workflows/admin-sample.cd.yml +++ b/.github/workflows/admin-sample.cd.yml @@ -1,4 +1,4 @@ -name: Admin Sample CD +name: Admin Sample CD # Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops @@ -36,7 +36,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --api Standalone --notification --captcha reCaptcha --signalR + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --api Standalone --notification --captcha reCaptcha --signalR --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -60,7 +60,7 @@ jobs: run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Core/AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Api/AdminPanel.Server.Api.csproj -c Release -p:PwaEnabled=true -p:PublishTrimmed=true -p:TrimMode=partial -p:JsonSerializerIsReflectionEnabledByDefault=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" + run: dotnet publish AdminPanel/src/Server/AdminPanel.Server.Api/AdminPanel.Server.Api.csproj -c Release -p:PwaEnabled=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 @@ -144,7 +144,7 @@ jobs: cd src\Templates\Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR + cd ..\..\..\ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --windows --appInsights --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --signalR --offlineDb --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -159,27 +159,12 @@ jobs: - name: Generate CSS/JS files run: dotnet build AdminPanel\src\Client\AdminPanel.Client.Core\AdminPanel.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release - - name: Set app center secret - run: (Get-Content AdminPanel\src\Client\AdminPanel.Client.Windows\Program.cs) -Replace 'appCenterSecret = null;', 'appCenterSecret = "a9ed2257-fb82-496a-ba10-78c2d9ef33a6";' | Out-File -Encoding utf8 AdminPanel\src\Client\AdminPanel.Client.Windows\Program.cs - shell: pwsh - - name: Publish run: | cd AdminPanel\src\Client\AdminPanel.Client.Windows\ - dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\bin\publish-arm64 -r win-arm64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-arm64\AdminPanel.Client.Windows.exe AdminPanel.Client.Windows-arm64.exe - dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\bin\publish-x86 -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x86\AdminPanel.Client.Windows.exe AdminPanel.Client.Windows-x86.exe - dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\bin\publish-x64 -r win-x64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x64\AdminPanel.Client.Windows.exe AdminPanel.Client.Windows-x64.exe - dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\bin\publish -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - del .\bin\publish\AdminPanel.Client.Windows.exe - echo D | xcopy .\bin\publish-arm64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x86 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish .\publish-result /s /e /h + dotnet publish AdminPanel.Client.Windows.csproj -c Release -o .\publish-result -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" dotnet tool restore - dotnet vpk pack -u AdminPanel.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e AdminPanel.Client.Windows-x86.exe -r win-x86 --framework net8.0.8-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'AdminPanel' + dotnet vpk pack -u AdminPanel.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e AdminPanel.Client.Windows.exe -r win-x86 --framework net9.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'AdminPanel' - name: Upload artifact uses: actions/upload-artifact@v4 @@ -206,7 +191,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 - uses: actions/setup-node@v4 with: @@ -251,13 +236,13 @@ jobs: dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release - name: Build aab - run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -c Release -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="AdminPanel.keystore" -p:AndroidSigningKeyAlias=bitplatform -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net8.0-android + run: dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -c Release -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="AdminPanel.keystore" -p:AndroidSigningKeyAlias=bitplatform -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net9.0-android - name: Upload artifact uses: actions/upload-artifact@v4 with: name: android-bundle - path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/Release/net8.0-android/*-Signed.* + path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/Release/net9.0-android/*-Signed.* build_blazor_hybrid_ios: name: build blazor hybrid (iOS-macOS) @@ -286,7 +271,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR + cd ../../../ && dotnet new bit-bp --name AdminPanel --database PostgreSQL --sample Admin --appInsights --appCenter --serverUrl ${{ env.WEB_SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --signalR --framework net9.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -324,10 +309,10 @@ jobs: dotnet build AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release - name: Build ipa - run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="AdminPanel" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net8.0-ios + run: dotnet publish AdminPanel/src/Client/AdminPanel.Client.Maui/AdminPanel.Client.Maui.csproj -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="AdminPanel" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -p:ApplicationTitle="AdminPanel" -p:ApplicationId="com.bitplatform.AdminPanel.Template" -f net9.0-ios - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ios-bundle - path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/release/net8.0-ios/ios-arm64/publish/*.ipa \ No newline at end of file + path: AdminPanel/src/Client/AdminPanel.Client.Maui/bin/release/net9.0-ios/ios-arm64/publish/*.ipa \ No newline at end of file diff --git a/.github/workflows/bit.ci.yml b/.github/workflows/bit.ci.yml index 28079eb035..bcb718b324 100644 --- a/.github/workflows/bit.ci.yml +++ b/.github/workflows/bit.ci.yml @@ -19,24 +19,23 @@ jobs: uses: actions/setup-dotnet@v4 with: global-json-file: src/global.json - - - name: Setup .NET 6,7 + + - name: Setup .NET 8 uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 6.0.x - 7.0.x + dotnet-version: | + 8.0.x - uses: actions/setup-node@v4 with: node-version: 22 - name: Install wasm and maui - run: cd src && dotnet workload install maui-android wasm-tools + run: cd src && dotnet workload install maui-android wasm-tools wasm-tools-net8 - name: Run BeforeBuildTasks continue-on-error: true # Error MSB4057, not all csproj files have BeforeBuildTasks target. - run: dotnet build src/Bit-CI-release.sln -t:BeforeBuildTasks -m:1 -f net8.0 + run: dotnet build src/Bit-CI-release.sln -t:BeforeBuildTasks -m:1 -f net9.0 - name: MSBuild prerelease run: dotnet build src/Bit-CI-release.sln @@ -58,27 +57,26 @@ jobs: uses: actions/setup-dotnet@v4 with: global-json-file: src/global.json - - - name: Setup .NET 6,7 + + - name: Setup .NET 8 uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 6.0.x - 7.0.x + dotnet-version: | + 8.0.x - uses: actions/setup-node@v4 with: node-version: 22 - name: Install wasm and maui - run: cd src && dotnet workload install maui-android wasm-tools + run: cd src && dotnet workload install maui-android wasm-tools wasm-tools-net8 - name: Install Android Sdk platform tools run: ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" - name: Run BeforeBuildTasks continue-on-error: true # Error MSB4057, not all csproj files have BeforeBuildTasks target. - run: dotnet build src/Bit-CI.sln -t:BeforeBuildTasks -m:1 -f net8.0 + run: dotnet build src/Bit-CI.sln -t:BeforeBuildTasks -m:1 -f net9.0 - name: Build run: dotnet build src/Bit-CI.sln -p:WarningLevel=0 -p:RunCodeAnalysis=false diff --git a/.github/workflows/bit.full.ci.yml b/.github/workflows/bit.full.ci.yml index 4535a3c30a..f6799fe9ad 100644 --- a/.github/workflows/bit.full.ci.yml +++ b/.github/workflows/bit.full.ci.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: env: - ConnectionStrings__SqlServerConnectionString: 'Data Source=localhost; Initial Catalog=BoilerplateDb;Application Name=Boilerplate;TrustServerCertificate=True;User Id=sa;Password=P@ssw0rdP@ssw0rd;' + ConnectionStrings__SqlServerConnectionString: 'Data Source=localhost; Initial Catalog=BoilerplateTestDb;Application Name=Boilerplate;TrustServerCertificate=True;User Id=sa;Password=P@ssw0rdP@ssw0rd;' SIMPLE_TEST_FILTER: "ClassName!~PageTests" BLAZOR_SERVER_TEST_FILTER: "ClassName~PageTests.BlazorServer" BLAZOR_WASM_TEST_FILTER: "ClassName~PageTests.BlazorWebAssembly" @@ -26,12 +26,11 @@ jobs: with: global-json-file: src/global.json - - name: Setup .NET 6,7 + - name: Setup .NET 8 uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x + 8.0.x - uses: actions/setup-node@v4 with: @@ -44,12 +43,10 @@ jobs: - name: Prepare environment run: | - cd src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/ - sed -i 's|"ServerAddress": "http://localhost:5030/",|"ServerAddress": "/",|' appsettings.json - cd ../../../../ && dotnet build -c Release + cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg && cd ../../../ - dotnet workload install maui-tizen maui-android wasm-tools + dotnet workload install maui-tizen maui-android wasm-tools wasm-tools-net8 ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools" - name: Install sql server @@ -62,7 +59,7 @@ jobs: - name: Simple tests (no --advancedTests) id: simple-test run: | - dotnet new bit-bp --name SimpleTest --database Sqlite + dotnet new bit-bp --name SimpleTest --database Sqlite --framework net8.0 cd SimpleTest/src/Server/SimpleTest.Server.Api/ dotnet tool restore dotnet ef migrations add InitialMigration @@ -83,14 +80,14 @@ jobs: - name: Test Sqlite database option id: sqlite-test run: | - dotnet new bit-bp --name TestSqlite --database Sqlite --advancedTests + dotnet new bit-bp --name TestSqlite --database Sqlite --advancedTests --framework net9.0 cd TestSqlite/src/Server/TestSqlite.Server.Api/ dotnet tool restore dotnet ef migrations add InitialMigration dotnet ef database update cd ../../Tests dotnet build - pwsh bin/Debug/net8.0/playwright.ps1 install --with-deps + pwsh bin/Debug/net9.0/playwright.ps1 install --with-deps dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_SERVER_TEST_FILTER }}" dotnet test --logger GitHubActions --filter "${{ env.BLAZOR_WASM_TEST_FILTER }}" -- MSTest.Parallelize.Workers=1 @@ -105,7 +102,7 @@ jobs: - name: Test SqlServer database option id: sqlserver-test run: | - dotnet new bit-bp --name TestSqlServer --database SqlServer --advancedTests + dotnet new bit-bp --name TestSqlServer --database SqlServer --advancedTests --framework net8.0 cd TestSqlServer/src/Server/TestSqlServer.Server.Api/ dotnet tool restore dotnet ef migrations add InitialMigration @@ -125,7 +122,7 @@ jobs: - name: Test Multilingual disabled option id: multilingual-disabled-test run: | - dotnet new bit-bp --name MultilingualDisabled --database Sqlite --advancedTests + dotnet new bit-bp --name MultilingualDisabled --database Sqlite --advancedTests --framework net8.0 cd MultilingualDisabled/src/Server/MultilingualDisabled.Server.Api/ dotnet tool restore dotnet ef migrations add InitialMigration @@ -143,58 +140,58 @@ jobs: - name: Test PostgreSQL, Cosmos, MySql, Other database options run: | - dotnet new bit-bp --name TestPostgreSQL --database PostgreSQL + dotnet new bit-bp --name TestPostgreSQL --database PostgreSQL --framework net8.0 cd TestPostgreSQL/src/Server/TestPostgreSQL.Server.Api/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestCosmos --database Cosmos + dotnet new bit-bp --name TestCosmos --database Cosmos --framework net9.0 cd TestCosmos/src/Server/TestCosmos.Server.Api/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestMySql --database MySql + dotnet new bit-bp --name TestMySql --database MySql --framework net8.0 cd TestMySql/src/Server/TestMySql.Server.Api/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestOther --database Other + dotnet new bit-bp --name TestOther --database Other --framework net9.0 cd TestOther/src/Server/TestOther.Server.Api/ dotnet build - name: Test file storage options run: | - dotnet new bit-bp --name TestLocal --filesStorage Local + dotnet new bit-bp --name TestLocal --filesStorage Local --framework net8.0 cd TestLocal/src/Server/TestLocal.Server.Api/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestAzureBlobStorage --filesStorage AzureBlobStorage + dotnet new bit-bp --name TestAzureBlobStorage --filesStorage AzureBlobStorage --framework net9.0 cd TestAzureBlobStorage/src/Server/TestAzureBlobStorage.Server.Api/ dotnet build - name: Test backend setup options run: | - dotnet new bit-bp --name TestStandalone --api Standalone + dotnet new bit-bp --name TestStandalone --api Standalone --framework net8.0 cd TestStandalone/src/Server/TestStandalone.Server.Api/ dotnet build cd ../ cd TestStandalone.Server.Web/ dotnet build cd ../../../../ - dotnet new bit-bp --name TestIntegrated --api Integrated + dotnet new bit-bp --name TestIntegrated --api Integrated --framework net9.0 cd TestIntegrated/src/Server/TestIntegrated.Server.Web/ dotnet build - name: Test sample configuration 1 run: | - dotnet new bit-bp --name TestProject --database Cosmos --filesStorage AzureBlobStorage --api Integrated --captcha reCaptcha --pipeline Azure --sample Admin --offlineDb --windows --appInsights --appCenter --signalR --notification + dotnet new bit-bp --name TestProject --database Cosmos --filesStorage AzureBlobStorage --api Integrated --captcha reCaptcha --pipeline Azure --sample Admin --offlineDb --windows --appInsights --appCenter --signalR --notification --framework net9.0 dotnet build TestProject/TestProject.sln -p:MultilingualEnabled=true -p:PwaEnabled=true -p:Environment=Staging - name: Test sample configuration 2 run: | - dotnet new bit-bp --name TestProject2 --database Other --filesStorage Other --api Standalone --captcha None --pipeline None --sample None --offlineDb false --windows false --appInsights false --appCenter false --signalR false --notification false + dotnet new bit-bp --name TestProject2 --database Other --filesStorage Other --api Standalone --captcha None --pipeline None --sample None --offlineDb false --windows false --appInsights false --appCenter false --signalR false --notification false --framework net8.0 dotnet build TestProject2/TestProject2.sln -p:MultilingualEnabled=false -p:PwaEnabled=false -p:Environment=Development - name: Run BeforeBuildTasks continue-on-error: true # Error MSB4057, not all csproj files have BeforeBuildTasks target. - run: dotnet build src/Bit-CI-release.sln -t:BeforeBuildTasks -m:1 -f net8.0 + run: dotnet build src/Bit-CI-release.sln -t:BeforeBuildTasks -m:1 -f net9.0 - name: Release build bit blazor ui + butil + bswup + besql + bup + code analyzers + source generators run: dotnet build src/Bit-CI-release.sln -c Release @@ -216,8 +213,8 @@ jobs: cd src/Templates/BlazorEmpty && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.BlazorEmpty.0.0.0.nupkg && cd ../../../ - dotnet new bit-empty --name AutoGlobal --interactivity Auto --all-interactive - dotnet new bit-empty --name SsrPerPage --interactivity None + dotnet new bit-empty --name AutoGlobal --interactivity Auto --all-interactive --framework net9.0 + dotnet new bit-empty --name SsrPerPage --interactivity None --framework net8.0 - name: Build blazor empty based projects run: | diff --git a/.github/workflows/blazorui.demo.cd.yml b/.github/workflows/blazorui.demo.cd.yml index 1a24cbab6a..1217f45e80 100644 --- a/.github/workflows/blazorui.demo.cd.yml +++ b/.github/workflows/blazorui.demo.cd.yml @@ -120,20 +120,9 @@ jobs: - name: Publish run: | cd src\BlazorUI\Demo\Client\Bit.BlazorUI.Demo.Client.Windows\ - dotnet publish Bit.BlazorUI.Demo.Client.Windows.csproj -c Release -o .\bin\publish-arm64 -r win-arm64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-arm64\Bit.BlazorUI.Demo.Client.Windows.exe Bit.BlazorUI.Demo.Client.Windows-arm64.exe - dotnet publish Bit.BlazorUI.Demo.Client.Windows.csproj -c Release -o .\bin\publish-x86 -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x86\Bit.BlazorUI.Demo.Client.Windows.exe Bit.BlazorUI.Demo.Client.Windows-x86.exe - dotnet publish Bit.BlazorUI.Demo.Client.Windows.csproj -c Release -o .\bin\publish-x64 -r win-x64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x64\Bit.BlazorUI.Demo.Client.Windows.exe Bit.BlazorUI.Demo.Client.Windows-x64.exe - dotnet publish Bit.BlazorUI.Demo.Client.Windows.csproj -c Release -o .\bin\publish -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - del .\bin\publish\Bit.BlazorUI.Demo.Client.Windows.exe - echo D | xcopy .\bin\publish-arm64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x86 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish .\publish-result /s /e /h + dotnet publish Bit.BlazorUI.Demo.Client.Windows.csproj -c Release -o .\publish-result -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" dotnet tool restore - dotnet vpk pack -u Bit.BlazorUI.Demo.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Bit.BlazorUI.Demo.Client.Windows-x86.exe -r win-x86 --framework net8.0.8-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Bit Blazor UI' + dotnet vpk pack -u Bit.BlazorUI.Demo.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e Bit.BlazorUI.Demo.Client.Windows.exe -r win-x86 --framework net9.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle 'Bit Blazor UI' - name: Upload artifact uses: actions/upload-artifact@v4 @@ -183,13 +172,13 @@ jobs: run: dotnet build src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -c Release - name: Build aab - run: dotnet build src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj -c Release -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="BitBlazorUIDemo.keystore" -p:AndroidSigningKeyAlias=bitplatform -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -f net8.0-android + run: dotnet build src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj -c Release -p:AndroidPackageFormat=aab -p:AndroidKeyStore=true -p:AndroidSigningKeyStore="BitBlazorUIDemo.keystore" -p:AndroidSigningKeyAlias=bitplatform -p:AndroidSigningKeyPass="${{ secrets.ANDROID_RELEASE_KEYSTORE_PASSWORD }}" -p:AndroidSigningStorePass="${{ secrets.ANDROID_RELEASE_SIGNING_PASSWORD }}" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -f net9.0-android - name: Upload artifact uses: actions/upload-artifact@v4 with: name: android-bundle - path: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/bin/Release/net8.0-android/*-Signed.* + path: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/bin/Release/net9.0-android/*-Signed.* build_blazor_hybrid_ios: name: build blazor hybrid (iOS-macOS) @@ -241,10 +230,10 @@ jobs: run: dotnet build src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Core/Bit.BlazorUI.Demo.Client.Core.csproj -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -c Release - name: Build ipa - run: dotnet publish src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="Bit Blazor UI Demo" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -f net8.0-ios + run: dotnet publish src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/Bit.BlazorUI.Demo.Client.Maui.csproj -p:RuntimeIdentifier=ios-arm64 -c Release -p:ArchiveOnBuild=true -p:CodesignKey="iPhone Distribution" -p:CodesignProvision="Bit Blazor UI Demo" -p:ApplicationDisplayVersion="${{ vars.APPLICATION_DISPLAY_VERSION }}" -p:ApplicationVersion="${{ vars.APPLICATION_VERSION }}" -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" -f net9.0-ios - name: Upload artifact uses: actions/upload-artifact@v4 with: name: ios-bundle - path: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/bin/release/net8.0-ios/ios-arm64/publish/*.ipa \ No newline at end of file + path: src/BlazorUI/Demo/Client/Bit.BlazorUI.Demo.Client.Maui/bin/release/net9.0-ios/ios-arm64/publish/*.ipa \ No newline at end of file diff --git a/.github/workflows/nuget.org.yml b/.github/workflows/nuget.org.yml index 369331d462..d0430d3ec8 100644 --- a/.github/workflows/nuget.org.yml +++ b/.github/workflows/nuget.org.yml @@ -45,49 +45,49 @@ jobs: encodedString: ${{ secrets.STRONG_SIGN_CERTIFICATE_BASE64 }} - name: Generate CSS/JS files BlazorUI - run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI run: dotnet pack src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Extras - run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Extras run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Extras run: dotnet pack src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Assets - run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Assets run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Assets run: dotnet pack src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Icons - run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Icons run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Icons run: dotnet pack src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj --output . --configuration Release - name: Generate CSS/JS files Bswup - run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Bswup run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Bswup run: dotnet pack src/Bswup/Bit.Bswup/Bit.Bswup.csproj --output . --configuration Release - name: Generate CSS/JS files Bup - run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Bup run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Bup run: dotnet pack src/Bup/Bit.Bup/Bit.Bup.csproj --output . --configuration Release - name: Generate CSS/JS files Butil - run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Butil run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Butil diff --git a/.github/workflows/prerelease.nuget.org.yml b/.github/workflows/prerelease.nuget.org.yml index cd465fc4ee..04c631c819 100644 --- a/.github/workflows/prerelease.nuget.org.yml +++ b/.github/workflows/prerelease.nuget.org.yml @@ -35,49 +35,49 @@ jobs: encodedString: ${{ secrets.STRONG_SIGN_CERTIFICATE_BASE64 }} - name: Generate CSS/JS files BlazorUI - run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI run: dotnet build src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI run: dotnet pack src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Extras - run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Extras run: dotnet build src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Extras run: dotnet pack src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Assets - run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Assets run: dotnet build src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Assets run: dotnet pack src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj --output . --configuration Release - name: Generate CSS/JS files BlazorUI.Icons - run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build BlazorUI.Icons run: dotnet build src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack BlazorUI.Icons run: dotnet pack src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj --output . --configuration Release - name: Generate CSS/JS files Bswup - run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Bswup run: dotnet build src/Bswup/Bit.Bswup/Bit.Bswup.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Bswup run: dotnet pack src/Bswup/Bit.Bswup/Bit.Bswup.csproj --output . --configuration Release - name: Generate CSS/JS files Bup - run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Bup run: dotnet build src/Bup/Bit.Bup/Bit.Bup.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Bup run: dotnet pack src/Bup/Bit.Bup/Bit.Bup.csproj --output . --configuration Release - name: Generate CSS/JS files Butil - run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -t:BeforeBuildTasks --no-restore -f:net8.0 -c Release + run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -t:BeforeBuildTasks --no-restore -f:net9.0 -c Release - name: dotnet build Butil run: dotnet build src/Butil/Bit.Butil/Bit.Butil.csproj -c Release -p:GeneratePackageOnBuild=false -p:WarningLevel=0 -p:RunCodeAnalysis=false - name: dotnet pack Butil diff --git a/.github/workflows/todo-sample.cd.yml b/.github/workflows/todo-sample.cd.yml index 83f2d4a09f..ef492cf4cb 100644 --- a/.github/workflows/todo-sample.cd.yml +++ b/.github/workflows/todo-sample.cd.yml @@ -1,4 +1,4 @@ -name: Todo Sample CD +name: Todo Sample CD # Project templates come equipped with CI/CD for both Azure DevOps and GitHub, providing you with a hassle-free way to get started with your new project. It is important to note that you should not depend on the contents of this file. More info at https://bitplatform.dev/templates/dev-ops @@ -24,10 +24,14 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 + - name: Remove .NET 9 based global.json + run: | + rm src/global.json + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global.json + global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global8.json - uses: actions/setup-node@v4 with: @@ -38,7 +42,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha + cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --framework net8.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -55,11 +59,16 @@ jobs: - name: Install wasm run: cd src && dotnet workload install wasm-tools + - name: Configure bswup + run: | + sed -i 's/\/\/ self.noPrerenderQuery/self.noPrerenderQuery/g' TodoSample/src/Client/TodoSample.Client.Web/wwwroot/service-worker.published.js + sed -i 's/\/\/ self.disablePassiveFirstBoot/self.disablePassiveFirstBoot/g' TodoSample/src/Client/TodoSample.Client.Web/wwwroot/service-worker.published.js + - name: Generate CSS/JS files run: dotnet build TodoSample/src/Client/TodoSample.Client.Core/TodoSample.Client.Core.csproj -t:BeforeBuildTasks -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" --no-restore -c Release - name: Publish - run: dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release -p:PwaEnabled=true -p:PublishTrimmed=true -p:TrimMode=partial -p:JsonSerializerIsReflectionEnabledByDefault=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" + run: dotnet publish TodoSample/src/Server/TodoSample.Server.Web/TodoSample.Server.Web.csproj -c Release -p:PwaEnabled=true --self-contained -r linux-x64 -o ${{env.DOTNET_ROOT}}/server -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - name: Upload server artifact uses: actions/upload-artifact@v4 @@ -118,10 +127,14 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 + - name: Remove .NET 9 based global.json + run: | + rm src/global.json + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - global-json-file: src\Templates\Boilerplate\Bit.Boilerplate\global.json + global-json-file: src\Templates\Boilerplate\Bit.Boilerplate\global8.json - uses: actions/setup-node@v4 with: @@ -132,7 +145,7 @@ jobs: cd src\Templates\Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --windows --appInsights --appCenter --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha + cd ..\..\..\ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --windows --appInsights --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --captcha reCaptcha --framework net8.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 @@ -144,10 +157,6 @@ jobs: WindowsUpdate.FilesUrl: https://windows-todo.bitplatform.dev ApplicationInsights.ConnectionString: ${{ secrets.APPLICATION_INSIGHTS_CONNECTION_STRING }} - - name: Set app center secret - run: (Get-Content TodoSample\src\Client\TodoSample.Client.Windows\Program.cs) -Replace 'appCenterSecret = null;', 'appCenterSecret = "39f576f2-7c16-4990-af3f-7b70509d41e2";' | Out-File -Encoding utf8 TodoSample\src\Client\TodoSample.Client.Windows\Program.cs - shell: pwsh - - name: Delete App Splash Screen run: rm TodoSample/src/Client/TodoSample.Client.Windows/Resources/SplashScreen.png @@ -164,20 +173,9 @@ jobs: - name: Publish run: | cd TodoSample\src\Client\TodoSample.Client.Windows\ - dotnet publish TodoSample.Client.Windows.csproj -c Release -o .\bin\publish-arm64 -r win-arm64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-arm64\TodoSample.Client.Windows.exe TodoSample.Client.Windows-arm64.exe - dotnet publish TodoSample.Client.Windows.csproj -c Release -o .\bin\publish-x86 -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x86\TodoSample.Client.Windows.exe TodoSample.Client.Windows-x86.exe - dotnet publish TodoSample.Client.Windows.csproj -c Release -o .\bin\publish-x64 -r win-x64 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - ren .\bin\publish-x64\TodoSample.Client.Windows.exe TodoSample.Client.Windows-x64.exe - dotnet publish TodoSample.Client.Windows.csproj -c Release -o .\bin\publish -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" - del .\bin\publish\TodoSample.Client.Windows.exe - echo D | xcopy .\bin\publish-arm64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x86 .\publish-result /s /e /h - echo A | xcopy .\bin\publish-x64 .\publish-result /s /e /h - echo A | xcopy .\bin\publish .\publish-result /s /e /h + dotnet publish TodoSample.Client.Windows.csproj -c Release -o .\publish-result -r win-x86 -p:Version="${{ vars.APPLICATION_DISPLAY_VERSION}}" dotnet tool restore - dotnet vpk pack -u TodoSample.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e TodoSample.Client.Windows-x86.exe -r win-x86 --framework net8.0.8-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle TodoSample + dotnet vpk pack -u TodoSample.Client.Windows -v "${{ vars.APPLICATION_DISPLAY_VERSION }}" -p .\publish-result -e TodoSample.Client.Windows.exe -r win-x86 --framework net8.0-x86-desktop,webview2 --icon .\wwwroot\favicon.ico --packTitle TodoSample - name: Upload artifact uses: actions/upload-artifact@v4 @@ -194,10 +192,14 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 + - name: Remove .NET 9 based global.json + run: | + rm src/global.json + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global.json + global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global8.json - uses: actions/setup-node@v4 with: @@ -208,7 +210,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha + cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --framework net8.0 - name: Extract Android signing key from env uses: timheuer/base64-to-file@v1.2 @@ -286,10 +288,14 @@ jobs: - name: Checkout source code uses: actions/checkout@v4 + - name: Remove .NET 9 based global.json + run: | + rm src/global.json + - name: Setup .NET uses: actions/setup-dotnet@v4 with: - global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global.json + global-json-file: src/Templates/Boilerplate/Bit.Boilerplate/global8.json - uses: actions/setup-node@v4 with: @@ -304,7 +310,7 @@ jobs: cd src/Templates/Boilerplate && dotnet build -c Release dotnet pack -c Release -o . -p:ReleaseVersion=0.0.0 -p:PackageVersion=0.0.0 dotnet new install Bit.Boilerplate.0.0.0.nupkg - cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha + cd ../../../ && dotnet new bit-bp --name TodoSample --database PostgreSQL --sample Todo --appInsights --appCenter --serverUrl ${{ env.SERVER_ADDRESS }} --filesStorage AzureBlobStorage --notification --captcha reCaptcha --framework net8.0 - name: Update core appsettings.json uses: devops-actions/variable-substitution@v1.2 diff --git a/README.md b/README.md index 986bb2d79e..d189ce9e8f 100644 --- a/README.md +++ b/README.md @@ -44,10 +44,10 @@ The following apps are our open-source projects powered by the bit platform show | AdminPanel | [![Prerendered PWA](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251381583-8b8eb895-80c9-4811-9641-57a5a08db163.png)](https://adminpanel.bitplatform.dev) | [![iOS app](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251381842-e72976ce-fd20-431d-a677-ca1ed625b83b.png)](https://apps.apple.com/us/app/bit-adminpanel/id6450611349) | [![Android app](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251381958-24931682-87f6-44fc-a1c7-eecf46387005.png)](https://play.google.com/store/apps/details?id=com.bitplatform.AdminPanel.Template) | [![Windows app](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251382080-9ae97fea-934c-4097-aca4-124a2aed1595.png)](https://windows-admin.bitplatform.dev/AdminPanel.Client.Windows-win-Setup.exe) | [![macOS app](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251382211-0d58f9ba-1a1f-4481-a0ca-b23a393cca9f.png)](https://apps.apple.com/nl/app/bit-adminpanel/id6450611349) | | bitplatform | [![SPA](https://github-production-user-asset-6210df.s3.amazonaws.com/6169846/251395129-71a5a79c-af74-4d4e-a0f7-ed9a15cf2e46.png)](https://bitplatform.dev)| -1. [bitplatform.dev](https://bitplatform.dev): Pre-rendered SPA with Blazor WebAssembly -2. [blazorui.bitplatform.dev](https://blazorui.bitplatform.dev): Pre-rendered PWA with Blazor Auto -3. [todo.bitplatform.dev](https://todo.bitplatform.dev): Pre-rendered PWA with Blazor WebAssembly -5. [adminpanel.bitplatform.dev](https://adminpanel.bitplatform.dev): PWA with Blazor WebAssembly Standalone (Hosted on Cloudflare Pages) +1. [bitplatform.dev](https://bitplatform.dev): .NET 9 Pre-rendered SPA with Blazor WebAssembly +2. [blazorui.bitplatform.dev](https://blazorui.bitplatform.dev): .NET 9 Pre-rendered PWA with Blazor WebAssembly +3. [todo.bitplatform.dev](https://todo.bitplatform.dev): .NET 8 Pre-rendered PWA with Blazor WebAssembly +5. [adminpanel.bitplatform.dev](https://adminpanel.bitplatform.dev): .NET 9 PWA with Blazor WebAssembly Standalone (Hosted on Cloudflare Pages) [Todo](https://todo.bitplatform.dev) & [Adminpanel](https://adminpanel.bitplatform.dev) web apps will launch their respective Android and iOS applications if you have already installed them, mirroring the behavior of apps like YouTube and Instagram. diff --git a/docs/how-to-build.md b/docs/how-to-build.md index 2ba7aa1569..d850c5aef6 100644 --- a/docs/how-to-build.md +++ b/docs/how-to-build.md @@ -22,7 +22,7 @@ building each one of them requires some specific steps that are explained below. Building each of the bit platform projects needs the following basic requirements other than the specific requirements that are explained later: -- [.NET 8 SDK (8.0.401)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0) +- [.NET 9 SDK (9.0.100)](https://dotnet.microsoft.com/en-us/download/dotnet/9.0) - [Node.js](https://nodejs.org)
diff --git a/src/Besql/Bit.Besql/Bit.Besql.csproj b/src/Besql/Bit.Besql/Bit.Besql.csproj index 4049ac8770..5910c31fad 100644 --- a/src/Besql/Bit.Besql/Bit.Besql.csproj +++ b/src/Besql/Bit.Besql/Bit.Besql.csproj @@ -3,7 +3,7 @@ - net8.0 + net9.0;net8.0 enable enable True @@ -16,8 +16,10 @@ - - + + + + diff --git a/src/Besql/Bit.Besql/wwwroot/bit-besql.js b/src/Besql/Bit.Besql/wwwroot/bit-besql.js index 7560d6a59f..40f2c9d96b 100644 --- a/src/Besql/Bit.Besql/wwwroot/bit-besql.js +++ b/src/Besql/Bit.Besql/wwwroot/bit-besql.js @@ -1,5 +1,5 @@ var BitBesql = BitBesql || {}; -BitBesql.version = window['bit-besql version'] = '8.12.0'; +BitBesql.version = window['bit-besql version'] = '9.0.0'; async function synchronizeDbWithCache(file) { @@ -25,14 +25,14 @@ async function synchronizeDbWithCache(file) { if (res) { console.log(`Restoring ${res.byteLength} bytes.`); - window.Module.FS.writeFile(backupPath, new Uint8Array(res)); + window.Blazor.runtime.Module.FS.writeFile(backupPath, new Uint8Array(res)); return 0; } } return -1; } - if (window.Module.FS.analyzePath(backupPath).exists) { + if (window.Blazor.runtime.Module.FS.analyzePath(backupPath).exists) { const waitFlush = new Promise((done, _) => { setTimeout(done, 10); @@ -40,7 +40,7 @@ async function synchronizeDbWithCache(file) { await waitFlush; - const data = window.Module.FS.readFile(backupPath); + const data = window.Blazor.runtime.Module.FS.readFile(backupPath); const blob = new Blob([data], { type: 'application/octet-stream', @@ -58,7 +58,7 @@ async function synchronizeDbWithCache(file) { await db.cache.put(cachePath, response); - window.Module.FS.unlink(backupPath); + window.Blazor.runtime.Module.FS.unlink(backupPath); return 1; } diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Bit.Besql.Demo.Client.csproj b/src/Besql/Demo/Bit.Besql.Demo.Client/Bit.Besql.Demo.Client.csproj index 31dd6dd5bf..2c2de73701 100644 --- a/src/Besql/Demo/Bit.Besql.Demo.Client/Bit.Besql.Demo.Client.csproj +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Bit.Besql.Demo.Client.csproj @@ -1,20 +1,20 @@ - + - - net8.0 - enable - enable - true - Default - true - + + net9.0 + enable + enable + true + Default + true + - - - + + + - - - + + + diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextAssemblyAttributes.cs b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextAssemblyAttributes.cs new file mode 100644 index 0000000000..3b0eb2469e --- /dev/null +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextAssemblyAttributes.cs @@ -0,0 +1,9 @@ +// +using Bit.Besql.Demo.Client.Data; +using Bit.Besql.Demo.Client.Data.CompiledModel; +using Microsoft.EntityFrameworkCore.Infrastructure; + +#pragma warning disable 219, 612, 618 +#nullable disable + +[assembly: DbContextModel(typeof(OfflineDbContext), typeof(OfflineDbContextModel))] diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModel.cs b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModel.cs new file mode 100644 index 0000000000..eb58793782 --- /dev/null +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModel.cs @@ -0,0 +1,47 @@ +// +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Bit.Besql.Demo.Client.Data.CompiledModel +{ + [DbContext(typeof(OfflineDbContext))] + public partial class OfflineDbContextModel : RuntimeModel + { + private static readonly bool _useOldBehavior31751 = + System.AppContext.TryGetSwitch("Microsoft.EntityFrameworkCore.Issue31751", out var enabled31751) && enabled31751; + + static OfflineDbContextModel() + { + var model = new OfflineDbContextModel(); + + if (_useOldBehavior31751) + { + model.Initialize(); + } + else + { + var thread = new System.Threading.Thread(RunInitialization, 10 * 1024 * 1024); + thread.Start(); + thread.Join(); + + void RunInitialization() + { + model.Initialize(); + } + } + + model.Customize(); + _instance = (OfflineDbContextModel)model.FinalizeModel(); + } + + private static OfflineDbContextModel _instance; + public static IModel Instance => _instance; + + partial void Initialize(); + + partial void Customize(); + } +} diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModelBuilder.cs b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModelBuilder.cs new file mode 100644 index 0000000000..9918c918f3 --- /dev/null +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/OfflineDbContextModelBuilder.cs @@ -0,0 +1,27 @@ +// +using System; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Bit.Besql.Demo.Client.Data.CompiledModel +{ + public partial class OfflineDbContextModel + { + private OfflineDbContextModel() + : base(skipDetectChanges: false, modelId: new Guid("83924357-cac0-4352-b1b4-39edcbc1a1e3"), entityTypeCount: 1) + { + } + + partial void Initialize() + { + var weatherForecast = WeatherForecastEntityType.Create(this); + + WeatherForecastEntityType.CreateAnnotations(weatherForecast); + + AddAnnotation("ProductVersion", "9.0.0"); + } + } +} diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/WeatherForecastEntityType.cs b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/WeatherForecastEntityType.cs new file mode 100644 index 0000000000..0e2494de50 --- /dev/null +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/CompiledModel/WeatherForecastEntityType.cs @@ -0,0 +1,83 @@ +// +using System; +using System.Reflection; +using Bit.Besql.Demo.Client.Model; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#pragma warning disable 219, 612, 618 +#nullable disable + +namespace Bit.Besql.Demo.Client.Data.CompiledModel +{ + [EntityFrameworkInternal] + public partial class WeatherForecastEntityType + { + public static RuntimeEntityType Create(RuntimeModel model, RuntimeEntityType baseEntityType = null) + { + var runtimeEntityType = model.AddEntityType( + "Bit.Besql.Demo.Client.Model.WeatherForecast", + typeof(WeatherForecast), + baseEntityType, + propertyCount: 4, + unnamedIndexCount: 1, + keyCount: 1); + + var id = runtimeEntityType.AddProperty( + "Id", + typeof(int), + propertyInfo: typeof(WeatherForecast).GetProperty("Id", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WeatherForecast).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueGenerated: ValueGenerated.OnAdd, + afterSaveBehavior: PropertySaveBehavior.Throw, + sentinel: 0); + + var date = runtimeEntityType.AddProperty( + "Date", + typeof(DateTimeOffset), + propertyInfo: typeof(WeatherForecast).GetProperty("Date", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WeatherForecast).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + valueConverter: new DateTimeOffsetToBinaryConverter()); + date.SetSentinelFromProviderValue(0L); + + var summary = runtimeEntityType.AddProperty( + "Summary", + typeof(string), + propertyInfo: typeof(WeatherForecast).GetProperty("Summary", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WeatherForecast).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + nullable: true, + maxLength: 100); + + var temperatureC = runtimeEntityType.AddProperty( + "TemperatureC", + typeof(int), + propertyInfo: typeof(WeatherForecast).GetProperty("TemperatureC", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly), + fieldInfo: typeof(WeatherForecast).GetField("k__BackingField", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly), + sentinel: 0); + + var key = runtimeEntityType.AddKey( + new[] { id }); + runtimeEntityType.SetPrimaryKey(key); + + var index = runtimeEntityType.AddIndex( + new[] { temperatureC }); + + return runtimeEntityType; + } + + public static void CreateAnnotations(RuntimeEntityType runtimeEntityType) + { + runtimeEntityType.AddAnnotation("Relational:FunctionName", null); + runtimeEntityType.AddAnnotation("Relational:Schema", null); + runtimeEntityType.AddAnnotation("Relational:SqlQuery", null); + runtimeEntityType.AddAnnotation("Relational:TableName", "WeatherForecasts"); + runtimeEntityType.AddAnnotation("Relational:ViewName", null); + runtimeEntityType.AddAnnotation("Relational:ViewSchema", null); + + Customize(runtimeEntityType); + } + + static partial void Customize(RuntimeEntityType runtimeEntityType); + } +} diff --git a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/OfflineDbContext.cs b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/OfflineDbContext.cs index 94d61448e8..d22ebe6cc8 100644 --- a/src/Besql/Demo/Bit.Besql.Demo.Client/Data/OfflineDbContext.cs +++ b/src/Besql/Demo/Bit.Besql.Demo.Client/Data/OfflineDbContext.cs @@ -1,5 +1,6 @@ using Bit.Besql.Demo.Client.Model; using Microsoft.EntityFrameworkCore; +using Bit.Besql.Demo.Client.Data.CompiledModel; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Bit.Besql.Demo.Client.Data; @@ -29,7 +30,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder - // .UseModel(OfflineDbContextModel.Instance) // use generated compiled model in order to make db context optimized + .UseModel(OfflineDbContextModel.Instance) // use generated compiled model in order to make db context optimized .UseSqlite("Data Source=Offline-ClientDb.db"); base.OnConfiguring(optionsBuilder); diff --git a/src/Besql/Demo/Bit.Besql.Demo/Bit.Besql.Demo.csproj b/src/Besql/Demo/Bit.Besql.Demo/Bit.Besql.Demo.csproj index c9a750a921..9750703360 100644 --- a/src/Besql/Demo/Bit.Besql.Demo/Bit.Besql.Demo.csproj +++ b/src/Besql/Demo/Bit.Besql.Demo/Bit.Besql.Demo.csproj @@ -1,14 +1,14 @@ - + - net8.0 + net9.0 enable enable - + @@ -19,13 +19,13 @@ and open Nuget Package Manager Console, and select `Bit.Besql.Demo` project as default project Then run either Add-Migration MigrationName -OutputDir Data\Migrations or Optimize-DbContext -OutputDir Data/CompiledModel commands. --> - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - all - runtime; build; native; contentfiles; analyzers; buildtransitive + + all + runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/Besql/Demo/Bit.Besql.Demo/Program.cs b/src/Besql/Demo/Bit.Besql.Demo/Program.cs index 7d36290de4..2d399adc81 100644 --- a/src/Besql/Demo/Bit.Besql.Demo/Program.cs +++ b/src/Besql/Demo/Bit.Besql.Demo/Program.cs @@ -1,4 +1,4 @@ -using Bit.Besql.Demo.Client.Data; +using Bit.Besql.Demo.Client.Data; using Bit.Besql.Demo.Client.Pages; using Bit.Besql.Demo.Components; using Microsoft.EntityFrameworkCore; @@ -31,6 +31,7 @@ app.UseStaticFiles(); app.UseAntiforgery(); +app.MapStaticAssets(); app.MapRazorComponents() .AddInteractiveServerRenderMode() .AddInteractiveWebAssemblyRenderMode() diff --git a/src/Bit.Build.props b/src/Bit.Build.props index 6efc6d1da5..acbd21534e 100644 --- a/src/Bit.Build.props +++ b/src/Bit.Build.props @@ -25,7 +25,7 @@ https://github.com/bitfoundation/bitplatform https://avatars.githubusercontent.com/u/22663390 - 8.12.0 + 9.0.0 https://github.com/bitfoundation/bitplatform/releases/tag/v-$(ReleaseVersion) $(ReleaseVersion) diff --git a/src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj b/src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj index 5dc6f0849e..ddbbc6edd9 100644 --- a/src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj +++ b/src/BlazorUI/Bit.BlazorUI.Assets/Bit.BlazorUI.Assets.csproj @@ -3,10 +3,10 @@ - net8.0;net7.0;net6.0 + net9.0;net8.0 Bit.BlazorUI 0 - + BeforeBuildTasks; $(ResolveStaticWebAssetsInputsDependsOn) @@ -23,7 +23,7 @@ - + diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj b/src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj index e2d356b695..be0b23b41b 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Bit.BlazorUI.Extras.csproj @@ -3,12 +3,12 @@ - net8.0;net7.0;net6.0 + net9.0;net8.0 enable Bit.BlazorUI true 0 - + BeforeBuildTasks; $(ResolveStaticWebAssetsInputsDependsOn) @@ -24,9 +24,8 @@ all - - + @@ -57,10 +56,10 @@ - - - - + + + + diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss index ec3be56fd7..e3cf74ab70 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/BitDataGrid.scss @@ -116,10 +116,12 @@ flex-grow: 1; display: flex; /* So that we can make col-title-text expand as much as possible, and still hide overflow with ellipsis */ min-width: 0px; + font-size: 1rem; } /* If the column is sortable, its title is rendered as a button element for accessibility and to support navigation by tab */ button.col-title { border: none; + color: inherit; cursor: pointer; background: none; position: relative; diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginationState.cs b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginationState.cs index 9a24839afb..05b66e352e 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginationState.cs +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginationState.cs @@ -5,15 +5,20 @@ /// public class BitDataGridPaginationState { + /// + /// Gets the current zero-based page index. To set it, call . + /// + public int CurrentPageIndex { get; private set; } + /// /// Gets or sets the number of items on each page. /// public int ItemsPerPage { get; set; } = 10; /// - /// Gets the current zero-based page index. To set it, call . + /// Gets the zero-based index of the last page, if known. The value will be null until is known. /// - public int CurrentPageIndex { get; private set; } + public int? LastPageIndex => (TotalItemCount - 1) / ItemsPerPage; /// /// Gets the total number of items across all pages, if known. The value will be null until an @@ -21,11 +26,6 @@ public class BitDataGridPaginationState /// public int? TotalItemCount { get; private set; } - /// - /// Gets the zero-based index of the last page, if known. The value will be null until is known. - /// - public int? LastPageIndex => (TotalItemCount - 1) / ItemsPerPage; - /// /// An event that is raised when the total item count has changed. /// diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor index 2ece139ac7..2fa1f8fef9 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor @@ -6,7 +6,11 @@
@if (SummaryTemplate is not null) { - @SummaryTemplate + @SummaryTemplate(Value) + } + else if (SummaryFormat is not null) + { + @SummaryFormat(Value) } else { @@ -14,14 +18,44 @@ }
} diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor.cs b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor.cs index 57f036b321..140c9a2847 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor.cs +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.razor.cs @@ -8,14 +8,49 @@ public partial class BitDataGridPaginator : IDisposable private readonly EventCallbackSubscriber _totalItemCountChanged; /// - /// Specifies the associated . This parameter is required. + /// The title of the go to first page button. /// - [Parameter, EditorRequired] public BitDataGridPaginationState Value { get; set; } = default!; + [Parameter] public string GoToFirstButtonTitle { get; set; } = "Go to first page"; + + /// + /// The title of the go to previous page button. + /// + [Parameter] public string GoToPrevButtonTitle { get; set; } = "Go to previous page"; + + /// + /// The title of the go to next page button. + /// + [Parameter] public string GoToNextButtonTitle { get; set; } = "Go to next page"; + + /// + /// The title of the go to last page button. + /// + [Parameter] public string GoToLastButtonTitle { get; set; } = "Go to last page"; + + /// + /// Optionally supplies a format for rendering the page count summary. + /// + [Parameter] public Func? SummaryFormat { get; set; } /// /// Optionally supplies a template for rendering the page count summary. /// - [Parameter] public RenderFragment? SummaryTemplate { get; set; } + [Parameter] public RenderFragment? SummaryTemplate { get; set; } + + /// + /// The optional custom format for the main text of the paginator in the middle of it. + /// + [Parameter] public Func? TextFormat { get; set; } + + /// + /// The optional custom template for the main text of the paginator in the middle of it. + /// + [Parameter] public RenderFragment? TextTemplate { get; set; } + + /// + /// Specifies the associated . This parameter is required. + /// + [Parameter, EditorRequired] public BitDataGridPaginationState Value { get; set; } = default!; /// /// Constructs an instance of . diff --git a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.scss b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.scss index 04cda8f09b..04010c2c1a 100644 --- a/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.scss +++ b/src/BlazorUI/Bit.BlazorUI.Extras/Components/DataGrid/Pagination/BitDataGridPaginator.scss @@ -57,3 +57,15 @@ transform: scaleX(-1); } } + +[dir=rtl] { + .bitdatagrid-paginator { + .go-next, .go-last { + transform: scaleX(1); + } + + .go-previous, .go-first { + transform: scaleX(-1); + } + } +} diff --git a/src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj b/src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj index 358bb5f7dd..d6d4fa27b7 100644 --- a/src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj +++ b/src/BlazorUI/Bit.BlazorUI.Icons/Bit.BlazorUI.Icons.csproj @@ -3,10 +3,10 @@ - net8.0;net7.0;net6.0 + net9.0;net8.0 Bit.BlazorUI 0 - + BeforeBuildTasks; $(ResolveStaticWebAssetsInputsDependsOn) @@ -26,7 +26,7 @@ - + diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Bit.BlazorUI.Tests.csproj b/src/BlazorUI/Bit.BlazorUI.Tests/Bit.BlazorUI.Tests.csproj index 70cf41fb96..f204e95372 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Bit.BlazorUI.Tests.csproj +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Bit.BlazorUI.Tests.csproj @@ -1,7 +1,7 @@  - net8.0;net7.0;net6.0 + net9.0;net8.0 false 11.0 @@ -13,10 +13,10 @@ - + - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs index 84b5f9207c..96a5108ba0 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/Dropdown/BitDropdownTests.cs @@ -903,6 +903,12 @@ public void BitDropdownVirtualizeTest(bool virtualize, int? itemSize, int? overs //https://bunit.dev/docs/test-doubles/emulating-ijsruntime.html#-jsinterop-emulation const double viewportHeight = 1_000_000_000; var items = GetRangeDropdownItems(500); + + // To ensure a consistent display structure in the Virtualize component across .NET 9 and .NET 8, + // we've set the default value of MaxItemCount to 100. This means that even if a higher value is specified, + // only a maximum of 100 items will be rendered by default. + AppContext.SetData("Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize.MaxItemCount", 100); + var component = RenderComponent, string>>(parameters => { parameters.Add(p => p.IsEnabled, true); @@ -931,6 +937,7 @@ public void BitDropdownVirtualizeTest(bool virtualize, int? itemSize, int? overs { //When virtualize is true, number of rendered items is greater than number of items show in the list + 2 * overScanCount. var expectedRenderedItemCount = Math.Ceiling((decimal)(viewportHeight / component.Instance.ItemSize)) + (2 * component.Instance.OverscanCount); + expectedRenderedItemCount = Math.Min(expectedRenderedItemCount, 100); //When actualRenderedItemCount is smaller than expectedRenderedItemCount, so show all items in viewport then actualRenderedItemCount equals total items count if (actualRenderedItemCount < expectedRenderedItemCount) @@ -1051,9 +1058,9 @@ private void HandleValuesChanged(IEnumerable values) new() { Text = "Banana", Value = "f-ban" }, new() { Text = "Broccoli", Value = "v-bro" } }; - - private static ICollection> GetRangeDropdownItems(int count) => + + private static ICollection> GetRangeDropdownItems(int count) => Enumerable.Range(1, count).Select(item => new BitDropdownItem { ItemType = BitDropdownItemType.Normal, diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/FileUpload/BitFileUploadTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/FileUpload/BitFileUploadTests.cs index 2d724f6ef3..d90edf040d 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/FileUpload/BitFileUploadTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Inputs/FileUpload/BitFileUploadTests.cs @@ -27,15 +27,15 @@ public void BitUploadFileHasBasicClass(bool isEnabled) DataRow(true), DataRow(false) ] - public void BitFileUploadMultipleAttributeTest(bool isMultiSelect) + public void BitFileUploadMultipleAttributeTest(bool isMultiple) { var com = RenderComponent(parameters => { - parameters.Add(p => p.MultiSelect, isMultiSelect); + parameters.Add(p => p.Multiple, isMultiple); }); var bitFileUpload = com.Find(".bit-upl-fi"); - Assert.AreEqual(isMultiSelect, bitFileUpload.HasAttribute("multiple")); + Assert.AreEqual(isMultiple, bitFileUpload.HasAttribute("multiple")); } [TestMethod] diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Lists/BasicList/BitBasicListTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Lists/BasicList/BitBasicListTests.cs index 36b72a53c3..b1266f6fd0 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Lists/BasicList/BitBasicListTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Lists/BasicList/BitBasicListTests.cs @@ -26,6 +26,11 @@ public void BitBasicListShouldRenderExpectedChildElements(bool virtualize, int? Context.JSInterop.Mode = JSRuntimeMode.Loose; + // To ensure a consistent display structure in the Virtualize component across .NET 9 and .NET 8, + // we've set the default value of MaxItemCount to 100. This means that even if a higher value is specified, + // only a maximum of 100 items will be rendered by default. + AppContext.SetData("Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize.MaxItemCount", 100); + var component = RenderComponent(parameters => { parameters.Add(p => p.Virtualize, virtualize); @@ -42,6 +47,8 @@ public void BitBasicListShouldRenderExpectedChildElements(bool virtualize, int? { //When virtualize is true, number of rendered items is greater than number of items show in the list + 2 * overScanCount. var expectedRenderedItemCount = Math.Ceiling((decimal)(viewportHeight / component.Instance.ItemSize)) + (2 * component.Instance.OverscanCount); + expectedRenderedItemCount = Math.Min(expectedRenderedItemCount, 100); + var actualRenderedItemCount = bitList.GetElementsByClassName("list-item").Length; //When actualRenderedItemCount is smaller than expectedRenderedItemCount, so show all items in viewport then actualRenderedItemCount equals total items count diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Link/BitLinkTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Link/BitLinkTests.cs index 905bbe19d5..38583c7bad 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Link/BitLinkTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Link/BitLinkTests.cs @@ -603,16 +603,16 @@ public void BitLinkShouldRespectHtmlAttributes(string href) [DataTestMethod, DataRow(null, null), - DataRow(null, BitAnchorRel.Bookmark), - DataRow(null, BitAnchorRel.Bookmark | BitAnchorRel.Alternate), + DataRow(null, BitLinkRel.Bookmark), + DataRow(null, BitLinkRel.Bookmark | BitLinkRel.Alternate), DataRow("https://bitplatform.dev", null), - DataRow("https://bitplatform.dev", BitAnchorRel.Bookmark), - DataRow("https://bitplatform.dev", BitAnchorRel.Bookmark | BitAnchorRel.Alternate), + DataRow("https://bitplatform.dev", BitLinkRel.Bookmark), + DataRow("https://bitplatform.dev", BitLinkRel.Bookmark | BitLinkRel.Alternate), DataRow("#go-to-section", null), - DataRow("#go-to-section", BitAnchorRel.Bookmark), - DataRow("#go-to-section", BitAnchorRel.Bookmark | BitAnchorRel.Alternate) + DataRow("#go-to-section", BitLinkRel.Bookmark), + DataRow("#go-to-section", BitLinkRel.Bookmark | BitLinkRel.Alternate) ] - public void BitLinkShouldRespectTarget(string href, BitAnchorRel? rel) + public void BitLinkShouldRespectTarget(string href, BitLinkRel? rel) { var component = RenderComponent(parameters => { @@ -630,7 +630,7 @@ public void BitLinkShouldRespectTarget(string href, BitAnchorRel? rel) { if (rel.HasValue) { - var rels = string.Join(" ", Enum.GetValues(typeof(BitAnchorRel)).Cast().Where(r => rel.Value.HasFlag(r)).Select(r => r.ToString().ToLower())); + var rels = string.Join(" ", Enum.GetValues(typeof(BitLinkRel)).Cast().Where(r => rel.Value.HasFlag(r)).Select(r => r.ToString().ToLower())); component.MarkupMatches(@$""); } diff --git a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Stack/BitStackTests.cs b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Stack/BitStackTests.cs index 5a08dba411..ab98936f24 100644 --- a/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Stack/BitStackTests.cs +++ b/src/BlazorUI/Bit.BlazorUI.Tests/Components/Utilities/Stack/BitStackTests.cs @@ -420,6 +420,52 @@ public void BitStackShouldRespectHorizontalChangingAfterRender() component.MarkupMatches(@$"
"); } + [DataTestMethod, + DataRow(null), + DataRow(BitAlignment.Start), + DataRow(BitAlignment.End), + DataRow(BitAlignment.Center), + DataRow(BitAlignment.SpaceBetween), + DataRow(BitAlignment.SpaceAround), + DataRow(BitAlignment.SpaceEvenly), + DataRow(BitAlignment.Baseline), + DataRow(BitAlignment.Stretch) + ] + public void BitStackShouldRespectAlignment(BitAlignment? alignment) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.Alignment, alignment); + }); + + if (alignment.HasValue) + { + var jc = _AlignmentMap[alignment.Value]; + var ai = _AlignmentMap[alignment.Value]; + + component.MarkupMatches(@$"
"); + } + else + { + component.MarkupMatches(@$"
"); + } + } + + [DataTestMethod] + public void BitStackShouldRespectAlignmentChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@$"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.Alignment, BitAlignment.SpaceBetween); + }); + + component.MarkupMatches(@$"
"); + } + [DataTestMethod, DataRow(BitAlignment.Start), DataRow(BitAlignment.End), @@ -498,7 +544,7 @@ public void BitStackShouldRespectReversedChangingAfterRender() DataRow(BitAlignment.Baseline), DataRow(BitAlignment.Stretch) ] - public void BitStackShouldRespectBitAlignment(BitAlignment verticalAlign) + public void BitStackShouldRespectVerticalAlign(BitAlignment verticalAlign) { var component = RenderComponent(parameters => { @@ -626,20 +672,20 @@ public void BitStackShouldRespectHorizontalAndReversedAndHorizontalAlignAndVerti DataRow(true), DataRow(false) ] - public void BitStackShouldRespectFull(bool full) + public void BitStackShouldRespectAutoSize(bool autoSize) { var component = RenderComponent(parameters => { - parameters.Add(p => p.AutoSize, full); + parameters.Add(p => p.AutoSize, autoSize); }); - var style = full ? "width:auto;height:auto;" : null; + var style = autoSize ? "width:auto;height:auto;" : null; component.MarkupMatches(@$"
"); } [DataTestMethod] - public void BitStackShouldRespectFullChangingAfterRender() + public void BitStackShouldRespectAutoSizeChangingAfterRender() { var component = RenderComponent(); @@ -657,7 +703,7 @@ public void BitStackShouldRespectFullChangingAfterRender() DataRow(true), DataRow(false) ] - public void BitStackShouldRespectFullWidth(bool autoWidth) + public void BitStackShouldRespectAutoWidth(bool autoWidth) { var component = RenderComponent(parameters => { @@ -670,7 +716,7 @@ public void BitStackShouldRespectFullWidth(bool autoWidth) } [DataTestMethod] - public void BitStackShouldRespectFullWidthChangingAfterRender() + public void BitStackShouldRespectAutoWidthChangingAfterRender() { var component = RenderComponent(); @@ -688,7 +734,7 @@ public void BitStackShouldRespectFullWidthChangingAfterRender() DataRow(true), DataRow(false) ] - public void BitStackShouldRespectFullHeight(bool autoHeight) + public void BitStackShouldRespectAutoHeight(bool autoHeight) { var component = RenderComponent(parameters => { @@ -701,7 +747,7 @@ public void BitStackShouldRespectFullHeight(bool autoHeight) } [DataTestMethod] - public void BitStackShouldRespectFullHeightChangingAfterRender() + public void BitStackShouldRespectAutoHeightChangingAfterRender() { var component = RenderComponent(); @@ -725,7 +771,7 @@ public void BitStackShouldRespectFullHeightChangingAfterRender() DataRow(false, false, true), DataRow(false, false, false) ] - public void BitStackShouldRespectFullAndFullWidthAndFullHeight(bool autoSize, bool autoWidth, bool autoHeight) + public void BitStackShouldRespectAutoSizeAndAutoWidthAndAutoHeight(bool autoSize, bool autoWidth, bool autoHeight) { var component = RenderComponent(parameters => { @@ -748,4 +794,97 @@ public void BitStackShouldRespectFullAndFullWidthAndFullHeight(bool autoSize, bo component.MarkupMatches(@$"
"); } + + [DataTestMethod, + DataRow(true), + DataRow(false) + ] + public void BitStackShouldRespectFitHeight(bool fitHeight) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.FitHeight, fitHeight); + }); + + var style = fitHeight ? "height:fit-content;" : null; + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod] + public void BitStackShouldRespectFitHeightChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@$"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.FitHeight, true); + }); + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod, + DataRow(true), + DataRow(false) + ] + public void BitStackShouldRespectFitWidth(bool fitWidth) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.FitWidth, fitWidth); + }); + + var style = fitWidth ? "width:fit-content;" : null; + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod] + public void BitStackShouldRespectFitWidthChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@$"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.FitWidth, true); + }); + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod, + DataRow(true), + DataRow(false) + ] + public void BitStackShouldRespectFitSize(bool fitSize) + { + var component = RenderComponent(parameters => + { + parameters.Add(p => p.FitSize, fitSize); + }); + + var style = fitSize ? "width:fit-content;height:fit-content;" : null; + + component.MarkupMatches(@$"
"); + } + + [DataTestMethod] + public void BitStackShouldRespectFitSizeChangingAfterRender() + { + var component = RenderComponent(); + + component.MarkupMatches(@$"
"); + + component.SetParametersAndRender(parameters => + { + parameters.Add(p => p.FitSize, true); + }); + + component.MarkupMatches(@$"
"); + } } diff --git a/src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj b/src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj index 9f440dbd75..9438d817fd 100644 --- a/src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj +++ b/src/BlazorUI/Bit.BlazorUI/Bit.BlazorUI.csproj @@ -3,10 +3,10 @@ - net8.0;net7.0;net6.0 + net9.0;net8.0 true enable - + BeforeBuildTasks; $(ResolveStaticWebAssetsInputsDependsOn) @@ -19,9 +19,8 @@
- - + @@ -52,7 +51,7 @@ - + diff --git a/src/BlazorUI/Bit.BlazorUI/Components/BitAnchorRel.cs b/src/BlazorUI/Bit.BlazorUI/Components/BitLinkRel.cs similarity index 92% rename from src/BlazorUI/Bit.BlazorUI/Components/BitAnchorRel.cs rename to src/BlazorUI/Bit.BlazorUI/Components/BitLinkRel.cs index 96bd668b78..08b9b02045 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/BitAnchorRel.cs +++ b/src/BlazorUI/Bit.BlazorUI/Components/BitLinkRel.cs @@ -1,7 +1,10 @@ namespace Bit.BlazorUI; +/// +/// The rel attribute defines the relationship between a linked resource and the current document. +/// [Flags] -public enum BitAnchorRel +public enum BitLinkRel { /// /// Provides a link to an alternate representation of the document. (i.e. print page, translated or mirror) diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.razor b/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.razor index 8ee398dd36..1b488d8975 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.razor @@ -78,6 +78,7 @@ else { + /// Expand the button width to 100% of the available width. + /// + [Parameter, ResetClassBuilder] + public bool FullWidth { get; set; } + /// /// The value of the href attribute of the link rendered by the button. If provided, the component will be rendered as an anchor tag instead of button. /// - [Parameter] public string? Href { get; set; } + [Parameter] + [CallOnSet(nameof(OnSetHrefAndRel))] + public string? Href { get; set; } /// /// The name of the icon to render inside the button. @@ -117,6 +126,13 @@ public partial class BitButton : BitComponentBase [Parameter, ResetClassBuilder] public bool ReversedIcon { get; set; } + /// + /// If Href provided, specifies the relationship between the current document and the linked document. + /// + [Parameter] + [CallOnSet(nameof(OnSetHrefAndRel))] + public BitLinkRel? Rel { get; set; } + /// /// The text of the secondary section of the button. /// @@ -211,6 +227,8 @@ protected override void RegisterCssClasses() ClassBuilder.Register(() => ReversedIcon ? "bit-btn-rvi" : string.Empty); ClassBuilder.Register(() => FixedColor ? "bit-btn-ftc" : string.Empty); + + ClassBuilder.Register(() => FullWidth ? "bit-btn-flw" : string.Empty); } protected override void RegisterCssStyles() @@ -255,4 +273,15 @@ private async Task HandleOnClick(MouseEventArgs e) await AssignIsLoading(false); } + + private void OnSetHrefAndRel() + { + if (Rel.HasValue is false || Href.HasNoValue() || Href!.StartsWith('#')) + { + _rel = null; + return; + } + + _rel = BitLinkRelUtils.GetRels(Rel.Value); + } } diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.scss b/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.scss index 677347da00..abbf42f882 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.scss +++ b/src/BlazorUI/Bit.BlazorUI/Components/Buttons/BitButton/BitButton.scss @@ -155,6 +155,9 @@ color: var(--bit-btn-clr-txt); } +.bit-btn-flw { + width: 100%; +} .bit-btn-pri { --bit-btn-clr: #{$clr-pri}; diff --git a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor index a5284de16c..b9c24df77b 100644 --- a/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor +++ b/src/BlazorUI/Bit.BlazorUI/Components/Inputs/Calendar/BitCalendar.razor @@ -90,7 +90,7 @@ aria-disabled="@nextDisabled">