@dignite-ng/expand.dynamic-form 3.0.0-rc.4 → 3.0.0-rc.6

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