@dignite-ng/expand.dynamic-form 3.0.0-rc.5 → 3.0.0-rc.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +117 -13
- package/esm2022/dignite-ng-expand.dynamic-form.mjs +1 -1
- package/esm2022/lib/components/dynamic/dynamic-config.component.mjs +61 -0
- package/esm2022/lib/components/dynamic/dynamic-control.component.mjs +92 -0
- package/esm2022/lib/components/dynamic/dynamic-search.component.mjs +67 -0
- package/esm2022/lib/components/dynamic/dynamic-view.component.mjs +60 -0
- package/esm2022/lib/components/dynamic/dynamic.component.mjs +15 -7
- package/esm2022/lib/components/dynamic/index.mjs +5 -1
- package/esm2022/lib/components/form/date-edit/date-edit-config.component.mjs +13 -11
- 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 +9 -8
- package/esm2022/lib/components/form/date-edit/date-edit-view.component.mjs +41 -0
- package/esm2022/lib/components/form/date-edit/index.mjs +2 -1
- package/esm2022/lib/components/form/form-control-group.mjs +21 -9
- 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 +12 -10
- 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 +24 -16
- package/esm2022/lib/components/form/numeric-edit/numeric-edit-search.component.mjs +107 -0
- package/esm2022/lib/components/form/numeric-edit/numeric-edit-view.component.mjs +40 -0
- package/esm2022/lib/components/form/select/index.mjs +3 -1
- package/esm2022/lib/components/form/select/select-config.component.mjs +37 -17
- package/esm2022/lib/components/form/select/select-config.mjs +4 -11
- package/esm2022/lib/components/form/select/select-control.component.mjs +27 -19
- package/esm2022/lib/components/form/select/select-search.component.mjs +94 -0
- package/esm2022/lib/components/form/select/select-view.component.mjs +45 -0
- package/esm2022/lib/components/form/switch/index.mjs +3 -1
- package/esm2022/lib/components/form/switch/switch-config.component.mjs +16 -12
- package/esm2022/lib/components/form/switch/switch-config.mjs +3 -10
- package/esm2022/lib/components/form/switch/switch-control.component.mjs +5 -5
- package/esm2022/lib/components/form/switch/switch-search.component.mjs +79 -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 +18 -14
- package/esm2022/lib/components/form/text-edit/text-edit-config.mjs +5 -12
- 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 +8 -7
- package/esm2022/lib/components/index.mjs +1 -1
- package/esm2022/lib/dynamic-form.module.mjs +82 -6
- 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 +2 -60
- package/esm2022/lib/services/form-control.service.mjs +37 -0
- package/esm2022/lib/services/index.mjs +1 -1
- package/esm2022/public-api.mjs +1 -1
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs +1070 -213
- package/fesm2022/dignite-ng-expand.dynamic-form.mjs.map +1 -1
- package/lib/components/dynamic/dynamic-config.component.d.ts +20 -0
- package/lib/components/dynamic/dynamic-control.component.d.ts +31 -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 +5 -1
- package/lib/components/dynamic/index.d.ts +4 -0
- package/lib/components/form/date-edit/date-edit-config.component.d.ts +1 -1
- package/lib/components/form/date-edit/date-edit-control.component.d.ts +2 -2
- package/lib/components/form/date-edit/date-edit-view.component.d.ts +18 -0
- package/lib/components/form/date-edit/index.d.ts +1 -0
- package/lib/components/form/form-control-group.d.ts +1 -1
- package/lib/components/form/numeric-edit/numberic-edit-config.component.d.ts +1 -1
- package/lib/components/form/numeric-edit/numberic-edit-control.component.d.ts +2 -1
- package/lib/components/form/numeric-edit/numeric-edit-search.component.d.ts +35 -0
- package/lib/components/form/numeric-edit/numeric-edit-view.component.d.ts +18 -0
- package/lib/components/form/select/index.d.ts +2 -0
- package/lib/components/form/select/select-config.component.d.ts +9 -1
- package/lib/components/form/select/select-config.d.ts +0 -1
- package/lib/components/form/select/select-control.component.d.ts +2 -2
- 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-config.component.d.ts +2 -2
- package/lib/components/form/switch/switch-config.d.ts +0 -1
- 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-config.component.d.ts +4 -2
- package/lib/components/form/text-edit/text-edit-config.d.ts +0 -1
- 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 +21 -5
- package/lib/interfaces/form-config-interfaces.d.ts +8 -4
- package/lib/services/df-api.service.d.ts +0 -11
- package/lib/services/form-control.service.d.ts +13 -0
- package/package.json +11 -9
|
@@ -1,31 +1,28 @@
|
|
|
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
|
-
import { Validators,
|
|
4
|
+
import { Validators, FormGroup, FormControl, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
5
5
|
import * as i2 from '@abp/ng.core';
|
|
6
6
|
import { CoreModule } from '@abp/ng.core';
|
|
7
7
|
import { ThemeSharedModule } from '@abp/ng.theme.shared';
|
|
8
|
-
import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
|
|
8
|
+
import { NgbDropdownModule, NgbDatepickerModule } from '@ng-bootstrap/ng-bootstrap';
|
|
9
9
|
import * as i3 from '@ngx-validate/core';
|
|
10
10
|
import * as i2$1 from '@angular/common';
|
|
11
11
|
import { DatePipe } from '@angular/common';
|
|
12
|
-
import
|
|
12
|
+
import * as i6 from '@angular/cdk/drag-drop';
|
|
13
|
+
import { moveItemInArray, DragDropModule } from '@angular/cdk/drag-drop';
|
|
14
|
+
import * as i4 from 'ng-zorro-antd/select';
|
|
15
|
+
import { NzSelectModule } from 'ng-zorro-antd/select';
|
|
16
|
+
import { ExtensibleModule } from '@abp/ng.components/extensible';
|
|
13
17
|
|
|
14
18
|
class TextEditConfig {
|
|
15
|
-
constructor(
|
|
19
|
+
constructor() {
|
|
16
20
|
/**占位符 */
|
|
17
|
-
this['TextEdit.Placeholder'] = [''
|
|
21
|
+
this['TextEdit.Placeholder'] = [''];
|
|
18
22
|
//字段类型,单行文本,多行文本
|
|
19
|
-
this['TextEdit.Mode'] = [0
|
|
23
|
+
this['TextEdit.Mode'] = [0];
|
|
20
24
|
// 字数限制
|
|
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
|
-
}
|
|
25
|
+
this['TextEdit.CharLimit'] = ['265'];
|
|
29
26
|
}
|
|
30
27
|
}
|
|
31
28
|
|
|
@@ -37,18 +34,21 @@ var TextEditMode;
|
|
|
37
34
|
TextEditMode[TextEditMode["MultipleLine"] = 1] = "MultipleLine";
|
|
38
35
|
})(TextEditMode || (TextEditMode = {}));
|
|
39
36
|
|
|
37
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
40
38
|
class TextEditConfigComponent {
|
|
41
39
|
constructor(fb) {
|
|
42
40
|
this.fb = fb;
|
|
43
41
|
this._TextEditMode = TextEditMode;
|
|
42
|
+
this.RadioIndex1 = Math.floor(Math.random() * 1001);
|
|
43
|
+
this.RadioIndex2 = Math.floor(Math.random() * 1001);
|
|
44
44
|
this.cdr = inject(ChangeDetectorRef);
|
|
45
45
|
}
|
|
46
46
|
set type(v) {
|
|
47
|
-
this.
|
|
47
|
+
this.formControlName = v;
|
|
48
48
|
this.dataLoaded();
|
|
49
49
|
}
|
|
50
50
|
set Entity(v) {
|
|
51
|
-
this.
|
|
51
|
+
this.formEntity = v;
|
|
52
52
|
this.dataLoaded();
|
|
53
53
|
}
|
|
54
54
|
set selected(v) {
|
|
@@ -56,19 +56,19 @@ class TextEditConfigComponent {
|
|
|
56
56
|
this.dataLoaded();
|
|
57
57
|
}
|
|
58
58
|
get formConfiguration() {
|
|
59
|
-
return this.
|
|
59
|
+
return this.formEntity.get('formConfiguration');
|
|
60
60
|
}
|
|
61
61
|
async dataLoaded() {
|
|
62
|
-
if (this.
|
|
62
|
+
if (this.formEntity && this.formControlName) {
|
|
63
63
|
await this.AfterInit();
|
|
64
|
-
this.cdr.detectChanges(); // 手动触发变更检测
|
|
65
|
-
this.submitclick?.nativeElement?.click();
|
|
66
64
|
}
|
|
67
65
|
}
|
|
68
66
|
AfterInit() {
|
|
69
67
|
return new Promise((resolve, rejects) => {
|
|
70
|
-
this.
|
|
71
|
-
|
|
68
|
+
this.formEntity.setControl('formConfiguration', this.fb.group(new TextEditConfig()));
|
|
69
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
70
|
+
this.submitclick?.nativeElement?.click();
|
|
71
|
+
if (this._selected && this._selected.formControlName == this.formControlName) {
|
|
72
72
|
this.formConfiguration.patchValue({
|
|
73
73
|
...this._selected.formConfiguration,
|
|
74
74
|
});
|
|
@@ -77,11 +77,11 @@ class TextEditConfigComponent {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
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]=\"
|
|
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]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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=\"flexRadioDefault{{RadioIndex1}}\">\n <label class=\"form-check-label\" for=\"flexRadioDefault{{RadioIndex1}}\">\n {{'AbpDynamicForm::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=\"flexRadioDefault{{RadioIndex2}}\">\n <label class=\"form-check-label\" for=\"flexRadioDefault{{RadioIndex2}}\">\n {{'AbpDynamicForm::MultipleLine' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::CharLimit' | abpLocalization}}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"TextEdit.CharLimit\">\n </div>\n <button type=\"submit\" 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: 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
81
|
}
|
|
82
82
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditConfigComponent, decorators: [{
|
|
83
83
|
type: Component,
|
|
84
|
-
args: [{ selector: 'df-text-edit-config', template: "<form [formGroup]=\"
|
|
84
|
+
args: [{ selector: 'df-text-edit-config', template: "<form [formGroup]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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=\"flexRadioDefault{{RadioIndex1}}\">\n <label class=\"form-check-label\" for=\"flexRadioDefault{{RadioIndex1}}\">\n {{'AbpDynamicForm::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=\"flexRadioDefault{{RadioIndex2}}\">\n <label class=\"form-check-label\" for=\"flexRadioDefault{{RadioIndex2}}\">\n {{'AbpDynamicForm::MultipleLine' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::CharLimit' | abpLocalization}}</label>\n <input type=\"number\" class=\"form-control\" formControlName=\"TextEdit.CharLimit\">\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>" }]
|
|
85
85
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { type: [{
|
|
86
86
|
type: Input
|
|
87
87
|
}], Entity: [{
|
|
@@ -93,6 +93,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
93
93
|
args: ['submitclick', { static: true }]
|
|
94
94
|
}] } });
|
|
95
95
|
|
|
96
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
96
97
|
/* eslint-disable @angular-eslint/no-empty-lifecycle-method */
|
|
97
98
|
/* eslint-disable @angular-eslint/use-lifecycle-interface */
|
|
98
99
|
class TextEditComponent {
|
|
@@ -134,7 +135,7 @@ class TextEditComponent {
|
|
|
134
135
|
}
|
|
135
136
|
AfterInit() {
|
|
136
137
|
return new Promise((resolve, rejects) => {
|
|
137
|
-
|
|
138
|
+
const ValidatorsArray = [];
|
|
138
139
|
if (this._fields.required) {
|
|
139
140
|
ValidatorsArray.push(Validators.required);
|
|
140
141
|
}
|
|
@@ -145,15 +146,15 @@ class TextEditComponent {
|
|
|
145
146
|
if (this._fields.field.formConfiguration['TextEdit.CharLimit']) {
|
|
146
147
|
ValidatorsArray.push(Validators.maxLength(this._fields.field.formConfiguration['TextEdit.CharLimit']));
|
|
147
148
|
}
|
|
148
|
-
|
|
149
|
-
this.extraProperties
|
|
149
|
+
const newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
150
|
+
this.extraProperties?.setControl(this._fields.field.name, newControl);
|
|
150
151
|
resolve(true);
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
ngOnDestroy() {
|
|
154
155
|
//Called once, before the instance is destroyed.
|
|
155
156
|
//Add 'implements OnDestroy' to the class.
|
|
156
|
-
this.extraProperties
|
|
157
|
+
this.extraProperties?.removeControl(this._fields.field.name);
|
|
157
158
|
}
|
|
158
159
|
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
160
|
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,20 +175,123 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
174
175
|
args: ['submitclick', { static: true }]
|
|
175
176
|
}] } });
|
|
176
177
|
|
|
178
|
+
class TextEditViewComponent {
|
|
179
|
+
constructor() {
|
|
180
|
+
/**展示则内容 */
|
|
181
|
+
this.showValue = '';
|
|
182
|
+
/**是否显示再列表 */
|
|
183
|
+
this.showInList = false;
|
|
184
|
+
/**表单控件Value */
|
|
185
|
+
this._value = '';
|
|
186
|
+
}
|
|
187
|
+
set value(v) {
|
|
188
|
+
this._value = v;
|
|
189
|
+
}
|
|
190
|
+
async ngAfterContentInit() {
|
|
191
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
192
|
+
//Add 'implements AfterContentInit' to the class.
|
|
193
|
+
let valueOptions = this._value;
|
|
194
|
+
if (this.type && valueOptions) {
|
|
195
|
+
this.showValue = valueOptions;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
199
|
+
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"] }] }); }
|
|
200
|
+
}
|
|
201
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditViewComponent, decorators: [{
|
|
202
|
+
type: Component,
|
|
203
|
+
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}" }]
|
|
204
|
+
}], propDecorators: { showInList: [{
|
|
205
|
+
type: Input
|
|
206
|
+
}], fields: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], type: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], value: [{
|
|
211
|
+
type: Input
|
|
212
|
+
}] } });
|
|
213
|
+
|
|
214
|
+
class TextEditSearchComponent {
|
|
215
|
+
constructor(fb) {
|
|
216
|
+
this.fb = fb;
|
|
217
|
+
this._TextEditMode = TextEditMode;
|
|
218
|
+
/**字段配置列表 */
|
|
219
|
+
this._fields = '';
|
|
220
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
221
|
+
this.isObjEmpty = (obj) => Object.keys(obj).length === 0;
|
|
222
|
+
}
|
|
223
|
+
set entity(v) {
|
|
224
|
+
this._entity = v;
|
|
225
|
+
if (v)
|
|
226
|
+
this.dataLoaded();
|
|
227
|
+
}
|
|
228
|
+
set fields(v) {
|
|
229
|
+
this._fields = v;
|
|
230
|
+
if (v)
|
|
231
|
+
this.dataLoaded();
|
|
232
|
+
}
|
|
233
|
+
set parentFiledName(v) {
|
|
234
|
+
this._parentFiledName = v;
|
|
235
|
+
if (v)
|
|
236
|
+
this.dataLoaded();
|
|
237
|
+
}
|
|
238
|
+
set selected(v) {
|
|
239
|
+
this._selected = v || '';
|
|
240
|
+
if (v)
|
|
241
|
+
this.dataLoaded();
|
|
242
|
+
}
|
|
243
|
+
async dataLoaded() {
|
|
244
|
+
if (this._fields && this._entity && this._parentFiledName) {
|
|
245
|
+
this.extraProperties = this._entity.get(this._parentFiledName);
|
|
246
|
+
await this.AfterInit();
|
|
247
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
248
|
+
this.submitclick?.nativeElement?.click();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
AfterInit() {
|
|
252
|
+
return new Promise((resolve, rejects) => {
|
|
253
|
+
let ValidatorsArray = [];
|
|
254
|
+
this._fields.field.formConfiguration = {
|
|
255
|
+
...this.fb.group(new TextEditConfig()).value,
|
|
256
|
+
...this._fields.field.formConfiguration
|
|
257
|
+
};
|
|
258
|
+
let newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
259
|
+
this.extraProperties?.setControl(this._fields.field.name, newControl);
|
|
260
|
+
resolve(true);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
ngOnDestroy() {
|
|
264
|
+
//Called once, before the instance is destroyed.
|
|
265
|
+
//Add 'implements OnDestroy' to the class.
|
|
266
|
+
this.extraProperties?.removeControl(this._fields.field.name);
|
|
267
|
+
}
|
|
268
|
+
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 }); }
|
|
269
|
+
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"] }] }); }
|
|
270
|
+
}
|
|
271
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: TextEditSearchComponent, decorators: [{
|
|
272
|
+
type: Component,
|
|
273
|
+
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>" }]
|
|
274
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
275
|
+
type: Input
|
|
276
|
+
}], fields: [{
|
|
277
|
+
type: Input
|
|
278
|
+
}], parentFiledName: [{
|
|
279
|
+
type: Input
|
|
280
|
+
}], selected: [{
|
|
281
|
+
type: Input
|
|
282
|
+
}], submitclick: [{
|
|
283
|
+
type: ViewChild,
|
|
284
|
+
args: ['submitclick', { static: true }]
|
|
285
|
+
}] } });
|
|
286
|
+
|
|
177
287
|
class SwitchConfig {
|
|
178
|
-
constructor(
|
|
288
|
+
constructor() {
|
|
179
289
|
/**默认值 */
|
|
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
|
-
}
|
|
290
|
+
this['Switch.Default'] = [false];
|
|
188
291
|
}
|
|
189
292
|
}
|
|
190
293
|
|
|
294
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
191
295
|
class SwitchConfigComponent {
|
|
192
296
|
constructor(fb) {
|
|
193
297
|
this.fb = fb;
|
|
@@ -198,7 +302,7 @@ class SwitchConfigComponent {
|
|
|
198
302
|
this.dataLoaded();
|
|
199
303
|
}
|
|
200
304
|
set Entity(v) {
|
|
201
|
-
this.
|
|
305
|
+
this.formEntity = v;
|
|
202
306
|
this.dataLoaded();
|
|
203
307
|
}
|
|
204
308
|
set selected(v) {
|
|
@@ -206,18 +310,20 @@ class SwitchConfigComponent {
|
|
|
206
310
|
this.dataLoaded();
|
|
207
311
|
}
|
|
208
312
|
get formConfiguration() {
|
|
209
|
-
return this.
|
|
313
|
+
return this.formEntity.get('formConfiguration');
|
|
210
314
|
}
|
|
211
315
|
async dataLoaded() {
|
|
212
|
-
if (this.
|
|
316
|
+
if (this.formEntity && this._type) {
|
|
213
317
|
await this.AfterInit();
|
|
214
|
-
this.cdr.detectChanges();
|
|
215
|
-
this.submitclick?.nativeElement?.click();
|
|
318
|
+
// this.cdr.detectChanges();
|
|
216
319
|
}
|
|
217
320
|
}
|
|
218
321
|
AfterInit() {
|
|
219
322
|
return new Promise((resolve, rejects) => {
|
|
220
|
-
this.
|
|
323
|
+
this.formEntity.setControl('formConfiguration', this.fb.group(new SwitchConfig()));
|
|
324
|
+
setTimeout(() => {
|
|
325
|
+
this.submitclick?.nativeElement?.click();
|
|
326
|
+
}, 0);
|
|
221
327
|
if (this._selected && this._selected.formControlName == this._type) {
|
|
222
328
|
this.formConfiguration.patchValue({
|
|
223
329
|
...this._selected.formConfiguration,
|
|
@@ -227,11 +333,11 @@ class SwitchConfigComponent {
|
|
|
227
333
|
});
|
|
228
334
|
}
|
|
229
335
|
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]=\"
|
|
336
|
+
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]=\"formEntity\">\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 {{'AbpDynamicForm::DefaultValue' | abpLocalization}}\n </label>\n </div>\n \n </div>\n </div>\n <button type=\"submit\" 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: 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
337
|
}
|
|
232
338
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchConfigComponent, decorators: [{
|
|
233
339
|
type: Component,
|
|
234
|
-
args: [{ selector: 'df-switch-config', template: "<form [formGroup]=\"
|
|
340
|
+
args: [{ selector: 'df-switch-config', template: "<form [formGroup]=\"formEntity\">\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 {{'AbpDynamicForm::DefaultValue' | abpLocalization}}\n </label>\n </div>\n \n </div>\n </div>\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\n </div>\n</form>" }]
|
|
235
341
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { type: [{
|
|
236
342
|
type: Input
|
|
237
343
|
}], Entity: [{
|
|
@@ -299,11 +405,83 @@ class SwitchControlComponent {
|
|
|
299
405
|
this.extraProperties.removeControl(this._fields.field.name);
|
|
300
406
|
}
|
|
301
407
|
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
|
|
408
|
+
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
409
|
}
|
|
304
410
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchControlComponent, decorators: [{
|
|
305
411
|
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
|
|
412
|
+
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>" }]
|
|
413
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
414
|
+
type: Input
|
|
415
|
+
}], fields: [{
|
|
416
|
+
type: Input
|
|
417
|
+
}], parentFiledName: [{
|
|
418
|
+
type: Input
|
|
419
|
+
}], selected: [{
|
|
420
|
+
type: Input
|
|
421
|
+
}], submitclick: [{
|
|
422
|
+
type: ViewChild,
|
|
423
|
+
args: ['submitclick', { static: true }]
|
|
424
|
+
}] } });
|
|
425
|
+
|
|
426
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
427
|
+
class SwitchSearchComponent {
|
|
428
|
+
constructor(fb) {
|
|
429
|
+
this.fb = fb;
|
|
430
|
+
/**字段配置列表 */
|
|
431
|
+
this._fields = '';
|
|
432
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
433
|
+
}
|
|
434
|
+
set entity(v) {
|
|
435
|
+
this._entity = v;
|
|
436
|
+
this.dataLoaded();
|
|
437
|
+
}
|
|
438
|
+
set fields(v) {
|
|
439
|
+
this._fields = v;
|
|
440
|
+
this.dataLoaded();
|
|
441
|
+
}
|
|
442
|
+
set parentFiledName(v) {
|
|
443
|
+
this._parentFiledName = v;
|
|
444
|
+
this.dataLoaded();
|
|
445
|
+
}
|
|
446
|
+
set selected(v) {
|
|
447
|
+
// ?v:false;
|
|
448
|
+
this._selected = v;
|
|
449
|
+
this.dataLoaded();
|
|
450
|
+
}
|
|
451
|
+
get extraProperties() {
|
|
452
|
+
return this._entity.get('extraProperties');
|
|
453
|
+
}
|
|
454
|
+
/**数据加载完成 */
|
|
455
|
+
async dataLoaded() {
|
|
456
|
+
if (this._fields && this._entity) {
|
|
457
|
+
await this.AfterInit();
|
|
458
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
459
|
+
this.submitclick?.nativeElement?.click();
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
AfterInit() {
|
|
463
|
+
return new Promise((resolve, rejects) => {
|
|
464
|
+
const ValidatorsArray = [];
|
|
465
|
+
const newControl = this.fb.control(this._selected
|
|
466
|
+
? this._selected
|
|
467
|
+
: this._selected === false
|
|
468
|
+
? this._selected
|
|
469
|
+
: '', ValidatorsArray);
|
|
470
|
+
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
471
|
+
resolve(true);
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
ngOnDestroy() {
|
|
475
|
+
//Called once, before the instance is destroyed.
|
|
476
|
+
//Add 'implements OnDestroy' to the class.
|
|
477
|
+
this.extraProperties.removeControl(this._fields.field.name);
|
|
478
|
+
}
|
|
479
|
+
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 }); }
|
|
480
|
+
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 <select class=\"form-select form-control\" formControlName=\"{{_fields.field.name}}\" role=\"switch\">\r\n <option [value]=\"\"></option>\r\n <option [value]=\"true\">{{'AbpUi::Yes'|abpLocalization}}</option>\r\n <option [value]=\"false\">{{'AbpUi::No'|abpLocalization}}</option>\r\n </select>\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.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i1.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([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.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: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
481
|
+
}
|
|
482
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchSearchComponent, decorators: [{
|
|
483
|
+
type: Component,
|
|
484
|
+
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 <select class=\"form-select form-control\" formControlName=\"{{_fields.field.name}}\" role=\"switch\">\r\n <option [value]=\"\"></option>\r\n <option [value]=\"true\">{{'AbpUi::Yes'|abpLocalization}}</option>\r\n <option [value]=\"false\">{{'AbpUi::No'|abpLocalization}}</option>\r\n </select>\r\n </div>\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>" }]
|
|
307
485
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { entity: [{
|
|
308
486
|
type: Input
|
|
309
487
|
}], fields: [{
|
|
@@ -317,14 +495,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
317
495
|
args: ['submitclick', { static: true }]
|
|
318
496
|
}] } });
|
|
319
497
|
|
|
498
|
+
class SwitchViewComponent {
|
|
499
|
+
constructor() {
|
|
500
|
+
/**展示则内容 */
|
|
501
|
+
this.showValue = '';
|
|
502
|
+
/**是否显示再列表 */
|
|
503
|
+
this.showInList = false;
|
|
504
|
+
/**表单控件Value */
|
|
505
|
+
this._value = '';
|
|
506
|
+
}
|
|
507
|
+
set value(v) {
|
|
508
|
+
this._value = v;
|
|
509
|
+
}
|
|
510
|
+
async ngAfterContentInit() {
|
|
511
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
512
|
+
//Add 'implements AfterContentInit' to the class.
|
|
513
|
+
let valueOptions = this._value;
|
|
514
|
+
if (this.type) {
|
|
515
|
+
this.showValue = valueOptions;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
519
|
+
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" }] }); }
|
|
520
|
+
}
|
|
521
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SwitchViewComponent, decorators: [{
|
|
522
|
+
type: Component,
|
|
523
|
+
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}" }]
|
|
524
|
+
}], propDecorators: { showInList: [{
|
|
525
|
+
type: Input
|
|
526
|
+
}], fields: [{
|
|
527
|
+
type: Input
|
|
528
|
+
}], type: [{
|
|
529
|
+
type: Input
|
|
530
|
+
}], value: [{
|
|
531
|
+
type: Input
|
|
532
|
+
}] } });
|
|
533
|
+
|
|
320
534
|
class NumbericEditConfig {
|
|
321
535
|
constructor(data) {
|
|
322
536
|
/**占位符 */
|
|
323
537
|
this['NumericEditField.Placeholder'] = ['', []];
|
|
324
538
|
/**最小值 */
|
|
325
|
-
this['NumericEditField.Min'] = ['', []];
|
|
539
|
+
this['NumericEditField.Min'] = ['', [Validators.required]];
|
|
326
540
|
//最大值
|
|
327
|
-
this['NumericEditField.Max'] = ['', []];
|
|
541
|
+
this['NumericEditField.Max'] = ['', [Validators.required]];
|
|
328
542
|
// 小数位数
|
|
329
543
|
this['NumericEditField.Decimals'] = [2, []];
|
|
330
544
|
//步长
|
|
@@ -341,6 +555,7 @@ class NumbericEditConfig {
|
|
|
341
555
|
}
|
|
342
556
|
}
|
|
343
557
|
|
|
558
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
344
559
|
class NumbericEditConfigComponent {
|
|
345
560
|
constructor(fb) {
|
|
346
561
|
this.fb = fb;
|
|
@@ -354,22 +569,22 @@ class NumbericEditConfigComponent {
|
|
|
354
569
|
this._selected = v ? v : v == false ? v : '';
|
|
355
570
|
}
|
|
356
571
|
set Entity(v) {
|
|
357
|
-
this.
|
|
572
|
+
this.formEntity = v;
|
|
358
573
|
this.dataLoaded();
|
|
359
574
|
}
|
|
360
575
|
get formConfiguration() {
|
|
361
|
-
return this.
|
|
576
|
+
return this.formEntity.get('formConfiguration');
|
|
362
577
|
}
|
|
363
578
|
async dataLoaded() {
|
|
364
|
-
if (this.
|
|
579
|
+
if (this.formEntity && this._type) {
|
|
365
580
|
await this.AfterInit();
|
|
366
|
-
this.cdr.detectChanges(); // 手动触发变更检测
|
|
367
|
-
this.submitclick?.nativeElement?.click();
|
|
368
581
|
}
|
|
369
582
|
}
|
|
370
583
|
AfterInit() {
|
|
371
584
|
return new Promise((resolve, rejects) => {
|
|
372
|
-
this.
|
|
585
|
+
this.formEntity.setControl('formConfiguration', this.fb.group(new NumbericEditConfig()));
|
|
586
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
587
|
+
this.submitclick?.nativeElement?.click();
|
|
373
588
|
if (this._selected && this._selected.formControlName == this._type) {
|
|
374
589
|
this.formConfiguration.patchValue({
|
|
375
590
|
...this._selected.formConfiguration,
|
|
@@ -379,11 +594,11 @@ class NumbericEditConfigComponent {
|
|
|
379
594
|
});
|
|
380
595
|
}
|
|
381
596
|
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]=\"
|
|
597
|
+
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]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::NumericStep' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Step\">\n <small class=\"form-text text-muted d-block\">{{'AbpDynamicForm::NumericStepHelp'|abpLocalization}}</small>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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
598
|
}
|
|
384
599
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumbericEditConfigComponent, decorators: [{
|
|
385
600
|
type: Component,
|
|
386
|
-
args: [{ selector: 'df-numberic-edit-config', template: "<form [formGroup]=\"
|
|
601
|
+
args: [{ selector: 'df-numberic-edit-config', template: "<form [formGroup]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::NumericStep' | abpLocalization}}</label>\n <input type=\"text\" class=\"form-control\" formControlName=\"NumericEditField.Step\">\n <small class=\"form-text text-muted d-block\">{{'AbpDynamicForm::NumericStepHelp'|abpLocalization}}</small>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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
602
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { type: [{
|
|
388
603
|
type: Input
|
|
389
604
|
}], selected: [{
|
|
@@ -395,13 +610,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
395
610
|
args: ['submitclick', { static: false }]
|
|
396
611
|
}] } });
|
|
397
612
|
|
|
613
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
614
|
+
/* eslint-disable @typescript-eslint/adjacent-overload-signatures */
|
|
398
615
|
function maxDecimalPlacesValidator(maxDecimalPlaces) {
|
|
399
616
|
return (control) => {
|
|
400
617
|
const value = control.value;
|
|
401
618
|
if (typeof value === 'number' && isNaN(value) === false) {
|
|
402
619
|
const decimalPart = value.toString().split('.')[1];
|
|
403
620
|
if (decimalPart && decimalPart.length > maxDecimalPlaces) {
|
|
404
|
-
return {
|
|
621
|
+
return { maxDecimalPlaces: { actual: decimalPart.length, max: maxDecimalPlaces } };
|
|
405
622
|
}
|
|
406
623
|
}
|
|
407
624
|
return null;
|
|
@@ -413,6 +630,7 @@ class NumbericEditControlComponent {
|
|
|
413
630
|
this.cdr = cdr;
|
|
414
631
|
/**字段配置列表 */
|
|
415
632
|
this._fields = '';
|
|
633
|
+
this.formConfiguration = '';
|
|
416
634
|
}
|
|
417
635
|
get entity() {
|
|
418
636
|
return this._entity;
|
|
@@ -425,16 +643,18 @@ class NumbericEditControlComponent {
|
|
|
425
643
|
}
|
|
426
644
|
set selected(v) {
|
|
427
645
|
this._selected = v;
|
|
428
|
-
//
|
|
646
|
+
//
|
|
429
647
|
}
|
|
430
648
|
set entity(v) {
|
|
431
649
|
this._entity = v;
|
|
432
650
|
this.dataLoaded();
|
|
433
651
|
}
|
|
434
652
|
get extraProperties() {
|
|
435
|
-
return this._entity
|
|
653
|
+
return this._entity?.get('extraProperties');
|
|
654
|
+
}
|
|
655
|
+
get fieldInput() {
|
|
656
|
+
return this.extraProperties.get(this._fields.field.name);
|
|
436
657
|
}
|
|
437
|
-
get fieldInput() { return this.extraProperties.get(this._fields.field.name); }
|
|
438
658
|
/**数据加载完成 */
|
|
439
659
|
async dataLoaded() {
|
|
440
660
|
if (this._fields && this._entity) {
|
|
@@ -445,8 +665,9 @@ class NumbericEditControlComponent {
|
|
|
445
665
|
}
|
|
446
666
|
AfterInit() {
|
|
447
667
|
return new Promise((resolve, rejects) => {
|
|
448
|
-
|
|
449
|
-
|
|
668
|
+
const ValidatorsArray = [];
|
|
669
|
+
const formConfiguration = this._fields.field.formConfiguration;
|
|
670
|
+
this.formConfiguration = formConfiguration;
|
|
450
671
|
if (this._fields.required) {
|
|
451
672
|
ValidatorsArray.push(Validators.required);
|
|
452
673
|
}
|
|
@@ -456,7 +677,7 @@ class NumbericEditControlComponent {
|
|
|
456
677
|
if (formConfiguration['NumericEditField.Max']) {
|
|
457
678
|
ValidatorsArray.push(Validators.max(formConfiguration['NumericEditField.Max']));
|
|
458
679
|
}
|
|
459
|
-
|
|
680
|
+
const newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
460
681
|
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
461
682
|
resolve(true);
|
|
462
683
|
});
|
|
@@ -468,20 +689,22 @@ class NumbericEditControlComponent {
|
|
|
468
689
|
}
|
|
469
690
|
/**数字框输入 */
|
|
470
691
|
inputchange(event) {
|
|
471
|
-
|
|
692
|
+
const val = event.target.value;
|
|
472
693
|
const decimalPart = val.toString().split('.')[1] || '';
|
|
473
|
-
|
|
474
|
-
|
|
694
|
+
const formConfiguration = this._fields.field.formConfiguration;
|
|
695
|
+
const Decimals = formConfiguration['NumericEditField.Decimals'];
|
|
475
696
|
if (decimalPart.length > Decimals) {
|
|
476
|
-
this.fieldInput
|
|
697
|
+
this.fieldInput?.patchValue(val.slice(0, val.length - (decimalPart.length - 2)));
|
|
477
698
|
}
|
|
699
|
+
this.extraProperties.updateValueAndValidity();
|
|
700
|
+
this.fieldInput.updateValueAndValidity();
|
|
478
701
|
}
|
|
479
702
|
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
|
|
703
|
+
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']\" [min]=\"formConfiguration['NumericEditField.Min']\" [max]=\"formConfiguration['NumericEditField.Max']\" (input)=\"inputchange($event)\" />\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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i2$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i1.FormGroupName, selector: "[formGroupName]", inputs: ["formGroupName"] }, { kind: "directive", type: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
481
704
|
}
|
|
482
705
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumbericEditControlComponent, decorators: [{
|
|
483
706
|
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
|
|
707
|
+
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']\" [min]=\"formConfiguration['NumericEditField.Min']\" [max]=\"formConfiguration['NumericEditField.Max']\" (input)=\"inputchange($event)\" />\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>" }]
|
|
485
708
|
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }], propDecorators: { fields: [{
|
|
486
709
|
type: Input
|
|
487
710
|
}], parentFiledName: [{
|
|
@@ -522,6 +745,7 @@ class DateEditConfig {
|
|
|
522
745
|
}
|
|
523
746
|
}
|
|
524
747
|
|
|
748
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
525
749
|
class DateEditConfigComponent {
|
|
526
750
|
constructor(fb) {
|
|
527
751
|
this.fb = fb;
|
|
@@ -537,22 +761,22 @@ class DateEditConfigComponent {
|
|
|
537
761
|
this._selected = v;
|
|
538
762
|
}
|
|
539
763
|
set Entity(v) {
|
|
540
|
-
this.
|
|
764
|
+
this.formEntity = v;
|
|
541
765
|
this.dataLoaded();
|
|
542
766
|
}
|
|
543
767
|
get formConfiguration() {
|
|
544
|
-
return this.
|
|
768
|
+
return this.formEntity.get('formConfiguration');
|
|
545
769
|
}
|
|
546
770
|
async dataLoaded() {
|
|
547
|
-
if (this.
|
|
771
|
+
if (this.formEntity && this._type) {
|
|
548
772
|
await this.AfterInit();
|
|
549
|
-
this.cdr.detectChanges(); // 手动触发变更检测
|
|
550
|
-
this.submitclick?.nativeElement?.click();
|
|
551
773
|
}
|
|
552
774
|
}
|
|
553
775
|
AfterInit() {
|
|
554
776
|
return new Promise((resolve, rejects) => {
|
|
555
|
-
this.
|
|
777
|
+
this.formEntity.setControl('formConfiguration', this.fb.group(new DateEditConfig()));
|
|
778
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
779
|
+
this.submitclick?.nativeElement?.click();
|
|
556
780
|
if (this._selected && this._selected.formControlName == this._type) {
|
|
557
781
|
this.formConfiguration.patchValue({
|
|
558
782
|
...this._selected.formConfiguration,
|
|
@@ -564,7 +788,7 @@ class DateEditConfigComponent {
|
|
|
564
788
|
}
|
|
565
789
|
/**切换时间类型 */
|
|
566
790
|
timeTypeChange() {
|
|
567
|
-
|
|
791
|
+
const type = this.formConfiguration.value['DateEdit.InputMode'];
|
|
568
792
|
let Min = this.formConfiguration.value['DateEdit.Min'];
|
|
569
793
|
let Max = this.formConfiguration.value['DateEdit.Max'];
|
|
570
794
|
if (type == DateEditInterfaces.Date) {
|
|
@@ -588,11 +812,11 @@ class DateEditConfigComponent {
|
|
|
588
812
|
});
|
|
589
813
|
}
|
|
590
814
|
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]=\"
|
|
815
|
+
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]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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 {{'AbpDynamicForm::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 {{'AbpDynamicForm::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 {{'AbpDynamicForm::Month' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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
816
|
}
|
|
593
817
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditConfigComponent, decorators: [{
|
|
594
818
|
type: Component,
|
|
595
|
-
args: [{ selector: 'df-date-edit-config', template: "<form [formGroup]=\"
|
|
819
|
+
args: [{ selector: 'df-date-edit-config', template: "<form [formGroup]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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 {{'AbpDynamicForm::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 {{'AbpDynamicForm::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 {{'AbpDynamicForm::Month' | abpLocalization}}\n </label>\n </div>\n </div>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\">{{'AbpDynamicForm::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
820
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { type: [{
|
|
597
821
|
type: Input
|
|
598
822
|
}], selected: [{
|
|
@@ -604,6 +828,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
604
828
|
args: ['submitclick', { static: true }]
|
|
605
829
|
}] } });
|
|
606
830
|
|
|
831
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
607
832
|
class DateEditControlComponent {
|
|
608
833
|
constructor(fb, cdr) {
|
|
609
834
|
this.fb = fb;
|
|
@@ -645,8 +870,8 @@ class DateEditControlComponent {
|
|
|
645
870
|
}
|
|
646
871
|
AfterInit() {
|
|
647
872
|
return new Promise((resolve, rejects) => {
|
|
648
|
-
|
|
649
|
-
|
|
873
|
+
const ValidatorsArray = [];
|
|
874
|
+
const formConfiguration = this._fields.field.formConfiguration;
|
|
650
875
|
if (this._fields.required) {
|
|
651
876
|
ValidatorsArray.push(Validators.required);
|
|
652
877
|
}
|
|
@@ -666,7 +891,7 @@ class DateEditControlComponent {
|
|
|
666
891
|
if (this._fields.field.formConfiguration['DateEdit.InputMode'] === DateEditInterfaces.Month) {
|
|
667
892
|
controlName = this._dataPipe.transform(this._selected, 'yyyy-MM');
|
|
668
893
|
}
|
|
669
|
-
|
|
894
|
+
const newControl = this.fb.control(controlName, ValidatorsArray);
|
|
670
895
|
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
671
896
|
resolve(true);
|
|
672
897
|
});
|
|
@@ -677,11 +902,11 @@ class DateEditControlComponent {
|
|
|
677
902
|
this.extraProperties.removeControl(this._fields.field.name);
|
|
678
903
|
}
|
|
679
904
|
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\"
|
|
905
|
+
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\" #dateTime (focus)=\"dateTime.focus()\" 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
906
|
}
|
|
682
907
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditControlComponent, decorators: [{
|
|
683
908
|
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\"
|
|
909
|
+
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\" #dateTime (focus)=\"dateTime.focus()\" 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
910
|
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: i0.ChangeDetectorRef }], propDecorators: { fields: [{
|
|
686
911
|
type: Input
|
|
687
912
|
}], parentFiledName: [{
|
|
@@ -695,94 +920,205 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
695
920
|
args: ['submitclick', { static: true }]
|
|
696
921
|
}] } });
|
|
697
922
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
923
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
924
|
+
class DateEditViewComponent {
|
|
925
|
+
constructor() {
|
|
926
|
+
/**展示则内容 */
|
|
927
|
+
this.showValue = '';
|
|
928
|
+
/**是否显示再列表 */
|
|
929
|
+
this.showInList = false;
|
|
930
|
+
/**表单控件Value */
|
|
931
|
+
this._value = '';
|
|
932
|
+
}
|
|
933
|
+
set value(v) {
|
|
934
|
+
this._value = v;
|
|
935
|
+
}
|
|
936
|
+
async ngAfterContentInit() {
|
|
937
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
938
|
+
//Add 'implements AfterContentInit' to the class.
|
|
939
|
+
const valueOptions = this._value;
|
|
940
|
+
if (this.type && valueOptions) {
|
|
941
|
+
this.showValue = valueOptions;
|
|
712
942
|
}
|
|
713
943
|
}
|
|
944
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
945
|
+
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" }] }); }
|
|
714
946
|
}
|
|
947
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DateEditViewComponent, decorators: [{
|
|
948
|
+
type: Component,
|
|
949
|
+
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}" }]
|
|
950
|
+
}], propDecorators: { showInList: [{
|
|
951
|
+
type: Input
|
|
952
|
+
}], fields: [{
|
|
953
|
+
type: Input
|
|
954
|
+
}], type: [{
|
|
955
|
+
type: Input
|
|
956
|
+
}], value: [{
|
|
957
|
+
type: Input
|
|
958
|
+
}] } });
|
|
715
959
|
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
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);
|
|
960
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
961
|
+
class NumericEditSearchComponent {
|
|
962
|
+
constructor(fb) {
|
|
963
|
+
this.fb = fb;
|
|
964
|
+
/**字段配置列表 */
|
|
965
|
+
this._fields = '';
|
|
966
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
967
|
+
/**定义number表单用于获取最小值最大值 */
|
|
968
|
+
this.numberForm = new FormGroup({
|
|
969
|
+
min: new FormControl(''),
|
|
970
|
+
max: new FormControl(''),
|
|
744
971
|
});
|
|
745
|
-
|
|
746
|
-
return pinyinstr || val;
|
|
972
|
+
this.formConfiguration = '';
|
|
747
973
|
}
|
|
748
|
-
|
|
749
|
-
|
|
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
|
-
});
|
|
974
|
+
set fields(v) {
|
|
975
|
+
this._fields = v;
|
|
758
976
|
}
|
|
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;
|
|
977
|
+
set parentFiledName(v) {
|
|
978
|
+
this._parentFiledName = v;
|
|
784
979
|
}
|
|
785
|
-
|
|
980
|
+
set selected(v) {
|
|
981
|
+
this._selected = v;
|
|
982
|
+
}
|
|
983
|
+
set entity(v) {
|
|
984
|
+
this._entity = v;
|
|
985
|
+
this.dataLoaded();
|
|
986
|
+
}
|
|
987
|
+
get extraProperties() {
|
|
988
|
+
return this._entity?.get('extraProperties');
|
|
989
|
+
}
|
|
990
|
+
/**数据加载完成 */
|
|
991
|
+
async dataLoaded() {
|
|
992
|
+
if (this._fields && this._entity) {
|
|
993
|
+
await this.AfterInit();
|
|
994
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
995
|
+
this.submitclick?.nativeElement?.click();
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
/**定义动态字符 */
|
|
999
|
+
get numberInput() {
|
|
1000
|
+
return this.extraProperties.get(this._fields.field.name);
|
|
1001
|
+
}
|
|
1002
|
+
get minInput() {
|
|
1003
|
+
return this.numberForm.get('min');
|
|
1004
|
+
}
|
|
1005
|
+
get maxInput() {
|
|
1006
|
+
return this.numberForm.get('max');
|
|
1007
|
+
}
|
|
1008
|
+
AfterInit() {
|
|
1009
|
+
return new Promise(resolve => {
|
|
1010
|
+
const ValidatorsArray = [];
|
|
1011
|
+
this.formConfiguration = this._fields.field.formConfiguration;
|
|
1012
|
+
const newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
1013
|
+
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
1014
|
+
this.numberForm.valueChanges.subscribe(res => {
|
|
1015
|
+
if (res.min < Number(this.formConfiguration['NumericEditField.Min'])) {
|
|
1016
|
+
this.minInput.patchValue(this.formConfiguration['NumericEditField.Min']);
|
|
1017
|
+
}
|
|
1018
|
+
if (res.min > Number(this.formConfiguration['NumericEditField.Max'])) {
|
|
1019
|
+
this.minInput.patchValue(this.formConfiguration['NumericEditField.Max']);
|
|
1020
|
+
}
|
|
1021
|
+
if ((res.min > res.max) && res.max) {
|
|
1022
|
+
this.minInput.patchValue(res.max);
|
|
1023
|
+
}
|
|
1024
|
+
if (res.max > Number(this.formConfiguration['NumericEditField.Max'])) {
|
|
1025
|
+
this.maxInput.patchValue(this.formConfiguration['NumericEditField.Max']);
|
|
1026
|
+
}
|
|
1027
|
+
if (this.numberForm.valid && res.min && res.max) {
|
|
1028
|
+
this.numberInput.patchValue(`${res.min}-${res.max}`);
|
|
1029
|
+
}
|
|
1030
|
+
else {
|
|
1031
|
+
this.numberInput.patchValue('');
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
resolve(true);
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
ngOnDestroy() {
|
|
1038
|
+
//Called once, before the instance is destroyed.
|
|
1039
|
+
//Add 'implements OnDestroy' to the class.
|
|
1040
|
+
this.extraProperties.removeControl(this._fields.field.name);
|
|
1041
|
+
}
|
|
1042
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditSearchComponent, deps: [{ token: i1.FormBuilder }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1043
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: NumericEditSearchComponent, selector: "df-numeric-edit-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]=\"numberForm\">\r\n <div class=\"selectcontrol\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <div class=\"input-group\" >\r\n <input class=\"form-control\" type=\"number\" formControlName=\"min\">\r\n <span class=\"input-group-text px-1\">-</span>\r\n <input class=\"form-control\" type=\"number\" formControlName=\"max\">\r\n </div>\r\n </div>\r\n\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.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: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i3.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }] }); }
|
|
1044
|
+
}
|
|
1045
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditSearchComponent, decorators: [{
|
|
1046
|
+
type: Component,
|
|
1047
|
+
args: [{ selector: 'df-numeric-edit-search', template: "<form [formGroup]=\"numberForm\">\r\n <div class=\"selectcontrol\">\r\n <div class=\"mb-3\">\r\n <label class=\"form-label\" *ngIf=\"_fields.displayName\">{{ _fields.displayName }}</label>\r\n <div class=\"input-group\" >\r\n <input class=\"form-control\" type=\"number\" formControlName=\"min\">\r\n <span class=\"input-group-text px-1\">-</span>\r\n <input class=\"form-control\" type=\"number\" formControlName=\"max\">\r\n </div>\r\n </div>\r\n\r\n </div>\r\n <button type=\"submit\" style=\"display: none;\" #submitclick></button>\r\n</form>" }]
|
|
1048
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { fields: [{
|
|
1049
|
+
type: Input
|
|
1050
|
+
}], parentFiledName: [{
|
|
1051
|
+
type: Input
|
|
1052
|
+
}], selected: [{
|
|
1053
|
+
type: Input
|
|
1054
|
+
}], entity: [{
|
|
1055
|
+
type: Input
|
|
1056
|
+
}], submitclick: [{
|
|
1057
|
+
type: ViewChild,
|
|
1058
|
+
args: ['submitclick', { static: true }]
|
|
1059
|
+
}] } });
|
|
1060
|
+
|
|
1061
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1062
|
+
class NumericEditViewComponent {
|
|
1063
|
+
constructor() {
|
|
1064
|
+
/**展示则内容 */
|
|
1065
|
+
this.showValue = '';
|
|
1066
|
+
/**是否显示再列表 */
|
|
1067
|
+
this.showInList = false;
|
|
1068
|
+
/**表单控件Value */
|
|
1069
|
+
this._value = '';
|
|
1070
|
+
}
|
|
1071
|
+
set value(v) {
|
|
1072
|
+
this._value = v;
|
|
1073
|
+
}
|
|
1074
|
+
async ngAfterContentInit() {
|
|
1075
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1076
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1077
|
+
const valueOptions = this._value;
|
|
1078
|
+
if (this.type && valueOptions) {
|
|
1079
|
+
this.showValue = valueOptions;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1083
|
+
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"] }] }); }
|
|
1084
|
+
}
|
|
1085
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: NumericEditViewComponent, decorators: [{
|
|
1086
|
+
type: Component,
|
|
1087
|
+
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}" }]
|
|
1088
|
+
}], propDecorators: { showInList: [{
|
|
1089
|
+
type: Input
|
|
1090
|
+
}], fields: [{
|
|
1091
|
+
type: Input
|
|
1092
|
+
}], type: [{
|
|
1093
|
+
type: Input
|
|
1094
|
+
}], value: [{
|
|
1095
|
+
type: Input
|
|
1096
|
+
}] } });
|
|
1097
|
+
|
|
1098
|
+
class SelectConfig {
|
|
1099
|
+
constructor() {
|
|
1100
|
+
/**空值文本 */
|
|
1101
|
+
this['Select.NullText'] = [''];
|
|
1102
|
+
//多选
|
|
1103
|
+
this['Select.Multiple'] = [false];
|
|
1104
|
+
// 选项
|
|
1105
|
+
this['Select.Options'] = new FormArray([]);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
class DfApiService {
|
|
1110
|
+
/**获取图片的本地连接 */
|
|
1111
|
+
getImageLacolBase64Url(file) {
|
|
1112
|
+
return new Promise((resolve, rejects) => {
|
|
1113
|
+
const reader = new FileReader();
|
|
1114
|
+
reader.readAsDataURL(file);
|
|
1115
|
+
reader.onload = (e) => {
|
|
1116
|
+
resolve(e.target.result);
|
|
1117
|
+
};
|
|
1118
|
+
reader.onerror = error => rejects(error);
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DfApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
786
1122
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DfApiService, providedIn: 'root' }); }
|
|
787
1123
|
}
|
|
788
1124
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DfApiService, decorators: [{
|
|
@@ -790,8 +1126,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
790
1126
|
args: [{
|
|
791
1127
|
providedIn: 'root'
|
|
792
1128
|
}]
|
|
793
|
-
}]
|
|
1129
|
+
}] });
|
|
794
1130
|
|
|
1131
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
795
1132
|
class SelectConfigComponent {
|
|
796
1133
|
constructor(fb, _DfApiService) {
|
|
797
1134
|
this.fb = fb;
|
|
@@ -805,20 +1142,18 @@ class SelectConfigComponent {
|
|
|
805
1142
|
this._selected = v;
|
|
806
1143
|
}
|
|
807
1144
|
set Entity(v) {
|
|
808
|
-
this.
|
|
1145
|
+
this.formEntity = v;
|
|
809
1146
|
this.dataLoaded();
|
|
810
1147
|
}
|
|
811
1148
|
get formConfiguration() {
|
|
812
|
-
return this.
|
|
1149
|
+
return this.formEntity?.get('formConfiguration');
|
|
813
1150
|
}
|
|
814
1151
|
get SelectOptions() {
|
|
815
1152
|
return this.formConfiguration.controls['Select.Options'];
|
|
816
1153
|
}
|
|
817
1154
|
async dataLoaded() {
|
|
818
|
-
if (this.
|
|
1155
|
+
if (this.formEntity && this._type) {
|
|
819
1156
|
await this.AfterInit();
|
|
820
|
-
this.cdr.detectChanges(); // 手动触发变更检测
|
|
821
|
-
this.submitclick?.nativeElement?.click();
|
|
822
1157
|
}
|
|
823
1158
|
}
|
|
824
1159
|
/**增加选项 */
|
|
@@ -835,11 +1170,18 @@ class SelectConfigComponent {
|
|
|
835
1170
|
}
|
|
836
1171
|
AfterInit() {
|
|
837
1172
|
return new Promise((resolve, rejects) => {
|
|
838
|
-
this.
|
|
1173
|
+
this.formEntity?.setControl('formConfiguration', this.fb.group(new SelectConfig()));
|
|
1174
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
1175
|
+
this.submitclick?.nativeElement?.click();
|
|
839
1176
|
if (this._selected && this._selected.formControlName == this._type) {
|
|
840
|
-
this._selected.formConfiguration['Select.Options']
|
|
1177
|
+
for (const element of this._selected.formConfiguration['Select.Options']) {
|
|
1178
|
+
for (const key in element) {
|
|
1179
|
+
const item = element[key];
|
|
1180
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1181
|
+
element[capitalizedKey] = item;
|
|
1182
|
+
}
|
|
841
1183
|
this.addSelectOptions();
|
|
842
|
-
}
|
|
1184
|
+
}
|
|
843
1185
|
this.formConfiguration.patchValue({
|
|
844
1186
|
...this._selected.formConfiguration,
|
|
845
1187
|
});
|
|
@@ -850,21 +1192,32 @@ class SelectConfigComponent {
|
|
|
850
1192
|
resolve(true);
|
|
851
1193
|
});
|
|
852
1194
|
}
|
|
1195
|
+
/**
|
|
1196
|
+
* 当选择项的文本发生变化时,更新对应的值
|
|
1197
|
+
* @param event 输入事件对象
|
|
1198
|
+
* @param index 选择项的索引位置
|
|
1199
|
+
* @description 如果选择项已有Value值则不处理,否则将中文文本转换为拼音作为Value值
|
|
1200
|
+
*/
|
|
853
1201
|
textChange(event, index) {
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
if (SelectOptionsItem.get('Value')
|
|
1202
|
+
const SelectOptionsItem = this.SelectOptions.at(index);
|
|
1203
|
+
const value = event.target.value;
|
|
1204
|
+
if (SelectOptionsItem.get('Value')?.value)
|
|
857
1205
|
return;
|
|
858
1206
|
SelectOptionsItem.patchValue({
|
|
859
|
-
Value:
|
|
1207
|
+
Value: structuredClone(value),
|
|
860
1208
|
});
|
|
861
1209
|
}
|
|
1210
|
+
/**调整表格位置 */
|
|
1211
|
+
drop(event) {
|
|
1212
|
+
moveItemInArray(this.SelectOptions.controls, event.previousIndex, event.currentIndex);
|
|
1213
|
+
this.SelectOptions.updateValueAndValidity();
|
|
1214
|
+
}
|
|
862
1215
|
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]=\"
|
|
1216
|
+
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]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::SelectListItem' | abpLocalization}}</label>\n <table class=\"table drag-table\" cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <thead>\n <tr>\n <th scope=\"col\"></th>\n <th scope=\"col\">{{'AbpDynamicForm::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'AbpDynamicForm::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'AbpDynamicForm::Selected' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" type=\"button\" (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\" cdkDrag cdkDragLockAxis=\"y\" [cdkDragData]=\"item\">\n <td>\n <div class=\"drag-handle\" cdkDragHandle>\n <span class=\"bi bi-arrows-move fs-5\"></span>\n </div>\n </td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" required\n (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" required formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\"\n id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" type=\"button\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\" id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'AbpDynamicForm::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: i1.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { 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: "directive", type: i6.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i6.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i6.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "pipe", type: i2.LocalizationPipe, name: "abpLocalization" }] }); }
|
|
864
1217
|
}
|
|
865
1218
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectConfigComponent, decorators: [{
|
|
866
1219
|
type: Component,
|
|
867
|
-
args: [{ selector: 'df-select-config', template: "<form [formGroup]=\"
|
|
1220
|
+
args: [{ selector: 'df-select-config', template: "<form [formGroup]=\"formEntity\">\n <div formGroupName=\"formConfiguration\">\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::SelectListItem' | abpLocalization}}</label>\n <table class=\"table drag-table\" cdkDropList (cdkDropListDropped)=\"drop($event)\">\n <thead>\n <tr>\n <th scope=\"col\"></th>\n <th scope=\"col\">{{'AbpDynamicForm::SelectListItemText' | abpLocalization}}</th>\n <th scope=\"col\">{{'AbpDynamicForm::SelectListItemValue' | abpLocalization}}</th>\n <th scope=\"col\">{{'AbpDynamicForm::Selected' | abpLocalization}}</th>\n <th scope=\"col\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" type=\"button\" (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\" cdkDrag cdkDragLockAxis=\"y\" [cdkDragData]=\"item\">\n <td>\n <div class=\"drag-handle\" cdkDragHandle>\n <span class=\"bi bi-arrows-move fs-5\"></span>\n </div>\n </td>\n <td><input type=\"text\" class=\"form-control\" formControlName=\"Text\" required\n (change)=\"textChange($event,i)\"></td>\n <td><input type=\"text\" class=\"form-control\" required formControlName=\"Value\"></td>\n <td>\n <div class=\"form-check form-check-inline\">\n <input class=\"form-check-input\" type=\"checkbox\" formControlName=\"Selected\"\n id=\"selected\">\n </div>\n </td>\n <td scope=\"row\" style=\"width: 1%;\">\n <button class=\"btn btn-light btn-sm\" type=\"button\" (click.stop)=\"deleteSelectOptions(i)\">\n <i class=\"fas fa-minus\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'AbpDynamicForm::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\" id=\"Multiple\">\n <label class=\"form-check-label\" for=\"Multiple\">\n {{'AbpDynamicForm::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
1221
|
}], ctorParameters: () => [{ type: i1.FormBuilder }, { type: DfApiService }], propDecorators: { type: [{
|
|
869
1222
|
type: Input
|
|
870
1223
|
}], selected: [{
|
|
@@ -876,11 +1229,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
876
1229
|
args: ['submitclick', { static: true }]
|
|
877
1230
|
}] } });
|
|
878
1231
|
|
|
1232
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
879
1233
|
class SelectControlComponent {
|
|
880
1234
|
constructor(fb) {
|
|
881
1235
|
this.fb = fb;
|
|
882
1236
|
/**字段配置列表 */
|
|
883
1237
|
this._fields = '';
|
|
1238
|
+
/**父级字段名称,用于为表单设置控件赋值 */
|
|
1239
|
+
this._selected = [];
|
|
884
1240
|
this.cdr = inject(ChangeDetectorRef);
|
|
885
1241
|
this.formConfiguration = '';
|
|
886
1242
|
}
|
|
@@ -891,14 +1247,14 @@ class SelectControlComponent {
|
|
|
891
1247
|
this._parentFiledName = v;
|
|
892
1248
|
}
|
|
893
1249
|
set selected(v) {
|
|
894
|
-
this._selected = v;
|
|
1250
|
+
this._selected = v || [];
|
|
895
1251
|
}
|
|
896
1252
|
set entity(v) {
|
|
897
1253
|
this._entity = v;
|
|
898
1254
|
this.dataLoaded();
|
|
899
1255
|
}
|
|
900
1256
|
get extraProperties() {
|
|
901
|
-
return this._entity
|
|
1257
|
+
return this._entity?.get('extraProperties');
|
|
902
1258
|
}
|
|
903
1259
|
/**数据加载完成 */
|
|
904
1260
|
async dataLoaded() {
|
|
@@ -910,24 +1266,28 @@ class SelectControlComponent {
|
|
|
910
1266
|
}
|
|
911
1267
|
AfterInit() {
|
|
912
1268
|
return new Promise((resolve, rejects) => {
|
|
913
|
-
|
|
1269
|
+
const ValidatorsArray = [];
|
|
914
1270
|
if (this._fields.required) {
|
|
915
1271
|
ValidatorsArray.push(Validators.required);
|
|
916
1272
|
}
|
|
917
1273
|
this.formConfiguration = this._fields.field.formConfiguration;
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1274
|
+
const isMultiple = this.formConfiguration['Select.Multiple'];
|
|
1275
|
+
let selectValue = isMultiple ? [] : [];
|
|
1276
|
+
for (const element of this.formConfiguration['Select.Options']) {
|
|
1277
|
+
for (const key in element) {
|
|
1278
|
+
const item = element[key];
|
|
1279
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1280
|
+
element[capitalizedKey] = item;
|
|
1281
|
+
}
|
|
1282
|
+
if (!this._selected) {
|
|
1283
|
+
if (Array.isArray(this._selected) && element.Selected && this._selected.length === 0) {
|
|
1284
|
+
selectValue = isMultiple ? [...selectValue, element.Value] : [element.Value];
|
|
1285
|
+
this._selected = selectValue;
|
|
926
1286
|
}
|
|
927
|
-
}
|
|
928
|
-
this._selected = selectValue;
|
|
1287
|
+
}
|
|
929
1288
|
}
|
|
930
|
-
|
|
1289
|
+
// this._selected = selectValue;
|
|
1290
|
+
const newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
931
1291
|
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
932
1292
|
resolve(true);
|
|
933
1293
|
});
|
|
@@ -938,11 +1298,11 @@ class SelectControlComponent {
|
|
|
938
1298
|
this.extraProperties.removeControl(this._fields.field.name);
|
|
939
1299
|
}
|
|
940
1300
|
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\"
|
|
1301
|
+
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 dignite-form-select\" [nzMaxTagCount]=\"1\"\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\n formControlName=\"{{_fields.field.name}}\" [nzDropdownMatchSelectWidth]=\"true\" [nzDropdownClassName]=\"'dignite-form-select-dropdown'\">\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: [""], 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
1302
|
}
|
|
943
1303
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectControlComponent, decorators: [{
|
|
944
1304
|
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\"
|
|
1305
|
+
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 dignite-form-select\" [nzMaxTagCount]=\"1\"\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\n formControlName=\"{{_fields.field.name}}\" [nzDropdownMatchSelectWidth]=\"true\" [nzDropdownClassName]=\"'dignite-form-select-dropdown'\">\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>" }]
|
|
946
1306
|
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { fields: [{
|
|
947
1307
|
type: Input
|
|
948
1308
|
}], parentFiledName: [{
|
|
@@ -956,6 +1316,135 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
956
1316
|
args: ['submitclick', { static: true }]
|
|
957
1317
|
}] } });
|
|
958
1318
|
|
|
1319
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1320
|
+
class SelectSearchComponent {
|
|
1321
|
+
constructor(fb) {
|
|
1322
|
+
this.fb = fb;
|
|
1323
|
+
/**字段配置列表 */
|
|
1324
|
+
this._fields = '';
|
|
1325
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
1326
|
+
this.formConfiguration = '';
|
|
1327
|
+
}
|
|
1328
|
+
set fields(v) {
|
|
1329
|
+
this._fields = v;
|
|
1330
|
+
}
|
|
1331
|
+
set parentFiledName(v) {
|
|
1332
|
+
this._parentFiledName = v;
|
|
1333
|
+
}
|
|
1334
|
+
set selected(v) {
|
|
1335
|
+
this._selected = v;
|
|
1336
|
+
}
|
|
1337
|
+
set entity(v) {
|
|
1338
|
+
this._entity = v;
|
|
1339
|
+
this.dataLoaded();
|
|
1340
|
+
}
|
|
1341
|
+
get extraProperties() {
|
|
1342
|
+
return this._entity?.get('extraProperties');
|
|
1343
|
+
}
|
|
1344
|
+
/**数据加载完成 */
|
|
1345
|
+
async dataLoaded() {
|
|
1346
|
+
if (this._fields && this._entity) {
|
|
1347
|
+
await this.AfterInit();
|
|
1348
|
+
this.cdr.detectChanges(); // 手动触发变更检测
|
|
1349
|
+
this.submitclick?.nativeElement?.click();
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
AfterInit() {
|
|
1353
|
+
return new Promise((resolve, rejects) => {
|
|
1354
|
+
const ValidatorsArray = [];
|
|
1355
|
+
this.formConfiguration = this._fields.field.formConfiguration;
|
|
1356
|
+
const isMultiple = this.formConfiguration['Select.Multiple'];
|
|
1357
|
+
const selectValue = isMultiple ? [] : [];
|
|
1358
|
+
for (const element of this.formConfiguration['Select.Options']) {
|
|
1359
|
+
for (const key in element) {
|
|
1360
|
+
const item = element[key];
|
|
1361
|
+
const capitalizedKey = key.charAt(0).toUpperCase() + key.slice(1);
|
|
1362
|
+
element[capitalizedKey] = item;
|
|
1363
|
+
}
|
|
1364
|
+
// if (this._selected) {
|
|
1365
|
+
// if (Array.isArray(this._selected) && element.Selected && this._selected.length === 0) {
|
|
1366
|
+
// selectValue = isMultiple ? [...selectValue, element.Value] : [element.Value];
|
|
1367
|
+
// }
|
|
1368
|
+
// }
|
|
1369
|
+
}
|
|
1370
|
+
this._selected = selectValue;
|
|
1371
|
+
const newControl = this.fb.control(this._selected, ValidatorsArray);
|
|
1372
|
+
this.extraProperties.setControl(this._fields.field.name, newControl);
|
|
1373
|
+
resolve(true);
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
changeValue(event) {
|
|
1377
|
+
const selectvalue = this.extraProperties.get(this._fields.field.name).value;
|
|
1378
|
+
if (selectvalue[0] === '') {
|
|
1379
|
+
this.extraProperties.get(this._fields.field.name).setValue([]);
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
ngOnDestroy() {
|
|
1383
|
+
//Called once, before the instance is destroyed.
|
|
1384
|
+
//Add 'implements OnDestroy' to the class.
|
|
1385
|
+
this.extraProperties.removeControl(this._fields.field.name);
|
|
1386
|
+
}
|
|
1387
|
+
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 }); }
|
|
1388
|
+
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 dignite-form-select\" [nzMaxTagCount]=\"1\"\r\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\r\n formControlName=\"{{_fields.field.name}}\" [nzDropdownMatchSelectWidth]=\"true\" [nzDropdownClassName]=\"'dignite-form-select-dropdown'\">\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: [""], 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"] }] }); }
|
|
1389
|
+
}
|
|
1390
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectSearchComponent, decorators: [{
|
|
1391
|
+
type: Component,
|
|
1392
|
+
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 dignite-form-select\" [nzMaxTagCount]=\"1\"\r\n nzShowSearch nzMode=\"multiple\" [nzPlaceHolder]=\"_fields.field.formConfiguration['Select.NullText']\"\r\n formControlName=\"{{_fields.field.name}}\" [nzDropdownMatchSelectWidth]=\"true\" [nzDropdownClassName]=\"'dignite-form-select-dropdown'\">\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>" }]
|
|
1393
|
+
}], ctorParameters: () => [{ type: i1.FormBuilder }], propDecorators: { fields: [{
|
|
1394
|
+
type: Input
|
|
1395
|
+
}], parentFiledName: [{
|
|
1396
|
+
type: Input
|
|
1397
|
+
}], selected: [{
|
|
1398
|
+
type: Input
|
|
1399
|
+
}], entity: [{
|
|
1400
|
+
type: Input
|
|
1401
|
+
}], submitclick: [{
|
|
1402
|
+
type: ViewChild,
|
|
1403
|
+
args: ['submitclick', { static: true }]
|
|
1404
|
+
}] } });
|
|
1405
|
+
|
|
1406
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1407
|
+
class SelectViewComponent {
|
|
1408
|
+
constructor() {
|
|
1409
|
+
/**展示则内容 */
|
|
1410
|
+
this.showValue = '';
|
|
1411
|
+
/**是否显示再列表 */
|
|
1412
|
+
this.showInList = false;
|
|
1413
|
+
/**表单控件Value */
|
|
1414
|
+
this._value = '';
|
|
1415
|
+
}
|
|
1416
|
+
set value(v) {
|
|
1417
|
+
this._value = v;
|
|
1418
|
+
}
|
|
1419
|
+
async ngAfterContentInit() {
|
|
1420
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1421
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1422
|
+
const valueOptions = this._value;
|
|
1423
|
+
if (this.type && valueOptions) {
|
|
1424
|
+
if (Array.isArray(valueOptions)) {
|
|
1425
|
+
this.showValue = valueOptions.join(',');
|
|
1426
|
+
}
|
|
1427
|
+
else {
|
|
1428
|
+
this.showValue = valueOptions;
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
}
|
|
1432
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectViewComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1433
|
+
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"] }] }); }
|
|
1434
|
+
}
|
|
1435
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: SelectViewComponent, decorators: [{
|
|
1436
|
+
type: Component,
|
|
1437
|
+
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}" }]
|
|
1438
|
+
}], propDecorators: { showInList: [{
|
|
1439
|
+
type: Input
|
|
1440
|
+
}], fields: [{
|
|
1441
|
+
type: Input
|
|
1442
|
+
}], type: [{
|
|
1443
|
+
type: Input
|
|
1444
|
+
}], value: [{
|
|
1445
|
+
type: Input
|
|
1446
|
+
}] } });
|
|
1447
|
+
|
|
959
1448
|
// import { CkEditorConfigComponent, CkEditorControlComponent } from "./ck-editor";
|
|
960
1449
|
/**
|
|
961
1450
|
* 表单控件分组-包含配置,控件,显示的数组
|
|
@@ -966,40 +1455,44 @@ const FieldControlGroup = [
|
|
|
966
1455
|
name: 'TextEdit',
|
|
967
1456
|
fieldConfigComponent: TextEditConfigComponent,
|
|
968
1457
|
fieldComponent: TextEditComponent,
|
|
969
|
-
|
|
1458
|
+
fieldViewComponent: TextEditViewComponent,
|
|
1459
|
+
fieldSearchComponent: TextEditSearchComponent,
|
|
970
1460
|
},
|
|
971
1461
|
{
|
|
972
1462
|
displayName: '开关',
|
|
973
1463
|
name: 'Switch',
|
|
974
1464
|
fieldConfigComponent: SwitchConfigComponent,
|
|
975
1465
|
fieldComponent: SwitchControlComponent,
|
|
976
|
-
|
|
1466
|
+
fieldViewComponent: SwitchViewComponent,
|
|
1467
|
+
fieldSearchComponent: SwitchSearchComponent,
|
|
977
1468
|
},
|
|
978
1469
|
{
|
|
979
1470
|
displayName: '选择',
|
|
980
1471
|
name: 'Select',
|
|
981
1472
|
fieldConfigComponent: SelectConfigComponent,
|
|
982
1473
|
fieldComponent: SelectControlComponent,
|
|
983
|
-
|
|
1474
|
+
fieldViewComponent: SelectViewComponent,
|
|
1475
|
+
fieldSearchComponent: SelectSearchComponent,
|
|
984
1476
|
},
|
|
985
1477
|
{
|
|
986
1478
|
displayName: '数字',
|
|
987
1479
|
name: 'NumericEdit',
|
|
988
1480
|
fieldConfigComponent: NumbericEditConfigComponent,
|
|
989
1481
|
fieldComponent: NumbericEditControlComponent,
|
|
990
|
-
|
|
1482
|
+
fieldViewComponent: NumericEditViewComponent,
|
|
1483
|
+
fieldSearchComponent: NumericEditSearchComponent,
|
|
991
1484
|
},
|
|
992
1485
|
{
|
|
993
1486
|
displayName: '日期',
|
|
994
1487
|
name: 'DateEdit',
|
|
995
1488
|
fieldConfigComponent: DateEditConfigComponent,
|
|
996
1489
|
fieldComponent: DateEditControlComponent,
|
|
997
|
-
|
|
1490
|
+
fieldViewComponent: DateEditViewComponent,
|
|
998
1491
|
},
|
|
999
1492
|
];
|
|
1000
|
-
function
|
|
1493
|
+
function addFieldControlGroup(array = []) {
|
|
1001
1494
|
for (const element of array) {
|
|
1002
|
-
|
|
1495
|
+
const find = FieldControlGroup.find((control) => {
|
|
1003
1496
|
return control.name === element.name;
|
|
1004
1497
|
});
|
|
1005
1498
|
if (!find) {
|
|
@@ -1009,6 +1502,12 @@ function AddFieldControlGroup(array = []) {
|
|
|
1009
1502
|
return FieldControlGroup;
|
|
1010
1503
|
}
|
|
1011
1504
|
|
|
1505
|
+
/* eslint-disable no-unsafe-optional-chaining */
|
|
1506
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1507
|
+
/**
|
|
1508
|
+
* 丢弃
|
|
1509
|
+
* @deprecated
|
|
1510
|
+
*/
|
|
1012
1511
|
class DynamicComponent {
|
|
1013
1512
|
set selected(v) {
|
|
1014
1513
|
this._selected = v === undefined ? '' : v === null ? '' : v;
|
|
@@ -1040,16 +1539,16 @@ class DynamicComponent {
|
|
|
1040
1539
|
}
|
|
1041
1540
|
/**数据加载完成 */
|
|
1042
1541
|
async dataLoaded(val) {
|
|
1043
|
-
|
|
1542
|
+
const _fieldControlGroup = addFieldControlGroup(this.mergedConfig);
|
|
1044
1543
|
if (this._entity) {
|
|
1045
1544
|
//加载所有的动态表单组件
|
|
1046
1545
|
if (this._type) {
|
|
1047
|
-
|
|
1546
|
+
const fieldControlItem = _fieldControlGroup.find(el => el.name === this._type);
|
|
1048
1547
|
this.loadfieldConfigComponent(fieldControlItem);
|
|
1049
1548
|
}
|
|
1050
1549
|
if (this._fields && this._parentFiledName && this._culture) {
|
|
1051
1550
|
/**表单控件组中的项 */
|
|
1052
|
-
|
|
1551
|
+
const fieldControlItem = _fieldControlGroup.find(el => el.name === this._fields?.field?.formControlName);
|
|
1053
1552
|
this.loadfieldComponent(fieldControlItem);
|
|
1054
1553
|
}
|
|
1055
1554
|
}
|
|
@@ -1084,11 +1583,11 @@ class DynamicComponent {
|
|
|
1084
1583
|
instance.entity = this._entity;
|
|
1085
1584
|
}
|
|
1086
1585
|
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 }); }
|
|
1087
|
-
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
|
|
1586
|
+
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: "\n<div [formGroup]=\"_entity\">\n <template #FormControlRef></template>\n <template #FormComponentsRef></template>\n</div>\n\n", styles: [""], dependencies: [{ 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: i3.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }] }); }
|
|
1088
1587
|
}
|
|
1089
1588
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicComponent, decorators: [{
|
|
1090
1589
|
type: Component,
|
|
1091
|
-
args: [{ selector: 'df-dynamic', template: "<template #FormControlRef></template>\n<template #FormComponentsRef></template
|
|
1590
|
+
args: [{ selector: 'df-dynamic', template: "\n<div [formGroup]=\"_entity\">\n <template #FormControlRef></template>\n <template #FormComponentsRef></template>\n</div>\n\n" }]
|
|
1092
1591
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1093
1592
|
type: Inject,
|
|
1094
1593
|
args: ['MERGED_FORM_CONFIG']
|
|
@@ -1112,6 +1611,304 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1112
1611
|
args: ['FormComponentsRef', { read: ViewContainerRef, static: true }]
|
|
1113
1612
|
}] } });
|
|
1114
1613
|
|
|
1614
|
+
/**
|
|
1615
|
+
* 表单控件服务
|
|
1616
|
+
* @description 用于获取表单所有控件的配置信息
|
|
1617
|
+
*/
|
|
1618
|
+
class FormControlService {
|
|
1619
|
+
constructor(mergedConfig) {
|
|
1620
|
+
this.mergedConfig = mergedConfig;
|
|
1621
|
+
this._FieldControlGroup = FieldControlGroup;
|
|
1622
|
+
}
|
|
1623
|
+
addFieldControlGroup() {
|
|
1624
|
+
const array = this.mergedConfig;
|
|
1625
|
+
for (const element of array) {
|
|
1626
|
+
const find = FieldControlGroup.find(control => {
|
|
1627
|
+
return control.name === element.name;
|
|
1628
|
+
});
|
|
1629
|
+
if (!find) {
|
|
1630
|
+
FieldControlGroup.push(element);
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
return FieldControlGroup;
|
|
1634
|
+
}
|
|
1635
|
+
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 }); }
|
|
1636
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: FormControlService, providedIn: 'root' }); }
|
|
1637
|
+
}
|
|
1638
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: FormControlService, decorators: [{
|
|
1639
|
+
type: Injectable,
|
|
1640
|
+
args: [{
|
|
1641
|
+
providedIn: 'root',
|
|
1642
|
+
}]
|
|
1643
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1644
|
+
type: Inject,
|
|
1645
|
+
args: ['MERGED_FORM_CONFIG']
|
|
1646
|
+
}] }] });
|
|
1647
|
+
|
|
1648
|
+
/* eslint-disable no-unsafe-optional-chaining */
|
|
1649
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1650
|
+
class DynamicViewComponent {
|
|
1651
|
+
constructor(_FormControlService) {
|
|
1652
|
+
this._FormControlService = _FormControlService;
|
|
1653
|
+
/**是否显示再列表 */
|
|
1654
|
+
this.showInList = false;
|
|
1655
|
+
/**表单控件Value */
|
|
1656
|
+
this._value = '';
|
|
1657
|
+
}
|
|
1658
|
+
set value(v) {
|
|
1659
|
+
this._value = v;
|
|
1660
|
+
// if(this._value) this.dataLoaded();
|
|
1661
|
+
}
|
|
1662
|
+
ngAfterContentInit() {
|
|
1663
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1664
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1665
|
+
if (this.type && this._value !== '') {
|
|
1666
|
+
const _fieldControlGroup = this._FormControlService.addFieldControlGroup();
|
|
1667
|
+
const fieldControlItem = _fieldControlGroup.find(el => el.name === this.type);
|
|
1668
|
+
this.loadViewComponent(fieldControlItem);
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
/**加载动态展示组件 */
|
|
1672
|
+
loadViewComponent(FieldControlItem) {
|
|
1673
|
+
//清空了容器中的所有组件
|
|
1674
|
+
this.FormTemplateRef?.clear();
|
|
1675
|
+
if (!FieldControlItem || !FieldControlItem.fieldViewComponent)
|
|
1676
|
+
return;
|
|
1677
|
+
//在容器中创建组件
|
|
1678
|
+
const { instance } = this.FormTemplateRef?.createComponent(FieldControlItem.fieldViewComponent); //创建组件模板
|
|
1679
|
+
/**向创建的组件模板中传值 */
|
|
1680
|
+
instance.type = this.type;
|
|
1681
|
+
instance.value = this._value;
|
|
1682
|
+
instance.fields = this.fields;
|
|
1683
|
+
instance.showInList = this.showInList;
|
|
1684
|
+
}
|
|
1685
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicViewComponent, deps: [{ token: FormControlService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1686
|
+
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: [""] }); }
|
|
1687
|
+
}
|
|
1688
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicViewComponent, decorators: [{
|
|
1689
|
+
type: Component,
|
|
1690
|
+
args: [{ selector: 'df-dynamic-view', template: "<template #FormTemplateRef></template>" }]
|
|
1691
|
+
}], ctorParameters: () => [{ type: FormControlService }], propDecorators: { showInList: [{
|
|
1692
|
+
type: Input
|
|
1693
|
+
}], fields: [{
|
|
1694
|
+
type: Input
|
|
1695
|
+
}], type: [{
|
|
1696
|
+
type: Input
|
|
1697
|
+
}], value: [{
|
|
1698
|
+
type: Input
|
|
1699
|
+
}], FormTemplateRef: [{
|
|
1700
|
+
type: ViewChild,
|
|
1701
|
+
args: ['FormTemplateRef', { read: ViewContainerRef, static: true }]
|
|
1702
|
+
}] } });
|
|
1703
|
+
|
|
1704
|
+
/* eslint-disable no-unsafe-optional-chaining */
|
|
1705
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1706
|
+
class DynamicConfigComponent {
|
|
1707
|
+
constructor(mergedConfig) {
|
|
1708
|
+
this.mergedConfig = mergedConfig;
|
|
1709
|
+
this.formControlName = '';
|
|
1710
|
+
}
|
|
1711
|
+
set type(v) {
|
|
1712
|
+
this.formControlName = v;
|
|
1713
|
+
}
|
|
1714
|
+
set form(v) {
|
|
1715
|
+
this.formEntity = v;
|
|
1716
|
+
}
|
|
1717
|
+
get formControlNameInput() {
|
|
1718
|
+
return this.formEntity.get('formControlName');
|
|
1719
|
+
}
|
|
1720
|
+
ngAfterContentInit() {
|
|
1721
|
+
this.loadfieldConfigComponent(this.formControlName);
|
|
1722
|
+
this.formControlNameInput?.valueChanges.subscribe((res) => {
|
|
1723
|
+
this.loadfieldConfigComponent(res);
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
/**加载动态表单配置组件 */
|
|
1727
|
+
loadfieldConfigComponent(formControlName) {
|
|
1728
|
+
const _fieldControlGroup = addFieldControlGroup(this.mergedConfig);
|
|
1729
|
+
const fieldControlItem = _fieldControlGroup.find(el => el.name === formControlName);
|
|
1730
|
+
//清空了容器中的所有组件
|
|
1731
|
+
this.FormconfigRef?.clear();
|
|
1732
|
+
if (!fieldControlItem || !fieldControlItem.fieldConfigComponent)
|
|
1733
|
+
return;
|
|
1734
|
+
//在容器中创建组件
|
|
1735
|
+
const { instance } = this.FormconfigRef?.createComponent(fieldControlItem.fieldConfigComponent); //创建组件模板
|
|
1736
|
+
// /**向创建的组件模板中传值 */
|
|
1737
|
+
instance.selected = this.selected;
|
|
1738
|
+
instance.type = formControlName;
|
|
1739
|
+
instance.Entity = this.formEntity;
|
|
1740
|
+
}
|
|
1741
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicConfigComponent, deps: [{ token: 'MERGED_FORM_CONFIG' }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1742
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicConfigComponent, selector: "df-dynamic-config", inputs: { type: "type", selected: "selected", form: "form" }, viewQueries: [{ propertyName: "FormconfigRef", first: true, predicate: ["FormconfigRef"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: " <template #FormconfigRef></template>", styles: [""] }); }
|
|
1743
|
+
}
|
|
1744
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicConfigComponent, decorators: [{
|
|
1745
|
+
type: Component,
|
|
1746
|
+
args: [{ selector: 'df-dynamic-config', template: " <template #FormconfigRef></template>" }]
|
|
1747
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1748
|
+
type: Inject,
|
|
1749
|
+
args: ['MERGED_FORM_CONFIG']
|
|
1750
|
+
}] }], propDecorators: { type: [{
|
|
1751
|
+
type: Input
|
|
1752
|
+
}], selected: [{
|
|
1753
|
+
type: Input
|
|
1754
|
+
}], form: [{
|
|
1755
|
+
type: Input
|
|
1756
|
+
}], FormconfigRef: [{
|
|
1757
|
+
type: ViewChild,
|
|
1758
|
+
args: ['FormconfigRef', { read: ViewContainerRef, static: true }]
|
|
1759
|
+
}] } });
|
|
1760
|
+
|
|
1761
|
+
/* eslint-disable no-unsafe-optional-chaining */
|
|
1762
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1763
|
+
class DynamicControlComponent {
|
|
1764
|
+
set selected(v) {
|
|
1765
|
+
this._selected = v === undefined ? '' : v === null ? '' : v;
|
|
1766
|
+
}
|
|
1767
|
+
set culture(v) {
|
|
1768
|
+
this._culture = v;
|
|
1769
|
+
}
|
|
1770
|
+
set parentFiledName(v) {
|
|
1771
|
+
this._parentFiledName = v;
|
|
1772
|
+
}
|
|
1773
|
+
set fields(v) {
|
|
1774
|
+
this._fields = v;
|
|
1775
|
+
}
|
|
1776
|
+
set entity(v) {
|
|
1777
|
+
if (v) {
|
|
1778
|
+
this._entity = v;
|
|
1779
|
+
// this.dataLoaded(3);
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
constructor(mergedConfig) {
|
|
1783
|
+
this.mergedConfig = mergedConfig;
|
|
1784
|
+
/**字段配置列表 */
|
|
1785
|
+
this._fields = '';
|
|
1786
|
+
}
|
|
1787
|
+
ngAfterContentInit() {
|
|
1788
|
+
this.loadfieldComponent(this._fields?.field?.formControlName);
|
|
1789
|
+
}
|
|
1790
|
+
// /**数据加载完成 */
|
|
1791
|
+
// async dataLoaded() {
|
|
1792
|
+
// const _fieldControlGroup: any[] = addFieldControlGroup(this.mergedConfig);
|
|
1793
|
+
// if (this._entity) {
|
|
1794
|
+
// //加载所有的动态表单组件
|
|
1795
|
+
// if (this._fields && this._parentFiledName && this._culture) {
|
|
1796
|
+
// /**表单控件组中的项 */
|
|
1797
|
+
// const fieldControlItem = _fieldControlGroup.find(
|
|
1798
|
+
// el => el.name === this._fields?.field?.formControlName,
|
|
1799
|
+
// );
|
|
1800
|
+
// this.loadfieldComponent(fieldControlItem);
|
|
1801
|
+
// }
|
|
1802
|
+
// }
|
|
1803
|
+
// }
|
|
1804
|
+
/**加载动态表单组件 */
|
|
1805
|
+
loadfieldComponent(formControlName) {
|
|
1806
|
+
const _fieldControlGroup = addFieldControlGroup(this.mergedConfig);
|
|
1807
|
+
/**表单控件组中的项 */
|
|
1808
|
+
const fieldControlItem = _fieldControlGroup.find(el => el.name === formControlName);
|
|
1809
|
+
//清空了容器中的所有组件
|
|
1810
|
+
this.FormComponentsRef?.clear();
|
|
1811
|
+
if (!fieldControlItem || !fieldControlItem.fieldComponent)
|
|
1812
|
+
return;
|
|
1813
|
+
//在容器中创建组件
|
|
1814
|
+
const { instance } = this.FormComponentsRef?.createComponent(fieldControlItem.fieldComponent); //创建组件模板
|
|
1815
|
+
/**向创建的组件模板中传值 */
|
|
1816
|
+
instance.fields = this._fields;
|
|
1817
|
+
instance.parentFiledName = this._parentFiledName;
|
|
1818
|
+
instance.selected = this._selected;
|
|
1819
|
+
instance.culture = this._culture;
|
|
1820
|
+
instance.entity = this._entity;
|
|
1821
|
+
}
|
|
1822
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicControlComponent, deps: [{ token: 'MERGED_FORM_CONFIG' }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1823
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.1.5", type: DynamicControlComponent, selector: "df-dynamic-control", inputs: { selected: "selected", 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 #FormComponentsRef></template>", styles: [""] }); }
|
|
1824
|
+
}
|
|
1825
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicControlComponent, decorators: [{
|
|
1826
|
+
type: Component,
|
|
1827
|
+
args: [{ selector: 'df-dynamic-control', template: "<template #FormComponentsRef></template>" }]
|
|
1828
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
1829
|
+
type: Inject,
|
|
1830
|
+
args: ['MERGED_FORM_CONFIG']
|
|
1831
|
+
}] }], propDecorators: { selected: [{
|
|
1832
|
+
type: Input
|
|
1833
|
+
}], culture: [{
|
|
1834
|
+
type: Input
|
|
1835
|
+
}], parentFiledName: [{
|
|
1836
|
+
type: Input
|
|
1837
|
+
}], fields: [{
|
|
1838
|
+
type: Input
|
|
1839
|
+
}], entity: [{
|
|
1840
|
+
type: Input
|
|
1841
|
+
}], FormControlRef: [{
|
|
1842
|
+
type: ViewChild,
|
|
1843
|
+
args: ['FormControlRef', { read: ViewContainerRef, static: true }]
|
|
1844
|
+
}], FormComponentsRef: [{
|
|
1845
|
+
type: ViewChild,
|
|
1846
|
+
args: ['FormComponentsRef', { read: ViewContainerRef, static: true }]
|
|
1847
|
+
}] } });
|
|
1848
|
+
|
|
1849
|
+
/* eslint-disable @angular-eslint/component-selector */
|
|
1850
|
+
class DynamicSearchComponent {
|
|
1851
|
+
constructor(_FormControlService) {
|
|
1852
|
+
this._FormControlService = _FormControlService;
|
|
1853
|
+
/**字段配置列表 */
|
|
1854
|
+
this._fields = '';
|
|
1855
|
+
}
|
|
1856
|
+
set culture(v) {
|
|
1857
|
+
this._culture = v;
|
|
1858
|
+
}
|
|
1859
|
+
set parentFiledName(v) {
|
|
1860
|
+
this._parentFiledName = v;
|
|
1861
|
+
}
|
|
1862
|
+
set fields(v) {
|
|
1863
|
+
this._fields = v;
|
|
1864
|
+
}
|
|
1865
|
+
set entity(v) {
|
|
1866
|
+
if (v) {
|
|
1867
|
+
this._entity = v;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
ngAfterContentInit() {
|
|
1871
|
+
//Called after ngOnInit when the component's or directive's content has been initialized.
|
|
1872
|
+
//Add 'implements AfterContentInit' to the class.
|
|
1873
|
+
if (this._fields && this._entity && this._culture) {
|
|
1874
|
+
let _fieldControlGroup = this._FormControlService.addFieldControlGroup();
|
|
1875
|
+
let fieldControlItem = _fieldControlGroup.find(el => el.name === this._fields?.field?.formControlName);
|
|
1876
|
+
this.loadComponent(fieldControlItem);
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
/**加载动态展示组件 */
|
|
1880
|
+
loadComponent(FieldControlItem) {
|
|
1881
|
+
//清空了容器中的所有组件
|
|
1882
|
+
this.FormSearchTemplateRef?.clear();
|
|
1883
|
+
if (!FieldControlItem || !FieldControlItem.fieldSearchComponent)
|
|
1884
|
+
return;
|
|
1885
|
+
//在容器中创建组件
|
|
1886
|
+
const { instance } = this.FormSearchTemplateRef?.createComponent(FieldControlItem.fieldSearchComponent); //创建组件模板
|
|
1887
|
+
/**向创建的组件模板中传值 */
|
|
1888
|
+
instance.fields = this._fields;
|
|
1889
|
+
instance.parentFiledName = this._parentFiledName;
|
|
1890
|
+
instance.culture = this._culture;
|
|
1891
|
+
instance.entity = this._entity;
|
|
1892
|
+
}
|
|
1893
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicSearchComponent, deps: [{ token: FormControlService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1894
|
+
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: [""] }); }
|
|
1895
|
+
}
|
|
1896
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicSearchComponent, decorators: [{
|
|
1897
|
+
type: Component,
|
|
1898
|
+
args: [{ selector: 'df-dynamic-search', template: "<template #FormSearchTemplateRef></template>" }]
|
|
1899
|
+
}], ctorParameters: () => [{ type: FormControlService }], propDecorators: { culture: [{
|
|
1900
|
+
type: Input
|
|
1901
|
+
}], parentFiledName: [{
|
|
1902
|
+
type: Input
|
|
1903
|
+
}], fields: [{
|
|
1904
|
+
type: Input
|
|
1905
|
+
}], entity: [{
|
|
1906
|
+
type: Input
|
|
1907
|
+
}], FormSearchTemplateRef: [{
|
|
1908
|
+
type: ViewChild,
|
|
1909
|
+
args: ['FormSearchTemplateRef', { read: ViewContainerRef, static: true }]
|
|
1910
|
+
}] } });
|
|
1911
|
+
|
|
1115
1912
|
class DynamicFormModule {
|
|
1116
1913
|
static forRoot(config) {
|
|
1117
1914
|
return {
|
|
@@ -1130,26 +1927,60 @@ class DynamicFormModule {
|
|
|
1130
1927
|
DateEditControlComponent,
|
|
1131
1928
|
SelectConfigComponent,
|
|
1132
1929
|
SelectControlComponent,
|
|
1133
|
-
DynamicComponent
|
|
1930
|
+
DynamicComponent,
|
|
1931
|
+
DynamicConfigComponent,
|
|
1932
|
+
DynamicViewComponent,
|
|
1933
|
+
DynamicControlComponent,
|
|
1934
|
+
SelectViewComponent,
|
|
1935
|
+
SwitchViewComponent,
|
|
1936
|
+
TextEditViewComponent,
|
|
1937
|
+
DateEditViewComponent,
|
|
1938
|
+
NumericEditViewComponent,
|
|
1939
|
+
DynamicSearchComponent,
|
|
1940
|
+
SelectSearchComponent,
|
|
1941
|
+
TextEditSearchComponent,
|
|
1942
|
+
SwitchSearchComponent,
|
|
1943
|
+
NumericEditSearchComponent], imports: [FormsModule,
|
|
1134
1944
|
CoreModule,
|
|
1135
1945
|
ThemeSharedModule,
|
|
1136
1946
|
ReactiveFormsModule,
|
|
1137
|
-
NgbDropdownModule
|
|
1947
|
+
NgbDropdownModule,
|
|
1948
|
+
NzSelectModule,
|
|
1949
|
+
DragDropModule,
|
|
1950
|
+
NgbDatepickerModule,
|
|
1951
|
+
ExtensibleModule
|
|
1952
|
+
// NzTreeModule,
|
|
1953
|
+
], exports: [TextEditConfigComponent,
|
|
1138
1954
|
TextEditComponent,
|
|
1955
|
+
TextEditViewComponent,
|
|
1139
1956
|
SwitchConfigComponent,
|
|
1140
1957
|
SwitchControlComponent,
|
|
1958
|
+
SwitchViewComponent,
|
|
1141
1959
|
NumbericEditConfigComponent,
|
|
1142
1960
|
NumbericEditControlComponent,
|
|
1143
1961
|
DateEditConfigComponent,
|
|
1144
1962
|
DateEditControlComponent,
|
|
1963
|
+
DateEditViewComponent,
|
|
1145
1964
|
SelectConfigComponent,
|
|
1146
1965
|
SelectControlComponent,
|
|
1147
|
-
|
|
1966
|
+
SelectViewComponent,
|
|
1967
|
+
SelectSearchComponent,
|
|
1968
|
+
DynamicComponent,
|
|
1969
|
+
DynamicConfigComponent,
|
|
1970
|
+
DynamicViewComponent,
|
|
1971
|
+
DynamicControlComponent,
|
|
1972
|
+
DynamicSearchComponent] }); }
|
|
1148
1973
|
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicFormModule, imports: [FormsModule,
|
|
1149
1974
|
CoreModule,
|
|
1150
1975
|
ThemeSharedModule,
|
|
1151
1976
|
ReactiveFormsModule,
|
|
1152
|
-
NgbDropdownModule
|
|
1977
|
+
NgbDropdownModule,
|
|
1978
|
+
NzSelectModule,
|
|
1979
|
+
DragDropModule,
|
|
1980
|
+
NgbDatepickerModule,
|
|
1981
|
+
ExtensibleModule
|
|
1982
|
+
// NzTreeModule,
|
|
1983
|
+
] }); }
|
|
1153
1984
|
}
|
|
1154
1985
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImport: i0, type: DynamicFormModule, decorators: [{
|
|
1155
1986
|
type: NgModule,
|
|
@@ -1166,6 +1997,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1166
1997
|
SelectConfigComponent,
|
|
1167
1998
|
SelectControlComponent,
|
|
1168
1999
|
DynamicComponent,
|
|
2000
|
+
DynamicConfigComponent,
|
|
2001
|
+
DynamicViewComponent,
|
|
2002
|
+
DynamicControlComponent,
|
|
2003
|
+
SelectViewComponent,
|
|
2004
|
+
SwitchViewComponent,
|
|
2005
|
+
TextEditViewComponent,
|
|
2006
|
+
DateEditViewComponent,
|
|
2007
|
+
NumericEditViewComponent,
|
|
2008
|
+
DynamicSearchComponent,
|
|
2009
|
+
SelectSearchComponent,
|
|
2010
|
+
TextEditSearchComponent,
|
|
2011
|
+
SwitchSearchComponent,
|
|
2012
|
+
NumericEditSearchComponent,
|
|
1169
2013
|
],
|
|
1170
2014
|
imports: [
|
|
1171
2015
|
FormsModule,
|
|
@@ -1173,20 +2017,33 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1173
2017
|
ThemeSharedModule,
|
|
1174
2018
|
ReactiveFormsModule,
|
|
1175
2019
|
NgbDropdownModule,
|
|
2020
|
+
NzSelectModule,
|
|
2021
|
+
DragDropModule,
|
|
2022
|
+
NgbDatepickerModule,
|
|
2023
|
+
ExtensibleModule
|
|
1176
2024
|
// NzTreeModule,
|
|
1177
2025
|
],
|
|
1178
2026
|
exports: [
|
|
1179
2027
|
TextEditConfigComponent,
|
|
1180
2028
|
TextEditComponent,
|
|
2029
|
+
TextEditViewComponent,
|
|
1181
2030
|
SwitchConfigComponent,
|
|
1182
2031
|
SwitchControlComponent,
|
|
2032
|
+
SwitchViewComponent,
|
|
1183
2033
|
NumbericEditConfigComponent,
|
|
1184
2034
|
NumbericEditControlComponent,
|
|
1185
2035
|
DateEditConfigComponent,
|
|
1186
2036
|
DateEditControlComponent,
|
|
2037
|
+
DateEditViewComponent,
|
|
1187
2038
|
SelectConfigComponent,
|
|
1188
2039
|
SelectControlComponent,
|
|
2040
|
+
SelectViewComponent,
|
|
2041
|
+
SelectSearchComponent,
|
|
1189
2042
|
DynamicComponent,
|
|
2043
|
+
DynamicConfigComponent,
|
|
2044
|
+
DynamicViewComponent,
|
|
2045
|
+
DynamicControlComponent,
|
|
2046
|
+
DynamicSearchComponent
|
|
1190
2047
|
],
|
|
1191
2048
|
providers: [],
|
|
1192
2049
|
}]
|
|
@@ -1200,5 +2057,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.5", ngImpor
|
|
|
1200
2057
|
* Generated bundle index. Do not edit.
|
|
1201
2058
|
*/
|
|
1202
2059
|
|
|
1203
|
-
export {
|
|
2060
|
+
export { 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, addFieldControlGroup, maxDecimalPlacesValidator };
|
|
1204
2061
|
//# sourceMappingURL=dignite-ng-expand.dynamic-form.mjs.map
|