form-custom-test 3.0.159 → 3.0.160

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
@@ -29,7 +29,7 @@ var __objRest = (source2, exclude) => {
29
29
  }
30
30
  return target;
31
31
  };
32
- import { openBlock, createElementBlock, normalizeClass, renderSlot, reactive, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, normalizeStyle, withModifiers, Fragment, createVNode, createBlock, withCtx, createTextVNode, renderList, defineComponent, createSlots, watch, ref, onBeforeUnmount, onMounted, onUnmounted, withDirectives, mergeProps, resolveDynamicComponent, vShow, isVNode } from "vue";
32
+ import { openBlock, createElementBlock, normalizeClass, renderSlot, reactive, createElementVNode, toDisplayString, createCommentVNode, resolveComponent, normalizeStyle, withModifiers, Fragment, createVNode, createBlock, withCtx, createTextVNode, withDirectives, vShow, renderList, defineComponent, createSlots, watch, ref, onBeforeUnmount, onMounted, onUnmounted, mergeProps, resolveDynamicComponent, isVNode } from "vue";
33
33
  import { ElMessage } from "element-plus";
34
34
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
35
35
  function getDefaultExportFromCjs(x) {
@@ -9450,7 +9450,7 @@ function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
9450
9450
  return openBlock(), createElementBlock("div", {
9451
9451
  class: normalizeClass(["field-wrapper", { "design-time-bottom-margin": !!this.designer }])
9452
9452
  }, [
9453
- !!$props.field.formItemFlag && (!$props.field.options.hidden || $props.designState === true) ? (openBlock(), createBlock(_component_el_form_item, {
9453
+ !!$props.field.formItemFlag ? withDirectives((openBlock(), createBlock(_component_el_form_item, {
9454
9454
  key: 0,
9455
9455
  label: $options.label,
9456
9456
  "label-width": $options.labelWidth + "px",
@@ -9514,7 +9514,9 @@ function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
9514
9514
  renderSlot(_ctx.$slots, "default", {}, void 0, true)
9515
9515
  ]),
9516
9516
  _: 3
9517
- }, 8, ["label", "label-width", "title", "rules", "prop", "class"])) : createCommentVNode("", true),
9517
+ }, 8, ["label", "label-width", "title", "rules", "prop", "class"])), [
9518
+ [vShow, $props.designState === true || !$props.field.options.hidden]
9519
+ ]) : createCommentVNode("", true),
9518
9520
  !!this.designer ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9519
9521
  $props.designer.selectedId === $props.field.id ? (openBlock(), createElementBlock("div", _hoisted_2$w, [
9520
9522
  createElementVNode("i", {
@@ -9558,7 +9560,7 @@ function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
9558
9560
  ], 64)) : createCommentVNode("", true)
9559
9561
  ], 2);
9560
9562
  }
9561
- var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["render", _sfc_render$19], ["__scopeId", "data-v-eed9a7f0"]]);
9563
+ var FormItemWrapper = /* @__PURE__ */ _export_sfc$1(_sfc_main$19, [["render", _sfc_render$19], ["__scopeId", "data-v-a42827ee"]]);
9562
9564
  var __glob_0_8 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
9563
9565
  __proto__: null,
9564
9566
  "default": FormItemWrapper
@@ -24827,9 +24829,9 @@ function _sfc_render$A(_ctx, _cache, $props, $setup, $data, $options) {
24827
24829
  ref: $props.widget.id
24828
24830
  }, {
24829
24831
  default: withCtx(() => [
24830
- (openBlock(true), createElementBlock(Fragment, null, renderList($props.widget.cols.filter((item) => !item.options.hidden) || [], (colWidget, colIdx) => {
24832
+ (openBlock(true), createElementBlock(Fragment, null, renderList($props.widget.cols || [], (colWidget, colIdx) => {
24831
24833
  return openBlock(), createBlock(_component_grid_col_item, {
24832
- key: colIdx,
24834
+ key: colWidget.id,
24833
24835
  widget: colWidget,
24834
24836
  "parent-list": $props.widget.cols,
24835
24837
  "index-of-parent-list": colIdx,
@@ -25810,13 +25812,70 @@ const _sfc_main$v = {
25810
25812
  }
25811
25813
  });
25812
25814
  },
25815
+ findFieldByName(fieldName) {
25816
+ if (!fieldName || !this.widgetList)
25817
+ return null;
25818
+ let found = null;
25819
+ const walk = (list) => {
25820
+ if (!Array.isArray(list) || found)
25821
+ return;
25822
+ list.forEach((w) => {
25823
+ if (found || !w)
25824
+ return;
25825
+ if (w.formItemFlag && w.options && w.options.name === fieldName) {
25826
+ found = w;
25827
+ return;
25828
+ }
25829
+ if (Array.isArray(w.widgetList))
25830
+ walk(w.widgetList);
25831
+ if (Array.isArray(w.cols)) {
25832
+ w.cols.forEach((c) => walk(c && c.widgetList));
25833
+ }
25834
+ if (Array.isArray(w.rows)) {
25835
+ w.rows.forEach((r) => Array.isArray(r && r.cols) && r.cols.forEach((c) => walk(c && c.widgetList)));
25836
+ }
25837
+ if (Array.isArray(w.tabs)) {
25838
+ w.tabs.forEach((t) => walk(t && t.widgetList));
25839
+ }
25840
+ });
25841
+ };
25842
+ walk(this.widgetList);
25843
+ return found;
25844
+ },
25813
25845
  findWidgetAndSetHidden(widgetName, hiddenFlag) {
25814
25846
  let foundW = this.getWidgetRef(widgetName);
25815
25847
  if (!!foundW) {
25816
25848
  foundW.setHidden(hiddenFlag);
25817
- } else {
25818
- this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
25849
+ return;
25850
+ }
25851
+ const fieldSchema = this.findFieldByName(widgetName);
25852
+ if (fieldSchema && fieldSchema.options) {
25853
+ fieldSchema.options.hidden = !!hiddenFlag;
25854
+ this.$nextTick(() => this.$forceUpdate());
25855
+ return;
25856
+ }
25857
+ this.findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag);
25858
+ },
25859
+ setFieldRequired(fieldName, required) {
25860
+ const flag = !!required;
25861
+ const fieldRef = this.getWidgetRef(fieldName);
25862
+ if (fieldRef && typeof fieldRef.setRequired === "function") {
25863
+ fieldRef.setRequired(flag);
25864
+ if (typeof fieldRef.buildFieldRules === "function") {
25865
+ fieldRef.buildFieldRules();
25866
+ }
25867
+ return true;
25819
25868
  }
25869
+ const fieldSchema = this.findFieldByName(fieldName);
25870
+ if (fieldSchema && fieldSchema.options) {
25871
+ fieldSchema.options.required = flag;
25872
+ const refAfter = this.getWidgetRef(fieldName);
25873
+ if (refAfter && typeof refAfter.buildFieldRules === "function") {
25874
+ refAfter.buildFieldRules();
25875
+ }
25876
+ return true;
25877
+ }
25878
+ return false;
25820
25879
  },
25821
25880
  findWidgetOfSubFormAndSetHidden(widgetName, hiddenFlag) {
25822
25881
  this.findWidgetNameInSubForm(widgetName).forEach((wn) => {
@@ -26285,7 +26344,7 @@ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
26285
26344
  _: 3
26286
26345
  }, 8, ["label-position", "size", "class", "label-width", "model"]);
26287
26346
  }
26288
- var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-6e3bb628"]]);
26347
+ var VFormRender = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["render", _sfc_render$v], ["__scopeId", "data-v-2bb5a9c0"]]);
26289
26348
  function registerIcon(app) {
26290
26349
  app.component("el-icon-edit", edit);
26291
26350
  app.component("el-icon-minus", minus);
@@ -26300,13 +26359,13 @@ function registerIcon(app) {
26300
26359
  if (typeof window !== "undefined") {
26301
26360
  let loadSvg = function() {
26302
26361
  var body = document.body;
26303
- var svgDom = document.getElementById("__svg__icons__dom__1779190384706__");
26362
+ var svgDom = document.getElementById("__svg__icons__dom__1779271953311__");
26304
26363
  if (!svgDom) {
26305
26364
  svgDom = document.createElementNS("http://www.w3.org/2000/svg", "svg");
26306
26365
  svgDom.style.position = "absolute";
26307
26366
  svgDom.style.width = "0";
26308
26367
  svgDom.style.height = "0";
26309
- svgDom.id = "__svg__icons__dom__1779190384706__";
26368
+ svgDom.id = "__svg__icons__dom__1779271953311__";
26310
26369
  svgDom.setAttribute("xmlns", "http://www.w3.org/2000/svg");
26311
26370
  svgDom.setAttribute("xmlns:link", "http://www.w3.org/1999/xlink");
26312
26371
  }