form-custom-test 3.0.218 → 3.0.219

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.
@@ -12655,21 +12655,52 @@ const _sfc_main$3q = {
12655
12655
  this.unregisterFromRefList();
12656
12656
  },
12657
12657
  methods: {
12658
+ parseFileFieldModel(value2) {
12659
+ if (value2 == null || value2 === "") {
12660
+ return [];
12661
+ }
12662
+ let parsed = value2;
12663
+ if (typeof parsed === "string") {
12664
+ const trimmed = parsed.trim();
12665
+ if (!trimmed) {
12666
+ return [];
12667
+ }
12668
+ try {
12669
+ parsed = JSON.parse(trimmed);
12670
+ if (typeof parsed === "string") {
12671
+ const inner = parsed.trim();
12672
+ if (inner.startsWith("[") || inner.startsWith("{")) {
12673
+ parsed = JSON.parse(inner);
12674
+ }
12675
+ }
12676
+ } catch (e) {
12677
+ console.warn("[file-upload] fieldModel JSON parse failed:", e);
12678
+ return [];
12679
+ }
12680
+ }
12681
+ if (Array.isArray(parsed)) {
12682
+ return parsed;
12683
+ }
12684
+ if (parsed && typeof parsed === "object") {
12685
+ return [parsed];
12686
+ }
12687
+ return [];
12688
+ },
12658
12689
  initFileList() {
12659
12690
  if (this.designState === true) {
12660
12691
  return;
12661
12692
  }
12662
- if (this.fieldModel == null) {
12663
- this.fileList = [];
12664
- this.uploadBtnHidden = false;
12665
- return;
12693
+ const parsedList = this.parseFileFieldModel(this.fieldModel);
12694
+ const shouldNormalizeFieldModel = typeof this.fieldModel === "string" || this.fieldModel != null && !Array.isArray(this.fieldModel) && typeof this.fieldModel === "object";
12695
+ if (shouldNormalizeFieldModel) {
12696
+ this.fieldModel = parsedList;
12666
12697
  }
12667
- const raw = Array.isArray(this.fieldModel) ? deepClone(this.fieldModel) : [deepClone(this.fieldModel)];
12668
- if (raw.length === 0) {
12698
+ if (parsedList.length === 0) {
12669
12699
  this.fileList = [];
12670
12700
  this.uploadBtnHidden = false;
12671
12701
  return;
12672
12702
  }
12703
+ const raw = deepClone(parsedList);
12673
12704
  this.fileList = raw.map((item, i) => {
12674
12705
  var _a2, _b2, _c2, _d;
12675
12706
  const name = (_b2 = (_a2 = item.name) != null ? _a2 : item.fileName) != null ? _b2 : "";
@@ -13084,7 +13115,7 @@ function _sfc_render$3q(_ctx, _cache, $props, $setup, $data, $options) {
13084
13115
  _: 1
13085
13116
  }, 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"]);
13086
13117
  }
13087
- var fileUploadWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$3q, [["render", _sfc_render$3q], ["__scopeId", "data-v-829125c8"]]);
13118
+ var fileUploadWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$3q, [["render", _sfc_render$3q], ["__scopeId", "data-v-3a72c058"]]);
13088
13119
  var __glob_0_7$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13089
13120
  __proto__: null,
13090
13121
  "default": fileUploadWidget
@@ -69248,13 +69279,13 @@ function registerIcon(app) {
69248
69279
  if (typeof window !== "undefined") {
69249
69280
  let loadSvg = function() {
69250
69281
  var body = document.body;
69251
- var svgDom = document.getElementById("__svg__icons__dom__1783058452579__");
69282
+ var svgDom = document.getElementById("__svg__icons__dom__1783060841122__");
69252
69283
  if (!svgDom) {
69253
69284
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
69254
69285
  svgDom.style.position = "absolute";
69255
69286
  svgDom.style.width = "0";
69256
69287
  svgDom.style.height = "0";
69257
- svgDom.id = "__svg__icons__dom__1783058452579__";
69288
+ svgDom.id = "__svg__icons__dom__1783060841122__";
69258
69289
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
69259
69290
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
69260
69291
  }
@@ -80491,15 +80522,28 @@ const _sfc_main$c = {
80491
80522
  getFormConfigCode(item) {
80492
80523
  return (item == null ? void 0 : item.formCode) || (item == null ? void 0 : item.subCategoryCode) || this.documentTypeValue;
80493
80524
  },
80525
+ buildReadonlyFormJson(formJson) {
80526
+ const json = lodash.exports.cloneDeep(formJson);
80527
+ if (json == null ? void 0 : json.widgetList) {
80528
+ traverseFieldWidgets(json.widgetList, (widget) => {
80529
+ if (widget == null ? void 0 : widget.options) {
80530
+ widget.options.disabled = true;
80531
+ widget.options.readonly = true;
80532
+ }
80533
+ });
80534
+ }
80535
+ return json;
80536
+ },
80494
80537
  applyFormToRender(parsed, formData) {
80495
- this.formJson = parsed;
80538
+ const disabledJson = this.buildReadonlyFormJson(parsed);
80539
+ this.formJson = disabledJson;
80496
80540
  this.showForm = true;
80497
80541
  this.$nextTick(() => {
80498
80542
  const ref2 = this.$refs.detailFormRender;
80499
80543
  if (!ref2 || typeof ref2.setFormJson !== "function") {
80500
80544
  return;
80501
80545
  }
80502
- ref2.setFormJson(lodash.exports.cloneDeep(parsed));
80546
+ ref2.setFormJson(lodash.exports.cloneDeep(disabledJson));
80503
80547
  this.$nextTick(() => {
80504
80548
  if (typeof ref2.setFormData === "function") {
80505
80549
  ref2.setFormData(lodash.exports.cloneDeep(formData));
@@ -80516,7 +80560,7 @@ const _sfc_main$c = {
80516
80560
  }
80517
80561
  };
80518
80562
  this.$nextTick(disable);
80519
- setTimeout(disable, 300);
80563
+ [300, 800, 1500].forEach((delay) => setTimeout(disable, delay));
80520
80564
  },
80521
80565
  async loadDocumentDetail(item) {
80522
80566
  const formConfigCode = this.getFormConfigCode(item);
@@ -80584,7 +80628,7 @@ const _hoisted_10 = {
80584
80628
  };
80585
80629
  const _hoisted_11 = {
80586
80630
  key: 2,
80587
- class: "detail-form"
80631
+ class: "detail-form detail-form--readonly"
80588
80632
  };
80589
80633
  const _hoisted_12 = {
80590
80634
  key: 3,
@@ -80749,7 +80793,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
80749
80793
  _: 1
80750
80794
  }, 8, ["modelValue", "onClose"]);
80751
80795
  }
80752
- var DocumentDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-ed9e5e3e"]]);
80796
+ var DocumentDialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$c], ["__scopeId", "data-v-6ee0ef30"]]);
80753
80797
  var documentDetailDialog_vue_vue_type_style_index_0_scoped_true_lang = "";
80754
80798
  var documentDetailDialog_vue_vue_type_style_index_1_lang = "";
80755
80799
  const DEFAULT_FORM_JSON = {