@dignite-ng/expand.dynamic-form 0.0.19 → 0.0.21

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 (110) hide show
  1. package/esm2022/dignite-ng-expand.dynamic-form.mjs +1 -1
  2. package/esm2022/dynamic-form.mjs +5 -0
  3. package/esm2022/lib/components/dynamic/dynamic.component.mjs +9 -8
  4. package/esm2022/lib/components/dynamic/index.mjs +1 -1
  5. package/esm2022/lib/components/form/date-edit/date-edit-config.component.mjs +62 -0
  6. package/esm2022/lib/components/form/date-edit/date-edit-config.mjs +19 -0
  7. package/esm2022/lib/components/form/date-edit/date-edit-control.component.mjs +84 -0
  8. package/esm2022/lib/components/form/date-edit/index.mjs +3 -0
  9. package/esm2022/lib/components/form/form-control-group.mjs +52 -0
  10. package/esm2022/lib/components/form/index.mjs +7 -0
  11. package/esm2022/lib/components/form/numeric-edit/index.mjs +3 -0
  12. package/esm2022/lib/components/form/numeric-edit/numberic-edit-config.component.mjs +60 -0
  13. package/esm2022/lib/components/form/numeric-edit/numberic-edit-config.mjs +24 -0
  14. package/esm2022/lib/components/form/numeric-edit/numberic-edit-control.component.mjs +104 -0
  15. package/esm2022/lib/components/form/select/index.mjs +3 -0
  16. package/esm2022/lib/components/form/select/select-config.component.mjs +94 -0
  17. package/esm2022/lib/components/form/select/select-config.mjs +19 -0
  18. package/esm2022/lib/components/form/select/select-control.component.mjs +81 -0
  19. package/esm2022/lib/components/form/switch/index.mjs +3 -0
  20. package/esm2022/lib/components/form/switch/switch-config.component.mjs +60 -0
  21. package/esm2022/lib/components/form/switch/switch-config.mjs +14 -0
  22. package/esm2022/lib/components/form/switch/switch-control.component.mjs +71 -0
  23. package/esm2022/lib/components/form/text-edit/index.mjs +4 -0
  24. package/esm2022/lib/components/form/text-edit/text-edit-config.component.mjs +62 -0
  25. package/esm2022/lib/components/form/text-edit/text-edit-config.mjs +18 -0
  26. package/esm2022/lib/components/form/text-edit/text-edit.component.mjs +81 -0
  27. package/esm2022/lib/components/index.mjs +2 -2
  28. package/esm2022/lib/dynamic-form.module.mjs +16 -14
  29. package/esm2022/lib/enums/date-edit-interfaces.mjs +1 -1
  30. package/esm2022/lib/enums/text-edit-mode.mjs +1 -1
  31. package/esm2022/lib/interfaces/form-config-interfaces.mjs +1 -1
  32. package/esm2022/lib/interfaces/index.mjs +1 -1
  33. package/esm2022/lib/services/df-api.service.mjs +7 -6
  34. package/esm2022/lib/services/index.mjs +1 -1
  35. package/esm2022/public-api.mjs +1 -1
  36. package/fesm2022/dignite-ng-expand.dynamic-form.mjs +64 -391
  37. package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
  38. package/fesm2022/dynamic-form.mjs +1141 -0
  39. package/fesm2022/dynamic-form.mjs.map +1 -0
  40. package/lib/components/{from → form}/index.d.ts +0 -1
  41. package/lib/components/index.d.ts +1 -1
  42. package/lib/dynamic-form.module.d.ts +17 -19
  43. package/package.json +2 -4
  44. package/esm2022/lib/components/from/ck-editor/ck-editor-config.component.mjs +0 -57
  45. package/esm2022/lib/components/from/ck-editor/ck-editor-config.mjs +0 -18
  46. package/esm2022/lib/components/from/ck-editor/ck-editor-control.component.mjs +0 -211
  47. package/esm2022/lib/components/from/ck-editor/ckEditorUpload.mjs +0 -51
  48. package/esm2022/lib/components/from/ck-editor/index.mjs +0 -3
  49. package/esm2022/lib/components/from/date-edit/date-edit-config.component.mjs +0 -62
  50. package/esm2022/lib/components/from/date-edit/date-edit-config.mjs +0 -19
  51. package/esm2022/lib/components/from/date-edit/date-edit-control.component.mjs +0 -83
  52. package/esm2022/lib/components/from/date-edit/index.mjs +0 -3
  53. package/esm2022/lib/components/from/form-control-group.mjs +0 -59
  54. package/esm2022/lib/components/from/index.mjs +0 -8
  55. package/esm2022/lib/components/from/numeric-edit/index.mjs +0 -3
  56. package/esm2022/lib/components/from/numeric-edit/numberic-edit-config.component.mjs +0 -60
  57. package/esm2022/lib/components/from/numeric-edit/numberic-edit-config.mjs +0 -24
  58. package/esm2022/lib/components/from/numeric-edit/numberic-edit-control.component.mjs +0 -103
  59. package/esm2022/lib/components/from/select/index.mjs +0 -3
  60. package/esm2022/lib/components/from/select/select-config.component.mjs +0 -94
  61. package/esm2022/lib/components/from/select/select-config.mjs +0 -19
  62. package/esm2022/lib/components/from/select/select-control.component.mjs +0 -80
  63. package/esm2022/lib/components/from/switch/index.mjs +0 -3
  64. package/esm2022/lib/components/from/switch/switch-config.component.mjs +0 -60
  65. package/esm2022/lib/components/from/switch/switch-config.mjs +0 -14
  66. package/esm2022/lib/components/from/switch/switch-control.component.mjs +0 -69
  67. package/esm2022/lib/components/from/text-edit/index.mjs +0 -4
  68. package/esm2022/lib/components/from/text-edit/text-edit-config.component.mjs +0 -62
  69. package/esm2022/lib/components/from/text-edit/text-edit-config.mjs +0 -18
  70. package/esm2022/lib/components/from/text-edit/text-edit.component.mjs +0 -80
  71. package/esm2022/lib/proxy/dignite/file-explorer/files/file-descriptor.service.mjs +0 -59
  72. package/esm2022/lib/proxy/dignite/file-explorer/files/index.mjs +0 -3
  73. package/esm2022/lib/proxy/dignite/file-explorer/files/models.mjs +0 -2
  74. package/esm2022/lib/proxy/microsoft/asp-net-core/mvc/models.mjs +0 -2
  75. package/esm2022/lib/proxy/microsoft/extensions/primitives/models.mjs +0 -2
  76. package/esm2022/lib/proxy/microsoft/net/http/headers/models.mjs +0 -2
  77. package/esm2022/lib/proxy/volo/abp/content/models.mjs +0 -2
  78. package/lib/components/from/ck-editor/ck-editor-config.component.d.ts +0 -21
  79. package/lib/components/from/ck-editor/ck-editor-config.d.ts +0 -7
  80. package/lib/components/from/ck-editor/ck-editor-control.component.d.ts +0 -77
  81. package/lib/components/from/ck-editor/ckEditorUpload.d.ts +0 -12
  82. package/lib/components/from/ck-editor/index.d.ts +0 -2
  83. package/lib/proxy/dignite/file-explorer/files/file-descriptor.service.d.ts +0 -20
  84. package/lib/proxy/dignite/file-explorer/files/index.d.ts +0 -2
  85. package/lib/proxy/dignite/file-explorer/files/models.d.ts +0 -50
  86. package/lib/proxy/microsoft/asp-net-core/mvc/models.d.ts +0 -10
  87. package/lib/proxy/microsoft/extensions/primitives/models.d.ts +0 -8
  88. package/lib/proxy/microsoft/net/http/headers/models.d.ts +0 -6
  89. package/lib/proxy/volo/abp/content/models.d.ts +0 -5
  90. /package/lib/components/{from → form}/date-edit/date-edit-config.component.d.ts +0 -0
  91. /package/lib/components/{from → form}/date-edit/date-edit-config.d.ts +0 -0
  92. /package/lib/components/{from → form}/date-edit/date-edit-control.component.d.ts +0 -0
  93. /package/lib/components/{from → form}/date-edit/index.d.ts +0 -0
  94. /package/lib/components/{from → form}/form-control-group.d.ts +0 -0
  95. /package/lib/components/{from → form}/numeric-edit/index.d.ts +0 -0
  96. /package/lib/components/{from → form}/numeric-edit/numberic-edit-config.component.d.ts +0 -0
  97. /package/lib/components/{from → form}/numeric-edit/numberic-edit-config.d.ts +0 -0
  98. /package/lib/components/{from → form}/numeric-edit/numberic-edit-control.component.d.ts +0 -0
  99. /package/lib/components/{from → form}/select/index.d.ts +0 -0
  100. /package/lib/components/{from → form}/select/select-config.component.d.ts +0 -0
  101. /package/lib/components/{from → form}/select/select-config.d.ts +0 -0
  102. /package/lib/components/{from → form}/select/select-control.component.d.ts +0 -0
  103. /package/lib/components/{from → form}/switch/index.d.ts +0 -0
  104. /package/lib/components/{from → form}/switch/switch-config.component.d.ts +0 -0
  105. /package/lib/components/{from → form}/switch/switch-config.d.ts +0 -0
  106. /package/lib/components/{from → form}/switch/switch-control.component.d.ts +0 -0
  107. /package/lib/components/{from → form}/text-edit/index.d.ts +0 -0
  108. /package/lib/components/{from → form}/text-edit/text-edit-config.component.d.ts +0 -0
  109. /package/lib/components/{from → form}/text-edit/text-edit-config.d.ts +0 -0
  110. /package/lib/components/{from → form}/text-edit/text-edit.component.d.ts +0 -0
@@ -0,0 +1,1141 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Component, Input, ViewChild, ChangeDetectionStrategy, Injectable, ViewContainerRef, NgModule } from '@angular/core';
3
+ import * as i1 from '@angular/forms';
4
+ import { Validators, FormArray, FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
5
+ import * as i2 from '@abp/ng.core';
6
+ import { CoreModule } from '@abp/ng.core';
7
+ import { ThemeSharedModule } from '@abp/ng.theme.shared';
8
+ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
9
+ import { NzTreeModule } from 'ng-zorro-antd/tree';
10
+ import * as i3 from '@ngx-validate/core';
11
+ import * as i2$1 from '@angular/common';
12
+ import { pinyin } from 'pinyin-pro';
13
+
14
+ class TextEditConfig {
15
+ constructor(data) {
16
+ /**占位符 */
17
+ this['TextEdit.Placeholder'] = ['', []];
18
+ //字段类型,单行文本,多行文本
19
+ this['TextEdit.Mode'] = [0, []];
20
+ // 字数限制
21
+ this['TextEdit.CharLimit'] = ['265', []];
22
+ if (data) {
23
+ for (const key in data) {
24
+ if (data.hasOwnProperty(key)) {
25
+ this[key] = data[key];
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ var TextEditMode;
33
+ (function (TextEditMode) {
34
+ // 简单类型
35
+ TextEditMode[TextEditMode["SingleLine"] = 0] = "SingleLine";
36
+ // 复合类型;
37
+ TextEditMode[TextEditMode["MultipleLine"] = 1] = "MultipleLine";
38
+ })(TextEditMode || (TextEditMode = {}));
39
+
40
+ class TextEditConfigComponent {
41
+ constructor(fb) {
42
+ this.fb = fb;
43
+ this._TextEditMode = TextEditMode;
44
+ }
45
+ set type(v) {
46
+ this._type = v;
47
+ this.dataLoaded();
48
+ }
49
+ set Entity(v) {
50
+ this._Entity = v;
51
+ this.dataLoaded();
52
+ }
53
+ set selected(v) {
54
+ this._selected = v;
55
+ this.dataLoaded();
56
+ }
57
+ get formConfiguration() {
58
+ return this._Entity.get('formConfiguration');
59
+ }
60
+ async dataLoaded() {
61
+ if (this._Entity && this._type) {
62
+ await this.AfterInit();
63
+ this.submitclick.nativeElement.click();
64
+ }
65
+ }
66
+ AfterInit() {
67
+ return new Promise((resolve, rejects) => {
68
+ this._Entity.setControl('formConfiguration', this.fb.group(new TextEditConfig()));
69
+ if (this._selected && this._selected.formControlName == this._type) {
70
+ this.formConfiguration.patchValue({
71
+ ...this._selected.formConfiguration
72
+ });
73
+ }
74
+ resolve(true);
75
+ });
76
+ }
77
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextEditConfigComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
78
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextEditConfigComponent, selector: "df-text-edit-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Placeholder' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"TextEdit.Placeholder\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::TextEditMode' | abpLocalization}}</label>\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_TextEditMode.SingleLine\" formControlName=\"TextEdit.Mode\"\n id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::SingleLine' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_TextEditMode.MultipleLine\" formControlName=\"TextEdit.Mode\"\n id=\"flexRadioDefault2\">\n <label class=\"form-check-label\" for=\"flexRadioDefault2\">\n {{'DigniteAbpForms::MultipleLine' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::CharLimit' | abpLocalization}}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"TextEdit.CharLimit\">\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
79
+ }
80
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextEditConfigComponent, decorators: [{
81
+ type: Component,
82
+ args: [{ selector: 'df-text-edit-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Placeholder' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"TextEdit.Placeholder\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::TextEditMode' | abpLocalization}}</label>\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_TextEditMode.SingleLine\" formControlName=\"TextEdit.Mode\"\n id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::SingleLine' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_TextEditMode.MultipleLine\" formControlName=\"TextEdit.Mode\"\n id=\"flexRadioDefault2\">\n <label class=\"form-check-label\" for=\"flexRadioDefault2\">\n {{'DigniteAbpForms::MultipleLine' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::CharLimit' | abpLocalization}}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"TextEdit.CharLimit\">\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>" }]
83
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
84
+ type: Input
85
+ }], Entity: [{
86
+ type: Input
87
+ }], selected: [{
88
+ type: Input
89
+ }], submitclick: [{
90
+ type: ViewChild,
91
+ args: ['submitclick', { static: true }]
92
+ }] } });
93
+
94
+ class TextEditComponent {
95
+ constructor(fb) {
96
+ this.fb = fb;
97
+ this._TextEditMode = TextEditMode;
98
+ /**字段配置列表 */
99
+ this._fields = '';
100
+ this.isObjEmpty = (obj) => Object.keys(obj).length === 0;
101
+ }
102
+ set entity(v) {
103
+ this._entity = v;
104
+ if (v)
105
+ this.dataLoaded();
106
+ }
107
+ set fields(v) {
108
+ this._fields = v;
109
+ if (v)
110
+ this.dataLoaded();
111
+ }
112
+ set parentFiledName(v) {
113
+ this._parentFiledName = v;
114
+ if (v)
115
+ this.dataLoaded();
116
+ }
117
+ set selected(v) {
118
+ this._selected = v || '';
119
+ if (v)
120
+ this.dataLoaded();
121
+ }
122
+ async dataLoaded() {
123
+ if (this._fields && this._entity && this._parentFiledName) {
124
+ this.extraProperties = this._entity.get(this._parentFiledName);
125
+ await this.AfterInit();
126
+ this.submitclick?.nativeElement?.click();
127
+ }
128
+ }
129
+ AfterInit() {
130
+ return new Promise((resolve, rejects) => {
131
+ let ValidatorsArray = [];
132
+ if (this._fields.required) {
133
+ ValidatorsArray.push(Validators.required);
134
+ }
135
+ this._fields.field.formConfiguration = {
136
+ ...this.fb.group(new TextEditConfig()).value,
137
+ ...this._fields.field.formConfiguration
138
+ };
139
+ if (this._fields.field.formConfiguration['TextEdit.CharLimit']) {
140
+ ValidatorsArray.push(Validators.maxLength(this._fields.field.formConfiguration['TextEdit.CharLimit']));
141
+ }
142
+ let newControl = this.fb.control(this._selected, ValidatorsArray);
143
+ this.extraProperties.setControl(this._fields.field.name, newControl);
144
+ resolve(true);
145
+ });
146
+ }
147
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextEditComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
148
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: TextEditComponent, selector: "df-text-edit", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] ===_TextEditMode.SingleLine\">\n <input type=\"text\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" />\n </ng-container>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] === _TextEditMode.MultipleLine\">\n <textarea class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" rows=\"3\"></textarea>\n </ng-container>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] }); }
149
+ }
150
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextEditComponent, decorators: [{
151
+ type: Component,
152
+ args: [{ selector: 'df-text-edit', template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] ===_TextEditMode.SingleLine\">\n <input type=\"text\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" />\n </ng-container>\n <ng-container *ngIf=\"_fields.field.formConfiguration['TextEdit.Mode'] === _TextEditMode.MultipleLine\">\n <textarea class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" rows=\"3\"></textarea>\n </ng-container>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
153
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
154
+ type: Input
155
+ }], fields: [{
156
+ type: Input
157
+ }], parentFiledName: [{
158
+ type: Input
159
+ }], selected: [{
160
+ type: Input
161
+ }], submitclick: [{
162
+ type: ViewChild,
163
+ args: ['submitclick', { static: true }]
164
+ }] } });
165
+
166
+ class SwitchConfig {
167
+ constructor(data) {
168
+ /**默认值 */
169
+ this['Switch.Default'] = [false, []];
170
+ if (data) {
171
+ for (const key in data) {
172
+ if (data.hasOwnProperty(key)) {
173
+ this[key] = data[key];
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+
180
+ class SwitchConfigComponent {
181
+ constructor(fb) {
182
+ this.fb = fb;
183
+ }
184
+ set type(v) {
185
+ this._type = v;
186
+ this.dataLoaded();
187
+ }
188
+ set Entity(v) {
189
+ this._Entity = v;
190
+ this.dataLoaded();
191
+ }
192
+ set selected(v) {
193
+ this._selected = v;
194
+ this.dataLoaded();
195
+ }
196
+ get formConfiguration() {
197
+ return this._Entity.get('formConfiguration');
198
+ }
199
+ async dataLoaded() {
200
+ if (this._Entity && this._type) {
201
+ await this.AfterInit();
202
+ this.submitclick.nativeElement.click();
203
+ }
204
+ }
205
+ AfterInit() {
206
+ return new Promise((resolve, rejects) => {
207
+ this._Entity.setControl('formConfiguration', this.fb.group(new SwitchConfig()));
208
+ if (this._selected && this._selected.formControlName == this._type) {
209
+ this.formConfiguration.patchValue({
210
+ ...this._selected.formConfiguration
211
+ });
212
+ }
213
+ resolve(true);
214
+ });
215
+ }
216
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SwitchConfigComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
217
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SwitchConfigComponent, selector: "df-switch-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Switch.Default\"\n id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::DefaultValue' | abpLocalization}}\n </label>\n </div>\n \n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
218
+ }
219
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SwitchConfigComponent, decorators: [{
220
+ type: Component,
221
+ args: [{ selector: 'df-switch-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Switch.Default\"\n id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::DefaultValue' | abpLocalization}}\n </label>\n </div>\n \n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>" }]
222
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
223
+ type: Input
224
+ }], Entity: [{
225
+ type: Input
226
+ }], selected: [{
227
+ type: Input
228
+ }], submitclick: [{
229
+ type: ViewChild,
230
+ args: ['submitclick', { static: true }]
231
+ }] } });
232
+
233
+ class SwitchControlComponent {
234
+ constructor(fb) {
235
+ this.fb = fb;
236
+ /**字段配置列表 */
237
+ this._fields = '';
238
+ }
239
+ set entity(v) {
240
+ this._entity = v;
241
+ this.dataLoaded();
242
+ }
243
+ set fields(v) {
244
+ this._fields = v;
245
+ this.dataLoaded();
246
+ }
247
+ set parentFiledName(v) {
248
+ this._parentFiledName = v;
249
+ this.dataLoaded();
250
+ }
251
+ set selected(v) {
252
+ // ?v:false;
253
+ this._selected = v;
254
+ this.dataLoaded();
255
+ }
256
+ get extraProperties() {
257
+ return this._entity.get('extraProperties');
258
+ }
259
+ /**数据加载完成 */
260
+ async dataLoaded() {
261
+ if (this._fields && this._entity) {
262
+ await this.AfterInit();
263
+ this.submitclick.nativeElement.click();
264
+ }
265
+ }
266
+ AfterInit() {
267
+ return new Promise((resolve, rejects) => {
268
+ let ValidatorsArray = [];
269
+ if (this._fields.required) {
270
+ ValidatorsArray.push(Validators.required);
271
+ }
272
+ // console.log(this._selected,'this._selected',this._fields.field.name);
273
+ let newControl = this.fb.control(this._selected ? this._selected : this._selected === false ? this._selected : this._fields.field.formConfiguration['Switch.Default'], ValidatorsArray);
274
+ this.extraProperties.setControl(this._fields.field.name, newControl);
275
+ resolve(true);
276
+ });
277
+ }
278
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SwitchControlComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
279
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SwitchControlComponent, selector: "df-switch-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div class=\"form-check form-switch\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" formControlName=\"{{_fields.field.name}}\">\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] }); }
280
+ }
281
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SwitchControlComponent, decorators: [{
282
+ type: Component,
283
+ args: [{ selector: 'df-switch-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <div class=\"form-check form-switch\">\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" formControlName=\"{{_fields.field.name}}\">\n </div>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
284
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
285
+ type: Input
286
+ }], fields: [{
287
+ type: Input
288
+ }], parentFiledName: [{
289
+ type: Input
290
+ }], selected: [{
291
+ type: Input
292
+ }], submitclick: [{
293
+ type: ViewChild,
294
+ args: ['submitclick', { static: true }]
295
+ }] } });
296
+
297
+ class NumbericEditConfig {
298
+ constructor(data) {
299
+ /**占位符 */
300
+ this['NumericEditField.Placeholder'] = ['', []];
301
+ /**最小值 */
302
+ this['NumericEditField.Min'] = ['', []];
303
+ //最大值
304
+ this['NumericEditField.Max'] = ['', []];
305
+ // 小数位数
306
+ this['NumericEditField.Decimals'] = [2, []];
307
+ //步长
308
+ this['NumericEditField.Step'] = ['', []];
309
+ //格式说明符
310
+ this['FormatSpecifier'] = ['', []];
311
+ if (data) {
312
+ for (const key in data) {
313
+ if (data.hasOwnProperty(key)) {
314
+ this[key] = data[key];
315
+ }
316
+ }
317
+ }
318
+ }
319
+ }
320
+
321
+ class NumbericEditConfigComponent {
322
+ constructor(fb) {
323
+ this.fb = fb;
324
+ }
325
+ set type(v) {
326
+ this._type = v;
327
+ this.dataLoaded();
328
+ }
329
+ set Entity(v) {
330
+ this._Entity = v;
331
+ this.dataLoaded();
332
+ }
333
+ set selected(v) {
334
+ this._selected = v ? v : v == false ? v : '';
335
+ this.dataLoaded();
336
+ }
337
+ get formConfiguration() {
338
+ return this._Entity.get('formConfiguration');
339
+ }
340
+ async dataLoaded() {
341
+ if (this._Entity && this._type) {
342
+ await this.AfterInit();
343
+ this.submitclick.nativeElement.click();
344
+ }
345
+ }
346
+ AfterInit() {
347
+ return new Promise((resolve, rejects) => {
348
+ this._Entity.setControl('formConfiguration', this.fb.group(new NumbericEditConfig()));
349
+ if (this._selected && this._selected.formControlName == this._type) {
350
+ this.formConfiguration.patchValue({
351
+ ...this._selected.formConfiguration
352
+ });
353
+ }
354
+ resolve(true);
355
+ });
356
+ }
357
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumbericEditConfigComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
358
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NumbericEditConfigComponent, selector: "df-numberic-edit-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Placeholder' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Placeholder\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Min' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Min\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Max' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Max\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NumericDecimals' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Decimals\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NumericStep' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Step\">\n <div class=\"form-text\">{{'DigniteAbpForms::NumericStepHelp'}}</div>\n </div>\n \n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::FormatSpecifier' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"FormatSpecifier\">\n <div class=\"form-text\">See:<a href=\"https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings\" target=\"_blank\">https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings</a></div>\n </div>\n \n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
359
+ }
360
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumbericEditConfigComponent, decorators: [{
361
+ type: Component,
362
+ args: [{ selector: 'df-numberic-edit-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Placeholder' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Placeholder\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Min' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Min\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Max' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Max\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NumericDecimals' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Decimals\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NumericStep' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Step\">\n <div class=\"form-text\">{{'DigniteAbpForms::NumericStepHelp'}}</div>\n </div>\n \n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::FormatSpecifier' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"FormatSpecifier\">\n <div class=\"form-text\">See:<a href=\"https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings\" target=\"_blank\">https://docs.microsoft.com/zh-cn/dotnet/standard/base-types/standard-numeric-format-strings</a></div>\n </div>\n \n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>" }]
363
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
364
+ type: Input
365
+ }], Entity: [{
366
+ type: Input
367
+ }], selected: [{
368
+ type: Input
369
+ }], submitclick: [{
370
+ type: ViewChild,
371
+ args: ['submitclick', { static: true }]
372
+ }] } });
373
+
374
+ function maxDecimalPlacesValidator(maxDecimalPlaces) {
375
+ return (control) => {
376
+ const value = control.value;
377
+ if (typeof value === 'number' && isNaN(value) === false) {
378
+ const decimalPart = value.toString().split('.')[1];
379
+ if (decimalPart && decimalPart.length > maxDecimalPlaces) {
380
+ return { 'maxDecimalPlaces': { actual: decimalPart.length, max: maxDecimalPlaces } };
381
+ }
382
+ }
383
+ return null;
384
+ };
385
+ }
386
+ class NumbericEditControlComponent {
387
+ constructor(fb, cdr) {
388
+ this.fb = fb;
389
+ this.cdr = cdr;
390
+ /**字段配置列表 */
391
+ this._fields = '';
392
+ }
393
+ set entity(v) {
394
+ this._entity = v;
395
+ this.dataLoaded();
396
+ }
397
+ get entity() {
398
+ return this._entity;
399
+ }
400
+ set fields(v) {
401
+ this._fields = v;
402
+ this.dataLoaded();
403
+ }
404
+ set parentFiledName(v) {
405
+ this._parentFiledName = v;
406
+ this.dataLoaded();
407
+ }
408
+ set selected(v) {
409
+ this._selected = v;
410
+ this.dataLoaded();
411
+ }
412
+ get extraProperties() {
413
+ return this._entity.get('extraProperties');
414
+ }
415
+ get fieldInput() { return this.extraProperties.get(this._fields.field.name); }
416
+ /**数据加载完成 */
417
+ async dataLoaded() {
418
+ if (this._fields && this._entity) {
419
+ await this.AfterInit();
420
+ this.cdr.detectChanges();
421
+ this.submitclick.nativeElement.click();
422
+ }
423
+ }
424
+ AfterInit() {
425
+ return new Promise((resolve, rejects) => {
426
+ let ValidatorsArray = [];
427
+ let formConfiguration = this._fields.field.formConfiguration;
428
+ if (this._fields.required) {
429
+ ValidatorsArray.push(Validators.required);
430
+ }
431
+ if (formConfiguration['NumericEditField.Min']) {
432
+ ValidatorsArray.push(Validators.min(formConfiguration['NumericEditField.Min']));
433
+ }
434
+ if (formConfiguration['NumericEditField.Max']) {
435
+ ValidatorsArray.push(Validators.max(formConfiguration['NumericEditField.Max']));
436
+ }
437
+ let newControl = this.fb.control(this._selected, ValidatorsArray);
438
+ this.extraProperties.setControl(this._fields.field.name, newControl);
439
+ resolve(true);
440
+ });
441
+ }
442
+ /**数字框输入 */
443
+ inputchange(event) {
444
+ let val = event.target.value;
445
+ const decimalPart = val.toString().split('.')[1] || '';
446
+ let formConfiguration = this._fields.field.formConfiguration;
447
+ let Decimals = formConfiguration['NumericEditField.Decimals'];
448
+ if (decimalPart.length > Decimals) {
449
+ this.fieldInput.patchValue(val.slice(0, val.length - (decimalPart.length - 2)));
450
+ }
451
+ }
452
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumbericEditControlComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
453
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: NumbericEditControlComponent, selector: "df-numberic-edit-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['NumericEditField.Placeholder']||''\"\n [min]=\"_fields.field.formConfiguration['NumericEditField.Min']\"\n [max]=\"_fields.field.formConfiguration['NumericEditField.Max']\"\n [step]=\"_fields.field.formConfiguration['NumericEditField.Step']\" (input)=\"inputchange($event)\" />\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
454
+ }
455
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: NumbericEditControlComponent, decorators: [{
456
+ type: Component,
457
+ args: [{ selector: 'df-numberic-edit-control', changeDetection: ChangeDetectionStrategy.OnPush, template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\n [placeholder]=\"_fields.field.formConfiguration['NumericEditField.Placeholder']||''\"\n [min]=\"_fields.field.formConfiguration['NumericEditField.Min']\"\n [max]=\"_fields.field.formConfiguration['NumericEditField.Max']\"\n [step]=\"_fields.field.formConfiguration['NumericEditField.Step']\" (input)=\"inputchange($event)\" />\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
458
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { entity: [{
459
+ type: Input
460
+ }], fields: [{
461
+ type: Input
462
+ }], parentFiledName: [{
463
+ type: Input
464
+ }], selected: [{
465
+ type: Input
466
+ }], submitclick: [{
467
+ type: ViewChild,
468
+ args: ['submitclick', { static: true }]
469
+ }] } });
470
+
471
+ var DateEditInterfaces;
472
+ (function (DateEditInterfaces) {
473
+ /// <summary>
474
+ /// Only date is allowed to be entered.
475
+ /// </summary>
476
+ DateEditInterfaces[DateEditInterfaces["Date"] = 0] = "Date";
477
+ /// <summary>
478
+ /// Both date and time are allowed to be entered.
479
+ /// </summary>
480
+ DateEditInterfaces[DateEditInterfaces["DateTime"] = 1] = "DateTime";
481
+ /// <summary>
482
+ /// Allowed to select only year and month.
483
+ /// </summary>
484
+ DateEditInterfaces[DateEditInterfaces["Month"] = 2] = "Month";
485
+ })(DateEditInterfaces || (DateEditInterfaces = {}));
486
+
487
+ class DateEditConfig {
488
+ constructor(data) {
489
+ /**日期格式 */
490
+ this['DateEdit.InputMode'] = [DateEditInterfaces.Date, []];
491
+ /**最小值 */
492
+ this['DateEdit.Min'] = ['', []];
493
+ /**最大值 */
494
+ this['DateEdit.Max'] = ['', []];
495
+ if (data) {
496
+ for (const key in data) {
497
+ if (data.hasOwnProperty(key)) {
498
+ this[key] = data[key];
499
+ }
500
+ }
501
+ }
502
+ }
503
+ }
504
+
505
+ class DateEditConfigComponent {
506
+ constructor(fb) {
507
+ this.fb = fb;
508
+ this._DateEditInterfaces = DateEditInterfaces;
509
+ }
510
+ set type(v) {
511
+ this._type = v;
512
+ this.dataLoaded();
513
+ }
514
+ set Entity(v) {
515
+ this._Entity = v;
516
+ this.dataLoaded();
517
+ }
518
+ set selected(v) {
519
+ this._selected = v;
520
+ this.dataLoaded();
521
+ }
522
+ get formConfiguration() {
523
+ return this._Entity.get('formConfiguration');
524
+ }
525
+ async dataLoaded() {
526
+ if (this._Entity && this._type) {
527
+ await this.AfterInit();
528
+ this.submitclick.nativeElement.click();
529
+ }
530
+ }
531
+ AfterInit() {
532
+ return new Promise((resolve, rejects) => {
533
+ this._Entity.setControl('formConfiguration', this.fb.group(new DateEditConfig()));
534
+ if (this._selected && this._selected.formControlName == this._type) {
535
+ this.formConfiguration.patchValue({
536
+ ...this._selected.formConfiguration
537
+ });
538
+ }
539
+ resolve(true);
540
+ });
541
+ }
542
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateEditConfigComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
543
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DateEditConfigComponent, selector: "df-date-edit-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::DateEditMode' | abpLocalization}}</label>\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.Date\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::Date' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.DateTime\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault2\">\n <label class=\"form-check-label\" for=\"flexRadioDefault2\">\n {{'DigniteAbpForms::DateTime' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.Month\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault3\">\n <label class=\"form-check-label\" for=\"flexRadioDefault3\">\n {{'DigniteAbpForms::Month' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Min' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"DateEdit.Min\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Max' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"DateEdit.Max\">\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.RadioControlValueAccessor, selector: "input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]", inputs: ["name", "formControlName", "value"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
544
+ }
545
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateEditConfigComponent, decorators: [{
546
+ type: Component,
547
+ args: [{ selector: 'df-date-edit-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::DateEditMode' | abpLocalization}}</label>\n <div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.Date\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault1\">\n <label class=\"form-check-label\" for=\"flexRadioDefault1\">\n {{'DigniteAbpForms::Date' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.DateTime\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault2\">\n <label class=\"form-check-label\" for=\"flexRadioDefault2\">\n {{'DigniteAbpForms::DateTime' | abpLocalization}}\n </label>\n </div>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"radio\" [value]=\"_DateEditInterfaces.Month\"\n formControlName=\"DateEdit.InputMode\" id=\"flexRadioDefault3\">\n <label class=\"form-check-label\" for=\"flexRadioDefault3\">\n {{'DigniteAbpForms::Month' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Min' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"DateEdit.Min\">\n </div>\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::Max' | abpLocalization}}</label>\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"DateEdit.Max\">\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>" }]
548
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { type: [{
549
+ type: Input
550
+ }], Entity: [{
551
+ type: Input
552
+ }], selected: [{
553
+ type: Input
554
+ }], submitclick: [{
555
+ type: ViewChild,
556
+ args: ['submitclick', { static: true }]
557
+ }] } });
558
+
559
+ class DateEditControlComponent {
560
+ constructor(fb, cdr) {
561
+ this.fb = fb;
562
+ this.cdr = cdr;
563
+ this._DateEditInterfaces = DateEditInterfaces;
564
+ /**字段配置列表 */
565
+ this._fields = '';
566
+ }
567
+ set entity(v) {
568
+ this._entity = v;
569
+ this.dataLoaded();
570
+ }
571
+ get entity() {
572
+ return this._entity;
573
+ }
574
+ set fields(v) {
575
+ this._fields = v;
576
+ this.dataLoaded();
577
+ }
578
+ set parentFiledName(v) {
579
+ this._parentFiledName = v;
580
+ this.dataLoaded();
581
+ }
582
+ set selected(v) {
583
+ this._selected = v;
584
+ this.dataLoaded();
585
+ }
586
+ get extraProperties() {
587
+ return this._entity.get('extraProperties');
588
+ }
589
+ get fieldInput() { return this.extraProperties.get(this._fields.field.name); }
590
+ /**数据加载完成 */
591
+ async dataLoaded() {
592
+ if (this._fields && this._entity) {
593
+ await this.AfterInit();
594
+ this.cdr.detectChanges();
595
+ this.submitclick.nativeElement.click();
596
+ }
597
+ }
598
+ AfterInit() {
599
+ return new Promise((resolve, rejects) => {
600
+ let ValidatorsArray = [];
601
+ let formConfiguration = this._fields.field.formConfiguration;
602
+ if (this._fields.required) {
603
+ ValidatorsArray.push(Validators.required);
604
+ }
605
+ if (formConfiguration['DateEdit.Min']) {
606
+ ValidatorsArray.push(Validators.min(formConfiguration['DateEdit.Min']));
607
+ }
608
+ if (formConfiguration['DateEdit.Max']) {
609
+ ValidatorsArray.push(Validators.max(formConfiguration['DateEdit.Max']));
610
+ }
611
+ let newControl = this.fb.control(this._selected, ValidatorsArray);
612
+ this.extraProperties.setControl(this._fields.field.name, newControl);
613
+ resolve(true);
614
+ });
615
+ }
616
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateEditControlComponent, deps: [{ token: i1.FormBuilder }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component }); }
617
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DateEditControlComponent, selector: "df-date-edit-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n\n <ng-container *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.Date\">\n <input type=\"date\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <ng-container\n *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.DateTime\">\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <ng-container *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.Month\">\n <input type=\"month\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] }); }
618
+ }
619
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DateEditControlComponent, decorators: [{
620
+ type: Component,
621
+ args: [{ selector: 'df-date-edit-control', template: "<form [formGroup]=\"_entity\">\n <div [formGroupName]=\"_parentFiledName\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n\n <ng-container *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.Date\">\n <input type=\"date\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <ng-container\n *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.DateTime\">\n <input type=\"datetime-local\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <ng-container *ngIf=\"_fields.field.formConfiguration['DateEdit.InputMode'] === _DateEditInterfaces.Month\">\n <input type=\"month\" class=\"form-control\" step=\"1\" formControlName=\"{{_fields.field.name}}\"\n [min]=\"_fields.field.formConfiguration['DateEdit.Min']\"\n [max]=\"_fields.field.formConfiguration['DateEdit.Max']\" />\n </ng-container>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
622
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { entity: [{
623
+ type: Input
624
+ }], fields: [{
625
+ type: Input
626
+ }], parentFiledName: [{
627
+ type: Input
628
+ }], selected: [{
629
+ type: Input
630
+ }], submitclick: [{
631
+ type: ViewChild,
632
+ args: ['submitclick', { static: true }]
633
+ }] } });
634
+
635
+ class SelectConfig {
636
+ constructor(data) {
637
+ /**空值文本 */
638
+ this['Select.NullText'] = ['', []];
639
+ //多选
640
+ this['Select.Multiple'] = [false, []];
641
+ // 选项
642
+ this['Select.Options'] = new FormArray([]);
643
+ if (data) {
644
+ for (const key in data) {
645
+ if (data.hasOwnProperty(key)) {
646
+ this[key] = data[key];
647
+ }
648
+ }
649
+ }
650
+ }
651
+ }
652
+
653
+ class DfApiService {
654
+ constructor() { }
655
+ /**
656
+ * 识别中文转化为拼音,固定返回类型
657
+ * 汉字转拼音
658
+ * 大写转小写
659
+ *
660
+ * */
661
+ chineseToPinyin(value) {
662
+ //去除字符串中所有的空格
663
+ // let val = value
664
+ let val = value.replaceAll(' ', "-");
665
+ let array = val.split('');
666
+ let newArray = [];
667
+ array.forEach((el, index) => {
668
+ //转化为小写
669
+ let elChange = el.toLowerCase();
670
+ let isChinese = (str) => {
671
+ return /^[\u4e00-\u9fa5]+$/.test(str);
672
+ };
673
+ if (isChinese(elChange)) {
674
+ const resultWithoutTone = pinyin(elChange, { toneType: 'none', type: 'array' });
675
+ elChange = resultWithoutTone.toString();
676
+ if (index < array.length - 1)
677
+ elChange += '-';
678
+ }
679
+ ;
680
+ newArray.push(elChange);
681
+ });
682
+ let pinyinstr = newArray.join('');
683
+ return pinyinstr || val;
684
+ }
685
+ /**获取图片的本地连接 */
686
+ getImageLacolBase64Url(file) {
687
+ return new Promise((resolve, rejects) => {
688
+ const reader = new FileReader();
689
+ reader.readAsDataURL(file);
690
+ reader.onload = (e) => {
691
+ resolve(e.target.result);
692
+ };
693
+ reader.onerror = error => rejects(error);
694
+ });
695
+ }
696
+ /**
697
+ * 深拷贝--方法 */
698
+ deepClone(obj) {
699
+ if (typeof obj !== 'object' || obj === null)
700
+ return obj;
701
+ const result = Array.isArray(obj) ? [] : {};
702
+ for (let key in obj) {
703
+ if (obj.hasOwnProperty(key)) {
704
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
705
+ if (obj[key] instanceof Date) {
706
+ result[key] = new Date(obj[key].getTime());
707
+ }
708
+ else if (obj[key] instanceof RegExp) {
709
+ result[key] = new RegExp(obj[key]);
710
+ }
711
+ else {
712
+ result[key] = this.deepClone(obj[key]);
713
+ }
714
+ }
715
+ else {
716
+ result[key] = obj[key];
717
+ }
718
+ }
719
+ }
720
+ return result;
721
+ }
722
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
723
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, providedIn: 'root' }); }
724
+ }
725
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DfApiService, decorators: [{
726
+ type: Injectable,
727
+ args: [{
728
+ providedIn: 'root'
729
+ }]
730
+ }], ctorParameters: function () { return []; } });
731
+
732
+ class SelectConfigComponent {
733
+ constructor(fb, _DfApiService) {
734
+ this.fb = fb;
735
+ this._DfApiService = _DfApiService;
736
+ }
737
+ set type(v) {
738
+ this._type = v;
739
+ this.dataLoaded();
740
+ }
741
+ set Entity(v) {
742
+ this._Entity = v;
743
+ this.dataLoaded();
744
+ }
745
+ set selected(v) {
746
+ this._selected = v;
747
+ this.dataLoaded();
748
+ }
749
+ get formConfiguration() {
750
+ return this._Entity.get('formConfiguration');
751
+ }
752
+ get SelectOptions() {
753
+ return this.formConfiguration.controls['Select.Options'];
754
+ }
755
+ async dataLoaded() {
756
+ if (this._Entity && this._type) {
757
+ await this.AfterInit();
758
+ this.submitclick.nativeElement.click();
759
+ }
760
+ }
761
+ /**增加选项 */
762
+ addSelectOptions() {
763
+ this.SelectOptions.push(new FormGroup({
764
+ Text: new FormControl('', Validators.required),
765
+ Value: new FormControl('', Validators.required),
766
+ Selected: new FormControl(false)
767
+ }));
768
+ }
769
+ /**删除某个选项 */
770
+ deleteSelectOptions(index) {
771
+ this.SelectOptions.removeAt(index);
772
+ }
773
+ AfterInit() {
774
+ return new Promise((resolve, rejects) => {
775
+ this._Entity.setControl('formConfiguration', this.fb.group(new SelectConfig()));
776
+ if (this._selected && this._selected.formControlName == this._type) {
777
+ this._selected.formConfiguration['Select.Options']?.forEach(el => {
778
+ this.addSelectOptions();
779
+ });
780
+ this.formConfiguration.patchValue({
781
+ ...this._selected.formConfiguration,
782
+ });
783
+ }
784
+ else {
785
+ this.addSelectOptions();
786
+ }
787
+ resolve(true);
788
+ });
789
+ }
790
+ textChange(event, index) {
791
+ let SelectOptionsItem = this.SelectOptions.at(index);
792
+ let value = event.target.value;
793
+ if (SelectOptionsItem.get('Value').value)
794
+ return;
795
+ SelectOptionsItem.patchValue({
796
+ Value: this._DfApiService.chineseToPinyin(value)
797
+ });
798
+ }
799
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectConfigComponent, deps: [{ token: i1.FormBuilder }, { token: DfApiService }], target: i0.ɵɵFactoryTarget.Component }); }
800
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectConfigComponent, selector: "df-select-config", inputs: { type: "type", Entity: "Entity", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addSelectOptions()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"Select.Options\">\n <ng-container *ngFor=\"let item of SelectOptions.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\" id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr> \n </ng-container>\n \n \n </tbody>\n </table>\n </div>\n\n\n\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NullText' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"Select.NullText\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Select.Multiple\"\n id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'DigniteAbpForms::Multiple' | abpLocalization}}\n </label>\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.CheckboxControlValueAccessor, selector: "input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i1.FormArrayName, selector: "[formArrayName]", inputs: ["formArrayName"] }, { kind: "directive", type: i2.InitDirective, selector: "[abpInit]", outputs: ["abpInit"] }, { kind: "directive", type: i2.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
801
+ }
802
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectConfigComponent, decorators: [{
803
+ type: Component,
804
+ args: [{ selector: 'df-select-config', template: "<form [formGroup]=\"_Entity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::SelectListItem' | abpLocalization}}</label>\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'DigniteAbpForms::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"addSelectOptions()\">\n <i class=\"fas fa-plus-circle\"></i>\n </button>\n </th>\n </tr>\n </thead>\n <tbody formArrayName=\"Select.Options\">\n <ng-container *ngFor=\"let item of SelectOptions.controls;let i=index\">\n <tr [formGroupName]=\"i\">\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\" id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr> \n </ng-container>\n \n \n </tbody>\n </table>\n </div>\n\n\n\n <div class=\"mb-2\">\n <label class=\"form-label\">{{'DigniteAbpForms::NullText' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"Select.NullText\">\n </div>\n <div class=\"mb-2\">\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Select.Multiple\"\n id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'DigniteAbpForms::Multiple' | abpLocalization}}\n </label>\n </div>\n </div>\n <button type=\"submit\" (abpInit)=\"submitclick?.nativeElement?.click()\" style=\"display: none;\"\n #submitclick></button>\n </div>\n</form>" }]
805
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: DfApiService }]; }, propDecorators: { type: [{
806
+ type: Input
807
+ }], Entity: [{
808
+ type: Input
809
+ }], selected: [{
810
+ type: Input
811
+ }], submitclick: [{
812
+ type: ViewChild,
813
+ args: ['submitclick', { static: true }]
814
+ }] } });
815
+
816
+ class SelectControlComponent {
817
+ constructor(fb) {
818
+ this.fb = fb;
819
+ /**字段配置列表 */
820
+ this._fields = '';
821
+ this.formConfiguration = '';
822
+ }
823
+ set entity(v) {
824
+ this._entity = v;
825
+ this.dataLoaded();
826
+ }
827
+ set fields(v) {
828
+ this._fields = v;
829
+ this.dataLoaded();
830
+ }
831
+ set parentFiledName(v) {
832
+ this._parentFiledName = v;
833
+ this.dataLoaded();
834
+ }
835
+ set selected(v) {
836
+ this._selected = v;
837
+ this.dataLoaded();
838
+ }
839
+ get extraProperties() {
840
+ return this._entity.get('extraProperties');
841
+ }
842
+ /**数据加载完成 */
843
+ async dataLoaded() {
844
+ if (this._fields && this._entity) {
845
+ await this.AfterInit();
846
+ this.submitclick.nativeElement.click();
847
+ }
848
+ }
849
+ AfterInit() {
850
+ return new Promise((resolve, rejects) => {
851
+ let ValidatorsArray = [];
852
+ if (this._fields.required) {
853
+ ValidatorsArray.push(Validators.required);
854
+ }
855
+ this.formConfiguration = this._fields.field.formConfiguration;
856
+ if (!this._selected) {
857
+ const isMultiple = this.formConfiguration['Select.Multiple'];
858
+ let selectValue = isMultiple ? [] : '';
859
+ this.formConfiguration['Select.Options'].forEach(el => {
860
+ if (el.Selected) {
861
+ selectValue = isMultiple ? [...selectValue, el.value || el.Value] : [el.value || el.Value];
862
+ }
863
+ });
864
+ this._selected = selectValue;
865
+ }
866
+ let newControl = this.fb.control(this._selected, ValidatorsArray);
867
+ this.extraProperties.setControl(this._fields.field.name, newControl);
868
+ resolve(true);
869
+ });
870
+ }
871
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectControlComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
872
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: SelectControlComponent, selector: "df-select-control", inputs: { entity: "entity", fields: "fields", parentFiledName: "parentFiledName", selected: "selected" }, viewQueries: [{ propertyName: "submitclick", first: true, predicate: ["submitclick"], descendants: true, static: true }], ngImport: i0, template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <ng-container *ngIf=\"formConfiguration['Select.Multiple']; else elseTemplate\">\n <select class=\"form-select\" multiple formControlName=\"{{_fields.field.name}}\">\n <ng-container *ngFor=\"let item of _fields.field.formConfiguration['Select.Options'];let i =index\">\n <option [value]=\"item.value\">{{item.text}}</option>\n </ng-container>\n </select>\n </ng-container>\n <ng-template #elseTemplate>\n <select class=\"form-select\" [multiple]=\"false\"\n formControlName=\"{{_fields.field.name}}\">\n <option>{{formConfiguration['Select.NullText']}}</option>\n <ng-container *ngFor=\"let item of formConfiguration['Select.Options'];let i =index\">\n <option [value]=\"item.Value\" >{{item.Text}}</option>\n </ng-container>\n </select>\n </ng-template>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>", styles: [""], dependencies: [{ kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectMultipleControlValueAccessor, selector: "select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] }); }
873
+ }
874
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: SelectControlComponent, decorators: [{
875
+ type: Component,
876
+ args: [{ selector: 'df-select-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\">\n <div class=\"mb-2\">\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\n <ng-container *ngIf=\"formConfiguration['Select.Multiple']; else elseTemplate\">\n <select class=\"form-select\" multiple formControlName=\"{{_fields.field.name}}\">\n <ng-container *ngFor=\"let item of _fields.field.formConfiguration['Select.Options'];let i =index\">\n <option [value]=\"item.value\">{{item.text}}</option>\n </ng-container>\n </select>\n </ng-container>\n <ng-template #elseTemplate>\n <select class=\"form-select\" [multiple]=\"false\"\n formControlName=\"{{_fields.field.name}}\">\n <option>{{formConfiguration['Select.NullText']}}</option>\n <ng-container *ngFor=\"let item of formConfiguration['Select.Options'];let i =index\">\n <option [value]=\"item.Value\" >{{item.Text}}</option>\n </ng-container>\n </select>\n </ng-template>\n <div class=\"form-text\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</div>\n </div>\n\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
877
+ }], ctorParameters: function () { return [{ type: i1.FormBuilder }]; }, propDecorators: { entity: [{
878
+ type: Input
879
+ }], fields: [{
880
+ type: Input
881
+ }], parentFiledName: [{
882
+ type: Input
883
+ }], selected: [{
884
+ type: Input
885
+ }], submitclick: [{
886
+ type: ViewChild,
887
+ args: ['submitclick', { static: true }]
888
+ }] } });
889
+
890
+ // import { CkEditorConfigComponent, CkEditorControlComponent } from "./ck-editor";
891
+ /**
892
+ * 表单控件分组-包含配置,控件,显示的数组
893
+ */
894
+ const FieldControlGroup = [
895
+ {
896
+ displayName: '文本框',
897
+ name: 'TextEdit',
898
+ fieldConfigComponent: TextEditConfigComponent,
899
+ fieldComponent: TextEditComponent,
900
+ // fieldViewComponent:TextBoxViewComponent,
901
+ }, {
902
+ displayName: '开关',
903
+ name: 'Switch',
904
+ fieldConfigComponent: SwitchConfigComponent,
905
+ fieldComponent: SwitchControlComponent,
906
+ // fieldViewComponent:TextBoxViewComponent,
907
+ }, {
908
+ displayName: '选择',
909
+ name: 'Select',
910
+ fieldConfigComponent: SelectConfigComponent,
911
+ fieldComponent: SelectControlComponent,
912
+ // fieldViewComponent:TextBoxViewComponent,
913
+ }, {
914
+ displayName: '数字',
915
+ name: 'NumericEdit',
916
+ fieldConfigComponent: NumbericEditConfigComponent,
917
+ fieldComponent: NumbericEditControlComponent,
918
+ // fieldViewComponent:TextBoxViewComponent,
919
+ }, {
920
+ displayName: '日期',
921
+ name: 'DateEdit',
922
+ fieldConfigComponent: DateEditConfigComponent,
923
+ fieldComponent: DateEditControlComponent,
924
+ // fieldViewComponent:TextBoxViewComponent,
925
+ },
926
+ ];
927
+ function getExcludeAssignControl(typeName) {
928
+ // return FieldControlGroup.filter(el => el.name !== typeName)
929
+ return FieldControlGroup;
930
+ }
931
+ function AddFieldControlGroup(array = []) {
932
+ FieldControlGroup.push(...array);
933
+ }
934
+
935
+ class DynamicComponent {
936
+ constructor() {
937
+ /**字段配置列表 */
938
+ this._fields = '';
939
+ /**表单控件组 */
940
+ this._fieldControlGroup = FieldControlGroup;
941
+ }
942
+ set selected(v) {
943
+ this._selected = v === undefined ? '' : v === null ? '' : v;
944
+ // this._selected = (v===true?true:v===false?false:v) || '';
945
+ if (v)
946
+ this.dataLoaded(1);
947
+ }
948
+ set type(v) {
949
+ this._type = v;
950
+ if (v)
951
+ this.dataLoaded(2);
952
+ }
953
+ set entity(v) {
954
+ if (v) {
955
+ this._entity = v;
956
+ this.dataLoaded(3);
957
+ }
958
+ }
959
+ set culture(v) {
960
+ this._culture = v;
961
+ if (v)
962
+ this.dataLoaded(6);
963
+ }
964
+ set parentFiledName(v) {
965
+ this._parentFiledName = v;
966
+ if (v)
967
+ this.dataLoaded(4);
968
+ }
969
+ set fields(v) {
970
+ this._fields = v;
971
+ if (v)
972
+ this.dataLoaded(5);
973
+ }
974
+ /**数据加载完成 */
975
+ dataLoaded(val) {
976
+ if (this._entity) {
977
+ if (this._type) {
978
+ let fieldControlItem = this._fieldControlGroup.find(el => el.name === this._type);
979
+ this.loadfieldConfigComponent(fieldControlItem);
980
+ }
981
+ if (this._fields && this._parentFiledName && this._culture) {
982
+ /**表单控件组中的项 */
983
+ let fieldControlItem = this._fieldControlGroup.find(el => el.name === this._fields.field.formControlName);
984
+ this.loadfieldComponent(fieldControlItem);
985
+ }
986
+ }
987
+ }
988
+ /**加载动态表单配置组件 */
989
+ loadfieldConfigComponent(FieldControlItem) {
990
+ //清空了容器中的所有组件
991
+ this.FormControlRef?.clear();
992
+ if (!FieldControlItem || !FieldControlItem.fieldConfigComponent)
993
+ return;
994
+ //在容器中创建组件
995
+ const { instance } = this.FormControlRef?.createComponent(FieldControlItem.fieldConfigComponent); //创建组件模板
996
+ /**向创建的组件模板中传值 */
997
+ instance.Entity = this._entity;
998
+ instance.selected = this._selected;
999
+ instance.type = this._type;
1000
+ }
1001
+ /**加载动态表单组件 */
1002
+ loadfieldComponent(FieldControlItem) {
1003
+ // this.FormControlRef.clear
1004
+ //清空了容器中的所有组件
1005
+ this.FormComponentsRef?.clear();
1006
+ if (!FieldControlItem || !FieldControlItem.fieldComponent)
1007
+ return;
1008
+ //在容器中创建组件
1009
+ const { instance } = this.FormComponentsRef?.createComponent(FieldControlItem.fieldComponent); //创建组件模板
1010
+ /**向创建的组件模板中传值 */
1011
+ instance.entity = this._entity;
1012
+ instance.fields = this._fields;
1013
+ instance.parentFiledName = this._parentFiledName;
1014
+ instance.selected = this._selected;
1015
+ instance.culture = this._culture;
1016
+ }
1017
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
1018
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: DynamicComponent, selector: "df-dynamic", inputs: { selected: "selected", type: "type", entity: "entity", culture: "culture", parentFiledName: "parentFiledName", fields: "fields" }, viewQueries: [{ propertyName: "FormControlRef", first: true, predicate: ["FormControlRef"], descendants: true, read: ViewContainerRef, static: true }, { propertyName: "FormComponentsRef", first: true, predicate: ["FormComponentsRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>", styles: [""] }); }
1019
+ }
1020
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicComponent, decorators: [{
1021
+ type: Component,
1022
+ args: [{ selector: 'df-dynamic', template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
1023
+ }], propDecorators: { selected: [{
1024
+ type: Input
1025
+ }], type: [{
1026
+ type: Input
1027
+ }], entity: [{
1028
+ type: Input
1029
+ }], culture: [{
1030
+ type: Input
1031
+ }], parentFiledName: [{
1032
+ type: Input
1033
+ }], fields: [{
1034
+ type: Input
1035
+ }], FormControlRef: [{
1036
+ type: ViewChild,
1037
+ args: ['FormControlRef', { read: ViewContainerRef, static: true }]
1038
+ }], FormComponentsRef: [{
1039
+ type: ViewChild,
1040
+ args: ['FormComponentsRef', { read: ViewContainerRef, static: true }]
1041
+ }] } });
1042
+
1043
+ // import { CKEditorModule } from '@ckeditor/ckeditor5-angular';
1044
+ class DynamicFormModule {
1045
+ static forRoot(config) {
1046
+ AddFieldControlGroup(config?.cmsFieldControlGroup);
1047
+ return {
1048
+ ngModule: DynamicFormModule,
1049
+ providers: []
1050
+ };
1051
+ }
1052
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1053
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, declarations: [TextEditConfigComponent,
1054
+ TextEditComponent,
1055
+ SwitchConfigComponent,
1056
+ SwitchControlComponent,
1057
+ NumbericEditConfigComponent,
1058
+ NumbericEditControlComponent,
1059
+ DateEditConfigComponent,
1060
+ DateEditControlComponent,
1061
+ SelectConfigComponent,
1062
+ SelectControlComponent,
1063
+ DynamicComponent], imports: [FormsModule,
1064
+ CoreModule,
1065
+ ThemeSharedModule,
1066
+ ReactiveFormsModule,
1067
+ NgbDropdownModule,
1068
+ NzTreeModule], exports: [TextEditConfigComponent,
1069
+ TextEditComponent,
1070
+ SwitchConfigComponent,
1071
+ SwitchControlComponent,
1072
+ NumbericEditConfigComponent,
1073
+ NumbericEditControlComponent,
1074
+ DateEditConfigComponent,
1075
+ DateEditControlComponent,
1076
+ // CkEditorConfigComponent,
1077
+ SelectConfigComponent,
1078
+ SelectControlComponent,
1079
+ DynamicComponent] }); }
1080
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, imports: [FormsModule,
1081
+ CoreModule,
1082
+ ThemeSharedModule,
1083
+ ReactiveFormsModule,
1084
+ NgbDropdownModule,
1085
+ NzTreeModule] }); }
1086
+ }
1087
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DynamicFormModule, decorators: [{
1088
+ type: NgModule,
1089
+ args: [{
1090
+ declarations: [
1091
+ TextEditConfigComponent,
1092
+ TextEditComponent,
1093
+ SwitchConfigComponent,
1094
+ SwitchControlComponent,
1095
+ NumbericEditConfigComponent,
1096
+ NumbericEditControlComponent,
1097
+ DateEditConfigComponent,
1098
+ DateEditControlComponent,
1099
+ SelectConfigComponent,
1100
+ SelectControlComponent,
1101
+ DynamicComponent,
1102
+ // CkEditorConfigComponent,
1103
+ // CkEditorControlComponent
1104
+ ],
1105
+ imports: [
1106
+ FormsModule,
1107
+ CoreModule,
1108
+ ThemeSharedModule,
1109
+ ReactiveFormsModule,
1110
+ NgbDropdownModule,
1111
+ NzTreeModule,
1112
+ // FileExplorerModule,
1113
+ // CKEditorModule,
1114
+ ],
1115
+ exports: [
1116
+ TextEditConfigComponent,
1117
+ TextEditComponent,
1118
+ SwitchConfigComponent,
1119
+ SwitchControlComponent,
1120
+ NumbericEditConfigComponent,
1121
+ NumbericEditControlComponent,
1122
+ DateEditConfigComponent,
1123
+ DateEditControlComponent,
1124
+ // CkEditorConfigComponent,
1125
+ SelectConfigComponent,
1126
+ SelectControlComponent,
1127
+ DynamicComponent,
1128
+ ],
1129
+ }]
1130
+ }] });
1131
+
1132
+ /*
1133
+ * Public API Surface of dynamic-form
1134
+ */
1135
+
1136
+ /**
1137
+ * Generated bundle index. Do not edit.
1138
+ */
1139
+
1140
+ export { AddFieldControlGroup, DateEditConfigComponent, DateEditControlComponent, DynamicComponent, DynamicFormModule, FieldControlGroup, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent, getExcludeAssignControl, maxDecimalPlacesValidator };
1141
+ //# sourceMappingURL=dynamic-form.mjs.map