@tmagic/form 1.0.0-beta.6 → 1.0.0-rc.10

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.
Files changed (39) hide show
  1. package/README.md +1 -0
  2. package/dist/style.css +9 -11
  3. package/dist/tmagic-form.es.js +240 -145
  4. package/dist/tmagic-form.es.js.map +1 -1
  5. package/dist/tmagic-form.umd.js +243 -149
  6. package/dist/tmagic-form.umd.js.map +1 -1
  7. package/dist/types/src/containers/Col.vue.d.ts +42 -0
  8. package/dist/types/src/containers/Container.vue.d.ts +1 -0
  9. package/dist/types/src/containers/Row.vue.d.ts +0 -1
  10. package/dist/types/src/fields/Checkbox.vue.d.ts +2 -2
  11. package/dist/types/src/fields/DynamicField.vue.d.ts +2 -2
  12. package/dist/types/src/index.d.ts +1 -1
  13. package/dist/types/src/schema.d.ts +10 -0
  14. package/package.json +17 -7
  15. package/src/Form.vue +7 -2
  16. package/src/FormDialog.vue +1 -1
  17. package/src/containers/Col.vue +56 -0
  18. package/src/containers/Container.vue +42 -12
  19. package/src/containers/GroupListItem.vue +4 -4
  20. package/src/containers/Row.vue +13 -17
  21. package/src/containers/Table.vue +15 -7
  22. package/src/containers/Tabs.vue +13 -5
  23. package/src/fields/Checkbox.vue +2 -2
  24. package/src/fields/Daterange.vue +8 -0
  25. package/src/fields/Link.vue +1 -1
  26. package/src/fields/Select.vue +11 -15
  27. package/src/fields/Text.vue +4 -4
  28. package/src/fields/Textarea.vue +11 -13
  29. package/src/schema.ts +10 -0
  30. package/src/theme/form.scss +24 -17
  31. package/src/utils/form.ts +7 -1
  32. package/dist/types/src/Form.vue.d.ts +0 -301
  33. package/dist/types/src/FormDialog.vue.d.ts +0 -638
  34. package/dist/types/src/containers/Table.vue.d.ts +0 -1403
  35. package/dist/types/src/fields/Cascader.vue.d.ts +0 -1748
  36. package/dist/types/src/fields/Link.vue.d.ts +0 -1358
  37. package/dist/types/src/fields/Select.vue.d.ts +0 -975
  38. package/tsconfig.json +0 -9
  39. package/vite.config.ts +0 -27
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('lodash-es'), require('@element-plus/icons'), require('element-plus'), require('sortablejs'), require('@tmagic/utils')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', 'lodash-es', '@element-plus/icons', 'element-plus', 'sortablejs', '@tmagic/utils'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.vue, global.lodashEs, global.icons, global.elementPlus, global.Sortable, global.utils));
5
- })(this, (function (exports, vue, lodashEs, icons, elementPlus, Sortable, utils) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons'), require('lodash-es'), require('element-plus'), require('sortablejs'), require('@tmagic/utils')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons', 'lodash-es', 'element-plus', 'sortablejs', '@tmagic/utils'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.icons, global.lodashEs, global.ElementPlus, global.Sortable, global.utils));
5
+ })(this, (function (exports, vue, icons, lodashEs, elementPlus, Sortable, utils) { 'use strict';
6
6
 
7
7
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
8
 
@@ -62,7 +62,11 @@
62
62
  asyncLoadConfig(value, initValue2, item);
63
63
  if (name && !items && typeof initValue2[name] !== "undefined") {
64
64
  if (typeof value[name] === "undefined") {
65
- value[name] = typeof initValue2[name] === "object" ? lodashEs.cloneDeep(initValue2[name]) : initValue2[name];
65
+ if (type === "number") {
66
+ value[name] = Number(initValue2[name]);
67
+ } else {
68
+ value[name] = typeof initValue2[name] === "object" ? lodashEs.cloneDeep(initValue2[name]) : initValue2[name];
69
+ }
66
70
  }
67
71
  return value;
68
72
  }
@@ -113,7 +117,8 @@
113
117
  model: props.model,
114
118
  parent: mForm?.parentValues || {},
115
119
  formValue: mForm?.values || props.model,
116
- prop: props.prop
120
+ prop: props.prop,
121
+ config: props.config
117
122
  });
118
123
  };
119
124
  const display = function(mForm, config, props) {
@@ -144,7 +149,8 @@
144
149
  model: props.model,
145
150
  parent: mForm?.parentValues || {},
146
151
  formValue: mForm?.values || props.model,
147
- prop: props.prop
152
+ prop: props.prop,
153
+ config: props.config
148
154
  }, mForm);
149
155
  }
150
156
  return item;
@@ -172,8 +178,9 @@
172
178
  return target;
173
179
  };
174
180
 
175
- const _sfc_main$s = vue.defineComponent({
181
+ const _sfc_main$t = vue.defineComponent({
176
182
  name: "m-form-container",
183
+ components: { WarningFilled: icons.WarningFilled },
177
184
  props: {
178
185
  labelWidth: String,
179
186
  expandMore: Boolean,
@@ -203,7 +210,18 @@
203
210
  const expand = vue.ref(false);
204
211
  const name = vue.computed(() => props.config.name || "");
205
212
  const items = vue.computed(() => props.config.items);
206
- const itemProp = vue.computed(() => name.value ? `${props.prop}${props.prop ? "." : ""}${name.value}` : props.prop);
213
+ const itemProp = vue.computed(() => {
214
+ let n = "";
215
+ const { names } = props.config;
216
+ if (names?.[0]) {
217
+ [n] = names;
218
+ } else if (name.value) {
219
+ n = name.value;
220
+ } else {
221
+ return props.prop;
222
+ }
223
+ return `${props.prop}${props.prop ? "." : ""}${n}`;
224
+ });
207
225
  const tagName = vue.computed(() => {
208
226
  const component = vue.resolveComponent(`m-${items.value ? "form" : "fields"}-${type.value}`);
209
227
  if (typeof component !== "string")
@@ -231,6 +249,7 @@
231
249
  }
232
250
  return display(mForm, props.config.display, props);
233
251
  });
252
+ const itemLabelWidth = vue.computed(() => props.config.labelWidth || props.labelWidth);
234
253
  vue.watchEffect(() => {
235
254
  expand.value = props.expandMore;
236
255
  });
@@ -242,7 +261,8 @@
242
261
  model: props.model,
243
262
  values: mForm?.initValues,
244
263
  formValue: mForm?.values,
245
- prop: itemProp.value
264
+ prop: itemProp.value,
265
+ config: props.config
246
266
  });
247
267
  }
248
268
  if (filter === "number") {
@@ -256,7 +276,8 @@
256
276
  model: props.model,
257
277
  values: mForm?.initValues,
258
278
  formValue: mForm?.values,
259
- prop: itemProp.value
279
+ prop: itemProp.value,
280
+ config: props.config
260
281
  });
261
282
  }
262
283
  };
@@ -267,9 +288,14 @@
267
288
  };
268
289
  const onChangeHandler = async function(v, key2) {
269
290
  const { filter, onChange, trim, name: name2, dynamicKey } = props.config;
270
- let value = filterHandler(filter, v);
271
- value = await changeHandler(onChange, value) ?? value;
272
- value = trimHandler(trim, value) ?? value;
291
+ let value = v;
292
+ try {
293
+ value = filterHandler(filter, v);
294
+ value = await changeHandler(onChange, value) ?? value;
295
+ value = trimHandler(trim, value) ?? value;
296
+ } catch (e) {
297
+ console.error(e);
298
+ }
273
299
  if ((name2 || name2 === 0) && props.model !== value && (v !== value || props.model[name2] !== value)) {
274
300
  props.model[name2] = value;
275
301
  }
@@ -286,6 +312,7 @@
286
312
  itemProp,
287
313
  items,
288
314
  display: display$1,
315
+ itemLabelWidth,
289
316
  tagName,
290
317
  rule,
291
318
  tooltip,
@@ -296,24 +323,25 @@
296
323
  };
297
324
  }
298
325
  });
299
- const _hoisted_1$g = ["innerHTML"];
326
+ const _hoisted_1$f = ["innerHTML"];
300
327
  const _hoisted_2$7 = ["innerHTML"];
301
328
  const _hoisted_3$7 = ["innerHTML"];
302
- const _hoisted_4$6 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-warning" }, null, -1);
303
- const _hoisted_5$4 = ["innerHTML"];
304
- const _hoisted_6$3 = {
329
+ const _hoisted_4$6 = ["innerHTML"];
330
+ const _hoisted_5$4 = {
305
331
  key: 4,
306
332
  style: { "text-align": "center" }
307
333
  };
308
- function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
334
+ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
309
335
  const _component_m_fields_hidden = vue.resolveComponent("m-fields-hidden");
310
336
  const _component_el_tooltip = vue.resolveComponent("el-tooltip");
311
337
  const _component_el_form_item = vue.resolveComponent("el-form-item");
338
+ const _component_warning_filled = vue.resolveComponent("warning-filled");
339
+ const _component_el_icon = vue.resolveComponent("el-icon");
312
340
  const _component_m_form_container = vue.resolveComponent("m-form-container");
313
341
  const _component_el_button = vue.resolveComponent("el-button");
314
342
  return _ctx.config ? (vue.openBlock(), vue.createElementBlock("div", {
315
343
  key: 0,
316
- style: vue.normalizeStyle(_ctx.config.tip ? "display: flex" : ""),
344
+ style: vue.normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
317
345
  class: vue.normalizeClass([_ctx.config.className, "m-form-container"])
318
346
  }, [
319
347
  _ctx.type === "hidden" ? (vue.openBlock(), vue.createBlock(_component_m_fields_hidden, {
@@ -332,19 +360,20 @@
332
360
  prop: _ctx.itemProp,
333
361
  "step-active": _ctx.stepActive,
334
362
  "expand-more": _ctx.expand,
335
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
363
+ "label-width": _ctx.itemLabelWidth,
336
364
  onChange: _ctx.onChangeHandler
337
- }, null, 8, ["size", "model", "config", "name", "prop", "step-active", "expand-more", "label-width", "onChange"])) : _ctx.type && _ctx.display ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
365
+ }, null, 40, ["size", "model", "config", "name", "prop", "step-active", "expand-more", "label-width", "onChange"])) : _ctx.type && _ctx.display ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
338
366
  vue.createVNode(_component_el_form_item, {
339
367
  style: vue.normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
368
+ class: vue.normalizeClass({ hidden: `${_ctx.itemLabelWidth}` === "0" || !_ctx.config.text }),
340
369
  prop: _ctx.itemProp,
341
- "label-width": _ctx.config.text ? _ctx.config.labelWidth || _ctx.labelWidth : "0",
370
+ "label-width": _ctx.itemLabelWidth,
342
371
  rules: _ctx.rule
343
372
  }, {
344
373
  label: vue.withCtx(() => [
345
374
  vue.createElementVNode("span", {
346
375
  innerHTML: _ctx.type === "checkbox" ? "" : _ctx.config.text
347
- }, null, 8, _hoisted_1$g)
376
+ }, null, 8, _hoisted_1$f)
348
377
  ]),
349
378
  default: vue.withCtx(() => [
350
379
  _ctx.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, { key: 0 }, {
@@ -361,7 +390,7 @@
361
390
  disabled: _ctx.disabled,
362
391
  prop: _ctx.itemProp,
363
392
  onChange: _ctx.onChangeHandler
364
- }, null, 8, ["size", "model", "config", "name", "disabled", "prop", "onChange"]))
393
+ }, null, 40, ["size", "model", "config", "name", "disabled", "prop", "onChange"]))
365
394
  ]),
366
395
  _: 1
367
396
  })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tagName), {
@@ -373,7 +402,7 @@
373
402
  disabled: _ctx.disabled,
374
403
  prop: _ctx.itemProp,
375
404
  onChange: _ctx.onChangeHandler
376
- }, null, 8, ["size", "model", "config", "name", "disabled", "prop", "onChange"])),
405
+ }, null, 40, ["size", "model", "config", "name", "disabled", "prop", "onChange"])),
377
406
  _ctx.extra ? (vue.openBlock(), vue.createElementBlock("div", {
378
407
  key: 2,
379
408
  innerHTML: _ctx.extra,
@@ -381,19 +410,23 @@
381
410
  }, null, 8, _hoisted_3$7)) : vue.createCommentVNode("", true)
382
411
  ]),
383
412
  _: 1
384
- }, 8, ["style", "prop", "label-width", "rules"]),
413
+ }, 8, ["style", "class", "prop", "label-width", "rules"]),
385
414
  _ctx.config.tip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
386
415
  key: 0,
387
- placement: "top",
388
- style: { "line-height": "40px", "margin-left": "5px" }
416
+ placement: "left"
389
417
  }, {
390
418
  content: vue.withCtx(() => [
391
419
  vue.createElementVNode("div", {
392
420
  innerHTML: _ctx.config.tip
393
- }, null, 8, _hoisted_5$4)
421
+ }, null, 8, _hoisted_4$6)
394
422
  ]),
395
423
  default: vue.withCtx(() => [
396
- _hoisted_4$6
424
+ vue.createVNode(_component_el_icon, { style: { "line-height": "40px", "margin-left": "5px" } }, {
425
+ default: vue.withCtx(() => [
426
+ vue.createVNode(_component_warning_filled)
427
+ ]),
428
+ _: 1
429
+ })
397
430
  ]),
398
431
  _: 1
399
432
  })) : vue.createCommentVNode("", true)
@@ -406,15 +439,15 @@
406
439
  size: _ctx.size,
407
440
  "step-active": _ctx.stepActive,
408
441
  "expand-more": _ctx.expand,
409
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
442
+ "label-width": _ctx.itemLabelWidth,
410
443
  prop: _ctx.itemProp,
411
444
  onChange: _ctx.onChangeHandler
412
445
  }, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop", "onChange"]);
413
446
  }), 128)) : vue.createCommentVNode("", true)
414
447
  ], 64)) : vue.createCommentVNode("", true),
415
- _ctx.config.expand && _ctx.type !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$3, [
448
+ _ctx.config.expand && _ctx.type !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5$4, [
416
449
  vue.createVNode(_component_el_button, {
417
- type: "text",
450
+ text: "",
418
451
  onClick: _ctx.expandHandler
419
452
  }, {
420
453
  default: vue.withCtx(() => [
@@ -425,9 +458,9 @@
425
458
  ])) : vue.createCommentVNode("", true)
426
459
  ], 6)) : vue.createCommentVNode("", true);
427
460
  }
428
- var Container = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$p]]);
461
+ var Container = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["render", _sfc_render$q]]);
429
462
 
430
- const _sfc_main$r = vue.defineComponent({
463
+ const _sfc_main$s = vue.defineComponent({
431
464
  name: "m-form-fieldset",
432
465
  props: {
433
466
  labelWidth: String,
@@ -479,7 +512,7 @@
479
512
  };
480
513
  }
481
514
  });
482
- const _hoisted_1$f = ["innerHTML"];
515
+ const _hoisted_1$e = ["innerHTML"];
483
516
  const _hoisted_2$6 = ["innerHTML"];
484
517
  const _hoisted_3$6 = { key: 1 };
485
518
  const _hoisted_4$5 = ["innerHTML"];
@@ -493,7 +526,7 @@
493
526
  };
494
527
  const _hoisted_10$1 = { style: { "flex": "1" } };
495
528
  const _hoisted_11 = ["src"];
496
- function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
529
+ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
497
530
  const _component_el_checkbox = vue.resolveComponent("el-checkbox");
498
531
  const _component_m_form_container = vue.resolveComponent("m-form-container");
499
532
  return (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model) ? (vue.openBlock(), vue.createElementBlock("fieldset", {
@@ -513,7 +546,7 @@
513
546
  default: vue.withCtx(() => [
514
547
  vue.createElementVNode("span", {
515
548
  innerHTML: _ctx.config.legend
516
- }, null, 8, _hoisted_1$f),
549
+ }, null, 8, _hoisted_1$e),
517
550
  _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
518
551
  key: 0,
519
552
  innerHTML: _ctx.config.extra,
@@ -585,9 +618,9 @@
585
618
  }), 128)) : vue.createCommentVNode("", true)
586
619
  ], 4)) : vue.createCommentVNode("", true);
587
620
  }
588
- var Fieldset = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$o]]);
621
+ var Fieldset = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$p]]);
589
622
 
590
- const _sfc_main$q = vue.defineComponent({
623
+ const _sfc_main$r = vue.defineComponent({
591
624
  name: "m-form-group-list-item",
592
625
  components: { CaretRight: icons.CaretRight, CaretBottom: icons.CaretBottom },
593
626
  props: {
@@ -671,11 +704,11 @@
671
704
  };
672
705
  }
673
706
  });
674
- const _hoisted_1$e = { class: "m-fields-group-list-item" };
707
+ const _hoisted_1$d = { class: "m-fields-group-list-item" };
675
708
  const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u79FB");
676
709
  const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u79FB");
677
710
  const _hoisted_4$4 = ["innerHTML"];
678
- function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
711
+ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
679
712
  const _component_caret_bottom = vue.resolveComponent("caret-bottom");
680
713
  const _component_caret_right = vue.resolveComponent("caret-right");
681
714
  const _component_el_icon = vue.resolveComponent("el-icon");
@@ -683,7 +716,7 @@
683
716
  const _component_CaretRight = vue.resolveComponent("CaretRight");
684
717
  const _component_CaretBottom = vue.resolveComponent("CaretBottom");
685
718
  const _component_m_form_container = vue.resolveComponent("m-form-container");
686
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
719
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
687
720
  vue.createElementVNode("div", null, [
688
721
  vue.createVNode(_component_el_icon, {
689
722
  style: { "margin-right": "7px" },
@@ -695,7 +728,7 @@
695
728
  _: 1
696
729
  }, 8, ["onClick"]),
697
730
  vue.createVNode(_component_el_button, {
698
- type: "text",
731
+ text: "",
699
732
  onClick: _ctx.expandHandler
700
733
  }, {
701
734
  default: vue.withCtx(() => [
@@ -704,7 +737,7 @@
704
737
  _: 1
705
738
  }, 8, ["onClick"]),
706
739
  vue.withDirectives(vue.createVNode(_component_el_button, {
707
- type: "text",
740
+ text: "",
708
741
  icon: _ctx.Delete,
709
742
  style: { "color": "#f56c6c" },
710
743
  onClick: _ctx.removeHandler
@@ -713,7 +746,7 @@
713
746
  ]),
714
747
  _ctx.movable() ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
715
748
  vue.withDirectives(vue.createVNode(_component_el_button, {
716
- type: "text",
749
+ text: "",
717
750
  size: "small",
718
751
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.changeOrder(-1))
719
752
  }, {
@@ -731,7 +764,7 @@
731
764
  [vue.vShow, _ctx.index !== 0]
732
765
  ]),
733
766
  vue.withDirectives(vue.createVNode(_component_el_button, {
734
- type: "text",
767
+ text: "",
735
768
  size: "small",
736
769
  onClick: _cache[1] || (_cache[1] = ($event) => _ctx.changeOrder(1))
737
770
  }, {
@@ -766,9 +799,9 @@
766
799
  }, null, 8, ["config", "model", "labelWidth", "prop", "size", "onChange"])) : vue.createCommentVNode("", true)
767
800
  ]);
768
801
  }
769
- var MFieldsGroupListItem = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$n]]);
802
+ var MFieldsGroupListItem = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$o]]);
770
803
 
771
- const _sfc_main$p = vue.defineComponent({
804
+ const _sfc_main$q = vue.defineComponent({
772
805
  name: "m-form-group-list",
773
806
  components: { MFieldsGroupListItem },
774
807
  props: {
@@ -860,7 +893,7 @@
860
893
  };
861
894
  }
862
895
  });
863
- const _hoisted_1$d = { class: "m-fields-group-list" };
896
+ const _hoisted_1$c = { class: "m-fields-group-list" };
864
897
  const _hoisted_2$4 = ["innerHTML"];
865
898
  const _hoisted_3$4 = {
866
899
  key: 1,
@@ -872,10 +905,10 @@
872
905
  ];
873
906
  const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0\u7EC4");
874
907
  const _hoisted_7$1 = /* @__PURE__ */ vue.createTextVNode("\u5207\u6362\u4E3A\u8868\u683C");
875
- function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
908
+ function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
876
909
  const _component_m_fields_group_list_item = vue.resolveComponent("m-fields-group-list-item");
877
910
  const _component_el_button = vue.resolveComponent("el-button");
878
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
911
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
879
912
  _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
880
913
  key: 0,
881
914
  innerHTML: _ctx.config.extra,
@@ -919,9 +952,9 @@
919
952
  }, 8, ["onClick"])) : vue.createCommentVNode("", true)
920
953
  ]);
921
954
  }
922
- var GroupList = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$m]]);
955
+ var GroupList = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$n]]);
923
956
 
924
- const _sfc_main$o = vue.defineComponent({
957
+ const _sfc_main$p = vue.defineComponent({
925
958
  name: "m-form-panel",
926
959
  components: { CaretBottom: icons.CaretBottom, CaretRight: icons.CaretRight },
927
960
  props: {
@@ -954,7 +987,7 @@
954
987
  };
955
988
  }
956
989
  });
957
- const _hoisted_1$c = { class: "clearfix" };
990
+ const _hoisted_1$b = { class: "clearfix" };
958
991
  const _hoisted_2$3 = ["innerHTML"];
959
992
  const _hoisted_3$3 = {
960
993
  key: 0,
@@ -962,7 +995,7 @@
962
995
  };
963
996
  const _hoisted_4$2 = { style: { "flex": "1" } };
964
997
  const _hoisted_5$1 = ["src"];
965
- function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
998
+ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
966
999
  const _component_caret_bottom = vue.resolveComponent("caret-bottom");
967
1000
  const _component_caret_right = vue.resolveComponent("caret-right");
968
1001
  const _component_el_icon = vue.resolveComponent("el-icon");
@@ -974,7 +1007,7 @@
974
1007
  "body-style": { display: _ctx.expand ? "block" : "none" }
975
1008
  }, {
976
1009
  header: vue.withCtx(() => [
977
- vue.createElementVNode("div", _hoisted_1$c, [
1010
+ vue.createElementVNode("div", _hoisted_1$b, [
978
1011
  vue.createElementVNode("a", {
979
1012
  href: "javascript:",
980
1013
  style: { "width": "100%", "display": "block" },
@@ -1032,10 +1065,60 @@
1032
1065
  _: 3
1033
1066
  }, 8, ["body-style"])) : vue.createCommentVNode("", true);
1034
1067
  }
1035
- var Panel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$l]]);
1068
+ var Panel = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$m]]);
1069
+
1070
+ const _sfc_main$o = vue.defineComponent({
1071
+ props: {
1072
+ labelWidth: String,
1073
+ expandMore: Boolean,
1074
+ span: Number,
1075
+ model: {
1076
+ type: Object,
1077
+ default: () => ({})
1078
+ },
1079
+ config: {
1080
+ type: Object,
1081
+ default: () => ({})
1082
+ },
1083
+ prop: String,
1084
+ size: String
1085
+ },
1086
+ emits: ["change"],
1087
+ setup(props, { emit }) {
1088
+ const mForm = vue.inject("mForm");
1089
+ const changeHandler = () => emit("change", props.model);
1090
+ return {
1091
+ mForm,
1092
+ display: vue.computed(() => display(mForm, props.config.display, props)),
1093
+ changeHandler
1094
+ };
1095
+ }
1096
+ });
1097
+ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
1098
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
1099
+ const _component_el_col = vue.resolveComponent("el-col");
1100
+ return vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_col, { span: _ctx.span }, {
1101
+ default: vue.withCtx(() => [
1102
+ vue.createVNode(_component_m_form_container, {
1103
+ model: _ctx.model,
1104
+ config: _ctx.config,
1105
+ prop: _ctx.prop,
1106
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1107
+ "expand-more": _ctx.expandMore,
1108
+ size: _ctx.size,
1109
+ onChange: _ctx.changeHandler
1110
+ }, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size", "onChange"])
1111
+ ]),
1112
+ _: 1
1113
+ }, 8, ["span"])), [
1114
+ [vue.vShow, _ctx.display && _ctx.config.type !== "hidden"]
1115
+ ]);
1116
+ }
1117
+ var Col = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$l]]);
1036
1118
 
1037
1119
  const _sfc_main$n = vue.defineComponent({
1038
1120
  name: "m-form-row",
1121
+ components: { Col },
1039
1122
  props: {
1040
1123
  labelWidth: String,
1041
1124
  expandMore: Boolean,
@@ -1057,38 +1140,27 @@
1057
1140
  const changeHandler = () => emit("change", props.name ? props.model[props.name] : props.model);
1058
1141
  return {
1059
1142
  mForm,
1060
- display(config) {
1061
- return display(mForm, config.display, props);
1062
- },
1063
1143
  changeHandler
1064
1144
  };
1065
1145
  }
1066
1146
  });
1067
1147
  function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
1068
- const _component_m_form_container = vue.resolveComponent("m-form-container");
1069
- const _component_el_col = vue.resolveComponent("el-col");
1148
+ const _component_Col = vue.resolveComponent("Col");
1070
1149
  const _component_el_row = vue.resolveComponent("el-row");
1071
1150
  return vue.openBlock(), vue.createBlock(_component_el_row, { gutter: 10 }, {
1072
1151
  default: vue.withCtx(() => [
1073
1152
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (col, index) => {
1074
- return vue.openBlock(), vue.createBlock(_component_el_col, {
1075
- style: vue.normalizeStyle(!_ctx.display(col) || col.type === "hidden" ? "display: none" : ""),
1153
+ return vue.openBlock(), vue.createBlock(_component_Col, {
1076
1154
  key: col[_ctx.mForm?.keyProp || "__key"] ?? index,
1077
- span: col.span || _ctx.config.span || 24 / _ctx.config.items.length
1078
- }, {
1079
- default: vue.withCtx(() => [
1080
- vue.createVNode(_component_m_form_container, {
1081
- model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1082
- config: col,
1083
- prop: _ctx.prop,
1084
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1085
- "expand-more": _ctx.expandMore,
1086
- size: _ctx.size,
1087
- onChange: _ctx.changeHandler
1088
- }, null, 8, ["model", "config", "prop", "label-width", "expand-more", "size", "onChange"])
1089
- ]),
1090
- _: 2
1091
- }, 1032, ["style", "span"]);
1155
+ span: col.span || _ctx.config.span || 24 / _ctx.config.items.length,
1156
+ config: col,
1157
+ labelWidth: _ctx.config.labelWidth || _ctx.labelWidth,
1158
+ expandMore: _ctx.expandMore,
1159
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1160
+ prop: _ctx.prop,
1161
+ size: _ctx.size,
1162
+ onChange: _ctx.changeHandler
1163
+ }, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "prop", "size", "onChange"]);
1092
1164
  }), 128))
1093
1165
  ]),
1094
1166
  _: 1
@@ -1421,7 +1493,7 @@
1421
1493
  }
1422
1494
  emit("select", selection, row);
1423
1495
  if (typeof props.config.onSelect === "function") {
1424
- props.config.onSelect(mForm, { selection, row });
1496
+ props.config.onSelect(mForm, { selection, row, config: props.config });
1425
1497
  }
1426
1498
  },
1427
1499
  toggleRowSelection(row, selected) {
@@ -1547,7 +1619,7 @@
1547
1619
  };
1548
1620
  }
1549
1621
  });
1550
- const _hoisted_1$b = ["innerHTML"];
1622
+ const _hoisted_1$a = ["innerHTML"];
1551
1623
  const _hoisted_2$2 = { class: "el-form-item__content" };
1552
1624
  const _hoisted_3$2 = ["innerHTML"];
1553
1625
  const _hoisted_4$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0");
@@ -1576,7 +1648,7 @@
1576
1648
  key: 0,
1577
1649
  style: { "color": "rgba(0, 0, 0, 0.45)" },
1578
1650
  innerHTML: _ctx.config.extra
1579
- }, null, 8, _hoisted_1$b)) : vue.createCommentVNode("", true),
1651
+ }, null, 8, _hoisted_1$a)) : vue.createCommentVNode("", true),
1580
1652
  vue.createElementVNode("div", _hoisted_2$2, [
1581
1653
  vue.createVNode(_component_el_tooltip, {
1582
1654
  content: "\u62D6\u62FD\u53EF\u6392\u5E8F",
@@ -1617,8 +1689,8 @@
1617
1689
  }, {
1618
1690
  default: vue.withCtx((scope) => [
1619
1691
  vue.withDirectives(vue.createVNode(_component_el_button, {
1620
- style: { "color": "#f56c6c" },
1621
- type: "text",
1692
+ type: "danger",
1693
+ text: "",
1622
1694
  icon: _ctx.Delete,
1623
1695
  onClick: ($event) => _ctx.removeHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1624
1696
  }, null, 8, ["icon", "onClick"]), [
@@ -1642,8 +1714,9 @@
1642
1714
  vue.createVNode(_component_el_button, {
1643
1715
  plain: "",
1644
1716
  size: "small",
1717
+ type: "primary",
1645
1718
  icon: _ctx.ArrowUp,
1646
- type: "text",
1719
+ text: "",
1647
1720
  onClick: ($event) => _ctx.upHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1),
1648
1721
  onDblclick: ($event) => _ctx.topHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1649
1722
  }, null, 8, ["icon", "onClick", "onDblclick"])
@@ -1659,8 +1732,9 @@
1659
1732
  vue.createVNode(_component_el_button, {
1660
1733
  plain: "",
1661
1734
  size: "small",
1735
+ type: "primary",
1662
1736
  icon: _ctx.ArrowDown,
1663
- type: "text",
1737
+ text: "",
1664
1738
  onClick: ($event) => _ctx.downHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1),
1665
1739
  onDblclick: ($event) => _ctx.bottomHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1666
1740
  }, null, 8, ["icon", "onClick", "onDblclick"])
@@ -1737,6 +1811,7 @@
1737
1811
  key: 1,
1738
1812
  icon: _ctx.Grid,
1739
1813
  size: "small",
1814
+ type: "primary",
1740
1815
  onClick: _ctx.toggleMode
1741
1816
  }, {
1742
1817
  default: vue.withCtx(() => [
@@ -1748,6 +1823,7 @@
1748
1823
  key: 2,
1749
1824
  icon: _ctx.FullScreen,
1750
1825
  size: "small",
1826
+ type: "primary",
1751
1827
  onClick: _ctx.toggleFullscreen
1752
1828
  }, {
1753
1829
  default: vue.withCtx(() => [
@@ -1822,11 +1898,11 @@
1822
1898
  const { config, model, prop } = props;
1823
1899
  tab.name = tab.paneName;
1824
1900
  if (typeof config.onTabClick === "function") {
1825
- config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
1901
+ config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop, config });
1826
1902
  }
1827
1903
  const tabConfig = config.items.find((item) => tab.name === item.status);
1828
1904
  if (tabConfig && typeof tabConfig.onTabClick === "function") {
1829
- tabConfig.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
1905
+ tabConfig.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop, config });
1830
1906
  }
1831
1907
  };
1832
1908
  const Tab = vue.defineComponent({
@@ -1881,7 +1957,11 @@
1881
1957
  if (!props.config.name)
1882
1958
  throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1883
1959
  if (typeof props.config.onTabAdd === "function") {
1884
- props.config.onTabAdd(mForm, { model: props.model });
1960
+ props.config.onTabAdd(mForm, {
1961
+ model: props.model,
1962
+ prop: props.prop,
1963
+ config: props.config
1964
+ });
1885
1965
  } else if (tabs.value.length > 0) {
1886
1966
  const newObj = lodashEs.cloneDeep(tabs.value[0]);
1887
1967
  newObj.title = `\u6807\u7B7E${tabs.value.length + 1}`;
@@ -1894,7 +1974,11 @@
1894
1974
  if (!props.config.name)
1895
1975
  throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1896
1976
  if (typeof props.config.onTabRemove === "function") {
1897
- props.config.onTabRemove(mForm, tabName, { model: props.model });
1977
+ props.config.onTabRemove(mForm, tabName, {
1978
+ model: props.model,
1979
+ prop: props.prop,
1980
+ config: props.config
1981
+ });
1898
1982
  } else {
1899
1983
  props.model[props.config.name].splice(+tabName, 1);
1900
1984
  if (tabName < activeTabName.value || activeTabName.value >= props.model[props.config.name].length) {
@@ -1909,7 +1993,7 @@
1909
1993
  changeHandler: () => {
1910
1994
  emit("change", props.model);
1911
1995
  if (typeof props.config.onChange === "function") {
1912
- props.config.onChange(mForm, { model: props.model });
1996
+ props.config.onChange(mForm, { model: props.model, prop: props.prop, config: props.config });
1913
1997
  }
1914
1998
  }
1915
1999
  };
@@ -2098,13 +2182,13 @@
2098
2182
  };
2099
2183
  }
2100
2184
  });
2101
- const _hoisted_1$a = {
2185
+ const _hoisted_1$9 = {
2102
2186
  class: "m-cascader",
2103
2187
  style: { "width": "100%" }
2104
2188
  };
2105
2189
  function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2106
2190
  const _component_el_cascader = vue.resolveComponent("el-cascader");
2107
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2191
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
2108
2192
  vue.createVNode(_component_el_cascader, {
2109
2193
  modelValue: _ctx.model[_ctx.name],
2110
2194
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
@@ -2144,7 +2228,7 @@
2144
2228
  } else {
2145
2229
  return props.config.activeValue;
2146
2230
  }
2147
- return "true";
2231
+ return void 0;
2148
2232
  }),
2149
2233
  inactiveValue: vue.computed(() => {
2150
2234
  if (typeof props.config.inactiveValue === "undefined") {
@@ -2154,7 +2238,7 @@
2154
2238
  } else {
2155
2239
  return props.config.inactiveValue;
2156
2240
  }
2157
- return "false";
2241
+ return void 0;
2158
2242
  }),
2159
2243
  changeHandler(value) {
2160
2244
  emit("change", value);
@@ -2227,7 +2311,7 @@
2227
2311
  }
2228
2312
  var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$e]]);
2229
2313
 
2230
- const _hoisted_1$9 = { key: 0 };
2314
+ const _hoisted_1$8 = { key: 0 };
2231
2315
  const __default__$2 = vue.defineComponent({
2232
2316
  name: "m-fields-color-picker"
2233
2317
  });
@@ -2247,7 +2331,7 @@
2247
2331
  const changeHandler = (value) => emit("change", value);
2248
2332
  return (_ctx, _cache) => {
2249
2333
  const _component_el_color_picker = vue.resolveComponent("el-color-picker");
2250
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
2334
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
2251
2335
  vue.createVNode(_component_el_color_picker, {
2252
2336
  modelValue: _ctx.model[_ctx.name],
2253
2337
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
@@ -2283,10 +2367,10 @@
2283
2367
  };
2284
2368
  }
2285
2369
  });
2286
- const _hoisted_1$8 = { key: 0 };
2370
+ const _hoisted_1$7 = { key: 0 };
2287
2371
  function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2288
2372
  const _component_el_date_picker = vue.resolveComponent("el-date-picker");
2289
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
2373
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
2290
2374
  vue.createVNode(_component_el_date_picker, {
2291
2375
  modelValue: _ctx.model[_ctx.modelName],
2292
2376
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.modelName] = $event),
@@ -2332,6 +2416,14 @@
2332
2416
  });
2333
2417
  } else if (props.model && props.name && v instanceof Date) {
2334
2418
  props.model[props.name] = utils.datetimeFormatter(v.toString(), "");
2419
+ } else if (names?.length) {
2420
+ names.forEach((item) => {
2421
+ if (props.model) {
2422
+ props.model[item] = void 0;
2423
+ }
2424
+ });
2425
+ } else if (props.name) {
2426
+ props.model[props.name] = void 0;
2335
2427
  }
2336
2428
  };
2337
2429
  return {
@@ -2390,10 +2482,10 @@
2390
2482
  };
2391
2483
  }
2392
2484
  });
2393
- const _hoisted_1$7 = { key: 0 };
2485
+ const _hoisted_1$6 = { key: 0 };
2394
2486
  function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2395
2487
  const _component_el_date_picker = vue.resolveComponent("el-date-picker");
2396
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
2488
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
2397
2489
  vue.createVNode(_component_el_date_picker, {
2398
2490
  modelValue: _ctx.model[_ctx.name],
2399
2491
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
@@ -2410,7 +2502,7 @@
2410
2502
  }
2411
2503
  var DateTime = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$b]]);
2412
2504
 
2413
- const _hoisted_1$6 = { key: 0 };
2505
+ const _hoisted_1$5 = { key: 0 };
2414
2506
  const __default__$1 = vue.defineComponent({
2415
2507
  name: "m-fields-display"
2416
2508
  });
@@ -2431,7 +2523,7 @@
2431
2523
  }
2432
2524
  useAddField(props.prop);
2433
2525
  return (_ctx, _cache) => {
2434
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$6, vue.toDisplayString(_ctx.model[vue.unref(n)]), 1)) : vue.createCommentVNode("", true);
2526
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$5, vue.toDisplayString(_ctx.model[vue.unref(n)]), 1)) : vue.createCommentVNode("", true);
2435
2527
  };
2436
2528
  }
2437
2529
  });
@@ -2501,12 +2593,12 @@
2501
2593
  }
2502
2594
  }
2503
2595
  });
2504
- const _hoisted_1$5 = { class: "m-fields-dynamic-field" };
2596
+ const _hoisted_1$4 = { class: "m-fields-dynamic-field" };
2505
2597
  function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
2506
2598
  const _component_el_input = vue.resolveComponent("el-input");
2507
2599
  const _component_el_form_item = vue.resolveComponent("el-form-item");
2508
2600
  const _component_el_form = vue.resolveComponent("el-form");
2509
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
2601
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
2510
2602
  vue.createVNode(_component_el_form, { size: "small" }, {
2511
2603
  default: vue.withCtx(() => [
2512
2604
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Object.keys(_ctx.fieldMap.value), (key) => {
@@ -2628,7 +2720,7 @@
2628
2720
  };
2629
2721
  }
2630
2722
  });
2631
- const _hoisted_1$4 = ["href"];
2723
+ const _hoisted_1$3 = ["href"];
2632
2724
  const _hoisted_2$1 = {
2633
2725
  key: 2,
2634
2726
  class: "m-fields-link"
@@ -2642,12 +2734,13 @@
2642
2734
  target: "_blank",
2643
2735
  href: _ctx.href,
2644
2736
  style: vue.normalizeStyle(_ctx.config.css || {})
2645
- }, vue.toDisplayString(_ctx.displayText), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
2737
+ }, vue.toDisplayString(_ctx.displayText), 13, _hoisted_1$3)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
2646
2738
  key: 1,
2647
2739
  style: vue.normalizeStyle(_ctx.config.disabledCss || {})
2648
2740
  }, vue.toDisplayString(_ctx.displayText), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
2649
2741
  vue.createVNode(_component_el_button, {
2650
- type: "text",
2742
+ text: "",
2743
+ type: "primary",
2651
2744
  onClick: _ctx.editHandler
2652
2745
  }, {
2653
2746
  default: vue.withCtx(() => [
@@ -2827,7 +2920,8 @@
2827
2920
  body = body(mForm, {
2828
2921
  model: props.model,
2829
2922
  formValue: mForm?.values,
2830
- formValues: mForm?.values
2923
+ formValues: mForm?.values,
2924
+ config: props.config
2831
2925
  });
2832
2926
  }
2833
2927
  body.query = query.value;
@@ -2850,7 +2944,8 @@
2850
2944
  res = option.afterRequest(mForm, res, {
2851
2945
  model: props.model,
2852
2946
  formValue: mForm?.values,
2853
- formValues: mForm?.values
2947
+ formValues: mForm?.values,
2948
+ config: props.config
2854
2949
  });
2855
2950
  }
2856
2951
  const optionsData = res[option.root];
@@ -2940,8 +3035,10 @@
2940
3035
  vue.watch(() => mForm?.values, () => {
2941
3036
  typeof props.config.options === "function" && Promise.resolve(props.config.options(mForm, {
2942
3037
  model: props.model,
3038
+ prop: props.prop,
2943
3039
  formValues: mForm?.values,
2944
- formValue: mForm?.values
3040
+ formValue: mForm?.values,
3041
+ config: props.config
2945
3042
  })).then((data) => {
2946
3043
  options.value = data;
2947
3044
  });
@@ -2989,11 +3086,11 @@
2989
3086
  remote,
2990
3087
  options,
2991
3088
  moreLoadingVisible,
3089
+ popperClass: mForm?.popperClass,
3090
+ getOptions,
2992
3091
  getRequestFuc() {
2993
3092
  return getConfig("request");
2994
3093
  },
2995
- async getInitOption() {
2996
- },
2997
3094
  changeHandler(value) {
2998
3095
  emit("change", value);
2999
3096
  },
@@ -3010,10 +3107,6 @@
3010
3107
  options.value = await getOptions();
3011
3108
  }
3012
3109
  },
3013
- async editAfterAction() {
3014
- pgIndex.value = 0;
3015
- options.value = await getOptions();
3016
- },
3017
3110
  async remoteMethod(q) {
3018
3111
  if (!localOptions.value.length) {
3019
3112
  query.value = q;
@@ -3028,7 +3121,7 @@
3028
3121
  };
3029
3122
  }
3030
3123
  });
3031
- const _hoisted_1$3 = { key: 2 };
3124
+ const _hoisted_1$2 = { key: 2 };
3032
3125
  function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3033
3126
  const _component_el_option = vue.resolveComponent("el-option");
3034
3127
  const _component_el_option_group = vue.resolveComponent("el-option-group");
@@ -3042,6 +3135,7 @@
3042
3135
  ref: "select",
3043
3136
  clearable: "",
3044
3137
  filterable: "",
3138
+ "popper-class": `m-select-popper ${_ctx.popperClass}`,
3045
3139
  size: _ctx.size,
3046
3140
  remote: _ctx.remote,
3047
3141
  placeholder: _ctx.config.placeholder,
@@ -3049,21 +3143,21 @@
3049
3143
  "value-key": _ctx.config.valueKey || "value",
3050
3144
  "allow-create": _ctx.config.allowCreate,
3051
3145
  disabled: _ctx.disabled,
3052
- "remote-method": _ctx.remoteMethod,
3146
+ "remote-method": _ctx.config.remote && _ctx.remoteMethod,
3053
3147
  onChange: _ctx.changeHandler,
3054
3148
  onVisibleChange: _ctx.visibleHandler
3055
3149
  }, {
3056
3150
  default: vue.withCtx(() => [
3057
3151
  _ctx.config.group ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.options, (group, index) => {
3058
3152
  return vue.openBlock(), vue.createBlock(_component_el_option_group, {
3059
- key: group.label + index,
3153
+ key: index,
3060
3154
  label: group.label,
3061
3155
  disabled: group.disabled
3062
3156
  }, {
3063
3157
  default: vue.withCtx(() => [
3064
3158
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.options, (item, index2) => {
3065
3159
  return vue.openBlock(), vue.createBlock(_component_el_option, {
3066
- key: item.label + index2,
3160
+ key: index2,
3067
3161
  label: item.label,
3068
3162
  value: item.value,
3069
3163
  disabled: item.disabled
@@ -3080,12 +3174,12 @@
3080
3174
  disabled: option.disabled
3081
3175
  }, null, 8, ["label", "value", "disabled"]);
3082
3176
  }), 128)),
3083
- _ctx.moreLoadingVisible ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, null, 512)), [
3177
+ _ctx.moreLoadingVisible ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, null, 512)), [
3084
3178
  [_directive_loading, true]
3085
3179
  ]) : vue.createCommentVNode("", true)
3086
3180
  ]),
3087
3181
  _: 1
3088
- }, 8, ["modelValue", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method", "onChange", "onVisibleChange"])), [
3182
+ }, 8, ["modelValue", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method", "onChange", "onVisibleChange"])), [
3089
3183
  [_directive_loading, _ctx.loading]
3090
3184
  ]) : vue.createCommentVNode("", true);
3091
3185
  }
@@ -3157,6 +3251,7 @@
3157
3251
  },
3158
3252
  emits: ["change", "input"],
3159
3253
  setup(props, { emit }) {
3254
+ const mForm = vue.inject("mForm");
3160
3255
  useAddField(props.prop);
3161
3256
  const modelName = vue.computed(() => props.name || props.config.name || "");
3162
3257
  return {
@@ -3165,12 +3260,10 @@
3165
3260
  emit("change", v);
3166
3261
  },
3167
3262
  inputHandler(v) {
3168
- const mForm = vue.inject("mForm");
3169
3263
  emit("input", v);
3170
3264
  mForm?.$emit("field-input", props.prop, v);
3171
3265
  },
3172
3266
  buttonClickHandler() {
3173
- const mForm = vue.inject("mForm");
3174
3267
  if (typeof props.config.append === "string")
3175
3268
  return;
3176
3269
  if (props.config.append?.handler) {
@@ -3234,7 +3327,7 @@
3234
3327
  };
3235
3328
  }
3236
3329
  });
3237
- const _hoisted_1$2 = { key: 0 };
3330
+ const _hoisted_1$1 = { key: 0 };
3238
3331
  function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3239
3332
  const _component_el_button = vue.resolveComponent("el-button");
3240
3333
  const _component_el_input = vue.resolveComponent("el-input");
@@ -3252,17 +3345,18 @@
3252
3345
  _ctx.config.append ? {
3253
3346
  name: "append",
3254
3347
  fn: vue.withCtx(() => [
3255
- typeof _ctx.config.append === "string" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$2, vue.toDisplayString(_ctx.config.append), 1)) : vue.createCommentVNode("", true),
3348
+ typeof _ctx.config.append === "string" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$1, vue.toDisplayString(_ctx.config.append), 1)) : vue.createCommentVNode("", true),
3256
3349
  typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3257
3350
  key: 1,
3258
3351
  style: { "color": "#409eff" },
3259
- onClick: _ctx.buttonClickHandler
3352
+ size: _ctx.size,
3353
+ onClick: vue.withModifiers(_ctx.buttonClickHandler, ["prevent"])
3260
3354
  }, {
3261
3355
  default: vue.withCtx(() => [
3262
3356
  vue.createTextVNode(vue.toDisplayString(_ctx.config.append.text), 1)
3263
3357
  ]),
3264
3358
  _: 1
3265
- }, 8, ["onClick"])) : vue.createCommentVNode("", true)
3359
+ }, 8, ["size", "onClick"])) : vue.createCommentVNode("", true)
3266
3360
  ])
3267
3361
  } : void 0
3268
3362
  ]), 1032, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"]);
@@ -3301,22 +3395,19 @@
3301
3395
  };
3302
3396
  }
3303
3397
  });
3304
- const _hoisted_1$1 = { key: 0 };
3305
3398
  function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3306
3399
  const _component_el_input = vue.resolveComponent("el-input");
3307
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
3308
- vue.createVNode(_component_el_input, {
3309
- modelValue: _ctx.model[_ctx.name],
3310
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3311
- type: "textarea",
3312
- size: _ctx.size,
3313
- clearable: "",
3314
- placeholder: _ctx.config.placeholder,
3315
- disabled: _ctx.disabled,
3316
- onChange: _ctx.changeHandler,
3317
- onInput: _ctx.inputHandler
3318
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"])
3319
- ])) : vue.createCommentVNode("", true);
3400
+ return vue.openBlock(), vue.createBlock(_component_el_input, {
3401
+ modelValue: _ctx.model[_ctx.name],
3402
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3403
+ type: "textarea",
3404
+ size: _ctx.size,
3405
+ clearable: "",
3406
+ placeholder: _ctx.config.placeholder,
3407
+ disabled: _ctx.disabled,
3408
+ onChange: _ctx.changeHandler,
3409
+ onInput: _ctx.inputHandler
3410
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"]);
3320
3411
  }
3321
3412
  var Textarea = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
3322
3413
 
@@ -3406,6 +3497,9 @@
3406
3497
  keyProp: {
3407
3498
  type: String,
3408
3499
  default: "__key"
3500
+ },
3501
+ popperClass: {
3502
+ type: String
3409
3503
  }
3410
3504
  },
3411
3505
  emits: ["change", "field-input", "field-change"],
@@ -3417,6 +3511,7 @@
3417
3511
  const requestFuc = getConfig("request");
3418
3512
  const formState = vue.reactive({
3419
3513
  keyProp: props.keyProp,
3514
+ popperClass: props.popperClass,
3420
3515
  config: props.config,
3421
3516
  initValues: props.initValues,
3422
3517
  parentValues: props.parentValues,
@@ -3460,7 +3555,7 @@
3460
3555
  submitForm: async (native) => {
3461
3556
  try {
3462
3557
  await elForm.value?.validate();
3463
- return native ? values.value : lodashEs.cloneDeep(values.value);
3558
+ return native ? values.value : lodashEs.cloneDeep(vue.toRaw(values.value));
3464
3559
  } catch (invalidFields) {
3465
3560
  const error = [];
3466
3561
  Object.entries(invalidFields).forEach(([, ValidateError]) => {
@@ -3712,7 +3807,7 @@
3712
3807
  }
3713
3808
  var FormDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
3714
3809
 
3715
- var index$1 = '';
3810
+ var index$1 = /* #__PURE__ */ (() => ".m-form-dialog .el-dialog__body {\n padding: 0 !important;\n}\n.m-form-dialog .m-dialog-body {\n padding: 0 20px;\n}\n.m-form-dialog .el-table .m-form-item .el-form-item {\n margin-bottom: 0;\n}\n\n.fade-enter-active,\n.fade-leave-active {\n transition: opacity 0.5s;\n}\n\n.fade-enter, .fade-leave-to {\n opacity: 0;\n}\n\n.m-form .m-form-tip {\n color: rgba(0, 0, 0, 0.45);\n font-size: 12px;\n transition: color 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);\n}\n.m-form .m-form-schematic {\n max-width: 50%;\n height: 100%;\n}\n.m-form .el-table .cell > div.m-form-container {\n display: block;\n}\n.m-form .el-tabs {\n margin-bottom: 10px;\n}\n.m-form .el-form-item.hidden .el-form-item__label {\n display: none;\n}\n\n.magic-datetime-picker-popper .el-picker-panel__footer button:first-child {\n display: none;\n}\n\ndiv.m-fields-link {\n width: fit-content;\n}\n\nfieldset.m-fieldset {\n position: relative;\n border: 1px solid rgb(229, 229, 229);\n margin-top: 10px;\n margin-bottom: 10px;\n min-inline-size: auto;\n}\nfieldset.m-fieldset legend {\n font-size: 14px;\n position: absolute;\n border: 0;\n top: -10px;\n left: 20px;\n background: rgb(255, 255, 255);\n width: auto;\n padding: 0px 3px;\n font-weight: bold;\n line-height: 20px;\n}\nfieldset.m-fieldset .m-form-tip {\n margin-left: 5px;\n}\n\n.m-fields-group-list .el-button--text {\n padding: 0;\n margin-bottom: 7px;\n}\n.m-fields-group-list .el-tree-node__expand-icon {\n padding: 0;\n margin-bottom: 7px;\n}\n.m-fields-group-list .el-tree-node__expand-icon.expand {\n transform: rotate(90deg);\n}\n.m-fields-group-list .m-fields-group-list-item {\n border-bottom: 1px solid #ebeef5;\n margin-bottom: 7px;\n}\n.m-fields-group-list .m-fields-group-list-item:last-of-type {\n border-bottom: 0;\n}\n\n.m-form-panel .el-card__header:hover {\n background: #f2f6fc;\n}\n.m-form-panel .el-card__header a {\n color: #409eff;\n}\n.m-form-panel .el-card__body {\n padding: 10px;\n}\n.m-form-panel .m-form-tip {\n margin-left: 5px;\n}\n\n.m-fields-table {\n width: 100%;\n}\n.m-fields-table.fixed {\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 100;\n}\n.m-fields-table.fixed::before {\n content: \" \";\n display: block;\n background: rgba(0, 0, 0, 0.5);\n position: fixed;\n top: 0;\n right: 0;\n left: 0;\n bottom: 0;\n z-index: 100;\n}\n.m-fields-table.fixed > .el-form-item__content {\n z-index: 101;\n position: relative;\n margin: 10vh auto;\n max-width: fit-content;\n}\n.m-fields-table.fixed table {\n width: 95vw !important;\n}\n.m-fields-table th {\n background-color: #f2f2f2 !important;\n color: #333 !important;\n}\n.m-fields-table .el-table th {\n padding: 0 !important;\n}\n.m-fields-table .el-table__column--dropable {\n cursor: move;\n}\n.m-fields-table .el-form-item__content .el-input-group {\n vertical-align: middle;\n}\n.m-fields-table.m-fields-table-item-extra tr.expanded td {\n border-bottom: 0;\n}\n.m-fields-table .el-table__expanded-cell .m-form-tip {\n margin-left: 80px;\n}\n.m-fields-table .el-form-item {\n margin-bottom: 0;\n}\n\n.m-select {\n width: 100%;\n}")();
3716
3811
 
3717
3812
  const defaultInstallOpt = {};
3718
3813
  const install = (app, opt) => {
@@ -3787,8 +3882,7 @@
3787
3882
  exports.initValue = initValue;
3788
3883
  exports.useAddField = useAddField;
3789
3884
 
3790
- Object.defineProperty(exports, '__esModule', { value: true });
3791
- exports[Symbol.toStringTag] = 'Module';
3885
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
3792
3886
 
3793
3887
  }));
3794
3888
  //# sourceMappingURL=tmagic-form.umd.js.map