@dignite-ng/expand.dynamic-form 3.0.0-rc.2 → 3.0.0-rc.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -13
- package/esm2022/dignite-ng-expand.dynamic-form.mjs +1 -1
- package/esm2022/lib/components/dynamic/dynamic-config.component.mjs +11 -0
- package/esm2022/lib/components/dynamic/dynamic-control.component.mjs +11 -0
- package/esm2022/lib/components/dynamic/dynamic-search.component.mjs +66 -0
- package/esm2022/lib/components/dynamic/dynamic-view.component.mjs +58 -0
- package/esm2022/lib/components/dynamic/dynamic.component.mjs +15 -12
- package/esm2022/lib/components/dynamic/index.mjs +5 -1
- package/esm2022/lib/components/form/date-edit/date-edit-config.component.mjs +3 -2
- package/esm2022/lib/components/form/date-edit/date-edit-config.mjs +1 -1
- package/esm2022/lib/components/form/date-edit/date-edit-control.component.mjs +3 -3
- package/esm2022/lib/components/form/date-edit/date-edit-view.component.mjs +40 -0
- package/esm2022/lib/components/form/date-edit/index.mjs +2 -1
- package/esm2022/lib/components/form/form-control-group.mjs +25 -19
- package/esm2022/lib/components/form/index.mjs +1 -1
- package/esm2022/lib/components/form/numeric-edit/index.mjs +1 -1
- package/esm2022/lib/components/form/numeric-edit/numberic-edit-config.component.mjs +3 -2
- package/esm2022/lib/components/form/numeric-edit/numberic-edit-config.mjs +4 -3
- package/esm2022/lib/components/form/numeric-edit/numberic-edit-control.component.mjs +5 -5
- package/esm2022/lib/components/form/numeric-edit/numeric-edit-view.component.mjs +39 -0
- package/esm2022/lib/components/form/select/index.mjs +3 -1
- package/esm2022/lib/components/form/select/select-config.component.mjs +14 -8
- package/esm2022/lib/components/form/select/select-config.mjs +1 -1
- package/esm2022/lib/components/form/select/select-control.component.mjs +24 -17
- package/esm2022/lib/components/form/select/select-search.component.mjs +93 -0
- package/esm2022/lib/components/form/select/select-view.component.mjs +44 -0
- package/esm2022/lib/components/form/switch/index.mjs +3 -1
- package/esm2022/lib/components/form/switch/switch-config.component.mjs +3 -2
- package/esm2022/lib/components/form/switch/switch-config.mjs +1 -1
- package/esm2022/lib/components/form/switch/switch-control.component.mjs +5 -5
- package/esm2022/lib/components/form/switch/switch-search.component.mjs +77 -0
- package/esm2022/lib/components/form/switch/switch-view.component.mjs +40 -0
- package/esm2022/lib/components/form/text-edit/index.mjs +3 -1
- package/esm2022/lib/components/form/text-edit/text-edit-config.component.mjs +3 -2
- package/esm2022/lib/components/form/text-edit/text-edit-config.mjs +1 -1
- package/esm2022/lib/components/form/text-edit/text-edit-search.component.mjs +81 -0
- package/esm2022/lib/components/form/text-edit/text-edit-view.component.mjs +39 -0
- package/esm2022/lib/components/form/text-edit/text-edit.component.mjs +5 -5
- package/esm2022/lib/components/index.mjs +1 -1
- package/esm2022/lib/dynamic-form.module.mjs +64 -7
- package/esm2022/lib/enums/date-edit-interfaces.mjs +1 -1
- package/esm2022/lib/enums/text-edit-mode.mjs +1 -1
- package/esm2022/lib/interfaces/form-config-interfaces.mjs +1 -1
- package/esm2022/lib/interfaces/index.mjs +1 -1
- package/esm2022/lib/services/df-api.service.mjs +1 -1
- package/esm2022/lib/services/form-control.service.mjs +33 -0
- package/esm2022/lib/services/index.mjs +1 -1
- package/esm2022/public-api.mjs +1 -1
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs +698 -60
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic/dynamic-config.component.d.ts +5 -0
- package/lib/components/dynamic/dynamic-control.component.d.ts +5 -0
- package/lib/components/dynamic/dynamic-search.component.d.ts +28 -0
- package/lib/components/dynamic/dynamic-view.component.d.ts +24 -0
- package/lib/components/dynamic/dynamic.component.d.ts +2 -0
- package/lib/components/dynamic/index.d.ts +4 -0
- package/lib/components/form/date-edit/date-edit-view.component.d.ts +17 -0
- package/lib/components/form/date-edit/index.d.ts +1 -0
- package/lib/components/form/form-control-group.d.ts +1 -2
- package/lib/components/form/numeric-edit/numeric-edit-view.component.d.ts +17 -0
- package/lib/components/form/select/index.d.ts +2 -0
- package/lib/components/form/select/select-search.component.d.ts +30 -0
- package/lib/components/form/select/select-view.component.d.ts +17 -0
- package/lib/components/form/switch/index.d.ts +2 -0
- package/lib/components/form/switch/switch-control.component.d.ts +1 -1
- package/lib/components/form/switch/switch-search.component.d.ts +28 -0
- package/lib/components/form/switch/switch-view.component.d.ts +17 -0
- package/lib/components/form/text-edit/index.d.ts +2 -0
- package/lib/components/form/text-edit/text-edit-search.component.d.ts +30 -0
- package/lib/components/form/text-edit/text-edit-view.component.d.ts +17 -0
- package/lib/dynamic-form.module.d.ts +18 -5
- package/lib/interfaces/form-config-interfaces.d.ts +8 -4
- package/lib/services/form-control.service.d.ts +9 -0
- package/package.json +11 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectorRef,
|
|
2
|
+
import { inject, ChangeDetectorRef, ViewChild, Input, Component, ChangeDetectionStrategy, Injectable, ViewContainerRef, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/forms';
|
|
4
4
|
import { Validators, FormArray, FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import * as i2 from '@abp/ng.core';
|
|
@@ -10,6 +10,8 @@ import * as i3 from '@ngx-validate/core';
|
|
|
10
10
|
import * as i2$1 from '@angular/common';
|
|
11
11
|
import { DatePipe } from '@angular/common';
|
|
12
12
|
import { pinyin } from 'pinyin-pro';
|
|
13
|
+
import * as i4 from 'ng-zorro-antd/select';
|
|
14
|
+
import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
13
15
|
|
|
14
16
|
class TextEditConfig {
|
|
15
17
|
constructor(data) {
|
|
@@ -146,14 +148,14 @@ class TextEditComponent {
|
|
|
146
148
|
ValidatorsArray.push(Validators.maxLength(this._fields.field.formConfiguration['TextEdit.CharLimit']));
|
|
147
149
|
}
|
|
148
150
|
let newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
149
|
-
this.extraProperties
|
|
151
|
+
this.extraProperties?.setControl(this._fields.field.name, newControl);
|
|
150
152
|
resolve(true);
|
|
151
153
|
});
|
|
152
154
|
}
|
|
153
155
|
ngOnDestroy() {
|
|
154
156
|
//Called once, before the instance is destroyed.
|
|
155
157
|
//Add 'implements OnDestroy' to the class.
|
|
156
|
-
this.extraProperties
|
|
158
|
+
this.extraProperties?.removeControl(this._fields.field.name);
|
|
157
159
|
}
|
|
158
160
|
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
161
|
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"] }] }); }
|
|
@@ -174,6 +176,115 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
174
176
|
args: ['submitclick', { static: true }]
|
|
175
177
|
}] } });
|
|
176
178
|
|
|
179
|
+
class TextEditViewComponent {
|
|
180
|
+
constructor() {
|
|
181
|
+
/**展示则内容 */
|
|
182
|
+
this.showValue = '';
|
|
183
|
+
/**是否显示再列表 */
|
|
184
|
+
this.showInList = false;
|
|
185
|
+
/**表单控件Value */
|
|
186
|
+
this._value = '';
|
|
187
|
+
}
|
|
188
|
+
set value(v) {
|
|
189
|
+
this._value = v;
|
|
190
|
+
}
|
|
191
|
+
async ngAfterContentInit() {
|
|
192
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
193
|
+
//Add 'implements AfterContentInit' to the class.
|
|
194
|
+
let valueOptions = this._value;
|
|
195
|
+
if (this.type && valueOptions) {
|
|
196
|
+
this.showValue = valueOptions;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
200
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.5", type: TextEditViewComponent, selector: "df-text-edit-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, ngImport: i0, template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
201
|
+
}
|
|
202
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditViewComponent, decorators: [{
|
|
203
|
+
type: Component,
|
|
204
|
+
args: [{ selector: 'df-text-edit-view', template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}" }]
|
|
205
|
+
}], propDecorators: { showInList: [{
|
|
206
|
+
type: Input
|
|
207
|
+
}], fields: [{
|
|
208
|
+
type: Input
|
|
209
|
+
}], type: [{
|
|
210
|
+
type: Input
|
|
211
|
+
}], value: [{
|
|
212
|
+
type: Input
|
|
213
|
+
}] } });
|
|
214
|
+
|
|
215
|
+
class TextEditSearchComponent {
|
|
216
|
+
constructor(fb) {
|
|
217
|
+
this.fb = fb;
|
|
218
|
+
this._TextEditMode = TextEditMode;
|
|
219
|
+
/**字段配置列表 */
|
|
220
|
+
this._fields = '';
|
|
221
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
222
|
+
this.isObjEmpty = (obj) => Object.keys(obj).length === 0;
|
|
223
|
+
}
|
|
224
|
+
set entity(v) {
|
|
225
|
+
this._entity = v;
|
|
226
|
+
if (v)
|
|
227
|
+
this.dataLoaded();
|
|
228
|
+
}
|
|
229
|
+
set fields(v) {
|
|
230
|
+
this._fields = v;
|
|
231
|
+
if (v)
|
|
232
|
+
this.dataLoaded();
|
|
233
|
+
}
|
|
234
|
+
set parentFiledName(v) {
|
|
235
|
+
this._parentFiledName = v;
|
|
236
|
+
if (v)
|
|
237
|
+
this.dataLoaded();
|
|
238
|
+
}
|
|
239
|
+
set selected(v) {
|
|
240
|
+
this._selected = v || '';
|
|
241
|
+
if (v)
|
|
242
|
+
this.dataLoaded();
|
|
243
|
+
}
|
|
244
|
+
async dataLoaded() {
|
|
245
|
+
if (this._fields && this._entity && this._parentFiledName) {
|
|
246
|
+
this.extraProperties = this._entity.get(this._parentFiledName);
|
|
247
|
+
await this.AfterInit();
|
|
248
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
249
|
+
this.submitclick?.nativeElement?.click();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
AfterInit() {
|
|
253
|
+
return new Promise((resolve, rejects) => {
|
|
254
|
+
let ValidatorsArray = [];
|
|
255
|
+
this._fields.field.formConfiguration = {
|
|
256
|
+
...this.fb.group(new TextEditConfig()).value,
|
|
257
|
+
...this._fields.field.formConfiguration
|
|
258
|
+
};
|
|
259
|
+
let newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
260
|
+
this.extraProperties?.setControl(this._fields.field.name, newControl);
|
|
261
|
+
resolve(true);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
ngOnDestroy() {
|
|
265
|
+
//Called once, before the instance is destroyed.
|
|
266
|
+
//Add 'implements OnDestroy' to the class.
|
|
267
|
+
this.extraProperties?.removeControl(this._fields.field.name);
|
|
268
|
+
}
|
|
269
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditSearchComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
270
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: TextEditSearchComponent, selector: "df-text-edit-search", 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\">\r\n <div [formGroupName]=\"_parentFiledName\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <input type=\"text\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\r\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" />\r\n </div>\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\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"] }] }); }
|
|
271
|
+
}
|
|
272
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditSearchComponent, decorators: [{
|
|
273
|
+
type: Component,
|
|
274
|
+
args: [{ selector: 'df-text-edit-search', template: "<form [formGroup]=\"_entity\">\r\n <div [formGroupName]=\"_parentFiledName\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <input type=\"text\" class=\"form-control\" formControlName=\"{{_fields.field.name}}\"\r\n [placeholder]=\"_fields.field.formConfiguration['TextEdit.Placeholder']\" />\r\n </div>\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>" }]
|
|
275
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
276
|
+
type: Input
|
|
277
|
+
}], fields: [{
|
|
278
|
+
type: Input
|
|
279
|
+
}], parentFiledName: [{
|
|
280
|
+
type: Input
|
|
281
|
+
}], selected: [{
|
|
282
|
+
type: Input
|
|
283
|
+
}], submitclick: [{
|
|
284
|
+
type: ViewChild,
|
|
285
|
+
args: ['submitclick', { static: true }]
|
|
286
|
+
}] } });
|
|
287
|
+
|
|
177
288
|
class SwitchConfig {
|
|
178
289
|
constructor(data) {
|
|
179
290
|
/**默认值 */
|
|
@@ -299,11 +410,11 @@ class SwitchControlComponent {
|
|
|
299
410
|
this.extraProperties.removeControl(this._fields.field.name);
|
|
300
411
|
}
|
|
301
412
|
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
|
|
413
|
+
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 </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
414
|
}
|
|
304
415
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchControlComponent, decorators: [{
|
|
305
416
|
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
|
|
417
|
+
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 </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n</form>" }]
|
|
307
418
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
308
419
|
type: Input
|
|
309
420
|
}], fields: [{
|
|
@@ -317,14 +428,121 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
317
428
|
args: ['submitclick', { static: true }]
|
|
318
429
|
}] } });
|
|
319
430
|
|
|
431
|
+
class SwitchSearchComponent {
|
|
432
|
+
constructor(fb) {
|
|
433
|
+
this.fb = fb;
|
|
434
|
+
/**字段配置列表 */
|
|
435
|
+
this._fields = '';
|
|
436
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
437
|
+
}
|
|
438
|
+
set entity(v) {
|
|
439
|
+
this._entity = v;
|
|
440
|
+
this.dataLoaded();
|
|
441
|
+
}
|
|
442
|
+
set fields(v) {
|
|
443
|
+
this._fields = v;
|
|
444
|
+
this.dataLoaded();
|
|
445
|
+
}
|
|
446
|
+
set parentFiledName(v) {
|
|
447
|
+
this._parentFiledName = v;
|
|
448
|
+
this.dataLoaded();
|
|
449
|
+
}
|
|
450
|
+
set selected(v) {
|
|
451
|
+
// ?v:false;
|
|
452
|
+
this._selected = v;
|
|
453
|
+
this.dataLoaded();
|
|
454
|
+
}
|
|
455
|
+
get extraProperties() {
|
|
456
|
+
return this._entity.get('extraProperties');
|
|
457
|
+
}
|
|
458
|
+
/**数据加载完成 */
|
|
459
|
+
async dataLoaded() {
|
|
460
|
+
if (this._fields && this._entity) {
|
|
461
|
+
await this.AfterInit();
|
|
462
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
463
|
+
this.submitclick?.nativeElement?.click();
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
AfterInit() {
|
|
467
|
+
return new Promise((resolve, rejects) => {
|
|
468
|
+
let ValidatorsArray = [];
|
|
469
|
+
let newControl = this.fb.control(this._selected
|
|
470
|
+
? this._selected
|
|
471
|
+
: this._selected === false
|
|
472
|
+
? this._selected
|
|
473
|
+
: this._fields.field.formConfiguration['Switch.Default'], ValidatorsArray);
|
|
474
|
+
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
475
|
+
resolve(true);
|
|
476
|
+
});
|
|
477
|
+
}
|
|
478
|
+
ngOnDestroy() {
|
|
479
|
+
//Called once, before the instance is destroyed.
|
|
480
|
+
//Add 'implements OnDestroy' to the class.
|
|
481
|
+
this.extraProperties.removeControl(this._fields.field.name);
|
|
482
|
+
}
|
|
483
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchSearchComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
484
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: SwitchSearchComponent, selector: "df-switch-search", 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\">\r\n <div formGroupName=\"extraProperties\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <div class=\"form-check form-switch\">\r\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" formControlName=\"{{_fields.field.name}}\">\r\n </div>\r\n <small class=\"form-text text-muted d-block\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</small>\r\n </div>\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\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"] }] }); }
|
|
485
|
+
}
|
|
486
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchSearchComponent, decorators: [{
|
|
487
|
+
type: Component,
|
|
488
|
+
args: [{ selector: 'df-switch-search', template: "<form [formGroup]=\"_entity\">\r\n <div formGroupName=\"extraProperties\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <div class=\"form-check form-switch\">\r\n <input class=\"form-check-input\" type=\"checkbox\" role=\"switch\" formControlName=\"{{_fields.field.name}}\">\r\n </div>\r\n <small class=\"form-text text-muted d-block\" *ngIf=\"_fields.field.description\">{{_fields.field.description}}</small>\r\n </div>\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>" }]
|
|
489
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
490
|
+
type: Input
|
|
491
|
+
}], fields: [{
|
|
492
|
+
type: Input
|
|
493
|
+
}], parentFiledName: [{
|
|
494
|
+
type: Input
|
|
495
|
+
}], selected: [{
|
|
496
|
+
type: Input
|
|
497
|
+
}], submitclick: [{
|
|
498
|
+
type: ViewChild,
|
|
499
|
+
args: ['submitclick', { static: true }]
|
|
500
|
+
}] } });
|
|
501
|
+
|
|
502
|
+
class SwitchViewComponent {
|
|
503
|
+
constructor() {
|
|
504
|
+
/**展示则内容 */
|
|
505
|
+
this.showValue = '';
|
|
506
|
+
/**是否显示再列表 */
|
|
507
|
+
this.showInList = false;
|
|
508
|
+
/**表单控件Value */
|
|
509
|
+
this._value = '';
|
|
510
|
+
}
|
|
511
|
+
set value(v) {
|
|
512
|
+
this._value = v;
|
|
513
|
+
}
|
|
514
|
+
async ngAfterContentInit() {
|
|
515
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
516
|
+
//Add 'implements AfterContentInit' to the class.
|
|
517
|
+
let valueOptions = this._value;
|
|
518
|
+
if (this.type) {
|
|
519
|
+
this.showValue = valueOptions;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
523
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.5", type: SwitchViewComponent, selector: "df-switch-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, ngImport: i0, template: "@if(showInList){\r\n {{'AbpUi::'+(showValue ? 'Yes' : 'No') | abpLocalization}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{'AbpUi::'+(showValue ? 'Yes' : 'No') | abpLocalization}}\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
524
|
+
}
|
|
525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchViewComponent, decorators: [{
|
|
526
|
+
type: Component,
|
|
527
|
+
args: [{ selector: 'df-switch-view', template: "@if(showInList){\r\n {{'AbpUi::'+(showValue ? 'Yes' : 'No') | abpLocalization}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{'AbpUi::'+(showValue ? 'Yes' : 'No') | abpLocalization}}\r\n </div>\r\n</div>\r\n}" }]
|
|
528
|
+
}], propDecorators: { showInList: [{
|
|
529
|
+
type: Input
|
|
530
|
+
}], fields: [{
|
|
531
|
+
type: Input
|
|
532
|
+
}], type: [{
|
|
533
|
+
type: Input
|
|
534
|
+
}], value: [{
|
|
535
|
+
type: Input
|
|
536
|
+
}] } });
|
|
537
|
+
|
|
320
538
|
class NumbericEditConfig {
|
|
321
539
|
constructor(data) {
|
|
322
540
|
/**占位符 */
|
|
323
541
|
this['NumericEditField.Placeholder'] = ['', []];
|
|
324
542
|
/**最小值 */
|
|
325
|
-
this['NumericEditField.Min'] = ['', []];
|
|
543
|
+
this['NumericEditField.Min'] = ['', [Validators.required]];
|
|
326
544
|
//最大值
|
|
327
|
-
this['NumericEditField.Max'] = ['', []];
|
|
545
|
+
this['NumericEditField.Max'] = ['', [Validators.required]];
|
|
328
546
|
// 小数位数
|
|
329
547
|
this['NumericEditField.Decimals'] = [2, []];
|
|
330
548
|
//步长
|
|
@@ -432,7 +650,7 @@ class NumbericEditControlComponent {
|
|
|
432
650
|
this.dataLoaded();
|
|
433
651
|
}
|
|
434
652
|
get extraProperties() {
|
|
435
|
-
return this._entity
|
|
653
|
+
return this._entity?.get('extraProperties');
|
|
436
654
|
}
|
|
437
655
|
get fieldInput() { return this.extraProperties.get(this._fields.field.name); }
|
|
438
656
|
/**数据加载完成 */
|
|
@@ -473,7 +691,7 @@ class NumbericEditControlComponent {
|
|
|
473
691
|
let formConfiguration = this._fields.field.formConfiguration;
|
|
474
692
|
let Decimals = formConfiguration['NumericEditField.Decimals'];
|
|
475
693
|
if (decimalPart.length > Decimals) {
|
|
476
|
-
this.fieldInput
|
|
694
|
+
this.fieldInput?.patchValue(val.slice(0, val.length - (decimalPart.length - 2)));
|
|
477
695
|
}
|
|
478
696
|
}
|
|
479
697
|
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 }); }
|
|
@@ -695,6 +913,78 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
695
913
|
args: ['submitclick', { static: true }]
|
|
696
914
|
}] } });
|
|
697
915
|
|
|
916
|
+
class DateEditViewComponent {
|
|
917
|
+
constructor() {
|
|
918
|
+
/**展示则内容 */
|
|
919
|
+
this.showValue = '';
|
|
920
|
+
/**是否显示再列表 */
|
|
921
|
+
this.showInList = false;
|
|
922
|
+
/**表单控件Value */
|
|
923
|
+
this._value = '';
|
|
924
|
+
}
|
|
925
|
+
set value(v) {
|
|
926
|
+
this._value = v;
|
|
927
|
+
}
|
|
928
|
+
async ngAfterContentInit() {
|
|
929
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
930
|
+
//Add 'implements AfterContentInit' to the class.
|
|
931
|
+
let valueOptions = this._value;
|
|
932
|
+
if (this.type && valueOptions) {
|
|
933
|
+
this.showValue = valueOptions;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
937
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.5", type: DateEditViewComponent, selector: "df-date-edit-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, ngImport: i0, template: "@if(showInList){\r\n{{showValue|shortDateTime}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue|shortDateTime}}\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i2.ShortDateTimePipe, name: "shortDateTime" }] }); }
|
|
938
|
+
}
|
|
939
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditViewComponent, decorators: [{
|
|
940
|
+
type: Component,
|
|
941
|
+
args: [{ selector: 'df-date-edit-view', template: "@if(showInList){\r\n{{showValue|shortDateTime}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue|shortDateTime}}\r\n </div>\r\n</div>\r\n}" }]
|
|
942
|
+
}], propDecorators: { showInList: [{
|
|
943
|
+
type: Input
|
|
944
|
+
}], fields: [{
|
|
945
|
+
type: Input
|
|
946
|
+
}], type: [{
|
|
947
|
+
type: Input
|
|
948
|
+
}], value: [{
|
|
949
|
+
type: Input
|
|
950
|
+
}] } });
|
|
951
|
+
|
|
952
|
+
class NumericEditViewComponent {
|
|
953
|
+
constructor() {
|
|
954
|
+
/**展示则内容 */
|
|
955
|
+
this.showValue = '';
|
|
956
|
+
/**是否显示再列表 */
|
|
957
|
+
this.showInList = false;
|
|
958
|
+
/**表单控件Value */
|
|
959
|
+
this._value = '';
|
|
960
|
+
}
|
|
961
|
+
set value(v) {
|
|
962
|
+
this._value = v;
|
|
963
|
+
}
|
|
964
|
+
async ngAfterContentInit() {
|
|
965
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
966
|
+
//Add 'implements AfterContentInit' to the class.
|
|
967
|
+
let valueOptions = this._value;
|
|
968
|
+
if (this.type && valueOptions) {
|
|
969
|
+
this.showValue = valueOptions;
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
973
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.5", type: NumericEditViewComponent, selector: "df-numeric-edit-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, ngImport: i0, template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
974
|
+
}
|
|
975
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditViewComponent, decorators: [{
|
|
976
|
+
type: Component,
|
|
977
|
+
args: [{ selector: 'df-numeric-edit-view', template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}" }]
|
|
978
|
+
}], propDecorators: { showInList: [{
|
|
979
|
+
type: Input
|
|
980
|
+
}], fields: [{
|
|
981
|
+
type: Input
|
|
982
|
+
}], type: [{
|
|
983
|
+
type: Input
|
|
984
|
+
}], value: [{
|
|
985
|
+
type: Input
|
|
986
|
+
}] } });
|
|
987
|
+
|
|
698
988
|
class SelectConfig {
|
|
699
989
|
constructor(data) {
|
|
700
990
|
/**空值文本 */
|
|
@@ -809,7 +1099,7 @@ class SelectConfigComponent {
|
|
|
809
1099
|
this.dataLoaded();
|
|
810
1100
|
}
|
|
811
1101
|
get formConfiguration() {
|
|
812
|
-
return this._Entity
|
|
1102
|
+
return this._Entity?.get('formConfiguration');
|
|
813
1103
|
}
|
|
814
1104
|
get SelectOptions() {
|
|
815
1105
|
return this.formConfiguration.controls['Select.Options'];
|
|
@@ -835,11 +1125,16 @@ class SelectConfigComponent {
|
|
|
835
1125
|
}
|
|
836
1126
|
AfterInit() {
|
|
837
1127
|
return new Promise((resolve, rejects) => {
|
|
838
|
-
this._Entity
|
|
1128
|
+
this._Entity?.setControl('formConfiguration', this.fb.group(new SelectConfig()));
|
|
839
1129
|
if (this._selected && this._selected.formControlName == this._type) {
|
|
840
|
-
this._selected.formConfiguration['Select.Options']
|
|
1130
|
+
for (const element of this._selected.formConfiguration['Select.Options']) {
|
|
1131
|
+
for (const key in element) {
|
|
1132
|
+
const item = element[key];
|
|
1133
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1134
|
+
element[capitalizedKey] = item;
|
|
1135
|
+
}
|
|
841
1136
|
this.addSelectOptions();
|
|
842
|
-
}
|
|
1137
|
+
}
|
|
843
1138
|
this.formConfiguration.patchValue({
|
|
844
1139
|
...this._selected.formConfiguration,
|
|
845
1140
|
});
|
|
@@ -853,7 +1148,7 @@ class SelectConfigComponent {
|
|
|
853
1148
|
textChange(event, index) {
|
|
854
1149
|
let SelectOptionsItem = this.SelectOptions.at(index);
|
|
855
1150
|
let value = event.target.value;
|
|
856
|
-
if (SelectOptionsItem.get('Value')
|
|
1151
|
+
if (SelectOptionsItem.get('Value')?.value)
|
|
857
1152
|
return;
|
|
858
1153
|
SelectOptionsItem.patchValue({
|
|
859
1154
|
Value: this._DfApiService.chineseToPinyin(value),
|
|
@@ -881,6 +1176,8 @@ class SelectControlComponent {
|
|
|
881
1176
|
this.fb = fb;
|
|
882
1177
|
/**字段配置列表 */
|
|
883
1178
|
this._fields = '';
|
|
1179
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
1180
|
+
this._selected = [];
|
|
884
1181
|
this.cdr = inject(ChangeDetectorRef);
|
|
885
1182
|
this.formConfiguration = '';
|
|
886
1183
|
}
|
|
@@ -891,14 +1188,14 @@ class SelectControlComponent {
|
|
|
891
1188
|
this._parentFiledName = v;
|
|
892
1189
|
}
|
|
893
1190
|
set selected(v) {
|
|
894
|
-
this._selected = v;
|
|
1191
|
+
this._selected = v || [];
|
|
895
1192
|
}
|
|
896
1193
|
set entity(v) {
|
|
897
1194
|
this._entity = v;
|
|
898
1195
|
this.dataLoaded();
|
|
899
1196
|
}
|
|
900
1197
|
get extraProperties() {
|
|
901
|
-
return this._entity
|
|
1198
|
+
return this._entity?.get('extraProperties');
|
|
902
1199
|
}
|
|
903
1200
|
/**数据加载完成 */
|
|
904
1201
|
async dataLoaded() {
|
|
@@ -915,18 +1212,22 @@ class SelectControlComponent {
|
|
|
915
1212
|
ValidatorsArray.push(Validators.required);
|
|
916
1213
|
}
|
|
917
1214
|
this.formConfiguration = this._fields.field.formConfiguration;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1215
|
+
const isMultiple = this.formConfiguration['Select.Multiple'];
|
|
1216
|
+
let selectValue = isMultiple ? [] : [];
|
|
1217
|
+
for (const element of this.formConfiguration['Select.Options']) {
|
|
1218
|
+
for (const key in element) {
|
|
1219
|
+
const item = element[key];
|
|
1220
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1221
|
+
element[capitalizedKey] = item;
|
|
1222
|
+
}
|
|
1223
|
+
if (!this._selected) {
|
|
1224
|
+
if (Array.isArray(this._selected) && element.Selected && this._selected.length === 0) {
|
|
1225
|
+
selectValue = isMultiple ? [...selectValue, element.Value] : [element.Value];
|
|
1226
|
+
this._selected = selectValue;
|
|
926
1227
|
}
|
|
927
|
-
}
|
|
928
|
-
this._selected = selectValue;
|
|
1228
|
+
}
|
|
929
1229
|
}
|
|
1230
|
+
// this._selected = selectValue;
|
|
930
1231
|
let newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
931
1232
|
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
932
1233
|
resolve(true);
|
|
@@ -938,11 +1239,11 @@ class SelectControlComponent {
|
|
|
938
1239
|
this.extraProperties.removeControl(this._fields.field.name);
|
|
939
1240
|
}
|
|
940
1241
|
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\"
|
|
1242
|
+
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\" class=\"selectcontrol\">\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 <nz-select class=\"form-select form-select-multiple\" [nzMaxTagCount]=\"1\"\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\n formControlName=\"{{_fields.field.name}}\">\n <nz-option *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options']\"\n [nzLabel]=\"item.Text\" [nzValue]=\"item.Value\"></nz-option>\n </nz-select>\n </ng-container>\n <ng-template #elseTemplate>\n <select class=\"form-select\" [multiple]=\"false\" formControlName=\"{{_fields.field.name}}\">\n <option [value]=\"''\">{{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\"\n *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: ["::ng-deep .selectcontrol nz-select{width:100%}::ng-deep .selectcontrol nz-select .ant-select-selector{background:transparent!important;border:none!important;padding:.475rem 1.25rem!important;box-shadow:none!important;height:auto!important}::ng-deep .selectcontrol nz-select .anticon-search,::ng-deep .selectcontrol nz-select .anticon-down{display:none}::ng-deep .selectcontrol .ant-select{color:inherit!important}::ng-deep .selectcontrol .ant-select-selection-placeholder{color:inherit!important}::ng-deep .selectcontrol .ant-select-multiple .ant-select-selection-item{max-width:40%!important}::ng-deep .cdk-overlay-container .ant-select-dropdown{background:var(--lpx-content-bg)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:var(--bs-primary)!important;color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:var(--lpx-brand);color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item{color:var(--bs-body-color)}::ng-deep .was-validated .form-select-multiple{border-color:#4fbf67;padding-right:calc(1.5em + 1.35rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%234fbf67' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");background-repeat:no-repeat;background-position:right calc(.375em + .3375rem) center;background-size:calc(.75em + .675rem) calc(.75em + .675rem)}\n"], 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"] }, { kind: "component", type: i4.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i4.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzBorderless", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus"], exportAs: ["nzSelect"] }] }); }
|
|
942
1243
|
}
|
|
943
1244
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectControlComponent, decorators: [{
|
|
944
1245
|
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\"
|
|
1246
|
+
args: [{ selector: 'df-select-control', template: "<form [formGroup]=\"_entity\">\n <div formGroupName=\"extraProperties\" class=\"selectcontrol\">\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 <nz-select class=\"form-select form-select-multiple\" [nzMaxTagCount]=\"1\"\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\n formControlName=\"{{_fields.field.name}}\">\n <nz-option *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options']\"\n [nzLabel]=\"item.Text\" [nzValue]=\"item.Value\"></nz-option>\n </nz-select>\n </ng-container>\n <ng-template #elseTemplate>\n <select class=\"form-select\" [multiple]=\"false\" formControlName=\"{{_fields.field.name}}\">\n <option [value]=\"''\">{{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\"\n *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: ["::ng-deep .selectcontrol nz-select{width:100%}::ng-deep .selectcontrol nz-select .ant-select-selector{background:transparent!important;border:none!important;padding:.475rem 1.25rem!important;box-shadow:none!important;height:auto!important}::ng-deep .selectcontrol nz-select .anticon-search,::ng-deep .selectcontrol nz-select .anticon-down{display:none}::ng-deep .selectcontrol .ant-select{color:inherit!important}::ng-deep .selectcontrol .ant-select-selection-placeholder{color:inherit!important}::ng-deep .selectcontrol .ant-select-multiple .ant-select-selection-item{max-width:40%!important}::ng-deep .cdk-overlay-container .ant-select-dropdown{background:var(--lpx-content-bg)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:var(--bs-primary)!important;color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:var(--lpx-brand);color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item{color:var(--bs-body-color)}::ng-deep .was-validated .form-select-multiple{border-color:#4fbf67;padding-right:calc(1.5em + 1.35rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%234fbf67' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");background-repeat:no-repeat;background-position:right calc(.375em + .3375rem) center;background-size:calc(.75em + .675rem) calc(.75em + .675rem)}\n"] }]
|
|
946
1247
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { fields: [{
|
|
947
1248
|
type: Input
|
|
948
1249
|
}], parentFiledName: [{
|
|
@@ -956,6 +1257,133 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
956
1257
|
args: ['submitclick', { static: true }]
|
|
957
1258
|
}] } });
|
|
958
1259
|
|
|
1260
|
+
class SelectSearchComponent {
|
|
1261
|
+
constructor(fb) {
|
|
1262
|
+
this.fb = fb;
|
|
1263
|
+
/**字段配置列表 */
|
|
1264
|
+
this._fields = '';
|
|
1265
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
1266
|
+
this.formConfiguration = '';
|
|
1267
|
+
}
|
|
1268
|
+
set fields(v) {
|
|
1269
|
+
this._fields = v;
|
|
1270
|
+
}
|
|
1271
|
+
set parentFiledName(v) {
|
|
1272
|
+
this._parentFiledName = v;
|
|
1273
|
+
}
|
|
1274
|
+
set selected(v) {
|
|
1275
|
+
this._selected = v;
|
|
1276
|
+
}
|
|
1277
|
+
set entity(v) {
|
|
1278
|
+
this._entity = v;
|
|
1279
|
+
this.dataLoaded();
|
|
1280
|
+
}
|
|
1281
|
+
get extraProperties() {
|
|
1282
|
+
return this._entity?.get('extraProperties');
|
|
1283
|
+
}
|
|
1284
|
+
/**数据加载完成 */
|
|
1285
|
+
async dataLoaded() {
|
|
1286
|
+
if (this._fields && this._entity) {
|
|
1287
|
+
await this.AfterInit();
|
|
1288
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
1289
|
+
this.submitclick?.nativeElement?.click();
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
AfterInit() {
|
|
1293
|
+
return new Promise((resolve, rejects) => {
|
|
1294
|
+
let ValidatorsArray = [];
|
|
1295
|
+
this.formConfiguration = this._fields.field.formConfiguration;
|
|
1296
|
+
const isMultiple = this.formConfiguration['Select.Multiple'];
|
|
1297
|
+
let selectValue = isMultiple ? [] : [];
|
|
1298
|
+
for (const element of this.formConfiguration['Select.Options']) {
|
|
1299
|
+
for (const key in element) {
|
|
1300
|
+
const item = element[key];
|
|
1301
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1302
|
+
element[capitalizedKey] = item;
|
|
1303
|
+
}
|
|
1304
|
+
// if (this._selected) {
|
|
1305
|
+
// if (Array.isArray(this._selected) && element.Selected && this._selected.length === 0) {
|
|
1306
|
+
// selectValue = isMultiple ? [...selectValue, element.Value] : [element.Value];
|
|
1307
|
+
// }
|
|
1308
|
+
// }
|
|
1309
|
+
}
|
|
1310
|
+
this._selected = selectValue;
|
|
1311
|
+
let newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
1312
|
+
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
1313
|
+
resolve(true);
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
changeValue(event) {
|
|
1317
|
+
let selectvalue = this.extraProperties.get(this._fields.field.name).value;
|
|
1318
|
+
if (selectvalue[0] === '') {
|
|
1319
|
+
this.extraProperties.get(this._fields.field.name).setValue([]);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
ngOnDestroy() {
|
|
1323
|
+
//Called once, before the instance is destroyed.
|
|
1324
|
+
//Add 'implements OnDestroy' to the class.
|
|
1325
|
+
this.extraProperties.removeControl(this._fields.field.name);
|
|
1326
|
+
}
|
|
1327
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectSearchComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1328
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: SelectSearchComponent, selector: "df-select-search", 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\">\r\n <div formGroupName=\"extraProperties\" class=\"selectcontrol\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <ng-container *ngIf=\"formConfiguration['Select.Multiple']; else elseTemplate\">\r\n <nz-select class=\"form-select form-select-multiple\" [nzMaxTagCount]=\"1\"\r\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\r\n formControlName=\"{{_fields.field.name}}\">\r\n <nz-option *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options']\"\r\n [nzLabel]=\"item.Text\" [nzValue]=\"item.Value\"></nz-option>\r\n </nz-select>\r\n </ng-container>\r\n <ng-template #elseTemplate>\r\n <select class=\"form-select\" [multiple]=\"false\" [placeholder]=\"formConfiguration['Select.NullText']\" formControlName=\"{{_fields.field.name}}\" (change)=\"changeValue($event)\">\r\n <option [value]=\"''\">{{formConfiguration['Select.NullText']}}</option>\r\n <ng-container *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options'];let i =index\">\r\n <option [value]=\"item.Value\">{{item.Text}}</option>\r\n </ng-container>\r\n </select>\r\n </ng-template>\r\n <small class=\"form-text text-muted d-block\"\r\n *ngIf=\"_fields.field.description\">{{_fields.field.description}}</small>\r\n </div>\r\n\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>", styles: ["::ng-deep .selectcontrol nz-select{width:100%}::ng-deep .selectcontrol nz-select .ant-select-selector{background:transparent!important;border:none!important;padding:.475rem 1.25rem!important;box-shadow:none!important;height:auto!important}::ng-deep .selectcontrol nz-select .anticon-search,::ng-deep .selectcontrol nz-select .anticon-down{display:none}::ng-deep .selectcontrol .ant-select{color:inherit!important}::ng-deep .selectcontrol .ant-select-selection-placeholder{color:inherit!important}::ng-deep .selectcontrol .ant-select-multiple .ant-select-selection-item{max-width:40%!important}::ng-deep .cdk-overlay-container .ant-select-dropdown{background:var(--lpx-content-bg)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:var(--bs-primary)!important;color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:var(--lpx-brand);color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item{color:var(--bs-body-color)}::ng-deep .was-validated .form-select-multiple{border-color:#4fbf67;padding-right:calc(1.5em + 1.35rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%234fbf67' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");background-repeat:no-repeat;background-position:right calc(.375em + .3375rem) center;background-size:calc(.75em + .675rem) calc(.75em + .675rem)}\n"], 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"] }, { kind: "component", type: i4.NzOptionComponent, selector: "nz-option", inputs: ["nzTitle", "nzLabel", "nzValue", "nzKey", "nzDisabled", "nzHide", "nzCustomContent"], exportAs: ["nzOption"] }, { kind: "component", type: i4.NzSelectComponent, selector: "nz-select", inputs: ["nzId", "nzSize", "nzStatus", "nzOptionHeightPx", "nzOptionOverflowSize", "nzDropdownClassName", "nzDropdownMatchSelectWidth", "nzDropdownStyle", "nzNotFoundContent", "nzPlaceHolder", "nzPlacement", "nzMaxTagCount", "nzDropdownRender", "nzCustomTemplate", "nzSuffixIcon", "nzClearIcon", "nzRemoveIcon", "nzMenuItemSelectedIcon", "nzTokenSeparators", "nzMaxTagPlaceholder", "nzMaxMultipleCount", "nzMode", "nzFilterOption", "compareWith", "nzAllowClear", "nzBorderless", "nzShowSearch", "nzLoading", "nzAutoFocus", "nzAutoClearSearchValue", "nzServerSearch", "nzDisabled", "nzOpen", "nzSelectOnTab", "nzBackdrop", "nzOptions", "nzShowArrow"], outputs: ["nzOnSearch", "nzScrollToBottom", "nzOpenChange", "nzBlur", "nzFocus"], exportAs: ["nzSelect"] }] }); }
|
|
1329
|
+
}
|
|
1330
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectSearchComponent, decorators: [{
|
|
1331
|
+
type: Component,
|
|
1332
|
+
args: [{ selector: 'df-select-search', template: "<form [formGroup]=\"_entity\">\r\n <div formGroupName=\"extraProperties\" class=\"selectcontrol\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <ng-container *ngIf=\"formConfiguration['Select.Multiple']; else elseTemplate\">\r\n <nz-select class=\"form-select form-select-multiple\" [nzMaxTagCount]=\"1\"\r\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\r\n formControlName=\"{{_fields.field.name}}\">\r\n <nz-option *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options']\"\r\n [nzLabel]=\"item.Text\" [nzValue]=\"item.Value\"></nz-option>\r\n </nz-select>\r\n </ng-container>\r\n <ng-template #elseTemplate>\r\n <select class=\"form-select\" [multiple]=\"false\" [placeholder]=\"formConfiguration['Select.NullText']\" formControlName=\"{{_fields.field.name}}\" (change)=\"changeValue($event)\">\r\n <option [value]=\"''\">{{formConfiguration['Select.NullText']}}</option>\r\n <ng-container *ngFor=\"let item of _fields?.field?.formConfiguration['Select.Options'];let i =index\">\r\n <option [value]=\"item.Value\">{{item.Text}}</option>\r\n </ng-container>\r\n </select>\r\n </ng-template>\r\n <small class=\"form-text text-muted d-block\"\r\n *ngIf=\"_fields.field.description\">{{_fields.field.description}}</small>\r\n </div>\r\n\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>", styles: ["::ng-deep .selectcontrol nz-select{width:100%}::ng-deep .selectcontrol nz-select .ant-select-selector{background:transparent!important;border:none!important;padding:.475rem 1.25rem!important;box-shadow:none!important;height:auto!important}::ng-deep .selectcontrol nz-select .anticon-search,::ng-deep .selectcontrol nz-select .anticon-down{display:none}::ng-deep .selectcontrol .ant-select{color:inherit!important}::ng-deep .selectcontrol .ant-select-selection-placeholder{color:inherit!important}::ng-deep .selectcontrol .ant-select-multiple .ant-select-selection-item{max-width:40%!important}::ng-deep .cdk-overlay-container .ant-select-dropdown{background:var(--lpx-content-bg)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-active:not(.ant-select-item-option-disabled){background-color:var(--bs-primary)!important;color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item-option-selected:not(.ant-select-item-option-disabled){background-color:var(--lpx-brand);color:var(--lpx-text-white)!important}::ng-deep .cdk-overlay-container .ant-select-item{color:var(--bs-body-color)}::ng-deep .was-validated .form-select-multiple{border-color:#4fbf67;padding-right:calc(1.5em + 1.35rem);background-image:url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%234fbf67' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\");background-repeat:no-repeat;background-position:right calc(.375em + .3375rem) center;background-size:calc(.75em + .675rem) calc(.75em + .675rem)}\n"] }]
|
|
1333
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { fields: [{
|
|
1334
|
+
type: Input
|
|
1335
|
+
}], parentFiledName: [{
|
|
1336
|
+
type: Input
|
|
1337
|
+
}], selected: [{
|
|
1338
|
+
type: Input
|
|
1339
|
+
}], entity: [{
|
|
1340
|
+
type: Input
|
|
1341
|
+
}], submitclick: [{
|
|
1342
|
+
type: ViewChild,
|
|
1343
|
+
args: ['submitclick', { static: true }]
|
|
1344
|
+
}] } });
|
|
1345
|
+
|
|
1346
|
+
class SelectViewComponent {
|
|
1347
|
+
constructor() {
|
|
1348
|
+
/**展示则内容 */
|
|
1349
|
+
this.showValue = '';
|
|
1350
|
+
/**是否显示再列表 */
|
|
1351
|
+
this.showInList = false;
|
|
1352
|
+
/**表单控件Value */
|
|
1353
|
+
this._value = '';
|
|
1354
|
+
}
|
|
1355
|
+
set value(v) {
|
|
1356
|
+
this._value = v;
|
|
1357
|
+
}
|
|
1358
|
+
async ngAfterContentInit() {
|
|
1359
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1360
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1361
|
+
let valueOptions = this._value;
|
|
1362
|
+
if (this.type && valueOptions) {
|
|
1363
|
+
if (Array.isArray(valueOptions)) {
|
|
1364
|
+
this.showValue = valueOptions.join(',');
|
|
1365
|
+
}
|
|
1366
|
+
else {
|
|
1367
|
+
this.showValue = valueOptions;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1372
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.1.5", type: SelectViewComponent, selector: "df-select-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, ngImport: i0, template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}", styles: [""], dependencies: [{ kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
|
|
1373
|
+
}
|
|
1374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectViewComponent, decorators: [{
|
|
1375
|
+
type: Component,
|
|
1376
|
+
args: [{ selector: 'df-select-view', template: "@if(showInList){\r\n{{showValue}}\r\n} @else{\r\n<div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"fields.displayName\">{{ fields.displayName }}</label>\r\n <div>\r\n {{showValue}}\r\n </div>\r\n</div>\r\n}" }]
|
|
1377
|
+
}], propDecorators: { showInList: [{
|
|
1378
|
+
type: Input
|
|
1379
|
+
}], fields: [{
|
|
1380
|
+
type: Input
|
|
1381
|
+
}], type: [{
|
|
1382
|
+
type: Input
|
|
1383
|
+
}], value: [{
|
|
1384
|
+
type: Input
|
|
1385
|
+
}] } });
|
|
1386
|
+
|
|
959
1387
|
// import { CkEditorConfigComponent, CkEditorControlComponent } from "./ck-editor";
|
|
960
1388
|
/**
|
|
961
1389
|
* 表单控件分组-包含配置,控件,显示的数组
|
|
@@ -966,58 +1394,53 @@ const FieldControlGroup = [
|
|
|
966
1394
|
name: 'TextEdit',
|
|
967
1395
|
fieldConfigComponent: TextEditConfigComponent,
|
|
968
1396
|
fieldComponent: TextEditComponent,
|
|
969
|
-
|
|
1397
|
+
fieldViewComponent: TextEditViewComponent,
|
|
1398
|
+
fieldSearchComponent: TextEditSearchComponent,
|
|
970
1399
|
},
|
|
971
1400
|
{
|
|
972
1401
|
displayName: '开关',
|
|
973
1402
|
name: 'Switch',
|
|
974
1403
|
fieldConfigComponent: SwitchConfigComponent,
|
|
975
1404
|
fieldComponent: SwitchControlComponent,
|
|
976
|
-
|
|
1405
|
+
fieldViewComponent: SwitchViewComponent,
|
|
1406
|
+
fieldSearchComponent: SwitchSearchComponent,
|
|
977
1407
|
},
|
|
978
1408
|
{
|
|
979
1409
|
displayName: '选择',
|
|
980
1410
|
name: 'Select',
|
|
981
1411
|
fieldConfigComponent: SelectConfigComponent,
|
|
982
1412
|
fieldComponent: SelectControlComponent,
|
|
983
|
-
|
|
1413
|
+
fieldViewComponent: SelectViewComponent,
|
|
1414
|
+
fieldSearchComponent: SelectSearchComponent,
|
|
984
1415
|
},
|
|
985
1416
|
{
|
|
986
1417
|
displayName: '数字',
|
|
987
1418
|
name: 'NumericEdit',
|
|
988
1419
|
fieldConfigComponent: NumbericEditConfigComponent,
|
|
989
1420
|
fieldComponent: NumbericEditControlComponent,
|
|
990
|
-
|
|
1421
|
+
fieldViewComponent: NumericEditViewComponent,
|
|
991
1422
|
},
|
|
992
1423
|
{
|
|
993
1424
|
displayName: '日期',
|
|
994
1425
|
name: 'DateEdit',
|
|
995
1426
|
fieldConfigComponent: DateEditConfigComponent,
|
|
996
1427
|
fieldComponent: DateEditControlComponent,
|
|
997
|
-
|
|
1428
|
+
fieldViewComponent: DateEditViewComponent,
|
|
998
1429
|
},
|
|
999
1430
|
];
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1431
|
+
function AddFieldControlGroup(array = []) {
|
|
1432
|
+
for (const element of array) {
|
|
1433
|
+
let find = FieldControlGroup.find((control) => {
|
|
1434
|
+
return control.name === element.name;
|
|
1435
|
+
});
|
|
1436
|
+
if (!find) {
|
|
1437
|
+
FieldControlGroup.push(element);
|
|
1438
|
+
}
|
|
1008
1439
|
}
|
|
1009
|
-
AddFieldControlGroup([...fielFieldControlGroup, ...ckEditorFieldControlGroup]);
|
|
1010
1440
|
return FieldControlGroup;
|
|
1011
1441
|
}
|
|
1012
|
-
function AddFieldControlGroup(array = []) {
|
|
1013
|
-
FieldControlGroup.push(...array);
|
|
1014
|
-
}
|
|
1015
1442
|
|
|
1016
1443
|
class DynamicComponent {
|
|
1017
|
-
constructor() {
|
|
1018
|
-
/**字段配置列表 */
|
|
1019
|
-
this._fields = '';
|
|
1020
|
-
}
|
|
1021
1444
|
set selected(v) {
|
|
1022
1445
|
this._selected = v === undefined ? '' : v === null ? '' : v;
|
|
1023
1446
|
}
|
|
@@ -1041,10 +1464,14 @@ class DynamicComponent {
|
|
|
1041
1464
|
this.dataLoaded(3);
|
|
1042
1465
|
}
|
|
1043
1466
|
}
|
|
1467
|
+
constructor(mergedConfig) {
|
|
1468
|
+
this.mergedConfig = mergedConfig;
|
|
1469
|
+
/**字段配置列表 */
|
|
1470
|
+
this._fields = '';
|
|
1471
|
+
}
|
|
1044
1472
|
/**数据加载完成 */
|
|
1045
1473
|
async dataLoaded(val) {
|
|
1046
|
-
|
|
1047
|
-
let _fieldControlGroup = new Array(...await getExcludeAssignControl());
|
|
1474
|
+
let _fieldControlGroup = AddFieldControlGroup(this.mergedConfig);
|
|
1048
1475
|
if (this._entity) {
|
|
1049
1476
|
//加载所有的动态表单组件
|
|
1050
1477
|
if (this._type) {
|
|
@@ -1053,7 +1480,7 @@ class DynamicComponent {
|
|
|
1053
1480
|
}
|
|
1054
1481
|
if (this._fields && this._parentFiledName && this._culture) {
|
|
1055
1482
|
/**表单控件组中的项 */
|
|
1056
|
-
let fieldControlItem = _fieldControlGroup.find(el => el.name === this._fields
|
|
1483
|
+
let fieldControlItem = _fieldControlGroup.find(el => el.name === this._fields?.field?.formControlName);
|
|
1057
1484
|
this.loadfieldComponent(fieldControlItem);
|
|
1058
1485
|
}
|
|
1059
1486
|
}
|
|
@@ -1087,13 +1514,16 @@ class DynamicComponent {
|
|
|
1087
1514
|
instance.culture = this._culture;
|
|
1088
1515
|
instance.entity = this._entity;
|
|
1089
1516
|
}
|
|
1090
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1517
|
+
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 }); }
|
|
1091
1518
|
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: [""] }); }
|
|
1092
1519
|
}
|
|
1093
1520
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicComponent, decorators: [{
|
|
1094
1521
|
type: Component,
|
|
1095
1522
|
args: [{ selector: 'df-dynamic', template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template>" }]
|
|
1096
|
-
}],
|
|
1523
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1524
|
+
type: Inject,
|
|
1525
|
+
args: ['MERGED_FORM_CONFIG']
|
|
1526
|
+
}] }], propDecorators: { selected: [{
|
|
1097
1527
|
type: Input
|
|
1098
1528
|
}], type: [{
|
|
1099
1529
|
type: Input
|
|
@@ -1113,9 +1543,172 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1113
1543
|
args: ['FormComponentsRef', { read: ViewContainerRef, static: true }]
|
|
1114
1544
|
}] } });
|
|
1115
1545
|
|
|
1546
|
+
class FormControlService {
|
|
1547
|
+
constructor(mergedConfig) {
|
|
1548
|
+
this.mergedConfig = mergedConfig;
|
|
1549
|
+
this._FieldControlGroup = FieldControlGroup;
|
|
1550
|
+
}
|
|
1551
|
+
AddFieldControlGroup() {
|
|
1552
|
+
let array = this.mergedConfig;
|
|
1553
|
+
for (const element of array) {
|
|
1554
|
+
let find = FieldControlGroup.find(control => {
|
|
1555
|
+
return control.name === element.name;
|
|
1556
|
+
});
|
|
1557
|
+
if (!find) {
|
|
1558
|
+
FieldControlGroup.push(element);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
return FieldControlGroup;
|
|
1562
|
+
}
|
|
1563
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: FormControlService, deps: [{ token: 'MERGED_FORM_CONFIG' }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1564
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: FormControlService, providedIn: 'root' }); }
|
|
1565
|
+
}
|
|
1566
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: FormControlService, decorators: [{
|
|
1567
|
+
type: Injectable,
|
|
1568
|
+
args: [{
|
|
1569
|
+
providedIn: 'root',
|
|
1570
|
+
}]
|
|
1571
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1572
|
+
type: Inject,
|
|
1573
|
+
args: ['MERGED_FORM_CONFIG']
|
|
1574
|
+
}] }] });
|
|
1575
|
+
|
|
1576
|
+
class DynamicViewComponent {
|
|
1577
|
+
constructor(_FormControlService) {
|
|
1578
|
+
this._FormControlService = _FormControlService;
|
|
1579
|
+
/**是否显示再列表 */
|
|
1580
|
+
this.showInList = false;
|
|
1581
|
+
/**表单控件Value */
|
|
1582
|
+
this._value = '';
|
|
1583
|
+
}
|
|
1584
|
+
set value(v) {
|
|
1585
|
+
this._value = v;
|
|
1586
|
+
// if(this._value) this.dataLoaded();
|
|
1587
|
+
}
|
|
1588
|
+
ngAfterContentInit() {
|
|
1589
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1590
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1591
|
+
if (this.type && this._value !== '') {
|
|
1592
|
+
let _fieldControlGroup = this._FormControlService.AddFieldControlGroup();
|
|
1593
|
+
let fieldControlItem = _fieldControlGroup.find(el => el.name === this.type);
|
|
1594
|
+
this.loadViewComponent(fieldControlItem);
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
/**加载动态展示组件 */
|
|
1598
|
+
loadViewComponent(FieldControlItem) {
|
|
1599
|
+
//清空了容器中的所有组件
|
|
1600
|
+
this.FormTemplateRef?.clear();
|
|
1601
|
+
if (!FieldControlItem || !FieldControlItem.fieldViewComponent)
|
|
1602
|
+
return;
|
|
1603
|
+
//在容器中创建组件
|
|
1604
|
+
const { instance } = this.FormTemplateRef?.createComponent(FieldControlItem.fieldViewComponent); //创建组件模板
|
|
1605
|
+
/**向创建的组件模板中传值 */
|
|
1606
|
+
instance.type = this.type;
|
|
1607
|
+
instance.value = this._value;
|
|
1608
|
+
instance.fields = this.fields;
|
|
1609
|
+
instance.showInList = this.showInList;
|
|
1610
|
+
}
|
|
1611
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicViewComponent, deps: [{ token: FormControlService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1612
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicViewComponent, selector: "df-dynamic-view", inputs: { showInList: "showInList", fields: "fields", type: "type", value: "value" }, viewQueries: [{ propertyName: "FormTemplateRef", first: true, predicate: ["FormTemplateRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<template #FormTemplateRef></template>", styles: [""] }); }
|
|
1613
|
+
}
|
|
1614
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicViewComponent, decorators: [{
|
|
1615
|
+
type: Component,
|
|
1616
|
+
args: [{ selector: 'df-dynamic-view', template: "<template #FormTemplateRef></template>" }]
|
|
1617
|
+
}], ctorParameters: () => [{ type: FormControlService }], propDecorators: { showInList: [{
|
|
1618
|
+
type: Input
|
|
1619
|
+
}], fields: [{
|
|
1620
|
+
type: Input
|
|
1621
|
+
}], type: [{
|
|
1622
|
+
type: Input
|
|
1623
|
+
}], value: [{
|
|
1624
|
+
type: Input
|
|
1625
|
+
}], FormTemplateRef: [{
|
|
1626
|
+
type: ViewChild,
|
|
1627
|
+
args: ['FormTemplateRef', { read: ViewContainerRef, static: true }]
|
|
1628
|
+
}] } });
|
|
1629
|
+
|
|
1630
|
+
class DynamicConfigComponent {
|
|
1631
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicConfigComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1632
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicConfigComponent, selector: "df-dynamic-config", ngImport: i0, template: "<p>dynamic-config works!</p>\r\n", styles: [""] }); }
|
|
1633
|
+
}
|
|
1634
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicConfigComponent, decorators: [{
|
|
1635
|
+
type: Component,
|
|
1636
|
+
args: [{ selector: 'df-dynamic-config', template: "<p>dynamic-config works!</p>\r\n" }]
|
|
1637
|
+
}] });
|
|
1638
|
+
|
|
1639
|
+
class DynamicControlComponent {
|
|
1640
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicControlComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1641
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicControlComponent, selector: "df-dynamic-control", ngImport: i0, template: "<p>dynamic-control works!</p>\r\n", styles: [""] }); }
|
|
1642
|
+
}
|
|
1643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicControlComponent, decorators: [{
|
|
1644
|
+
type: Component,
|
|
1645
|
+
args: [{ selector: 'df-dynamic-control', template: "<p>dynamic-control works!</p>\r\n" }]
|
|
1646
|
+
}] });
|
|
1647
|
+
|
|
1648
|
+
class DynamicSearchComponent {
|
|
1649
|
+
constructor(_FormControlService) {
|
|
1650
|
+
this._FormControlService = _FormControlService;
|
|
1651
|
+
/**字段配置列表 */
|
|
1652
|
+
this._fields = '';
|
|
1653
|
+
}
|
|
1654
|
+
set culture(v) {
|
|
1655
|
+
this._culture = v;
|
|
1656
|
+
}
|
|
1657
|
+
set parentFiledName(v) {
|
|
1658
|
+
this._parentFiledName = v;
|
|
1659
|
+
}
|
|
1660
|
+
set fields(v) {
|
|
1661
|
+
this._fields = v;
|
|
1662
|
+
}
|
|
1663
|
+
set entity(v) {
|
|
1664
|
+
if (v) {
|
|
1665
|
+
this._entity = v;
|
|
1666
|
+
}
|
|
1667
|
+
}
|
|
1668
|
+
ngAfterContentInit() {
|
|
1669
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1670
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1671
|
+
if (this._fields && this._entity && this._culture) {
|
|
1672
|
+
let _fieldControlGroup = this._FormControlService.AddFieldControlGroup();
|
|
1673
|
+
let fieldControlItem = _fieldControlGroup.find(el => el.name === this._fields?.field?.formControlName);
|
|
1674
|
+
this.loadComponent(fieldControlItem);
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
/**加载动态展示组件 */
|
|
1678
|
+
loadComponent(FieldControlItem) {
|
|
1679
|
+
//清空了容器中的所有组件
|
|
1680
|
+
this.FormSearchTemplateRef?.clear();
|
|
1681
|
+
if (!FieldControlItem || !FieldControlItem.fieldSearchComponent)
|
|
1682
|
+
return;
|
|
1683
|
+
//在容器中创建组件
|
|
1684
|
+
const { instance } = this.FormSearchTemplateRef?.createComponent(FieldControlItem.fieldSearchComponent); //创建组件模板
|
|
1685
|
+
/**向创建的组件模板中传值 */
|
|
1686
|
+
instance.fields = this._fields;
|
|
1687
|
+
instance.parentFiledName = this._parentFiledName;
|
|
1688
|
+
instance.culture = this._culture;
|
|
1689
|
+
instance.entity = this._entity;
|
|
1690
|
+
}
|
|
1691
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicSearchComponent, deps: [{ token: FormControlService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1692
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicSearchComponent, selector: "df-dynamic-search", inputs: { culture: "culture", parentFiledName: "parentFiledName", fields: "fields", entity: "entity" }, viewQueries: [{ propertyName: "FormSearchTemplateRef", first: true, predicate: ["FormSearchTemplateRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<template #FormSearchTemplateRef></template>", styles: [""] }); }
|
|
1693
|
+
}
|
|
1694
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicSearchComponent, decorators: [{
|
|
1695
|
+
type: Component,
|
|
1696
|
+
args: [{ selector: 'df-dynamic-search', template: "<template #FormSearchTemplateRef></template>" }]
|
|
1697
|
+
}], ctorParameters: () => [{ type: FormControlService }], propDecorators: { culture: [{
|
|
1698
|
+
type: Input
|
|
1699
|
+
}], parentFiledName: [{
|
|
1700
|
+
type: Input
|
|
1701
|
+
}], fields: [{
|
|
1702
|
+
type: Input
|
|
1703
|
+
}], entity: [{
|
|
1704
|
+
type: Input
|
|
1705
|
+
}], FormSearchTemplateRef: [{
|
|
1706
|
+
type: ViewChild,
|
|
1707
|
+
args: ['FormSearchTemplateRef', { read: ViewContainerRef, static: true }]
|
|
1708
|
+
}] } });
|
|
1709
|
+
|
|
1116
1710
|
class DynamicFormModule {
|
|
1117
1711
|
static forRoot(config) {
|
|
1118
|
-
AddFieldControlGroup(config?.cmsFieldControlGroup);
|
|
1119
1712
|
return {
|
|
1120
1713
|
ngModule: DynamicFormModule,
|
|
1121
1714
|
providers: []
|
|
@@ -1132,26 +1725,49 @@ class DynamicFormModule {
|
|
|
1132
1725
|
DateEditControlComponent,
|
|
1133
1726
|
SelectConfigComponent,
|
|
1134
1727
|
SelectControlComponent,
|
|
1135
|
-
DynamicComponent
|
|
1728
|
+
DynamicComponent,
|
|
1729
|
+
DynamicConfigComponent,
|
|
1730
|
+
DynamicViewComponent,
|
|
1731
|
+
DynamicControlComponent,
|
|
1732
|
+
SelectViewComponent,
|
|
1733
|
+
SwitchViewComponent,
|
|
1734
|
+
TextEditViewComponent,
|
|
1735
|
+
DateEditViewComponent,
|
|
1736
|
+
NumericEditViewComponent,
|
|
1737
|
+
DynamicSearchComponent,
|
|
1738
|
+
SelectSearchComponent,
|
|
1739
|
+
TextEditSearchComponent,
|
|
1740
|
+
SwitchSearchComponent], imports: [FormsModule,
|
|
1136
1741
|
CoreModule,
|
|
1137
1742
|
ThemeSharedModule,
|
|
1138
1743
|
ReactiveFormsModule,
|
|
1139
|
-
NgbDropdownModule
|
|
1744
|
+
NgbDropdownModule,
|
|
1745
|
+
NzSelectModule], exports: [TextEditConfigComponent,
|
|
1140
1746
|
TextEditComponent,
|
|
1747
|
+
TextEditViewComponent,
|
|
1141
1748
|
SwitchConfigComponent,
|
|
1142
1749
|
SwitchControlComponent,
|
|
1750
|
+
SwitchViewComponent,
|
|
1143
1751
|
NumbericEditConfigComponent,
|
|
1144
1752
|
NumbericEditControlComponent,
|
|
1145
1753
|
DateEditConfigComponent,
|
|
1146
1754
|
DateEditControlComponent,
|
|
1755
|
+
DateEditViewComponent,
|
|
1147
1756
|
SelectConfigComponent,
|
|
1148
1757
|
SelectControlComponent,
|
|
1149
|
-
|
|
1758
|
+
SelectViewComponent,
|
|
1759
|
+
SelectSearchComponent,
|
|
1760
|
+
DynamicComponent,
|
|
1761
|
+
DynamicConfigComponent,
|
|
1762
|
+
DynamicViewComponent,
|
|
1763
|
+
DynamicControlComponent,
|
|
1764
|
+
DynamicSearchComponent] }); }
|
|
1150
1765
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicFormModule, imports: [FormsModule,
|
|
1151
1766
|
CoreModule,
|
|
1152
1767
|
ThemeSharedModule,
|
|
1153
1768
|
ReactiveFormsModule,
|
|
1154
|
-
NgbDropdownModule
|
|
1769
|
+
NgbDropdownModule,
|
|
1770
|
+
NzSelectModule] }); }
|
|
1155
1771
|
}
|
|
1156
1772
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicFormModule, decorators: [{
|
|
1157
1773
|
type: NgModule,
|
|
@@ -1168,6 +1784,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1168
1784
|
SelectConfigComponent,
|
|
1169
1785
|
SelectControlComponent,
|
|
1170
1786
|
DynamicComponent,
|
|
1787
|
+
DynamicConfigComponent,
|
|
1788
|
+
DynamicViewComponent,
|
|
1789
|
+
DynamicControlComponent,
|
|
1790
|
+
SelectViewComponent,
|
|
1791
|
+
SwitchViewComponent,
|
|
1792
|
+
TextEditViewComponent,
|
|
1793
|
+
DateEditViewComponent,
|
|
1794
|
+
NumericEditViewComponent,
|
|
1795
|
+
DynamicSearchComponent,
|
|
1796
|
+
SelectSearchComponent,
|
|
1797
|
+
TextEditSearchComponent,
|
|
1798
|
+
SwitchSearchComponent,
|
|
1171
1799
|
],
|
|
1172
1800
|
imports: [
|
|
1173
1801
|
FormsModule,
|
|
@@ -1175,20 +1803,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1175
1803
|
ThemeSharedModule,
|
|
1176
1804
|
ReactiveFormsModule,
|
|
1177
1805
|
NgbDropdownModule,
|
|
1806
|
+
NzSelectModule,
|
|
1178
1807
|
// NzTreeModule,
|
|
1179
1808
|
],
|
|
1180
1809
|
exports: [
|
|
1181
1810
|
TextEditConfigComponent,
|
|
1182
1811
|
TextEditComponent,
|
|
1812
|
+
TextEditViewComponent,
|
|
1183
1813
|
SwitchConfigComponent,
|
|
1184
1814
|
SwitchControlComponent,
|
|
1815
|
+
SwitchViewComponent,
|
|
1185
1816
|
NumbericEditConfigComponent,
|
|
1186
1817
|
NumbericEditControlComponent,
|
|
1187
1818
|
DateEditConfigComponent,
|
|
1188
1819
|
DateEditControlComponent,
|
|
1820
|
+
DateEditViewComponent,
|
|
1189
1821
|
SelectConfigComponent,
|
|
1190
1822
|
SelectControlComponent,
|
|
1823
|
+
SelectViewComponent,
|
|
1824
|
+
SelectSearchComponent,
|
|
1191
1825
|
DynamicComponent,
|
|
1826
|
+
DynamicConfigComponent,
|
|
1827
|
+
DynamicViewComponent,
|
|
1828
|
+
DynamicControlComponent,
|
|
1829
|
+
DynamicSearchComponent
|
|
1192
1830
|
],
|
|
1193
1831
|
providers: [],
|
|
1194
1832
|
}]
|
|
@@ -1202,5 +1840,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1202
1840
|
* Generated bundle index. Do not edit.
|
|
1203
1841
|
*/
|
|
1204
1842
|
|
|
1205
|
-
export { AddFieldControlGroup, DateEditConfigComponent, DateEditControlComponent, DynamicComponent, DynamicFormModule, FieldControlGroup, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SwitchConfigComponent, SwitchControlComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent,
|
|
1843
|
+
export { AddFieldControlGroup, DateEditConfigComponent, DateEditControlComponent, DateEditViewComponent, DynamicComponent, DynamicConfigComponent, DynamicControlComponent, DynamicFormModule, DynamicSearchComponent, DynamicViewComponent, FieldControlGroup, NumbericEditConfigComponent, NumbericEditControlComponent, SelectConfigComponent, SelectControlComponent, SelectSearchComponent, SelectViewComponent, SwitchConfigComponent, SwitchControlComponent, SwitchSearchComponent, SwitchViewComponent, TextEditComponent, TextEditConfig, TextEditConfigComponent, TextEditSearchComponent, TextEditViewComponent, maxDecimalPlacesValidator };
|
|
1206
1844
|
//# sourceMappingURL=dignite-ng-expand.dynamic-form.mjs.map
|