super-page-runtime 2.0.66 → 2.0.69
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.
|
@@ -3,6 +3,7 @@ import { ElMessage } from "element-plus";
|
|
|
3
3
|
import { getComponentRef } from "../global-refs.js";
|
|
4
4
|
import { getI18n } from "agilebuilder-ui/src/utils/util";
|
|
5
5
|
import { getAdditionalParamMap } from "./standard-event.js";
|
|
6
|
+
import { isPromise } from "agilebuilder-ui/src/utils/common-util";
|
|
6
7
|
function setObjectPropRule(prop, rules, leafRule) {
|
|
7
8
|
const rule = {};
|
|
8
9
|
if (!rules) {
|
|
@@ -276,7 +277,18 @@ function validateCommonFormDataModel(dataModel, pageContext, rules) {
|
|
|
276
277
|
if (Object.keys(handleModels).indexOf("validateErrorField") >= 0) {
|
|
277
278
|
delete handleModels.validateErrorField;
|
|
278
279
|
}
|
|
279
|
-
|
|
280
|
+
const customRuleResult = validateCustomRuleEvents(pageContext);
|
|
281
|
+
if (customRuleResult && isPromise(customRuleResult)) {
|
|
282
|
+
customRuleResult.then((result) => {
|
|
283
|
+
if (result) {
|
|
284
|
+
resolve(handleModels);
|
|
285
|
+
} else {
|
|
286
|
+
resolve(false);
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
} else {
|
|
290
|
+
resolve(handleModels);
|
|
291
|
+
}
|
|
280
292
|
} else {
|
|
281
293
|
reject(
|
|
282
294
|
new Error(
|
|
@@ -407,6 +419,48 @@ function getWorkflowRules(pageContext) {
|
|
|
407
419
|
workflowFieldPermissionRules = packageCustomRules(customRules, workflowFieldPermissionRules);
|
|
408
420
|
return workflowFieldPermissionRules;
|
|
409
421
|
}
|
|
422
|
+
function validateCustomRuleEvents(pageContext) {
|
|
423
|
+
const result = [];
|
|
424
|
+
if (pageContext.customRuleEvents && pageContext.customRuleEvents.length > 0) {
|
|
425
|
+
pageContext.customRuleEvents.forEach((event) => {
|
|
426
|
+
event.events.forEach((eventName) => {
|
|
427
|
+
const eventFun = pageContext.customEvents[eventName];
|
|
428
|
+
result.push(eventFun.apply(eventFun, [{ prop: event.prop, pageContext }]));
|
|
429
|
+
});
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
if (result && result.length > 0) {
|
|
433
|
+
return new Promise((resolve, reject) => {
|
|
434
|
+
const promiseResults = [];
|
|
435
|
+
const booleanResults = [];
|
|
436
|
+
result.forEach((validateResult) => {
|
|
437
|
+
if (isPromise(validateResult)) {
|
|
438
|
+
promiseResults.push(validateResult);
|
|
439
|
+
} else {
|
|
440
|
+
booleanResults.push(validateResult);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
if (booleanResults.includes(false)) {
|
|
444
|
+
resolve(false);
|
|
445
|
+
}
|
|
446
|
+
if (promiseResults.length > 0) {
|
|
447
|
+
Promise.all(promiseResults).then((values) => {
|
|
448
|
+
if (values.includes(false)) {
|
|
449
|
+
resolve(false);
|
|
450
|
+
} else {
|
|
451
|
+
resolve(true);
|
|
452
|
+
}
|
|
453
|
+
}).catch((error) => {
|
|
454
|
+
console.error(error);
|
|
455
|
+
resolve(false);
|
|
456
|
+
});
|
|
457
|
+
} else {
|
|
458
|
+
resolve(true);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
return null;
|
|
463
|
+
}
|
|
410
464
|
export {
|
|
411
465
|
getWorkflowRules,
|
|
412
466
|
i18nValidateRulesMessage,
|
|
@@ -227,7 +227,7 @@ function queryPageSuperGrids(pageDesign, pageContext, publishVersion) {
|
|
|
227
227
|
);
|
|
228
228
|
}
|
|
229
229
|
function packageFormRules(pageContext, configure) {
|
|
230
|
-
var _a;
|
|
230
|
+
var _a, _b;
|
|
231
231
|
const isWorkflow = pageContext.workflowCode ? true : false;
|
|
232
232
|
if (isWorkflow) {
|
|
233
233
|
if (configure.name !== "button-detail" && pageContext.fieldPermissionMap) {
|
|
@@ -265,6 +265,15 @@ function packageFormRules(pageContext, configure) {
|
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
+
if ((_b = configure.props) == null ? void 0 : _b.customRuleEvents) {
|
|
269
|
+
if (!pageContext.customRuleEvents) {
|
|
270
|
+
pageContext.customRuleEvents = [];
|
|
271
|
+
}
|
|
272
|
+
pageContext.customRuleEvents.push({
|
|
273
|
+
prop: propName,
|
|
274
|
+
events: configure.props.customRuleEvents
|
|
275
|
+
});
|
|
276
|
+
}
|
|
268
277
|
}
|
|
269
278
|
}
|
|
270
279
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "super-page-runtime",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.69",
|
|
4
4
|
"description": "AgileBuilder super page runtime",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"main": "dist/es/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
49
49
|
"@vue/eslint-config-prettier": "^8.0.0",
|
|
50
50
|
"@vue/test-utils": "^2.4.4",
|
|
51
|
-
"agilebuilder-ui": "1.0.
|
|
51
|
+
"agilebuilder-ui": "1.0.50",
|
|
52
52
|
"axios": "^1.6.8",
|
|
53
53
|
"cypress": "^13.6.6",
|
|
54
54
|
"element-plus": "^2.6.1",
|