starfish-form-custom 1.0.19 → 1.0.21

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.
@@ -1102,7 +1102,7 @@ const _hoisted_1$r = {
1102
1102
  class: "item_require"
1103
1103
  };
1104
1104
  const _hoisted_2$k = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1105
- const _hoisted_3$7 = { class: "keyValueSelect" };
1105
+ const _hoisted_3$f = { class: "keyValueSelect" };
1106
1106
  const _hoisted_4$4 = { class: "keyValueInput" };
1107
1107
  const _hoisted_5$2 = { class: "inputItem" };
1108
1108
  const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("span", null, "\u6587\u672C\uFF1A", -1);
@@ -1156,7 +1156,7 @@ function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
1156
1156
  class: "starfish-keyValueItem",
1157
1157
  key: index
1158
1158
  }, [
1159
- createElementVNode("div", _hoisted_3$7, [
1159
+ createElementVNode("div", _hoisted_3$f, [
1160
1160
  createVNode(_component_el_checkbox, {
1161
1161
  modelValue: items.select,
1162
1162
  "onUpdate:modelValue": ($event) => items.select = $event,
@@ -1336,7 +1336,7 @@ const _hoisted_1$q = {
1336
1336
  class: "item_require"
1337
1337
  };
1338
1338
  const _hoisted_2$j = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1339
- const _hoisted_3$6 = { class: "keyValueSelect" };
1339
+ const _hoisted_3$e = { class: "keyValueSelect" };
1340
1340
  const _hoisted_4$3 = { class: "keyValueInput" };
1341
1341
  const _hoisted_5$1 = { class: "inputItem" };
1342
1342
  const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("span", null, "\u6587\u672C\uFF1A", -1);
@@ -1390,7 +1390,7 @@ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
1390
1390
  class: "starfish-keyValueItem",
1391
1391
  key: index
1392
1392
  }, [
1393
- createElementVNode("div", _hoisted_3$6, [
1393
+ createElementVNode("div", _hoisted_3$e, [
1394
1394
  createVNode(_component_el_checkbox, {
1395
1395
  modelValue: items.select,
1396
1396
  "onUpdate:modelValue": ($event) => items.select = $event,
@@ -1530,7 +1530,7 @@ const _hoisted_1$o = {
1530
1530
  class: "item_require"
1531
1531
  };
1532
1532
  const _hoisted_2$i = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1533
- const _hoisted_3$5 = /* @__PURE__ */ createTextVNode(" \u65B0\u5EFA\u52A8\u4F5C+ ");
1533
+ const _hoisted_3$d = /* @__PURE__ */ createTextVNode(" \u65B0\u5EFA\u52A8\u4F5C+ ");
1534
1534
  function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
1535
1535
  const _component_el_tooltip = ElTooltip;
1536
1536
  const _component_el_option = ElOption;
@@ -1687,7 +1687,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
1687
1687
  size: _ctx.size
1688
1688
  }, {
1689
1689
  default: withCtx(() => [
1690
- _hoisted_3$5
1690
+ _hoisted_3$d
1691
1691
  ]),
1692
1692
  _: 1
1693
1693
  }, 8, ["size"])
@@ -1836,7 +1836,7 @@ const _sfc_main$m = defineComponent({
1836
1836
  });
1837
1837
  const _hoisted_1$m = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1838
1838
  const _hoisted_2$h = /* @__PURE__ */ createElementVNode("i", { class: "iconfontui icon-bars handle" }, null, -1);
1839
- const _hoisted_3$4 = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u9762\u677F");
1839
+ const _hoisted_3$c = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u9762\u677F");
1840
1840
  function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
1841
1841
  const _component_el_tooltip = ElTooltip;
1842
1842
  const _component_el_col = ElCol;
@@ -1941,7 +1941,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
1941
1941
  size: "default"
1942
1942
  }, {
1943
1943
  default: withCtx(() => [
1944
- _hoisted_3$4
1944
+ _hoisted_3$c
1945
1945
  ]),
1946
1946
  _: 1
1947
1947
  }, 8, ["onClick"])
@@ -1992,7 +1992,7 @@ const _hoisted_2$g = {
1992
1992
  key: 0,
1993
1993
  class: "item_require"
1994
1994
  };
1995
- const _hoisted_3$3 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1995
+ const _hoisted_3$b = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
1996
1996
  const _hoisted_4$2 = { class: "control" };
1997
1997
  function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
1998
1998
  const _component_el_tooltip = ElTooltip;
@@ -2012,7 +2012,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
2012
2012
  placement: "top"
2013
2013
  }, {
2014
2014
  default: withCtx(() => [
2015
- _hoisted_3$3
2015
+ _hoisted_3$b
2016
2016
  ]),
2017
2017
  _: 1
2018
2018
  }, 8, ["content"])) : createCommentVNode("", true)
@@ -2066,6 +2066,7 @@ const _hoisted_1$k = {
2066
2066
  class: "item_require"
2067
2067
  };
2068
2068
  const _hoisted_2$f = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
2069
+ const _hoisted_3$a = { key: 0 };
2069
2070
  function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
2070
2071
  const _component_el_tooltip = ElTooltip;
2071
2072
  const _component_el_checkbox = ElCheckbox;
@@ -2096,8 +2097,8 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
2096
2097
  class: "control",
2097
2098
  style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
2098
2099
  }, [
2099
- !_ctx.drag && _ctx.data[_ctx.item.data.fieldName] ? (openBlock(), createBlock(_component_el_checkbox_group, {
2100
- key: 0,
2100
+ !_ctx.drag && _ctx.data[_ctx.item.data.fieldName] && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$a, toDisplayString(_ctx.data[_ctx.item.data.fieldName].join(",") || "--"), 1)) : !_ctx.drag && _ctx.data[_ctx.item.data.fieldName] ? (openBlock(), createBlock(_component_el_checkbox_group, {
2101
+ key: 1,
2101
2102
  modelValue: _ctx.data[_ctx.item.data.fieldName],
2102
2103
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
2103
2104
  class: normalizeClass({ "vertical-group": _ctx.item.data.arrangeMent === "vertical" }),
@@ -2120,7 +2121,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
2120
2121
  _: 1
2121
2122
  }, 8, ["modelValue", "class", "size", "disabled"])) : createCommentVNode("", true),
2122
2123
  _ctx.drag ? (openBlock(), createBlock(_component_el_checkbox_group, {
2123
- key: 1,
2124
+ key: 2,
2124
2125
  modelValue: _ctx.item.data.itemConfig.value,
2125
2126
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.item.data.itemConfig.value = $event),
2126
2127
  class: normalizeClass({ "vertical-group": _ctx.item.data.arrangeMent === "vertical" }),
@@ -2174,7 +2175,7 @@ const _hoisted_1$j = {
2174
2175
  class: "item_require"
2175
2176
  };
2176
2177
  const _hoisted_2$e = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1));
2177
- const _hoisted_3$2 = { key: 0 };
2178
+ const _hoisted_3$9 = { key: 0 };
2178
2179
  const _hoisted_4$1 = { key: 1 };
2179
2180
  function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
2180
2181
  const _component_el_tooltip = ElTooltip;
@@ -2206,7 +2207,7 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
2206
2207
  class: "control",
2207
2208
  style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
2208
2209
  }, [
2209
- _ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
2210
+ _ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
2210
2211
  createVNode(_component_el_input, {
2211
2212
  modelValue: _ctx.item.data.default,
2212
2213
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.default = $event),
@@ -2252,7 +2253,7 @@ const _sfc_main$i = defineComponent({
2252
2253
  nameCn: "\u65E5\u671F",
2253
2254
  icon: "icon-24gl-calendar",
2254
2255
  formConfig: getFormConfig("Date", [
2255
- { fieldName: "default", component: "Date" },
2256
+ { fieldName: "default", component: "DateTime" },
2256
2257
  { fieldName: "placeholder", component: "Text" },
2257
2258
  { fieldName: "format", component: "Selected" },
2258
2259
  { fieldName: "state", component: "Radio" }
@@ -2276,8 +2277,34 @@ const _sfc_main$i = defineComponent({
2276
2277
  };
2277
2278
  return formatTypeMap[format] || "date";
2278
2279
  };
2280
+ const formatReadonlyDate = (dateValue, format) => {
2281
+ if (!dateValue)
2282
+ return "--";
2283
+ if (typeof dateValue === "string") {
2284
+ return dateValue;
2285
+ }
2286
+ if (dateValue instanceof Date) {
2287
+ const year = dateValue.getFullYear();
2288
+ const month = String(dateValue.getMonth() + 1).padStart(2, "0");
2289
+ const day = String(dateValue.getDate()).padStart(2, "0");
2290
+ const hours = String(dateValue.getHours()).padStart(2, "0");
2291
+ const minutes = String(dateValue.getMinutes()).padStart(2, "0");
2292
+ const seconds = String(dateValue.getSeconds()).padStart(2, "0");
2293
+ const formatMap = {
2294
+ "YYYY": `${year}`,
2295
+ "YYYY-MM": `${year}-${month}`,
2296
+ "YYYY-MM-DD": `${year}-${month}-${day}`,
2297
+ "YYYY-MM-DD HH": `${year}-${month}-${day} ${hours}`,
2298
+ "YYYY-MM-DD HH:mm": `${year}-${month}-${day} ${hours}:${minutes}`,
2299
+ "YYYY-MM-DD HH:mm:ss": `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
2300
+ };
2301
+ return formatMap[format] || `${year}-${month}-${day}`;
2302
+ }
2303
+ return String(dateValue);
2304
+ };
2279
2305
  return {
2280
- getPickerType
2306
+ getPickerType,
2307
+ formatReadonlyDate
2281
2308
  };
2282
2309
  }
2283
2310
  });
@@ -2286,6 +2313,7 @@ const _hoisted_1$i = {
2286
2313
  class: "item_require"
2287
2314
  };
2288
2315
  const _hoisted_2$d = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
2316
+ const _hoisted_3$8 = { key: 1 };
2289
2317
  function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
2290
2318
  const _component_el_tooltip = ElTooltip;
2291
2319
  const _component_el_date_picker = ElDatePicker;
@@ -2328,8 +2356,8 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
2328
2356
  disabled: _ctx.item.data.state === "disabled",
2329
2357
  readonly: _ctx.item.data.state === "readonly"
2330
2358
  }, null, 8, ["modelValue", "type", "format", "value-format", "placeholder", "size", "disabled", "readonly"])) : createCommentVNode("", true),
2331
- !_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
2332
- key: 1,
2359
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$8, toDisplayString(_ctx.formatReadonlyDate(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.format)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
2360
+ key: 2,
2333
2361
  modelValue: _ctx.data[_ctx.item.data.fieldName],
2334
2362
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
2335
2363
  width: "240px",
@@ -2453,7 +2481,21 @@ const _sfc_main$g = defineComponent({
2453
2481
  setup(props) {
2454
2482
  const vm = getCurrentInstance();
2455
2483
  useWatch(props);
2484
+ const formatReadonlyNumber = (value, precision) => {
2485
+ if (value === null || value === void 0 || value === "") {
2486
+ return "-";
2487
+ }
2488
+ const numValue = Number(value);
2489
+ if (isNaN(numValue)) {
2490
+ return String(value);
2491
+ }
2492
+ if (precision !== void 0 && precision !== null) {
2493
+ return numValue.toFixed(precision);
2494
+ }
2495
+ return String(numValue);
2496
+ };
2456
2497
  return {
2498
+ formatReadonlyNumber,
2457
2499
  execFunc(type) {
2458
2500
  if (props.item.data.action && props.item.data.action[type]) {
2459
2501
  window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [
@@ -2469,6 +2511,7 @@ const _hoisted_1$g = {
2469
2511
  class: "item_require"
2470
2512
  };
2471
2513
  const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
2514
+ const _hoisted_3$7 = { key: 1 };
2472
2515
  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2473
2516
  const _component_el_tooltip = ElTooltip;
2474
2517
  const _component_el_input_number = ElInputNumber;
@@ -2512,8 +2555,8 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2512
2555
  precision: _ctx.item.data.precision,
2513
2556
  disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
2514
2557
  }, null, 8, ["modelValue", "controls-position", "size", "precision", "disabled"])) : createCommentVNode("", true),
2515
- !_ctx.drag ? (openBlock(), createBlock(_component_el_input_number, {
2516
- key: 1,
2558
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(_ctx.formatReadonlyNumber(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.precision)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input_number, {
2559
+ key: 2,
2517
2560
  modelValue: _ctx.data[_ctx.item.data.fieldName],
2518
2561
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
2519
2562
  width: "240px",
@@ -2557,6 +2600,7 @@ const _hoisted_1$f = {
2557
2600
  class: "item_require"
2558
2601
  };
2559
2602
  const _hoisted_2$a = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
2603
+ const _hoisted_3$6 = { key: 0 };
2560
2604
  function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2561
2605
  const _component_el_tooltip = ElTooltip;
2562
2606
  const _component_el_radio = ElRadio;
@@ -2591,8 +2635,8 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2591
2635
  class: "control",
2592
2636
  style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
2593
2637
  }, [
2594
- !_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
2595
- key: 0,
2638
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
2639
+ key: 1,
2596
2640
  modelValue: _ctx.data[_ctx.item.data.fieldName],
2597
2641
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
2598
2642
  size: _ctx.size,
@@ -2615,7 +2659,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2615
2659
  _: 1
2616
2660
  }, 8, ["modelValue", "size", "class"])) : createCommentVNode("", true),
2617
2661
  _ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
2618
- key: 1,
2662
+ key: 2,
2619
2663
  modelValue: _ctx.item.data.itemConfig.value,
2620
2664
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.item.data.itemConfig.value = $event),
2621
2665
  size: _ctx.size,
@@ -3105,6 +3149,7 @@ const _hoisted_1$e = {
3105
3149
  class: "item_require"
3106
3150
  };
3107
3151
  const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
3152
+ const _hoisted_3$5 = { key: 1 };
3108
3153
  function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
3109
3154
  const _component_el_tooltip = ElTooltip;
3110
3155
  const _component_el_option = ElOption;
@@ -3159,8 +3204,8 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
3159
3204
  ]),
3160
3205
  _: 1
3161
3206
  }, 8, ["modelValue", "placeholder", "size", "disabled"])) : createCommentVNode("", true),
3162
- !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
3163
- key: 1,
3207
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
3208
+ key: 2,
3164
3209
  modelValue: _ctx.data[_ctx.item.data.fieldName],
3165
3210
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
3166
3211
  width: "240px",
@@ -3224,6 +3269,7 @@ const _hoisted_1$d = {
3224
3269
  class: "item_require"
3225
3270
  };
3226
3271
  const _hoisted_2$8 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
3272
+ const _hoisted_3$4 = { key: 1 };
3227
3273
  function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3228
3274
  const _component_el_tooltip = ElTooltip;
3229
3275
  const _component_el_option = ElOption;
@@ -3279,8 +3325,8 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
3279
3325
  ]),
3280
3326
  _: 1
3281
3327
  }, 8, ["modelValue", "placeholder", "disabled", "size"])) : createCommentVNode("", true),
3282
- !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
3283
- key: 1,
3328
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(_ctx.data[_ctx.item.data.fieldName].join(",") || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
3329
+ key: 2,
3284
3330
  modelValue: _ctx.data[_ctx.item.data.fieldName],
3285
3331
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
3286
3332
  width: "240px",
@@ -3342,7 +3388,7 @@ const _hoisted_1$c = {
3342
3388
  class: "item_require"
3343
3389
  };
3344
3390
  const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
3345
- const _hoisted_3$1 = /* @__PURE__ */ createTextVNode("\u5DF2\u8BBE\u7F6E");
3391
+ const _hoisted_3$3 = /* @__PURE__ */ createTextVNode("\u5DF2\u8BBE\u7F6E");
3346
3392
  const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u672A\u8BBE\u7F6E");
3347
3393
  const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u666E\u901A\u8BBE\u7F6E");
3348
3394
  const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u9AD8\u7EA7\u8BBE\u7F6E");
@@ -3384,7 +3430,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
3384
3430
  size: _ctx.size
3385
3431
  }, {
3386
3432
  default: withCtx(() => [
3387
- _hoisted_3$1
3433
+ _hoisted_3$3
3388
3434
  ]),
3389
3435
  _: 1
3390
3436
  }, 8, ["size"])) : (openBlock(), createBlock(_component_el_button, {
@@ -3636,6 +3682,7 @@ const _hoisted_1$9 = {
3636
3682
  class: "item_require"
3637
3683
  };
3638
3684
  const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
3685
+ const _hoisted_3$2 = { key: 1 };
3639
3686
  function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3640
3687
  const _component_el_tooltip = ElTooltip;
3641
3688
  const _component_el_input = ElInput;
@@ -3683,8 +3730,8 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
3683
3730
  minlength: _ctx.item.data.minLength,
3684
3731
  class: normalizeClass("input-" + _ctx.item.data.align)
3685
3732
  }, null, 8, ["modelValue", "placeholder", "size", "disabled", "readonly", "maxlength", "minlength", "class"])) : createCommentVNode("", true),
3686
- !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
3687
- key: 1,
3733
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
3734
+ key: 2,
3688
3735
  modelValue: _ctx.data[_ctx.item.data.fieldName],
3689
3736
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
3690
3737
  width: "200px",
@@ -3745,6 +3792,7 @@ const _hoisted_1$8 = {
3745
3792
  class: "item_require"
3746
3793
  };
3747
3794
  const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
3795
+ const _hoisted_3$1 = { key: 1 };
3748
3796
  function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3749
3797
  const _component_el_tooltip = ElTooltip;
3750
3798
  const _component_el_input = ElInput;
@@ -3791,8 +3839,8 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
3791
3839
  autosize: _ctx.item.data.autoHeight,
3792
3840
  size: _ctx.size
3793
3841
  }, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "maxlength", "minlength", "autosize", "size"])) : createCommentVNode("", true),
3794
- !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
3795
- key: 1,
3842
+ !_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
3843
+ key: 2,
3796
3844
  type: "textarea",
3797
3845
  modelValue: _ctx.data[_ctx.item.data.fieldName],
3798
3846
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
@@ -4409,6 +4457,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
4409
4457
  default: withCtx(() => [
4410
4458
  (openBlock(), createBlock(resolveDynamicComponent(element.ControlType), {
4411
4459
  drag: true,
4460
+ size: "default",
4412
4461
  item: element,
4413
4462
  data: {}
4414
4463
  }, null, 8, ["item"]))
@@ -4440,6 +4489,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
4440
4489
  ref: "controlObj",
4441
4490
  onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change")),
4442
4491
  item: listItem,
4492
+ size: "default",
4443
4493
  data: _ctx.data || "{}",
4444
4494
  drag: false
4445
4495
  }, null, 40, ["item", "data"]))
@@ -4450,6 +4500,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
4450
4500
  ref: "controlObj",
4451
4501
  onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("change")),
4452
4502
  key: listItem.id,
4503
+ size: "default",
4453
4504
  item: listItem,
4454
4505
  data: _ctx.data || "{}",
4455
4506
  drag: false
@@ -4555,6 +4606,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
4555
4606
  }, {
4556
4607
  default: withCtx(() => [
4557
4608
  (openBlock(), createBlock(resolveDynamicComponent(element.ControlType), {
4609
+ size: "default",
4558
4610
  drag: true,
4559
4611
  item: element,
4560
4612
  data: {}
@@ -4577,6 +4629,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
4577
4629
  onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change")),
4578
4630
  item: listItem,
4579
4631
  data: _ctx.data || "{}",
4632
+ size: "default",
4580
4633
  drag: false
4581
4634
  }, null, 40, ["item", "data"]))
4582
4635
  ]),
@@ -4585,6 +4638,7 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
4585
4638
  ref_for: true,
4586
4639
  ref: "controlObj",
4587
4640
  onChange: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("change")),
4641
+ size: "default",
4588
4642
  key: listItem.id,
4589
4643
  item: listItem,
4590
4644
  data: _ctx.data || "{}",
@@ -4999,78 +5053,110 @@ class Flex {
4999
5053
  * json转标准数据格式进行收口
5000
5054
  */
5001
5055
  jsonToForm(item) {
5002
- if (!item.data || !item.controlItems) {
5003
- item = this.deepClone(item);
5004
- const currentComponent = window.VApp.$formcomponents[item.ControlType];
5005
- item.formConfig = window.VApp.$formcomponents[item.ControlType]?.formConfig || {};
5006
- if (!item.data) {
5007
- item.data = item.formConfig.data();
5008
- }
5009
- if (!item.data.fieldName) {
5010
- item.data.fieldName = item.ControlType + "_" + this.generateMixed();
5056
+ try {
5057
+ if (!item || !item.ControlType) {
5058
+ console.error("jsonToForm: 无效的 item 参数", item);
5059
+ return item;
5011
5060
  }
5012
- if (item.layout) {
5013
- if (item.ControlType == "Grid" && item.data.columns && item.data.columns.length > 0) {
5014
- item.data.columns = item.data.columns.map((colItem) => {
5015
- if (colItem.list && colItem.list.length > 0) {
5016
- colItem.list = this.jsonToForm(colItem.list);
5017
- }
5018
- return colItem;
5019
- });
5020
- } else if (item.ControlType == "TableLayout" && item.data.trs && item.data.trs.length > 0) {
5021
- item.data.trs = item.data.trs.map((trItem) => {
5022
- trItem.tds.forEach((tdItem) => {
5023
- if (tdItem.list && tdItem.list.length > 0) {
5024
- tdItem.list = this.jsonToForm(tdItem.list);
5061
+ if (!item.data || !item.controlItems) {
5062
+ item = this.deepClone(item);
5063
+ const currentComponent = window.VApp.$formcomponents[item.ControlType];
5064
+ if (!currentComponent) {
5065
+ console.warn(`jsonToForm: 未找到组件 ${item.ControlType},使用默认配置`);
5066
+ item.formConfig = {
5067
+ data: () => ({}),
5068
+ morenConfig: () => []
5069
+ };
5070
+ } else {
5071
+ item.formConfig = currentComponent.formConfig || {};
5072
+ }
5073
+ if (!item.data) {
5074
+ if (item.formConfig.data && typeof item.formConfig.data === "function") {
5075
+ item.data = item.formConfig.data();
5076
+ } else {
5077
+ console.warn(`jsonToForm: ${item.ControlType} 缺少 data 方法,使用空对象`);
5078
+ item.data = {};
5079
+ }
5080
+ }
5081
+ if (!item.data.fieldName) {
5082
+ item.data.fieldName = item.ControlType + "_" + this.generateMixed();
5083
+ }
5084
+ if (item.layout) {
5085
+ if (item.ControlType == "Grid" && item.data.columns && Array.isArray(item.data.columns)) {
5086
+ item.data.columns = item.data.columns.map((colItem) => {
5087
+ if (colItem.list && Array.isArray(colItem.list)) {
5088
+ colItem.list = colItem.list.map((listItem) => this.jsonToForm(listItem));
5025
5089
  }
5026
- return tdItem;
5090
+ return colItem;
5027
5091
  });
5028
- return trItem;
5029
- });
5030
- } else if ((item.ControlType == "Collapse" || item.ControlType == "Tabs") && item.data.items && item.data.items.length > 0) {
5031
- item.data.items = item.data.items.map((colItem) => {
5032
- if (colItem.list && colItem.list.length > 0) {
5033
- colItem.list = this.jsonToForm(colItem.list);
5034
- }
5035
- return colItem;
5036
- });
5092
+ } else if (item.ControlType == "TableLayout" && item.data.trs && Array.isArray(item.data.trs)) {
5093
+ item.data.trs = item.data.trs.map((trItem) => {
5094
+ if (trItem.tds && Array.isArray(trItem.tds)) {
5095
+ trItem.tds = trItem.tds.map((tdItem) => {
5096
+ if (tdItem.list && Array.isArray(tdItem.list)) {
5097
+ tdItem.list = tdItem.list.map((listItem) => this.jsonToForm(listItem));
5098
+ }
5099
+ return tdItem;
5100
+ });
5101
+ }
5102
+ return trItem;
5103
+ });
5104
+ } else if ((item.ControlType == "Collapse" || item.ControlType == "Tabs") && item.data.items && Array.isArray(item.data.items)) {
5105
+ item.data.items = item.data.items.map((colItem) => {
5106
+ if (colItem.list && Array.isArray(colItem.list)) {
5107
+ colItem.list = colItem.list.map((listItem) => this.jsonToForm(listItem));
5108
+ }
5109
+ return colItem;
5110
+ });
5111
+ }
5037
5112
  }
5038
- }
5039
- const dynamicList = formStore?.get("globalFormList")?.filter((item2) => {
5040
- if (item2.dynamic) {
5041
- return item2;
5113
+ const dynamicList = formStore?.get("globalFormList")?.filter((globalItem) => {
5114
+ return globalItem && globalItem.dynamic;
5115
+ }) || [];
5116
+ item.id = item.id || this.generateMixed();
5117
+ let controlItems = [];
5118
+ if (item.formConfig.morenConfig && typeof item.formConfig.morenConfig === "function") {
5119
+ controlItems = item.formConfig.morenConfig().concat(dynamicList);
5120
+ } else {
5121
+ console.warn(`jsonToForm: ${item.ControlType} 缺少 morenConfig 方法,使用空数组`);
5122
+ controlItems = dynamicList;
5042
5123
  }
5043
- });
5044
- item.id = this.generateMixed();
5045
- let controlItems = item.formConfig.morenConfig().concat(dynamicList);
5046
- if (currentComponent.actionType && currentComponent.actionType.length > 0) {
5047
- console.log(controlItems);
5048
- controlItems.find((item2) => {
5049
- if (item2.ControlType == "Action") {
5050
- item2.data.formConfig = {
5124
+ if (currentComponent && currentComponent.actionType && Array.isArray(currentComponent.actionType) && currentComponent.actionType.length > 0) {
5125
+ const actionControl = controlItems.find((controlItem) => controlItem && controlItem.ControlType == "Action");
5126
+ if (actionControl) {
5127
+ actionControl.data = actionControl.data || {};
5128
+ actionControl.data.formConfig = {
5051
5129
  value: {},
5052
5130
  items: []
5053
5131
  };
5054
5132
  currentComponent.actionType.forEach((action2, index) => {
5055
- item2.data.formConfig.items.push({
5056
- label: action2,
5057
- value: action2,
5058
- id: index + 1
5059
- });
5133
+ if (actionControl.data.formConfig) {
5134
+ actionControl.data.formConfig.items.push({
5135
+ label: action2,
5136
+ value: action2,
5137
+ id: index + 1
5138
+ });
5139
+ }
5060
5140
  });
5061
5141
  }
5062
- });
5063
- } else {
5064
- controlItems = controlItems.filter((item2) => {
5065
- if (item2.ControlType !== "Action") {
5066
- return item2;
5067
- }
5068
- });
5142
+ } else {
5143
+ controlItems = controlItems.filter((controlItem) => {
5144
+ return controlItem && controlItem.ControlType !== "Action";
5145
+ });
5146
+ }
5147
+ if (this.controlFormRule && typeof this.controlFormRule === "function") {
5148
+ item.rules = this.controlFormRule(controlItems, item);
5149
+ } else {
5150
+ console.warn("jsonToForm: controlFormRule 方法不存在,使用空数组");
5151
+ item.rules = [];
5152
+ }
5153
+ item.controlItems = controlItems;
5069
5154
  }
5070
- item.rules = this.controlFormRule(controlItems);
5071
- item.controlItems = controlItems;
5155
+ return item;
5156
+ } catch (error) {
5157
+ console.error("jsonToForm: 处理组件时发生错误", error, item);
5158
+ return item;
5072
5159
  }
5073
- return item;
5074
5160
  }
5075
5161
  /**
5076
5162
  * 完整的表单列表数据进行删减,方便展示
@@ -5218,7 +5304,7 @@ Object.keys(files).forEach((fileName) => {
5218
5304
  }
5219
5305
  });
5220
5306
  const RichText = defineAsyncComponent({
5221
- loader: () => import('./index-16bc32d0.mjs'),
5307
+ loader: () => import('./index-926a31bc.mjs'),
5222
5308
  loadingComponent: Loading
5223
5309
  });
5224
5310
  RichText.ControlType = "RichText";
@@ -5227,7 +5313,7 @@ RichText.icon = "icon-textEdit";
5227
5313
  RichText.formConfig = getFormConfig("RichText");
5228
5314
  utilFuns[RichText.ControlType] = RichText;
5229
5315
  const jsonEditor = defineAsyncComponent({
5230
- loader: () => import('./index-1132b976.mjs'),
5316
+ loader: () => import('./index-b97774de.mjs'),
5231
5317
  loadingComponent: Loading
5232
5318
  });
5233
5319
  jsonEditor.ControlType = "JsonEditor";
@@ -5237,14 +5323,14 @@ jsonEditor.formConfig = getFormConfig("JsonEditor", [{ fieldName: "default", com
5237
5323
  jsonEditor.rule = _.getJsonValidate();
5238
5324
  utilFuns[jsonEditor.ControlType] = jsonEditor;
5239
5325
  const formAction = defineAsyncComponent({
5240
- loader: () => import('./formAction-5c75f7d1.mjs'),
5326
+ loader: () => import('./formAction-1e01e917.mjs'),
5241
5327
  loadingComponent: Loading
5242
5328
  });
5243
5329
  formAction.ControlType = "FormAction";
5244
5330
  formAction.isHide = true;
5245
5331
  utilFuns[formAction.ControlType] = formAction;
5246
5332
  const Rule = defineAsyncComponent({
5247
- loader: () => import('./index-20cd69ac.mjs'),
5333
+ loader: () => import('./index-b62b5782.mjs'),
5248
5334
  loadingComponent: Loading
5249
5335
  });
5250
5336
  Rule.ControlType = "Rule";
@@ -5253,7 +5339,7 @@ utilFuns[Rule.ControlType] = Rule;
5253
5339
  const install = (app) => {
5254
5340
  app.config.globalProperties.$formcomponents = utilFuns;
5255
5341
  };
5256
- const Dynamicform = defineAsyncComponent(() => import('./starfish-form-f84a17c3.mjs'));
5342
+ const Dynamicform = defineAsyncComponent(() => import('./starfish-form-bbc0124d.mjs'));
5257
5343
  const main = {
5258
5344
  install
5259
5345
  };
@@ -3,7 +3,7 @@ import 'element-plus/es/components/base/style/css';
3
3
  import 'element-plus/es/components/form/style/css';
4
4
  import 'element-plus/es/components/form-item/style/css';
5
5
  import { defineComponent, getCurrentInstance, ref, onMounted, openBlock, createElementBlock, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, toRaw } from 'vue';
6
- import { _ as _export_sfc } from './main-a1705ce2.mjs';
6
+ import { _ as _export_sfc } from './main-f8d74300.mjs';
7
7
  import 'element-plus/es/components/icon/style/css';
8
8
  import 'element-plus/es/components/input/style/css';
9
9
  import 'element-plus/es/components/checkbox/style/css';
@@ -1,4 +1,4 @@
1
- export { D as Dynamicform, m as default } from './main-a1705ce2.mjs';
1
+ export { D as Dynamicform, m as default } from './main-f8d74300.mjs';
2
2
  import 'vue';
3
3
  import 'element-plus/es';
4
4
  import 'element-plus/es/components/base/style/css';
@@ -62,6 +62,7 @@ interface Config {
62
62
  fieldName: string;
63
63
  component: string;
64
64
  label?: string;
65
+ format?: string;
65
66
  }
66
67
  interface FormConfigReturn {
67
68
  data: () => fields;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starfish-form-custom",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "main": "dist/starfish-form.mjs",
5
5
  "style": "dist/style.css",
6
6
  "module": "dist/starfish-form.mjs",