@tmagic/form 1.5.0-beta.6 → 1.5.0-beta.8

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.
@@ -182,11 +182,11 @@
182
182
  return defaultValue;
183
183
  };
184
184
 
185
- const _hoisted_1$d = ["data-tmagic-id"];
186
- const _hoisted_2$8 = ["innerHTML", "title"];
187
- const _hoisted_3$5 = ["innerHTML"];
188
- const _hoisted_4$4 = ["innerHTML"];
189
- const _hoisted_5$4 = ["innerHTML"];
185
+ const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
186
+ const _hoisted_2$7 = ["innerHTML", "title"];
187
+ const _hoisted_3$4 = ["innerHTML"];
188
+ const _hoisted_4$3 = ["innerHTML"];
189
+ const _hoisted_5$3 = ["innerHTML"];
190
190
  const _hoisted_6$2 = ["innerHTML", "title"];
191
191
  const _hoisted_7$1 = ["innerHTML"];
192
192
  const _hoisted_8$1 = ["innerHTML"];
@@ -337,6 +337,7 @@
337
337
  return _ctx.config ? (vue.openBlock(), vue.createElementBlock("div", {
338
338
  key: 0,
339
339
  "data-tmagic-id": _ctx.config.id,
340
+ "data-tmagic-form-item-prop": itemProp.value,
340
341
  style: vue.normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
341
342
  class: vue.normalizeClass(`m-form-container m-container-${type.value || ""} ${_ctx.config.className || ""}`)
342
343
  }, [
@@ -374,16 +375,15 @@
374
375
  vue.createElementVNode("span", {
375
376
  innerHTML: type.value === "checkbox" ? "" : text.value,
376
377
  title: _ctx.config.labelTitle
377
- }, null, 8, _hoisted_2$8)
378
+ }, null, 8, _hoisted_2$7)
378
379
  ]),
379
380
  default: vue.withCtx(() => [
380
381
  tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
381
382
  content: vue.withCtx(() => [
382
- vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
383
+ vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$4)
383
384
  ]),
384
385
  default: vue.withCtx(() => [
385
386
  (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
386
- "data-tmagic-form-item-prop": itemProp.value,
387
387
  key: key(_ctx.config),
388
388
  size: _ctx.size,
389
389
  model: _ctx.model,
@@ -394,11 +394,10 @@
394
394
  prop: itemProp.value,
395
395
  onChange: onChangeHandler,
396
396
  onAddDiffCount
397
- }, null, 40, ["data-tmagic-form-item-prop", "size", "model", "last-values", "config", "name", "disabled", "prop"]))
397
+ }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"]))
398
398
  ]),
399
399
  _: 1
400
400
  })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
401
- "data-tmagic-form-item-prop": itemProp.value,
402
401
  key: key(_ctx.config),
403
402
  size: _ctx.size,
404
403
  model: _ctx.model,
@@ -409,12 +408,12 @@
409
408
  prop: itemProp.value,
410
409
  onChange: onChangeHandler,
411
410
  onAddDiffCount
412
- }, null, 40, ["data-tmagic-form-item-prop", "size", "model", "last-values", "config", "name", "disabled", "prop"])),
411
+ }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"])),
413
412
  extra.value && type.value !== "table" ? (vue.openBlock(), vue.createElementBlock("div", {
414
413
  key: 2,
415
414
  innerHTML: extra.value,
416
415
  class: "m-form-tip"
417
- }, null, 8, _hoisted_4$4)) : vue.createCommentVNode("", true)
416
+ }, null, 8, _hoisted_4$3)) : vue.createCommentVNode("", true)
418
417
  ]),
419
418
  _: 1
420
419
  }, 8, ["style", "class", "prop", "label-width", "rules"]),
@@ -425,7 +424,7 @@
425
424
  content: vue.withCtx(() => [
426
425
  vue.createElementVNode("div", {
427
426
  innerHTML: _ctx.config.tip
428
- }, null, 8, _hoisted_5$4)
427
+ }, null, 8, _hoisted_5$3)
429
428
  ]),
430
429
  default: vue.withCtx(() => [
431
430
  vue.createVNode(vue.unref(design.TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -613,10 +612,10 @@
613
612
  });
614
613
 
615
614
  const _hoisted_1$c = ["innerHTML"];
616
- const _hoisted_2$7 = ["innerHTML"];
617
- const _hoisted_3$4 = { key: 1 };
618
- const _hoisted_4$3 = ["innerHTML"];
619
- const _hoisted_5$3 = ["innerHTML"];
615
+ const _hoisted_2$6 = ["innerHTML"];
616
+ const _hoisted_3$3 = { key: 1 };
617
+ const _hoisted_4$2 = ["innerHTML"];
618
+ const _hoisted_5$2 = ["innerHTML"];
620
619
  const _hoisted_6$1 = {
621
620
  key: 2,
622
621
  style: { "display": "flex" }
@@ -688,21 +687,21 @@
688
687
  key: 0,
689
688
  innerHTML: _ctx.config.extra,
690
689
  class: "m-form-tip"
691
- }, null, 8, _hoisted_2$7)) : vue.createCommentVNode("", true)
690
+ }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
692
691
  ]),
693
692
  _: 1
694
693
  }, 8, ["modelValue", "prop"])
695
694
  ]),
696
695
  _: 1
697
- })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$4, [
696
+ })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$3, [
698
697
  vue.createElementVNode("span", {
699
698
  innerHTML: _ctx.config.legend
700
- }, null, 8, _hoisted_4$3),
699
+ }, null, 8, _hoisted_4$2),
701
700
  _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
702
701
  key: 0,
703
702
  innerHTML: _ctx.config.extra,
704
703
  class: "m-form-tip"
705
- }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
704
+ }, null, 8, _hoisted_5$2)) : vue.createCommentVNode("", true)
706
705
  ])),
707
706
  _ctx.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
708
707
  vue.createElementVNode("div", _hoisted_7, [
@@ -749,7 +748,7 @@
749
748
  });
750
749
 
751
750
  const _hoisted_1$b = { class: "m-fields-group-list-item" };
752
- const _hoisted_2$6 = ["innerHTML"];
751
+ const _hoisted_2$5 = ["innerHTML"];
753
752
  const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
754
753
  ...{
755
754
  name: "MFormGroupListItem"
@@ -850,7 +849,7 @@
850
849
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
851
850
  }, {
852
851
  default: vue.withCtx(() => [
853
- vue.createTextVNode("上移"),
852
+ _cache[3] || (_cache[3] = vue.createTextVNode("上移")),
854
853
  vue.createVNode(vue.unref(design.TMagicIcon), null, {
855
854
  default: vue.withCtx(() => [
856
855
  vue.createVNode(vue.unref(iconsVue.CaretTop))
@@ -869,7 +868,7 @@
869
868
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
870
869
  }, {
871
870
  default: vue.withCtx(() => [
872
- vue.createTextVNode("下移"),
871
+ _cache[4] || (_cache[4] = vue.createTextVNode("下移")),
873
872
  vue.createVNode(vue.unref(design.TMagicIcon), null, {
874
873
  default: vue.withCtx(() => [
875
874
  vue.createVNode(vue.unref(iconsVue.CaretBottom))
@@ -886,7 +885,7 @@
886
885
  key: 1,
887
886
  innerHTML: itemExtra.value,
888
887
  class: "m-form-tip"
889
- }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
888
+ }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true)
890
889
  ]),
891
890
  expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$x, {
892
891
  key: 0,
@@ -907,15 +906,11 @@
907
906
  });
908
907
 
909
908
  const _hoisted_1$a = { class: "m-fields-group-list" };
910
- const _hoisted_2$5 = ["innerHTML"];
911
- const _hoisted_3$3 = {
909
+ const _hoisted_2$4 = ["innerHTML"];
910
+ const _hoisted_3$2 = {
912
911
  key: 1,
913
912
  class: "el-table__empty-block"
914
913
  };
915
- const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1);
916
- const _hoisted_5$2 = [
917
- _hoisted_4$2
918
- ];
919
914
  const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
920
915
  ...{
921
916
  name: "MFormGroupList"
@@ -1001,8 +996,10 @@
1001
996
  key: 0,
1002
997
  innerHTML: _ctx.config.extra,
1003
998
  style: { "color": "rgba(0, 0, 0, 0.45)" }
1004
- }, null, 8, _hoisted_2$5)) : vue.createCommentVNode("", true),
1005
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
999
+ }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1000
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, _cache[1] || (_cache[1] = [
1001
+ vue.createElementVNode("span", { class: "el-table__empty-text" }, "暂无数据", -1)
1002
+ ]))) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
1006
1003
  return vue.openBlock(), vue.createBlock(_sfc_main$v, {
1007
1004
  key: index,
1008
1005
  model: item,
@@ -1027,9 +1024,9 @@
1027
1024
  size: "small",
1028
1025
  disabled: _ctx.disabled
1029
1026
  }, {
1030
- default: vue.withCtx(() => [
1027
+ default: vue.withCtx(() => _cache[2] || (_cache[2] = [
1031
1028
  vue.createTextVNode("新增")
1032
- ]),
1029
+ ])),
1033
1030
  _: 1
1034
1031
  }, 8, ["disabled"])) : vue.createCommentVNode("", true),
1035
1032
  _ctx.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -1038,9 +1035,9 @@
1038
1035
  size: "small",
1039
1036
  onClick: toggleMode
1040
1037
  }, {
1041
- default: vue.withCtx(() => [
1038
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
1042
1039
  vue.createTextVNode("切换为表格")
1043
- ]),
1040
+ ])),
1044
1041
  _: 1
1045
1042
  }, 8, ["icon"])) : vue.createCommentVNode("", true)
1046
1043
  ]);
@@ -1049,8 +1046,8 @@
1049
1046
  });
1050
1047
 
1051
1048
  const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
1052
- const _hoisted_2$4 = ["innerHTML"];
1053
- const _hoisted_3$2 = {
1049
+ const _hoisted_2$3 = ["innerHTML"];
1050
+ const _hoisted_3$1 = {
1054
1051
  key: 0,
1055
1052
  style: { "display": "flex" }
1056
1053
  };
@@ -1100,7 +1097,7 @@
1100
1097
  key: 0,
1101
1098
  innerHTML: _ctx.config.extra,
1102
1099
  class: "m-form-tip"
1103
- }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
1100
+ }, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true),
1104
1101
  vue.renderSlot(_ctx.$slots, "header", {}, () => [
1105
1102
  vue.createTextVNode(vue.toDisplayString(filter(_ctx.config.title)), 1)
1106
1103
  ])
@@ -1109,7 +1106,7 @@
1109
1106
  default: vue.withCtx(() => [
1110
1107
  vue.createElementVNode("div", null, [
1111
1108
  vue.renderSlot(_ctx.$slots, "default"),
1112
- _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
1109
+ _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
1113
1110
  vue.createElementVNode("div", _hoisted_4$1, [
1114
1111
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, (item, index) => {
1115
1112
  return vue.openBlock(), vue.createBlock(_sfc_main$x, {
@@ -1335,8 +1332,8 @@
1335
1332
  });
1336
1333
 
1337
1334
  const _hoisted_1$8 = { class: "m-fields-table-wrap" };
1338
- const _hoisted_2$3 = ["innerHTML"];
1339
- const _hoisted_3$1 = ["innerHTML"];
1335
+ const _hoisted_2$2 = ["innerHTML"];
1336
+ const _hoisted_3 = ["innerHTML"];
1340
1337
  const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
1341
1338
  const _hoisted_5 = { style: { "display": "flex" } };
1342
1339
  const _hoisted_6 = {
@@ -1714,7 +1711,7 @@
1714
1711
  key: 0,
1715
1712
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1716
1713
  innerHTML: _ctx.config.extra
1717
- }, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true),
1714
+ }, null, 8, _hoisted_2$2)) : vue.createCommentVNode("", true),
1718
1715
  vue.createVNode(vue.unref(design.TMagicTooltip), {
1719
1716
  content: "拖拽可排序",
1720
1717
  placement: "left-start",
@@ -1746,7 +1743,7 @@
1746
1743
  vue.createElementVNode("span", {
1747
1744
  innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
1748
1745
  class: "m-form-tip"
1749
- }, null, 8, _hoisted_3$1)
1746
+ }, null, 8, _hoisted_3)
1750
1747
  ]),
1751
1748
  _: 1
1752
1749
  })) : vue.createCommentVNode("", true),
@@ -1883,9 +1880,9 @@
1883
1880
  plain: "",
1884
1881
  onClick: _cache[2] || (_cache[2] = ($event) => newHandler())
1885
1882
  }, {
1886
- default: vue.withCtx(() => [
1883
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
1887
1884
  vue.createTextVNode("新增一行")
1888
- ]),
1885
+ ])),
1889
1886
  _: 1
1890
1887
  }, 8, ["disabled"])) : vue.createCommentVNode("", true),
1891
1888
  vue.createElementVNode("div", _hoisted_5, [
@@ -1896,9 +1893,9 @@
1896
1893
  type: "primary",
1897
1894
  onClick: toggleMode
1898
1895
  }, {
1899
- default: vue.withCtx(() => [
1896
+ default: vue.withCtx(() => _cache[5] || (_cache[5] = [
1900
1897
  vue.createTextVNode("展开配置")
1901
- ]),
1898
+ ])),
1902
1899
  _: 1
1903
1900
  }, 8, ["icon"])) : vue.createCommentVNode("", true),
1904
1901
  _ctx.config.enableFullscreen !== false ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -1930,9 +1927,9 @@
1930
1927
  disabled: _ctx.disabled,
1931
1928
  plain: ""
1932
1929
  }, {
1933
- default: vue.withCtx(() => [
1930
+ default: vue.withCtx(() => _cache[6] || (_cache[6] = [
1934
1931
  vue.createTextVNode("导入EXCEL")
1935
- ]),
1932
+ ])),
1936
1933
  _: 1
1937
1934
  }, 8, ["disabled"])
1938
1935
  ]),
@@ -1946,9 +1943,9 @@
1946
1943
  plain: "",
1947
1944
  onClick: _cache[3] || (_cache[3] = ($event) => clearHandler())
1948
1945
  }, {
1949
- default: vue.withCtx(() => [
1946
+ default: vue.withCtx(() => _cache[7] || (_cache[7] = [
1950
1947
  vue.createTextVNode("清空")
1951
- ]),
1948
+ ])),
1952
1949
  _: 1
1953
1950
  }, 8, ["disabled"])) : vue.createCommentVNode("", true)
1954
1951
  ])
@@ -2475,7 +2472,7 @@
2475
2472
  const props = __props;
2476
2473
  const emit = __emit;
2477
2474
  useAddField(props.prop);
2478
- props.model[props.name] = datetimeFormatter(props.model[props.name], "", "YYYY/MM/DD");
2475
+ props.model[props.name] = datetimeFormatter(props.model[props.name], "", props.config.valueFormat || "YYYY/MM/DD");
2479
2476
  const changeHandler = (v) => {
2480
2477
  emit("change", v);
2481
2478
  };
@@ -2526,9 +2523,10 @@
2526
2523
  if (!value.value) {
2527
2524
  value.value = [];
2528
2525
  }
2526
+ const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
2529
2527
  if (!start || !end) value.value = [];
2530
- if (start !== preStart) value.value[0] = new Date(start);
2531
- if (end !== preEnd) value.value[1] = new Date(end);
2528
+ if (start !== preStart) value.value[0] = datetimeFormatter(start, "", format);
2529
+ if (end !== preEnd) value.value[1] = datetimeFormatter(end, "", format);
2532
2530
  },
2533
2531
  {
2534
2532
  immediate: true
@@ -2538,7 +2536,11 @@
2538
2536
  vue.watch(
2539
2537
  () => props.model[props.name],
2540
2538
  (start, preStart) => {
2541
- if (start !== preStart) value.value = start.map((item) => item ? new Date(item) : void 0);
2539
+ const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
2540
+ if (start !== preStart)
2541
+ value.value = start.map(
2542
+ (item) => item ? datetimeFormatter(item, "", format) : void 0
2543
+ );
2542
2544
  },
2543
2545
  {
2544
2546
  immediate: true
@@ -2552,11 +2554,7 @@
2552
2554
  return;
2553
2555
  }
2554
2556
  if (Array.isArray(v)) {
2555
- props.model[item] = datetimeFormatter(
2556
- v[index]?.toString(),
2557
- "",
2558
- props.config.valueFormat || "YYYY/MM/DD HH:mm:ss"
2559
- );
2557
+ props.model[item] = v[index];
2560
2558
  } else {
2561
2559
  props.model[item] = void 0;
2562
2560
  }
@@ -2565,18 +2563,12 @@
2565
2563
  const changeHandler = (v) => {
2566
2564
  const value2 = v || [];
2567
2565
  if (props.name) {
2568
- emit(
2569
- "change",
2570
- value2.map((item) => {
2571
- if (item) return datetimeFormatter(item, "", props.config.valueFormat || "YYYY/MM/DD HH:mm:ss");
2572
- return void 0;
2573
- })
2574
- );
2566
+ emit("change", value2);
2575
2567
  } else {
2576
2568
  if (names?.length) {
2577
2569
  setValue(value2);
2578
2570
  }
2579
- emit("change", value2);
2571
+ emit("change", props.model);
2580
2572
  }
2581
2573
  };
2582
2574
  return (_ctx, _cache) => {
@@ -3086,9 +3078,9 @@
3086
3078
  onClick: cancel,
3087
3079
  size: "small"
3088
3080
  }, {
3089
- default: vue.withCtx(() => [
3081
+ default: vue.withCtx(() => _cache[2] || (_cache[2] = [
3090
3082
  vue.createTextVNode("取 消")
3091
- ]),
3083
+ ])),
3092
3084
  _: 1
3093
3085
  }),
3094
3086
  hasStep.value && stepActive.value > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -3097,9 +3089,9 @@
3097
3089
  size: "small",
3098
3090
  onClick: preStep
3099
3091
  }, {
3100
- default: vue.withCtx(() => [
3092
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
3101
3093
  vue.createTextVNode("上一步")
3102
- ]),
3094
+ ])),
3103
3095
  _: 1
3104
3096
  })) : vue.createCommentVNode("", true),
3105
3097
  hasStep.value && stepCount.value > stepActive.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -3108,9 +3100,9 @@
3108
3100
  size: "small",
3109
3101
  onClick: nextStep
3110
3102
  }, {
3111
- default: vue.withCtx(() => [
3103
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
3112
3104
  vue.createTextVNode("下一步")
3113
- ]),
3105
+ ])),
3114
3106
  _: 1
3115
3107
  })) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3116
3108
  key: 2,
@@ -3164,7 +3156,7 @@
3164
3156
  });
3165
3157
 
3166
3158
  const _hoisted_1$4 = ["href"];
3167
- const _hoisted_2$2 = {
3159
+ const _hoisted_2$1 = {
3168
3160
  key: 2,
3169
3161
  class: "m-fields-link"
3170
3162
  };
@@ -3240,15 +3232,15 @@
3240
3232
  }, vue.toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
3241
3233
  key: 1,
3242
3234
  style: vue.normalizeStyle(_ctx.config.disabledCss || {})
3243
- }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
3235
+ }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
3244
3236
  vue.createVNode(vue.unref(design.TMagicButton), {
3245
3237
  link: "",
3246
3238
  type: "primary",
3247
3239
  onClick: editHandler
3248
3240
  }, {
3249
- default: vue.withCtx(() => [
3241
+ default: vue.withCtx(() => _cache[0] || (_cache[0] = [
3250
3242
  vue.createTextVNode("点击编辑")
3251
- ]),
3243
+ ])),
3252
3244
  _: 1
3253
3245
  }),
3254
3246
  vue.createVNode(_sfc_main$c, {
@@ -3317,7 +3309,6 @@
3317
3309
  });
3318
3310
 
3319
3311
  const _hoisted_1$3 = { class: "m-fields-number-range" };
3320
- const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3321
3312
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
3322
3313
  ...{
3323
3314
  name: "MFormNumberRange"
@@ -3358,7 +3349,7 @@
3358
3349
  disabled: _ctx.disabled,
3359
3350
  onChange: minChangeHandler
3360
3351
  }, null, 8, ["modelValue", "size", "disabled"]),
3361
- _hoisted_2$1,
3352
+ _cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "split-tag" }, "-", -1)),
3362
3353
  vue.createVNode(vue.unref(design.TMagicInput), {
3363
3354
  modelValue: _ctx.model[_ctx.name][1],
3364
3355
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3881,8 +3872,7 @@
3881
3872
  });
3882
3873
 
3883
3874
  const _hoisted_1$1 = { class: "m-form-item__content" };
3884
- const _hoisted_2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1);
3885
- const _hoisted_3 = { style: { "display": "flex", "justify-content": "flex-end" } };
3875
+ const _hoisted_2 = { style: { "display": "flex", "justify-content": "flex-end" } };
3886
3876
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
3887
3877
  ...{
3888
3878
  name: "MFormText"
@@ -4008,7 +3998,6 @@
4008
3998
  modelValue: _ctx.model[_ctx.name],
4009
3999
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
4010
4000
  clearable: "",
4011
- "data-tmagic-form-item-prop": _ctx.prop,
4012
4001
  size: _ctx.size,
4013
4002
  placeholder: _ctx.config.placeholder,
4014
4003
  disabled: _ctx.disabled,
@@ -4033,20 +4022,20 @@
4033
4022
  ]),
4034
4023
  key: "0"
4035
4024
  } : void 0
4036
- ]), 1032, ["modelValue", "data-tmagic-form-item-prop", "size", "placeholder", "disabled"])
4025
+ ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4037
4026
  ]),
4038
4027
  default: vue.withCtx(() => [
4039
4028
  vue.createElementVNode("div", _hoisted_1$1, [
4040
- _hoisted_2,
4041
- vue.createElementVNode("div", _hoisted_3, [
4029
+ _cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1)),
4030
+ vue.createElementVNode("div", _hoisted_2, [
4042
4031
  vue.createVNode(vue.unref(design.TMagicButton), {
4043
4032
  link: "",
4044
4033
  size: "small",
4045
4034
  onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
4046
4035
  }, {
4047
- default: vue.withCtx(() => [
4036
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
4048
4037
  vue.createTextVNode("保持原样")
4049
- ]),
4038
+ ])),
4050
4039
  _: 1
4051
4040
  }),
4052
4041
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -4054,9 +4043,9 @@
4054
4043
  size: "small",
4055
4044
  onClick: confirmTrimHandler
4056
4045
  }, {
4057
- default: vue.withCtx(() => [
4046
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
4058
4047
  vue.createTextVNode("移除空格")
4059
- ]),
4048
+ ])),
4060
4049
  _: 1
4061
4050
  })
4062
4051
  ])
@@ -4342,9 +4331,9 @@
4342
4331
  default: vue.withCtx(() => [
4343
4332
  vue.renderSlot(_ctx.$slots, "footer", {}, () => [
4344
4333
  vue.createVNode(vue.unref(design.TMagicButton), { onClick: handleClose }, {
4345
- default: vue.withCtx(() => [
4334
+ default: vue.withCtx(() => _cache[1] || (_cache[1] = [
4346
4335
  vue.createTextVNode("关闭")
4347
- ]),
4336
+ ])),
4348
4337
  _: 1
4349
4338
  }),
4350
4339
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -4519,8 +4508,8 @@
4519
4508
  const createForm = (config) => config;
4520
4509
  const defaultInstallOpt = {};
4521
4510
  const index = {
4522
- install(app, opt = {}) {
4523
- const option = Object.assign(defaultInstallOpt, opt);
4511
+ install(app, opt) {
4512
+ const option = Object.assign(defaultInstallOpt, opt || {});
4524
4513
  app.config.globalProperties.$MAGIC_FORM = option;
4525
4514
  setConfig(option);
4526
4515
  app.component("m-form", _sfc_main$d);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.0-beta.6",
2
+ "version": "1.5.0-beta.8",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -44,18 +44,18 @@
44
44
  "@types/lodash-es": "^4.17.4",
45
45
  "@types/node": "^18.19.0",
46
46
  "@types/sortablejs": "^1.15.8",
47
- "@vitejs/plugin-vue": "^5.1.1",
48
- "@vue/compiler-sfc": "^3.4.27",
47
+ "@vitejs/plugin-vue": "^5.1.3",
48
+ "@vue/compiler-sfc": "^3.5.0",
49
49
  "@vue/test-utils": "^2.4.6",
50
50
  "rimraf": "^3.0.2",
51
- "sass": "^1.77.0",
52
- "vite": "^5.3.5"
51
+ "sass": "^1.78.0",
52
+ "vite": "^5.4.3"
53
53
  },
54
54
  "peerDependencies": {
55
- "vue": "^3.4.35",
55
+ "vue": "^3.5.0",
56
56
  "typescript": "*",
57
- "@tmagic/design": "1.5.0-beta.6",
58
- "@tmagic/utils": "1.5.0-beta.6"
57
+ "@tmagic/design": "1.5.0-beta.8",
58
+ "@tmagic/utils": "1.5.0-beta.8"
59
59
  },
60
60
  "peerDependenciesMeta": {
61
61
  "typescript": {
@@ -2,6 +2,7 @@
2
2
  <div
3
3
  v-if="config"
4
4
  :data-tmagic-id="config.id"
5
+ :data-tmagic-form-item-prop="itemProp"
5
6
  :style="config.tip ? 'display: flex;align-items: baseline;' : ''"
6
7
  :class="`m-form-container m-container-${type || ''} ${config.className || ''}`"
7
8
  >
@@ -44,7 +45,6 @@
44
45
  <template #label><span v-html="type === 'checkbox' ? '' : text" :title="config.labelTitle"></span></template>
45
46
  <TMagicTooltip v-if="tooltip">
46
47
  <component
47
- :data-tmagic-form-item-prop="itemProp"
48
48
  :key="key(config)"
49
49
  :size="size"
50
50
  :is="tagName"
@@ -64,7 +64,6 @@
64
64
 
65
65
  <component
66
66
  v-else
67
- :data-tmagic-form-item-prop="itemProp"
68
67
  :key="key(config)"
69
68
  :size="size"
70
69
  :is="tagName"
@@ -30,7 +30,7 @@ const emit = defineEmits<{
30
30
 
31
31
  useAddField(props.prop);
32
32
 
33
- props.model[props.name] = datetimeFormatter(props.model[props.name], '', 'YYYY/MM/DD');
33
+ props.model[props.name] = datetimeFormatter(props.model[props.name], '', props.config.valueFormat || 'YYYY/MM/DD');
34
34
 
35
35
  const changeHandler = (v: string) => {
36
36
  emit('change', v);