cloud-web-corejs 1.0.54-dev.201 → 1.0.54-dev.203
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/package.json +1 -1
- package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +21 -32
- package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
- package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +8 -3
- package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -0
- package/src/components/xform/utils/util.js +660 -1018
- package/src/layout/components/watermark/index.vue +7 -1
- package/src/views/bd/setting/bd_attach_setting/edit.vue +2 -2
- package/src/views/bd/setting/bd_attach_setting/mixins/list.js +2 -2
- package/src/views/bd/setting/form_import_log/edit.vue +2 -2
- package/src/views/bd/setting/form_script/edit.vue +2 -2
- package/src/views/bd/setting/form_script/edit1.vue +2 -2
- package/src/views/bd/setting/form_script/mixins/form_list.js +2 -2
- package/src/views/bd/setting/form_script/mixins/list.js +2 -2
- package/src/views/bd/setting/form_script/mixins/list1.js +2 -2
- package/src/views/bd/setting/form_template/edit.vue +2 -2
- package/src/views/bd/setting/form_template/mixins/list.js +2 -2
- package/src/views/bd/setting/table_model/mixins/list.js +2 -2
@@ -1,44 +1,52 @@
|
|
1
|
-
import Clipboard from
|
2
|
-
import axios from
|
3
|
-
import request from
|
4
|
-
import {decode} from "js-base64";
|
1
|
+
import Clipboard from "clipboard";
|
2
|
+
import axios from "axios";
|
3
|
+
import request from "../../../utils/request.js";
|
4
|
+
import { decode } from "js-base64";
|
5
5
|
|
6
6
|
export function getAccessUrl() {
|
7
|
-
return SUPPORT_PREFIX +
|
7
|
+
return SUPPORT_PREFIX + "/report_ins/getData";
|
8
8
|
}
|
9
9
|
|
10
10
|
export function isNull(value) {
|
11
|
-
return
|
11
|
+
return value === null || value === undefined;
|
12
12
|
}
|
13
13
|
|
14
14
|
export function isNotNull(value) {
|
15
|
-
return
|
15
|
+
return value !== null && value !== undefined;
|
16
16
|
}
|
17
17
|
|
18
18
|
export function isEmptyStr(str) {
|
19
19
|
//return (str === undefined) || (!str) || (!/[^\s]/.test(str));
|
20
|
-
return (
|
20
|
+
return (
|
21
|
+
str === undefined ||
|
22
|
+
(!str && str !== 0 && str !== "0") ||
|
23
|
+
!/[^\s]/.test(str)
|
24
|
+
);
|
21
25
|
}
|
22
26
|
|
23
27
|
export const generateId = function () {
|
24
|
-
return Math.floor(
|
28
|
+
return Math.floor(
|
29
|
+
Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000
|
30
|
+
);
|
25
31
|
};
|
26
32
|
|
27
33
|
export const createUUID = function () {
|
28
|
-
return
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
|
35
|
+
.replace(/[xy]/g, function (c) {
|
36
|
+
var r = (Math.random() * 16) | 0,
|
37
|
+
v = c == "x" ? r : (r & 0x3) | 0x8;
|
38
|
+
return v.toString(16);
|
39
|
+
})
|
40
|
+
.replaceAll("-", "");
|
33
41
|
};
|
34
42
|
|
35
43
|
export const deepClone = function (origin) {
|
36
44
|
if (origin === undefined) {
|
37
|
-
return undefined
|
45
|
+
return undefined;
|
38
46
|
}
|
39
47
|
|
40
|
-
return JSON.parse(JSON.stringify(origin))
|
41
|
-
}
|
48
|
+
return JSON.parse(JSON.stringify(origin));
|
49
|
+
};
|
42
50
|
|
43
51
|
export const overwriteObj = function (obj1, obj2) {
|
44
52
|
/* 浅拷贝对象属性,obj2覆盖obj1 */
|
@@ -48,46 +56,48 @@ export const overwriteObj = function (obj1, obj2) {
|
|
48
56
|
// }
|
49
57
|
// }
|
50
58
|
|
51
|
-
Object.keys(obj2).forEach(prop => {
|
52
|
-
obj1[prop] = obj2[prop]
|
53
|
-
})
|
54
|
-
}
|
59
|
+
Object.keys(obj2).forEach((prop) => {
|
60
|
+
obj1[prop] = obj2[prop];
|
61
|
+
});
|
62
|
+
};
|
55
63
|
|
56
64
|
export const addWindowResizeHandler = function (handler) {
|
57
|
-
let oldHandler = window.onresize
|
58
|
-
if (typeof window.onresize !=
|
59
|
-
window.onresize = handler
|
65
|
+
let oldHandler = window.onresize;
|
66
|
+
if (typeof window.onresize != "function") {
|
67
|
+
window.onresize = handler;
|
60
68
|
} else {
|
61
69
|
window.onresize = function () {
|
62
|
-
oldHandler()
|
63
|
-
handler()
|
64
|
-
}
|
70
|
+
oldHandler();
|
71
|
+
handler();
|
72
|
+
};
|
65
73
|
}
|
66
|
-
}
|
74
|
+
};
|
67
75
|
|
68
76
|
const createStyleSheet = function () {
|
69
|
-
let head = document.head || document.getElementsByTagName(
|
70
|
-
let style = document.createElement(
|
71
|
-
style.type =
|
77
|
+
let head = document.head || document.getElementsByTagName("head")[0];
|
78
|
+
let style = document.createElement("style");
|
79
|
+
style.type = "text/css";
|
72
80
|
head.appendChild(style);
|
73
81
|
return style.sheet;
|
74
|
-
}
|
82
|
+
};
|
75
83
|
|
76
|
-
export const insertCustomCssToHead = function (cssCode, formId =
|
77
|
-
let head = document.getElementsByTagName(
|
78
|
-
let oldStyle = document.getElementById(
|
84
|
+
export const insertCustomCssToHead = function (cssCode, formId = "") {
|
85
|
+
let head = document.getElementsByTagName("head")[0];
|
86
|
+
let oldStyle = document.getElementById("vform-custom-css");
|
79
87
|
if (!!oldStyle) {
|
80
88
|
head.removeChild(oldStyle); //先清除后插入!!
|
81
89
|
}
|
82
90
|
if (!!formId) {
|
83
|
-
oldStyle = document.getElementById(
|
91
|
+
oldStyle = document.getElementById("vform-custom-css" + "-" + formId);
|
84
92
|
!!oldStyle && head.removeChild(oldStyle); //先清除后插入!!
|
85
93
|
}
|
86
94
|
|
87
|
-
let newStyle = document.createElement(
|
88
|
-
newStyle.type =
|
89
|
-
newStyle.rel =
|
90
|
-
newStyle.id = !!formId
|
95
|
+
let newStyle = document.createElement("style");
|
96
|
+
newStyle.type = "text/css";
|
97
|
+
newStyle.rel = "stylesheet";
|
98
|
+
newStyle.id = !!formId
|
99
|
+
? "vform-custom-css" + "-" + formId
|
100
|
+
: "vform-custom-css";
|
91
101
|
try {
|
92
102
|
newStyle.appendChild(document.createTextNode(cssCode));
|
93
103
|
} catch (ex) {
|
@@ -95,204 +105,201 @@ export const insertCustomCssToHead = function (cssCode, formId = '') {
|
|
95
105
|
}
|
96
106
|
|
97
107
|
head.appendChild(newStyle);
|
98
|
-
}
|
108
|
+
};
|
99
109
|
|
100
|
-
export const insertGlobalFunctionsToHtml = function (
|
101
|
-
|
102
|
-
|
110
|
+
export const insertGlobalFunctionsToHtml = function (
|
111
|
+
functionsCode,
|
112
|
+
formId = ""
|
113
|
+
) {
|
114
|
+
let bodyEle = document.getElementsByTagName("body")[0];
|
115
|
+
let oldScriptEle = document.getElementById("v_form_global_functions");
|
103
116
|
!!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!
|
104
117
|
if (!!formId) {
|
105
|
-
oldScriptEle = document.getElementById(
|
118
|
+
oldScriptEle = document.getElementById(
|
119
|
+
"v_form_global_functions" + "-" + formId
|
120
|
+
);
|
106
121
|
!!oldScriptEle && bodyEle.removeChild(oldScriptEle); //先清除后插入!!
|
107
122
|
}
|
108
123
|
|
109
|
-
let newScriptEle = document.createElement(
|
110
|
-
newScriptEle.id = !!formId
|
111
|
-
|
124
|
+
let newScriptEle = document.createElement("script");
|
125
|
+
newScriptEle.id = !!formId
|
126
|
+
? "v_form_global_functions" + "-" + formId
|
127
|
+
: "v_form_global_functions";
|
128
|
+
newScriptEle.type = "text/javascript";
|
112
129
|
newScriptEle.innerHTML = functionsCode;
|
113
130
|
bodyEle.appendChild(newScriptEle);
|
114
|
-
}
|
131
|
+
};
|
115
132
|
|
116
133
|
export const optionExists = function (optionsObj, optionName) {
|
117
134
|
if (!optionsObj) {
|
118
|
-
return false
|
135
|
+
return false;
|
119
136
|
}
|
120
137
|
|
121
|
-
return Object.keys(optionsObj).indexOf(optionName) > -1
|
122
|
-
}
|
138
|
+
return Object.keys(optionsObj).indexOf(optionName) > -1;
|
139
|
+
};
|
123
140
|
|
124
141
|
export const loadRemoteScript = function (srcPath, callback) {
|
125
142
|
/*加载远程js,加载成功后执行回调函数*/
|
126
|
-
let sid = encodeURIComponent(srcPath)
|
127
|
-
let oldScriptEle = document.getElementById(sid)
|
143
|
+
let sid = encodeURIComponent(srcPath);
|
144
|
+
let oldScriptEle = document.getElementById(sid);
|
128
145
|
|
129
146
|
if (!oldScriptEle) {
|
130
|
-
let s = document.createElement(
|
131
|
-
s.src = srcPath
|
132
|
-
s.id = sid
|
133
|
-
document.body.appendChild(s)
|
147
|
+
let s = document.createElement("script");
|
148
|
+
s.src = srcPath;
|
149
|
+
s.id = sid;
|
150
|
+
document.body.appendChild(s);
|
134
151
|
|
135
152
|
s.onload = s.onreadystatechange = function (_, isAbort) {
|
136
153
|
/* 借鉴自ace.js */
|
137
|
-
if (
|
138
|
-
|
154
|
+
if (
|
155
|
+
isAbort ||
|
156
|
+
!s.readyState ||
|
157
|
+
s.readyState === "loaded" ||
|
158
|
+
s.readyState === "complete"
|
159
|
+
) {
|
160
|
+
s = s.onload = s.onreadystatechange = null;
|
139
161
|
if (!isAbort) {
|
140
|
-
callback()
|
162
|
+
callback();
|
141
163
|
}
|
142
164
|
}
|
143
|
-
}
|
165
|
+
};
|
166
|
+
}
|
167
|
+
};
|
168
|
+
|
169
|
+
export function traverseFieldWidgets(
|
170
|
+
widgetList,
|
171
|
+
handler,
|
172
|
+
parent = null,
|
173
|
+
staticWidgetsIncluded
|
174
|
+
) {
|
175
|
+
if (!widgetList) {
|
176
|
+
return;
|
144
177
|
}
|
145
|
-
}
|
146
178
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
} else if (w.
|
172
|
-
|
173
|
-
|
174
|
-
traverseFieldWidgets(w.widgetList, handler, w)
|
179
|
+
widgetList.forEach((w) => {
|
180
|
+
if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
|
181
|
+
handler(w, parent);
|
182
|
+
} else if (w.type === "grid") {
|
183
|
+
w.cols.forEach((col) => {
|
184
|
+
traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);
|
185
|
+
});
|
186
|
+
} else if (w.type === "table") {
|
187
|
+
w.rows.forEach((row) => {
|
188
|
+
row.cols.forEach((cell) => {
|
189
|
+
traverseFieldWidgets(
|
190
|
+
cell.widgetList,
|
191
|
+
handler,
|
192
|
+
w,
|
193
|
+
staticWidgetsIncluded
|
194
|
+
);
|
195
|
+
});
|
196
|
+
});
|
197
|
+
} else if (w.type === "tab") {
|
198
|
+
w.tabs.forEach((tab) => {
|
199
|
+
traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);
|
200
|
+
});
|
201
|
+
} else if (w.type === "sub-form" || w.type === "grid-sub-form") {
|
202
|
+
traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
|
203
|
+
} else if (w.category === "container") {
|
204
|
+
//自定义容器
|
205
|
+
traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
|
175
206
|
}
|
176
|
-
})
|
207
|
+
});
|
177
208
|
}
|
178
209
|
|
179
|
-
export function
|
180
|
-
widgetList
|
181
|
-
|
182
|
-
|
183
|
-
|
210
|
+
export function traverseContainerWidgets(
|
211
|
+
widgetList,
|
212
|
+
handler,
|
213
|
+
skipDialogAndDrawer
|
214
|
+
) {
|
215
|
+
if (!widgetList) {
|
216
|
+
return;
|
217
|
+
}
|
184
218
|
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
}
|
195
|
-
} else if (w.type === 'h5-table') {
|
196
|
-
w.rows.forEach(row => {
|
197
|
-
row.cols.forEach(cell => {
|
198
|
-
traverseContainWidgets(cell.widgetList, handler)
|
199
|
-
})
|
200
|
-
})
|
201
|
-
} else if (w.type === 'tab') {
|
202
|
-
w.tabs.forEach(tab => {
|
203
|
-
traverseContainWidgets(tab.widgetList, handler)
|
204
|
-
})
|
205
|
-
} else if (w.type === 'sub-form') {
|
206
|
-
traverseContainWidgets(w.widgetList, handler)
|
207
|
-
} else if (w.category === 'container') { //自定义容器
|
208
|
-
traverseContainWidgets(w.widgetList, handler)
|
219
|
+
widgetList.forEach((w) => {
|
220
|
+
if (w.category === "container") {
|
221
|
+
if (
|
222
|
+
skipDialogAndDrawer &&
|
223
|
+
(w.type === "vf-dialog" || w.type === "vf-drawer")
|
224
|
+
) {
|
225
|
+
//什么也不做
|
226
|
+
} else {
|
227
|
+
handler(w);
|
228
|
+
}
|
209
229
|
}
|
210
|
-
})
|
211
|
-
}
|
212
230
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
231
|
+
if (w.type === "grid") {
|
232
|
+
w.cols.forEach((col) => {
|
233
|
+
traverseContainerWidgets(col.widgetList, handler);
|
234
|
+
});
|
235
|
+
} else if (w.type === "table") {
|
236
|
+
w.rows.forEach((row) => {
|
237
|
+
row.cols.forEach((cell) => {
|
238
|
+
traverseContainerWidgets(cell.widgetList, handler);
|
239
|
+
});
|
240
|
+
});
|
241
|
+
} else if (w.type === "tab") {
|
242
|
+
w.tabs.forEach((tab) => {
|
243
|
+
traverseContainerWidgets(tab.widgetList, handler);
|
244
|
+
});
|
245
|
+
} else if (w.type === "sub-form" || w.type === "grid-sub-form") {
|
246
|
+
traverseContainerWidgets(w.widgetList, handler);
|
247
|
+
} else if (w.category === "container") {
|
248
|
+
//自定义容器
|
249
|
+
if (
|
250
|
+
skipDialogAndDrawer &&
|
251
|
+
(w.type === "vf-dialog" || w.type === "vf-drawer")
|
252
|
+
) {
|
253
|
+
//什么也不做
|
254
|
+
} else {
|
255
|
+
traverseContainerWidgets(w.widgetList, handler);
|
256
|
+
}
|
232
257
|
}
|
233
|
-
)
|
234
|
-
}
|
235
|
-
|
236
|
-
let itemFieldMap = {
|
237
|
-
grid: "cols",
|
238
|
-
table: "rows",
|
239
|
-
'h5-table': "rows",
|
240
|
-
tab: "tabs",
|
241
|
-
"detail": "panes",
|
242
|
-
"detail-h5": "panes",
|
243
|
-
"h5-card": "panes",
|
258
|
+
});
|
244
259
|
}
|
245
260
|
|
246
261
|
export function traverseAllWidgets(widgetList, handler) {
|
247
|
-
if (!widgetList)
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
handler
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
} else if (w.
|
273
|
-
|
274
|
-
|
275
|
-
handler(cell)
|
276
|
-
traverseAllWidgets(cell.widgetList, handler)
|
277
|
-
})
|
278
|
-
})
|
279
|
-
} else if (w.type === 'tab') {
|
280
|
-
w.tabs.forEach(tab => {
|
281
|
-
traverseAllWidgets(tab.widgetList, handler)
|
282
|
-
})
|
283
|
-
} else if (w.type === 'sub-form') {
|
284
|
-
traverseAllWidgets(w.widgetList, handler)
|
285
|
-
} else if (w.category === 'container') { //自定义容器
|
286
|
-
traverseAllWidgets(w.widgetList, handler)
|
262
|
+
if (!widgetList) {
|
263
|
+
return;
|
264
|
+
}
|
265
|
+
|
266
|
+
widgetList.forEach((w) => {
|
267
|
+
handler(w);
|
268
|
+
|
269
|
+
if (w.type === "grid") {
|
270
|
+
w.cols.forEach((col) => {
|
271
|
+
handler(col);
|
272
|
+
traverseAllWidgets(col.widgetList, handler);
|
273
|
+
});
|
274
|
+
} else if (w.type === "table") {
|
275
|
+
w.rows.forEach((row) => {
|
276
|
+
row.cols.forEach((cell) => {
|
277
|
+
handler(cell);
|
278
|
+
traverseAllWidgets(cell.widgetList, handler);
|
279
|
+
});
|
280
|
+
});
|
281
|
+
} else if (w.type === "tab") {
|
282
|
+
w.tabs.forEach((tab) => {
|
283
|
+
traverseAllWidgets(tab.widgetList, handler);
|
284
|
+
});
|
285
|
+
} else if (w.type === "sub-form" || w.type === "grid-sub-form") {
|
286
|
+
traverseAllWidgets(w.widgetList, handler);
|
287
|
+
} else if (w.category === "container") {
|
288
|
+
//自定义容器
|
289
|
+
traverseAllWidgets(w.widgetList, handler);
|
287
290
|
}
|
288
|
-
})
|
291
|
+
});
|
289
292
|
}
|
290
293
|
|
291
|
-
function handleWidgetForTraverse(
|
292
|
-
|
293
|
-
|
294
|
+
function handleWidgetForTraverse(
|
295
|
+
widget,
|
296
|
+
handler,
|
297
|
+
staticWidgetsIncluded = false
|
298
|
+
) {
|
299
|
+
if (!!widget.category && widget.category === "container") {
|
300
|
+
traverseFieldWidgetsOfContainer(widget, handler);
|
294
301
|
} else if (widget.formItemFlag) {
|
295
|
-
handler(widget)
|
302
|
+
handler(widget);
|
296
303
|
}
|
297
304
|
}
|
298
305
|
|
@@ -300,149 +307,323 @@ function handleWidgetForTraverse(widget, handler) {
|
|
300
307
|
* 遍历容器内的字段组件
|
301
308
|
* @param con
|
302
309
|
* @param handler
|
310
|
+
* @param staticWidgetsIncluded
|
303
311
|
*/
|
304
|
-
export function traverseFieldWidgetsOfContainer(
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
})
|
323
|
-
} else if (con.type ===
|
324
|
-
con.
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
312
|
+
export function traverseFieldWidgetsOfContainer(
|
313
|
+
con,
|
314
|
+
handler,
|
315
|
+
staticWidgetsIncluded = false
|
316
|
+
) {
|
317
|
+
if (con.type === "grid") {
|
318
|
+
con.cols.forEach((col) => {
|
319
|
+
col.widgetList.forEach((cw) => {
|
320
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
321
|
+
});
|
322
|
+
});
|
323
|
+
} else if (con.type === "table") {
|
324
|
+
con.rows.forEach((row) => {
|
325
|
+
row.cols.forEach((cell) => {
|
326
|
+
cell.widgetList.forEach((cw) => {
|
327
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
328
|
+
});
|
329
|
+
});
|
330
|
+
});
|
331
|
+
} else if (con.type === "tab") {
|
332
|
+
con.tabs.forEach((tab) => {
|
333
|
+
tab.widgetList.forEach((cw) => {
|
334
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
335
|
+
});
|
336
|
+
});
|
337
|
+
} else if (con.type === "sub-form" || con.type === "grid-sub-form") {
|
338
|
+
con.widgetList.forEach((cw) => {
|
339
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
340
|
+
});
|
341
|
+
} else if (con.category === "container") {
|
342
|
+
//自定义容器
|
343
|
+
con.widgetList.forEach((cw) => {
|
344
|
+
handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
|
345
|
+
});
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
function handleContainerTraverse(
|
350
|
+
widget,
|
351
|
+
fieldHandler,
|
352
|
+
containerHandler,
|
353
|
+
internalContainerCallFlag,
|
354
|
+
staticWidgetsIncluded
|
355
|
+
) {
|
356
|
+
if (!!widget.category && widget.category === "container") {
|
357
|
+
traverseWidgetsOfContainer(
|
358
|
+
widget,
|
359
|
+
fieldHandler,
|
360
|
+
containerHandler,
|
361
|
+
internalContainerCallFlag,
|
362
|
+
staticWidgetsIncluded
|
363
|
+
);
|
364
|
+
} else if (widget.formItemFlag) {
|
365
|
+
fieldHandler(widget);
|
366
|
+
} else if (staticWidgetsIncluded) {
|
367
|
+
fieldHandler(widget);
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
/**
|
372
|
+
* 遍历容器内部的字段组件和容器组件
|
373
|
+
* @param con
|
374
|
+
* @param fieldHandler
|
375
|
+
* @param containerHandler
|
376
|
+
* @param internalContainerCallFlag 是否需要处理内部容器组件,默认不处理
|
377
|
+
* @param staticWidgetsIncluded 是否需要处理静态非表单交互类组件
|
378
|
+
*/
|
379
|
+
export function traverseWidgetsOfContainer(
|
380
|
+
con,
|
381
|
+
fieldHandler,
|
382
|
+
containerHandler,
|
383
|
+
internalContainerCallFlag,
|
384
|
+
staticWidgetsIncluded
|
385
|
+
) {
|
386
|
+
if (con.category === "container") {
|
387
|
+
containerHandler(con);
|
388
|
+
}
|
389
|
+
|
390
|
+
if (con.type === "grid") {
|
391
|
+
con.cols.forEach((col) => {
|
392
|
+
if (internalContainerCallFlag) {
|
393
|
+
containerHandler(col);
|
394
|
+
}
|
395
|
+
col.widgetList.forEach((cw) => {
|
396
|
+
handleContainerTraverse(
|
397
|
+
cw,
|
398
|
+
fieldHandler,
|
399
|
+
containerHandler,
|
400
|
+
internalContainerCallFlag,
|
401
|
+
staticWidgetsIncluded
|
402
|
+
);
|
403
|
+
});
|
404
|
+
});
|
405
|
+
} else if (con.type === "table") {
|
406
|
+
con.rows.forEach((row) => {
|
407
|
+
if (internalContainerCallFlag) {
|
408
|
+
containerHandler(row);
|
409
|
+
}
|
410
|
+
row.cols.forEach((cell) => {
|
411
|
+
if (internalContainerCallFlag) {
|
412
|
+
containerHandler(cell);
|
413
|
+
}
|
414
|
+
cell.widgetList.forEach((cw) => {
|
415
|
+
handleContainerTraverse(
|
416
|
+
cw,
|
417
|
+
fieldHandler,
|
418
|
+
containerHandler,
|
419
|
+
internalContainerCallFlag,
|
420
|
+
staticWidgetsIncluded
|
421
|
+
);
|
422
|
+
});
|
423
|
+
});
|
424
|
+
});
|
425
|
+
} else if (con.type === "tab") {
|
426
|
+
con.tabs.forEach((tab) => {
|
427
|
+
if (internalContainerCallFlag) {
|
428
|
+
containerHandler(tab);
|
429
|
+
}
|
430
|
+
tab.widgetList.forEach((cw) => {
|
431
|
+
handleContainerTraverse(
|
432
|
+
cw,
|
433
|
+
fieldHandler,
|
434
|
+
containerHandler,
|
435
|
+
internalContainerCallFlag,
|
436
|
+
staticWidgetsIncluded
|
437
|
+
);
|
438
|
+
});
|
439
|
+
});
|
440
|
+
} else if (con.type === "sub-form" || con.type === "grid-sub-form") {
|
441
|
+
con.widgetList.forEach((cw) => {
|
442
|
+
handleContainerTraverse(
|
443
|
+
cw,
|
444
|
+
fieldHandler,
|
445
|
+
containerHandler,
|
446
|
+
internalContainerCallFlag,
|
447
|
+
staticWidgetsIncluded
|
448
|
+
);
|
449
|
+
});
|
450
|
+
} else if (con.category === "container") {
|
451
|
+
//自定义容器
|
452
|
+
con.widgetList.forEach((cw) => {
|
453
|
+
handleContainerTraverse(
|
454
|
+
cw,
|
455
|
+
fieldHandler,
|
456
|
+
containerHandler,
|
457
|
+
internalContainerCallFlag,
|
458
|
+
staticWidgetsIncluded
|
459
|
+
);
|
460
|
+
});
|
461
|
+
}
|
462
|
+
}
|
463
|
+
|
464
|
+
export function traverseWidgetsOfGridCol(
|
465
|
+
gridCol,
|
466
|
+
fieldHandler,
|
467
|
+
containerHandler
|
468
|
+
) {
|
469
|
+
// if (gridCol.category === 'container') {
|
470
|
+
// containerHandler(gridCol)
|
471
|
+
// }
|
472
|
+
|
473
|
+
if (gridCol.type === "grid-col") {
|
474
|
+
gridCol.widgetList.forEach((cw) => {
|
475
|
+
handleContainerTraverse(cw, fieldHandler, containerHandler);
|
476
|
+
});
|
353
477
|
}
|
354
478
|
}
|
355
479
|
|
356
480
|
/**
|
357
481
|
* 获取所有字段组件
|
358
482
|
* @param widgetList
|
483
|
+
* @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含
|
359
484
|
* @returns {[]}
|
360
485
|
*/
|
361
|
-
export function getAllFieldWidgets(widgetList) {
|
362
|
-
|
486
|
+
export function getAllFieldWidgets(widgetList, staticWidgetsIncluded) {
|
487
|
+
if (!widgetList) {
|
488
|
+
return [];
|
489
|
+
}
|
490
|
+
|
491
|
+
let result = [];
|
363
492
|
let handlerFn = (w) => {
|
364
493
|
result.push({
|
365
494
|
type: w.type,
|
366
495
|
name: w.options.name,
|
367
|
-
field: w
|
368
|
-
})
|
369
|
-
}
|
370
|
-
traverseFieldWidgets(widgetList, handlerFn)
|
496
|
+
field: w,
|
497
|
+
});
|
498
|
+
};
|
499
|
+
traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
|
371
500
|
|
372
|
-
return result
|
501
|
+
return result;
|
373
502
|
}
|
374
503
|
|
375
504
|
/**
|
376
505
|
* 获取所有容器组件
|
377
506
|
* @param widgetList
|
507
|
+
* @param skipDialogAndDrawer 是否跳过弹窗和抽屉内部组件,默认不跳过
|
378
508
|
* @returns {[]}
|
379
509
|
*/
|
380
|
-
export function getAllContainerWidgets(widgetList) {
|
381
|
-
|
510
|
+
export function getAllContainerWidgets(widgetList, skipDialogAndDrawer) {
|
511
|
+
if (!widgetList) {
|
512
|
+
return [];
|
513
|
+
}
|
514
|
+
|
515
|
+
let result = [];
|
382
516
|
let handlerFn = (w) => {
|
383
517
|
result.push({
|
384
518
|
type: w.type,
|
385
519
|
name: w.options.name,
|
386
|
-
container: w
|
387
|
-
})
|
520
|
+
container: w,
|
521
|
+
});
|
522
|
+
};
|
523
|
+
traverseContainerWidgets(widgetList, handlerFn, skipDialogAndDrawer);
|
524
|
+
|
525
|
+
return result;
|
526
|
+
}
|
527
|
+
|
528
|
+
export function getFieldWidgetByName(
|
529
|
+
widgetList,
|
530
|
+
fieldName,
|
531
|
+
staticWidgetsIncluded
|
532
|
+
) {
|
533
|
+
if (!widgetList) {
|
534
|
+
return null;
|
388
535
|
}
|
389
|
-
traverseContainWidgets(widgetList, handlerFn)
|
390
536
|
|
391
|
-
|
537
|
+
let foundWidget = null;
|
538
|
+
let handlerFn = (widget) => {
|
539
|
+
if (widget.options.name === fieldName) {
|
540
|
+
foundWidget = widget;
|
541
|
+
}
|
542
|
+
};
|
543
|
+
|
544
|
+
traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
|
545
|
+
return foundWidget;
|
392
546
|
}
|
393
547
|
|
394
|
-
export function
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
548
|
+
export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
|
549
|
+
if (!widgetList) {
|
550
|
+
return null;
|
551
|
+
}
|
552
|
+
|
553
|
+
let foundWidget = null;
|
554
|
+
let handlerFn = (widget) => {
|
555
|
+
if (widget.id === fieldId) {
|
556
|
+
foundWidget = widget;
|
557
|
+
}
|
558
|
+
};
|
559
|
+
|
560
|
+
traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
|
561
|
+
return foundWidget;
|
401
562
|
}
|
402
563
|
|
403
|
-
export function getContainerWidgetByName(
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
564
|
+
export function getContainerWidgetByName(widgetList, containerName) {
|
565
|
+
if (!widgetList) {
|
566
|
+
return null;
|
567
|
+
}
|
568
|
+
|
569
|
+
let foundContainer = null;
|
570
|
+
let handlerFn = (con) => {
|
571
|
+
if (con.options.name === containerName) {
|
572
|
+
foundContainer = con;
|
573
|
+
}
|
574
|
+
};
|
575
|
+
|
576
|
+
traverseContainerWidgets(widgetList, handlerFn);
|
577
|
+
return foundContainer;
|
410
578
|
}
|
411
579
|
|
412
|
-
export function getContainerWidgetById(
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
580
|
+
export function getContainerWidgetById(widgetList, containerId) {
|
581
|
+
if (!widgetList) {
|
582
|
+
return null;
|
583
|
+
}
|
584
|
+
|
585
|
+
let foundContainer = null;
|
586
|
+
let handlerFn = (con) => {
|
587
|
+
if (con.id === containerId) {
|
588
|
+
foundContainer = con;
|
589
|
+
}
|
590
|
+
};
|
591
|
+
|
592
|
+
traverseContainerWidgets(widgetList, handlerFn);
|
593
|
+
return foundContainer;
|
419
594
|
}
|
420
595
|
|
421
|
-
export function copyToClipboard(
|
596
|
+
export function copyToClipboard(
|
597
|
+
content,
|
598
|
+
clickEvent,
|
599
|
+
$message,
|
600
|
+
successMsg,
|
601
|
+
errorMsg
|
602
|
+
) {
|
422
603
|
const clipboard = new Clipboard(clickEvent.target, {
|
423
|
-
text: () => content
|
424
|
-
})
|
604
|
+
text: () => content,
|
605
|
+
});
|
425
606
|
|
426
|
-
clipboard.on(
|
427
|
-
$message.success(successMsg)
|
428
|
-
clipboard.destroy()
|
429
|
-
})
|
607
|
+
clipboard.on("success", () => {
|
608
|
+
$message.success(successMsg);
|
609
|
+
clipboard.destroy();
|
610
|
+
});
|
430
611
|
|
431
|
-
clipboard.on(
|
432
|
-
$message.error(errorMsg)
|
433
|
-
clipboard.destroy()
|
434
|
-
})
|
612
|
+
clipboard.on("error", () => {
|
613
|
+
$message.error(errorMsg);
|
614
|
+
clipboard.destroy();
|
615
|
+
});
|
435
616
|
|
436
|
-
clipboard.onClick(clickEvent)
|
617
|
+
clipboard.onClick(clickEvent);
|
437
618
|
}
|
438
619
|
|
439
620
|
export function getQueryParam(variable) {
|
440
621
|
let query = window.location.search.substring(1);
|
441
|
-
let vars = query.split("&")
|
622
|
+
let vars = query.split("&");
|
442
623
|
for (let i = 0; i < vars.length; i++) {
|
443
|
-
let pair = vars[i].split("=")
|
624
|
+
let pair = vars[i].split("=");
|
444
625
|
if (pair[0] == variable) {
|
445
|
-
return pair[1]
|
626
|
+
return pair[1];
|
446
627
|
}
|
447
628
|
}
|
448
629
|
|
@@ -469,7 +650,7 @@ export function getDefaultFormConfig() {
|
|
469
650
|
onFormDataChange: "",
|
470
651
|
gridConfig: {
|
471
652
|
accessReturnType: 1,
|
472
|
-
isLoadDataByAccess: false
|
653
|
+
isLoadDataByAccess: false,
|
473
654
|
},
|
474
655
|
getConfig: {
|
475
656
|
accessType: "1",
|
@@ -477,7 +658,7 @@ export function getDefaultFormConfig() {
|
|
477
658
|
accessParam: null,
|
478
659
|
accessCallback: null,
|
479
660
|
scriptName: null,
|
480
|
-
scriptCode: null
|
661
|
+
scriptCode: null,
|
481
662
|
},
|
482
663
|
saveConfig: {
|
483
664
|
accessType: "1",
|
@@ -485,7 +666,7 @@ export function getDefaultFormConfig() {
|
|
485
666
|
accessParam: null,
|
486
667
|
accessCallback: null,
|
487
668
|
scriptName: null,
|
488
|
-
scriptCode: null
|
669
|
+
scriptCode: null,
|
489
670
|
},
|
490
671
|
scriptList: [],
|
491
672
|
formType: 0,
|
@@ -503,36 +684,38 @@ export function getDefaultFormConfig() {
|
|
503
684
|
formScriptSuccess: null,
|
504
685
|
saveScriptCode: "saveUpdate",
|
505
686
|
wfConfig: null,
|
506
|
-
wfStartBindSave: false
|
507
|
-
}
|
687
|
+
wfStartBindSave: false,
|
688
|
+
};
|
508
689
|
}
|
509
690
|
|
510
691
|
export function buildDefaultFormJson() {
|
511
692
|
return {
|
512
693
|
widgetList: [],
|
513
|
-
formConfig: deepClone(getDefaultFormConfig())
|
514
|
-
}
|
694
|
+
formConfig: deepClone(getDefaultFormConfig()),
|
695
|
+
};
|
515
696
|
}
|
516
697
|
|
517
698
|
export function cloneFormConfigWithoutEventHandler(e) {
|
518
699
|
var t = deepClone(e);
|
519
|
-
return
|
520
|
-
t.onFormMounted = "",
|
521
|
-
|
522
|
-
t
|
700
|
+
return (
|
701
|
+
(t.onFormCreated = ""), (t.onFormMounted = ""), (t.onFormDataChange = ""), t
|
702
|
+
);
|
523
703
|
}
|
524
704
|
|
525
705
|
export function translateOptionItems(e, t, i, n) {
|
526
|
-
if ("cascader" === t)
|
527
|
-
return deepClone(e);
|
706
|
+
if ("cascader" === t) return deepClone(e);
|
528
707
|
var o = [];
|
529
|
-
return
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
708
|
+
return (
|
709
|
+
e &&
|
710
|
+
e.length > 0 &&
|
711
|
+
e.forEach(function (e) {
|
712
|
+
o.push({
|
713
|
+
[i]: e[i],
|
714
|
+
[n]: e[n],
|
715
|
+
});
|
716
|
+
}),
|
535
717
|
o
|
718
|
+
);
|
536
719
|
}
|
537
720
|
|
538
721
|
export function assembleAxiosConfig(arrayObj, DSV, VFR) {
|
@@ -540,15 +723,17 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
|
|
540
723
|
if (arrayObj && arrayObj.length) {
|
541
724
|
arrayObj.map(function (ai) {
|
542
725
|
if ("String" === ai.type) {
|
543
|
-
result[ai.name] = String(ai.value)
|
726
|
+
result[ai.name] = String(ai.value);
|
544
727
|
} else if ("Number" === ai.type) {
|
545
|
-
result[ai.name] = Number(ai.value)
|
728
|
+
result[ai.name] = Number(ai.value);
|
546
729
|
} else if ("Boolean" === ai.type) {
|
547
|
-
"false" === ai.value
|
548
|
-
|
549
|
-
|
730
|
+
"false" === ai.value.toLowerCase() || "0" === ai.value
|
731
|
+
? (result[ai.name] = !1)
|
732
|
+
: "true" === ai.value.toLowerCase() || "1" === ai.value
|
733
|
+
? (result[ai.name] = !0)
|
734
|
+
: (result[ai.name] = null);
|
550
735
|
} else if ("Variable" === ai.type) {
|
551
|
-
result[ai.name] = eval(ai.value)
|
736
|
+
result[ai.name] = eval(ai.value);
|
552
737
|
} else if ("FormData" === ai.type) {
|
553
738
|
if (VFR.formDataModel.hasOwnProperty(ai.value)) {
|
554
739
|
result[ai.name] = VFR.formDataModel[ai.value];
|
@@ -559,7 +744,7 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
|
|
559
744
|
}
|
560
745
|
}
|
561
746
|
}
|
562
|
-
})
|
747
|
+
});
|
563
748
|
}
|
564
749
|
return result;
|
565
750
|
|
@@ -585,14 +770,14 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
|
|
585
770
|
let requestAccess = DSV.requestAccess;
|
586
771
|
// config.url = dataSource.requestURL;
|
587
772
|
config.url = getAccessUrl();
|
588
|
-
config.method = dataSource.requestMethod || "post",
|
589
|
-
config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR),
|
590
|
-
config.params = assembleAxiosConfig(dataSource.params, DSV, VFR);
|
773
|
+
(config.method = dataSource.requestMethod || "post"),
|
774
|
+
(config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR)),
|
775
|
+
(config.params = assembleAxiosConfig(dataSource.params, DSV, VFR));
|
591
776
|
// config.data = assembleAxiosConfig(dataSource.data, DSV, VFR);
|
592
777
|
let data = {};
|
593
778
|
let conditions = assembleAxiosConfig(dataSource.data, DSV, VFR);
|
594
779
|
|
595
|
-
let globalReqData = getReportGlobalMap()
|
780
|
+
let globalReqData = getReportGlobalMap(); //全局请求参数
|
596
781
|
Object.assign(conditions, globalReqData);
|
597
782
|
|
598
783
|
let doms = VFR.getWidgetRef(DSV.widgetName);
|
@@ -619,20 +804,39 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
|
|
619
804
|
} */
|
620
805
|
|
621
806
|
config.data = data;
|
622
|
-
var chFn = new Function(
|
623
|
-
|
807
|
+
var chFn = new Function(
|
808
|
+
"config",
|
809
|
+
"isSandbox",
|
810
|
+
"DSV",
|
811
|
+
"VFR",
|
812
|
+
dataSource.configHandlerCode
|
813
|
+
);
|
814
|
+
return chFn.call(null, config, isSandbox, DSV, VFR);
|
624
815
|
}
|
625
816
|
|
626
817
|
export function runDataSourceRequest(e, t, i, n, o) {
|
627
|
-
return _runDataSourceRequest.apply(this, arguments)
|
818
|
+
return _runDataSourceRequest.apply(this, arguments);
|
628
819
|
}
|
629
820
|
|
630
821
|
export function _runDataSourceRequest() {
|
631
822
|
let _runDataSourceRequestN = function (t, i, n, o, a) {
|
632
823
|
var l, s, r, d;
|
633
|
-
l = buildRequestConfig(t, i, n, o),
|
634
|
-
r = new Function(
|
635
|
-
|
824
|
+
(l = buildRequestConfig(t, i, n, o)),
|
825
|
+
(r = new Function(
|
826
|
+
"result",
|
827
|
+
"isSandbox",
|
828
|
+
"DSV",
|
829
|
+
"VFR",
|
830
|
+
t.dataHandlerCode
|
831
|
+
)),
|
832
|
+
(d = new Function(
|
833
|
+
"error",
|
834
|
+
"isSandbox",
|
835
|
+
"DSV",
|
836
|
+
"$message",
|
837
|
+
"VFR",
|
838
|
+
t.errorHandlerCode
|
839
|
+
));
|
636
840
|
|
637
841
|
/*
|
638
842
|
axios.request(l).then(() => {
|
@@ -645,13 +849,13 @@ export function _runDataSourceRequest() {
|
|
645
849
|
request({
|
646
850
|
...l,
|
647
851
|
callback: (res) => {
|
648
|
-
resolve(r.call(null, res, o, i, n))
|
852
|
+
resolve(r.call(null, res, o, i, n));
|
649
853
|
},
|
650
854
|
error: (error) => {
|
651
855
|
d.call(null, error, o, i, a, n);
|
652
856
|
reject(error);
|
653
|
-
}
|
654
|
-
})
|
857
|
+
},
|
858
|
+
});
|
655
859
|
});
|
656
860
|
|
657
861
|
/* return s = e.sent,
|
@@ -661,7 +865,7 @@ export function _runDataSourceRequest() {
|
|
661
865
|
d = new Function("error","isSandbox","DSV","$message","VFR",t.errorHandlerCode),
|
662
866
|
d.call(null, null, o, i, a, n), */
|
663
867
|
};
|
664
|
-
return _runDataSourceRequestN.apply(this, arguments)
|
868
|
+
return _runDataSourceRequestN.apply(this, arguments);
|
665
869
|
/* return _runDataSourceRequest = Object(D_dev2021_variant_form_pro_node_modules_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_0__["a"])(regeneratorRuntime.mark((function e(t, i, n, o, a) {
|
666
870
|
var l, s, r, d;
|
667
871
|
return regeneratorRuntime.wrap((function(e) {
|
@@ -695,10 +899,14 @@ export function _runDataSourceRequest() {
|
|
695
899
|
|
696
900
|
export function getDSByName(e, t) {
|
697
901
|
var i = null;
|
698
|
-
return
|
699
|
-
|
700
|
-
|
902
|
+
return (
|
903
|
+
t &&
|
904
|
+
e.dataSources &&
|
905
|
+
e.dataSources.forEach(function (e) {
|
906
|
+
e.uniqueName === t && (i = e);
|
907
|
+
}),
|
701
908
|
i
|
909
|
+
);
|
702
910
|
}
|
703
911
|
|
704
912
|
export function setReportGlobalParam(value) {
|
@@ -720,10 +928,10 @@ export function getSubFormNameByFieldId(o, e) {
|
|
720
928
|
const c = (u) => {
|
721
929
|
u.id === e && (n = s.name);
|
722
930
|
};
|
723
|
-
(s.type === "sub-form" || s.type === "grid-sub-form")
|
724
|
-
|
931
|
+
(s.type === "sub-form" || s.type === "grid-sub-form") &&
|
932
|
+
traverseFieldWidgetsOfContainer(s.container, c);
|
725
933
|
}),
|
726
|
-
|
934
|
+
n
|
727
935
|
);
|
728
936
|
}
|
729
937
|
|
@@ -739,46 +947,30 @@ export function fieldIsUsedInFormula(o, e, n) {
|
|
739
947
|
if (u.substring(0, u.length - 2) === "func") return;
|
740
948
|
const g = c.split(".")[0],
|
741
949
|
y = g.substring(2, g.length);
|
742
|
-
getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options
|
743
|
-
|
950
|
+
getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options.name === o &&
|
951
|
+
(s = !0);
|
744
952
|
}),
|
745
|
-
|
746
|
-
);
|
747
|
-
}
|
748
|
-
|
749
|
-
export function getFieldWidgetById(o, e, n) {
|
750
|
-
if (!o) return null;
|
751
|
-
let l = null;
|
752
|
-
return (
|
753
|
-
traverseFieldWidgets(
|
754
|
-
o,
|
755
|
-
(c) => {
|
756
|
-
c.id === e && (l = c);
|
757
|
-
},
|
758
|
-
null,
|
759
|
-
n
|
760
|
-
),
|
761
|
-
l
|
953
|
+
s
|
762
954
|
);
|
763
955
|
}
|
764
956
|
|
765
957
|
export function calculateFormula(o, e, n, l, s) {
|
766
958
|
if (
|
767
|
-
!!l.subFormItemFlag
|
768
|
-
|
769
|
-
|
959
|
+
!!l.subFormItemFlag &&
|
960
|
+
!!s.subFormItemFlag &&
|
961
|
+
s.subFormRowId !== l.subFormRowId
|
770
962
|
)
|
771
963
|
return;
|
772
964
|
let c = l.field.options.formula;
|
773
965
|
c = replaceFieldsAndFunctionsOfFormula(o, l);
|
774
966
|
const u = c.match(/[A-Za-z]*/g);
|
775
|
-
u
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
967
|
+
u &&
|
968
|
+
u.forEach((g) => {
|
969
|
+
if (!!g && findCalFunStartIndex(g) !== -1) {
|
970
|
+
const y = g.toUpperCase();
|
971
|
+
c = c.replace(g, "formulaJs." + y);
|
972
|
+
}
|
973
|
+
}),
|
782
974
|
console.log("formula: ", c),
|
783
975
|
console.log("formulaFieldRef: ", l);
|
784
976
|
const $ = evalFn(c, e, o, n);
|
@@ -808,10 +1000,8 @@ export function replaceFieldsAndFunctionsOfFormula(o, e) {
|
|
808
1000
|
const w = o.getSubFormNameOfWidget(f.options.name);
|
809
1001
|
if (e.subFormItemFlag)
|
810
1002
|
w === e.subFormName
|
811
|
-
? ((v = o.getWidgetRef(
|
812
|
-
|
813
|
-
)),
|
814
|
-
v && (s = s.replaceAll(c, v.getValue())))
|
1003
|
+
? ((v = o.getWidgetRef(f.options.name + "@row" + e.subFormRowId)),
|
1004
|
+
v && (s = s.replaceAll(c, v.getValue())))
|
815
1005
|
: console.error("Invalid formula!");
|
816
1006
|
else {
|
817
1007
|
const _ = o.formDataModel[w];
|
@@ -825,7 +1015,7 @@ export function replaceFieldsAndFunctionsOfFormula(o, e) {
|
|
825
1015
|
}
|
826
1016
|
}
|
827
1017
|
}),
|
828
|
-
|
1018
|
+
s
|
829
1019
|
);
|
830
1020
|
}
|
831
1021
|
|
@@ -952,11 +1142,8 @@ export function trimEx(o, e, n) {
|
|
952
1142
|
? n === "left"
|
953
1143
|
? o.replace(new RegExp("^%%" + e + "+", "g"), "")
|
954
1144
|
: n === "right"
|
955
|
-
|
956
|
-
|
957
|
-
new RegExp("^%%" + e + "+|%%" + e + "+$", "g"),
|
958
|
-
""
|
959
|
-
)
|
1145
|
+
? o.replace(new RegExp("%%" + e + "+$", "g"), "")
|
1146
|
+
: o.replace(new RegExp("^%%" + e + "+|%%" + e + "+$", "g"), "")
|
960
1147
|
: o.replace(/^%s+|%s+$/g, "");
|
961
1148
|
}
|
962
1149
|
|
@@ -980,652 +1167,107 @@ export function objectKeysToArray(o) {
|
|
980
1167
|
Object.keys(o).forEach((n) => {
|
981
1168
|
e.push(n);
|
982
1169
|
}),
|
983
|
-
|
1170
|
+
e
|
984
1171
|
);
|
985
1172
|
}
|
986
1173
|
|
987
1174
|
//begin
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
return this.viewState.viewport;
|
994
|
-
}
|
995
|
-
get visibleRanges() {
|
996
|
-
return this.viewState.visibleRanges;
|
997
|
-
}
|
998
|
-
get inView() {
|
999
|
-
return this.viewState.inView;
|
1000
|
-
}
|
1001
|
-
get composing() {
|
1002
|
-
return this.inputState.composing > 0;
|
1003
|
-
}
|
1004
|
-
get compositionStarted() {
|
1005
|
-
return this.inputState.composing >= 0;
|
1006
|
-
}
|
1007
|
-
get root() {
|
1008
|
-
return this._root;
|
1009
|
-
}
|
1010
|
-
get win() {
|
1011
|
-
return this.dom.ownerDocument.defaultView || window;
|
1012
|
-
}
|
1013
|
-
constructor(e = {}) {
|
1014
|
-
(this.plugins = []),
|
1015
|
-
(this.pluginMap = new Map()),
|
1016
|
-
(this.editorAttrs = {}),
|
1017
|
-
(this.contentAttrs = {}),
|
1018
|
-
(this.bidiCache = []),
|
1019
|
-
(this.destroyed = !1),
|
1020
|
-
(this.updateState = 2),
|
1021
|
-
(this.measureScheduled = -1),
|
1022
|
-
(this.measureRequests = []),
|
1023
|
-
(this.contentDOM = document.createElement("div")),
|
1024
|
-
(this.scrollDOM = document.createElement("div")),
|
1025
|
-
(this.scrollDOM.tabIndex = -1),
|
1026
|
-
(this.scrollDOM.className = "cm-scroller"),
|
1027
|
-
this.scrollDOM.appendChild(this.contentDOM),
|
1028
|
-
(this.announceDOM = document.createElement("div")),
|
1029
|
-
(this.announceDOM.style.cssText =
|
1030
|
-
"position: fixed; top: -10000px"),
|
1031
|
-
this.announceDOM.setAttribute("aria-live", "polite"),
|
1032
|
-
(this.dom = document.createElement("div")),
|
1033
|
-
this.dom.appendChild(this.announceDOM),
|
1034
|
-
this.dom.appendChild(this.scrollDOM);
|
1035
|
-
let { dispatch: n } = e;
|
1036
|
-
(this.dispatchTransactions =
|
1037
|
-
e.dispatchTransactions ||
|
1038
|
-
(n && ((l) => l.forEach((s) => n(s, this)))) ||
|
1039
|
-
((l) => this.update(l))),
|
1040
|
-
(this.dispatch = this.dispatch.bind(this)),
|
1041
|
-
(this._root = e.root || getRoot(e.parent) || document),
|
1042
|
-
(this.viewState = new ViewState(
|
1043
|
-
e.state || EditorState.create(e)
|
1044
|
-
)),
|
1045
|
-
(this.plugins = this.state
|
1046
|
-
.facet(viewPlugin)
|
1047
|
-
.map((l) => new PluginInstance(l)));
|
1048
|
-
for (let l of this.plugins) l.update(this);
|
1049
|
-
(this.observer = new DOMObserver(this)),
|
1050
|
-
(this.inputState = new InputState(this)),
|
1051
|
-
this.inputState.ensureHandlers(this.plugins),
|
1052
|
-
(this.docView = new DocView(this)),
|
1053
|
-
this.mountStyles(),
|
1054
|
-
this.updateAttrs(),
|
1055
|
-
(this.updateState = 0),
|
1056
|
-
this.requestMeasure(),
|
1057
|
-
e.parent && e.parent.appendChild(this.dom);
|
1058
|
-
}
|
1059
|
-
dispatch(...e) {
|
1060
|
-
let n =
|
1061
|
-
e.length == 1 && e[0] instanceof Transaction
|
1062
|
-
? e
|
1063
|
-
: e.length == 1 && Array.isArray(e[0])
|
1064
|
-
? e[0]
|
1065
|
-
: [this.state.update(...e)];
|
1066
|
-
this.dispatchTransactions(n, this);
|
1067
|
-
}
|
1068
|
-
update(e) {
|
1069
|
-
if (this.updateState != 0)
|
1070
|
-
throw new Error(
|
1071
|
-
"Calls to EditorView.update are not allowed while an update is in progress"
|
1072
|
-
);
|
1073
|
-
let n = !1,
|
1074
|
-
l = !1,
|
1075
|
-
s,
|
1076
|
-
c = this.state;
|
1077
|
-
for (let w of e) {
|
1078
|
-
if (w.startState != c)
|
1079
|
-
throw new RangeError(
|
1080
|
-
"Trying to update state with a transaction that doesn't start from the previous state."
|
1081
|
-
);
|
1082
|
-
c = w.state;
|
1083
|
-
}
|
1084
|
-
if (this.destroyed) {
|
1085
|
-
this.viewState.state = c;
|
1086
|
-
return;
|
1087
|
-
}
|
1088
|
-
let u = this.hasFocus,
|
1089
|
-
$ = 0,
|
1090
|
-
g = null;
|
1091
|
-
e.some((w) => w.annotation(isFocusChange))
|
1092
|
-
? ((this.inputState.notifiedFocused = u), ($ = 1))
|
1093
|
-
: u != this.inputState.notifiedFocused &&
|
1094
|
-
((this.inputState.notifiedFocused = u),
|
1095
|
-
(g = focusChangeTransaction(c, u)),
|
1096
|
-
g || ($ = 1));
|
1097
|
-
let y = this.observer.delayedAndroidKey,
|
1098
|
-
f = null;
|
1099
|
-
if (
|
1100
|
-
(y
|
1101
|
-
? (this.observer.clearDelayedAndroidKey(),
|
1102
|
-
(f = this.observer.readChange()),
|
1103
|
-
((f && !this.state.doc.eq(c.doc)) ||
|
1104
|
-
!this.state.selection.eq(c.selection)) &&
|
1105
|
-
(f = null))
|
1106
|
-
: this.observer.clear(),
|
1107
|
-
c.facet(EditorState.phrases) !=
|
1108
|
-
this.state.facet(EditorState.phrases))
|
1109
|
-
)
|
1110
|
-
return this.setState(c);
|
1111
|
-
(s = ViewUpdate.create(this, c, e)), (s.flags |= $);
|
1112
|
-
let v = this.viewState.scrollTarget;
|
1113
|
-
try {
|
1114
|
-
this.updateState = 2;
|
1115
|
-
for (let w of e) {
|
1116
|
-
if ((v && (v = v.map(w.changes)), w.scrollIntoView)) {
|
1117
|
-
let { main: _ } = w.state.selection;
|
1118
|
-
v = new ScrollTarget(
|
1119
|
-
_.empty
|
1120
|
-
? _
|
1121
|
-
: EditorSelection.cursor(
|
1122
|
-
_.head,
|
1123
|
-
_.head > _.anchor ? -1 : 1
|
1124
|
-
)
|
1125
|
-
);
|
1126
|
-
}
|
1127
|
-
for (let _ of w.effects)
|
1128
|
-
_.is(scrollIntoView$1) && (v = _.value);
|
1129
|
-
}
|
1130
|
-
this.viewState.update(s, v),
|
1131
|
-
(this.bidiCache = CachedOrder.update(
|
1132
|
-
this.bidiCache,
|
1133
|
-
s.changes
|
1134
|
-
)),
|
1135
|
-
s.empty ||
|
1136
|
-
(this.updatePlugins(s), this.inputState.update(s)),
|
1137
|
-
(n = this.docView.update(s)),
|
1138
|
-
this.state.facet(styleModule) != this.styleModules &&
|
1139
|
-
this.mountStyles(),
|
1140
|
-
(l = this.updateAttrs()),
|
1141
|
-
this.showAnnouncements(e),
|
1142
|
-
this.docView.updateSelection(
|
1143
|
-
n,
|
1144
|
-
e.some((w) => w.isUserEvent("select.pointer"))
|
1145
|
-
);
|
1146
|
-
} finally {
|
1147
|
-
this.updateState = 0;
|
1148
|
-
}
|
1149
|
-
if (
|
1150
|
-
(s.startState.facet(theme) != s.state.facet(theme) &&
|
1151
|
-
(this.viewState.mustMeasureContent = !0),
|
1152
|
-
(n ||
|
1153
|
-
l ||
|
1154
|
-
v ||
|
1155
|
-
this.viewState.mustEnforceCursorAssoc ||
|
1156
|
-
this.viewState.mustMeasureContent) &&
|
1157
|
-
this.requestMeasure(),
|
1158
|
-
!s.empty)
|
1159
|
-
)
|
1160
|
-
for (let w of this.state.facet(updateListener)) w(s);
|
1161
|
-
(g || f) &&
|
1162
|
-
Promise.resolve().then(() => {
|
1163
|
-
g && this.state == g.startState && this.dispatch(g),
|
1164
|
-
f &&
|
1165
|
-
!applyDOMChange(this, f) &&
|
1166
|
-
y.force &&
|
1167
|
-
dispatchKey(this.contentDOM, y.key, y.keyCode);
|
1175
|
+
function loopHandleWidget(widgetList, callback) {
|
1176
|
+
widgetList &&
|
1177
|
+
widgetList.length > 0 &&
|
1178
|
+
widgetList.forEach(function (e) {
|
1179
|
+
loopHandleWidgetItem(e, null, callback);
|
1168
1180
|
});
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
this.updateState = 2;
|
1180
|
-
let n = this.hasFocus;
|
1181
|
-
try {
|
1182
|
-
for (let l of this.plugins) l.destroy(this);
|
1183
|
-
(this.viewState = new ViewState(e)),
|
1184
|
-
(this.plugins = e
|
1185
|
-
.facet(viewPlugin)
|
1186
|
-
.map((l) => new PluginInstance(l))),
|
1187
|
-
this.pluginMap.clear();
|
1188
|
-
for (let l of this.plugins) l.update(this);
|
1189
|
-
(this.docView = new DocView(this)),
|
1190
|
-
this.inputState.ensureHandlers(this.plugins),
|
1191
|
-
this.mountStyles(),
|
1192
|
-
this.updateAttrs(),
|
1193
|
-
(this.bidiCache = []);
|
1194
|
-
} finally {
|
1195
|
-
this.updateState = 0;
|
1196
|
-
}
|
1197
|
-
n && this.focus(), this.requestMeasure();
|
1198
|
-
}
|
1199
|
-
updatePlugins(e) {
|
1200
|
-
let n = e.startState.facet(viewPlugin),
|
1201
|
-
l = e.state.facet(viewPlugin);
|
1202
|
-
if (n != l) {
|
1203
|
-
let s = [];
|
1204
|
-
for (let c of l) {
|
1205
|
-
let u = n.indexOf(c);
|
1206
|
-
if (u < 0) s.push(new PluginInstance(c));
|
1207
|
-
else {
|
1208
|
-
let $ = this.plugins[u];
|
1209
|
-
($.mustUpdate = e), s.push($);
|
1210
|
-
}
|
1181
|
+
}
|
1182
|
+
function loopHandleWidgetItem(e, p, callback) {
|
1183
|
+
if ("container" === e.category) {
|
1184
|
+
callback(e, p);
|
1185
|
+
if ("vf-dialog" === e.type || "vf-drawer" === e.type);
|
1186
|
+
else if ("data-table" === e.type) {
|
1187
|
+
if (!!e.widgetList) {
|
1188
|
+
e.widgetList.forEach((childItem) => {
|
1189
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1190
|
+
});
|
1211
1191
|
}
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
for (let s = 0; s < this.plugins.length; s++)
|
1217
|
-
this.plugins[s].update(this);
|
1218
|
-
n != l && this.inputState.ensureHandlers(this.plugins);
|
1219
|
-
}
|
1220
|
-
measure(e = !0) {
|
1221
|
-
if (this.destroyed) return;
|
1222
|
-
if (
|
1223
|
-
(this.measureScheduled > -1 &&
|
1224
|
-
this.win.cancelAnimationFrame(this.measureScheduled),
|
1225
|
-
this.observer.delayedAndroidKey)
|
1226
|
-
) {
|
1227
|
-
(this.measureScheduled = -1), this.requestMeasure();
|
1228
|
-
return;
|
1229
|
-
}
|
1230
|
-
(this.measureScheduled = 0), e && this.observer.forceFlush();
|
1231
|
-
let n = null,
|
1232
|
-
l = this.scrollDOM,
|
1233
|
-
s = l.scrollTop * this.scaleY,
|
1234
|
-
{ scrollAnchorPos: c, scrollAnchorHeight: u } = this.viewState;
|
1235
|
-
Math.abs(s - this.viewState.scrollTop) > 1 && (u = -1),
|
1236
|
-
(this.viewState.scrollAnchorHeight = -1);
|
1237
|
-
try {
|
1238
|
-
for (let $ = 0; ; $++) {
|
1239
|
-
if (u < 0)
|
1240
|
-
if (isScrolledToBottom(l))
|
1241
|
-
(c = -1), (u = this.viewState.heightMap.height);
|
1242
|
-
else {
|
1243
|
-
let _ = this.viewState.scrollAnchorAt(s);
|
1244
|
-
(c = _.from), (u = _.top);
|
1245
|
-
}
|
1246
|
-
this.updateState = 1;
|
1247
|
-
let g = this.viewState.measure(this);
|
1248
|
-
if (
|
1249
|
-
!g &&
|
1250
|
-
!this.measureRequests.length &&
|
1251
|
-
this.viewState.scrollTarget == null
|
1252
|
-
)
|
1253
|
-
break;
|
1254
|
-
if ($ > 5) {
|
1255
|
-
console.warn(
|
1256
|
-
this.measureRequests.length
|
1257
|
-
? "Measure loop restarted more than 5 times"
|
1258
|
-
: "Viewport failed to stabilize"
|
1259
|
-
);
|
1260
|
-
break;
|
1261
|
-
}
|
1262
|
-
let y = [];
|
1263
|
-
g & 4 ||
|
1264
|
-
([this.measureRequests, y] = [y, this.measureRequests]);
|
1265
|
-
let f = y.map((_) => {
|
1266
|
-
try {
|
1267
|
-
return _.read(this);
|
1268
|
-
} catch (O) {
|
1269
|
-
return logException(this.state, O), BadMeasure;
|
1270
|
-
}
|
1271
|
-
}),
|
1272
|
-
v = ViewUpdate.create(this, this.state, []),
|
1273
|
-
w = !1;
|
1274
|
-
(v.flags |= g),
|
1275
|
-
n ? (n.flags |= g) : (n = v),
|
1276
|
-
(this.updateState = 2),
|
1277
|
-
v.empty ||
|
1278
|
-
(this.updatePlugins(v),
|
1279
|
-
this.inputState.update(v),
|
1280
|
-
this.updateAttrs(),
|
1281
|
-
(w = this.docView.update(v)));
|
1282
|
-
for (let _ = 0; _ < y.length; _++)
|
1283
|
-
if (f[_] != BadMeasure)
|
1284
|
-
try {
|
1285
|
-
let O = y[_];
|
1286
|
-
O.write && O.write(f[_], this);
|
1287
|
-
} catch (O) {
|
1288
|
-
logException(this.state, O);
|
1289
|
-
}
|
1290
|
-
if (
|
1291
|
-
(w && this.docView.updateSelection(!0),
|
1292
|
-
!v.viewportChanged && this.measureRequests.length == 0)
|
1293
|
-
) {
|
1294
|
-
if (this.viewState.editorHeight)
|
1295
|
-
if (this.viewState.scrollTarget) {
|
1296
|
-
this.docView.scrollIntoView(
|
1297
|
-
this.viewState.scrollTarget
|
1298
|
-
),
|
1299
|
-
(this.viewState.scrollTarget = null);
|
1300
|
-
continue;
|
1301
|
-
} else {
|
1302
|
-
let O =
|
1303
|
-
(c < 0
|
1304
|
-
? this.viewState.heightMap.height
|
1305
|
-
: this.viewState.lineBlockAt(c).top) -
|
1306
|
-
u;
|
1307
|
-
if (O > 1 || O < -1) {
|
1308
|
-
(s = s + O),
|
1309
|
-
(l.scrollTop = s / this.scaleY),
|
1310
|
-
(u = -1);
|
1311
|
-
continue;
|
1312
|
-
}
|
1313
|
-
}
|
1314
|
-
break;
|
1315
|
-
}
|
1192
|
+
if (!!e.buttons) {
|
1193
|
+
e.buttons.forEach((childItem) => {
|
1194
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1195
|
+
});
|
1316
1196
|
}
|
1317
|
-
}
|
1318
|
-
(
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
let e = this.state.facet(EditorView.cspNonce);
|
1376
|
-
StyleModule.mount(
|
1377
|
-
this.root,
|
1378
|
-
this.styleModules.concat(baseTheme$1$3).reverse(),
|
1379
|
-
e ? { nonce: e } : void 0
|
1380
|
-
);
|
1381
|
-
}
|
1382
|
-
readMeasured() {
|
1383
|
-
if (this.updateState == 2)
|
1384
|
-
throw new Error(
|
1385
|
-
"Reading the editor layout isn't allowed during an update"
|
1386
|
-
);
|
1387
|
-
this.updateState == 0 &&
|
1388
|
-
this.measureScheduled > -1 &&
|
1389
|
-
this.measure(!1);
|
1390
|
-
}
|
1391
|
-
requestMeasure(e) {
|
1392
|
-
if (
|
1393
|
-
(this.measureScheduled < 0 &&
|
1394
|
-
(this.measureScheduled = this.win.requestAnimationFrame(
|
1395
|
-
() => this.measure()
|
1396
|
-
)),
|
1397
|
-
e)
|
1398
|
-
) {
|
1399
|
-
if (this.measureRequests.indexOf(e) > -1) return;
|
1400
|
-
if (e.key != null) {
|
1401
|
-
for (let n = 0; n < this.measureRequests.length; n++)
|
1402
|
-
if (this.measureRequests[n].key === e.key) {
|
1403
|
-
this.measureRequests[n] = e;
|
1404
|
-
return;
|
1405
|
-
}
|
1197
|
+
} else if ("list-h5" === e.type) {
|
1198
|
+
if (!!e.widgetList && e.widgetList.length > 0) {
|
1199
|
+
e.widgetList.forEach((childItem) => {
|
1200
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1201
|
+
});
|
1202
|
+
}
|
1203
|
+
} else if ("grid" === e.type) {
|
1204
|
+
e.cols &&
|
1205
|
+
e.cols.length > 0 &&
|
1206
|
+
e.cols.forEach(function (childItem) {
|
1207
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1208
|
+
});
|
1209
|
+
} else if ("table" === e.type) {
|
1210
|
+
e.rows &&
|
1211
|
+
e.rows.length > 0 &&
|
1212
|
+
e.rows.forEach(function (rowItem) {
|
1213
|
+
rowItem.cols &&
|
1214
|
+
rowItem.cols.length > 0 &&
|
1215
|
+
rowItem.cols.forEach(function (childItem) {
|
1216
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1217
|
+
});
|
1218
|
+
});
|
1219
|
+
} else if ("h5-table" === e.type) {
|
1220
|
+
e.rows &&
|
1221
|
+
e.rows.length > 0 &&
|
1222
|
+
e.rows.forEach(function (rowItem) {
|
1223
|
+
rowItem.cols &&
|
1224
|
+
rowItem.cols.length > 0 &&
|
1225
|
+
rowItem.cols.forEach(function (childItem) {
|
1226
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1227
|
+
});
|
1228
|
+
});
|
1229
|
+
} else if ("tab" === e.type) {
|
1230
|
+
e.tabs &&
|
1231
|
+
e.tabs.length > 0 &&
|
1232
|
+
e.tabs.forEach(function (tabItem) {
|
1233
|
+
tabItem.widgetList &&
|
1234
|
+
tabItem.widgetList.length > 0 &&
|
1235
|
+
tabItem.widgetList.forEach(function (childItem) {
|
1236
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1237
|
+
});
|
1238
|
+
});
|
1239
|
+
} else if ("detail" === e.type) {
|
1240
|
+
if (e.panes) {
|
1241
|
+
e.panes.forEach(function (childItem) {
|
1242
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1243
|
+
});
|
1244
|
+
}
|
1245
|
+
if (e.widgetList) {
|
1246
|
+
e.widgetList.forEach(function (childItem) {
|
1247
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1248
|
+
});
|
1249
|
+
}
|
1250
|
+
} else if ("detail-pane" === e.type) {
|
1251
|
+
if (e.widgetList) {
|
1252
|
+
e.widgetList.forEach(function (childItem) {
|
1253
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1254
|
+
});
|
1406
1255
|
}
|
1407
|
-
|
1256
|
+
if (e.buttonWidgetList) {
|
1257
|
+
e.buttonWidgetList.forEach(function (childItem) {
|
1258
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1259
|
+
});
|
1260
|
+
}
|
1261
|
+
} else {
|
1262
|
+
"grid-col" === e.type || e.type,
|
1263
|
+
e.widgetList &&
|
1264
|
+
e.widgetList.length > 0 &&
|
1265
|
+
e.widgetList.forEach(function (childItem) {
|
1266
|
+
loopHandleWidgetItem(childItem, e, callback);
|
1267
|
+
});
|
1408
1268
|
}
|
1409
|
-
}
|
1410
|
-
|
1411
|
-
let n = this.pluginMap.get(e);
|
1412
|
-
return (
|
1413
|
-
(n === void 0 || (n && n.spec != e)) &&
|
1414
|
-
this.pluginMap.set(
|
1415
|
-
e,
|
1416
|
-
(n = this.plugins.find((l) => l.spec == e) || null)
|
1417
|
-
),
|
1418
|
-
n && n.update(this).value
|
1419
|
-
);
|
1420
|
-
}
|
1421
|
-
get documentTop() {
|
1422
|
-
return (
|
1423
|
-
this.contentDOM.getBoundingClientRect().top +
|
1424
|
-
this.viewState.paddingTop
|
1425
|
-
);
|
1426
|
-
}
|
1427
|
-
get documentPadding() {
|
1428
|
-
return {
|
1429
|
-
top: this.viewState.paddingTop,
|
1430
|
-
bottom: this.viewState.paddingBottom,
|
1431
|
-
};
|
1432
|
-
}
|
1433
|
-
get scaleX() {
|
1434
|
-
return this.viewState.scaleX;
|
1435
|
-
}
|
1436
|
-
get scaleY() {
|
1437
|
-
return this.viewState.scaleY;
|
1438
|
-
}
|
1439
|
-
elementAtHeight(e) {
|
1440
|
-
return this.readMeasured(), this.viewState.elementAtHeight(e);
|
1441
|
-
}
|
1442
|
-
lineBlockAtHeight(e) {
|
1443
|
-
return this.readMeasured(), this.viewState.lineBlockAtHeight(e);
|
1444
|
-
}
|
1445
|
-
get viewportLineBlocks() {
|
1446
|
-
return this.viewState.viewportLines;
|
1447
|
-
}
|
1448
|
-
lineBlockAt(e) {
|
1449
|
-
return this.viewState.lineBlockAt(e);
|
1450
|
-
}
|
1451
|
-
get contentHeight() {
|
1452
|
-
return this.viewState.contentHeight;
|
1453
|
-
}
|
1454
|
-
moveByChar(e, n, l) {
|
1455
|
-
return skipAtoms(this, e, moveByChar(this, e, n, l));
|
1456
|
-
}
|
1457
|
-
moveByGroup(e, n) {
|
1458
|
-
return skipAtoms(
|
1459
|
-
this,
|
1460
|
-
e,
|
1461
|
-
moveByChar(this, e, n, (l) => byGroup(this, e.head, l))
|
1462
|
-
);
|
1463
|
-
}
|
1464
|
-
moveToLineBoundary(e, n, l = !0) {
|
1465
|
-
return moveToLineBoundary(this, e, n, l);
|
1466
|
-
}
|
1467
|
-
moveVertically(e, n, l) {
|
1468
|
-
return skipAtoms(this, e, moveVertically(this, e, n, l));
|
1469
|
-
}
|
1470
|
-
domAtPos(e) {
|
1471
|
-
return this.docView.domAtPos(e);
|
1472
|
-
}
|
1473
|
-
posAtDOM(e, n = 0) {
|
1474
|
-
return this.docView.posFromDOM(e, n);
|
1475
|
-
}
|
1476
|
-
posAtCoords(e, n = !0) {
|
1477
|
-
return this.readMeasured(), posAtCoords(this, e, n);
|
1478
|
-
}
|
1479
|
-
coordsAtPos(e, n = 1) {
|
1480
|
-
this.readMeasured();
|
1481
|
-
let l = this.docView.coordsAt(e, n);
|
1482
|
-
if (!l || l.left == l.right) return l;
|
1483
|
-
let s = this.state.doc.lineAt(e),
|
1484
|
-
c = this.bidiSpans(s),
|
1485
|
-
u = c[BidiSpan.find(c, e - s.from, -1, n)];
|
1486
|
-
return flattenRect(l, (u.dir == Direction.LTR) == n > 0);
|
1487
|
-
}
|
1488
|
-
coordsForChar(e) {
|
1489
|
-
return this.readMeasured(), this.docView.coordsForChar(e);
|
1490
|
-
}
|
1491
|
-
get defaultCharacterWidth() {
|
1492
|
-
return this.viewState.heightOracle.charWidth;
|
1493
|
-
}
|
1494
|
-
get defaultLineHeight() {
|
1495
|
-
return this.viewState.heightOracle.lineHeight;
|
1496
|
-
}
|
1497
|
-
get textDirection() {
|
1498
|
-
return this.viewState.defaultTextDirection;
|
1499
|
-
}
|
1500
|
-
textDirectionAt(e) {
|
1501
|
-
return !this.state.facet(perLineTextDirection) ||
|
1502
|
-
e < this.viewport.from ||
|
1503
|
-
e > this.viewport.to
|
1504
|
-
? this.textDirection
|
1505
|
-
: (this.readMeasured(), this.docView.textDirectionAt(e));
|
1506
|
-
}
|
1507
|
-
get lineWrapping() {
|
1508
|
-
return this.viewState.heightOracle.lineWrapping;
|
1509
|
-
}
|
1510
|
-
bidiSpans(e) {
|
1511
|
-
if (e.length > MaxBidiLine) return trivialOrder(e.length);
|
1512
|
-
let n = this.textDirectionAt(e.from),
|
1513
|
-
l;
|
1514
|
-
for (let c of this.bidiCache)
|
1515
|
-
if (
|
1516
|
-
c.from == e.from &&
|
1517
|
-
c.dir == n &&
|
1518
|
-
(c.fresh ||
|
1519
|
-
isolatesEq(
|
1520
|
-
c.isolates,
|
1521
|
-
(l = getIsolatedRanges(this, e.from, e.to))
|
1522
|
-
))
|
1523
|
-
)
|
1524
|
-
return c.order;
|
1525
|
-
l || (l = getIsolatedRanges(this, e.from, e.to));
|
1526
|
-
let s = computeOrder(e.text, n, l);
|
1527
|
-
return (
|
1528
|
-
this.bidiCache.push(new CachedOrder(e.from, e.to, n, l, !0, s)),
|
1529
|
-
s
|
1530
|
-
);
|
1531
|
-
}
|
1532
|
-
get hasFocus() {
|
1533
|
-
var e;
|
1534
|
-
return (
|
1535
|
-
(this.dom.ownerDocument.hasFocus() ||
|
1536
|
-
(browser.safari &&
|
1537
|
-
((e = this.inputState) === null || e === void 0
|
1538
|
-
? void 0
|
1539
|
-
: e.lastContextMenu) >
|
1540
|
-
Date.now() - 3e4)) &&
|
1541
|
-
this.root.activeElement == this.contentDOM
|
1542
|
-
);
|
1543
|
-
}
|
1544
|
-
focus() {
|
1545
|
-
this.observer.ignore(() => {
|
1546
|
-
focusPreventScroll(this.contentDOM),
|
1547
|
-
this.docView.updateSelection();
|
1548
|
-
});
|
1549
|
-
}
|
1550
|
-
setRoot(e) {
|
1551
|
-
this._root != e &&
|
1552
|
-
((this._root = e),
|
1553
|
-
this.observer.setWindow(
|
1554
|
-
(e.nodeType == 9 ? e : e.ownerDocument).defaultView ||
|
1555
|
-
window
|
1556
|
-
),
|
1557
|
-
this.mountStyles());
|
1558
|
-
}
|
1559
|
-
destroy() {
|
1560
|
-
for (let e of this.plugins) e.destroy(this);
|
1561
|
-
(this.plugins = []),
|
1562
|
-
this.inputState.destroy(),
|
1563
|
-
this.dom.remove(),
|
1564
|
-
this.observer.destroy(),
|
1565
|
-
this.measureScheduled > -1 &&
|
1566
|
-
this.win.cancelAnimationFrame(this.measureScheduled),
|
1567
|
-
(this.destroyed = !0);
|
1568
|
-
}
|
1569
|
-
static scrollIntoView(e, n = {}) {
|
1570
|
-
return scrollIntoView$1.of(
|
1571
|
-
new ScrollTarget(
|
1572
|
-
typeof e == "number" ? EditorSelection.cursor(e) : e,
|
1573
|
-
n.y,
|
1574
|
-
n.x,
|
1575
|
-
n.yMargin,
|
1576
|
-
n.xMargin
|
1577
|
-
)
|
1578
|
-
);
|
1579
|
-
}
|
1580
|
-
static domEventHandlers(e) {
|
1581
|
-
return ViewPlugin.define(() => ({}), { eventHandlers: e });
|
1582
|
-
}
|
1583
|
-
static domEventObservers(e) {
|
1584
|
-
return ViewPlugin.define(() => ({}), { eventObservers: e });
|
1585
|
-
}
|
1586
|
-
static theme(e, n) {
|
1587
|
-
let l = StyleModule.newName(),
|
1588
|
-
s = [theme.of(l), styleModule.of(buildTheme(`.${l}`, e))];
|
1589
|
-
return n && n.dark && s.push(darkTheme.of(!0)), s;
|
1590
|
-
}
|
1591
|
-
static baseTheme(e) {
|
1592
|
-
return Prec.lowest(
|
1593
|
-
styleModule.of(buildTheme("." + baseThemeID, e, lightDarkIDs))
|
1594
|
-
);
|
1595
|
-
}
|
1596
|
-
static findFromDOM(e) {
|
1597
|
-
var n;
|
1598
|
-
let l = e.querySelector(".cm-content"),
|
1599
|
-
s = (l && ContentView.get(l)) || ContentView.get(e);
|
1600
|
-
return (
|
1601
|
-
((n = s == null ? void 0 : s.rootView) === null || n === void 0
|
1602
|
-
? void 0
|
1603
|
-
: n.view) || null
|
1604
|
-
);
|
1269
|
+
} else {
|
1270
|
+
callback && callback(e);
|
1605
1271
|
}
|
1606
1272
|
}
|
1607
|
-
(EditorView.styleModule = styleModule),
|
1608
|
-
(EditorView.inputHandler = inputHandler$1),
|
1609
|
-
(EditorView.focusChangeEffect = focusChangeEffect),
|
1610
|
-
(EditorView.perLineTextDirection = perLineTextDirection),
|
1611
|
-
(EditorView.exceptionSink = exceptionSink),
|
1612
|
-
(EditorView.updateListener = updateListener),
|
1613
|
-
(EditorView.editable = editable),
|
1614
|
-
(EditorView.mouseSelectionStyle = mouseSelectionStyle),
|
1615
|
-
(EditorView.dragMovesSelection = dragMovesSelection$1),
|
1616
|
-
(EditorView.clickAddsSelectionRange = clickAddsSelectionRange),
|
1617
|
-
(EditorView.decorations = decorations),
|
1618
|
-
(EditorView.atomicRanges = atomicRanges),
|
1619
|
-
(EditorView.bidiIsolatedRanges = bidiIsolatedRanges),
|
1620
|
-
(EditorView.scrollMargins = scrollMargins),
|
1621
|
-
(EditorView.darkTheme = darkTheme),
|
1622
|
-
(EditorView.cspNonce = Facet.define({
|
1623
|
-
combine: (o) => (o.length ? o[0] : ""),
|
1624
|
-
})),
|
1625
|
-
(EditorView.contentAttributes = contentAttributes),
|
1626
|
-
(EditorView.editorAttributes = editorAttributes),
|
1627
|
-
(EditorView.lineWrapping = EditorView.contentAttributes.of({
|
1628
|
-
class: "cm-lineWrapping",
|
1629
|
-
})),
|
1630
|
-
(EditorView.announce = StateEffect.define());*/
|
1631
1273
|
//end
|