diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json index 924306634e..0d67d9cca5 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json @@ -565,7 +565,7 @@ "PrePayment_IyzicoRedirectionInfo": "您将被重定向到 Iyzico 支付网关以安全地完成您的购买。", "PrePayment_IyzicoAcceptVisaAndMasterCard": "Iyzico 接受 Visa 和 MasterCard。", "Purchase": "购买", - "AcceptTermsAndConditions": "我已阅读、理解并接受隐私政策, 条款和条件和 EULA。", + "AcceptTermsAndConditions": "我已阅读、理解并接受隐私政策, 条款和条件和 EULA。", "AcceptTermsAndConditionsWarningMessage": "请接受隐私政策和条款和条件", "SelectGatewayToContinue": "请选择一个网关以继续!", "GatewaySelection_SelectGateway": "选择支付网关", diff --git a/docs/en/UI/Angular/Config-State-Service.md b/docs/en/UI/Angular/Config-State-Service.md index 11415eb771..c457184fc2 100644 --- a/docs/en/UI/Angular/Config-State-Service.md +++ b/docs/en/UI/Angular/Config-State-Service.md @@ -120,7 +120,7 @@ Please refer to `ApplicationConfigurationDto` type for all the properties you ca You can get the application configuration response and set the `ConfigStateService` state value as shown below: ```js -import {ApplicationConfigurationService, ConfigStateService} from '@abp/ng.core'; +import {AbpApplicationConfigurationService, ConfigStateService} from '@abp/ng.core'; constructor(private abpApplicationConfigurationService: AbpApplicationConfigurationService, private config: ConfigStateService) { this.abpApplicationConfigurationService.get().subscribe(config => { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs index 1d95297a88..7c21b9fe09 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/AbpAspNetCoreMvcClientModule.cs @@ -1,6 +1,5 @@ -using System.Threading.Tasks; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.DependencyInjection; using Volo.Abp.EventBus; using Volo.Abp.Modularity; using Volo.Abp.Threading; @@ -20,6 +19,6 @@ public class AbpAspNetCoreMvcClientModule : AbpModule public async override Task OnApplicationInitializationAsync(ApplicationInitializationContext context) { - await context.ServiceProvider.GetRequiredService().ServiceProvider.GetRequiredService().InitializeAsync(); + await context.ServiceProvider.GetRequiredService().InitializeAsync(); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs index a30b16ee41..fa0cc26d11 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/ProjectCreationCommandBase.cs @@ -103,18 +103,6 @@ public abstract class ProjectCreationCommandBase Logger.LogInformation("UI Framework: " + uiFramework); } - var theme = uiFramework == UiFramework.None ? (Theme?)null : GetThemeByTemplateOrNull(commandLineArgs, template); - if (theme.HasValue) - { - Logger.LogInformation("Theme: " + theme); - } - - var themeStyle = theme.HasValue ? GetThemeStyleOrNull(commandLineArgs, theme.Value) : (ThemeStyle?)null; - if(themeStyle.HasValue) - { - Logger.LogInformation("Theme Style: " + themeStyle); - } - var publicWebSite = uiFramework != UiFramework.None && commandLineArgs.Options.ContainsKey(Options.PublicWebSite.Long); if (publicWebSite) { @@ -210,6 +198,9 @@ public abstract class ProjectCreationCommandBase } commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); + + var theme = uiFramework == UiFramework.None ? (Theme?)null : GetThemeByTemplateOrNull(commandLineArgs, template); + var themeStyle = theme.HasValue ? GetThemeStyleOrNull(commandLineArgs, theme.Value) : (ThemeStyle?)null; return new ProjectBuildArgs( solutionName, diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs index dcf8496e66..916f861460 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs @@ -141,6 +141,13 @@ public class ChangeThemeStep : ProjectBuildPipelineStep "AbpAspNetCoreComponentsWebAssemblyLeptonThemeModule" ); + ChangeNamespace( + context, + "/MyCompanyName.MyProjectName.Blazor/MyProjectNameBlazorModule.cs", + "Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme", + "Volo.Abp.AspNetCore.Components.WebAssembly.LeptonTheme" + ); + #endregion #region MyCompanyName.MyProjectName.Blazor.Server && MyCompanyName.MyProjectName.Blazor.Server.Tiered @@ -210,7 +217,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep } AddProjectReference(file, $@"..\..\..\..\lepton-theme\src\Volo.Abp.LeptonTheme.Management.{projectName}\Volo.Abp.LeptonTheme.Management.{projectName}.csproj"); - AddModuleDependency(moduleFile, $"LeptonThemeManagement{ConvertProjectNameToModuleName($"{projectName}")}Module"); + AddModuleDependency(moduleFile, projectName, $"LeptonThemeManagement{ConvertProjectNameToModuleName($"{projectName}")}Module"); } } @@ -325,21 +332,22 @@ public class ChangeThemeStep : ProjectBuildPipelineStep AddProjectReference(projectFile, reference); - AddModuleDependency(moduleFile, $"LeptonThemeManagement{ConvertProjectNameToModuleName(projectInfo.Key)}Module", + AddModuleDependency(moduleFile, projectInfo.Key, $"LeptonThemeManagement{ConvertProjectNameToModuleName(projectInfo.Key)}Module", underManagementFolder: projectInfo.Key != "HttpApi"); } - private void AddModuleDependency(FileEntry moduleFile, string dependency, bool underManagementFolder = true) + private void AddModuleDependency(FileEntry moduleFile, string projectName, string dependency, bool underManagementFolder = true) { - var lines = moduleFile.GetLines(); + var projectNames = new[] { "Blazor", "Blazor.Server", "Blazor.WebAssembly" }; + var lines = moduleFile.GetLines(); for (var i = 0; i < lines.Length; i++) { if (lines[i].Contains("namespace MyCompanyName.MyProjectName")) { - lines[i - 1] = lines[i - 1] + "using Volo.Abp.LeptonTheme" + (underManagementFolder ? ".Management" : "").EnsureEndsWith(';') + Environment.NewLine; + lines[i - 1] = lines[i - 1] + ("using Volo.Abp.LeptonTheme" + (underManagementFolder ? ".Management." : ".") + (projectNames.Any(p => p == projectName) ? projectName : "")).TrimEnd('.').EnsureEndsWith(';') + Environment.NewLine; } - + if (lines[i].Contains("public class MyProjectName") && lines[i-1].Contains(")]")) { lines[i - 2] = lines[i - 2] + "," + Environment.NewLine + $"\ttypeof({dependency})"; @@ -584,9 +592,7 @@ public class ChangeThemeStep : ProjectBuildPipelineStep .Replace(".csproj", "Module") .Replace(".", ""); - fileName = ConvertProjectNameToModuleName(fileName); - - return context.Files.FirstOrDefault(f => f.Name.Contains(splittedProjectFileName.Last() + "/" + fileName)); + return context.Files.FirstOrDefault(f => f.Name.Contains(splittedProjectFileName.Last() + "/" + fileName) && f.Name.EndsWith("Module.cs")); } private static string ConvertProjectNameToModuleName(string moduleName) @@ -796,6 +802,12 @@ public class ChangeThemeStep : ProjectBuildPipelineStep "BlazorLeptonXThemeBundles.Scripts.Global", "BlazorLeptonThemeBundles.Scripts.Global" ); + + RemoveLinesByStatement( + context, + $"/MyCompanyName.MyProjectName.{projectName}/MyProjectNameBlazorModule.cs", + "Volo.Abp.LeptonX.Shared;" + ); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 126e9bdbf9..33c2237773 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -71,6 +71,8 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency args.ExtraProperties.ContainsKey(NewCommand.Options.Preview.Long) ); + ConfigureThemeOptions(args, templateFile.Version); + DeveloperApiKeyResult apiKeyResult = null; #if DEBUG @@ -207,4 +209,37 @@ public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency return TemplateInfoProvider.Get(args.TemplateName); } } + + private bool IsThemeOptionEnabled(ProjectBuildArgs args, string templateVersion) + { + var version = string.IsNullOrWhiteSpace(args.Version) + ? templateVersion + : args.Version; + + if (!SemanticVersion.TryParse(version, out var semanticVersion)) + { + return false; + } + + return semanticVersion >= SemanticVersion.Parse("6.0.0-rc.1"); + } + + private void ConfigureThemeOptions(ProjectBuildArgs args, string templateVersion) + { + if (!IsThemeOptionEnabled(args, templateVersion)) + { + args.Theme = null; + args.ThemeStyle = null; + } + + if (args.Theme.HasValue) + { + Logger.LogInformation("Theme: " + args.Theme); + } + + if(args.ThemeStyle.HasValue) + { + Logger.LogInformation("Theme Style: " + args.ThemeStyle); + } + } } diff --git a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs b/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs index c4720c92db..6b7f32807e 100644 --- a/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs +++ b/framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/JsonConverters/AbpStringToEnumConverter.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; @@ -48,4 +47,14 @@ public class AbpStringToEnumConverter : JsonConverter JsonSerializer.Serialize(writer, value, _writeJsonSerializerOptions); } + + public override T ReadAsPropertyName(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + return (T)Enum.Parse(typeToConvert, reader.GetString()); + } + + public override void WriteAsPropertyName(Utf8JsonWriter writer, T value, JsonSerializerOptions options) + { + writer.WritePropertyName(Enum.GetName(typeof(T), value)); + } } diff --git a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs index d3bba36534..8336b4ce7d 100644 --- a/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs +++ b/framework/test/Volo.Abp.Json.Tests/Volo/Abp/Json/AbpStringToEnum_Tests.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Text.Json; using Shouldly; using Volo.Abp.Json.SystemTextJson.JsonConverters; @@ -26,6 +27,16 @@ namespace Volo.Abp.Json testClass = JsonSerializer.Deserialize("{\"Day\": 1}", options); testClass.ShouldNotBeNull(); testClass.Day.ShouldBe(DayOfWeek.Monday); + + var dictionary = JsonSerializer.Deserialize>("{\"Monday\":\"Mo\"}", options); + dictionary.ShouldNotBeNull(); + dictionary.Keys.ShouldContain(DayOfWeek.Monday); + dictionary.Values.ShouldContain("Mo"); + + dictionary = JsonSerializer.Deserialize>("{\"1\":\"Mo\"}", options); + dictionary.ShouldNotBeNull(); + dictionary.Keys.ShouldContain(DayOfWeek.Monday); + dictionary.Values.ShouldContain("Mo"); } [Fact] @@ -45,6 +56,13 @@ namespace Volo.Abp.Json }); testClassJson.ShouldBe("{\"Day\":1}"); + + testClassJson = JsonSerializer.Serialize(new Dictionary + { + {DayOfWeek.Monday, "Mo"} + }, options); + + testClassJson.ShouldBe("{\"Monday\":\"Mo\"}"); } class TestClass diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml index a3a99969ff..958621ea9c 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Web/Pages/CmsKit/Comments/Index.cshtml @@ -37,7 +37,7 @@
- + @@ -58,11 +58,9 @@ -
- - - -
+ + +
diff --git a/npm/ng-packs/packages/schematics/src/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template b/npm/ng-packs/packages/schematics/src/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template index 78fb27c33d..1e1cc4564a 100644 --- a/npm/ng-packs/packages/schematics/src/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template +++ b/npm/ng-packs/packages/schematics/src/commands/api/files-service/proxy/__namespace@dir__/__name@kebab__.service.ts.template @@ -7,12 +7,18 @@ export class <%= name %>Service { apiName = '<%= apiName %>';<% for (let {body, signature} of methods) { %> + <% + const isBlob = body.isBlobMethod() ; + const responseType = isBlob ? "Blob":body.responseType; + %> <%= camel(signature.name) %> = (<%= serializeParameters(signature.parameters) %>) => - this.restService.request<<%= body.requestType %>, <%= body.responseType %>>({ - method: '<%= body.method %>',<% + this.restService.request<<%= body.requestType %>, <%= responseType %>>({ + method: '<%= body.method %>',<% if (body.responseType === 'string') { %> - responseType: 'text',<% } %> + responseType: 'text',<% } %><% + if (isBlob) { %> + responseType: 'blob',<% } %> url: <%= body.url %>,<% if (body.params.length) { %> params: { <%= body.params.join(', ') %> },<% } diff --git a/npm/ng-packs/packages/schematics/src/constants/volo.ts b/npm/ng-packs/packages/schematics/src/constants/volo.ts index 00fde72c79..d45a4b9e72 100644 --- a/npm/ng-packs/packages/schematics/src/constants/volo.ts +++ b/npm/ng-packs/packages/schematics/src/constants/volo.ts @@ -1 +1,2 @@ export const VOLO_REGEX = /^Volo\.Abp\.(Application\.Dtos|ObjectExtending)/; +export const VOLO_REMOTE_STREAM_CONTENT = 'Volo.Abp.Content.IRemoteStreamContent' diff --git a/npm/ng-packs/packages/schematics/src/models/method.ts b/npm/ng-packs/packages/schematics/src/models/method.ts index d8f56e383e..d54d4303b9 100644 --- a/npm/ng-packs/packages/schematics/src/models/method.ts +++ b/npm/ng-packs/packages/schematics/src/models/method.ts @@ -4,6 +4,7 @@ import { getParamName } from '../utils/methods'; import { ParameterInBody } from './api-definition'; import { Property } from './model'; import { Omissible } from './util'; +import {VOLO_REMOTE_STREAM_CONTENT} from "../constants"; // eslint-disable-next-line @typescript-eslint/no-var-requires const shouldQuote = require('should-quote'); @@ -39,6 +40,7 @@ export class Body { body?: string; method: string; params: string[] = []; + responseTypeWithNamespace: string; requestType = 'any'; responseType: string; url: string; @@ -77,6 +79,10 @@ export class Body { this.setUrlQuotes(); } + isBlobMethod(){ + return this.responseTypeWithNamespace === VOLO_REMOTE_STREAM_CONTENT + } + private setUrlQuotes() { this.url = /{/.test(this.url) ? `\`/${this.url}\`` : `'/${this.url}'`; } @@ -84,5 +90,5 @@ export class Body { export type BodyOptions = Omissible< Omit, - 'params' | 'requestType' + 'params' | 'requestType' | 'isBlobMethod' >; diff --git a/npm/ng-packs/packages/schematics/src/utils/service.ts b/npm/ng-packs/packages/schematics/src/utils/service.ts index 4e2fdc7c02..28ce82e3f7 100644 --- a/npm/ng-packs/packages/schematics/src/utils/service.ts +++ b/npm/ng-packs/packages/schematics/src/utils/service.ts @@ -22,6 +22,7 @@ import { } from './type'; import { eBindingSourceId } from '../enums'; import { camelizeHyphen } from './text'; +import {VOLO_REMOTE_STREAM_CONTENT} from "../constants"; export function serializeParameters(parameters: Property[]) { return parameters.map(p => p.name + p.optional + ': ' + p.type + p.default, '').join(', '); @@ -38,7 +39,8 @@ export function createControllerToServiceMapper({ const name = controller.controllerName; const namespace = parseNamespace(solution, controller.type); const actions = Object.values(controller.actions); - const imports = actions.reduce(createActionToImportsReducer(solution, types, namespace), []); + const typeWithoutIRemoteStreamContent = getTypesWithoutIRemoteStreamContent(types) + const imports = actions.reduce(createActionToImportsReducer(solution, typeWithoutIRemoteStreamContent, namespace), []); imports.push(new Import({ path: '@abp/ng.core', specifiers: ['RestService'] })); imports.push(new Import({ path: '@angular/core', specifiers: ['Injectable'] })); sortImports(imports); @@ -48,6 +50,11 @@ export function createControllerToServiceMapper({ }; } +function getTypesWithoutIRemoteStreamContent(types: Record) { + const newType = {...types} + delete newType[VOLO_REMOTE_STREAM_CONTENT] + return newType +} function sortMethods(methods: Method[]) { methods.sort((a, b) => (a.signature.name > b.signature.name ? 1 : -1)); } @@ -68,7 +75,8 @@ export function createActionToBodyMapper() { return ({ httpMethod, parameters, returnValue, url }: Action) => { const responseType = adaptType(returnValue.typeSimple); - const body = new Body({ method: httpMethod, responseType, url }); + const responseTypeWithNamespace = returnValue.typeSimple; + const body = new Body({ method: httpMethod, responseType, url ,responseTypeWithNamespace}); parameters.forEach(body.registerActionParameter);