super-page-runtime 2.0.43-beta3 → 2.0.43-beta4
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.
|
@@ -7,6 +7,14 @@ import { analysisCondition } from "agilebuilder-ui/src/utils/util";
|
|
|
7
7
|
import { getListCode } from "../common-util.js";
|
|
8
8
|
import eventBus from "../eventBus.js";
|
|
9
9
|
import { getValueFromSource } from "../page-helper-util.js";
|
|
10
|
+
const skipValidateEvents = [
|
|
11
|
+
"downloadTemplate",
|
|
12
|
+
"back",
|
|
13
|
+
"exportForm",
|
|
14
|
+
"exportPDF",
|
|
15
|
+
"lineEditCreate",
|
|
16
|
+
"workflowSave"
|
|
17
|
+
];
|
|
10
18
|
function initPageEvents(pageDesign, pageContext) {
|
|
11
19
|
if (pageDesign && pageDesign.customEvents) {
|
|
12
20
|
const customEvents = transferToFunction(pageDesign.customEvents);
|
|
@@ -184,13 +192,20 @@ function buttonClickEvent(pageContext, configure, eventParams) {
|
|
|
184
192
|
}
|
|
185
193
|
function doValidateForm(pageContext, configure, eventParams) {
|
|
186
194
|
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
195
|
+
let isEnableRequired = true;
|
|
187
196
|
const clickEventFunObj = getClickEventFuncByType(pageContext, events, "click");
|
|
188
197
|
if (clickEventFunObj) {
|
|
189
198
|
const isStandardEvent = clickEventFunObj.isStandard;
|
|
190
199
|
const event = clickEventFunObj.event;
|
|
191
|
-
isNotNeedValidateRequired(isStandardEvent, event);
|
|
200
|
+
const isNotNeedValidate = isNotNeedValidateRequired(isStandardEvent, event);
|
|
201
|
+
if (isNotNeedValidate) {
|
|
202
|
+
isEnableRequired = false;
|
|
203
|
+
}
|
|
192
204
|
}
|
|
193
|
-
validateDataModelFunc(pageContext, configure,
|
|
205
|
+
validateDataModelFunc(pageContext, configure, isEnableRequired).then((validateReslut) => {
|
|
206
|
+
if (!validateReslut) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
194
209
|
const beforeClickResult = doBeforeClickEvent(pageContext, configure, eventParams);
|
|
195
210
|
if (!beforeClickResult) {
|
|
196
211
|
return;
|
|
@@ -271,7 +286,7 @@ function isNotDoAfterClick(isStandardEvent, clickEvent) {
|
|
|
271
286
|
return isStandardEvent && (clickEvent.eventName === "exportForm" || clickEvent.eventName === "exportPDF" || clickEvent.eventName === "import" || clickEvent.eventName === "assign" || clickEvent.eventName === "copyTask" || clickEvent.eventName === "addSigner" || clickEvent.eventName === "returnTaskTo" || clickEvent.eventName === "removeSigner");
|
|
272
287
|
}
|
|
273
288
|
function isNotNeedValidateRequired(isStandardEvent, clickEvent) {
|
|
274
|
-
return isStandardEvent && (clickEvent.eventName
|
|
289
|
+
return isStandardEvent && skipValidateEvents.includes(clickEvent.eventName);
|
|
275
290
|
}
|
|
276
291
|
function doAfterClickEvent(pageContext, configure, otherParams) {
|
|
277
292
|
const events = configure.runtime && configure.runtime.events ? configure.runtime.events : [];
|
|
@@ -149,16 +149,26 @@ function validateDataModelFunc(pageContext, configureObj, isEnableRequired) {
|
|
|
149
149
|
const pageModel = pageContext.entity.page;
|
|
150
150
|
const data = { ...pageModel, ...dataModel };
|
|
151
151
|
const rules = pageContext.rules;
|
|
152
|
+
if (isEnableRequired === void 0 || isEnableRequired === null) {
|
|
153
|
+
isEnableRequired = configureObj.props.verification ? configureObj.props.verification.required : false;
|
|
154
|
+
if (typeof isEnableRequired === "undefined") {
|
|
155
|
+
isEnableRequired = false;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
152
158
|
return validateDataModel(isEnableRequired, data, rules, pageContext);
|
|
153
159
|
}
|
|
154
160
|
function validateDataModel(isEnableRequired, dataModel, rules, pageContext) {
|
|
155
|
-
{
|
|
161
|
+
if (isEnableRequired) {
|
|
156
162
|
const isWorkflow = pageContext.workflowCode ? true : false;
|
|
157
163
|
if (isWorkflow) {
|
|
158
164
|
return validateWorkflowFormDataModel(dataModel, pageContext);
|
|
159
165
|
} else {
|
|
160
166
|
return validateCommonFormDataModel(dataModel, pageContext, rules);
|
|
161
167
|
}
|
|
168
|
+
} else {
|
|
169
|
+
return new Promise((resolve, reject) => {
|
|
170
|
+
resolve(true);
|
|
171
|
+
});
|
|
162
172
|
}
|
|
163
173
|
}
|
|
164
174
|
function validateWorkflowFormDataModel(dataModel, pageContext) {
|