cloud-web-corejs 1.0.54-dev.202 → 1.0.54-dev.204

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.
Files changed (20) hide show
  1. package/package.json +1 -1
  2. package/src/components/excelExport/mixins.js +1 -1
  3. package/src/components/xform/form-designer/designer.js +0 -1
  4. package/src/components/xform/form-designer/form-widget/container-widget/data-table-mixin.js +245 -1
  5. package/src/components/xform/form-designer/form-widget/field-widget/fieldMixin.js +30 -36
  6. package/src/components/xform/form-designer/form-widget/field-widget/number-widget.vue +1 -1
  7. package/src/components/xform/form-designer/form-widget/field-widget/select-widget.vue +1 -1
  8. package/src/components/xform/form-designer/setting-panel/index.vue +4 -0
  9. package/src/components/xform/form-designer/setting-panel/indexMixin.js +2 -0
  10. package/src/components/xform/form-designer/setting-panel/property-editor/container-data-table/table-column-dialog.vue +23 -4
  11. package/src/components/xform/form-designer/setting-panel/property-editor/formula-editor.vue +214 -129
  12. package/src/components/xform/form-designer/setting-panel/property-editor/multiple-editor.vue +8 -3
  13. package/src/components/xform/form-designer/widget-panel/widgetsConfig.js +2 -0
  14. package/src/components/xform/form-render/container-item/data-table-item.vue +7 -4
  15. package/src/components/xform/form-render/container-item/data-table-mixin.js +225 -34
  16. package/src/components/xform/form-render/container-item/data-table-mixin2.js +2169 -0
  17. package/src/components/xform/form-render/indexMixin.js +65 -16
  18. package/src/components/xform/utils/formula-util.js +33 -12
  19. package/src/components/xform/utils/util.js +762 -999
  20. package/src/views/bd/setting/form_script/edit1.vue +8 -1
@@ -1,44 +1,52 @@
1
- import Clipboard from 'clipboard'
2
- import axios from 'axios'
3
- import request from '../../../utils/request.js'
1
+ import Clipboard from "clipboard";
2
+ import axios from "axios";
3
+ import request from "../../../utils/request.js";
4
4
  import {decode} from "js-base64";
5
5
 
6
6
  export function getAccessUrl() {
7
- return SUPPORT_PREFIX + '/report_ins/getData';
7
+ return SUPPORT_PREFIX + "/report_ins/getData";
8
8
  }
9
9
 
10
10
  export function isNull(value) {
11
- return (value === null) || (value === undefined);
11
+ return value === null || value === undefined;
12
12
  }
13
13
 
14
14
  export function isNotNull(value) {
15
- return (value !== null) && (value !== undefined);
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 (str === undefined) || (!str && (str !== 0) && (str !== '0')) || (!/[^\s]/.test(str));
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(Math.random() * 100000 + Math.random() * 20000 + Math.random() * 5000);
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 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
29
- var r = (Math.random() * 16) | 0,
30
- v = c == 'x' ? r : (r & 0x3) | 0x8;
31
- return v.toString(16);
32
- }).replaceAll("-", "");
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 != 'function') {
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('head')[0];
70
- let style = document.createElement('style');
71
- style.type = 'text/css';
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('head')[0];
78
- let oldStyle = document.getElementById('vform-custom-css');
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('vform-custom-css' + '-' + formId);
91
+ oldStyle = document.getElementById("vform-custom-css" + "-" + formId);
84
92
  !!oldStyle && head.removeChild(oldStyle); //先清除后插入!!
85
93
  }
86
94
 
87
- let newStyle = document.createElement('style');
88
- newStyle.type = 'text/css';
89
- newStyle.rel = 'stylesheet';
90
- newStyle.id = !!formId ? 'vform-custom-css' + '-' + formId : 'vform-custom-css';
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,354 +105,644 @@ export const insertCustomCssToHead = function (cssCode, formId = '') {
95
105
  }
96
106
 
97
107
  head.appendChild(newStyle);
98
- }
108
+ };
99
109
 
100
- export const insertGlobalFunctionsToHtml = function (functionsCode, formId = '') {
101
- let bodyEle = document.getElementsByTagName('body')[0];
102
- let oldScriptEle = document.getElementById('v_form_global_functions');
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('v_form_global_functions' + '-' + formId);
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('script');
110
- newScriptEle.id = !!formId ? 'v_form_global_functions' + '-' + formId : 'v_form_global_functions';
111
- newScriptEle.type = 'text/javascript';
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('script')
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 (isAbort || !s.readyState || s.readyState === "loaded" || s.readyState === "complete") {
138
- s = s.onload = s.onreadystatechange = null
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
+ };
144
166
  }
145
- }
167
+ };
146
168
 
147
- export function traverseFieldWidgets(widgetList, handler, parent = null) {
148
- widgetList.forEach(w => {
149
- if (w.formItemFlag) {
169
+ export function traverseFieldWidgets(
170
+ widgetList,
171
+ handler,
172
+ parent = null,
173
+ staticWidgetsIncluded
174
+ ) {
175
+ if (!widgetList) {
176
+ return;
177
+ }
178
+
179
+ loopHandleWidget(widgetList, (w, parent) => {
180
+ if (w.formItemFlag || ((w.formItemFlag === false) && staticWidgetsIncluded)) {
150
181
  handler(w, parent)
151
- } else if (w.type === 'grid') {
152
- w.cols.forEach(col => {
153
- traverseFieldWidgets(col.widgetList, handler, w)
154
- })
155
- } else if (w.type === 'table') {
156
- w.rows.forEach(row => {
157
- row.cols.forEach(cell => {
158
- traverseFieldWidgets(cell.widgetList, handler, w)
159
- })
160
- })
161
- } else if (w.type === 'h5-table') {
162
- w.rows.forEach(row => {
163
- row.cols.forEach(cell => {
164
- traverseFieldWidgets(cell.widgetList, handler, w)
165
- })
166
- })
167
- } else if (w.type === 'tab') {
168
- w.tabs.forEach(tab => {
169
- traverseFieldWidgets(tab.widgetList, handler, w)
170
- })
171
- } else if (w.type === 'sub-form') {
172
- traverseFieldWidgets(w.widgetList, handler, w)
173
- } else if (w.category === 'container') { //自定义容器
174
- traverseFieldWidgets(w.widgetList, handler, w)
175
182
  }
176
- })
183
+ });
184
+
185
+ /* widgetList.forEach((w) => {
186
+ if (w.formItemFlag || (w.formItemFlag === false && staticWidgetsIncluded)) {
187
+ handler(w, parent);
188
+ } else if (w.type === "grid") {
189
+ w.cols.forEach((col) => {
190
+ traverseFieldWidgets(col.widgetList, handler, w, staticWidgetsIncluded);
191
+ });
192
+ } else if (w.type === "table") {
193
+ w.rows.forEach((row) => {
194
+ row.cols.forEach((cell) => {
195
+ traverseFieldWidgets(
196
+ cell.widgetList,
197
+ handler,
198
+ w,
199
+ staticWidgetsIncluded
200
+ );
201
+ });
202
+ });
203
+ } else if (w.type === "tab") {
204
+ w.tabs.forEach((tab) => {
205
+ traverseFieldWidgets(tab.widgetList, handler, w, staticWidgetsIncluded);
206
+ });
207
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
208
+ traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
209
+ } else if (w.category === "container") {
210
+ //自定义容器
211
+ traverseFieldWidgets(w.widgetList, handler, w, staticWidgetsIncluded);
212
+ }
213
+ }); */
177
214
  }
178
215
 
179
- export function traverseContainWidgets(widgetList, handler) {
180
- widgetList.forEach(w => {
181
- if (w.category === 'container') {
182
- handler(w)
216
+ export function traverseContainerWidgets(
217
+ widgetList,
218
+ handler,
219
+ skipDialogAndDrawer
220
+ ) {
221
+ if (!widgetList) {
222
+ return;
223
+ }
224
+
225
+ loopHandleWidget(widgetList, (w, parent) => {
226
+ if (w.category === "container") {
227
+ if (
228
+ skipDialogAndDrawer &&
229
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
230
+ ) {
231
+ //什么也不做
232
+ } else {
233
+ handler(w);
234
+ }
183
235
  }
236
+ });
184
237
 
185
- if (w.type === 'grid') {
186
- w.cols.forEach(col => {
187
- traverseContainWidgets(col.widgetList, handler)
188
- })
189
- } else if (w.type === 'table') {
190
- w.rows.forEach(row => {
191
- row.cols.forEach(cell => {
192
- traverseContainWidgets(cell.widgetList, handler)
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)
238
+ /* widgetList.forEach((w) => {
239
+ if (w.category === "container") {
240
+ if (
241
+ skipDialogAndDrawer &&
242
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
243
+ ) {
244
+ //什么也不做
245
+ } else {
246
+ handler(w);
247
+ }
209
248
  }
210
- })
249
+
250
+ if (w.type === "grid") {
251
+ w.cols.forEach((col) => {
252
+ traverseContainerWidgets(col.widgetList, handler);
253
+ });
254
+ } else if (w.type === "table") {
255
+ w.rows.forEach((row) => {
256
+ row.cols.forEach((cell) => {
257
+ traverseContainerWidgets(cell.widgetList, handler);
258
+ });
259
+ });
260
+ } else if (w.type === "tab") {
261
+ w.tabs.forEach((tab) => {
262
+ traverseContainerWidgets(tab.widgetList, handler);
263
+ });
264
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
265
+ traverseContainerWidgets(w.widgetList, handler);
266
+ } else if (w.category === "container") {
267
+ //自定义容器
268
+ if (
269
+ skipDialogAndDrawer &&
270
+ (w.type === "vf-dialog" || w.type === "vf-drawer")
271
+ ) {
272
+ //什么也不做
273
+ } else {
274
+ traverseContainerWidgets(w.widgetList, handler);
275
+ }
276
+ }
277
+ }); */
211
278
  }
212
279
 
213
- export function traverseContainerWidgets(e, t) {
214
- e.forEach((function (e) {
215
- "container" === e.category && t(e),
216
- "grid" === e.type ? e.cols.forEach((function (e) {
217
- traverseContainerWidgets(e.widgetList, t)
218
- }
219
- )) : "detail" === e.type ? e.panes.forEach((function (e) {
220
- traverseContainerWidgets(e.widgetList, t)
221
- }
222
- )) : "table" === e.type ? e.rows.forEach((function (e) {
223
- e.cols.forEach((function (e) {
224
- traverseContainerWidgets(e.widgetList, t)
225
- }
226
- ))
227
- }
228
- )) : "tab" === e.type ? e.tabs.forEach((function (e) {
229
- traverseContainerWidgets(e.widgetList, t)
230
- }
231
- )) : ("sub-form" === e.type || "grid-sub-form" === e.type || "container" === e.category) && traverseContainerWidgets(e.widgetList, t)
280
+ export function traverseAllWidgets(widgetList, handler) {
281
+ if (!widgetList) {
282
+ return;
283
+ }
284
+
285
+ loopHandleWidget(widgetList, (w, parent) => {
286
+ handler(w);
287
+ });
288
+
289
+ /* widgetList.forEach((w) => {
290
+ handler(w);
291
+
292
+ if (w.type === "grid") {
293
+ w.cols.forEach((col) => {
294
+ handler(col);
295
+ traverseAllWidgets(col.widgetList, handler);
296
+ });
297
+ } else if (w.type === "table") {
298
+ w.rows.forEach((row) => {
299
+ row.cols.forEach((cell) => {
300
+ handler(cell);
301
+ traverseAllWidgets(cell.widgetList, handler);
302
+ });
303
+ });
304
+ } else if (w.type === "tab") {
305
+ w.tabs.forEach((tab) => {
306
+ traverseAllWidgets(tab.widgetList, handler);
307
+ });
308
+ } else if (w.type === "sub-form" || w.type === "grid-sub-form") {
309
+ traverseAllWidgets(w.widgetList, handler);
310
+ } else if (w.category === "container") {
311
+ //自定义容器
312
+ traverseAllWidgets(w.widgetList, handler);
232
313
  }
233
- ))
314
+ }); */
315
+ }
316
+
317
+ function handleWidgetForTraverse(
318
+ widget,
319
+ handler,
320
+ staticWidgetsIncluded = false
321
+ ) {
322
+ if (!!widget.category && widget.category === "container") {
323
+ traverseFieldWidgetsOfContainer(widget, handler);
324
+ } else if (widget.formItemFlag) {
325
+ handler(widget);
326
+ }
234
327
  }
235
328
 
236
- let itemFieldMap = {
329
+ export const itemFieldMap = {
237
330
  grid: "cols",
238
331
  table: "rows",
332
+ "table-cell": "widgetList",
239
333
  'h5-table': "rows",
334
+ "h5-table-cell": "widgetList",
240
335
  tab: "tabs",
336
+ "tab-pane": "widgetList",
337
+ "grid-col": "widgetList",
338
+ "vf-box": "widgetList",
339
+ "card": "widgetList",
241
340
  "detail": "panes",
341
+ "detail-pane": "widgetList",
242
342
  "detail-h5": "panes",
243
343
  "h5-card": "panes",
344
+ "h5-card-pane": "widgetList",
244
345
  }
245
346
 
246
- export function traverseAllWidgets(widgetList, handler) {
247
- if (!widgetList) return
248
- widgetList.forEach(w => {
249
- handler(w)
250
- if (w.type === 'grid') {
251
- w.cols.forEach(col => {
252
- handler(col)
253
- traverseAllWidgets(col.widgetList, handler)
254
- })
255
- } else if (w.type === 'detail') {
256
- w.panes.forEach(item => {
257
- handler(item)
258
- traverseAllWidgets(item.widgetList, handler)
259
- traverseAllWidgets(item.buttonWidgetList, handler)
260
- })
261
- w.widgetList.forEach(item => {
262
- handler(item)
263
- traverseAllWidgets(item.widgetList, handler)
264
- })
265
- } else if (w.type === 'table') {
266
- w.rows.forEach(row => {
267
- row.cols.forEach(cell => {
268
- handler(cell)
269
- traverseAllWidgets(cell.widgetList, handler)
270
- })
271
- })
272
- } else if (w.type === 'h5-table') {
273
- w.rows.forEach(row => {
274
- row.cols.forEach(cell => {
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)
347
+ /**
348
+ * 遍历容器内的字段组件
349
+ * @param con
350
+ * @param handler
351
+ * @param staticWidgetsIncluded
352
+ */
353
+ export function traverseFieldWidgetsOfContainer(
354
+ con,
355
+ handler,
356
+ staticWidgetsIncluded = false
357
+ ) {
358
+
359
+ /*loopHandleWidget([con],(w, parent)=>{
360
+ handleWidgetForTraverse(w, handler, staticWidgetsIncluded);
361
+ });*/
362
+ if (con.type === "grid") {
363
+ con.cols.forEach((col) => {
364
+ col.widgetList.forEach((cw) => {
365
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
366
+ });
367
+ });
368
+ } else if (con.type === "table") {
369
+ con.rows.forEach((row) => {
370
+ row.cols.forEach((cell) => {
371
+ cell.widgetList.forEach((cw) => {
372
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
373
+ });
374
+ });
375
+ });
376
+ } else if (con.type === "tab") {
377
+ con.tabs.forEach((tab) => {
378
+ tab.widgetList.forEach((cw) => {
379
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
380
+ });
381
+ });
382
+ } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
383
+ con.widgetList.forEach((cw) => {
384
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
385
+ });
386
+ } else if (con.type === "data-table") {
387
+ /*con.widgetList.forEach((cw) => {
388
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
389
+ });*/
390
+ for (let column of con.options.tableColumns) {
391
+ if (column.widget) {
392
+ handleWidgetForTraverse(column.widget, handler, staticWidgetsIncluded);
393
+ }
394
+ if (column.widgetList) {
395
+ loopHandleWidget(column.widgetList, (cw) => {
396
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
397
+ });
398
+ }
287
399
  }
288
- })
400
+ } else if (con.category === "container") {
401
+ //自定义容器
402
+ /*let key = itemFieldMap[con.type]
403
+ con[key].forEach((cw) => {
404
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded);
405
+ });*/
406
+
407
+
408
+ /*con.widgetList.forEach(cw => {
409
+ handleWidgetForTraverse(cw, handler, staticWidgetsIncluded)
410
+ })*/
411
+ loopHandleWidgetItem(con, null, (w) => {
412
+ if (con.id != w.id)
413
+ handleWidgetForTraverse(w, handler, staticWidgetsIncluded)
414
+ })
415
+
416
+ }
289
417
  }
290
418
 
291
- function handleWidgetForTraverse(widget, handler) {
292
- if (!!widget.category) {
293
- traverseFieldWidgetsOfContainer(widget, handler)
419
+ function handleContainerTraverse(
420
+ widget,
421
+ fieldHandler,
422
+ containerHandler,
423
+ internalContainerCallFlag,
424
+ staticWidgetsIncluded
425
+ ) {
426
+ if (!!widget.category && widget.category === "container") {
427
+ traverseWidgetsOfContainer(
428
+ widget,
429
+ fieldHandler,
430
+ containerHandler,
431
+ internalContainerCallFlag,
432
+ staticWidgetsIncluded
433
+ );
294
434
  } else if (widget.formItemFlag) {
295
- handler(widget)
435
+ fieldHandler(widget);
436
+ } else if (staticWidgetsIncluded) {
437
+ fieldHandler(widget);
296
438
  }
297
439
  }
298
440
 
299
441
  /**
300
- * 遍历容器内的字段组件
442
+ * 遍历容器内部的字段组件和容器组件
301
443
  * @param con
302
- * @param handler
444
+ * @param fieldHandler
445
+ * @param containerHandler
446
+ * @param internalContainerCallFlag 是否需要处理内部容器组件,默认不处理
447
+ * @param staticWidgetsIncluded 是否需要处理静态非表单交互类组件
303
448
  */
304
- export function traverseFieldWidgetsOfContainer(con, handler) {
305
- if (con.type === 'grid') {
306
- con.cols.forEach(col => {
307
- col.widgetList.forEach(cw => {
308
- handleWidgetForTraverse(cw, handler)
309
- })
310
- })
311
- }else if (con.type === 'detail') {
312
- con.panes.forEach(col => {
313
- col.widgetList.forEach(cw => {
314
- handleWidgetForTraverse(cw, handler)
315
- })
316
- col.buttonWidgetList.forEach(cw => {
317
- handleWidgetForTraverse(cw, handler)
318
- })
319
- })
320
- con.widgetList.forEach(col => {
321
- handleWidgetForTraverse(col, handler)
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)
328
- })
329
- })
330
- })
331
- } else if (con.type === 'h5-table') {
332
- con.rows.forEach(row => {
333
- row.cols.forEach(cell => {
334
- cell.widgetList.forEach(cw => {
335
- handleWidgetForTraverse(cw, handler)
336
- })
337
- })
338
- })
339
- } else if (con.type === 'tab') {
340
- con.tabs.forEach(tab => {
341
- tab.widgetList.forEach(cw => {
342
- handleWidgetForTraverse(cw, handler)
343
- })
344
- })
345
- } else if (con.type === 'sub-form') {
346
- con.widgetList.forEach(cw => {
347
- handleWidgetForTraverse(cw, handler)
348
- })
349
- } else if (con.category === 'container') { //自定义容器
350
- con.widgetList.forEach(cw => {
351
- handleWidgetForTraverse(cw, handler)
352
- })
449
+ export function traverseWidgetsOfContainer(
450
+ con,
451
+ fieldHandler,
452
+ containerHandler,
453
+ internalContainerCallFlag,
454
+ staticWidgetsIncluded
455
+ ) {
456
+ if (con.category === "container") {
457
+ containerHandler(con);
458
+ }
459
+
460
+ /*loopHandleWidget([con], (cw, parent) => {
461
+ if (con.id !== cw.id) {
462
+ handleContainerTraverse(
463
+ cw,
464
+ fieldHandler,
465
+ containerHandler,
466
+ internalContainerCallFlag,
467
+ staticWidgetsIncluded
468
+ );
469
+ }
470
+ });*/
471
+
472
+ if (con.type === "grid") {
473
+ con.cols.forEach((col) => {
474
+ if (internalContainerCallFlag) {
475
+ containerHandler(col);
476
+ }
477
+ col.widgetList.forEach((cw) => {
478
+ handleContainerTraverse(
479
+ cw,
480
+ fieldHandler,
481
+ containerHandler,
482
+ internalContainerCallFlag,
483
+ staticWidgetsIncluded
484
+ );
485
+ });
486
+ });
487
+ } else if (con.type === "table") {
488
+ con.rows.forEach((row) => {
489
+ if (internalContainerCallFlag) {
490
+ containerHandler(row);
491
+ }
492
+ row.cols.forEach((cell) => {
493
+ if (internalContainerCallFlag) {
494
+ containerHandler(cell);
495
+ }
496
+ cell.widgetList.forEach((cw) => {
497
+ handleContainerTraverse(
498
+ cw,
499
+ fieldHandler,
500
+ containerHandler,
501
+ internalContainerCallFlag,
502
+ staticWidgetsIncluded
503
+ );
504
+ });
505
+ });
506
+ });
507
+ } else if (con.type === "tab") {
508
+ con.tabs.forEach((tab) => {
509
+ if (internalContainerCallFlag) {
510
+ containerHandler(tab);
511
+ }
512
+ tab.widgetList.forEach((cw) => {
513
+ handleContainerTraverse(
514
+ cw,
515
+ fieldHandler,
516
+ containerHandler,
517
+ internalContainerCallFlag,
518
+ staticWidgetsIncluded
519
+ );
520
+ });
521
+ });
522
+ } else if (con.type === "sub-form" || con.type === "grid-sub-form") {
523
+ con.widgetList.forEach((cw) => {
524
+ handleContainerTraverse(
525
+ cw,
526
+ fieldHandler,
527
+ containerHandler,
528
+ internalContainerCallFlag,
529
+ staticWidgetsIncluded
530
+ );
531
+ });
532
+ } else if (con.category === "container") {
533
+ //自定义容器
534
+ let key = itemFieldMap[con.type]
535
+ con[key].forEach((cw) => {
536
+ handleContainerTraverse(
537
+ cw,
538
+ fieldHandler,
539
+ containerHandler,
540
+ internalContainerCallFlag,
541
+ staticWidgetsIncluded
542
+ );
543
+ });
544
+ }
545
+ }
546
+
547
+ export function traverseWidgetsOfGridCol(
548
+ gridCol,
549
+ fieldHandler,
550
+ containerHandler
551
+ ) {
552
+ // if (gridCol.category === 'container') {
553
+ // containerHandler(gridCol)
554
+ // }
555
+
556
+ if (gridCol.type === "grid-col") {
557
+ gridCol.widgetList.forEach((cw) => {
558
+ handleContainerTraverse(cw, fieldHandler, containerHandler);
559
+ });
353
560
  }
354
561
  }
355
562
 
356
563
  /**
357
564
  * 获取所有字段组件
358
565
  * @param widgetList
566
+ * @param staticWidgetsIncluded 是否包含按钮等静态组件,默认不包含
359
567
  * @returns {[]}
360
568
  */
361
- export function getAllFieldWidgets(widgetList) {
362
- let result = []
569
+ export function getAllFieldWidgets(widgetList, staticWidgetsIncluded) {
570
+ if (!widgetList) {
571
+ return [];
572
+ }
573
+
574
+ let result = [];
363
575
  let handlerFn = (w) => {
364
576
  result.push({
365
577
  type: w.type,
366
578
  name: w.options.name,
367
- field: w
368
- })
369
- }
370
- traverseFieldWidgets(widgetList, handlerFn)
579
+ field: w,
580
+ });
581
+ };
582
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
371
583
 
372
- return result
584
+ return result;
373
585
  }
374
586
 
375
587
  /**
376
588
  * 获取所有容器组件
377
589
  * @param widgetList
590
+ * @param skipDialogAndDrawer 是否跳过弹窗和抽屉内部组件,默认不跳过
378
591
  * @returns {[]}
379
592
  */
380
- export function getAllContainerWidgets(widgetList) {
381
- let result = []
593
+ export function getAllContainerWidgets(widgetList, skipDialogAndDrawer) {
594
+ if (!widgetList) {
595
+ return [];
596
+ }
597
+
598
+ let result = [];
382
599
  let handlerFn = (w) => {
383
600
  result.push({
384
601
  type: w.type,
385
602
  name: w.options.name,
386
- container: w
387
- })
603
+ container: w,
604
+ });
605
+ };
606
+ traverseContainerWidgets(widgetList, handlerFn, skipDialogAndDrawer);
607
+
608
+ return result;
609
+ }
610
+
611
+ export function getFieldWidgetByName(
612
+ widgetList,
613
+ fieldName,
614
+ staticWidgetsIncluded
615
+ ) {
616
+ if (!widgetList) {
617
+ return null;
388
618
  }
389
- traverseContainWidgets(widgetList, handlerFn)
390
619
 
391
- return result
620
+ let foundWidget = null;
621
+ let handlerFn = (widget) => {
622
+ if (widget.options.name === fieldName) {
623
+ foundWidget = widget;
624
+ }
625
+ };
626
+
627
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
628
+ return foundWidget;
392
629
  }
393
630
 
394
- export function getFieldWidgetByName(e, t) {
395
- var i = null,
396
- n = function (e) {
397
- e.options.name === t && (i = e)
398
- };
399
- return traverseFieldWidgets(e, n),
400
- i
631
+ export const columnFormatMap = {
632
+ editInput: "input",
633
+ editNumber: "number",
634
+ editDate: "date",
635
+ editSelect: "select",
636
+ editSearch: "vabsearch",
637
+ editAttachment: "baseAttachment",
638
+ editStatus: "status",
639
+ aText: "a-text",
640
+ aLink: "a-link",
641
+ editDelete: "a-link",
642
+ editButton: "a-link",
643
+ button: "button",
644
+ addSiblingEditRow: "a-link",
645
+ addChildTreeRow: "a-link",
646
+ moveUpRow: "a-link",
647
+ moveDownRow: "a-link",
648
+ removeTreeRow: "a-link",
649
+ text: "text",
650
+ checkbox: "checkbox",
651
+ radio: "radio",
652
+ };
653
+
654
+ export function getFieldWidgetById(widgetList, fieldId, staticWidgetsIncluded) {
655
+ if (!widgetList) {
656
+ return null;
657
+ }
658
+
659
+ let foundWidget = null;
660
+ let handlerFn = (widget) => {
661
+ if (widget.id === fieldId) {
662
+ foundWidget = widget;
663
+ } else if (widget.type == "data-table") {
664
+ for (let column of widget.options.tableColumns) {
665
+ if (column?.widget?.id + "" === fieldId) {
666
+ foundWidget = column.widget;
667
+ break
668
+ } else if (column.widgetList) {
669
+ loopHandleWidget(column.widgetList, (item1) => {
670
+ if (item1.id === fieldId) {
671
+ foundWidget = item1;
672
+ }
673
+ });
674
+ }
675
+ }
676
+ }
677
+ };
678
+
679
+ traverseFieldWidgets(widgetList, handlerFn, null, staticWidgetsIncluded);
680
+ return foundWidget;
401
681
  }
402
682
 
403
- export function getContainerWidgetByName(e, t) {
404
- var i = null,
405
- n = function (e) {
406
- e.options.name === t && (i = e)
407
- };
408
- return traverseContainerWidgets(e, n),
409
- i
683
+ export function getContainerWidgetByName(widgetList, containerName) {
684
+ if (!widgetList) {
685
+ return null;
686
+ }
687
+
688
+ let foundContainer = null;
689
+ let handlerFn = (con) => {
690
+ if (con.options.name === containerName) {
691
+ foundContainer = con;
692
+ }
693
+ };
694
+
695
+ traverseContainerWidgets(widgetList, handlerFn);
696
+ return foundContainer;
410
697
  }
411
698
 
412
- export function getContainerWidgetById(e, t) {
413
- var i = null,
414
- n = function (e) {
415
- e.id === t && (i = e)
416
- };
417
- return traverseContainerWidgets(e, n),
418
- i
699
+ export function getContainerWidgetById(widgetList, containerId) {
700
+ if (!widgetList) {
701
+ return null;
702
+ }
703
+
704
+ let foundContainer = null;
705
+ let handlerFn = (con) => {
706
+ if (con.id === containerId) {
707
+ foundContainer = con;
708
+ }
709
+ };
710
+
711
+ traverseContainerWidgets(widgetList, handlerFn);
712
+ return foundContainer;
419
713
  }
420
714
 
421
- export function copyToClipboard(content, clickEvent, $message, successMsg, errorMsg) {
715
+ export function copyToClipboard(
716
+ content,
717
+ clickEvent,
718
+ $message,
719
+ successMsg,
720
+ errorMsg
721
+ ) {
422
722
  const clipboard = new Clipboard(clickEvent.target, {
423
- text: () => content
424
- })
723
+ text: () => content,
724
+ });
425
725
 
426
- clipboard.on('success', () => {
427
- $message.success(successMsg)
428
- clipboard.destroy()
429
- })
726
+ clipboard.on("success", () => {
727
+ $message.success(successMsg);
728
+ clipboard.destroy();
729
+ });
430
730
 
431
- clipboard.on('error', () => {
432
- $message.error(errorMsg)
433
- clipboard.destroy()
434
- })
731
+ clipboard.on("error", () => {
732
+ $message.error(errorMsg);
733
+ clipboard.destroy();
734
+ });
435
735
 
436
- clipboard.onClick(clickEvent)
736
+ clipboard.onClick(clickEvent);
437
737
  }
438
738
 
439
739
  export function getQueryParam(variable) {
440
740
  let query = window.location.search.substring(1);
441
- let vars = query.split("&")
741
+ let vars = query.split("&");
442
742
  for (let i = 0; i < vars.length; i++) {
443
- let pair = vars[i].split("=")
743
+ let pair = vars[i].split("=");
444
744
  if (pair[0] == variable) {
445
- return pair[1]
745
+ return pair[1];
446
746
  }
447
747
  }
448
748
 
@@ -469,7 +769,7 @@ export function getDefaultFormConfig() {
469
769
  onFormDataChange: "",
470
770
  gridConfig: {
471
771
  accessReturnType: 1,
472
- isLoadDataByAccess: false
772
+ isLoadDataByAccess: false,
473
773
  },
474
774
  getConfig: {
475
775
  accessType: "1",
@@ -477,7 +777,7 @@ export function getDefaultFormConfig() {
477
777
  accessParam: null,
478
778
  accessCallback: null,
479
779
  scriptName: null,
480
- scriptCode: null
780
+ scriptCode: null,
481
781
  },
482
782
  saveConfig: {
483
783
  accessType: "1",
@@ -485,7 +785,7 @@ export function getDefaultFormConfig() {
485
785
  accessParam: null,
486
786
  accessCallback: null,
487
787
  scriptName: null,
488
- scriptCode: null
788
+ scriptCode: null,
489
789
  },
490
790
  scriptList: [],
491
791
  formType: 0,
@@ -503,36 +803,38 @@ export function getDefaultFormConfig() {
503
803
  formScriptSuccess: null,
504
804
  saveScriptCode: "saveUpdate",
505
805
  wfConfig: null,
506
- wfStartBindSave: false
507
- }
806
+ wfStartBindSave: false,
807
+ };
508
808
  }
509
809
 
510
810
  export function buildDefaultFormJson() {
511
811
  return {
512
812
  widgetList: [],
513
- formConfig: deepClone(getDefaultFormConfig())
514
- }
813
+ formConfig: deepClone(getDefaultFormConfig()),
814
+ };
515
815
  }
516
816
 
517
817
  export function cloneFormConfigWithoutEventHandler(e) {
518
818
  var t = deepClone(e);
519
- return t.onFormCreated = "",
520
- t.onFormMounted = "",
521
- t.onFormDataChange = "",
522
- t
819
+ return (
820
+ (t.onFormCreated = ""), (t.onFormMounted = ""), (t.onFormDataChange = ""), t
821
+ );
523
822
  }
524
823
 
525
824
  export function translateOptionItems(e, t, i, n) {
526
- if ("cascader" === t)
527
- return deepClone(e);
825
+ if ("cascader" === t) return deepClone(e);
528
826
  var o = [];
529
- return e && e.length > 0 && e.forEach((function (e) {
530
- o.push({
531
- [i]: e[i],
532
- [n]: e[n]
533
- })
534
- })),
535
- o
827
+ return (
828
+ e &&
829
+ e.length > 0 &&
830
+ e.forEach(function (e) {
831
+ o.push({
832
+ [i]: e[i],
833
+ [n]: e[n],
834
+ });
835
+ }),
836
+ o
837
+ );
536
838
  }
537
839
 
538
840
  export function assembleAxiosConfig(arrayObj, DSV, VFR) {
@@ -540,15 +842,17 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
540
842
  if (arrayObj && arrayObj.length) {
541
843
  arrayObj.map(function (ai) {
542
844
  if ("String" === ai.type) {
543
- result[ai.name] = String(ai.value)
845
+ result[ai.name] = String(ai.value);
544
846
  } else if ("Number" === ai.type) {
545
- result[ai.name] = Number(ai.value)
847
+ result[ai.name] = Number(ai.value);
546
848
  } else if ("Boolean" === ai.type) {
547
- "false" === ai.value
548
- .toLowerCase() || "0" === ai.value ? result[ai.name] = !1 : "true" === ai.value.toLowerCase()
549
- || "1" === ai.value ? result[ai.name] = !0 : result[ai.name] = null
849
+ "false" === ai.value.toLowerCase() || "0" === ai.value
850
+ ? (result[ai.name] = !1)
851
+ : "true" === ai.value.toLowerCase() || "1" === ai.value
852
+ ? (result[ai.name] = !0)
853
+ : (result[ai.name] = null);
550
854
  } else if ("Variable" === ai.type) {
551
- result[ai.name] = eval(ai.value)
855
+ result[ai.name] = eval(ai.value);
552
856
  } else if ("FormData" === ai.type) {
553
857
  if (VFR.formDataModel.hasOwnProperty(ai.value)) {
554
858
  result[ai.name] = VFR.formDataModel[ai.value];
@@ -559,7 +863,7 @@ export function assembleAxiosConfig(arrayObj, DSV, VFR) {
559
863
  }
560
864
  }
561
865
  }
562
- })
866
+ });
563
867
  }
564
868
  return result;
565
869
 
@@ -585,14 +889,14 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
585
889
  let requestAccess = DSV.requestAccess;
586
890
  // config.url = dataSource.requestURL;
587
891
  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);
892
+ (config.method = dataSource.requestMethod || "post"),
893
+ (config.headers = assembleAxiosConfig(dataSource.headers, DSV, VFR)),
894
+ (config.params = assembleAxiosConfig(dataSource.params, DSV, VFR));
591
895
  // config.data = assembleAxiosConfig(dataSource.data, DSV, VFR);
592
896
  let data = {};
593
897
  let conditions = assembleAxiosConfig(dataSource.data, DSV, VFR);
594
898
 
595
- let globalReqData = getReportGlobalMap();//全局请求参数
899
+ let globalReqData = getReportGlobalMap(); //全局请求参数
596
900
  Object.assign(conditions, globalReqData);
597
901
 
598
902
  let doms = VFR.getWidgetRef(DSV.widgetName);
@@ -619,20 +923,39 @@ export function buildRequestConfig(dataSource, DSV, VFR, isSandbox) {
619
923
  } */
620
924
 
621
925
  config.data = data;
622
- var chFn = new Function("config", "isSandbox", "DSV", "VFR", dataSource.configHandlerCode);
623
- return chFn.call(null, config, isSandbox, DSV, VFR)
926
+ var chFn = new Function(
927
+ "config",
928
+ "isSandbox",
929
+ "DSV",
930
+ "VFR",
931
+ dataSource.configHandlerCode
932
+ );
933
+ return chFn.call(null, config, isSandbox, DSV, VFR);
624
934
  }
625
935
 
626
936
  export function runDataSourceRequest(e, t, i, n, o) {
627
- return _runDataSourceRequest.apply(this, arguments)
937
+ return _runDataSourceRequest.apply(this, arguments);
628
938
  }
629
939
 
630
940
  export function _runDataSourceRequest() {
631
941
  let _runDataSourceRequestN = function (t, i, n, o, a) {
632
942
  var l, s, r, d;
633
- l = buildRequestConfig(t, i, n, o),
634
- r = new Function("result", "isSandbox", "DSV", "VFR", t.dataHandlerCode),
635
- d = new Function("error", "isSandbox", "DSV", "$message", "VFR", t.errorHandlerCode);
943
+ (l = buildRequestConfig(t, i, n, o)),
944
+ (r = new Function(
945
+ "result",
946
+ "isSandbox",
947
+ "DSV",
948
+ "VFR",
949
+ t.dataHandlerCode
950
+ )),
951
+ (d = new Function(
952
+ "error",
953
+ "isSandbox",
954
+ "DSV",
955
+ "$message",
956
+ "VFR",
957
+ t.errorHandlerCode
958
+ ));
636
959
 
637
960
  /*
638
961
  axios.request(l).then(() => {
@@ -645,13 +968,13 @@ export function _runDataSourceRequest() {
645
968
  request({
646
969
  ...l,
647
970
  callback: (res) => {
648
- resolve(r.call(null, res, o, i, n))
971
+ resolve(r.call(null, res, o, i, n));
649
972
  },
650
973
  error: (error) => {
651
974
  d.call(null, error, o, i, a, n);
652
975
  reject(error);
653
- }
654
- })
976
+ },
977
+ });
655
978
  });
656
979
 
657
980
  /* return s = e.sent,
@@ -661,7 +984,7 @@ export function _runDataSourceRequest() {
661
984
  d = new Function("error","isSandbox","DSV","$message","VFR",t.errorHandlerCode),
662
985
  d.call(null, null, o, i, a, n), */
663
986
  };
664
- return _runDataSourceRequestN.apply(this, arguments)
987
+ return _runDataSourceRequestN.apply(this, arguments);
665
988
  /* 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
989
  var l, s, r, d;
667
990
  return regeneratorRuntime.wrap((function(e) {
@@ -695,10 +1018,14 @@ export function _runDataSourceRequest() {
695
1018
 
696
1019
  export function getDSByName(e, t) {
697
1020
  var i = null;
698
- return t && e.dataSources && e.dataSources.forEach((function (e) {
699
- e.uniqueName === t && (i = e)
700
- })),
701
- i
1021
+ return (
1022
+ t &&
1023
+ e.dataSources &&
1024
+ e.dataSources.forEach(function (e) {
1025
+ e.uniqueName === t && (i = e);
1026
+ }),
1027
+ i
1028
+ );
702
1029
  }
703
1030
 
704
1031
  export function setReportGlobalParam(value) {
@@ -720,8 +1047,8 @@ export function getSubFormNameByFieldId(o, e) {
720
1047
  const c = (u) => {
721
1048
  u.id === e && (n = s.name);
722
1049
  };
723
- (s.type === "sub-form" || s.type === "grid-sub-form")
724
- && traverseFieldWidgetsOfContainer(s.container, c);
1050
+ (s.type === "sub-form" || s.type === "grid-sub-form") &&
1051
+ traverseFieldWidgetsOfContainer(s.container, c);
725
1052
  }),
726
1053
  n
727
1054
  );
@@ -739,41 +1066,25 @@ export function fieldIsUsedInFormula(o, e, n) {
739
1066
  if (u.substring(0, u.length - 2) === "func") return;
740
1067
  const g = c.split(".")[0],
741
1068
  y = g.substring(2, g.length);
742
- getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options
743
- .name === o && (s = !0);
1069
+ getFieldWidgetById(n.formJsonObj.widgetList, y, !1).options.name === o &&
1070
+ (s = !0);
744
1071
  }),
745
1072
  s
746
1073
  );
747
1074
  }
748
1075
 
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
762
- );
763
- }
764
-
765
1076
  export function calculateFormula(o, e, n, l, s) {
766
1077
  if (
767
- !!l.subFormItemFlag
768
- && !!s.subFormItemFlag
769
- && s.subFormRowId !== l.subFormRowId
1078
+ !!l.subFormItemFlag &&
1079
+ !!s.subFormItemFlag &&
1080
+ s.subFormRowId !== l.subFormRowId
770
1081
  )
771
1082
  return;
772
1083
  let c = l.field.options.formula;
773
1084
  c = replaceFieldsAndFunctionsOfFormula(o, l);
774
1085
  const u = c.match(/[A-Za-z]*/g);
775
- u
776
- && u.forEach((g) => {
1086
+ u &&
1087
+ u.forEach((g) => {
777
1088
  if (!!g && findCalFunStartIndex(g) !== -1) {
778
1089
  const y = g.toUpperCase();
779
1090
  c = c.replace(g, "formulaJs." + y);
@@ -808,9 +1119,7 @@ export function replaceFieldsAndFunctionsOfFormula(o, e) {
808
1119
  const w = o.getSubFormNameOfWidget(f.options.name);
809
1120
  if (e.subFormItemFlag)
810
1121
  w === e.subFormName
811
- ? ((v = o.getWidgetRef(
812
- f.options.name + "@row" + e.subFormRowId
813
- )),
1122
+ ? ((v = o.getWidgetRef(f.options.name + "@row" + e.subFormRowId)),
814
1123
  v && (s = s.replaceAll(c, v.getValue())))
815
1124
  : console.error("Invalid formula!");
816
1125
  else {
@@ -953,10 +1262,7 @@ export function trimEx(o, e, n) {
953
1262
  ? o.replace(new RegExp("^%%" + e + "+", "g"), "")
954
1263
  : n === "right"
955
1264
  ? o.replace(new RegExp("%%" + e + "+$", "g"), "")
956
- : o.replace(
957
- new RegExp("^%%" + e + "+|%%" + e + "+$", "g"),
958
- ""
959
- )
1265
+ : o.replace(new RegExp("^%%" + e + "+|%%" + e + "+$", "g"), "")
960
1266
  : o.replace(/^%s+|%s+$/g, "");
961
1267
  }
962
1268
 
@@ -985,647 +1291,104 @@ export function objectKeysToArray(o) {
985
1291
  }
986
1292
 
987
1293
  //begin
988
- /*export class EditorView {
989
- get state() {
990
- return this.viewState.state;
991
- }
992
- get viewport() {
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);
1294
+ export function loopHandleWidget(widgetList, callback) {
1295
+ widgetList &&
1296
+ widgetList.length > 0 &&
1297
+ widgetList.forEach(function (e) {
1298
+ loopHandleWidgetItem(e, null, callback);
1299
+ });
1300
+ }
1301
+
1302
+ function loopHandleWidgetItem(e, p, callback) {
1303
+ if ("container" === e.category) {
1304
+ callback(e, p);
1305
+ if ("vf-dialog" === e.type || "vf-drawer" === e.type) ;
1306
+ else if ("data-table" === e.type) {
1307
+ if (!!e.widgetList) {
1308
+ e.widgetList.forEach((childItem) => {
1309
+ loopHandleWidgetItem(childItem, e, callback);
1310
+ });
1129
1311
  }
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);
1168
- });
1169
- }
1170
- setState(e) {
1171
- if (this.updateState != 0)
1172
- throw new Error(
1173
- "Calls to EditorView.setState are not allowed while an update is in progress"
1174
- );
1175
- if (this.destroyed) {
1176
- this.viewState.state = e;
1177
- return;
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
- }
1312
+ if (!!e.buttons) {
1313
+ e.buttons.forEach((childItem) => {
1314
+ loopHandleWidgetItem(childItem, e, callback);
1315
+ });
1211
1316
  }
1212
- for (let c of this.plugins)
1213
- c.mustUpdate != e && c.destroy(this);
1214
- (this.plugins = s), this.pluginMap.clear();
1215
- } else for (let s of this.plugins) s.mustUpdate = e;
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
- }
1317
+ } else if ("list-h5" === e.type) {
1318
+ if (!!e.widgetList && e.widgetList.length > 0) {
1319
+ e.widgetList.forEach((childItem) => {
1320
+ loopHandleWidgetItem(childItem, e, callback);
1321
+ });
1316
1322
  }
1317
- } finally {
1318
- (this.updateState = 0), (this.measureScheduled = -1);
1319
- }
1320
- if (n && !n.empty)
1321
- for (let $ of this.state.facet(updateListener)) $(n);
1322
- }
1323
- get themeClasses() {
1324
- return (
1325
- baseThemeID +
1326
- " " +
1327
- (this.state.facet(darkTheme) ? baseDarkID : baseLightID) +
1328
- " " +
1329
- this.state.facet(theme)
1330
- );
1331
- }
1332
- updateAttrs() {
1333
- let e = attrsFromFacet(this, editorAttributes, {
1334
- class:
1335
- "cm-editor" +
1336
- (this.hasFocus ? " cm-focused " : " ") +
1337
- this.themeClasses,
1338
- }),
1339
- n = {
1340
- spellcheck: "false",
1341
- autocorrect: "off",
1342
- autocapitalize: "off",
1343
- translate: "no",
1344
- contenteditable: this.state.facet(editable)
1345
- ? "true"
1346
- : "false",
1347
- class: "cm-content",
1348
- style: `${browser.tabSize}: ${this.state.tabSize}`,
1349
- role: "textbox",
1350
- "aria-multiline": "true",
1351
- };
1352
- this.state.readOnly && (n["aria-readonly"] = "true"),
1353
- attrsFromFacet(this, contentAttributes, n);
1354
- let l = this.observer.ignore(() => {
1355
- let s = updateAttrs(this.contentDOM, this.contentAttrs, n),
1356
- c = updateAttrs(this.dom, this.editorAttrs, e);
1357
- return s || c;
1358
- });
1359
- return (this.editorAttrs = e), (this.contentAttrs = n), l;
1360
- }
1361
- showAnnouncements(e) {
1362
- let n = !0;
1363
- for (let l of e)
1364
- for (let s of l.effects)
1365
- if (s.is(EditorView.announce)) {
1366
- n && (this.announceDOM.textContent = ""), (n = !1);
1367
- let c = this.announceDOM.appendChild(
1368
- document.createElement("div")
1369
- );
1370
- c.textContent = s.value;
1371
- }
1372
- }
1373
- mountStyles() {
1374
- this.styleModules = this.state.facet(styleModule);
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
- }
1323
+ } else if ("grid" === e.type) {
1324
+ e.cols &&
1325
+ e.cols.length > 0 &&
1326
+ e.cols.forEach(function (childItem) {
1327
+ loopHandleWidgetItem(childItem, e, callback);
1328
+ });
1329
+ } else if ("table" === e.type) {
1330
+ e.rows &&
1331
+ e.rows.length > 0 &&
1332
+ e.rows.forEach(function (rowItem) {
1333
+ rowItem.cols &&
1334
+ rowItem.cols.length > 0 &&
1335
+ rowItem.cols.forEach(function (childItem) {
1336
+ loopHandleWidgetItem(childItem, e, callback);
1337
+ });
1338
+ });
1339
+ } else if ("h5-table" === e.type) {
1340
+ e.rows &&
1341
+ e.rows.length > 0 &&
1342
+ e.rows.forEach(function (rowItem) {
1343
+ rowItem.cols &&
1344
+ rowItem.cols.length > 0 &&
1345
+ rowItem.cols.forEach(function (childItem) {
1346
+ loopHandleWidgetItem(childItem, e, callback);
1347
+ });
1348
+ });
1349
+ } else if ("tab" === e.type) {
1350
+ e.tabs &&
1351
+ e.tabs.length > 0 &&
1352
+ e.tabs.forEach(function (tabItem) {
1353
+ tabItem.widgetList &&
1354
+ tabItem.widgetList.length > 0 &&
1355
+ tabItem.widgetList.forEach(function (childItem) {
1356
+ loopHandleWidgetItem(childItem, e, callback);
1357
+ });
1358
+ });
1359
+ } else if ("detail" === e.type) {
1360
+ if (e.panes) {
1361
+ e.panes.forEach(function (childItem) {
1362
+ loopHandleWidgetItem(childItem, e, callback);
1363
+ });
1406
1364
  }
1407
- this.measureRequests.push(e);
1365
+ if (e.widgetList) {
1366
+ e.widgetList.forEach(function (childItem) {
1367
+ loopHandleWidgetItem(childItem, e, callback);
1368
+ });
1369
+ }
1370
+ } else if ("detail-pane" === e.type) {
1371
+ if (e.widgetList) {
1372
+ e.widgetList.forEach(function (childItem) {
1373
+ loopHandleWidgetItem(childItem, e, callback);
1374
+ });
1375
+ }
1376
+ if (e.buttonWidgetList) {
1377
+ e.buttonWidgetList.forEach(function (childItem) {
1378
+ loopHandleWidgetItem(childItem, e, callback);
1379
+ });
1380
+ }
1381
+ } else {
1382
+ "grid-col" === e.type || e.type,
1383
+ e.widgetList &&
1384
+ e.widgetList.length > 0 &&
1385
+ e.widgetList.forEach(function (childItem) {
1386
+ loopHandleWidgetItem(childItem, e, callback);
1387
+ });
1408
1388
  }
1409
- }
1410
- plugin(e) {
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
- );
1389
+ } else {
1390
+ callback && callback(e);
1605
1391
  }
1606
1392
  }
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());*/
1393
+
1631
1394
  //end