@dignite-ng/expand.cms 0.0.49 → 0.0.50

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.
Files changed (84) hide show
  1. package/config/components/domains/domains.component.d.ts +7 -0
  2. package/config/components/site-language/site-language.component.d.ts +29 -0
  3. package/config/enums/route-names.d.ts +3 -2
  4. package/config/proxy/dignite/cms/admin/sites/index.d.ts +2 -0
  5. package/config/proxy/dignite/cms/admin/sites/models.d.ts +4 -0
  6. package/config/proxy/dignite/cms/admin/sites/site-admin.service.d.ts +13 -0
  7. package/config/proxy/dignite/cms/sites/models.d.ts +4 -0
  8. package/config/services/validators.service.d.ts +16 -0
  9. package/esm2022/config/cms-config.module.mjs +4 -4
  10. package/esm2022/config/components/domains/domains.component.mjs +22 -11
  11. package/esm2022/config/components/site-language/site-language.component.mjs +108 -0
  12. package/esm2022/config/enums/route-names.mjs +11 -2
  13. package/esm2022/config/providers/route.provider.mjs +17 -11
  14. package/esm2022/config/proxy/admin/domains/domain-admin.service.mjs +18 -19
  15. package/esm2022/config/proxy/dignite/cms/admin/sites/index.mjs +3 -0
  16. package/esm2022/config/proxy/dignite/cms/admin/sites/models.mjs +2 -0
  17. package/esm2022/config/proxy/dignite/cms/admin/sites/site-admin.service.mjs +27 -0
  18. package/esm2022/config/proxy/dignite/cms/sites/models.mjs +2 -0
  19. package/esm2022/config/services/validators.service.mjs +82 -0
  20. package/esm2022/lib/cms-routing.module.mjs +6 -6
  21. package/esm2022/lib/cms.module.mjs +16 -8
  22. package/esm2022/lib/components/admin/entries/create-or-edit-entries.component.mjs +29 -44
  23. package/esm2022/lib/components/admin/entries/create-or-update-entry-input-base.mjs +20 -20
  24. package/esm2022/lib/components/admin/entries/create.component.mjs +25 -23
  25. package/esm2022/lib/components/admin/entries/edit.component.mjs +25 -23
  26. package/esm2022/lib/components/admin/entries/entries.component.mjs +36 -43
  27. package/esm2022/lib/components/admin/fields/create-field.component.mjs +18 -18
  28. package/esm2022/lib/components/admin/fields/create-or-edit-field.component.mjs +8 -15
  29. package/esm2022/lib/components/admin/fields/create-or-update-field-input-base.mjs +13 -13
  30. package/esm2022/lib/components/admin/fields/edit-field.component.mjs +20 -23
  31. package/esm2022/lib/components/admin/fields/field-group.component.mjs +35 -27
  32. package/esm2022/lib/components/admin/fields/fields.component.mjs +14 -20
  33. package/esm2022/lib/components/admin/sections/create-or-update-sections-input-base.mjs +15 -15
  34. package/esm2022/lib/components/admin/sections/entry-types/create-or-edit.-entry-type-input-base.mjs +26 -26
  35. package/esm2022/lib/components/admin/sections/entry-types/create-or-edit.component.mjs +43 -66
  36. package/esm2022/lib/components/admin/sections/sections.component.mjs +28 -25
  37. package/esm2022/lib/components/dynamic-form/entry/entry-config.component.mjs +10 -21
  38. package/esm2022/lib/components/dynamic-form/entry/entry-config.mjs +7 -7
  39. package/esm2022/lib/components/dynamic-form/entry/entry-control.component.mjs +9 -19
  40. package/esm2022/lib/components/dynamic-form/matrix/matrix-config.component.mjs +14 -30
  41. package/esm2022/lib/components/dynamic-form/matrix/matrix-config.mjs +16 -16
  42. package/esm2022/lib/components/dynamic-form/matrix/matrix-control.component.mjs +7 -22
  43. package/esm2022/lib/components/dynamic-form/table/table-config.component.mjs +8 -30
  44. package/esm2022/lib/components/dynamic-form/table/table-config.mjs +15 -15
  45. package/esm2022/lib/components/dynamic-form/table/table-control.component.mjs +6 -20
  46. package/esm2022/lib/constants/styles.mjs +6 -1
  47. package/esm2022/lib/proxy/admin/dynamic-forms/form-admin.service.mjs +8 -9
  48. package/esm2022/lib/proxy/admin/entries/entry-admin.service.mjs +56 -57
  49. package/esm2022/lib/proxy/admin/fields/field-admin.service.mjs +31 -32
  50. package/esm2022/lib/proxy/admin/fields/field-group-admin.service.mjs +27 -28
  51. package/esm2022/lib/proxy/admin/sections/entry-type-admin.service.mjs +27 -28
  52. package/esm2022/lib/proxy/admin/sections/section-admin.service.mjs +37 -38
  53. package/esm2022/lib/proxy/admin/settings/site-settings-admin.service.mjs +17 -18
  54. package/esm2022/lib/resolvers/extensions-props-action-token.resolver.mjs +132 -0
  55. package/esm2022/lib/resolvers/page-default-toolbar-actions.mjs +160 -0
  56. package/esm2022/lib/services/cms-api.service.mjs +3 -4
  57. package/esm2022/lib/services/cms.service.mjs +4 -5
  58. package/esm2022/lib/services/field-abstracts.service.mjs +7 -9
  59. package/esm2022/lib/services/simple-reuse-strategy.mjs +2 -2
  60. package/esm2022/lib/services/update-list.service.mjs +6 -5
  61. package/esm2022/lib/services/validators.service.mjs +83 -0
  62. package/esm2022/public-api.mjs +1 -4
  63. package/fesm2022/dignite-ng-expand.cms-config.mjs +265 -44
  64. package/fesm2022/dignite-ng-expand.cms-config.mjs.map +1 -1
  65. package/fesm2022/dignite-ng-expand.cms.mjs +856 -865
  66. package/fesm2022/dignite-ng-expand.cms.mjs.map +1 -1
  67. package/lib/components/admin/entries/create.component.d.ts +7 -0
  68. package/lib/components/admin/entries/edit.component.d.ts +7 -0
  69. package/lib/components/admin/fields/create-field.component.d.ts +7 -0
  70. package/lib/components/admin/fields/create-or-edit-field.component.d.ts +3 -1
  71. package/lib/components/admin/fields/edit-field.component.d.ts +7 -0
  72. package/lib/components/admin/fields/field-group.component.d.ts +7 -0
  73. package/lib/components/admin/sections/entry-types/create-or-edit.component.d.ts +7 -0
  74. package/lib/components/admin/sections/sections.component.d.ts +7 -0
  75. package/lib/constants/styles.d.ts +1 -1
  76. package/lib/resolvers/extensions-props-action-token.resolver.d.ts +71 -0
  77. package/lib/services/validators.service.d.ts +16 -0
  78. package/package.json +1 -1
  79. package/esm2022/lib/toolbar/index.mjs +0 -3
  80. package/esm2022/lib/toolbar/toolbar-btn-default-action.mjs +0 -160
  81. package/esm2022/lib/toolbar/toolbar-config.mjs +0 -83
  82. package/lib/toolbar/index.d.ts +0 -2
  83. package/lib/toolbar/toolbar-config.d.ts +0 -56
  84. /package/lib/{toolbar/toolbar-btn-default-action.d.ts → resolvers/page-default-toolbar-actions.d.ts} +0 -0
@@ -0,0 +1,83 @@
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
+ isCheckForm(input) {
14
+ let keys = Object.keys(input);
15
+ for (let i = 0; i < keys.length; i++) {
16
+ const element = keys[i];
17
+ if (input[element] == false) {
18
+ let info = `请检查 ${this._LocalizationService.instant(`CmsKit::${element}`)} 字段`;
19
+ if (element.includes('.') && !element.includes('].')) {
20
+ let arr = element.split('.');
21
+ info = `请检查 ${this._LocalizationService.instant(`Cms::${arr[0]}`)} 的 ${this._LocalizationService.instant(`Cms::${arr[1]}`)}字段`;
22
+ }
23
+ if (element.includes('].')) {
24
+ let arr = element.split('].');
25
+ let arrStart = arr[0].split('[');
26
+ info = `请检查 ${this._LocalizationService.instant(`Cms::${arrStart[0]}`)}[${arrStart[1]}] 的 ${this._LocalizationService.instant(`Cms::${arr[1]}`)}字段`;
27
+ }
28
+ //使用abp多语言提示
29
+ this.toaster.warn(info);
30
+ return true;
31
+ }
32
+ }
33
+ return false;
34
+ }
35
+ /**获取表单所有字段是否通过验证 */
36
+ getFormValidationStatus(formEntity) {
37
+ let validationStatus = {};
38
+ // 递归遍历表单组和表单控件集合
39
+ const traverseForm = (form, prefix = '') => {
40
+ if (form instanceof FormGroup) {
41
+ Object.keys(form.controls).forEach(key => {
42
+ const control = form.controls[key];
43
+ let displayName = key.charAt(0).toUpperCase() + key.slice(1);
44
+ const fullKey = prefix ? `${prefix}.${displayName}` : displayName;
45
+ if (control instanceof FormControl) {
46
+ validationStatus[fullKey] = control.valid;
47
+ }
48
+ else if (control instanceof FormArray) {
49
+ traverseForm(control, fullKey);
50
+ }
51
+ else if (control instanceof FormGroup) {
52
+ traverseForm(control, fullKey);
53
+ }
54
+ });
55
+ }
56
+ else if (form instanceof FormArray) {
57
+ form.controls.forEach((control, index) => {
58
+ const fullKey = prefix ? `${prefix}[${index}]` : `[${index}]`;
59
+ if (control instanceof FormControl) {
60
+ validationStatus[fullKey] = control.valid;
61
+ }
62
+ else if (control instanceof FormArray) {
63
+ traverseForm(control, fullKey);
64
+ }
65
+ else if (control instanceof FormGroup) {
66
+ traverseForm(control, fullKey);
67
+ }
68
+ });
69
+ }
70
+ };
71
+ traverseForm(formEntity);
72
+ return validationStatus;
73
+ }
74
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
75
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, providedIn: 'root' }); }
76
+ }
77
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: ValidatorsService, decorators: [{
78
+ type: Injectable,
79
+ args: [{
80
+ providedIn: 'root'
81
+ }]
82
+ }], ctorParameters: () => [] });
83
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdG9ycy5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcHJvamVjdHMvY21zL3NyYy9saWIvc2VydmljZXMvdmFsaWRhdG9ycy5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLGNBQWMsQ0FBQztBQUNuRCxPQUFPLEVBQUUsY0FBYyxFQUFFLE1BQU0sc0JBQXNCLENBQUM7QUFDdEQsT0FBTyxFQUF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HtcclxuICAgICAgICAgIGxldCBhcnIgPSBlbGVtZW50LnNwbGl0KCcuJyk7XHJcbiAgICAgICAgICBpbmZvID0gYOivt+ajgOafpSAke3RoaXMuX0xvY2FsaXphdGlvblNlcnZpY2UuaW5zdGFudChgQ21zOjoke2FyclswXX1gKX0g55qEICR7dGhpcy5fTG9jYWxpemF0aW9uU2VydmljZS5pbnN0YW50KGBDbXM6OiR7YXJyWzFdfWApfeWtl+autWA7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIGlmIChlbGVtZW50LmluY2x1ZGVzKCddLicpKSB7XHJcbiAgICAgICAgICBsZXQgYXJyID0gZWxlbWVudC5zcGxpdCgnXS4nKTtcclxuICAgICAgICAgIGxldCBhcnJTdGFydCA9IGFyclswXS5zcGxpdCgnWycpO1xyXG4gICAgICAgICAgaW5mbyA9IGDor7fmo4Dmn6UgJHt0aGlzLl9Mb2NhbGl6YXRpb25TZXJ2aWNlLmluc3RhbnQoYENtczo6JHthcnJTdGFydFswXX1gKX1bJHthcnJTdGFydFsxXX1dIOeahCAke3RoaXMuX0xvY2FsaXphdGlvblNlcnZpY2UuaW5zdGFudChgQ21zOjoke2FyclsxXX1gKX3lrZfmrrVgO1xyXG4gICAgICAgIH1cclxuICAgICAgICAvL+S9v+eUqGFicOWkmuivreiogOaPkOekulxyXG4gICAgICAgIHRoaXMudG9hc3Rlci53YXJuKGluZm8pO1xyXG4gICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICB9XHJcbiAgICB9XHJcbiAgICByZXR1cm4gZmFsc2U7XHJcbiAgfVxyXG5cclxuXHJcbiAgLyoq6I635Y+W6KGo5Y2V5omA5pyJ5a2X5q615piv5ZCm6YCa6L+H6aqM6K+BICovXHJcbiAgZ2V0Rm9ybVZhbGlkYXRpb25TdGF0dXMoZm9ybUVudGl0eTogRm9ybUdyb3VwIHwgRm9ybUFycmF5KTogeyBba2V5OiBzdHJpbmddOiBhbnkgfSB7XHJcbiAgICBsZXQgdmFsaWRhdGlvblN0YXR1czogeyBba2V5OiBzdHJpbmddOiBhbnkgfSA9IHt9O1xyXG5cclxuICAgIC8vIOmAkuW9kumBjeWOhuihqOWNlee7hOWSjOihqOWNleaOp+S7tumbhuWQiFxyXG4gICAgY29uc3QgdHJhdmVyc2VGb3JtID0gKGZvcm06IEZvcm1Hcm91cCB8IEZvcm1BcnJheSwgcHJlZml4ID0gJycpID0+IHtcclxuICAgICAgaWYgKGZvcm0gaW5zdGFuY2VvZiBGb3JtR3JvdXApIHtcclxuICAgICAgICBPYmplY3Qua2V5cyhmb3JtLmNvbnRyb2xzKS5mb3JFYWNoKGtleSA9PiB7XHJcbiAgICAgICAgICBjb25zdCBjb250cm9sID0gZm9ybS5jb250cm9sc1trZXldO1xyXG4gICAgICAgICAgbGV0IGRpc3BsYXlOYW1lID0ga2V5LmNoYXJBdCgwKS50b1VwcGVyQ2FzZSgpICsga2V5LnNsaWNlKDEpO1xyXG4gICAgICAgICAgY29uc3QgZnVsbEtleSA9IHByZWZpeCA/IGAke3ByZWZpeH0uJHtkaXNwbGF5TmFtZX1gIDogZGlzcGxheU5hbWU7XHJcbiAgICAgICAgICBpZiAoY29udHJvbCBpbnN0YW5jZW9mIEZvcm1Db250cm9sKSB7XHJcbiAgICAgICAgICAgIHZhbGlkYXRpb25TdGF0dXNbZnVsbEtleV0gPSBjb250cm9sLnZhbGlkO1xyXG4gICAgICAgICAgfSBlbHNlIGlmIChjb250cm9sIGluc3RhbmNlb2YgRm9ybUFycmF5KSB7XHJcbiAgICAgICAgICAgIHRyYXZlcnNlRm9ybShjb250cm9sLCBmdWxsS2V5KTtcclxuICAgICAgICAgIH0gZWxzZSBpZiAoY29udHJvbCBpbnN0YW5jZW9mIEZvcm1Hcm91cCkge1xyXG4gICAgICAgICAgICB0cmF2ZXJzZUZvcm0oY29udHJvbCwgZnVsbEtleSk7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgIH0gZWxzZSBpZiAoZm9ybSBpbnN0YW5jZW9mIEZvcm1BcnJheSkge1xyXG4gICAgICAgIGZvcm0uY29udHJvbHMuZm9yRWFjaCgoY29udHJvbCwgaW5kZXgpID0+IHtcclxuICAgICAgICAgIGNvbnN0IGZ1bGxLZXkgPSBwcmVmaXggPyBgJHtwcmVmaXh9WyR7aW5kZXh9XWAgOiBgWyR7aW5kZXh9XWA7XHJcbiAgICAgICAgICBpZiAoY29udHJvbCBpbnN0YW5jZW9mIEZvcm1Db250cm9sKSB7XHJcbiAgICAgICAgICAgIHZhbGlkYXRpb25TdGF0dXNbZnVsbEtleV0gPSBjb250cm9sLnZhbGlkO1xyXG4gICAgICAgICAgfSBlbHNlIGlmIChjb250cm9sIGluc3RhbmNlb2YgRm9ybUFycmF5KSB7XHJcbiAgICAgICAgICAgIHRyYXZlcnNlRm9ybShjb250cm9sLCBmdWxsS2V5KTtcclxuICAgICAgICAgIH0gZWxzZSBpZiAoY29udHJvbCBpbnN0YW5jZW9mIEZvcm1Hcm91cCkge1xyXG4gICAgICAgICAgICB0cmF2ZXJzZUZvcm0oY29udHJvbCwgZnVsbEtleSk7XHJcbiAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICAgIH1cclxuICAgIH07XHJcblxyXG4gICAgdHJhdmVyc2VGb3JtKGZvcm1FbnRpdHkpO1xyXG5cclxuICAgIHJldHVybiB2YWxpZGF0aW9uU3RhdHVzO1xyXG4gIH1cclxuXHJcbn1cclxuIl19
@@ -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
- // export * from './lib/proxy';
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,46 @@
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
+ // Sites = "Cms::Sites",
19
+ eCmsRouteNames["Sections"] = "Cms::Sections";
20
+ eCmsRouteNames["SiteLanguage"] = "Cms::DisplayName:Cms.Site.Languages";
21
+ })(eCmsRouteNames || (eCmsRouteNames = {}));
22
+
12
23
  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
24
  constructor(restService) {
30
25
  this.restService = restService;
26
+ this.apiName = 'CmsAdmin';
27
+ this.getBound = (config) => this.restService.request({
28
+ method: 'GET',
29
+ url: '/api/cms-admin/domains/bound',
30
+ }, { apiName: this.apiName, ...config });
31
+ this.nameExists = (domainName, config) => this.restService.request({
32
+ method: 'GET',
33
+ url: '/api/cms-admin/domains/name-exists',
34
+ params: { domainName },
35
+ }, { apiName: this.apiName, ...config });
36
+ this.update = (input, config) => this.restService.request({
37
+ method: 'POST',
38
+ url: '/api/cms-admin/domains',
39
+ body: input,
40
+ }, { apiName: this.apiName, ...config });
31
41
  }
32
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, deps: [{ token: i1.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
33
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, providedIn: 'root' });
42
+ 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 }); }
43
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, providedIn: 'root' }); }
34
44
  }
35
45
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainAdminService, decorators: [{
36
46
  type: Injectable,
@@ -39,14 +49,98 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
39
49
  }]
40
50
  }], ctorParameters: () => [{ type: i1.RestService }] });
41
51
 
52
+ class ValidatorsService {
53
+ constructor() {
54
+ this.fb = inject(FormBuilder);
55
+ this.toaster = inject(ToasterService);
56
+ this._LocalizationService = inject(LocalizationService);
57
+ }
58
+ /**检查表单- */
59
+ isCheckForm(input) {
60
+ let keys = Object.keys(input);
61
+ for (let i = 0; i < keys.length; i++) {
62
+ const element = keys[i];
63
+ if (input[element] == false) {
64
+ let info = `请检查${this._LocalizationService.instant(`CmsKit::${element}`)}字段`;
65
+ if (element.includes('.') && !element.includes('].')) {
66
+ let arr = element.split('.');
67
+ info = `请检查${this._LocalizationService.instant(`Travely::${arr[0]}`)}的${this._LocalizationService.instant(`Travely::${arr[1]}`)}字段`;
68
+ }
69
+ if (element.includes('].')) {
70
+ let arr = element.split('].');
71
+ let arrStart = arr[0].split('[');
72
+ info = `请检查${this._LocalizationService.instant(`Travely::${arrStart[0]}`)}[${arrStart[1]}]的${this._LocalizationService.instant(`Travely::${arr[1]}`)}字段`;
73
+ }
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
- toaster = inject(ToasterService);
44
- _DomainAdminService = inject(DomainAdminService);
45
- _LocalizationService = inject(LocalizationService);
46
- /**表单实体 */
47
- newEntity;
48
- /**domain详情 */
49
- domainInfo = '';
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))
202
+ return;
106
203
  this._DomainAdminService.update(input).subscribe(async (res) => {
107
204
  this.toaster.success(this._LocalizationService.instant(`AbpUi::保存成功`));
108
205
  await this.getDomainsBound();
109
206
  });
110
207
  }
111
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DomainsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
112
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DomainsComponent, isStandalone: true, selector: "cms-domains", ngImport: i0, template: "<form [formGroup]=\"newEntity\" (ngSubmit)=\"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: "directive", type: i1.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { 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 }] });
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\" (ngSubmit)=\"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>" }]
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(`RealtyPilot::SuccessfullySaved`));
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: "Cms::Menu:Cms" /* eCmsRouteNames.Cms */,
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: "Cms::FormControl:Entry" /* eCmsRouteNames.Entries */,
152
- parentName: "Cms::Menu:Cms" /* eCmsRouteNames.Cms */,
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: "Cms::Menu:Settings" /* eCmsRouteNames.Settings */,
160
- parentName: "Cms::Menu:Cms" /* eCmsRouteNames.Cms */,
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: "Cms::Fields" /* eCmsRouteNames.Fields */,
168
- parentName: "Cms::Menu:Settings" /* eCmsRouteNames.Settings */,
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: "Cms::Sections" /* eCmsRouteNames.Sections */,
177
- parentName: "Cms::Menu:Settings" /* eCmsRouteNames.Settings */,
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 ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
195
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule });
196
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: CmsConfigModule });
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