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

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
  };
@@ -2527,8 +2524,8 @@
2527
2524
  value.value = [];
2528
2525
  }
2529
2526
  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);
2527
+ if (start !== preStart) value.value[0] = start;
2528
+ if (end !== preEnd) value.value[1] = end;
2532
2529
  },
2533
2530
  {
2534
2531
  immediate: true
@@ -2537,8 +2534,8 @@
2537
2534
  } else if (props.name && props.model[props.name]) {
2538
2535
  vue.watch(
2539
2536
  () => props.model[props.name],
2540
- (start, preStart) => {
2541
- if (start !== preStart) value.value = start.map((item) => item ? new Date(item) : void 0);
2537
+ (start) => {
2538
+ value.value = start;
2542
2539
  },
2543
2540
  {
2544
2541
  immediate: true
@@ -2552,11 +2549,7 @@
2552
2549
  return;
2553
2550
  }
2554
2551
  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
- );
2552
+ props.model[item] = v[index];
2560
2553
  } else {
2561
2554
  props.model[item] = void 0;
2562
2555
  }
@@ -2565,18 +2558,12 @@
2565
2558
  const changeHandler = (v) => {
2566
2559
  const value2 = v || [];
2567
2560
  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
- );
2561
+ emit("change", value2);
2575
2562
  } else {
2576
2563
  if (names?.length) {
2577
2564
  setValue(value2);
2578
2565
  }
2579
- emit("change", value2);
2566
+ emit("change", props.model);
2580
2567
  }
2581
2568
  };
2582
2569
  return (_ctx, _cache) => {
@@ -3086,9 +3073,9 @@
3086
3073
  onClick: cancel,
3087
3074
  size: "small"
3088
3075
  }, {
3089
- default: vue.withCtx(() => [
3076
+ default: vue.withCtx(() => _cache[2] || (_cache[2] = [
3090
3077
  vue.createTextVNode("取 消")
3091
- ]),
3078
+ ])),
3092
3079
  _: 1
3093
3080
  }),
3094
3081
  hasStep.value && stepActive.value > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -3097,9 +3084,9 @@
3097
3084
  size: "small",
3098
3085
  onClick: preStep
3099
3086
  }, {
3100
- default: vue.withCtx(() => [
3087
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
3101
3088
  vue.createTextVNode("上一步")
3102
- ]),
3089
+ ])),
3103
3090
  _: 1
3104
3091
  })) : vue.createCommentVNode("", true),
3105
3092
  hasStep.value && stepCount.value > stepActive.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
@@ -3108,9 +3095,9 @@
3108
3095
  size: "small",
3109
3096
  onClick: nextStep
3110
3097
  }, {
3111
- default: vue.withCtx(() => [
3098
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
3112
3099
  vue.createTextVNode("下一步")
3113
- ]),
3100
+ ])),
3114
3101
  _: 1
3115
3102
  })) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
3116
3103
  key: 2,
@@ -3164,7 +3151,7 @@
3164
3151
  });
3165
3152
 
3166
3153
  const _hoisted_1$4 = ["href"];
3167
- const _hoisted_2$2 = {
3154
+ const _hoisted_2$1 = {
3168
3155
  key: 2,
3169
3156
  class: "m-fields-link"
3170
3157
  };
@@ -3240,15 +3227,15 @@
3240
3227
  }, vue.toDisplayString(displayText.value), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
3241
3228
  key: 1,
3242
3229
  style: vue.normalizeStyle(_ctx.config.disabledCss || {})
3243
- }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
3230
+ }, vue.toDisplayString(displayText.value), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
3244
3231
  vue.createVNode(vue.unref(design.TMagicButton), {
3245
3232
  link: "",
3246
3233
  type: "primary",
3247
3234
  onClick: editHandler
3248
3235
  }, {
3249
- default: vue.withCtx(() => [
3236
+ default: vue.withCtx(() => _cache[0] || (_cache[0] = [
3250
3237
  vue.createTextVNode("点击编辑")
3251
- ]),
3238
+ ])),
3252
3239
  _: 1
3253
3240
  }),
3254
3241
  vue.createVNode(_sfc_main$c, {
@@ -3317,7 +3304,6 @@
3317
3304
  });
3318
3305
 
3319
3306
  const _hoisted_1$3 = { class: "m-fields-number-range" };
3320
- const _hoisted_2$1 = /* @__PURE__ */ vue.createElementVNode("span", { class: "split-tag" }, "-", -1);
3321
3307
  const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
3322
3308
  ...{
3323
3309
  name: "MFormNumberRange"
@@ -3358,7 +3344,7 @@
3358
3344
  disabled: _ctx.disabled,
3359
3345
  onChange: minChangeHandler
3360
3346
  }, null, 8, ["modelValue", "size", "disabled"]),
3361
- _hoisted_2$1,
3347
+ _cache[2] || (_cache[2] = vue.createElementVNode("span", { class: "split-tag" }, "-", -1)),
3362
3348
  vue.createVNode(vue.unref(design.TMagicInput), {
3363
3349
  modelValue: _ctx.model[_ctx.name][1],
3364
3350
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
@@ -3881,8 +3867,7 @@
3881
3867
  });
3882
3868
 
3883
3869
  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" } };
3870
+ const _hoisted_2 = { style: { "display": "flex", "justify-content": "flex-end" } };
3886
3871
  const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
3887
3872
  ...{
3888
3873
  name: "MFormText"
@@ -4008,7 +3993,6 @@
4008
3993
  modelValue: _ctx.model[_ctx.name],
4009
3994
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
4010
3995
  clearable: "",
4011
- "data-tmagic-form-item-prop": _ctx.prop,
4012
3996
  size: _ctx.size,
4013
3997
  placeholder: _ctx.config.placeholder,
4014
3998
  disabled: _ctx.disabled,
@@ -4033,20 +4017,20 @@
4033
4017
  ]),
4034
4018
  key: "0"
4035
4019
  } : void 0
4036
- ]), 1032, ["modelValue", "data-tmagic-form-item-prop", "size", "placeholder", "disabled"])
4020
+ ]), 1032, ["modelValue", "size", "placeholder", "disabled"])
4037
4021
  ]),
4038
4022
  default: vue.withCtx(() => [
4039
4023
  vue.createElementVNode("div", _hoisted_1$1, [
4040
- _hoisted_2,
4041
- vue.createElementVNode("div", _hoisted_3, [
4024
+ _cache[5] || (_cache[5] = vue.createElementVNode("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1)),
4025
+ vue.createElementVNode("div", _hoisted_2, [
4042
4026
  vue.createVNode(vue.unref(design.TMagicButton), {
4043
4027
  link: "",
4044
4028
  size: "small",
4045
4029
  onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
4046
4030
  }, {
4047
- default: vue.withCtx(() => [
4031
+ default: vue.withCtx(() => _cache[3] || (_cache[3] = [
4048
4032
  vue.createTextVNode("保持原样")
4049
- ]),
4033
+ ])),
4050
4034
  _: 1
4051
4035
  }),
4052
4036
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -4054,9 +4038,9 @@
4054
4038
  size: "small",
4055
4039
  onClick: confirmTrimHandler
4056
4040
  }, {
4057
- default: vue.withCtx(() => [
4041
+ default: vue.withCtx(() => _cache[4] || (_cache[4] = [
4058
4042
  vue.createTextVNode("移除空格")
4059
- ]),
4043
+ ])),
4060
4044
  _: 1
4061
4045
  })
4062
4046
  ])
@@ -4342,9 +4326,9 @@
4342
4326
  default: vue.withCtx(() => [
4343
4327
  vue.renderSlot(_ctx.$slots, "footer", {}, () => [
4344
4328
  vue.createVNode(vue.unref(design.TMagicButton), { onClick: handleClose }, {
4345
- default: vue.withCtx(() => [
4329
+ default: vue.withCtx(() => _cache[1] || (_cache[1] = [
4346
4330
  vue.createTextVNode("关闭")
4347
- ]),
4331
+ ])),
4348
4332
  _: 1
4349
4333
  }),
4350
4334
  vue.createVNode(vue.unref(design.TMagicButton), {
@@ -4519,8 +4503,8 @@
4519
4503
  const createForm = (config) => config;
4520
4504
  const defaultInstallOpt = {};
4521
4505
  const index = {
4522
- install(app, opt = {}) {
4523
- const option = Object.assign(defaultInstallOpt, opt);
4506
+ install(app, opt) {
4507
+ const option = Object.assign(defaultInstallOpt, opt || {});
4524
4508
  app.config.globalProperties.$MAGIC_FORM = option;
4525
4509
  setConfig(option);
4526
4510
  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.7",
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.7",
58
+ "@tmagic/utils": "1.5.0-beta.7"
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);
@@ -22,7 +22,6 @@ import { ref, watch } from 'vue';
22
22
  import { TMagicDatePicker } from '@tmagic/design';
23
23
 
24
24
  import type { DaterangeConfig, FieldProps } from '../schema';
25
- import { datetimeFormatter } from '../utils/form';
26
25
  import { useAddField } from '../utils/useAddField';
27
26
 
28
27
  defineOptions({
@@ -35,7 +34,6 @@ const emit = defineEmits(['change']);
35
34
 
36
35
  useAddField(props.prop);
37
36
 
38
- // eslint-disable-next-line vue/no-setup-props-destructure
39
37
  const { names } = props.config;
40
38
  const value = ref<(Date | undefined)[] | null>([]);
41
39
 
@@ -48,8 +46,8 @@ if (props.model !== undefined) {
48
46
  value.value = [];
49
47
  }
50
48
  if (!start || !end) value.value = [];
51
- if (start !== preStart) value.value[0] = new Date(start);
52
- if (end !== preEnd) value.value[1] = new Date(end);
49
+ if (start !== preStart) value.value[0] = start;
50
+ if (end !== preEnd) value.value[1] = end;
53
51
  },
54
52
  {
55
53
  immediate: true,
@@ -58,8 +56,8 @@ if (props.model !== undefined) {
58
56
  } else if (props.name && props.model[props.name]) {
59
57
  watch(
60
58
  () => props.model[props.name],
61
- (start, preStart) => {
62
- if (start !== preStart) value.value = start.map((item: string) => (item ? new Date(item) : undefined));
59
+ (start) => {
60
+ value.value = start;
63
61
  },
64
62
  {
65
63
  immediate: true,
@@ -74,11 +72,7 @@ const setValue = (v: Date[] | Date) => {
74
72
  return;
75
73
  }
76
74
  if (Array.isArray(v)) {
77
- props.model[item] = datetimeFormatter(
78
- v[index]?.toString(),
79
- '',
80
- props.config.valueFormat || 'YYYY/MM/DD HH:mm:ss',
81
- );
75
+ props.model[item] = v[index];
82
76
  } else {
83
77
  props.model[item] = undefined;
84
78
  }
@@ -89,18 +83,12 @@ const changeHandler = (v: Date[]) => {
89
83
  const value = v || [];
90
84
 
91
85
  if (props.name) {
92
- emit(
93
- 'change',
94
- value.map((item?: Date) => {
95
- if (item) return datetimeFormatter(item, '', props.config.valueFormat || 'YYYY/MM/DD HH:mm:ss');
96
- return undefined;
97
- }),
98
- );
86
+ emit('change', value);
99
87
  } else {
100
88
  if (names?.length) {
101
89
  setValue(value);
102
90
  }
103
- emit('change', value);
91
+ emit('change', props.model);
104
92
  }
105
93
  };
106
94
  </script>