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