form-custom-test 3.0.48 → 3.0.50

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/render.es.js CHANGED
@@ -1374,6 +1374,7 @@ var enLocale = {
1374
1374
  widgetColumnWidth: "Width",
1375
1375
  widgetSize: "Size",
1376
1376
  fontSize: "Font Size",
1377
+ fontColor: "Text Color",
1377
1378
  textAlign: "Text Align",
1378
1379
  autoFullWidth: "Auto Full Width",
1379
1380
  showStops: "Show Stops",
@@ -1691,6 +1692,7 @@ var zhLocale = {
1691
1692
  widgetColumnWidth: "\u7EC4\u4EF6\u5217\u5BBD",
1692
1693
  widgetSize: "\u7EC4\u4EF6\u5927\u5C0F",
1693
1694
  fontSize: "\u5B57\u4F53\u5927\u5C0F",
1695
+ fontColor: "\u6587\u5B57\u989C\u8272",
1694
1696
  textAlign: "\u6587\u5B57\u5BF9\u9F50",
1695
1697
  autoFullWidth: "\u81EA\u52A8\u62C9\u4F38\u5BBD\u5EA6",
1696
1698
  showStops: "\u663E\u793A\u95F4\u65AD\u70B9",
@@ -23543,12 +23545,37 @@ const _sfc_main$z = {
23543
23545
  }
23544
23546
  },
23545
23547
  components: {
23546
- StaticContentWrapper
23548
+ FormItemWrapper
23549
+ },
23550
+ data() {
23551
+ return {
23552
+ oldFieldValue: null,
23553
+ fieldModel: null,
23554
+ rules: []
23555
+ };
23556
+ },
23557
+ computed: {
23558
+ staticTextStyle() {
23559
+ const s = {};
23560
+ if (this.field.options.fontSize)
23561
+ s.fontSize = this.field.options.fontSize;
23562
+ return s;
23563
+ },
23564
+ innerStyle() {
23565
+ return {
23566
+ whiteSpace: this.field.options.preWrap ? "pre-wrap" : "pre",
23567
+ textAlign: this.field.options.textAlign || "left",
23568
+ color: this.field.options.fontColor || void 0
23569
+ };
23570
+ },
23571
+ displayText() {
23572
+ return this.fieldModel || this.field.options.textContent;
23573
+ }
23547
23574
  },
23548
- computed: {},
23549
23575
  beforeCreate() {
23550
23576
  },
23551
23577
  created() {
23578
+ this.initFieldModel();
23552
23579
  this.registerToRefList();
23553
23580
  this.initEventHandler();
23554
23581
  this.handleOnCreated();
@@ -23562,10 +23589,11 @@ const _sfc_main$z = {
23562
23589
  methods: {}
23563
23590
  };
23564
23591
  function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
23565
- const _component_static_content_wrapper = resolveComponent("static-content-wrapper");
23566
- return openBlock(), createBlock(_component_static_content_wrapper, {
23592
+ const _component_form_item_wrapper = resolveComponent("form-item-wrapper");
23593
+ return openBlock(), createBlock(_component_form_item_wrapper, {
23567
23594
  designer: $props.designer,
23568
23595
  field: $props.field,
23596
+ rules: $data.rules,
23569
23597
  "design-state": $props.designState,
23570
23598
  "parent-widget": $props.parentWidget,
23571
23599
  "parent-list": $props.parentList,
@@ -23577,17 +23605,17 @@ function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
23577
23605
  default: withCtx(() => [
23578
23606
  createElementVNode("div", {
23579
23607
  ref: "fieldEditor",
23580
- style: normalizeStyle(!!$props.field.options.fontSize ? `font-size: ${$props.field.options.fontSize};` : "")
23608
+ style: normalizeStyle($options.staticTextStyle)
23581
23609
  }, [
23582
- createElementVNode("pre", {
23583
- style: normalizeStyle({ "white-space": !!$props.field.options.preWrap ? "pre-wrap" : "pre", "text-align": !!$props.field.options.textAlign ? $props.field.options.textAlign : "left" })
23584
- }, toDisplayString($props.field.options.textContent), 5)
23610
+ createElementVNode("div", {
23611
+ style: normalizeStyle($options.innerStyle)
23612
+ }, toDisplayString($options.displayText), 5)
23585
23613
  ], 4)
23586
23614
  ]),
23587
23615
  _: 1
23588
- }, 8, ["designer", "field", "design-state", "parent-widget", "parent-list", "index-of-parent-list", "sub-form-row-index", "sub-form-col-index", "sub-form-row-id"]);
23616
+ }, 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"]);
23589
23617
  }
23590
- var staticTextWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$z], ["__scopeId", "data-v-4071ab53"]]);
23618
+ var staticTextWidget = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["render", _sfc_render$z], ["__scopeId", "data-v-55fc605c"]]);
23591
23619
  var __glob_0_21 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
23592
23620
  __proto__: null,
23593
23621
  "default": staticTextWidget
@@ -24224,6 +24252,12 @@ var containerItemMixin = {
24224
24252
  };
24225
24253
  traverseFieldWidgetsOfContainer(this.widget, clearRulesFn);
24226
24254
  },
24255
+ setDisabled(flag) {
24256
+ if (!this.widget || !this.widget.options) {
24257
+ return;
24258
+ }
24259
+ this.widget.options.disabled = flag;
24260
+ },
24227
24261
  activeTab(tabIndex) {
24228
24262
  if (tabIndex >= 0 && tabIndex < this.widget.tabs.length) {
24229
24263
  this.widget.tabs.forEach((tp, idx) => {
@@ -25411,6 +25445,18 @@ const _sfc_main$o = {
25411
25445
  }
25412
25446
  return foundRef;
25413
25447
  },
25448
+ getStaticTextRef(nameOrId) {
25449
+ if (nameOrId) {
25450
+ const ref2 = this.getWidgetRef(nameOrId);
25451
+ if (ref2 && ref2.field && ref2.field.type === "static-text")
25452
+ return ref2;
25453
+ }
25454
+ const list = Object.values(this.widgetRefList).filter((ref2) => ref2 && ref2.field && ref2.field.type === "static-text");
25455
+ return list.length > 0 ? list[0] : void 0;
25456
+ },
25457
+ getStaticTextRefs() {
25458
+ return Object.values(this.widgetRefList).filter((ref2) => ref2 && ref2.field && ref2.field.type === "static-text");
25459
+ },
25414
25460
  clearFormDataModel() {
25415
25461
  for (let pkey in this.formDataModel) {
25416
25462
  delete this.formDataModel[pkey];
@@ -25742,7 +25788,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
25742
25788
  _: 3
25743
25789
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
25744
25790
  }
25745
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$o], ["__scopeId", "data-v-62d83c26"]]);
25791
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["render", _sfc_render$o], ["__scopeId", "data-v-15a0247d"]]);
25746
25792
  function registerIcon(app) {
25747
25793
  app.component("el-icon-edit", edit);
25748
25794
  app.component("el-icon-minus", minus);
@@ -25757,13 +25803,13 @@ function registerIcon(app) {
25757
25803
  if (typeof window !== "undefined") {
25758
25804
  let loadSvg = function() {
25759
25805
  var body = document.body;
25760
- var svgDom = document.getElementById("__svg__icons__dom__1772593002951__");
25806
+ var svgDom = document.getElementById("__svg__icons__dom__1772609564024__");
25761
25807
  if (!svgDom) {
25762
25808
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
25763
25809
  svgDom.style.position = "absolute";
25764
25810
  svgDom.style.width = "0";
25765
25811
  svgDom.style.height = "0";
25766
- svgDom.id = "__svg__icons__dom__1772593002951__";
25812
+ svgDom.id = "__svg__icons__dom__1772609564024__";
25767
25813
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
25768
25814
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
25769
25815
  }
@@ -34282,7 +34328,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
34282
34328
  $props.widget.options.showRowNumber ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString($props.widget.options.label || "\u81EA\u5B9A\u4E49\u5B50\u8868\u5355") + " " + toDisplayString(sfrIdx + 1), 1)) : (openBlock(), createElementBlock("span", _hoisted_6$2, "\u8868\u5355\u7EC4"))
34283
34329
  ]),
34284
34330
  createElementVNode("div", _hoisted_7$1, [
34285
- sfrIdx > 0 ? (openBlock(), createBlock(_component_el_button, {
34331
+ sfrIdx > 0 && !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
34286
34332
  key: 0,
34287
34333
  size: "small",
34288
34334
  type: "danger",
@@ -34332,7 +34378,8 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
34332
34378
  ]);
34333
34379
  }), 128)),
34334
34380
  !$props.widget.widgetList || $props.widget.widgetList.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_13, " \u8BF7\u5148\u5728\u8BBE\u8BA1\u5668\u4E2D\u62D6\u62FD\u7EC4\u4EF6\u5230\u5B50\u8868\u5355\u4E2D ")) : $data.rowIdData.length === 0 ? (openBlock(), createElementBlock("div", _hoisted_14, ' \u70B9\u51FB"\u6DFB\u52A0"\u6309\u94AE\u6DFB\u52A0\u6570\u636E\u884C ')) : createCommentVNode("", true),
34335
- createVNode(_component_el_button, {
34381
+ !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
34382
+ key: 2,
34336
34383
  disabled: $data.actionDisabled,
34337
34384
  type: "primary",
34338
34385
  plain: "",
@@ -34344,7 +34391,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
34344
34391
  _cache[1] || (_cache[1] = createTextVNode(" \u6DFB\u52A0 ", -1))
34345
34392
  ]),
34346
34393
  _: 1
34347
- }, 8, ["disabled", "onClick"])
34394
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true)
34348
34395
  ], 2)), [
34349
34396
  [vShow, $props.widget && $props.widget.options && !$props.widget.options.hidden]
34350
34397
  ]) : createCommentVNode("", true)
@@ -34352,7 +34399,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
34352
34399
  _: 1
34353
34400
  }, 8, ["widget"]);
34354
34401
  }
34355
- var CustomSubFormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-489afa42"]]);
34402
+ var CustomSubFormItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["render", _sfc_render$9], ["__scopeId", "data-v-4ce4d728"]]);
34356
34403
  var customTableCellWidget_vue_vue_type_style_index_0_scoped_true_lang = "";
34357
34404
  const _sfc_main$8 = {
34358
34405
  name: "custom-table-cell-widget",
@@ -35324,7 +35371,8 @@ const _sfc_main$3 = {
35324
35371
  dialogTitle: "\u65B0\u589E",
35325
35372
  dialogFormData: {},
35326
35373
  dialogFormRules: {},
35327
- editingIndex: -1
35374
+ editingIndex: -1,
35375
+ syncFromFormModel: false
35328
35376
  };
35329
35377
  },
35330
35378
  computed: {
@@ -35347,17 +35395,23 @@ const _sfc_main$3 = {
35347
35395
  watch: {
35348
35396
  formModel: {
35349
35397
  handler(newVal) {
35398
+ this.syncFromFormModel = true;
35350
35399
  if (newVal && Array.isArray(newVal)) {
35351
35400
  this.tableData = deepClone(newVal);
35352
35401
  } else if (!newVal) {
35353
35402
  this.tableData = [];
35354
35403
  }
35404
+ this.$nextTick(() => {
35405
+ this.syncFromFormModel = false;
35406
+ });
35355
35407
  },
35356
35408
  immediate: true,
35357
35409
  deep: true
35358
35410
  },
35359
35411
  tableData: {
35360
35412
  handler(newVal) {
35413
+ if (this.syncFromFormModel)
35414
+ return;
35361
35415
  if (this.formModel !== newVal) {
35362
35416
  this.updateFormModel(newVal);
35363
35417
  }
@@ -35366,7 +35420,6 @@ const _sfc_main$3 = {
35366
35420
  }
35367
35421
  },
35368
35422
  created() {
35369
- this.initFieldModel();
35370
35423
  this.initRefList();
35371
35424
  this.initTableData();
35372
35425
  },
@@ -35698,7 +35751,8 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
35698
35751
  $props.widget.options.required ? (openBlock(), createElementBlock("span", _hoisted_2$2, "*")) : createCommentVNode("", true)
35699
35752
  ])) : createCommentVNode("", true),
35700
35753
  createElementVNode("div", _hoisted_3$1, [
35701
- createVNode(_component_el_button, {
35754
+ !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_button, {
35755
+ key: 0,
35702
35756
  type: "primary",
35703
35757
  size: "small",
35704
35758
  disabled: $props.widget.options.disabled,
@@ -35709,7 +35763,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
35709
35763
  _cache[2] || (_cache[2] = createTextVNode(" \u65B0\u589E ", -1))
35710
35764
  ]),
35711
35765
  _: 1
35712
- }, 8, ["disabled", "onClick"])
35766
+ }, 8, ["disabled", "onClick"])) : createCommentVNode("", true)
35713
35767
  ]),
35714
35768
  createVNode(_component_el_table, {
35715
35769
  data: $data.tableData,
@@ -35749,7 +35803,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
35749
35803
  _: 2
35750
35804
  }, 1032, ["prop", "label", "width", "min-width"]);
35751
35805
  }), 128)),
35752
- $props.widget.options.showOperation ? (openBlock(), createBlock(_component_el_table_column, {
35806
+ $props.widget.options.showOperation && !$props.widget.options.disabled ? (openBlock(), createBlock(_component_el_table_column, {
35753
35807
  key: 1,
35754
35808
  label: "\u64CD\u4F5C",
35755
35809
  width: $props.widget.options.operationColumnWidth,
@@ -35925,7 +35979,7 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
35925
35979
  _: 1
35926
35980
  }, 8, ["widget"]);
35927
35981
  }
35928
- var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-22c76baf"]]);
35982
+ var SubTableItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["render", _sfc_render$3], ["__scopeId", "data-v-0c285f08"]]);
35929
35983
  var ace$2 = { exports: {} };
35930
35984
  (function(module, exports) {
35931
35985
  (function() {