@dignite-ng/expand.cms 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/components/domains/domains.component.d.ts +7 -0
- package/config/components/site-language/site-language.component.d.ts +29 -0
- package/config/enums/route-names.d.ts +3 -2
- package/config/proxy/dignite/cms/admin/sites/index.d.ts +2 -0
- package/config/proxy/dignite/cms/admin/sites/models.d.ts +4 -0
- package/config/proxy/dignite/cms/admin/sites/site-admin.service.d.ts +13 -0
- package/config/proxy/dignite/cms/sites/models.d.ts +4 -0
- package/config/services/validators.service.d.ts +16 -0
- package/esm2022/config/cms-config.module.mjs +4 -4
- package/esm2022/config/components/domains/domains.component.mjs +23 -12
- package/esm2022/config/components/site-language/site-language.component.mjs +108 -0
- package/esm2022/config/enums/route-names.mjs +10 -2
- package/esm2022/config/providers/route.provider.mjs +17 -11
- package/esm2022/config/proxy/admin/domains/domain-admin.service.mjs +18 -19
- package/esm2022/config/proxy/dignite/cms/admin/sites/index.mjs +3 -0
- package/esm2022/config/proxy/dignite/cms/admin/sites/models.mjs +2 -0
- package/esm2022/config/proxy/dignite/cms/admin/sites/site-admin.service.mjs +27 -0
- package/esm2022/config/proxy/dignite/cms/sites/models.mjs +2 -0
- package/esm2022/config/services/validators.service.mjs +83 -0
- package/esm2022/lib/cms-routing.module.mjs +6 -6
- package/esm2022/lib/cms.module.mjs +16 -8
- package/esm2022/lib/components/admin/entries/create-or-edit-entries.component.mjs +29 -44
- package/esm2022/lib/components/admin/entries/create-or-update-entry-input-base.mjs +20 -20
- package/esm2022/lib/components/admin/entries/create.component.mjs +26 -24
- package/esm2022/lib/components/admin/entries/edit.component.mjs +26 -24
- package/esm2022/lib/components/admin/entries/entries.component.mjs +36 -43
- package/esm2022/lib/components/admin/fields/create-field.component.mjs +19 -19
- package/esm2022/lib/components/admin/fields/create-or-edit-field.component.mjs +8 -15
- package/esm2022/lib/components/admin/fields/create-or-update-field-input-base.mjs +13 -13
- package/esm2022/lib/components/admin/fields/edit-field.component.mjs +21 -24
- package/esm2022/lib/components/admin/fields/field-group.component.mjs +37 -29
- package/esm2022/lib/components/admin/fields/fields.component.mjs +14 -20
- package/esm2022/lib/components/admin/sections/create-or-update-sections-input-base.mjs +15 -15
- package/esm2022/lib/components/admin/sections/entry-types/create-or-edit.-entry-type-input-base.mjs +26 -26
- package/esm2022/lib/components/admin/sections/entry-types/create-or-edit.component.mjs +45 -68
- package/esm2022/lib/components/admin/sections/sections.component.mjs +30 -27
- package/esm2022/lib/components/dynamic-form/entry/entry-config.component.mjs +10 -21
- package/esm2022/lib/components/dynamic-form/entry/entry-config.mjs +7 -7
- package/esm2022/lib/components/dynamic-form/entry/entry-control.component.mjs +9 -19
- package/esm2022/lib/components/dynamic-form/matrix/matrix-config.component.mjs +14 -30
- package/esm2022/lib/components/dynamic-form/matrix/matrix-config.mjs +16 -16
- package/esm2022/lib/components/dynamic-form/matrix/matrix-control.component.mjs +7 -22
- package/esm2022/lib/components/dynamic-form/table/table-config.component.mjs +8 -30
- package/esm2022/lib/components/dynamic-form/table/table-config.mjs +15 -15
- package/esm2022/lib/components/dynamic-form/table/table-control.component.mjs +6 -20
- package/esm2022/lib/constants/styles.mjs +6 -1
- package/esm2022/lib/proxy/admin/dynamic-forms/form-admin.service.mjs +8 -9
- package/esm2022/lib/proxy/admin/entries/entry-admin.service.mjs +56 -57
- package/esm2022/lib/proxy/admin/fields/field-admin.service.mjs +31 -32
- package/esm2022/lib/proxy/admin/fields/field-group-admin.service.mjs +27 -28
- package/esm2022/lib/proxy/admin/sections/entry-type-admin.service.mjs +27 -28
- package/esm2022/lib/proxy/admin/sections/section-admin.service.mjs +37 -38
- package/esm2022/lib/proxy/admin/settings/site-settings-admin.service.mjs +17 -18
- package/esm2022/lib/resolvers/extensions-props-action-token.resolver.mjs +132 -0
- package/esm2022/lib/resolvers/page-default-toolbar-actions.mjs +160 -0
- package/esm2022/lib/services/cms-api.service.mjs +3 -4
- package/esm2022/lib/services/cms.service.mjs +4 -5
- package/esm2022/lib/services/field-abstracts.service.mjs +7 -9
- package/esm2022/lib/services/simple-reuse-strategy.mjs +2 -2
- package/esm2022/lib/services/update-list.service.mjs +6 -5
- package/esm2022/lib/services/validators.service.mjs +85 -0
- package/esm2022/public-api.mjs +1 -4
- package/fesm2022/dignite-ng-expand.cms-config.mjs +266 -45
- package/fesm2022/dignite-ng-expand.cms-config.mjs.map +1 -1
- package/fesm2022/dignite-ng-expand.cms.mjs +868 -875
- package/fesm2022/dignite-ng-expand.cms.mjs.map +1 -1
- package/lib/components/admin/entries/create.component.d.ts +7 -0
- package/lib/components/admin/entries/edit.component.d.ts +7 -0
- package/lib/components/admin/fields/create-field.component.d.ts +7 -0
- package/lib/components/admin/fields/create-or-edit-field.component.d.ts +3 -1
- package/lib/components/admin/fields/edit-field.component.d.ts +7 -0
- package/lib/components/admin/fields/field-group.component.d.ts +7 -0
- package/lib/components/admin/sections/entry-types/create-or-edit.component.d.ts +7 -0
- package/lib/components/admin/sections/sections.component.d.ts +7 -0
- package/lib/constants/styles.d.ts +1 -1
- package/lib/resolvers/extensions-props-action-token.resolver.d.ts +71 -0
- package/lib/services/validators.service.d.ts +17 -0
- package/package.json +1 -1
- package/esm2022/lib/toolbar/index.mjs +0 -3
- package/esm2022/lib/toolbar/toolbar-btn-default-action.mjs +0 -160
- package/esm2022/lib/toolbar/toolbar-config.mjs +0 -83
- package/lib/toolbar/index.d.ts +0 -2
- package/lib/toolbar/toolbar-config.d.ts +0 -56
- /package/lib/{toolbar/toolbar-btn-default-action.d.ts → resolvers/page-default-toolbar-actions.d.ts} +0 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { LocalizationService } from '@abp/ng.core';
|
|
2
|
+
import { ToasterService } from '@abp/ng.theme.shared';
|
|
3
|
+
import { inject, Injectable } from '@angular/core';
|
|
4
|
+
import { FormGroup, FormArray, FormControl, FormBuilder } from '@angular/forms';
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export class ValidatorsService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.fb = inject(FormBuilder);
|
|
9
|
+
this.toaster = inject(ToasterService);
|
|
10
|
+
this._LocalizationService = inject(LocalizationService);
|
|
11
|
+
}
|
|
12
|
+
/**检查表单- */
|
|
13
|
+
/**检查表单- */
|
|
14
|
+
isCheckForm(input, module = 'AbpValidation') {
|
|
15
|
+
let keys = Object.keys(input);
|
|
16
|
+
for (let i = 0; i < keys.length; i++) {
|
|
17
|
+
const element = keys[i];
|
|
18
|
+
if (input[element] == false) {
|
|
19
|
+
let info = `"${this._LocalizationService.instant(`${module}::${element}`)}" `;
|
|
20
|
+
if (element.includes('.') && !element.includes('].')) {
|
|
21
|
+
let arr = element.split('.');
|
|
22
|
+
info = `"${this._LocalizationService.instant(`CmsKit::${arr[0]}`)}.${this._LocalizationService.instant(`CmsKit::${arr[1]}`)}"`;
|
|
23
|
+
}
|
|
24
|
+
if (element.includes('].')) {
|
|
25
|
+
let arr = element.split('].');
|
|
26
|
+
let arrStart = arr[0].split('[');
|
|
27
|
+
info = `"${this._LocalizationService.instant(`CmsKit::${arrStart[0]}`)}[${arrStart[1]}].${this._LocalizationService.instant(`CmsKit::${arr[1]}`)}"`;
|
|
28
|
+
}
|
|
29
|
+
info += `${this._LocalizationService.instant(`AbpValidation::ThisFieldIsNotValid`)}`;
|
|
30
|
+
//使用abp多语言提示
|
|
31
|
+
this.toaster.warn(info);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
/**获取表单所有字段是否通过验证 */
|
|
38
|
+
getFormValidationStatus(formEntity) {
|
|
39
|
+
let validationStatus = {};
|
|
40
|
+
// 递归遍历表单组和表单控件集合
|
|
41
|
+
const traverseForm = (form, prefix = '') => {
|
|
42
|
+
if (form instanceof FormGroup) {
|
|
43
|
+
Object.keys(form.controls).forEach(key => {
|
|
44
|
+
const control = form.controls[key];
|
|
45
|
+
let displayName = key.charAt(0).toUpperCase() + key.slice(1);
|
|
46
|
+
const fullKey = prefix ? `${prefix}.${displayName}` : displayName;
|
|
47
|
+
if (control instanceof FormControl) {
|
|
48
|
+
validationStatus[fullKey] = control.valid;
|
|
49
|
+
}
|
|
50
|
+
else if (control instanceof FormArray) {
|
|
51
|
+
traverseForm(control, fullKey);
|
|
52
|
+
}
|
|
53
|
+
else if (control instanceof FormGroup) {
|
|
54
|
+
traverseForm(control, fullKey);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
else if (form instanceof FormArray) {
|
|
59
|
+
form.controls.forEach((control, index) => {
|
|
60
|
+
const fullKey = prefix ? `${prefix}[${index}]` : `[${index}]`;
|
|
61
|
+
if (control instanceof FormControl) {
|
|
62
|
+
validationStatus[fullKey] = control.valid;
|
|
63
|
+
}
|
|
64
|
+
else if (control instanceof FormArray) {
|
|
65
|
+
traverseForm(control, fullKey);
|
|
66
|
+
}
|
|
67
|
+
else if (control instanceof FormGroup) {
|
|
68
|
+
traverseForm(control, fullKey);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
traverseForm(formEntity);
|
|
74
|
+
return validationStatus;
|
|
75
|
+
}
|
|
76
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
77
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, providedIn: 'root' }); }
|
|
78
|
+
}
|
|
79
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, decorators: [{
|
|
80
|
+
type: Injectable,
|
|
81
|
+
args: [{
|
|
82
|
+
providedIn: 'root'
|
|
83
|
+
}]
|
|
84
|
+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Gl6YXRpb25TZXJ2aWNlID0gaW5qZWN0KExvY2FsaXphdGlvblNlcnZpY2UpO1xyXG5cclxuICAvKirmo4Dmn6XooajljZUtICovXHJcbiAgICAvKirmo4Dmn6XooajljZUtICovXHJcbiAgICBpc0NoZWNrRm9ybShpbnB1dDogYW55LG1vZHVsZT0nQWJwVmFsaWRhdGlvbicpIHtcclxuICAgICAgbGV0IGtleXMgPSBPYmplY3Qua2V5cyhpbnB1dCk7XHJcbiAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwga2V5cy5sZW5ndGg7IGkrKykge1xyXG4gICAgICAgIGNvbnN0IGVsZW1lbnQgPSBrZXlzW2ldO1xyXG4gICAgICAgIGlmIChpbnB1dFtlbGVtZW50XSA9PSBmYWxzZSkge1xyXG4gICAgICAgICAgbGV0IGluZm8gPSBgXCIke3RoaXMuX0xvY2FsaXphdGlvblNlcnZpY2UuaW5zdGFudChgJHttb2R1bGV9Ojoke2VsZW1lbnR9YCl9XCIgYDtcclxuICAgICAgICAgIGlmIChlbGVtZW50LmluY2x1ZGVzKCcuJykgJiYgIWVsZW1lbnQuaW5jbHVkZXMoJ10uJykpIHtcclxuICAgICAgICAgICAgbGV0IGFyciA9IGVsZW1lbnQuc3BsaXQoJy4nKTtcclxuICAgICAgICAgICAgaW5mbz1gXCIke3RoaXMuX0xvY2FsaXphdGlvblNlcnZpY2UuaW5zdGFudChgQ21zS2l0Ojoke2FyclswXX1gKX0uJHt0aGlzLl9Mb2NhbGl6YXRpb25TZXJ2aWNlLmluc3RhbnQoYENtc0tpdDo6JHthcnJbMV19YCl9XCJgXHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgICBpZiAoZWxlbWVudC5pbmNsdWRlcygnXS4nKSkge1xyXG4gICAgICAgICAgICBsZXQgYXJyID0gZWxlbWVudC5zcGxpdCgnXS4nKTtcclxuICAgICAgICAgICAgbGV0IGFyclN0YXJ0ID0gYXJyWzBdLnNwbGl0KCdbJyk7XHJcbiAgICAgICAgICAgIGlu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V5XSA9IGNvbnRyb2wudmFsaWQ7XHJcbiAgICAgICAgICB9IGVsc2UgaWYgKGNvbnRyb2wgaW5zdGFuY2VvZiBGb3JtQXJyYXkpIHtcclxuICAgICAgICAgICAgdHJhdmVyc2VGb3JtKGNvbnRyb2wsIGZ1bGxLZXkpO1xyXG4gICAgICAgICAgfSBlbHNlIGlmIChjb250cm9sIGluc3RhbmNlb2YgRm9ybUdyb3VwKSB7XHJcbiAgICAgICAgICAgIHRyYXZlcnNlRm9ybShjb250cm9sLCBmdWxsS2V5KTtcclxuICAgICAgICAgIH1cclxuICAgICAgICB9KTtcclxuICAgICAgfVxyXG4gICAgfTtcclxuXHJcbiAgICB0cmF2ZXJzZUZvcm0oZm9ybUVudGl0eSk7XHJcblxyXG4gICAgcmV0dXJuIHZhbGlkYXRpb25TdGF0dXM7XHJcbiAgfVxyXG5cclxufVxyXG4iXX0=
|
package/esm2022/public-api.mjs
CHANGED
|
@@ -2,8 +2,5 @@
|
|
|
2
2
|
* Public API Surface of cms
|
|
3
3
|
*/
|
|
4
4
|
export * from './lib/cms.module';
|
|
5
|
-
// export * from './lib/cms-routing.module';
|
|
6
5
|
export * from './lib/components/dynamic-form';
|
|
7
|
-
|
|
8
|
-
// export * from './lib/services/simple-reuse-strategy';
|
|
9
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2Ntcy9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsa0JBQWtCLENBQUM7QUFDakMsNENBQTRDO0FBQzVDLGNBQWMsK0JBQStCLENBQUM7QUFDOUMsK0JBQStCO0FBQy9CLHdEQUF3RCIsInNvdXJjZXNDb250ZW50IjpbIi8qXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBjbXNcclxuICovXHJcblxyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9jbXMubW9kdWxlJztcclxuLy8gZXhwb3J0ICogZnJvbSAnLi9saWIvY21zLXJvdXRpbmcubW9kdWxlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvY29tcG9uZW50cy9keW5hbWljLWZvcm0nO1xyXG4vLyBleHBvcnQgKiBmcm9tICcuL2xpYi9wcm94eSc7XHJcbi8vIGV4cG9ydCAqIGZyb20gJy4vbGliL3NlcnZpY2VzL3NpbXBsZS1yZXVzZS1zdHJhdGVneSc7XHJcbiJdfQ==
|
|
6
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL2Ntcy9zcmMvcHVibGljLWFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsa0JBQWtCLENBQUM7QUFDakMsY0FBYywrQkFBK0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbIi8qXHJcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBjbXNcclxuICovXHJcblxyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9jbXMubW9kdWxlJztcclxuZXhwb3J0ICogZnJvbSAnLi9saWIvY29tcG9uZW50cy9keW5hbWljLWZvcm0nO1xyXG4iXX0=
|
|
@@ -1,36 +1,45 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, inject, Component, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@abp/ng.core';
|
|
4
|
-
import { LocalizationService, CoreModule, RoutesService } from '@abp/ng.core';
|
|
4
|
+
import { LocalizationService, CoreModule, ConfigStateService, RoutesService } from '@abp/ng.core';
|
|
5
5
|
import { SettingTabsService } from '@abp/ng.setting-management/config';
|
|
6
6
|
import * as i2 from '@angular/forms';
|
|
7
|
-
import { FormGroup, FormControl, FormsModule } from '@angular/forms';
|
|
7
|
+
import { FormBuilder, FormGroup, FormControl, FormArray, FormsModule, Validators } from '@angular/forms';
|
|
8
8
|
import { ToasterService, ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
9
9
|
import * as i1$1 from '@angular/common';
|
|
10
10
|
import * as i4 from '@ngx-validate/core';
|
|
11
11
|
|
|
12
|
+
var eCmsRouteNames;
|
|
13
|
+
(function (eCmsRouteNames) {
|
|
14
|
+
eCmsRouteNames["Cms"] = "Cms::Menu:Cms";
|
|
15
|
+
eCmsRouteNames["Entries"] = "Cms::FormControl:Entry";
|
|
16
|
+
eCmsRouteNames["Settings"] = "Cms::Menu:Settings";
|
|
17
|
+
eCmsRouteNames["Fields"] = "Cms::Fields";
|
|
18
|
+
eCmsRouteNames["Sections"] = "Cms::Sections";
|
|
19
|
+
eCmsRouteNames["SiteLanguage"] = "Cms::DisplayName:Cms.Site.Languages";
|
|
20
|
+
})(eCmsRouteNames || (eCmsRouteNames = {}));
|
|
21
|
+
|
|
12
22
|
class DomainAdminService {
|
|
13
|
-
restService;
|
|
14
|
-
apiName = 'CmsAdmin';
|
|
15
|
-
getBound = (config) => this.restService.request({
|
|
16
|
-
method: 'GET',
|
|
17
|
-
url: '/api/cms-admin/domains/bound',
|
|
18
|
-
}, { apiName: this.apiName, ...config });
|
|
19
|
-
nameExists = (domainName, config) => this.restService.request({
|
|
20
|
-
method: 'GET',
|
|
21
|
-
url: '/api/cms-admin/domains/name-exists',
|
|
22
|
-
params: { domainName },
|
|
23
|
-
}, { apiName: this.apiName, ...config });
|
|
24
|
-
update = (input, config) => this.restService.request({
|
|
25
|
-
method: 'POST',
|
|
26
|
-
url: '/api/cms-admin/domains',
|
|
27
|
-
body: input,
|
|
28
|
-
}, { apiName: this.apiName, ...config });
|
|
29
23
|
constructor(restService) {
|
|
30
24
|
this.restService = restService;
|
|
25
|
+
this.apiName = 'CmsAdmin';
|
|
26
|
+
this.getBound = (config) => this.restService.request({
|
|
27
|
+
method: 'GET',
|
|
28
|
+
url: '/api/cms-admin/domains/bound',
|
|
29
|
+
}, { apiName: this.apiName, ...config });
|
|
30
|
+
this.nameExists = (domainName, config) => this.restService.request({
|
|
31
|
+
method: 'GET',
|
|
32
|
+
url: '/api/cms-admin/domains/name-exists',
|
|
33
|
+
params: { domainName },
|
|
34
|
+
}, { apiName: this.apiName, ...config });
|
|
35
|
+
this.update = (input, config) => this.restService.request({
|
|
36
|
+
method: 'POST',
|
|
37
|
+
url: '/api/cms-admin/domains',
|
|
38
|
+
body: input,
|
|
39
|
+
}, { apiName: this.apiName, ...config });
|
|
31
40
|
}
|
|
32
|
-
static
|
|
33
|
-
static
|
|
41
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
42
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, providedIn: 'root' }); }
|
|
34
43
|
}
|
|
35
44
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, decorators: [{
|
|
36
45
|
type: Injectable,
|
|
@@ -39,14 +48,99 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
39
48
|
}]
|
|
40
49
|
}], ctorParameters: () => [{ type: i1.RestService }] });
|
|
41
50
|
|
|
51
|
+
class ValidatorsService {
|
|
52
|
+
constructor() {
|
|
53
|
+
this.fb = inject(FormBuilder);
|
|
54
|
+
this.toaster = inject(ToasterService);
|
|
55
|
+
this._LocalizationService = inject(LocalizationService);
|
|
56
|
+
}
|
|
57
|
+
/**检查表单- */
|
|
58
|
+
isCheckForm(input, module = 'AbpValidation') {
|
|
59
|
+
let keys = Object.keys(input);
|
|
60
|
+
for (let i = 0; i < keys.length; i++) {
|
|
61
|
+
const element = keys[i];
|
|
62
|
+
if (input[element] == false) {
|
|
63
|
+
let info = `"${this._LocalizationService.instant(`${module}::${element}`)}" `;
|
|
64
|
+
if (element.includes('.') && !element.includes('].')) {
|
|
65
|
+
let arr = element.split('.');
|
|
66
|
+
info = `"${this._LocalizationService.instant(`CmsKit::${arr[0]}`)}.${this._LocalizationService.instant(`CmsKit::${arr[1]}`)}"`;
|
|
67
|
+
}
|
|
68
|
+
if (element.includes('].')) {
|
|
69
|
+
let arr = element.split('].');
|
|
70
|
+
let arrStart = arr[0].split('[');
|
|
71
|
+
info = `"${this._LocalizationService.instant(`CmsKit::${arrStart[0]}`)}[${arrStart[1]}].${this._LocalizationService.instant(`CmsKit::${arr[1]}`)}"`;
|
|
72
|
+
}
|
|
73
|
+
info += `${this._LocalizationService.instant(`AbpValidation::ThisFieldIsNotValid`)}`;
|
|
74
|
+
//使用abp多语言提示
|
|
75
|
+
this.toaster.warn(info);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
/**获取表单所有字段是否通过验证 */
|
|
82
|
+
getFormValidationStatus(formEntity) {
|
|
83
|
+
let validationStatus = {};
|
|
84
|
+
// 递归遍历表单组和表单控件集合
|
|
85
|
+
const traverseForm = (form, prefix = '') => {
|
|
86
|
+
if (form instanceof FormGroup) {
|
|
87
|
+
Object.keys(form.controls).forEach(key => {
|
|
88
|
+
const control = form.controls[key];
|
|
89
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
90
|
+
if (control instanceof FormControl) {
|
|
91
|
+
validationStatus[fullKey] = control.valid;
|
|
92
|
+
}
|
|
93
|
+
else if (control instanceof FormArray) {
|
|
94
|
+
traverseForm(control, fullKey);
|
|
95
|
+
}
|
|
96
|
+
else if (control instanceof FormGroup) {
|
|
97
|
+
traverseForm(control, fullKey);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
else if (form instanceof FormArray) {
|
|
102
|
+
form.controls.forEach((control, index) => {
|
|
103
|
+
const fullKey = prefix ? `${prefix}[${index}]` : `[${index}]`;
|
|
104
|
+
if (control instanceof FormControl) {
|
|
105
|
+
validationStatus[fullKey] = control.valid;
|
|
106
|
+
}
|
|
107
|
+
else if (control instanceof FormArray) {
|
|
108
|
+
traverseForm(control, fullKey);
|
|
109
|
+
}
|
|
110
|
+
else if (control instanceof FormGroup) {
|
|
111
|
+
traverseForm(control, fullKey);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
traverseForm(formEntity);
|
|
117
|
+
return validationStatus;
|
|
118
|
+
}
|
|
119
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
120
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, providedIn: 'root' }); }
|
|
121
|
+
}
|
|
122
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, decorators: [{
|
|
123
|
+
type: Injectable,
|
|
124
|
+
args: [{
|
|
125
|
+
providedIn: 'root'
|
|
126
|
+
}]
|
|
127
|
+
}], ctorParameters: () => [] });
|
|
128
|
+
|
|
42
129
|
class DomainsComponent {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
130
|
+
constructor() {
|
|
131
|
+
this.toaster = inject(ToasterService);
|
|
132
|
+
this._DomainAdminService = inject(DomainAdminService);
|
|
133
|
+
this._LocalizationService = inject(LocalizationService);
|
|
134
|
+
/**domain详情 */
|
|
135
|
+
this.domainInfo = '';
|
|
136
|
+
this._ValidatorsService = inject(ValidatorsService);
|
|
137
|
+
/**表单验证状态
|
|
138
|
+
* {
|
|
139
|
+
* title:true,
|
|
140
|
+
* }
|
|
141
|
+
*/
|
|
142
|
+
this.formValidation = '';
|
|
143
|
+
}
|
|
50
144
|
get domainNameInput() {
|
|
51
145
|
return this.newEntity.get('domainName');
|
|
52
146
|
}
|
|
@@ -103,13 +197,16 @@ class DomainsComponent {
|
|
|
103
197
|
/**保存 */
|
|
104
198
|
SaveSubmit() {
|
|
105
199
|
let input = this.newEntity.value;
|
|
200
|
+
this.formValidation = this._ValidatorsService.getFormValidationStatus(this.newEntity);
|
|
201
|
+
if (this._ValidatorsService.isCheckForm(this.formValidation, 'Cms'))
|
|
202
|
+
return;
|
|
106
203
|
this._DomainAdminService.update(input).subscribe(async (res) => {
|
|
107
|
-
this.toaster.success(this._LocalizationService.instant(`AbpUi
|
|
204
|
+
this.toaster.success(this._LocalizationService.instant(`AbpUi::SavedSuccessfully`));
|
|
108
205
|
await this.getDomainsBound();
|
|
109
206
|
});
|
|
110
207
|
}
|
|
111
|
-
static
|
|
112
|
-
static
|
|
208
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
209
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DomainsComponent, isStandalone: true, selector: "cms-domains", ngImport: i0, template: "<form [formGroup]=\"newEntity\" (keydown.enter)=\"$event.preventDefault()\" [class]=\"{'was-validated':formValidation}\" (submit)=\"SaveSubmit()\">\n \n <div class=\"d-flex align-items-center justify-content-between\">\n <h2>{{'Cms::Domain'|abpLocalization}}</h2>\n <button class=\"btn btn-primary btn-sm\" type=\"submit\"><i\n class=\"me-1 fas fa-save\"></i>{{'AbpUi::Save'|abpLocalization}}</button>\n </div>\n <hr class=\"my-3\" />\n <div class=\"mb-2\">\n <input type=\"text\" class=\"form-control\" formControlName=\"domainName\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"domainNameInput.errors?.repetition\">\n {{domainNameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">\u6B64\u5904\u662F\u586B\u5199\u57DF\u540D\u7684\u63CF\u8FF0\uFF0C\u9700\u8981\u4E00\u4E2A\u5B57\u6BB5\u7EDF\u4E00\u914D\u7F6E\u57DF\u540D\u591A\u8BED\u8A00\uFF0C</div>\n </div>\n <hr class=\"my-3\" />\n</form>", styles: [""], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }, { kind: "ngmodule", type: ThemeSharedModule }, { kind: "directive", type: i4.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i4.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "ngmodule", type: FormsModule }] }); }
|
|
113
210
|
}
|
|
114
211
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainsComponent, decorators: [{
|
|
115
212
|
type: Component,
|
|
@@ -117,7 +214,127 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
117
214
|
CoreModule,
|
|
118
215
|
ThemeSharedModule,
|
|
119
216
|
FormsModule,
|
|
120
|
-
], template: "<form [formGroup]=\"newEntity\" (
|
|
217
|
+
], template: "<form [formGroup]=\"newEntity\" (keydown.enter)=\"$event.preventDefault()\" [class]=\"{'was-validated':formValidation}\" (submit)=\"SaveSubmit()\">\n \n <div class=\"d-flex align-items-center justify-content-between\">\n <h2>{{'Cms::Domain'|abpLocalization}}</h2>\n <button class=\"btn btn-primary btn-sm\" type=\"submit\"><i\n class=\"me-1 fas fa-save\"></i>{{'AbpUi::Save'|abpLocalization}}</button>\n </div>\n <hr class=\"my-3\" />\n <div class=\"mb-2\">\n <input type=\"text\" class=\"form-control\" formControlName=\"domainName\">\n <div class=\"text-danger invalid-feedback\" *ngIf=\"domainNameInput.errors?.repetition\">\n {{domainNameInput.errors?.repetition}}\n </div>\n <div class=\"form-text\">\u6B64\u5904\u662F\u586B\u5199\u57DF\u540D\u7684\u63CF\u8FF0\uFF0C\u9700\u8981\u4E00\u4E2A\u5B57\u6BB5\u7EDF\u4E00\u914D\u7F6E\u57DF\u540D\u591A\u8BED\u8A00\uFF0C</div>\n </div>\n <hr class=\"my-3\" />\n</form>" }]
|
|
218
|
+
}] });
|
|
219
|
+
|
|
220
|
+
class SiteAdminService {
|
|
221
|
+
constructor(restService) {
|
|
222
|
+
this.restService = restService;
|
|
223
|
+
this.apiName = 'CmsAdmin';
|
|
224
|
+
this.get = (config) => this.restService.request({
|
|
225
|
+
method: 'GET',
|
|
226
|
+
url: '/api/cms-admin/sites',
|
|
227
|
+
}, { apiName: this.apiName, ...config });
|
|
228
|
+
this.update = (input, config) => this.restService.request({
|
|
229
|
+
method: 'PUT',
|
|
230
|
+
url: '/api/cms-admin/sites',
|
|
231
|
+
body: input,
|
|
232
|
+
}, { apiName: this.apiName, ...config });
|
|
233
|
+
}
|
|
234
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SiteAdminService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
235
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SiteAdminService, providedIn: 'root' }); }
|
|
236
|
+
}
|
|
237
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SiteAdminService, decorators: [{
|
|
238
|
+
type: Injectable,
|
|
239
|
+
args: [{
|
|
240
|
+
providedIn: 'root',
|
|
241
|
+
}]
|
|
242
|
+
}], ctorParameters: () => [{ type: i1.RestService }] });
|
|
243
|
+
|
|
244
|
+
// import { SiteAdminService } from '../../../../proxy/dignite/cms/admin/sites';
|
|
245
|
+
class SiteLanguageComponent {
|
|
246
|
+
constructor() {
|
|
247
|
+
this.fb = inject(FormBuilder);
|
|
248
|
+
this.toaster = inject(ToasterService);
|
|
249
|
+
this._LocalizationService = inject(LocalizationService);
|
|
250
|
+
this.configState = inject(ConfigStateService);
|
|
251
|
+
this._SiteAdminService = inject(SiteAdminService);
|
|
252
|
+
// private SiteLanguagesService = inject(SiteLanguagesService);
|
|
253
|
+
this.eCmsRouteNames = eCmsRouteNames;
|
|
254
|
+
/**系统语言 */
|
|
255
|
+
this.languagesSystem = [];
|
|
256
|
+
}
|
|
257
|
+
async ngOnInit() {
|
|
258
|
+
//Called after the constructor, initializing input properties, and the first call to ngOnChanges.
|
|
259
|
+
//Add 'implements OnInit' to the class.
|
|
260
|
+
//获取所有语言 */
|
|
261
|
+
let languagesSystem = this.configState.getDeep('localization.languages');
|
|
262
|
+
languagesSystem.map(el => {
|
|
263
|
+
el.ischecked = false;
|
|
264
|
+
el.isDefault = false;
|
|
265
|
+
});
|
|
266
|
+
this.languagesSystem = languagesSystem;
|
|
267
|
+
this.newEntity = this.fb.group({
|
|
268
|
+
defaultLanguage: ['', [Validators.required]],
|
|
269
|
+
allLanguages: [[], [Validators.required]],
|
|
270
|
+
});
|
|
271
|
+
await this.getSiteLanguageSettings();
|
|
272
|
+
}
|
|
273
|
+
/**获取配置的默认语言与选中语言 */
|
|
274
|
+
getSiteLanguageSettings() {
|
|
275
|
+
return new Promise((resolve, rejects) => {
|
|
276
|
+
this._SiteAdminService.get().subscribe((res) => {
|
|
277
|
+
this.newEntity.patchValue({
|
|
278
|
+
defaultLanguage: res.defaultLanguage,
|
|
279
|
+
allLanguages: res.allLanguages
|
|
280
|
+
});
|
|
281
|
+
this.languagesSystem.forEach((el) => {
|
|
282
|
+
el.ischecked = res.allLanguages.includes(el.cultureName);
|
|
283
|
+
el.isDefault = el.cultureName === res.defaultLanguage;
|
|
284
|
+
});
|
|
285
|
+
resolve(true);
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
/**语言改变 */
|
|
290
|
+
setLanguagesChange(event, item) {
|
|
291
|
+
let checked = event.target.checked;
|
|
292
|
+
item.ischecked = checked;
|
|
293
|
+
this.setFromLangguages();
|
|
294
|
+
}
|
|
295
|
+
/**设置默认语言 */
|
|
296
|
+
setDefault(items) {
|
|
297
|
+
this.languagesSystem.forEach(el => {
|
|
298
|
+
el.isDefault = false;
|
|
299
|
+
});
|
|
300
|
+
items.isDefault = true;
|
|
301
|
+
this.newEntity.patchValue({
|
|
302
|
+
defaultLanguage: items.cultureName
|
|
303
|
+
});
|
|
304
|
+
this.setFromLangguages();
|
|
305
|
+
}
|
|
306
|
+
/**设置表单中的语言 */
|
|
307
|
+
setFromLangguages() {
|
|
308
|
+
let languagesSelect = this.languagesSystem.filter(el => el.ischecked == true).map(el => el.cultureName);
|
|
309
|
+
this.newEntity.patchValue({
|
|
310
|
+
allLanguages: languagesSelect
|
|
311
|
+
});
|
|
312
|
+
if (languagesSelect.length == 0) {
|
|
313
|
+
this.languagesSystem.forEach(el => {
|
|
314
|
+
el.isDefault = false;
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
/**保存 */
|
|
319
|
+
SaveSubmit() {
|
|
320
|
+
let input = this.newEntity.value;
|
|
321
|
+
this._SiteAdminService.update({
|
|
322
|
+
...input
|
|
323
|
+
}).subscribe((res => {
|
|
324
|
+
this.toaster.success(this._LocalizationService.instant(`AbpUi::SavedSuccessfully`));
|
|
325
|
+
this.getSiteLanguageSettings();
|
|
326
|
+
}));
|
|
327
|
+
}
|
|
328
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SiteLanguageComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
329
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: SiteLanguageComponent, isStandalone: true, selector: "app-site-language", ngImport: i0, template: "<form [formGroup]=\"newEntity\" (keydown.enter)=\"$event.preventDefault()\" (submit)=\"SaveSubmit()\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <h2>{{eCmsRouteNames.SiteLanguage|abpLocalization}}</h2>\r\n <button class=\"btn btn-primary btn-sm\" type=\"submit\"><i\r\n class=\"me-1 fas fa-save\"></i>{{'AbpUi::\u4FDD\u5B58'|abpLocalization}}</button>\r\n </div>\r\n <hr class=\"my-3\" />\r\n <div class=\"mb-2\">\r\n <label class=\"form-label\" for=\"title\">{{'Travely::Language' | abpLocalization}}</label>\r\n <ul class=\"list-group\">\r\n <ng-container *ngFor=\"let item of languagesSystem;let i=index\">\r\n <li class=\"list-group-item d-flex align-items-center justify-content-between\">\r\n <div class=\"form-check\">\r\n <input class=\"form-check-input\" type=\"checkbox\" value=\"\" id=\"Languages{{i}}\"\r\n [checked]=\"item.ischecked\" (change)=\"setLanguagesChange($event,item)\" />\r\n <label class=\"form-check-label\" for=\"Languages{{i}}\">\r\n {{item.displayName}}\r\n </label>\r\n </div>\r\n <ng-container *ngIf=\"item.ischecked\">\r\n <div class=\"text-primary fs-5\" type=\"button\" *ngIf=\"item.isDefault\">\r\n {{'Travely::Default'|abpLocalization}}</div>\r\n <div class=\"text-muted fs-5\" type=\"button\" (click.stop)=\"setDefault(item)\"\r\n *ngIf=\"!item.isDefault\">{{'Travely::SetDefault'|abpLocalization}}</div>\r\n </ng-container>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </div>\r\n <hr class=\"my-3\" />\r\n</form>", styles: [""], dependencies: [{ kind: "ngmodule", type: CoreModule }, { kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }, { kind: "directive", type: i1.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "ngmodule", type: ThemeSharedModule }, { kind: "directive", type: i4.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "ngmodule", type: FormsModule }] }); }
|
|
330
|
+
}
|
|
331
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SiteLanguageComponent, decorators: [{
|
|
332
|
+
type: Component,
|
|
333
|
+
args: [{ selector: 'app-site-language', standalone: true, imports: [
|
|
334
|
+
CoreModule,
|
|
335
|
+
ThemeSharedModule,
|
|
336
|
+
FormsModule,
|
|
337
|
+
], template: "<form [formGroup]=\"newEntity\" (keydown.enter)=\"$event.preventDefault()\" (submit)=\"SaveSubmit()\">\r\n <div class=\"d-flex align-items-center justify-content-between\">\r\n <h2>{{eCmsRouteNames.SiteLanguage|abpLocalization}}</h2>\r\n <button class=\"btn btn-primary btn-sm\" type=\"submit\"><i\r\n class=\"me-1 fas fa-save\"></i>{{'AbpUi::\u4FDD\u5B58'|abpLocalization}}</button>\r\n </div>\r\n <hr class=\"my-3\" />\r\n <div class=\"mb-2\">\r\n <label class=\"form-label\" for=\"title\">{{'Travely::Language' | abpLocalization}}</label>\r\n <ul class=\"list-group\">\r\n <ng-container *ngFor=\"let item of languagesSystem;let i=index\">\r\n <li class=\"list-group-item d-flex align-items-center justify-content-between\">\r\n <div class=\"form-check\">\r\n <input class=\"form-check-input\" type=\"checkbox\" value=\"\" id=\"Languages{{i}}\"\r\n [checked]=\"item.ischecked\" (change)=\"setLanguagesChange($event,item)\" />\r\n <label class=\"form-check-label\" for=\"Languages{{i}}\">\r\n {{item.displayName}}\r\n </label>\r\n </div>\r\n <ng-container *ngIf=\"item.ischecked\">\r\n <div class=\"text-primary fs-5\" type=\"button\" *ngIf=\"item.isDefault\">\r\n {{'Travely::Default'|abpLocalization}}</div>\r\n <div class=\"text-muted fs-5\" type=\"button\" (click.stop)=\"setDefault(item)\"\r\n *ngIf=\"!item.isDefault\">{{'Travely::SetDefault'|abpLocalization}}</div>\r\n </ng-container>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </div>\r\n <hr class=\"my-3\" />\r\n</form>" }]
|
|
121
338
|
}] });
|
|
122
339
|
|
|
123
340
|
const CMS_ROUTE_PROVIDERS = [
|
|
@@ -133,39 +350,43 @@ function configureRoutes(routesService, settingTabs) {
|
|
|
133
350
|
settingTabs.add([
|
|
134
351
|
{
|
|
135
352
|
name: 'Cms::Domain',
|
|
136
|
-
order: 1,
|
|
137
353
|
requiredPolicy: 'CmsAdmin.Domain',
|
|
138
354
|
component: DomainsComponent,
|
|
139
355
|
},
|
|
356
|
+
{
|
|
357
|
+
name: eCmsRouteNames.SiteLanguage,
|
|
358
|
+
requiredPolicy: 'TravelyAdmin.SiteSetting',
|
|
359
|
+
component: SiteLanguageComponent,
|
|
360
|
+
},
|
|
140
361
|
]);
|
|
141
362
|
routesService.add([
|
|
142
363
|
{
|
|
143
364
|
path: '/cms',
|
|
144
|
-
name:
|
|
365
|
+
name: eCmsRouteNames.Cms,
|
|
145
366
|
iconClass: 'bi-archive-fill',
|
|
146
367
|
layout: "application" /* eLayoutType.application */,
|
|
147
368
|
requiredPolicy: 'CmsAdmin.Entry || CmsAdmin.Field || CmsAdmin.Site || CmsAdmin.Section',
|
|
148
369
|
},
|
|
149
370
|
{
|
|
150
371
|
path: '/cms/admin/entries',
|
|
151
|
-
name:
|
|
152
|
-
parentName:
|
|
372
|
+
name: eCmsRouteNames.Entries,
|
|
373
|
+
parentName: eCmsRouteNames.Cms,
|
|
153
374
|
iconClass: 'bi-file-earmark-text-fill',
|
|
154
375
|
layout: "application" /* eLayoutType.application */,
|
|
155
376
|
requiredPolicy: 'CmsAdmin.Entry',
|
|
156
377
|
},
|
|
157
378
|
{
|
|
158
379
|
path: '',
|
|
159
|
-
name:
|
|
160
|
-
parentName:
|
|
380
|
+
name: eCmsRouteNames.Settings,
|
|
381
|
+
parentName: eCmsRouteNames.Cms,
|
|
161
382
|
iconClass: 'fas fa fa-cog',
|
|
162
383
|
layout: "application" /* eLayoutType.application */,
|
|
163
384
|
requiredPolicy: 'CmsAdmin.Field || CmsAdmin.Section',
|
|
164
385
|
},
|
|
165
386
|
{
|
|
166
387
|
path: '/cms/admin/fields',
|
|
167
|
-
name:
|
|
168
|
-
parentName:
|
|
388
|
+
name: eCmsRouteNames.Fields,
|
|
389
|
+
parentName: eCmsRouteNames.Settings,
|
|
169
390
|
iconClass: 'bi-file-earmark-text-fill',
|
|
170
391
|
layout: "application" /* eLayoutType.application */,
|
|
171
392
|
order: 1,
|
|
@@ -173,8 +394,8 @@ function configureRoutes(routesService, settingTabs) {
|
|
|
173
394
|
},
|
|
174
395
|
{
|
|
175
396
|
path: '/cms/admin/sections',
|
|
176
|
-
name:
|
|
177
|
-
parentName:
|
|
397
|
+
name: eCmsRouteNames.Sections,
|
|
398
|
+
parentName: eCmsRouteNames.Settings,
|
|
178
399
|
iconClass: 'bi bi-menu-button-wide-fill',
|
|
179
400
|
layout: "application" /* eLayoutType.application */,
|
|
180
401
|
order: 3,
|
|
@@ -191,9 +412,9 @@ class CmsConfigModule {
|
|
|
191
412
|
providers: [CMS_ROUTE_PROVIDERS],
|
|
192
413
|
};
|
|
193
414
|
}
|
|
194
|
-
static
|
|
195
|
-
static
|
|
196
|
-
static
|
|
415
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
416
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule }); }
|
|
417
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule }); }
|
|
197
418
|
}
|
|
198
419
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule, decorators: [{
|
|
199
420
|
type: NgModule
|
|
@@ -203,5 +424,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
203
424
|
* Generated bundle index. Do not edit.
|
|
204
425
|
*/
|
|
205
426
|
|
|
206
|
-
export { CMS_ROUTE_PROVIDERS, CmsConfigModule, configureRoutes };
|
|
427
|
+
export { CMS_ROUTE_PROVIDERS, CmsConfigModule, configureRoutes, eCmsRouteNames };
|
|
207
428
|
//# sourceMappingURL=dignite-ng-expand.cms-config.mjs.map
|