Browse Source

Merge branch 'dev' into salihozkara/abpUnited

pull/20272/head
maliming 2 years ago
parent
commit
faeb7a8a2f
  1. 2
      docs/en/Tutorials/Part-1.md
  2. 2
      docs/en/Tutorials/Part-10.md
  3. 4
      docs/en/Tutorials/Part-2.md
  4. 4
      docs/en/Tutorials/Part-3.md
  5. 4
      docs/en/Tutorials/Part-5.md
  6. 8
      docs/en/Tutorials/Part-9.md
  7. 7
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs
  8. 8
      modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs
  9. 14
      modules/docs/src/Volo.Docs.Web/DocsWebGoogleOptions.cs
  10. 21
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml
  11. 66
      npm/ng-packs/packages/core/locale/src/utils/register-locale.ts
  12. 59
      npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.html
  13. 12
      npm/ng-packs/packages/schematics/src/utils/model.ts

2
docs/en/Tutorials/Part-1.md

@ -82,7 +82,7 @@ abp install-libs
`abp bundle` command offers bundling and minification support for client-side resources (JavaScript and CSS files) for Blazor projects. This command automatically run when you create a new solution with the [ABP CLI](../CLI.md).
However, sometimes you might need to run this command manually. To update script & style references without worrying about dependencies, ordering, etc. in a project, you can run this command in the directory of your blazor application:
However, sometimes you might need to run this command manually. To update script & style references without worrying about dependencies, ordering, etc. in a project, you can run this command in the directory of your `Blazor.Client` project:
```bash
abp bundle

2
docs/en/Tutorials/Part-10.md

@ -1105,7 +1105,7 @@ That's all. Just run the application and try to create or edit an author.
### The Book List
It is very easy to show the *Author Name* in the book list. Open the `/Pages/Books.razor` file in the `Acme.BookStore.Blazor` project and add the following `DataGridColumn` definition just after the `Name` (book name) column:
It is very easy to show the *Author Name* in the book list. Open the `/Pages/Books.razor` file in the `Acme.BookStore.Blazor.Client` project and add the following `DataGridColumn` definition just after the `Name` (book name) column:
````xml
<DataGridColumn TItem="BookDto"

4
docs/en/Tutorials/Part-2.md

@ -556,7 +556,7 @@ Now you can see the final result on your browser:
## Create a Books Page
It's time to create something visible and usable! Right click on the `Pages` folder under the `Acme.BookStore.Blazor` project and add a new **razor component**, named `Books.razor`:
It's time to create something visible and usable! Right click on the `Pages` folder under the `Acme.BookStore.Blazor.Client` project and add a new **razor component**, named `Books.razor`:
![blazor-add-books-component](images/blazor-add-books-component.png)
@ -574,7 +574,7 @@ Replace the contents of this component as shown below:
### Add the Books Page to the Main Menu
Open the `BookStoreMenuContributor` class in the `Blazor` project add the following code to the end of the `ConfigureMainMenuAsync` method:
Open the `BookStoreMenuContributor` class in the `Blazor.Client` project add the following code to the end of the `ConfigureMainMenuAsync` method:
````csharp
context.Menu.AddItem(

4
docs/en/Tutorials/Part-3.md

@ -1330,13 +1330,13 @@ We can now define a modal to edit the book. Add the following code to the end of
The base `AbpCrudPageBase` uses the [object to object mapping](../Object-To-Object-Mapping.md) system to convert an incoming `BookDto` object to a `CreateUpdateBookDto` object. So, we need to define the mapping.
Open the `BookStoreBlazorAutoMapperProfile` inside the `Acme.BookStore.Blazor` project and change the content as the following:
Open the `BookStoreBlazorAutoMapperProfile` inside the `Acme.BookStore.Blazor.Client` project and change the content as the following:
````csharp
using Acme.BookStore.Books;
using AutoMapper;
namespace Acme.BookStore.Blazor;
namespace Acme.BookStore.Blazor.Client;
public class BookStoreBlazorAutoMapperProfile : Profile
{

4
docs/en/Tutorials/Part-5.md

@ -414,7 +414,7 @@ Open the `/src/app/book/book.component.html` file and replace the edit and delet
### Authorize the Razor Component
Open the `/Pages/Books.razor` file in the `Acme.BookStore.Blazor` project and add an `Authorize` attribute just after the `@page` directive and the following namespace imports (`@using` lines), as shown below:
Open the `/Pages/Books.razor` file in the `Acme.BookStore.Blazor.Client` project and add an `Authorize` attribute just after the `@page` directive and the following namespace imports (`@using` lines), as shown below:
````html
@page "/books"
@ -500,7 +500,7 @@ You can run and test the permissions. Remove a book related permission from the
Even we have secured all the layers of the book management page, it is still visible on the main menu of the application. We should hide the menu item if the current user has no permission.
Open the `BookStoreMenuContributor` class in the `Acme.BookStore.Blazor` project, find the code block below:
Open the `BookStoreMenuContributor` class in the `Acme.BookStore.Blazor.Client` project, find the code block below:
````csharp
context.Menu.AddItem(

8
docs/en/Tutorials/Part-9.md

@ -861,7 +861,7 @@ That's all! This is a fully working CRUD page, you can create, edit and delete a
### Authors Razor Component
Create a new Razor Component Page, `/Pages/Authors.razor`, in the `Acme.BookStore.Blazor` project with the following content:
Create a new Razor Component Page, `/Pages/Authors.razor`, in the `Acme.BookStore.Blazor.Client` project with the following content:
````xml
@page "/authors"
@ -1062,7 +1062,7 @@ using Blazorise.DataGrid;
using Microsoft.AspNetCore.Authorization;
using Volo.Abp.Application.Dtos;
namespace Acme.BookStore.Blazor.Pages;
namespace Acme.BookStore.Blazor.Client.Pages;
public partial class Authors
{
@ -1208,7 +1208,7 @@ This class typically defines the properties and methods used by the `Authors.raz
`Authors` class uses the `IObjectMapper` in the `OpenEditAuthorModal` method. So, we need to define this mapping.
Open the `BookStoreBlazorAutoMapperProfile.cs` in the `Acme.BookStore.Blazor` project and add the following mapping code in the constructor:
Open the `BookStoreBlazorAutoMapperProfile.cs` in the `Acme.BookStore.Blazor.Client` project and add the following mapping code in the constructor:
````csharp
CreateMap<AuthorDto, UpdateAuthorDto>();
@ -1218,7 +1218,7 @@ You will need to declare a `using Acme.BookStore.Authors;` statement to the begi
### Add to the Main Menu
Open the `BookStoreMenuContributor.cs` in the `Acme.BookStore.Blazor` project and add the following code to the end of the `ConfigureMainMenuAsync` method:
Open the `BookStoreMenuContributor.cs` in the `Acme.BookStore.Blazor.Client` project and add the following code to the end of the `ConfigureMainMenuAsync` method:
````csharp
if (await context.IsGrantedAsync(BookStorePermissions.Authors.Default))

7
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ChangeThemeStep.cs

@ -291,6 +291,13 @@ public class ChangeThemeStep : ProjectBuildPipelineStep
moduleFile.Name,
"Volo.Abp.LeptonX.Shared;"
);
AddNamespaces(
context,
moduleFile.Name,
"using Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton;",
"using Volo.Abp.AspNetCore.Mvc.UI.Theme.Lepton.Bundling;"
);
}
}

8
modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs

@ -85,7 +85,7 @@ namespace VoloDocs.Web
Configure<DocsElasticSearchOptions>(options =>
{
options.Enable = true;
options.Enable = false;
});
Configure<AbpDbConnectionOptions>(options =>
@ -164,9 +164,11 @@ namespace VoloDocs.Web
options.Conventions.AddPageRoute("/Error", "error/{statusCode}");
});
Configure<DocsWebGoogleTranslationOptions>(options =>
Configure<DocsWebGoogleOptions>(options =>
{
options.UseGoogleTranslation = true;
options.EnableGoogleTranslate = true;
options.EnableGoogleProgrammableSearchEngine = true;
options.GoogleSearchEngineId = "77c7266532da1427f";
});
}

14
modules/docs/src/Volo.Docs.Web/DocsWebGoogleTranslationOptions.cs → modules/docs/src/Volo.Docs.Web/DocsWebGoogleOptions.cs

@ -4,9 +4,9 @@ using System.Globalization;
namespace Volo.Docs;
public class DocsWebGoogleTranslationOptions
public class DocsWebGoogleOptions
{
public bool UseGoogleTranslation { get; set; }
public bool EnableGoogleTranslate { get; set; }
/// <summary>
/// https://cloud.google.com/translate/docs/languages
@ -15,9 +15,13 @@ public class DocsWebGoogleTranslationOptions
public Func<CultureInfo, string> GetCultureLanguageCode { get; set; }
public DocsWebGoogleTranslationOptions()
public bool EnableGoogleProgrammableSearchEngine { get; set; }
public string GoogleSearchEngineId { get; set; }
public DocsWebGoogleOptions()
{
UseGoogleTranslation = false;
EnableGoogleTranslate = false;
IncludedLanguages =
[
"en",
@ -47,5 +51,7 @@ public class DocsWebGoogleTranslationOptions
_ => culture.TwoLetterISOLanguageName
};
};
EnableGoogleProgrammableSearchEngine = false;
}
}

21
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml

@ -22,7 +22,7 @@
@inject IThemeManager ThemeManager
@inject IPageLayout PageLayout
@inject IHtmlLocalizer<DocsResource> L
@inject IOptions<DocsWebGoogleTranslationOptions> DocsWebOptions
@inject IOptions<DocsWebGoogleOptions> DocsWebGoogleOptions
@model IndexModel
@{
@ -58,15 +58,15 @@
<abp-script src="/Pages/Documents/Shared/Scripts/vs.js"/>
<abp-script src="/Pages/Documents/Project/index.js"/>
</abp-script-bundle>
if (DocsWebOptions.Value.UseGoogleTranslation)
if (DocsWebGoogleOptions.Value.EnableGoogleTranslate)
{
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: '@DocsWebOptions.Value.GetCultureLanguageCode(CultureInfo.CurrentUICulture)',
pageLanguage: '@DocsWebGoogleOptions.Value.GetCultureLanguageCode(CultureInfo.CurrentUICulture)',
autoDisplay: false,
disableAutoTranslation: true,
includedLanguages: '@string.Join(",", DocsWebOptions.Value.IncludedLanguages)',
includedLanguages: '@string.Join(",", DocsWebGoogleOptions.Value.IncludedLanguages)',
layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL
}, 'google_translate_element');
}
@ -81,11 +81,15 @@
var alt = img.attr('alt');
a.removeClass().css('color', '#666').html(alt);
}
}
}
});
</script>
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
}
if (DocsWebGoogleOptions.Value.EnableGoogleProgrammableSearchEngine)
{
<script async src="https://cse.google.com/cse.js?cx=@DocsWebGoogleOptions.Value.GoogleSearchEngineId"></script>
}
}
else
{
@ -214,7 +218,7 @@
}
</div>
@if (DocsWebOptions.Value.UseGoogleTranslation)
@if (DocsWebGoogleOptions.Value.EnableGoogleTranslate)
{
<div class="docs-version mt-2 skiptranslate">
<span>@L["GoogleTranslate"]</span>
@ -318,6 +322,11 @@
</div>
</div>
}
@if (DocsWebGoogleOptions.Value.EnableGoogleProgrammableSearchEngine)
{
<div class="gcse-search"></div>
}
</div>
@{
var showContributors = Model.Document.Contributors != null && Model.Document.Contributors.Count > 0;

66
npm/ng-packs/packages/core/locale/src/utils/register-locale.ts

@ -15,6 +15,72 @@ export interface RegisterLocaleData {
errorHandlerFn?: (data: LocaleErrorHandlerData) => any;
}
function loadLocale(locale: string) {
// hard coded list works with esbuild. Source https://github.com/angular/angular-cli/issues/26904#issuecomment-1903596563
const list = {
'ar': () => import('@angular/common/locales/ar'),
'cs': () => import('@angular/common/locales/cs'),
'en': () => import('@angular/common/locales/en'),
'en-GB': () => import('@angular/common/locales/en-GB'),
'es': () => import('@angular/common/locales/es'),
'de': () => import('@angular/common/locales/de'),
'fi': () => import('@angular/common/locales/fi'),
'fr': () => import('@angular/common/locales/fr'),
'hi': () => import('@angular/common/locales/hi'),
'hu': () => import('@angular/common/locales/hu'),
'is': () => import('@angular/common/locales/is'),
'it': () => import('@angular/common/locales/it'),
'pt': () => import('@angular/common/locales/pt'),
'tr': () => import('@angular/common/locales/tr'),
'ru': () => import('@angular/common/locales/ru'),
'ro': () => import('@angular/common/locales/ro'),
'sk': () => import('@angular/common/locales/sk'),
'sl': () => import('@angular/common/locales/sl'),
'zh-Hans': () => import('@angular/common/locales/zh-Hans'),
'zh-Hant': () => import('@angular/common/locales/zh-Hant')
}
return list[locale]();
}
export function registerLocaleForEsBuild(
{
cultureNameLocaleFileMap = {},
errorHandlerFn = defaultLocalErrorHandlerFn,
} = {} as RegisterLocaleData,
) {
return (locale: string): Promise<any> => {
localeMap = { ...differentLocales, ...cultureNameLocaleFileMap };
const l = localeMap[locale] || locale;
const localeSupportList = "ar|cs|en|en-GB|es|de|fi|fr|hi|hu|is|it|pt|tr|ru|ro|sk|sl|zh-Hans|zh-Hant".split("|");
if (localeSupportList.indexOf(locale) == -1) {
return;
}
return new Promise((resolve, reject) => {
return loadLocale(l)
.then(val => {
let module = val;
while (module.default) {
module = module.default;
}
resolve({ default: module });
})
.catch(error => {
errorHandlerFn({
resolve,
reject,
error,
locale,
});
});
});
};
}
export function registerLocale(
{
cultureNameLocaleFileMap = {},

59
npm/ng-packs/packages/feature-management/src/lib/components/feature-management/feature-management.component.html

@ -69,35 +69,35 @@
}
@case (valueTypes.SelectionStringValueType) {
@if (feature.valueType.itemSource?.items?.length) {
<div class="mb-3 form-group">
<label [htmlFor]="feature.name" class="form-label">{{
feature.displayName
}}</label>
<select
class="form-select"
[id]="feature.name"
[(ngModel)]="feature.value"
>
@for (
item of feature.valueType.itemSource?.items;
track item.value
) {
<option [ngValue]="item.value">
{{
item.displayText?.resourceName +
'::' +
item.displayText?.name | abpLocalization
}}
</option>
}
</select>
<ng-container
*ngTemplateOutlet="
descTmp;
context: { $implicit: feature.description }
"
></ng-container>
</div>
<div class="mb-3 form-group">
<label [htmlFor]="feature.name" class="form-label">{{
feature.displayName
}}</label>
<select
class="form-select"
[id]="feature.name"
[(ngModel)]="feature.value"
>
@for (
item of feature.valueType.itemSource?.items;
track item.value
) {
<option [ngValue]="item.value">
{{
item.displayText?.resourceName +
'::' +
item.displayText?.name | abpLocalization
}}
</option>
}
</select>
<ng-container
*ngTemplateOutlet="
descTmp;
context: { $implicit: feature.description }
"
></ng-container>
</div>
}
}
@default {
@ -136,7 +136,6 @@
@if (groups.length) {
<abp-button
iconClass="fa fa-refresh"
buttonClass="btn btn-outline-primary"
[disabled]="modalBusy"
(click)="resetToDefault()"

12
npm/ng-packs/packages/schematics/src/utils/model.ts

@ -91,16 +91,8 @@ export function createImportRefsToModelReducer(params: ModelGeneratorParams) {
if (propType.isEnum) {
toBeImported.push({ type: ref, isEnum: true });
}
if (parseNamespace(solution, ref) !== model.namespace) {
const isEnumImportAvailable = toBeImported.some(importValue => {
return importValue.isEnum && importValue.type === ref;
});
if (!isEnumImportAvailable) {
toBeImported.push({ type: ref, isEnum: false });
}
} else if (parseNamespace(solution, ref) !== model.namespace) {
toBeImported.push({ type: ref, isEnum: false });
}
});
});

Loading…
Cancel
Save