@kp-ui/lowcode 1.0.31 → 1.0.32

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 (27) hide show
  1. package/_virtual/virtual_svg-icons-register.js +2 -2
  2. package/package.json +1 -1
  3. package/render.js +13 -14
  4. package/src/components/CustomRender/components/AttachmentRender.vue.js +1 -1
  5. package/src/components/CustomRender/components/AttachmentRender.vue2.js +25 -12
  6. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue.js +1 -0
  7. package/src/components/form-designer/form-widget/container-widget/data-table-widget.vue3.js +2 -3
  8. package/src/components/form-designer/form-widget/container-widget/vf-box-item.vue.js +4 -3
  9. package/src/components/form-designer/form-widget/container-widget/vf-box-widget.vue.js +4 -3
  10. package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue.js +2 -0
  11. package/src/components/form-designer/form-widget/container-widget/vf-collapse-widget.vue4.js +1 -1
  12. package/src/components/form-designer/form-widget/field-widget/diy-compontent-widget.vue.js +5 -3
  13. package/src/components/form-designer/form-widget/field-widget/fieldMixin.js +87 -122
  14. package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue.js +1 -1
  15. package/src/components/form-designer/form-widget/field-widget/file-upload-widget.vue2.js +25 -19
  16. package/src/components/form-designer/toolbar-panel/index.vue.js +4 -6
  17. package/src/components/form-designer/widget-panel/advanced/diy-compontent.js +1 -0
  18. package/src/components/form-render/container-item/vf-collapse-item.vue.js +4 -3
  19. package/src/components/form-render/dynamic-dialog.vue.js +236 -241
  20. package/src/components/form-render/dynamic-drawer.vue.js +206 -2
  21. package/src/utils/i18n.js +1 -14
  22. package/styles/style.css +1 -1
  23. package/types/src/components/CustomRender/components/AttachmentRender.d.ts.map +1 -1
  24. package/types/src/components/form-designer/widget-panel/advanced/diy-compontent.d.ts.map +1 -1
  25. package/types/src/components/form-render/index.d.ts.map +1 -1
  26. package/src/components/form-render/dynamic-dialog.vue3.js +0 -5
  27. package/src/components/form-render/dynamic-drawer.vue2.js +0 -247
@@ -1,19 +1,19 @@
1
- import { translateOptionItems, deepClone } from '../../../../utils/util.js';
2
- import FormValidators from '../../../../utils/validators.js';
3
- import { fmtHttpParams } from '../../../../utils/request/fmtHttpParams.js';
4
- import { eq, isArray } from 'lodash-es';
1
+ import { translateOptionItems, deepClone } from "../../../../utils/util.js";
2
+ import FormValidators from "../../../../utils/validators.js";
3
+ import { fmtHttpParams } from "../../../../utils/request/fmtHttpParams.js";
4
+ import { eq, isArray } from "lodash-es";
5
5
  const fieldMixin = {
6
6
  inject: [
7
- 'refList',
8
- 'getFormConfig',
9
- 'globalOptionData',
10
- 'globalModel',
11
- 'getOptionData',
12
- 'getGlobalDsv',
13
- 'getReadMode',
14
- 'getSubFormFieldFlag',
15
- 'getSubFormName',
16
- 'getDSResultCache'
7
+ "refList",
8
+ "getFormConfig",
9
+ "globalOptionData",
10
+ "globalModel",
11
+ "getOptionData",
12
+ "getGlobalDsv",
13
+ "getReadMode",
14
+ "getSubFormFieldFlag",
15
+ "getSubFormName",
16
+ "getDSResultCache"
17
17
  ],
18
18
  data() {
19
19
  return {
@@ -22,14 +22,11 @@ const fieldMixin = {
22
22
  };
23
23
  },
24
24
  computed: {
25
- isFileMode() {
26
- return this.field.type === 'file-upload' || this.field.type === 'picture-upload';
27
- },
28
25
  formConfig() {
29
26
  return this.getFormConfig();
30
27
  },
31
28
  subFormName() {
32
- return !!this.getSubFormName ? this.getSubFormName() : '';
29
+ return !!this.getSubFormName ? this.getSubFormName() : "";
33
30
  },
34
31
  subFormItemFlag() {
35
32
  return !!this.getSubFormFieldFlag ? this.getSubFormFieldFlag() : false;
@@ -45,17 +42,13 @@ const fieldMixin = {
45
42
  },
46
43
  optionLabel() {
47
44
  if (this.fieldModel === null) {
48
- return '';
45
+ return "";
49
46
  } else {
50
- let resultContent = '';
47
+ let resultContent = "";
51
48
  const { valueKey, labelKey } = this.field.options;
52
- this.field.options.optionItems.forEach(oItem => {
53
- if (
54
- oItem[valueKey] === this.fieldModel ||
55
- this.findInArray(this.fieldModel, oItem[valueKey]) !== -1
56
- ) {
57
- resultContent =
58
- resultContent === '' ? oItem[labelKey] : resultContent + ' ' + oItem[labelKey];
49
+ this.field.options.optionItems.forEach((oItem) => {
50
+ if (oItem[valueKey] === this.fieldModel || this.findInArray(this.fieldModel, oItem[valueKey]) !== -1) {
51
+ resultContent = resultContent === "" ? oItem[labelKey] : resultContent + " " + oItem[labelKey];
59
52
  }
60
53
  });
61
54
  return resultContent;
@@ -102,7 +95,7 @@ const fieldMixin = {
102
95
  //--------------------- 组件内部方法 begin ------------------//
103
96
  getPropName() {
104
97
  if (this.subFormItemFlag && !this.designState) {
105
- return this.subFormName + '.' + this.subFormRowIndex + '.' + this.field.options.name;
98
+ return this.subFormName + "." + this.subFormRowIndex + "." + this.field.options.name;
106
99
  } else {
107
100
  return this.field.options.name;
108
101
  }
@@ -113,15 +106,9 @@ const fieldMixin = {
113
106
  }
114
107
  if (!!this.subFormItemFlag && !this.designState) {
115
108
  const subFormData = this.formModel[this.subFormName];
116
- if (
117
- (subFormData === void 0 ||
118
- subFormData[this.subFormRowIndex] === void 0 ||
119
- subFormData[this.subFormRowIndex][this.field.options.name] === void 0) &&
120
- this.field.options.defaultValue !== void 0
121
- ) {
109
+ if ((subFormData === void 0 || subFormData[this.subFormRowIndex] === void 0 || subFormData[this.subFormRowIndex][this.field.options.name] === void 0) && this.field.options.defaultValue !== void 0) {
122
110
  this.fieldModel = this.field.options.defaultValue;
123
- subFormData[this.subFormRowIndex][this.field.options.name] =
124
- this.field.options.defaultValue;
111
+ subFormData[this.subFormRowIndex][this.field.options.name] = this.field.options.defaultValue;
125
112
  } else if (subFormData[this.subFormRowIndex][this.field.options.name] === void 0) {
126
113
  this.fieldModel = null;
127
114
  subFormData[this.subFormRowIndex][this.field.options.name] = null;
@@ -141,10 +128,7 @@ const fieldMixin = {
141
128
  this.initFileList();
142
129
  return;
143
130
  }
144
- if (
145
- this.formModel[this.field.options.name] === void 0 &&
146
- this.field.options.defaultValue !== void 0
147
- ) {
131
+ if (this.formModel[this.field.options.name] === void 0 && this.field.options.defaultValue !== void 0) {
148
132
  this.fieldModel = this.field.options.defaultValue;
149
133
  } else if (this.formModel[this.field.options.name] === void 0) {
150
134
  this.formModel[this.field.options.name] = null;
@@ -155,7 +139,7 @@ const fieldMixin = {
155
139
  this.initFileList();
156
140
  },
157
141
  initFileList() {
158
- if (!this.isFileMode || this.designState === true) {
142
+ if (this.field.type !== "picture-upload" && this.field.type !== "file-upload" || this.designState === true) {
159
143
  return;
160
144
  }
161
145
  if (!!this.fieldModel) {
@@ -167,16 +151,12 @@ const fieldMixin = {
167
151
  }
168
152
  },
169
153
  initEventHandler() {
170
- this.on$('setFormData', newFormData => {
154
+ this.on$("setFormData", (newFormData) => {
171
155
  if (!this.subFormItemFlag) {
172
- let data = newFormData?.[this.field.options.name] || '';
173
- if (this.isFileMode) {
174
- if (typeof data === 'string' && data !== '') data = JSON.parse(data);
175
- }
176
- this.setValue(data);
156
+ this.setValue(newFormData[this.field.options.name]);
177
157
  }
178
158
  });
179
- this.on$('field-value-changed', values => {
159
+ this.on$("field-value-changed", (values) => {
180
160
  if (!!this.subFormItemFlag) {
181
161
  const subFormData = this.formModel[this.subFormName];
182
162
  this.handleOnChangeForSubForm(values[0], values[1], subFormData, this.subFormRowId);
@@ -184,10 +164,10 @@ const fieldMixin = {
184
164
  this.handleOnChange(values[0], values[1]);
185
165
  }
186
166
  });
187
- this.on$('loadOptionItemsFromDataSet', dsName => {
167
+ this.on$("loadOptionItemsFromDataSet", (dsName) => {
188
168
  this.loadOptionItemsFromDataSet(dsName);
189
169
  });
190
- this.on$('reloadOptionItems', widgetNames => {
170
+ this.on$("reloadOptionItems", (widgetNames) => {
191
171
  if (widgetNames.length === 0 || widgetNames.indexOf(this.field.options.name) > -1) {
192
172
  this.initOptionItems(true);
193
173
  }
@@ -215,9 +195,9 @@ const fieldMixin = {
215
195
  if (this.refList !== null && !!this.field.options.name) {
216
196
  if (this.subFormItemFlag && !this.designState) {
217
197
  if (!!oldRefName) {
218
- delete this.refList[oldRefName + '@row' + this.subFormRowId];
198
+ delete this.refList[oldRefName + "@row" + this.subFormRowId];
219
199
  }
220
- this.refList[this.field.options.name + '@row' + this.subFormRowId] = this;
200
+ this.refList[this.field.options.name + "@row" + this.subFormRowId] = this;
221
201
  } else {
222
202
  if (!!oldRefName) {
223
203
  delete this.refList[oldRefName];
@@ -230,7 +210,7 @@ const fieldMixin = {
230
210
  if (this.refList !== null && !!this.field.options.name) {
231
211
  const oldRefName = this.field.options.name;
232
212
  if (this.subFormItemFlag && !this.designState) {
233
- delete this.refList[oldRefName + '@row' + this.subFormRowId];
213
+ delete this.refList[oldRefName + "@row" + this.subFormRowId];
234
214
  } else {
235
215
  delete this.refList[oldRefName];
236
216
  }
@@ -248,11 +228,8 @@ const fieldMixin = {
248
228
  }
249
229
  if (this.loading) return;
250
230
  this.loading = true;
251
- if (['radio', 'checkbox', 'select', 'cascader', 'treeSelect'].includes(this.field.type)) {
252
- if (
253
- !!this.field.options.dsEnabled &&
254
- ((_a = this.field.options.http) == null ? void 0 : _a.url)
255
- ) {
231
+ if (["radio", "checkbox", "select", "cascader", "treeSelect"].includes(this.field.type)) {
232
+ if (!!this.field.options.dsEnabled && ((_a = this.field.options.http) == null ? void 0 : _a.url)) {
256
233
  try {
257
234
  const dsResult = await fmtHttpParams.call(this, this.field.options, {
258
235
  fieldCode: this.field.options.name
@@ -270,7 +247,7 @@ const fieldMixin = {
270
247
  }
271
248
  }
272
249
  } catch (err) {
273
- console.error('err: ', err);
250
+ console.error("err: ", err);
274
251
  }
275
252
  }
276
253
  const newOptionItems = this.getOptionData();
@@ -288,20 +265,10 @@ const fieldMixin = {
288
265
  if (this.designState) {
289
266
  return;
290
267
  }
291
- if (
292
- this.field.type !== 'radio' &&
293
- this.field.type !== 'checkbox' &&
294
- this.field.type !== 'select' &&
295
- this.field.type !== 'cascader'
296
- ) {
268
+ if (this.field.type !== "radio" && this.field.type !== "checkbox" && this.field.type !== "select" && this.field.type !== "cascader") {
297
269
  return;
298
270
  }
299
- if (
300
- !this.field.options.dsEnabled ||
301
- !this.field.options.dsName ||
302
- !this.field.options.dataSetName ||
303
- this.field.options.dsName !== dsName
304
- ) {
271
+ if (!this.field.options.dsEnabled || !this.field.options.dsName || !this.field.options.dataSetName || this.field.options.dsName !== dsName) {
305
272
  return;
306
273
  }
307
274
  const dataCache = this.getDSResultCache();
@@ -331,8 +298,10 @@ const fieldMixin = {
331
298
  this.rules.push({
332
299
  required: true,
333
300
  //trigger: ['blur', 'change'],
334
- trigger: ['blur'],
335
- message: this.field.options.requiredHint || this.i18nt('render.hint.fieldRequired')
301
+ trigger: [
302
+ "blur"
303
+ ],
304
+ message: this.field.options.requiredHint || this.i18nt("render.hint.fieldRequired")
336
305
  });
337
306
  }
338
307
  if (!!this.field.options.validation) {
@@ -340,14 +309,14 @@ const fieldMixin = {
340
309
  if (!!FormValidators[vldName]) {
341
310
  this.rules.push({
342
311
  validator: FormValidators[vldName],
343
- trigger: ['blur', 'change'],
312
+ trigger: ["blur", "change"],
344
313
  label: this.field.options.label,
345
314
  errorMsg: this.field.options.validationHint
346
315
  });
347
316
  } else {
348
317
  this.rules.push({
349
- validator: FormValidators['regExp'],
350
- trigger: ['blur', 'change'],
318
+ validator: FormValidators["regExp"],
319
+ trigger: ["blur", "change"],
351
320
  regExp: vldName,
352
321
  label: this.field.options.label,
353
322
  errorMsg: this.field.options.validationHint
@@ -356,12 +325,12 @@ const fieldMixin = {
356
325
  }
357
326
  if (!!this.field.options.onValidate) {
358
327
  const customFn = (rule, value) => {
359
- const tmpFunc = new Function('rule', 'value', this.field.options.onValidate);
328
+ const tmpFunc = new Function("rule", "value", this.field.options.onValidate);
360
329
  return tmpFunc.call(this, rule, value);
361
330
  };
362
331
  this.rules.push({
363
332
  validator: customFn,
364
- trigger: ['blur'],
333
+ trigger: ["blur"],
365
334
  label: this.field.options.label
366
335
  });
367
336
  }
@@ -373,7 +342,7 @@ const fieldMixin = {
373
342
  if (!this.rules) {
374
343
  return;
375
344
  }
376
- this.rules.forEach(rule => {
345
+ this.rules.forEach((rule) => {
377
346
  if (!!rule.trigger) {
378
347
  rule.trigger.splice(0, rule.trigger.length);
379
348
  }
@@ -386,16 +355,16 @@ const fieldMixin = {
386
355
  if (!this.rules) {
387
356
  return;
388
357
  }
389
- this.rules.forEach(rule => {
358
+ this.rules.forEach((rule) => {
390
359
  if (!!rule.trigger) {
391
- rule.trigger.push('blur');
392
- rule.trigger.push('change');
360
+ rule.trigger.push("blur");
361
+ rule.trigger.push("change");
393
362
  }
394
363
  });
395
364
  },
396
365
  disableOptionOfList(optionList, optionValue) {
397
366
  if (!!optionList && optionList.length > 0) {
398
- optionList.forEach(opt => {
367
+ optionList.forEach((opt) => {
399
368
  if (opt.value === optionValue) {
400
369
  opt.disabled = true;
401
370
  }
@@ -404,7 +373,7 @@ const fieldMixin = {
404
373
  },
405
374
  enableOptionOfList(optionList, optionValue) {
406
375
  if (!!optionList && optionList.length > 0) {
407
- optionList.forEach(opt => {
376
+ optionList.forEach((opt) => {
408
377
  if (opt.value === optionValue) {
409
378
  opt.disabled = false;
410
379
  }
@@ -417,8 +386,8 @@ const fieldMixin = {
417
386
  if (newValue) {
418
387
  newValue = newValue.target ? newValue.target.value : newValue;
419
388
  }
420
- this.emit$('field-value-changed', [newValue, oldValue]);
421
- this.dispatch('VFormRender', 'fieldChange', [
389
+ this.emit$("field-value-changed", [newValue, oldValue]);
390
+ this.dispatch("VFormRender", "fieldChange", [
422
391
  this.field.options.name,
423
392
  newValue,
424
393
  oldValue,
@@ -450,7 +419,7 @@ const fieldMixin = {
450
419
  this.syncUpdateFormModel(value);
451
420
  this.emitFieldDataChange(value, this.oldFieldValue);
452
421
  this.oldFieldValue = deepClone(value);
453
- this.dispatch('VFormRender', 'fieldValidation', [this.getPropName()]);
422
+ this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]);
454
423
  },
455
424
  handleFocusCustomEvent(event) {
456
425
  if (!!this.designState) {
@@ -458,7 +427,7 @@ const fieldMixin = {
458
427
  }
459
428
  this.oldFieldValue = deepClone(this.fieldModel);
460
429
  if (!!this.field.options.onFocus) {
461
- const customFn = new Function('event', this.field.options.onFocus);
430
+ const customFn = new Function("event", this.field.options.onFocus);
462
431
  customFn.call(this, event);
463
432
  }
464
433
  if (this.field.options.loadingPage) {
@@ -471,7 +440,7 @@ const fieldMixin = {
471
440
  return;
472
441
  }
473
442
  if (!!this.field.options.onBlur) {
474
- const customFn = new Function('event', this.field.options.onBlur);
443
+ const customFn = new Function("event", this.field.options.onBlur);
475
444
  customFn.call(this, event);
476
445
  }
477
446
  },
@@ -483,9 +452,9 @@ const fieldMixin = {
483
452
  return;
484
453
  }
485
454
  this.syncUpdateFormModel(value);
486
- this.dispatch('VFormRender', 'fieldValidation', [this.getPropName()]);
455
+ this.dispatch("VFormRender", "fieldValidation", [this.getPropName()]);
487
456
  if (!!this.field.options.onInput) {
488
- const customFn = new Function('value', this.field.options.onInput);
457
+ const customFn = new Function("value", this.field.options.onInput);
489
458
  customFn.call(this, value);
490
459
  }
491
460
  },
@@ -497,7 +466,7 @@ const fieldMixin = {
497
466
  const customFn = new Function(this.field.options.onAppendButtonClick);
498
467
  customFn.call(this);
499
468
  } else {
500
- this.dispatch('VFormRender', 'appendButtonClick', [this]);
469
+ this.dispatch("VFormRender", "appendButtonClick", [this]);
501
470
  }
502
471
  },
503
472
  handleOnChange(val, oldVal, ops = []) {
@@ -505,7 +474,7 @@ const fieldMixin = {
505
474
  return;
506
475
  }
507
476
  if (!!this.field.options.onChange) {
508
- const changeFn = new Function('value', 'oldValue', 'ops', this.field.options.onChange);
477
+ const changeFn = new Function("value", "oldValue", "ops", this.field.options.onChange);
509
478
  changeFn.call(this, val, oldVal, ops[0]);
510
479
  }
511
480
  },
@@ -515,11 +484,11 @@ const fieldMixin = {
515
484
  }
516
485
  if (!!this.field.options.onChange) {
517
486
  const changeFn = new Function(
518
- 'value',
519
- 'oldValue',
520
- 'ops',
521
- 'subFormData',
522
- 'rowId',
487
+ "value",
488
+ "oldValue",
489
+ "ops",
490
+ "subFormData",
491
+ "rowId",
523
492
  this.field.options.onChange
524
493
  );
525
494
  changeFn.call(this, val, oldVal, ops[0], subFormData, rowId);
@@ -533,7 +502,7 @@ const fieldMixin = {
533
502
  const customFn = new Function(this.field.options.onClick);
534
503
  return customFn.call(this);
535
504
  } else {
536
- this.dispatch('VFormRender', 'buttonClick', [this]);
505
+ this.dispatch("VFormRender", "buttonClick", [this]);
537
506
  }
538
507
  },
539
508
  handleButtonWidgetClick() {
@@ -544,7 +513,7 @@ const fieldMixin = {
544
513
  const customFn = new Function(this.field.options.onClick);
545
514
  return customFn.call(this);
546
515
  } else {
547
- this.dispatch('VFormRender', 'buttonClick', [this]);
516
+ this.dispatch("VFormRender", "buttonClick", [this]);
548
517
  }
549
518
  },
550
519
  /**
@@ -576,17 +545,17 @@ const fieldMixin = {
576
545
  //--------------------- 以下为组件支持外部调用的API方法 begin ------------------//
577
546
  /* 提示:用户可自行扩充这些方法!!! */
578
547
  getFormRef() {
579
- return this.refList['v_form_ref'];
548
+ return this.refList["v_form_ref"];
580
549
  },
581
550
  getWidgetRef(widgetName, showError) {
582
551
  const foundRef = this.refList[widgetName];
583
552
  if (!foundRef && !!showError) {
584
- this.$message.error(this.i18nt('render.hint.refNotFound') + widgetName);
553
+ this.$message.error(this.i18nt("render.hint.refNotFound") + widgetName);
585
554
  }
586
555
  return foundRef;
587
556
  },
588
557
  getFieldEditor() {
589
- return this.$refs['fieldEditor'];
558
+ return this.$refs["fieldEditor"];
590
559
  },
591
560
  showFileList(list) {
592
561
  if (!isArray(list)) return [];
@@ -608,9 +577,9 @@ const fieldMixin = {
608
577
  if (eq(this.fieldModel, newValue)) return;
609
578
  if (!!this.field.formItemFlag) {
610
579
  const oldValue = deepClone(this.fieldModel);
611
- if (this.field.type === 'file-upload') {
580
+ if (this.field.type === "file-upload") {
612
581
  newValue = this.showFileList(newValue || []);
613
- } else if (this.field.type === 'code-editor') {
582
+ } else if (this.field.type === "code-editor") {
614
583
  this.$refs.fieldEditor.setValue(newValue);
615
584
  }
616
585
  this.fieldModel = newValue;
@@ -629,8 +598,9 @@ const fieldMixin = {
629
598
  resetField() {
630
599
  const defaultValue = this.field.options.defaultValue;
631
600
  this.setValue(defaultValue);
632
- this.$nextTick(() => {});
633
- if (this.field.type === 'picture-upload' || this.field.type === 'file-upload') {
601
+ this.$nextTick(() => {
602
+ });
603
+ if (this.field.type === "picture-upload" || this.field.type === "file-upload") {
634
604
  this.fileList.splice(0, this.fileList.length);
635
605
  this.handleChangeEvent(this.fileList);
636
606
  }
@@ -688,20 +658,13 @@ const fieldMixin = {
688
658
  }
689
659
  },
690
660
  clearSelectedOptions() {
691
- if (
692
- this.field.type !== 'checkbox' &&
693
- this.field.type !== 'radio' &&
694
- this.field.type !== 'select'
695
- ) {
661
+ if (this.field.type !== "checkbox" && this.field.type !== "radio" && this.field.type !== "select") {
696
662
  return;
697
663
  }
698
- if (
699
- this.field.type === 'checkbox' ||
700
- (this.field.type === 'select' && this.field.options.multiple)
701
- ) {
664
+ if (this.field.type === "checkbox" || this.field.type === "select" && this.field.options.multiple) {
702
665
  this.fieldModel = [];
703
666
  } else {
704
- this.fieldModel = '';
667
+ this.fieldModel = "";
705
668
  }
706
669
  },
707
670
  /**
@@ -712,8 +675,8 @@ const fieldMixin = {
712
675
  this.field.options.optionItems = translateOptionItems(
713
676
  options,
714
677
  this.field.type,
715
- this.field.options.labelKey || 'label',
716
- this.field.options.valueKey || 'value'
678
+ this.field.options.labelKey || "label",
679
+ this.field.options.valueKey || "value"
717
680
  );
718
681
  },
719
682
  /**
@@ -724,8 +687,8 @@ const fieldMixin = {
724
687
  this.field.options.optionItems = translateOptionItems(
725
688
  options,
726
689
  this.field.type,
727
- this.field.options.labelKey || 'label',
728
- this.field.options.valueKey || 'value'
690
+ this.field.options.labelKey || "label",
691
+ this.field.options.valueKey || "value"
729
692
  );
730
693
  },
731
694
  disableOption(optionValue) {
@@ -803,4 +766,6 @@ const fieldMixin = {
803
766
  //--------------------- 以上为组件支持外部调用的API方法 end ------------------//
804
767
  }
805
768
  };
806
- export { fieldMixin as default };
769
+ export {
770
+ fieldMixin as default
771
+ };
@@ -92,7 +92,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
92
92
  _: 1
93
93
  }, 8, ["designer", "field", "rules", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"])) : createCommentVNode("", true);
94
94
  }
95
- const fileUploadWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-4b4d49bf"]]);
95
+ const fileUploadWidget = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-a39df179"]]);
96
96
  export {
97
97
  fileUploadWidget as default
98
98
  };
@@ -44,6 +44,7 @@ const _sfc_main = {
44
44
  },
45
45
  data() {
46
46
  return {
47
+ urlList: {},
47
48
  previewTitle: "",
48
49
  previewVisible: false,
49
50
  previewImage: "",
@@ -105,10 +106,10 @@ const _sfc_main = {
105
106
  }
106
107
  },
107
108
  iconRender({
108
- file
109
+ file: file2
109
110
  }) {
110
111
  try {
111
- const fieldTypes = file.fileName.slice(file.fileName.lastIndexOf("."));
112
+ const fieldTypes = file2.fileName.slice(file2.fileName.lastIndexOf("."));
112
113
  if ([".xls", ".xlsx"].includes(fieldTypes.toLowerCase())) {
113
114
  return createVNode(SvgIcon, {
114
115
  "icon-class": "excel"
@@ -134,12 +135,23 @@ const _sfc_main = {
134
135
  handleCancel() {
135
136
  this.previewVisible = false;
136
137
  },
137
- async handlePreview(file) {
138
+ async getFileUrl(fileCode) {
139
+ if (this.fileList[fileCode]) {
140
+ return this.fileList[fileCode];
141
+ } else {
142
+ const fileUrlObj = await filesystemApi.getPreviewFileUrl({
143
+ fileCode: file.fileCode
144
+ });
145
+ fileUrlObj.data.value;
146
+ }
147
+ },
148
+ async handlePreview(file2) {
138
149
  var _a, _b;
139
- if ([".png", ".jpg", ".jpeg", ".gif"].includes(file.fileType)) {
140
- this.previewImage = file.url;
150
+ if ([".png", ".jpg", ".jpeg", ".gif"].includes(file2.fileType)) {
151
+ const url = await this.getFileUrl(file2.fileCode);
152
+ this.previewImage = url;
141
153
  this.previewVisible = true;
142
- this.previewTitle = file.fileName;
154
+ this.previewTitle = file2.fileName;
143
155
  } else {
144
156
  const localUserInfo = getUserInfo();
145
157
  const employeeId = (_a = localUserInfo == null ? void 0 : localUserInfo.loginInfo) == null ? void 0 : _a.employeeId;
@@ -152,15 +164,15 @@ const _sfc_main = {
152
164
  tenantId,
153
165
  tokenId,
154
166
  employeeId,
155
- fileCode: file.fileCode
167
+ fileCode: file2.fileCode
156
168
  };
157
169
  window.open(`${doMain}/view-file/preview?${queryString.stringify(obj)}`);
158
170
  }
159
171
  },
160
- handleOnBeforeUpload(file) {
172
+ handleOnBeforeUpload(file2) {
161
173
  if (!!this.field.options.onBeforeUpload) {
162
174
  const bfFunc = new Function("file", this.field.options.onBeforeUpload);
163
- const result = bfFunc.call(this, file);
175
+ const result = bfFunc.call(this, file2);
164
176
  if (typeof result === "boolean") {
165
177
  return result;
166
178
  } else {
@@ -169,8 +181,8 @@ const _sfc_main = {
169
181
  }
170
182
  return true;
171
183
  },
172
- removeFile(file) {
173
- const findInx = this.fileList.findIndex((item) => item.uid === file.uid);
184
+ removeFile(file2) {
185
+ const findInx = this.fileList.findIndex((item) => item.uid === file2.uid);
174
186
  this.fileList.splice(findInx, 1);
175
187
  this.handleChangeEvent(this.fileList);
176
188
  },
@@ -207,10 +219,6 @@ const _sfc_main = {
207
219
  fileName: name,
208
220
  fileCode
209
221
  } = res.data.object;
210
- const fileUrlObj = await filesystemApi.getPreviewFileUrl({
211
- fileCode
212
- });
213
- const url = fileUrlObj.data.value;
214
222
  if (limit > 1) {
215
223
  const findIndex = this.fileList.findIndex((item) => item.name === name);
216
224
  if (findIndex > -1) {
@@ -219,15 +227,13 @@ const _sfc_main = {
219
227
  if (this.fileList.length < limit) {
220
228
  this.fileList.push({
221
229
  ...res.data.object,
222
- name,
223
- url
230
+ name
224
231
  });
225
232
  }
226
233
  } else {
227
234
  this.fileList = [{
228
235
  ...res.data.object,
229
- name,
230
- url
236
+ name
231
237
  }];
232
238
  }
233
239
  } finally {
@@ -1,5 +1,4 @@
1
- import VFormRender from "../../../../render.js";
2
- import CodeEditor from "../../code-editor/index.vue.js";
1
+ import { defineAsyncComponent, resolveComponent, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withCtx, normalizeStyle, createTextVNode, toDisplayString, Fragment, renderList, renderSlot, normalizeClass } from "vue";
3
2
  import { traverseAllWidgets, generateId, copyToClipboard, getQueryParam, addWindowResizeHandler, getLocat } from "../../../utils/util.js";
4
3
  import i18n from "../../../utils/i18n.js";
5
4
  import { generateCode } from "../../../utils/code-generator.js";
@@ -8,15 +7,14 @@ import axios from "axios";
8
7
  import SvgIcon from "../../svg-icon/index.vue.js";
9
8
  import { fmtHttpParams } from "../../../utils/request/fmtHttpParams.js";
10
9
  import { cloneDeep } from "lodash-es";
11
- import { resolveComponent, createElementBlock, openBlock, createElementVNode, createVNode, createBlock, createCommentVNode, withCtx, normalizeStyle, createTextVNode, toDisplayString, Fragment, renderList, renderSlot, normalizeClass } from "vue";
12
10
  /* empty css */
13
11
  import _export_sfc from "../../../../_virtual/_plugin-vue_export-helper.js";
14
12
  const _sfc_main = {
15
13
  name: "ToolbarPanel",
16
14
  mixins: [i18n],
17
15
  components: {
18
- VFormRender,
19
- CodeEditor,
16
+ VFormRender: defineAsyncComponent(() => import("../../../../render.js")),
17
+ CodeEditor: defineAsyncComponent(() => import("../../code-editor/index.vue.js")),
20
18
  // Clipboard,
21
19
  SvgIcon
22
20
  },
@@ -1013,7 +1011,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
1013
1011
  }, 8, ["title", "visible"])) : createCommentVNode("", true)
1014
1012
  ]);
1015
1013
  }
1016
- const ToolbarPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-ba172836"]]);
1014
+ const ToolbarPanel = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-066a3314"]]);
1017
1015
  export {
1018
1016
  ToolbarPanel as default
1019
1017
  };
@@ -8,6 +8,7 @@ const diyCompontent = (ops = {}) => {
8
8
  formItemFlag: true,
9
9
  options: {
10
10
  name: "",
11
+ label: "",
11
12
  diyCompontent: "",
12
13
  hidden: false,
13
14
  holdHidden: true,