@dhccmobile/vue3-lo-form 1.1.41 → 2.0.0
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/.env.local.bak +6 -6
- package/.eslintrc.js +28 -28
- package/README.md +70 -62
- package/babel.config.js +3 -3
- package/dist/vue3-lo-form.common.js +7700 -107778
- package/dist/vue3-lo-form.common.js.map +1 -1
- package/dist/vue3-lo-form.css +1 -1
- package/dist/vue3-lo-form.umd.js +7773 -107851
- package/dist/vue3-lo-form.umd.js.map +1 -1
- package/dist/vue3-lo-form.umd.min.js +1 -56
- package/dist/vue3-lo-form.umd.min.js.map +1 -1
- package/package.json +65 -61
- package/public/index.html +17 -17
- package/public/js/pinyin.ts +101 -101
- package/src/App.vue +741 -741
- package/src/components/form/DvForm.vue +642 -642
- package/src/components/form/DvFormLayout.vue +1569 -1569
- package/src/components/form/StretchText.vue +90 -90
- package/src/components/index.ts +3 -3
- package/src/constants/config/form-template.config.ts +32 -32
- package/src/constants/config/form.config.ts +4 -4
- package/src/constants/config/storage.config.ts +4 -4
- package/src/constants/encode-assets/svg.ts +11 -11
- package/src/constants/enum/builtIn-label.enum.ts +5 -5
- package/src/constants/enum/cache-type.enum.ts +7 -7
- package/src/constants/enum/control-format-type.enum.ts +9 -9
- package/src/constants/enum/dynamic-option-type.enum.ts +6 -6
- package/src/constants/enum/form-bus-attr.enum.ts +8 -8
- package/src/constants/enum/form-field-class.enum.ts +7 -7
- package/src/constants/enum/form-field-type.enum.ts +25 -25
- package/src/constants/enum/form-type.enum.ts +5 -5
- package/src/constants/enum/index.ts +19 -19
- package/src/constants/enum/lateral-arrangement.enum.ts +9 -9
- package/src/constants/enum/money-unit.enum.ts +6 -6
- package/src/constants/enum/option-type.enum.ts +5 -5
- package/src/constants/enum/submitted-type.enum.ts +32 -31
- package/src/constants/enum/support-upload-type.enum.ts +5 -5
- package/src/constants/enum/switch.enum.ts +5 -5
- package/src/constants/enum/upload-type.enum.ts +17 -17
- package/src/constants/enum/validate-rules.enum.ts +25 -25
- package/src/constants/enum/validate-status.enum.ts +8 -8
- package/src/constants/enum/vertical-arrangement.enum.ts +7 -7
- package/src/constants/enum/zoom-type.ts +6 -6
- package/src/constants/index.ts +3 -3
- package/src/core/FormApi.ts +1238 -1238
- package/src/core/index.ts +1 -1
- package/src/domain/AbstractControl.ts +6 -6
- package/src/domain/Control.ts +14 -14
- package/src/domain/CustomFormat.ts +6 -6
- package/src/domain/DesForm.ts +48 -48
- package/src/domain/DesFormControl.ts +241 -241
- package/src/domain/DesFormLayout.ts +51 -51
- package/src/domain/FieldChangeHistory.ts +9 -9
- package/src/domain/FormConfig.ts +15 -15
- package/src/domain/FormControl.ts +125 -125
- package/src/domain/FormEnum.ts +9 -9
- package/src/domain/FormGroup.ts +42 -42
- package/src/domain/FormRestfulResponse.ts +6 -6
- package/src/domain/ProvideInjectData.ts +10 -10
- package/src/domain/SysDictDetail.ts +38 -38
- package/src/domain/SysDictInfo.ts +40 -40
- package/src/domain/SysDictTreeDetail.ts +52 -52
- package/src/domain/index.ts +12 -12
- package/src/filtres/amount-capitalization.filter.ts +154 -147
- package/src/filtres/extract-options.filter.ts +53 -53
- package/src/filtres/generate-grid-column-end.filter.ts +22 -22
- package/src/filtres/generate-grid-template-columns.filter.ts +24 -24
- package/src/filtres/switch-enum-convert.filter.ts +18 -18
- package/src/filtres/zoom-multiple.filter.ts +32 -32
- package/src/index.ts +73 -73
- package/src/main.ts +17 -17
- package/src/services/api.service.ts +73 -73
- package/src/services/clean-local-forage.service.ts +58 -58
- package/src/services/date-format.service.ts +74 -74
- package/src/services/dict-local-forage.service.ts +58 -58
- package/src/services/form-bean-utils.service.ts +41 -41
- package/src/services/form-local-forage.service.ts +59 -59
- package/src/services/form-tools.service.ts +739 -659
- package/src/services/form-tree-node-convert.service.ts +240 -240
- package/src/services/form-validate.service.ts +103 -103
- package/src/services/index.ts +9 -9
- package/src/services/router.service.ts +96 -96
- package/src/services/validate-generator.service.ts +710 -710
- package/src/shims-vue.d.ts +6 -6
- package/src/store/dict.store.ts +63 -63
- package/src/store/form.store.ts +32 -32
- package/src/store/index.ts +2 -2
- package/src/styles/datePicker.scss +125 -125
- package/src/styles/index.scss +195 -195
- package/src/styles/theme1.scss +277 -277
- package/src/styles/theme2.scss +376 -376
- package/src/styles/themes.scss +9 -9
- package/src/types/vfForm.ts +11 -11
- package/tsconfig.json +40 -40
- package/types/components/index.d.ts +3 -3
- package/types/constants/config/form-template.config.d.ts +30 -30
- package/types/constants/config/form.config.d.ts +4 -4
- package/types/constants/config/storage.config.d.ts +4 -4
- package/types/constants/encode-assets/svg.d.ts +5 -5
- package/types/constants/enum/builtIn-label.enum.d.ts +7 -7
- package/types/constants/enum/cache-type.enum.d.ts +15 -15
- package/types/constants/enum/control-format-type.enum.d.ts +23 -23
- package/types/constants/enum/dynamic-option-type.enum.d.ts +11 -11
- package/types/constants/enum/form-bus-attr.enum.d.ts +19 -19
- package/types/constants/enum/form-field-class.enum.d.ts +18 -18
- package/types/constants/enum/form-field-type.enum.d.ts +111 -111
- package/types/constants/enum/form-type.enum.d.ts +11 -11
- package/types/constants/enum/index.d.ts +19 -19
- package/types/constants/enum/lateral-arrangement.enum.d.ts +23 -23
- package/types/constants/enum/money-unit.enum.d.ts +15 -15
- package/types/constants/enum/option-type.enum.d.ts +11 -11
- package/types/constants/enum/submitted-type.enum.d.ts +115 -111
- package/types/constants/enum/support-upload-type.enum.d.ts +11 -11
- package/types/constants/enum/switch.enum.d.ts +11 -11
- package/types/constants/enum/upload-type.enum.d.ts +59 -59
- package/types/constants/enum/validate-rules.enum.d.ts +2 -2
- package/types/constants/enum/validate-status.enum.d.ts +2 -2
- package/types/constants/enum/vertical-arrangement.enum.d.ts +21 -21
- package/types/constants/enum/zoom-type.d.ts +15 -15
- package/types/constants/index.d.ts +3 -3
- package/types/core/FormApi.d.ts +376 -376
- package/types/core/index.d.ts +1 -1
- package/types/domain/AbstractControl.d.ts +5 -5
- package/types/domain/Control.d.ts +13 -13
- package/types/domain/CustomFormat.d.ts +5 -5
- package/types/domain/DesForm.d.ts +32 -32
- package/types/domain/DesFormControl.d.ts +160 -160
- package/types/domain/DesFormLayout.d.ts +33 -33
- package/types/domain/FieldChangeHistory.d.ts +9 -9
- package/types/domain/FormConfig.d.ts +15 -15
- package/types/domain/FormControl.d.ts +60 -60
- package/types/domain/FormEnum.d.ts +10 -10
- package/types/domain/FormGroup.d.ts +27 -27
- package/types/domain/FormRestfulResponse.d.ts +6 -6
- package/types/domain/ProvideInjectData.d.ts +10 -10
- package/types/domain/SysDictDetail.d.ts +24 -24
- package/types/domain/SysDictInfo.d.ts +26 -26
- package/types/domain/SysDictTreeDetail.d.ts +34 -34
- package/types/domain/index.d.ts +12 -12
- package/types/filtres/amount-capitalization.filter.d.ts +7 -7
- package/types/filtres/extract-options.filter.d.ts +13 -13
- package/types/filtres/generate-grid-column-end.filter.d.ts +11 -11
- package/types/filtres/generate-grid-template-columns.filter.d.ts +11 -11
- package/types/filtres/switch-enum-convert.filter.d.ts +2 -2
- package/types/filtres/zoom-multiple.filter.d.ts +3 -3
- package/types/index.d.ts +13 -13
- package/types/main.d.ts +2 -2
- package/types/services/api.service.d.ts +25 -25
- package/types/services/clean-local-forage.service.d.ts +28 -28
- package/types/services/date-format.service.d.ts +21 -21
- package/types/services/dict-local-forage.service.d.ts +28 -28
- package/types/services/form-bean-utils.service.d.ts +23 -23
- package/types/services/form-local-forage.service.d.ts +28 -28
- package/types/services/form-tools.service.d.ts +153 -144
- package/types/services/form-tree-node-convert.service.d.ts +104 -104
- package/types/services/form-validate.service.d.ts +32 -32
- package/types/services/index.d.ts +9 -9
- package/types/services/router.service.d.ts +40 -40
- package/types/services/validate-generator.service.d.ts +154 -154
- package/types/store/dict.store.d.ts +29 -29
- package/types/store/form.store.d.ts +17 -17
- package/types/store/index.d.ts +2 -2
- package/types/types/vfForm.d.ts +10 -10
- package/vue.config.js +38 -29
- package/dhccmobile-vue3-lo-form-1.1.41.tgz +0 -0
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import { DesFormControl } from "./DesFormControl";
|
|
2
|
-
|
|
3
|
-
export class DesFormLayout {
|
|
4
|
-
layoutId: string;
|
|
5
|
-
formId: string;
|
|
6
|
-
parentLayoutId: string;
|
|
7
|
-
layoutName: string;
|
|
8
|
-
layoutType: string;
|
|
9
|
-
gridSpace: number | undefined;
|
|
10
|
-
gridColumnConfig: any;
|
|
11
|
-
gridLateralArrangement: string;
|
|
12
|
-
gridVerticalArrangement: string;
|
|
13
|
-
layoutOrder: number | undefined;
|
|
14
|
-
labelSpan: string;
|
|
15
|
-
controlSpan: string;
|
|
16
|
-
desFormControls: DesFormControl[];
|
|
17
|
-
subDesFormLayout: DesFormLayout[];
|
|
18
|
-
constructor(
|
|
19
|
-
options: {
|
|
20
|
-
layoutId?: string;
|
|
21
|
-
formId?: string;
|
|
22
|
-
parentLayoutId?: string;
|
|
23
|
-
layoutName?: string;
|
|
24
|
-
layoutType?: string;
|
|
25
|
-
gridSpace?: number;
|
|
26
|
-
gridColumnConfig?: any;
|
|
27
|
-
gridLateralArrangement?: string;
|
|
28
|
-
gridVerticalArrangement?: string;
|
|
29
|
-
layoutOrder?: number;
|
|
30
|
-
labelSpan?: string;
|
|
31
|
-
controlSpan?: string;
|
|
32
|
-
desFormControls?: DesFormControl[];
|
|
33
|
-
subDesFormLayout?: DesFormLayout[];
|
|
34
|
-
} = {}
|
|
35
|
-
) {
|
|
36
|
-
this.layoutId = options.layoutId || "";
|
|
37
|
-
this.formId = options.formId || "";
|
|
38
|
-
this.parentLayoutId = options.parentLayoutId || "";
|
|
39
|
-
this.layoutName = options.layoutName || "";
|
|
40
|
-
this.layoutType = options.layoutType || "";
|
|
41
|
-
this.gridSpace = options.gridSpace;
|
|
42
|
-
this.gridColumnConfig = options.gridColumnConfig;
|
|
43
|
-
this.gridLateralArrangement = options.gridLateralArrangement || "";
|
|
44
|
-
this.gridVerticalArrangement = options.gridVerticalArrangement || "";
|
|
45
|
-
this.layoutOrder = options.layoutOrder;
|
|
46
|
-
this.labelSpan = options.labelSpan || "";
|
|
47
|
-
this.controlSpan = options.controlSpan || "";
|
|
48
|
-
this.desFormControls = options.desFormControls || [];
|
|
49
|
-
this.subDesFormLayout = options.subDesFormLayout || [];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
import { DesFormControl } from "./DesFormControl";
|
|
2
|
+
|
|
3
|
+
export class DesFormLayout {
|
|
4
|
+
layoutId: string;
|
|
5
|
+
formId: string;
|
|
6
|
+
parentLayoutId: string;
|
|
7
|
+
layoutName: string;
|
|
8
|
+
layoutType: string;
|
|
9
|
+
gridSpace: number | undefined;
|
|
10
|
+
gridColumnConfig: any;
|
|
11
|
+
gridLateralArrangement: string;
|
|
12
|
+
gridVerticalArrangement: string;
|
|
13
|
+
layoutOrder: number | undefined;
|
|
14
|
+
labelSpan: string;
|
|
15
|
+
controlSpan: string;
|
|
16
|
+
desFormControls: DesFormControl[];
|
|
17
|
+
subDesFormLayout: DesFormLayout[];
|
|
18
|
+
constructor(
|
|
19
|
+
options: {
|
|
20
|
+
layoutId?: string;
|
|
21
|
+
formId?: string;
|
|
22
|
+
parentLayoutId?: string;
|
|
23
|
+
layoutName?: string;
|
|
24
|
+
layoutType?: string;
|
|
25
|
+
gridSpace?: number;
|
|
26
|
+
gridColumnConfig?: any;
|
|
27
|
+
gridLateralArrangement?: string;
|
|
28
|
+
gridVerticalArrangement?: string;
|
|
29
|
+
layoutOrder?: number;
|
|
30
|
+
labelSpan?: string;
|
|
31
|
+
controlSpan?: string;
|
|
32
|
+
desFormControls?: DesFormControl[];
|
|
33
|
+
subDesFormLayout?: DesFormLayout[];
|
|
34
|
+
} = {}
|
|
35
|
+
) {
|
|
36
|
+
this.layoutId = options.layoutId || "";
|
|
37
|
+
this.formId = options.formId || "";
|
|
38
|
+
this.parentLayoutId = options.parentLayoutId || "";
|
|
39
|
+
this.layoutName = options.layoutName || "";
|
|
40
|
+
this.layoutType = options.layoutType || "";
|
|
41
|
+
this.gridSpace = options.gridSpace;
|
|
42
|
+
this.gridColumnConfig = options.gridColumnConfig;
|
|
43
|
+
this.gridLateralArrangement = options.gridLateralArrangement || "";
|
|
44
|
+
this.gridVerticalArrangement = options.gridVerticalArrangement || "";
|
|
45
|
+
this.layoutOrder = options.layoutOrder;
|
|
46
|
+
this.labelSpan = options.labelSpan || "";
|
|
47
|
+
this.controlSpan = options.controlSpan || "";
|
|
48
|
+
this.desFormControls = options.desFormControls || [];
|
|
49
|
+
this.subDesFormLayout = options.subDesFormLayout || [];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export interface FieldChangeHistory {
|
|
2
|
-
[key: string]: FieldChangeHistoryItem[];
|
|
3
|
-
}
|
|
4
|
-
export interface FieldChangeHistoryItem {
|
|
5
|
-
time: string;
|
|
6
|
-
before: string;
|
|
7
|
-
after: string;
|
|
8
|
-
author: string;
|
|
9
|
-
}
|
|
1
|
+
export interface FieldChangeHistory {
|
|
2
|
+
[key: string]: FieldChangeHistoryItem[];
|
|
3
|
+
}
|
|
4
|
+
export interface FieldChangeHistoryItem {
|
|
5
|
+
time: string;
|
|
6
|
+
before: string;
|
|
7
|
+
after: string;
|
|
8
|
+
author: string;
|
|
9
|
+
}
|
package/src/domain/FormConfig.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type LoadMode = "static" | "dynamic";
|
|
2
|
-
export interface FormConfig {
|
|
3
|
-
url?: string;
|
|
4
|
-
dictUrl?: string;
|
|
5
|
-
dictRestLoadMode?: string;
|
|
6
|
-
dictRestLoadBody?: any;
|
|
7
|
-
dictRestLoadHeaders?: any;
|
|
8
|
-
dictRestLoadOnlyBody?: boolean;
|
|
9
|
-
loadMode?: LoadMode;
|
|
10
|
-
appId?: string;
|
|
11
|
-
onlySimpleLoadConfig?: boolean;
|
|
12
|
-
appIds?: string[];
|
|
13
|
-
urls?: string[];
|
|
14
|
-
dictUrls?: string[];
|
|
15
|
-
}
|
|
1
|
+
export type LoadMode = "static" | "dynamic";
|
|
2
|
+
export interface FormConfig {
|
|
3
|
+
url?: string;
|
|
4
|
+
dictUrl?: string;
|
|
5
|
+
dictRestLoadMode?: string;
|
|
6
|
+
dictRestLoadBody?: any;
|
|
7
|
+
dictRestLoadHeaders?: any;
|
|
8
|
+
dictRestLoadOnlyBody?: boolean;
|
|
9
|
+
loadMode?: LoadMode;
|
|
10
|
+
appId?: string;
|
|
11
|
+
onlySimpleLoadConfig?: boolean;
|
|
12
|
+
appIds?: string[];
|
|
13
|
+
urls?: string[];
|
|
14
|
+
dictUrls?: string[];
|
|
15
|
+
}
|
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
import { AbstractControl } from "./AbstractControl";
|
|
2
|
-
import { ValidateStatus } from "../constants/enum/validate-status.enum";
|
|
3
|
-
|
|
4
|
-
export interface ValidateResult {
|
|
5
|
-
validateStatus?: string;
|
|
6
|
-
errorMsg?: any;
|
|
7
|
-
}
|
|
8
|
-
export interface ValidateReport {
|
|
9
|
-
key: string;
|
|
10
|
-
name: string;
|
|
11
|
-
errorMsg: any;
|
|
12
|
-
controlType: string;
|
|
13
|
-
}
|
|
14
|
-
export type ValidateFunc = (val: any) => ValidateResult;
|
|
15
|
-
export interface Validate {
|
|
16
|
-
name: string;
|
|
17
|
-
validateFunc: ValidateFunc;
|
|
18
|
-
}
|
|
19
|
-
export type TextNoticeCallback = (val?: any) => string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @description: 控件对象
|
|
23
|
-
* @author ChenRui
|
|
24
|
-
* @date 2020/12/1 15:06
|
|
25
|
-
*/
|
|
26
|
-
export class FormControl extends AbstractControl {
|
|
27
|
-
history: any[] = []; // 字段历史
|
|
28
|
-
validates: Validate[] = []; // 校验规则
|
|
29
|
-
textNoticeCallback: TextNoticeCallback | undefined; // 获取文本内容回调
|
|
30
|
-
|
|
31
|
-
constructor(formState?: any) {
|
|
32
|
-
super();
|
|
33
|
-
this.setValue(formState);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
setValue(value: any) {
|
|
37
|
-
this.value = value || undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
get(path: Array<string | number> | string): AbstractControl | null {
|
|
41
|
-
return this;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* @description: 添加校验
|
|
46
|
-
* @author ChenRui
|
|
47
|
-
* @date 2021/1/26 21:05
|
|
48
|
-
*/
|
|
49
|
-
addValidate(validate: Validate | Validate[]): void {
|
|
50
|
-
let validates: Validate[] = [];
|
|
51
|
-
if (!(validate instanceof Array)) {
|
|
52
|
-
validates.push(validate);
|
|
53
|
-
} else {
|
|
54
|
-
validates = validate;
|
|
55
|
-
}
|
|
56
|
-
if (validates && validates.length > 0) {
|
|
57
|
-
for (let i = 0; i < validates.length; i++) {
|
|
58
|
-
if (validates[i].name) {
|
|
59
|
-
const index = this.validates.findIndex((item) => item.name === validates[i].name);
|
|
60
|
-
if (index > -1) {
|
|
61
|
-
this.validates[index].validateFunc = validates[i].validateFunc;
|
|
62
|
-
} else {
|
|
63
|
-
this.validates.push(validates[i]);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @description: 移除校验
|
|
72
|
-
* @author ChenRui
|
|
73
|
-
* @date 2021/1/26 21:06
|
|
74
|
-
*/
|
|
75
|
-
removeValidate(name: string): void {
|
|
76
|
-
if (name) {
|
|
77
|
-
const index = this.validates.findIndex((item) => item.name === name);
|
|
78
|
-
if (index > -1) {
|
|
79
|
-
this.validates.splice(index, 1);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @description: 获取校验
|
|
86
|
-
* @author ChenRui
|
|
87
|
-
* @date 2021/1/30 11:47
|
|
88
|
-
*/
|
|
89
|
-
getValidate(name: string): Validate | any {
|
|
90
|
-
if (name) {
|
|
91
|
-
return this.validates.find((item) => item.name === name);
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* @description: 校验
|
|
98
|
-
* @author ChenRui
|
|
99
|
-
* @date 2021/1/26 21:08
|
|
100
|
-
*/
|
|
101
|
-
validate(val: any = this.value): ValidateResult {
|
|
102
|
-
for (let i = 0; i < this.validates.length; i++) {
|
|
103
|
-
const result: ValidateResult = this.validates[i].validateFunc(val);
|
|
104
|
-
if (result && result.validateStatus !== ValidateStatus.Success.code) {
|
|
105
|
-
return result;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
validateStatus: ValidateStatus.Success.code,
|
|
110
|
-
errorMsg: null,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* @description: 获取文本内容
|
|
116
|
-
* @author ChenRui
|
|
117
|
-
* @date 2021/1/29 15:56
|
|
118
|
-
*/
|
|
119
|
-
text(): string {
|
|
120
|
-
if (this.textNoticeCallback) {
|
|
121
|
-
return this.textNoticeCallback();
|
|
122
|
-
}
|
|
123
|
-
return "";
|
|
124
|
-
}
|
|
125
|
-
}
|
|
1
|
+
import { AbstractControl } from "./AbstractControl";
|
|
2
|
+
import { ValidateStatus } from "../constants/enum/validate-status.enum";
|
|
3
|
+
|
|
4
|
+
export interface ValidateResult {
|
|
5
|
+
validateStatus?: string;
|
|
6
|
+
errorMsg?: any;
|
|
7
|
+
}
|
|
8
|
+
export interface ValidateReport {
|
|
9
|
+
key: string;
|
|
10
|
+
name: string;
|
|
11
|
+
errorMsg: any;
|
|
12
|
+
controlType: string;
|
|
13
|
+
}
|
|
14
|
+
export type ValidateFunc = (val: any) => ValidateResult;
|
|
15
|
+
export interface Validate {
|
|
16
|
+
name: string;
|
|
17
|
+
validateFunc: ValidateFunc;
|
|
18
|
+
}
|
|
19
|
+
export type TextNoticeCallback = (val?: any) => string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description: 控件对象
|
|
23
|
+
* @author ChenRui
|
|
24
|
+
* @date 2020/12/1 15:06
|
|
25
|
+
*/
|
|
26
|
+
export class FormControl extends AbstractControl {
|
|
27
|
+
history: any[] = []; // 字段历史
|
|
28
|
+
validates: Validate[] = []; // 校验规则
|
|
29
|
+
textNoticeCallback: TextNoticeCallback | undefined; // 获取文本内容回调
|
|
30
|
+
|
|
31
|
+
constructor(formState?: any) {
|
|
32
|
+
super();
|
|
33
|
+
this.setValue(formState);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
setValue(value: any) {
|
|
37
|
+
this.value = value || undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get(path: Array<string | number> | string): AbstractControl | null {
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @description: 添加校验
|
|
46
|
+
* @author ChenRui
|
|
47
|
+
* @date 2021/1/26 21:05
|
|
48
|
+
*/
|
|
49
|
+
addValidate(validate: Validate | Validate[]): void {
|
|
50
|
+
let validates: Validate[] = [];
|
|
51
|
+
if (!(validate instanceof Array)) {
|
|
52
|
+
validates.push(validate);
|
|
53
|
+
} else {
|
|
54
|
+
validates = validate;
|
|
55
|
+
}
|
|
56
|
+
if (validates && validates.length > 0) {
|
|
57
|
+
for (let i = 0; i < validates.length; i++) {
|
|
58
|
+
if (validates[i].name) {
|
|
59
|
+
const index = this.validates.findIndex((item) => item.name === validates[i].name);
|
|
60
|
+
if (index > -1) {
|
|
61
|
+
this.validates[index].validateFunc = validates[i].validateFunc;
|
|
62
|
+
} else {
|
|
63
|
+
this.validates.push(validates[i]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @description: 移除校验
|
|
72
|
+
* @author ChenRui
|
|
73
|
+
* @date 2021/1/26 21:06
|
|
74
|
+
*/
|
|
75
|
+
removeValidate(name: string): void {
|
|
76
|
+
if (name) {
|
|
77
|
+
const index = this.validates.findIndex((item) => item.name === name);
|
|
78
|
+
if (index > -1) {
|
|
79
|
+
this.validates.splice(index, 1);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* @description: 获取校验
|
|
86
|
+
* @author ChenRui
|
|
87
|
+
* @date 2021/1/30 11:47
|
|
88
|
+
*/
|
|
89
|
+
getValidate(name: string): Validate | any {
|
|
90
|
+
if (name) {
|
|
91
|
+
return this.validates.find((item) => item.name === name);
|
|
92
|
+
}
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description: 校验
|
|
98
|
+
* @author ChenRui
|
|
99
|
+
* @date 2021/1/26 21:08
|
|
100
|
+
*/
|
|
101
|
+
validate(val: any = this.value): ValidateResult {
|
|
102
|
+
for (let i = 0; i < this.validates.length; i++) {
|
|
103
|
+
const result: ValidateResult = this.validates[i].validateFunc(val);
|
|
104
|
+
if (result && result.validateStatus !== ValidateStatus.Success.code) {
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
validateStatus: ValidateStatus.Success.code,
|
|
110
|
+
errorMsg: null,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @description: 获取文本内容
|
|
116
|
+
* @author ChenRui
|
|
117
|
+
* @date 2021/1/29 15:56
|
|
118
|
+
*/
|
|
119
|
+
text(): string {
|
|
120
|
+
if (this.textNoticeCallback) {
|
|
121
|
+
return this.textNoticeCallback();
|
|
122
|
+
}
|
|
123
|
+
return "";
|
|
124
|
+
}
|
|
125
|
+
}
|
package/src/domain/FormEnum.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
interface FormEnumItem {
|
|
2
|
-
code: any;
|
|
3
|
-
name: string;
|
|
4
|
-
icon?: string;
|
|
5
|
-
type?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface FormEnum {
|
|
8
|
-
[key: string]: FormEnumItem;
|
|
9
|
-
}
|
|
1
|
+
interface FormEnumItem {
|
|
2
|
+
code: any;
|
|
3
|
+
name: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
type?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FormEnum {
|
|
8
|
+
[key: string]: FormEnumItem;
|
|
9
|
+
}
|
package/src/domain/FormGroup.ts
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import { AbstractControl } from "./AbstractControl";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description: 表单对象
|
|
5
|
-
* @author ChenRui
|
|
6
|
-
* @date 2020/12/1 15:06
|
|
7
|
-
*/
|
|
8
|
-
export class FormGroup extends AbstractControl {
|
|
9
|
-
controls: { [key: string]: AbstractControl };
|
|
10
|
-
|
|
11
|
-
constructor(controls: { [key: string]: AbstractControl } = {}) {
|
|
12
|
-
super();
|
|
13
|
-
this.controls = controls;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* @description: 添加控件
|
|
18
|
-
* @author ChenRui
|
|
19
|
-
* @date 2020/12/1 14:47
|
|
20
|
-
*/
|
|
21
|
-
addControl(name: string, control: AbstractControl): void {
|
|
22
|
-
this.controls[name] = control;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @description: 移除控件
|
|
27
|
-
* @author ChenRui
|
|
28
|
-
* @date 2020/12/1 14:47
|
|
29
|
-
*/
|
|
30
|
-
removeControl(name: string): void {
|
|
31
|
-
if (this.controls[name] != null) {
|
|
32
|
-
delete this.controls[name];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get(path: Array<string | number> | string): AbstractControl | null {
|
|
37
|
-
if (typeof path === "string") {
|
|
38
|
-
return this.controls[path];
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
import { AbstractControl } from "./AbstractControl";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description: 表单对象
|
|
5
|
+
* @author ChenRui
|
|
6
|
+
* @date 2020/12/1 15:06
|
|
7
|
+
*/
|
|
8
|
+
export class FormGroup extends AbstractControl {
|
|
9
|
+
controls: { [key: string]: AbstractControl };
|
|
10
|
+
|
|
11
|
+
constructor(controls: { [key: string]: AbstractControl } = {}) {
|
|
12
|
+
super();
|
|
13
|
+
this.controls = controls;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @description: 添加控件
|
|
18
|
+
* @author ChenRui
|
|
19
|
+
* @date 2020/12/1 14:47
|
|
20
|
+
*/
|
|
21
|
+
addControl(name: string, control: AbstractControl): void {
|
|
22
|
+
this.controls[name] = control;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @description: 移除控件
|
|
27
|
+
* @author ChenRui
|
|
28
|
+
* @date 2020/12/1 14:47
|
|
29
|
+
*/
|
|
30
|
+
removeControl(name: string): void {
|
|
31
|
+
if (this.controls[name] != null) {
|
|
32
|
+
delete this.controls[name];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get(path: Array<string | number> | string): AbstractControl | null {
|
|
37
|
+
if (typeof path === "string") {
|
|
38
|
+
return this.controls[path];
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export interface FormRestfulResponse {
|
|
2
|
-
code?: number;
|
|
3
|
-
msg?: string;
|
|
4
|
-
data?: any;
|
|
5
|
-
meta?: any;
|
|
6
|
-
}
|
|
1
|
+
export interface FormRestfulResponse {
|
|
2
|
+
code?: number;
|
|
3
|
+
msg?: string;
|
|
4
|
+
data?: any;
|
|
5
|
+
meta?: any;
|
|
6
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface ProvideInjectData {
|
|
2
|
-
labelSpan?: any;
|
|
3
|
-
controlSpan?: any;
|
|
4
|
-
edit?: boolean | undefined;
|
|
5
|
-
colon?: boolean;
|
|
6
|
-
metaRefresh?: any;
|
|
7
|
-
refreshCheckFeedbackFlag?: any;
|
|
8
|
-
widthCompatibleMode?: boolean;
|
|
9
|
-
formValidateStateResetMark?: any;
|
|
10
|
-
}
|
|
1
|
+
export interface ProvideInjectData {
|
|
2
|
+
labelSpan?: any;
|
|
3
|
+
controlSpan?: any;
|
|
4
|
+
edit?: boolean | undefined;
|
|
5
|
+
colon?: boolean;
|
|
6
|
+
metaRefresh?: any;
|
|
7
|
+
refreshCheckFeedbackFlag?: any;
|
|
8
|
+
widthCompatibleMode?: boolean;
|
|
9
|
+
formValidateStateResetMark?: any;
|
|
10
|
+
}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
export class SysDictDetail {
|
|
2
|
-
dataId: string;
|
|
3
|
-
dictId: string;
|
|
4
|
-
dicEntryPk: string;
|
|
5
|
-
dictCd: string;
|
|
6
|
-
dictNm: string;
|
|
7
|
-
dicKey: string;
|
|
8
|
-
dicValue: string;
|
|
9
|
-
mark: string;
|
|
10
|
-
dicEntryRank: string;
|
|
11
|
-
useState: string;
|
|
12
|
-
|
|
13
|
-
constructor(
|
|
14
|
-
options: {
|
|
15
|
-
dataId?: string;
|
|
16
|
-
dictId?: string;
|
|
17
|
-
dicEntryPk?: string;
|
|
18
|
-
dictCd?: string;
|
|
19
|
-
dictNm?: string;
|
|
20
|
-
dicKey?: string;
|
|
21
|
-
dicValue?: string;
|
|
22
|
-
mark?: string;
|
|
23
|
-
dicEntryRank?: string;
|
|
24
|
-
useState?: string;
|
|
25
|
-
} = {}
|
|
26
|
-
) {
|
|
27
|
-
this.dataId = options.dataId || '';
|
|
28
|
-
this.dictId = options.dictId || '';
|
|
29
|
-
this.dicEntryPk = options.dicEntryPk || '';
|
|
30
|
-
this.dictCd = options.dictCd || '';
|
|
31
|
-
this.dictNm = options.dictNm || '';
|
|
32
|
-
this.dicKey = options.dicKey || '';
|
|
33
|
-
this.dicValue = options.dicValue || '';
|
|
34
|
-
this.mark = options.mark || '';
|
|
35
|
-
this.dicEntryRank = options.dicEntryRank || '';
|
|
36
|
-
this.useState = options.useState || '';
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
export class SysDictDetail {
|
|
2
|
+
dataId: string;
|
|
3
|
+
dictId: string;
|
|
4
|
+
dicEntryPk: string;
|
|
5
|
+
dictCd: string;
|
|
6
|
+
dictNm: string;
|
|
7
|
+
dicKey: string;
|
|
8
|
+
dicValue: string;
|
|
9
|
+
mark: string;
|
|
10
|
+
dicEntryRank: string;
|
|
11
|
+
useState: string;
|
|
12
|
+
|
|
13
|
+
constructor(
|
|
14
|
+
options: {
|
|
15
|
+
dataId?: string;
|
|
16
|
+
dictId?: string;
|
|
17
|
+
dicEntryPk?: string;
|
|
18
|
+
dictCd?: string;
|
|
19
|
+
dictNm?: string;
|
|
20
|
+
dicKey?: string;
|
|
21
|
+
dicValue?: string;
|
|
22
|
+
mark?: string;
|
|
23
|
+
dicEntryRank?: string;
|
|
24
|
+
useState?: string;
|
|
25
|
+
} = {}
|
|
26
|
+
) {
|
|
27
|
+
this.dataId = options.dataId || '';
|
|
28
|
+
this.dictId = options.dictId || '';
|
|
29
|
+
this.dicEntryPk = options.dicEntryPk || '';
|
|
30
|
+
this.dictCd = options.dictCd || '';
|
|
31
|
+
this.dictNm = options.dictNm || '';
|
|
32
|
+
this.dicKey = options.dicKey || '';
|
|
33
|
+
this.dicValue = options.dicValue || '';
|
|
34
|
+
this.mark = options.mark || '';
|
|
35
|
+
this.dicEntryRank = options.dicEntryRank || '';
|
|
36
|
+
this.useState = options.useState || '';
|
|
37
|
+
}
|
|
38
|
+
}
|