super-page-runtime 2.0.8 → 2.0.9
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/dist/es/components/runtime/index.d.ts +3 -3
- package/dist/es/components/runtime/utils/page-helper-util.d.ts +1 -1
- package/dist/es/components/runtime/utils/page-helper-util.js +4 -1
- package/dist/es/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +196 -18
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +44 -0
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +4 -0
- package/dist/es/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +76 -6
- package/dist/es/index.d.ts +2 -2
- package/dist/es/index.js +2 -2
- package/dist/lib/_virtual/AttributeMap.js +4 -0
- package/dist/lib/_virtual/Delta.js +4 -0
- package/dist/lib/_virtual/Op.js +4 -0
- package/dist/lib/_virtual/OpIterator.js +4 -0
- package/dist/lib/_virtual/__vite-browser-external.js +3 -0
- package/dist/lib/_virtual/_commonjsHelpers.js +8 -0
- package/dist/lib/_virtual/_plugin-vue_export-helper.js +9 -0
- package/dist/lib/_virtual/dayjs.min.js +4 -0
- package/dist/lib/_virtual/index.js +4 -0
- package/dist/lib/_virtual/index2.js +4 -0
- package/dist/lib/_virtual/index3.js +4 -0
- package/dist/lib/assets/chart-themes/theme1.d.ts +4 -0
- package/dist/lib/assets/chart-themes/theme1.js +7 -0
- package/dist/lib/assets/chart-themes/theme2.d.ts +4 -0
- package/dist/lib/assets/chart-themes/theme2.js +7 -0
- package/dist/lib/assets/chart-themes/theme3.d.ts +4 -0
- package/dist/lib/assets/chart-themes/theme3.js +7 -0
- package/dist/lib/components/runtime/index.d.ts +4 -0
- package/dist/lib/components/runtime/utils/api/api-util.d.ts +11 -0
- package/dist/lib/components/runtime/utils/api/api-util.js +128 -0
- package/dist/lib/components/runtime/utils/assemblys-config.js +258 -0
- package/dist/lib/components/runtime/utils/charts/chart-util.d.ts +11 -0
- package/dist/lib/components/runtime/utils/charts/chart-util.js +28 -0
- package/dist/lib/components/runtime/utils/common-util.d.ts +16 -0
- package/dist/lib/components/runtime/utils/common-util.js +94 -0
- package/dist/lib/components/runtime/utils/eventBus.d.ts +7 -0
- package/dist/lib/components/runtime/utils/eventBus.js +10 -0
- package/dist/lib/components/runtime/utils/events/event-util.d.ts +48 -0
- package/dist/lib/components/runtime/utils/events/event-util.js +526 -0
- package/dist/lib/components/runtime/utils/events/standard-event.d.ts +61 -0
- package/dist/lib/components/runtime/utils/events/standard-event.js +1625 -0
- package/dist/lib/components/runtime/utils/events/validator-util.d.ts +4 -0
- package/dist/lib/components/runtime/utils/events/validator-util.js +389 -0
- package/dist/lib/components/runtime/utils/global-refs.d.ts +59 -0
- package/dist/lib/components/runtime/utils/global-refs.js +65 -0
- package/dist/lib/components/runtime/utils/interfaces/page-design-types.d.ts +223 -0
- package/dist/lib/components/runtime/utils/interfaces/page-design-types.js +9 -0
- package/dist/lib/components/runtime/utils/page-helper-util.d.ts +106 -0
- package/dist/lib/components/runtime/utils/page-helper-util.js +622 -0
- package/dist/lib/components/runtime/utils/page-init-util.d.ts +38 -0
- package/dist/lib/components/runtime/utils/page-init-util.js +200 -0
- package/dist/lib/components/runtime/utils/page-permission-util.d.ts +26 -0
- package/dist/lib/components/runtime/utils/page-permission-util.js +525 -0
- package/dist/lib/components/runtime/utils/store-util.d.ts +15 -0
- package/dist/lib/components/runtime/utils/store-util.js +17 -0
- package/dist/lib/components/runtime/utils/store.d.ts +2 -0
- package/dist/lib/components/runtime/utils/store.js +3 -0
- package/dist/lib/components/runtime/utils/table-utils.js +24 -0
- package/dist/lib/components/runtime/views/assemblys/button/button/button-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/button/button/button-runtime.vue2.js +54 -0
- package/dist/lib/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/button/button-group/buttongroup-runtime.vue2.js +35 -0
- package/dist/lib/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/button/dropdown/dropdown-runtime.vue2.js +110 -0
- package/dist/lib/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/column-line/column-line-runtime.vue2.js +432 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue.js +43 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header-breadcrumb.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue.js +61 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header-group.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header.vue.js +126 -0
- package/dist/lib/components/runtime/views/assemblys/chart/common/common-chart-header.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/gauge/gauge-runtime.vue2.js +52 -0
- package/dist/lib/components/runtime/views/assemblys/chart/pie/pie-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/pie/pie-runtime.vue2.js +54 -0
- package/dist/lib/components/runtime/views/assemblys/chart/radar/radar-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/radar/radar-runtime.vue2.js +54 -0
- package/dist/lib/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/chart/scatter/scatter-runtime.vue2.js +56 -0
- package/dist/lib/components/runtime/views/assemblys/common/export-form-report-dialog.vue.d.ts +24 -0
- package/dist/lib/components/runtime/views/assemblys/common/export-form-report-dialog.vue.js +147 -0
- package/dist/lib/components/runtime/views/assemblys/common/export-form-report-dialog.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/common/remove-signer-dialog.vue.d.ts +35 -0
- package/dist/lib/components/runtime/views/assemblys/common/remove-signer-dialog.vue.js +127 -0
- package/dist/lib/components/runtime/views/assemblys/common/remove-signer-dialog.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/common/task-informition-dialog.vue.d.ts +26 -0
- package/dist/lib/components/runtime/views/assemblys/common/task-informition-dialog.vue.js +104 -0
- package/dist/lib/components/runtime/views/assemblys/common/task-informition-dialog.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/card/card-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/card/card-runtime.vue2.js +72 -0
- package/dist/lib/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/collapse/collapse-runtime.vue2.js +74 -0
- package/dist/lib/components/runtime/views/assemblys/container/container/container-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/container/container-runtime.vue2.js +79 -0
- package/dist/lib/components/runtime/views/assemblys/container/flex/flex-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/flex/flex-runtime.vue2.js +43 -0
- package/dist/lib/components/runtime/views/assemblys/container/form/form-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/form/form-runtime.vue2.js +44 -0
- package/dist/lib/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/iframe/iframe-runtime.vue2.js +30 -0
- package/dist/lib/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/tabs/tabs-runtime.vue2.js +69 -0
- package/dist/lib/components/runtime/views/assemblys/container/tools/tools-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/container/tools/tools-runtime.vue2.js +75 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/main-table-runtime.vue.js +642 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/main-table-runtime.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/sub-table-runtime.vue.js +453 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/sub-table-runtime.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/table-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/data/table/table-runtime.vue2.js +88 -0
- package/dist/lib/components/runtime/views/assemblys/error-render.vue.d.ts +22 -0
- package/dist/lib/components/runtime/views/assemblys/error-render.vue.js +22 -0
- package/dist/lib/components/runtime/views/assemblys/error-render.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/checkbox/checkbox-runtime.vue2.js +156 -0
- package/dist/lib/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/date-picker/datepicker-runtime.vue2.js +82 -0
- package/dist/lib/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/dept-tree/depttree-runtime.vue2.js +64 -0
- package/dist/lib/components/runtime/views/assemblys/form/divider/divider-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/divider/divider-runtime.vue2.js +40 -0
- package/dist/lib/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/file-upload/fileupload-runtime.vue2.js +74 -0
- package/dist/lib/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/input-number/input-number-runtime.vue2.js +63 -0
- package/dist/lib/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/input-text/inputtext-runtime.vue2.js +127 -0
- package/dist/lib/components/runtime/views/assemblys/form/label/label-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/label/label-runtime.vue2.js +127 -0
- package/dist/lib/components/runtime/views/assemblys/form/link/link-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/link/link-runtime.vue2.js +77 -0
- package/dist/lib/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/placeholder/placeholder-runtime.vue2.js +29 -0
- package/dist/lib/components/runtime/views/assemblys/form/radio/radio-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/radio/radio-runtime.vue2.js +157 -0
- package/dist/lib/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/rich-text/richtext-runtime.vue2.js +164 -0
- package/dist/lib/components/runtime/views/assemblys/form/select/select-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/select/select-runtime.vue2.js +201 -0
- package/dist/lib/components/runtime/views/assemblys/form/switch/switch-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/switch/switch-runtime.vue2.js +63 -0
- package/dist/lib/components/runtime/views/assemblys/form/tag/tag-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/tag/tag-runtime.vue2.js +63 -0
- package/dist/lib/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/form/textarea/textarea-runtime.vue2.js +65 -0
- package/dist/lib/components/runtime/views/assemblys/object-render.vue.d.ts +17 -0
- package/dist/lib/components/runtime/views/assemblys/object-render.vue.js +142 -0
- package/dist/lib/components/runtime/views/assemblys/object-render.vue2.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue.js +3 -0
- package/dist/lib/components/runtime/views/assemblys/workflow/workflow-button/workflowbutton-runtime.vue2.js +61 -0
- package/dist/lib/components/runtime/views/super-page-dialog.vue.d.ts +36 -0
- package/dist/lib/components/runtime/views/super-page-dialog.vue.js +73 -0
- package/dist/lib/components/runtime/views/super-page-dialog.vue2.js +3 -0
- package/dist/lib/components/runtime/views/super-page.vue.d.ts +91 -0
- package/dist/lib/components/runtime/views/super-page.vue.js +496 -0
- package/dist/lib/components/runtime/views/super-page.vue2.js +3 -0
- package/dist/lib/favicon.ico +0 -0
- package/dist/lib/index.d.ts +8 -0
- package/dist/lib/index.js +15 -0
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function setObjectPropRule(prop: any, rules: any, leafRule: any): {};
|
|
2
|
+
export declare function validator(entity: any, rules: any, columns: any, rowIndex: any, isSql: any): any;
|
|
3
|
+
export declare function validateDataModelFunc(pageContext: any, configureObj: any, isEnableRequired: any): Promise<unknown>;
|
|
4
|
+
export declare function i18nValidateRulesMessage(rules: any): {};
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const index$1 = require("../../../../node_modules/.pnpm/async-validator@4.2.5/node_modules/async-validator/dist-web/index.js");
|
|
4
|
+
const globalRefs = require("../global-refs.js");
|
|
5
|
+
const util = require("../../../../node_modules/.pnpm/agilebuilder-ui@1.0.13_vue@3.4.21/node_modules/agilebuilder-ui/src/utils/util.js");
|
|
6
|
+
const index = require("../../../../node_modules/.pnpm/element-plus@2.6.2_vue@3.4.21/node_modules/element-plus/es/components/message/index.js");
|
|
7
|
+
function setObjectPropRule(prop, rules, leafRule) {
|
|
8
|
+
const rule = {};
|
|
9
|
+
if (!rules) {
|
|
10
|
+
rules = {};
|
|
11
|
+
}
|
|
12
|
+
let num = 0;
|
|
13
|
+
const props = prop.split(".");
|
|
14
|
+
props.forEach((subProp) => {
|
|
15
|
+
let objectRule;
|
|
16
|
+
if (num === props.length - 1) {
|
|
17
|
+
objectRule = getEndObjectRule(rule, props, subProp);
|
|
18
|
+
objectRule.fields[subProp] = leafRule;
|
|
19
|
+
} else {
|
|
20
|
+
let lastObjectRule;
|
|
21
|
+
if (num === 0) {
|
|
22
|
+
objectRule = rules;
|
|
23
|
+
} else {
|
|
24
|
+
lastObjectRule = getLastObjectRule(rule, props, props[num - 1]);
|
|
25
|
+
objectRule = lastObjectRule.fields;
|
|
26
|
+
}
|
|
27
|
+
if (!objectRule[subProp]) {
|
|
28
|
+
objectRule[subProp] = {
|
|
29
|
+
type: "object",
|
|
30
|
+
required: true,
|
|
31
|
+
fields: {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (num === 0) {
|
|
35
|
+
rule[subProp] = objectRule[subProp];
|
|
36
|
+
} else {
|
|
37
|
+
lastObjectRule.fields[subProp] = objectRule[subProp];
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
num++;
|
|
41
|
+
});
|
|
42
|
+
return rule;
|
|
43
|
+
}
|
|
44
|
+
function getLastObjectRule(rule, props, currentProp) {
|
|
45
|
+
let lastObjectdRule;
|
|
46
|
+
for (let i = 0; i < props.length; i++) {
|
|
47
|
+
const subProp = props[i];
|
|
48
|
+
if (i === 0) {
|
|
49
|
+
lastObjectdRule = rule[subProp];
|
|
50
|
+
} else {
|
|
51
|
+
lastObjectdRule = lastObjectdRule.fields[props[i]];
|
|
52
|
+
}
|
|
53
|
+
if (subProp === currentProp) {
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return lastObjectdRule;
|
|
58
|
+
}
|
|
59
|
+
function getEndObjectRule(rule, props, currentProp) {
|
|
60
|
+
let lastObjectdRule;
|
|
61
|
+
for (let i = 0; i < props.length; i++) {
|
|
62
|
+
if (i === 0) {
|
|
63
|
+
lastObjectdRule = rule[props[i]];
|
|
64
|
+
} else {
|
|
65
|
+
lastObjectdRule = lastObjectdRule.fields[props[i]];
|
|
66
|
+
}
|
|
67
|
+
if (i !== props.length - 1) {
|
|
68
|
+
const leafSubProp = props[i + 1];
|
|
69
|
+
if (leafSubProp === currentProp) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return lastObjectdRule;
|
|
75
|
+
}
|
|
76
|
+
function getValidator(columns) {
|
|
77
|
+
const rules = {};
|
|
78
|
+
if (columns) {
|
|
79
|
+
columns.forEach((editField) => {
|
|
80
|
+
const prop = editField.model;
|
|
81
|
+
if (prop && editField.validations) {
|
|
82
|
+
const validations = editField.validations;
|
|
83
|
+
if (prop.indexOf(".") > 0) {
|
|
84
|
+
setObjectPropRule(editField.prop, rules, validations);
|
|
85
|
+
} else {
|
|
86
|
+
if (validations && validations.length > 0) {
|
|
87
|
+
rules[prop] = [...validations];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return rules;
|
|
94
|
+
}
|
|
95
|
+
function validator(entity, rules, columns, rowIndex, isSql) {
|
|
96
|
+
return validatorEntity(entity, rules, columns, rowIndex, true, isSql);
|
|
97
|
+
}
|
|
98
|
+
function sublistVerify(rules) {
|
|
99
|
+
if (!rules) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
Object.keys(rules).forEach((item) => {
|
|
103
|
+
if (item.indexOf(".") >= 0) {
|
|
104
|
+
let ruleKetArr = [];
|
|
105
|
+
ruleKetArr = item.split(".");
|
|
106
|
+
if (rules[ruleKetArr[0]]) {
|
|
107
|
+
rules[ruleKetArr[0]].fields[ruleKetArr[1]] = rules[item][0];
|
|
108
|
+
} else {
|
|
109
|
+
rules[ruleKetArr[0]] = new Object();
|
|
110
|
+
rules[ruleKetArr[0]].fields = new Object();
|
|
111
|
+
rules[ruleKetArr[0]].fields[ruleKetArr[1]] = rules[item][0];
|
|
112
|
+
rules[ruleKetArr[0]].type = "object";
|
|
113
|
+
}
|
|
114
|
+
delete rules[item];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
return rules;
|
|
118
|
+
}
|
|
119
|
+
function validatorEntity(entity, rules, columns, rowIndex, isShouldRepeateValdate, isSql) {
|
|
120
|
+
let validateRules = sublistVerify(rules);
|
|
121
|
+
if ((!rules || rules === null) && columns) {
|
|
122
|
+
validateRules = getValidator(columns);
|
|
123
|
+
}
|
|
124
|
+
if (!validateRules || Object.keys(validateRules).length === 0) {
|
|
125
|
+
entity["validateErrorField"] = "";
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
let result;
|
|
129
|
+
const validator2 = new index$1(validateRules);
|
|
130
|
+
validator2.validate(
|
|
131
|
+
entity,
|
|
132
|
+
{
|
|
133
|
+
first: true
|
|
134
|
+
},
|
|
135
|
+
(errors, fields) => {
|
|
136
|
+
let fieldName;
|
|
137
|
+
if (errors) {
|
|
138
|
+
result = errors[0].message;
|
|
139
|
+
fieldName = errors[0]["field"];
|
|
140
|
+
if (typeof rowIndex !== "undefined" && rowIndex !== null) {
|
|
141
|
+
result = util.getI18n().t("superPageRuntimeMessage.recordLine", {
|
|
142
|
+
row: rowIndex + 1
|
|
143
|
+
}) + "," + result;
|
|
144
|
+
}
|
|
145
|
+
index.ElMessage({
|
|
146
|
+
message: result,
|
|
147
|
+
showClose: true,
|
|
148
|
+
type: "warning",
|
|
149
|
+
duration: 3 * 1e3
|
|
150
|
+
});
|
|
151
|
+
console.log("errors", errors, "fields", fields);
|
|
152
|
+
} else {
|
|
153
|
+
result = true;
|
|
154
|
+
}
|
|
155
|
+
if (fieldName && isShouldRepeateValdate === true) {
|
|
156
|
+
const reg1 = /[A-Z]+/;
|
|
157
|
+
if (isSql !== void 0 && isSql === true && reg1.test(fieldName) && entity[fieldName.toLowerCase()] !== void 0) {
|
|
158
|
+
const copyEntity = JSON.parse(JSON.stringify(entity));
|
|
159
|
+
copyEntity[fieldName.toUpperCase()] = entity[fieldName.toLowerCase()];
|
|
160
|
+
delete copyEntity[fieldName.toLowerCase()];
|
|
161
|
+
result = validatorEntity(copyEntity, rules, columns, rowIndex, false, isSql);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
return result;
|
|
167
|
+
}
|
|
168
|
+
function validateDataModelFunc(pageContext, configureObj, isEnableRequired) {
|
|
169
|
+
const dataModel = pageContext.entity.data;
|
|
170
|
+
const pageModel = pageContext.entity.page;
|
|
171
|
+
const data = { ...pageModel, ...dataModel };
|
|
172
|
+
const rules = pageContext.rules;
|
|
173
|
+
if (isEnableRequired === void 0 || isEnableRequired === null) {
|
|
174
|
+
isEnableRequired = configureObj.props.verification.required;
|
|
175
|
+
if (typeof isEnableRequired === "undefined") {
|
|
176
|
+
isEnableRequired = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return validateDataModel(isEnableRequired, data, rules, pageContext);
|
|
180
|
+
}
|
|
181
|
+
function validateDataModel(isEnableRequired, dataModel, rules, pageContext) {
|
|
182
|
+
if (isEnableRequired) {
|
|
183
|
+
const isWorkflow = pageContext.workflowCode ? true : false;
|
|
184
|
+
const customRules = pageContext.customRules;
|
|
185
|
+
if (isWorkflow) {
|
|
186
|
+
return validateWorkflowFormDataModel(dataModel, pageContext, customRules);
|
|
187
|
+
} else {
|
|
188
|
+
return validateCommonFormDataModel(dataModel, pageContext, rules, customRules);
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
return new Promise((resolve, reject) => {
|
|
192
|
+
resolve(true);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function validateWorkflowFormDataModel(dataModel, pageContext, customRules) {
|
|
197
|
+
return new Promise((resolve, reject) => {
|
|
198
|
+
const additionalParamMap = pageContext.entity.request;
|
|
199
|
+
const contextParameter = pageContext.entity.context;
|
|
200
|
+
const taskParamMap = pageContext.entity.task;
|
|
201
|
+
const isSql = true;
|
|
202
|
+
const subTablePageInfo = pageContext.subTablePageInfo;
|
|
203
|
+
let workflowFieldPermissionRules = window["$vueApp"].config.globalProperties.$getValidator(
|
|
204
|
+
pageContext.completeTaskParam.fieldPermissions,
|
|
205
|
+
dataModel,
|
|
206
|
+
isSql,
|
|
207
|
+
additionalParamMap,
|
|
208
|
+
taskParamMap,
|
|
209
|
+
contextParameter
|
|
210
|
+
);
|
|
211
|
+
workflowFieldPermissionRules = packageCustomRules(customRules, workflowFieldPermissionRules);
|
|
212
|
+
let result = false;
|
|
213
|
+
if (!workflowFieldPermissionRules) {
|
|
214
|
+
result = true;
|
|
215
|
+
} else {
|
|
216
|
+
result = window["$vueApp"].config.globalProperties.$formValidator(
|
|
217
|
+
dataModel,
|
|
218
|
+
workflowFieldPermissionRules,
|
|
219
|
+
isSql,
|
|
220
|
+
additionalParamMap,
|
|
221
|
+
taskParamMap,
|
|
222
|
+
contextParameter,
|
|
223
|
+
subTablePageInfo
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
if (result !== true) {
|
|
227
|
+
index.ElMessage({
|
|
228
|
+
showClose: true,
|
|
229
|
+
message: result + "",
|
|
230
|
+
type: "warning"
|
|
231
|
+
});
|
|
232
|
+
resolve(false);
|
|
233
|
+
} else {
|
|
234
|
+
const validatorResult = [];
|
|
235
|
+
const customUuids = pageContext.customValidatorUuids;
|
|
236
|
+
if (customUuids) {
|
|
237
|
+
customUuids.forEach((componentUuid) => {
|
|
238
|
+
const customRef = globalRefs.getComponentRef(pageContext, componentUuid);
|
|
239
|
+
if (customRef) {
|
|
240
|
+
validatorResult.push(customRef.validator());
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (validatorResult && validatorResult.length > 0) {
|
|
245
|
+
Promise.all(validatorResult).then((values) => {
|
|
246
|
+
if (values.includes(false)) {
|
|
247
|
+
resolve(false);
|
|
248
|
+
} else {
|
|
249
|
+
if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
|
|
250
|
+
delete dataModel.validateErrorField;
|
|
251
|
+
}
|
|
252
|
+
resolve(dataModel);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
} else {
|
|
256
|
+
if (Object.keys(dataModel).indexOf("validateErrorField") >= 0) {
|
|
257
|
+
delete dataModel.validateErrorField;
|
|
258
|
+
}
|
|
259
|
+
resolve(dataModel);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function validateCommonFormDataModel(dataModel, pageContext, rules, customRules) {
|
|
265
|
+
return new Promise((resolve, reject) => {
|
|
266
|
+
const handleModels = JSON.parse(JSON.stringify(dataModel));
|
|
267
|
+
rules = packageCustomRules(customRules, rules);
|
|
268
|
+
if (!rules) {
|
|
269
|
+
resolve(handleModels);
|
|
270
|
+
} else {
|
|
271
|
+
const validateEntityResult = validator(handleModels, rules, null, null, true);
|
|
272
|
+
if (validateEntityResult === true) {
|
|
273
|
+
const validateResult = validateSubTables(pageContext);
|
|
274
|
+
if (validateResult === true) {
|
|
275
|
+
if (Object.keys(handleModels).indexOf("validateErrorField") >= 0) {
|
|
276
|
+
delete handleModels.validateErrorField;
|
|
277
|
+
}
|
|
278
|
+
resolve(handleModels);
|
|
279
|
+
} else {
|
|
280
|
+
reject(
|
|
281
|
+
new Error(
|
|
282
|
+
util.getI18n().t("superPageRuntimeMessage.tableListSubTableDataVerificationFailed")
|
|
283
|
+
).message
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
} else {
|
|
287
|
+
reject(new Error(util.getI18n().t("superPageRuntimeMessage.formDataVerificationFailed")).message);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
function packageCustomRules(orgCustomRules, orgRules) {
|
|
293
|
+
if (!orgCustomRules || !orgRules) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const customRulesKeys = Object.keys(orgCustomRules);
|
|
297
|
+
const customRules = orgCustomRules;
|
|
298
|
+
customRulesKeys.forEach((key) => {
|
|
299
|
+
if (key === "__subRules") {
|
|
300
|
+
const subRules = customRules["__subRules"];
|
|
301
|
+
const customSubTableKey = Object.keys(subRules);
|
|
302
|
+
customSubTableKey.forEach((subTableKey) => {
|
|
303
|
+
if (!orgRules.subRules) {
|
|
304
|
+
orgRules["subRules"] = {};
|
|
305
|
+
}
|
|
306
|
+
if (orgRules.subRules[subTableKey]) {
|
|
307
|
+
Object.assign(orgRules.subRules[subTableKey], subRules[subTableKey]);
|
|
308
|
+
} else {
|
|
309
|
+
orgRules.subRules[subTableKey] = subRules[subTableKey];
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
} else {
|
|
313
|
+
orgRules[key] = customRules[key];
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
return sublistVerify(orgRules);
|
|
317
|
+
}
|
|
318
|
+
function validateSubTables(pageContext) {
|
|
319
|
+
if (!pageContext) {
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
const tableUuidArr = pageContext.tableUuids;
|
|
323
|
+
if (!tableUuidArr) {
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
for (let i = 0; i < tableUuidArr.length; i++) {
|
|
327
|
+
const tableUuid = tableUuidArr[i];
|
|
328
|
+
const refDom = globalRefs.getComponentRef(pageContext, tableUuid);
|
|
329
|
+
if (refDom) {
|
|
330
|
+
const flag = refDom.validatorSunTableListData();
|
|
331
|
+
if (!flag) {
|
|
332
|
+
return false;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
function i18nValidateRulesMessage(rules) {
|
|
339
|
+
if (!rules || Object.keys(rules).length === 0) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const newRules = {};
|
|
343
|
+
const propNames = Object.keys(rules);
|
|
344
|
+
for (let i = 0; i < propNames.length; i++) {
|
|
345
|
+
const propName = propNames[i];
|
|
346
|
+
const propRules = rules[propName];
|
|
347
|
+
propRules.forEach((rule) => {
|
|
348
|
+
const label = rule["label"];
|
|
349
|
+
const i18nLabel = util.getI18n().t(label);
|
|
350
|
+
if (rule["required"]) {
|
|
351
|
+
rule["message"] = util.getI18n().t("superPageRuntimeMessage.required", { label: i18nLabel });
|
|
352
|
+
}
|
|
353
|
+
if (rule["myType"]) {
|
|
354
|
+
rule["message"] = util.getI18n().t("superPageRuntimeMessage.formatMismatch", {
|
|
355
|
+
label: i18nLabel
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
if (rule["patternType"]) {
|
|
359
|
+
rule["message"] = util.getI18n().t("superPageRuntimeMessage.formatMismatch", {
|
|
360
|
+
label: i18nLabel
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
if (rule["max"] !== void 0 && rule["max"] !== null) {
|
|
364
|
+
rule["message"] = util.getI18n().t("superPageRuntimeMessage.overMaxLength", {
|
|
365
|
+
label: i18nLabel,
|
|
366
|
+
value: rule["max"]
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
if (rule["min"] !== void 0 && rule["min"] !== null) {
|
|
370
|
+
rule["message"] = util.getI18n().t("superPageRuntimeMessage.limitMinLength", {
|
|
371
|
+
label: i18nLabel,
|
|
372
|
+
value: rule["min"]
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
if (propName.indexOf(".") > 0) {
|
|
377
|
+
setObjectPropRule(propName, newRules, propRules);
|
|
378
|
+
} else {
|
|
379
|
+
if (propRules && propRules.length > 0) {
|
|
380
|
+
newRules[propName] = [...propRules];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return newRules;
|
|
385
|
+
}
|
|
386
|
+
exports.i18nValidateRulesMessage = i18nValidateRulesMessage;
|
|
387
|
+
exports.setObjectPropRule = setObjectPropRule;
|
|
388
|
+
exports.validateDataModelFunc = validateDataModelFunc;
|
|
389
|
+
exports.validator = validator;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PageContext } from './interfaces/page-design-types';
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
globalRefs: any;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* 添加组件引用对象
|
|
10
|
+
* @param pageContext 页面运行时对象
|
|
11
|
+
* @param componentIndex 对象ID
|
|
12
|
+
* @param refObj 引用对象
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare function addComponentRef(pageContext: PageContext, componentUuid: string, refObj: any): any;
|
|
16
|
+
/**
|
|
17
|
+
* 添加组件引用对象
|
|
18
|
+
* @param pageContext 页面运行时对象
|
|
19
|
+
* @param componentIndex 对象ID
|
|
20
|
+
* @param refObj 引用对象
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare function addComponentRefByCode(pageContext: PageContext, componentCode: string, refObj: any): any;
|
|
24
|
+
/**
|
|
25
|
+
* 获取组件引用对象
|
|
26
|
+
* @param pageDesign 页面设计对象
|
|
27
|
+
* @param componentIndex 对象ID
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
export declare function getComponentRef(pageContext: PageContext, componentUuid: string): any;
|
|
31
|
+
/**
|
|
32
|
+
* 根据编码获取组件引用对象
|
|
33
|
+
* @param pageDesign 页面设计对象
|
|
34
|
+
* @param componentCode 对象code
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
export declare function getComponentRefByCode(pageContext: PageContext, componentCode: string): any;
|
|
38
|
+
/**
|
|
39
|
+
* 移除组件引用对象
|
|
40
|
+
* @param pageDesign 页面设计对象
|
|
41
|
+
* @param componentIndex 对象ID
|
|
42
|
+
* @param refObj 引用对象
|
|
43
|
+
* @returns
|
|
44
|
+
*/
|
|
45
|
+
export declare function removeComponentRef(pageContext: PageContext, componentUuid: string): any;
|
|
46
|
+
/**
|
|
47
|
+
* 移除页面所有引用
|
|
48
|
+
* @param pageDesign 页面设计对象
|
|
49
|
+
* @param componentIndex 对象ID
|
|
50
|
+
* @param refObj 引用对象
|
|
51
|
+
* @returns
|
|
52
|
+
*/
|
|
53
|
+
export declare function removePageAllRef(pageContext: PageContext): void;
|
|
54
|
+
/**
|
|
55
|
+
* 初始化页面引用对象
|
|
56
|
+
* @param pageCode
|
|
57
|
+
* @param pageVersion
|
|
58
|
+
*/
|
|
59
|
+
export declare function initComponentRefState(pageContext: PageContext): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
require("vue");
|
|
4
|
+
if (!window["globalRefs"]) {
|
|
5
|
+
window["globalRefs"] = {};
|
|
6
|
+
}
|
|
7
|
+
const globalRefs = window["globalRefs"];
|
|
8
|
+
function addComponentRef(pageContext, componentUuid, refObj) {
|
|
9
|
+
if (!pageContext) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const cacheKey = getPageRefKey(pageContext.code, pageContext.version);
|
|
13
|
+
if (!globalRefs[cacheKey]) {
|
|
14
|
+
globalRefs[cacheKey] = {};
|
|
15
|
+
}
|
|
16
|
+
globalRefs[cacheKey][componentUuid] = refObj;
|
|
17
|
+
return globalRefs[cacheKey];
|
|
18
|
+
}
|
|
19
|
+
function addComponentRefByCode(pageContext, componentCode, refObj) {
|
|
20
|
+
if (!pageContext) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const cacheKey = getPageRefKeyByCode(pageContext.code, pageContext.version);
|
|
24
|
+
if (!globalRefs[cacheKey]) {
|
|
25
|
+
globalRefs[cacheKey] = {};
|
|
26
|
+
}
|
|
27
|
+
globalRefs[cacheKey][componentCode] = refObj;
|
|
28
|
+
return globalRefs[cacheKey];
|
|
29
|
+
}
|
|
30
|
+
function getComponentRef(pageContext, componentUuid) {
|
|
31
|
+
if (!pageContext || !componentUuid) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const cacheKey = getPageRefKey(pageContext.code, pageContext.version);
|
|
35
|
+
if (!globalRefs[cacheKey]) {
|
|
36
|
+
globalRefs[cacheKey] = {};
|
|
37
|
+
}
|
|
38
|
+
const objRef = globalRefs[cacheKey][componentUuid];
|
|
39
|
+
return objRef ? objRef.value : objRef;
|
|
40
|
+
}
|
|
41
|
+
function removePageAllRef(pageContext) {
|
|
42
|
+
if (!pageContext) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const cacheKey = getPageRefKey(pageContext.code, pageContext.version);
|
|
46
|
+
globalRefs[cacheKey] = {};
|
|
47
|
+
}
|
|
48
|
+
function initComponentRefState(pageContext) {
|
|
49
|
+
if (!pageContext) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const cacheKey = getPageRefKey(pageContext.code, pageContext.version);
|
|
53
|
+
globalRefs[cacheKey] = {};
|
|
54
|
+
}
|
|
55
|
+
function getPageRefKey(pageCode, pageVersion) {
|
|
56
|
+
return "pageRuntimeRef-" + pageCode + "-" + (pageVersion ? pageVersion : 1);
|
|
57
|
+
}
|
|
58
|
+
function getPageRefKeyByCode(pageCode, pageVersion) {
|
|
59
|
+
return getPageRefKey(pageCode, pageVersion) + "-code";
|
|
60
|
+
}
|
|
61
|
+
exports.addComponentRef = addComponentRef;
|
|
62
|
+
exports.addComponentRefByCode = addComponentRefByCode;
|
|
63
|
+
exports.getComponentRef = getComponentRef;
|
|
64
|
+
exports.initComponentRefState = initComponentRefState;
|
|
65
|
+
exports.removePageAllRef = removePageAllRef;
|