@tmagic/form 1.0.0-beta.1

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 (94) hide show
  1. package/dist/style.css +161 -0
  2. package/dist/tmagic-form.es.js +3749 -0
  3. package/dist/tmagic-form.es.js.map +1 -0
  4. package/dist/tmagic-form.umd.js +3790 -0
  5. package/dist/tmagic-form.umd.js.map +1 -0
  6. package/dist/types/src/Form.vue.d.ts +304 -0
  7. package/dist/types/src/FormDialog.vue.d.ts +641 -0
  8. package/dist/types/src/containers/Container.vue.d.ts +69 -0
  9. package/dist/types/src/containers/Fieldset.vue.d.ts +56 -0
  10. package/dist/types/src/containers/GroupList.vue.d.ts +56 -0
  11. package/dist/types/src/containers/GroupListItem.vue.d.ts +72 -0
  12. package/dist/types/src/containers/Panel.vue.d.ts +41 -0
  13. package/dist/types/src/containers/Row.vue.d.ts +42 -0
  14. package/dist/types/src/containers/Step.vue.d.ts +45 -0
  15. package/dist/types/src/containers/Table.vue.d.ts +1401 -0
  16. package/dist/types/src/containers/Tabs.vue.d.ts +45 -0
  17. package/dist/types/src/fields/Cascader.vue.d.ts +1748 -0
  18. package/dist/types/src/fields/Checkbox.vue.d.ts +59 -0
  19. package/dist/types/src/fields/CheckboxGroup.vue.d.ts +56 -0
  20. package/dist/types/src/fields/Date.vue.d.ts +58 -0
  21. package/dist/types/src/fields/DateTime.vue.d.ts +57 -0
  22. package/dist/types/src/fields/Daterange.vue.d.ts +57 -0
  23. package/dist/types/src/fields/Display.vue.d.ts +3 -0
  24. package/dist/types/src/fields/DynamicField.vue.d.ts +76 -0
  25. package/dist/types/src/fields/Hidden.vue.d.ts +3 -0
  26. package/dist/types/src/fields/Link.vue.d.ts +1365 -0
  27. package/dist/types/src/fields/Number.vue.d.ts +59 -0
  28. package/dist/types/src/fields/RadioGroup.vue.d.ts +55 -0
  29. package/dist/types/src/fields/Select.vue.d.ts +975 -0
  30. package/dist/types/src/fields/Switch.vue.d.ts +59 -0
  31. package/dist/types/src/fields/Text.vue.d.ts +61 -0
  32. package/dist/types/src/fields/Textarea.vue.d.ts +56 -0
  33. package/dist/types/src/fields/Time.vue.d.ts +54 -0
  34. package/dist/types/src/index.d.ts +36 -0
  35. package/dist/types/src/schema.d.ts +495 -0
  36. package/dist/types/src/shims-vue.d.ts +6 -0
  37. package/dist/types/src/utils/config.d.ts +3 -0
  38. package/dist/types/src/utils/fieldProps.d.ts +21 -0
  39. package/dist/types/src/utils/form.d.ts +8 -0
  40. package/dist/types/src/utils/useAddField.d.ts +1 -0
  41. package/dist/types/src/vite-env.d.ts +1 -0
  42. package/package.json +51 -0
  43. package/src/Form.vue +188 -0
  44. package/src/FormDialog.vue +163 -0
  45. package/src/containers/Container.vue +263 -0
  46. package/src/containers/Fieldset.vue +138 -0
  47. package/src/containers/GroupList.vue +152 -0
  48. package/src/containers/GroupListItem.vue +159 -0
  49. package/src/containers/Panel.vue +106 -0
  50. package/src/containers/Row.vue +68 -0
  51. package/src/containers/Step.vue +82 -0
  52. package/src/containers/Table.vue +624 -0
  53. package/src/containers/Tabs.vue +176 -0
  54. package/src/fields/Cascader.vue +147 -0
  55. package/src/fields/Checkbox.vue +67 -0
  56. package/src/fields/CheckboxGroup.vue +44 -0
  57. package/src/fields/ColorPicker.vue +38 -0
  58. package/src/fields/Date.vue +51 -0
  59. package/src/fields/DateTime.vue +59 -0
  60. package/src/fields/Daterange.vue +75 -0
  61. package/src/fields/Display.vue +34 -0
  62. package/src/fields/DynamicField.vue +109 -0
  63. package/src/fields/Hidden.vue +29 -0
  64. package/src/fields/Link.vue +112 -0
  65. package/src/fields/Number.vue +53 -0
  66. package/src/fields/RadioGroup.vue +33 -0
  67. package/src/fields/Select.vue +393 -0
  68. package/src/fields/Switch.vue +65 -0
  69. package/src/fields/Text.vue +134 -0
  70. package/src/fields/Textarea.vue +62 -0
  71. package/src/fields/Time.vue +48 -0
  72. package/src/index.ts +127 -0
  73. package/src/schema.ts +638 -0
  74. package/src/shims-vue.d.ts +6 -0
  75. package/src/theme/date-time.scss +7 -0
  76. package/src/theme/fieldset.scss +24 -0
  77. package/src/theme/form-dialog.scss +13 -0
  78. package/src/theme/form.scss +30 -0
  79. package/src/theme/group-list.scss +23 -0
  80. package/src/theme/index.scss +9 -0
  81. package/src/theme/link.scss +3 -0
  82. package/src/theme/panel.scss +18 -0
  83. package/src/theme/select.scss +3 -0
  84. package/src/theme/table.scss +69 -0
  85. package/src/theme/tabs.scss +25 -0
  86. package/src/utils/config.ts +27 -0
  87. package/src/utils/containerProps.ts +50 -0
  88. package/src/utils/createForm.ts +25 -0
  89. package/src/utils/fieldProps.ts +39 -0
  90. package/src/utils/form.ts +266 -0
  91. package/src/utils/useAddField.ts +40 -0
  92. package/src/vite-env.d.ts +1 -0
  93. package/tsconfig.json +9 -0
  94. package/vite.config.ts +27 -0
@@ -0,0 +1,3790 @@
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';
6
+
7
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var Sortable__default = /*#__PURE__*/_interopDefaultLegacy(Sortable);
10
+
11
+ const isTableSelect = (type) => typeof type === "string" && ["table-select", "tableSelect"].includes(type);
12
+ const asyncLoadConfig = (value, initValue2, { asyncLoad, name, type }) => {
13
+ if (type === "html" && typeof asyncLoad === "object" && typeof name !== "undefined") {
14
+ asyncLoad.name = name;
15
+ value.asyncLoad = typeof initValue2.asyncLoad === "object" ? initValue2.asyncLoad : asyncLoad;
16
+ }
17
+ };
18
+ const isMultipleValue = (type) => typeof type === "string" && [
19
+ "checkbox-group",
20
+ "checkboxGroup",
21
+ "table",
22
+ "cascader",
23
+ "group-list",
24
+ "groupList",
25
+ "dynamic-tab",
26
+ "dynamicTab"
27
+ ].includes(type);
28
+ const initItemsValue = (mForm, value, initValue2, { items, name, extensible }) => {
29
+ if (Array.isArray(initValue2[name])) {
30
+ value[name] = initValue2[name].map((v) => init(mForm, items, v));
31
+ } else {
32
+ value[name] = init(mForm, items, initValue2[name], value[name]);
33
+ if (extensible) {
34
+ value[name] = Object.assign({}, initValue2[name], value[name]);
35
+ }
36
+ }
37
+ };
38
+ const setValue = (mForm, value, initValue2, item) => {
39
+ const { items, name, type, checkbox } = item;
40
+ if (isMultipleValue(type)) {
41
+ value[name] = initValue2[name] || [];
42
+ }
43
+ if (items) {
44
+ initItemsValue(mForm, value, initValue2, item);
45
+ } else {
46
+ value[name] = getDefaultValue(mForm, item);
47
+ }
48
+ if (type === "fieldset" && checkbox) {
49
+ if (typeof value[name] === "object") {
50
+ value[name].value = typeof initValue2[name] === "object" ? initValue2[name].value || 0 : 0;
51
+ }
52
+ }
53
+ };
54
+ const initValueItem = function(mForm, item, initValue2, value) {
55
+ const { items } = item;
56
+ const { names } = item;
57
+ const { type, name } = item;
58
+ if (isTableSelect(type) && name) {
59
+ value[name] = initValue2[name] || "";
60
+ return value;
61
+ }
62
+ asyncLoadConfig(value, initValue2, item);
63
+ if (name && !items && typeof initValue2[name] !== "undefined") {
64
+ if (typeof value[name] === "undefined") {
65
+ value[name] = typeof initValue2[name] === "object" ? lodashEs.cloneDeep(initValue2[name]) : initValue2[name];
66
+ }
67
+ return value;
68
+ }
69
+ if (names) {
70
+ return names.forEach((n) => value[n] = initValue2[n] || "");
71
+ }
72
+ if (!name) {
73
+ return init(mForm, items, initValue2, value);
74
+ }
75
+ setValue(mForm, value, initValue2, item);
76
+ return value;
77
+ };
78
+ const init = function(mForm, config = [], initValue2 = {}, value = {}) {
79
+ if (Array.isArray(config)) {
80
+ config.forEach((item) => {
81
+ initValueItem(mForm, item, initValue2, value);
82
+ });
83
+ }
84
+ return value;
85
+ };
86
+ const getDefaultValue = function(mForm, { defaultValue, type, filter, multiple }) {
87
+ if (typeof defaultValue === "function") {
88
+ return defaultValue(mForm);
89
+ }
90
+ if (defaultValue === "undefined") {
91
+ return void 0;
92
+ }
93
+ if (typeof defaultValue !== "undefined") {
94
+ return defaultValue;
95
+ }
96
+ if (type === "number" || filter === "number") {
97
+ return 0;
98
+ }
99
+ if (["switch", "checkbox"].includes(type)) {
100
+ return false;
101
+ }
102
+ if (multiple) {
103
+ return [];
104
+ }
105
+ return "";
106
+ };
107
+ const filterFunction = (mForm, config, props) => {
108
+ if (typeof config !== "function") {
109
+ return config;
110
+ }
111
+ return config(mForm, {
112
+ values: mForm?.initValues || {},
113
+ model: props.model,
114
+ parent: mForm?.parentValues || {},
115
+ formValue: mForm?.values || props.model,
116
+ prop: props.prop
117
+ });
118
+ };
119
+ const display = function(mForm, config, props) {
120
+ if (typeof config === "function") {
121
+ return filterFunction(mForm, config, props);
122
+ }
123
+ if (config === false) {
124
+ return false;
125
+ }
126
+ return true;
127
+ };
128
+ const getRules = function(mForm, rules = [], props) {
129
+ rules = lodashEs.cloneDeep(rules);
130
+ if (typeof rules === "object" && !Array.isArray(rules)) {
131
+ rules = [rules];
132
+ }
133
+ return rules.map((item) => {
134
+ if (typeof item.validator === "function") {
135
+ const fnc = item.validator;
136
+ item.validator = (rule, value, callback, source, options) => fnc({
137
+ rule,
138
+ value,
139
+ callback,
140
+ source,
141
+ options
142
+ }, {
143
+ values: mForm?.initValues || {},
144
+ model: props.model,
145
+ parent: mForm?.parentValues || {},
146
+ formValue: mForm?.values || props.model,
147
+ prop: props.prop
148
+ }, mForm);
149
+ }
150
+ return item;
151
+ });
152
+ };
153
+ const initValue = async (mForm, { initValues, config }) => {
154
+ if (!Array.isArray(config))
155
+ throw new Error("config\u5E94\u8BE5\u4E3A\u6570\u7EC4");
156
+ let valuesTmp = init(mForm, config, vue.toRaw(initValues), {});
157
+ const [firstForm] = config;
158
+ if (firstForm && typeof firstForm.onInitValue === "function") {
159
+ valuesTmp = await firstForm.onInitValue(mForm, {
160
+ formValue: valuesTmp,
161
+ initValue: initValues
162
+ });
163
+ }
164
+ return valuesTmp || {};
165
+ };
166
+
167
+ var _export_sfc = (sfc, props) => {
168
+ const target = sfc.__vccOpts || sfc;
169
+ for (const [key, val] of props) {
170
+ target[key] = val;
171
+ }
172
+ return target;
173
+ };
174
+
175
+ const _sfc_main$s = vue.defineComponent({
176
+ name: "m-form-container",
177
+ props: {
178
+ labelWidth: String,
179
+ expandMore: Boolean,
180
+ model: {
181
+ type: [Object, Array],
182
+ required: true
183
+ },
184
+ config: {
185
+ type: Object,
186
+ required: true
187
+ },
188
+ prop: {
189
+ type: String,
190
+ default: () => ""
191
+ },
192
+ stepActive: {
193
+ type: [String, Number]
194
+ },
195
+ size: {
196
+ type: String,
197
+ default: "small"
198
+ }
199
+ },
200
+ emits: ["change"],
201
+ setup(props, { emit }) {
202
+ const mForm = vue.inject("mForm");
203
+ const expand = vue.ref(false);
204
+ const name = vue.computed(() => props.config.name || "");
205
+ const items = vue.computed(() => props.config.items);
206
+ const itemProp = vue.computed(() => name.value ? `${props.prop}${props.prop ? "." : ""}${name.value}` : props.prop);
207
+ const tagName = vue.computed(() => {
208
+ const component = vue.resolveComponent(`m-${items.value ? "form" : "fields"}-${type.value}`);
209
+ if (typeof component !== "string")
210
+ return component;
211
+ return "m-fields-text";
212
+ });
213
+ const disabled = vue.computed(() => filterFunction(mForm, props.config.disabled, props));
214
+ const tooltip = vue.computed(() => filterFunction(mForm, props.config.tooltip, props));
215
+ const extra = vue.computed(() => filterFunction(mForm, props.config.extra, props));
216
+ const rule = vue.computed(() => getRules(mForm, props.config.rules, props));
217
+ const type = vue.computed(() => {
218
+ let { type: type2 } = props.config;
219
+ if (typeof type2 === "function") {
220
+ type2 = type2(mForm, {
221
+ model: props.model
222
+ });
223
+ }
224
+ if (type2 === "form")
225
+ return "";
226
+ return type2?.replace(/([A-Z])/g, "-$1").toLowerCase() || (items.value ? "" : "text");
227
+ });
228
+ const display$1 = vue.computed(() => {
229
+ if (props.config.display === "expand") {
230
+ return expand.value;
231
+ }
232
+ return display(mForm, props.config.display, props);
233
+ });
234
+ vue.watchEffect(() => {
235
+ expand.value = props.expandMore;
236
+ });
237
+ const expandHandler = () => expand.value = !expand.value;
238
+ const key = (config) => config[mForm?.keyProps];
239
+ const filterHandler = (filter, value) => {
240
+ if (typeof filter === "function") {
241
+ return filter(mForm, value, {
242
+ model: props.model,
243
+ values: mForm?.initValues,
244
+ formValue: mForm?.values,
245
+ prop: itemProp.value
246
+ });
247
+ }
248
+ if (filter === "number") {
249
+ return +value;
250
+ }
251
+ return value;
252
+ };
253
+ const changeHandler = (onChange, value) => {
254
+ if (typeof onChange === "function") {
255
+ return onChange(mForm, value, {
256
+ model: props.model,
257
+ values: mForm?.initValues,
258
+ formValue: mForm?.values,
259
+ prop: itemProp.value
260
+ });
261
+ }
262
+ };
263
+ const trimHandler = (trim, value) => {
264
+ if (typeof value === "string" && trim) {
265
+ return value.replace(/^\s*/, "").replace(/\s*$/, "");
266
+ }
267
+ };
268
+ const onChangeHandler = async function(v, key2) {
269
+ 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;
273
+ if ((name2 || name2 === 0) && props.model !== value && (v !== value || props.model[name2] !== value)) {
274
+ props.model[name2] = value;
275
+ }
276
+ if (key2 !== void 0 && dynamicKey) {
277
+ props.model[key2] = value;
278
+ }
279
+ emit("change", props.model);
280
+ };
281
+ return {
282
+ expand,
283
+ name,
284
+ type,
285
+ disabled,
286
+ itemProp,
287
+ items,
288
+ display: display$1,
289
+ tagName,
290
+ rule,
291
+ tooltip,
292
+ extra,
293
+ key,
294
+ onChangeHandler,
295
+ expandHandler
296
+ };
297
+ }
298
+ });
299
+ const _hoisted_1$g = ["innerHTML"];
300
+ const _hoisted_2$7 = ["innerHTML"];
301
+ 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 = {
305
+ key: 4,
306
+ style: { "text-align": "center" }
307
+ };
308
+ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
309
+ const _component_m_fields_hidden = vue.resolveComponent("m-fields-hidden");
310
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
311
+ const _component_el_form_item = vue.resolveComponent("el-form-item");
312
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
313
+ const _component_el_button = vue.resolveComponent("el-button");
314
+ return _ctx.config ? (vue.openBlock(), vue.createElementBlock("div", {
315
+ key: 0,
316
+ style: vue.normalizeStyle(_ctx.config.tip ? "display: flex" : ""),
317
+ class: vue.normalizeClass([_ctx.config.className, "m-form-container"])
318
+ }, [
319
+ _ctx.type === "hidden" ? (vue.openBlock(), vue.createBlock(_component_m_fields_hidden, {
320
+ key: 0,
321
+ model: _ctx.model,
322
+ config: _ctx.config,
323
+ name: _ctx.config.name,
324
+ disabled: _ctx.disabled,
325
+ prop: _ctx.itemProp
326
+ }, null, 8, ["model", "config", "name", "disabled", "prop"])) : _ctx.items && !_ctx.config.text && _ctx.type && _ctx.display ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tagName), {
327
+ key: _ctx.key(_ctx.config),
328
+ size: _ctx.size,
329
+ model: _ctx.model,
330
+ config: _ctx.config,
331
+ name: _ctx.name,
332
+ prop: _ctx.itemProp,
333
+ "step-active": _ctx.stepActive,
334
+ "expand-more": _ctx.expand,
335
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
336
+ 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 }, [
338
+ vue.createVNode(_component_el_form_item, {
339
+ style: vue.normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
340
+ prop: _ctx.itemProp,
341
+ "label-width": _ctx.config.text ? _ctx.config.labelWidth || _ctx.labelWidth : "0",
342
+ rules: _ctx.rule
343
+ }, {
344
+ label: vue.withCtx(() => [
345
+ vue.createElementVNode("span", {
346
+ innerHTML: _ctx.type === "checkbox" ? "" : _ctx.config.text
347
+ }, null, 8, _hoisted_1$g)
348
+ ]),
349
+ default: vue.withCtx(() => [
350
+ _ctx.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, { key: 0 }, {
351
+ content: vue.withCtx(() => [
352
+ vue.createElementVNode("div", { innerHTML: _ctx.tooltip }, null, 8, _hoisted_2$7)
353
+ ]),
354
+ default: vue.withCtx(() => [
355
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tagName), {
356
+ key: _ctx.key(_ctx.config),
357
+ size: _ctx.size,
358
+ model: _ctx.model,
359
+ config: _ctx.config,
360
+ name: _ctx.name,
361
+ disabled: _ctx.disabled,
362
+ prop: _ctx.itemProp,
363
+ onChange: _ctx.onChangeHandler
364
+ }, null, 8, ["size", "model", "config", "name", "disabled", "prop", "onChange"]))
365
+ ]),
366
+ _: 1
367
+ })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tagName), {
368
+ key: _ctx.key(_ctx.config),
369
+ size: _ctx.size,
370
+ model: _ctx.model,
371
+ config: _ctx.config,
372
+ name: _ctx.name,
373
+ disabled: _ctx.disabled,
374
+ prop: _ctx.itemProp,
375
+ onChange: _ctx.onChangeHandler
376
+ }, null, 8, ["size", "model", "config", "name", "disabled", "prop", "onChange"])),
377
+ _ctx.extra ? (vue.openBlock(), vue.createElementBlock("div", {
378
+ key: 2,
379
+ innerHTML: _ctx.extra,
380
+ class: "m-form-tip"
381
+ }, null, 8, _hoisted_3$7)) : vue.createCommentVNode("", true)
382
+ ]),
383
+ _: 1
384
+ }, 8, ["style", "prop", "label-width", "rules"]),
385
+ _ctx.config.tip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
386
+ key: 0,
387
+ placement: "top",
388
+ style: { "line-height": "40px", "margin-left": "5px" }
389
+ }, {
390
+ content: vue.withCtx(() => [
391
+ vue.createElementVNode("div", {
392
+ innerHTML: _ctx.config.tip
393
+ }, null, 8, _hoisted_5$4)
394
+ ]),
395
+ default: vue.withCtx(() => [
396
+ _hoisted_4$6
397
+ ]),
398
+ _: 1
399
+ })) : vue.createCommentVNode("", true)
400
+ ], 64)) : _ctx.items && _ctx.display ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
401
+ (_ctx.name || _ctx.name === 0 ? _ctx.model[_ctx.name] : _ctx.model) ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.items, (item) => {
402
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
403
+ key: _ctx.key(item),
404
+ model: _ctx.name || _ctx.name === 0 ? _ctx.model[_ctx.name] : _ctx.model,
405
+ config: item,
406
+ size: _ctx.size,
407
+ "step-active": _ctx.stepActive,
408
+ "expand-more": _ctx.expand,
409
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
410
+ prop: _ctx.itemProp,
411
+ onChange: _ctx.onChangeHandler
412
+ }, null, 8, ["model", "config", "size", "step-active", "expand-more", "label-width", "prop", "onChange"]);
413
+ }), 128)) : vue.createCommentVNode("", true)
414
+ ], 64)) : vue.createCommentVNode("", true),
415
+ _ctx.config.expand && _ctx.type !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$3, [
416
+ vue.createVNode(_component_el_button, {
417
+ type: "text",
418
+ onClick: _ctx.expandHandler
419
+ }, {
420
+ default: vue.withCtx(() => [
421
+ vue.createTextVNode(vue.toDisplayString(_ctx.expand ? "\u6536\u8D77\u914D\u7F6E" : "\u5C55\u5F00\u66F4\u591A\u914D\u7F6E"), 1)
422
+ ]),
423
+ _: 1
424
+ }, 8, ["onClick"])
425
+ ])) : vue.createCommentVNode("", true)
426
+ ], 6)) : vue.createCommentVNode("", true);
427
+ }
428
+ var Container = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["render", _sfc_render$p]]);
429
+
430
+ const _sfc_main$r = vue.defineComponent({
431
+ name: "m-form-fieldset",
432
+ props: {
433
+ labelWidth: String,
434
+ model: {
435
+ type: Object,
436
+ default: () => ({})
437
+ },
438
+ config: {
439
+ type: Object,
440
+ default: () => ({})
441
+ },
442
+ rules: {
443
+ type: Object,
444
+ default: () => ({})
445
+ },
446
+ prop: {
447
+ type: String,
448
+ default: () => ""
449
+ },
450
+ size: String
451
+ },
452
+ emits: ["change"],
453
+ setup(props, { emit }) {
454
+ const mForm = vue.inject("mForm");
455
+ const name = vue.computed(() => props.config.name || "");
456
+ const show = vue.computed(() => {
457
+ if (props.config.expand && name.value) {
458
+ return props.model[name.value]?.value;
459
+ }
460
+ return true;
461
+ });
462
+ const lWidth = vue.computed(() => {
463
+ if (props.config.items) {
464
+ return props.config.labelWidth || props.labelWidth;
465
+ }
466
+ return props.config.labelWidth || props.labelWidth || (props.config.text ? null : "0");
467
+ });
468
+ const change = () => {
469
+ emit("change", props.model);
470
+ };
471
+ const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
472
+ return {
473
+ show,
474
+ name,
475
+ mForm,
476
+ lWidth,
477
+ key,
478
+ change
479
+ };
480
+ }
481
+ });
482
+ const _hoisted_1$f = ["innerHTML"];
483
+ const _hoisted_2$6 = ["innerHTML"];
484
+ const _hoisted_3$6 = { key: 1 };
485
+ const _hoisted_4$5 = ["innerHTML"];
486
+ const _hoisted_5$3 = ["innerHTML"];
487
+ const _hoisted_6$2 = { key: 2 };
488
+ const _hoisted_7$2 = ["innerHTML"];
489
+ const _hoisted_8$1 = ["innerHTML"];
490
+ const _hoisted_9$1 = {
491
+ key: 3,
492
+ style: { "display": "flex" }
493
+ };
494
+ const _hoisted_10$1 = { style: { "flex": "1" } };
495
+ const _hoisted_11 = ["src"];
496
+ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
497
+ const _component_el_checkbox = vue.resolveComponent("el-checkbox");
498
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
499
+ return (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model) ? (vue.openBlock(), vue.createElementBlock("fieldset", {
500
+ key: 0,
501
+ class: "m-fieldset",
502
+ style: vue.normalizeStyle(_ctx.show ? "padding: 15px 15px 0 5px;" : "border: 0")
503
+ }, [
504
+ !_ctx.show && _ctx.name ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
505
+ key: 0,
506
+ modelValue: _ctx.model[_ctx.name].value,
507
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name].value = $event),
508
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
509
+ "true-label": 1,
510
+ "false-label": 0,
511
+ onChange: _ctx.change
512
+ }, {
513
+ default: vue.withCtx(() => [
514
+ vue.createElementVNode("span", {
515
+ innerHTML: _ctx.config.legend
516
+ }, null, 8, _hoisted_1$f),
517
+ _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
518
+ key: 0,
519
+ innerHTML: _ctx.config.extra,
520
+ class: "m-form-tip"
521
+ }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("", true)
522
+ ]),
523
+ _: 1
524
+ }, 8, ["modelValue", "prop", "onChange"])) : _ctx.config.checkbox && _ctx.name ? (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$6, [
525
+ vue.createVNode(_component_el_checkbox, {
526
+ modelValue: _ctx.model[_ctx.name].value,
527
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name].value = $event),
528
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
529
+ "true-label": 1,
530
+ "false-label": 0,
531
+ onChange: _ctx.change
532
+ }, {
533
+ default: vue.withCtx(() => [
534
+ vue.createElementVNode("span", {
535
+ innerHTML: _ctx.config.legend
536
+ }, null, 8, _hoisted_4$5),
537
+ _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
538
+ key: 0,
539
+ innerHTML: _ctx.config.extra,
540
+ class: "m-form-tip"
541
+ }, null, 8, _hoisted_5$3)) : vue.createCommentVNode("", true)
542
+ ]),
543
+ _: 1
544
+ }, 8, ["modelValue", "prop", "onChange"])
545
+ ])) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_6$2, [
546
+ vue.createElementVNode("span", {
547
+ innerHTML: _ctx.config.legend
548
+ }, null, 8, _hoisted_7$2),
549
+ _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
550
+ key: 0,
551
+ innerHTML: _ctx.config.extra,
552
+ class: "m-form-tip"
553
+ }, null, 8, _hoisted_8$1)) : vue.createCommentVNode("", true)
554
+ ])),
555
+ _ctx.config.schematic && _ctx.show ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9$1, [
556
+ vue.createElementVNode("div", _hoisted_10$1, [
557
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (item, index) => {
558
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
559
+ key: _ctx.key(item, index),
560
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
561
+ rules: _ctx.name ? _ctx.rules[_ctx.name] : [],
562
+ config: item,
563
+ prop: _ctx.prop,
564
+ labelWidth: _ctx.lWidth,
565
+ size: _ctx.size,
566
+ onChange: _ctx.change
567
+ }, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size", "onChange"]);
568
+ }), 128))
569
+ ]),
570
+ vue.createElementVNode("img", {
571
+ class: "m-form-schematic",
572
+ src: _ctx.config.schematic
573
+ }, null, 8, _hoisted_11)
574
+ ])) : _ctx.show ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 4 }, vue.renderList(_ctx.config.items, (item, index) => {
575
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
576
+ key: _ctx.key(item, index),
577
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
578
+ rules: _ctx.name ? _ctx.rules[_ctx.name] : [],
579
+ config: item,
580
+ prop: _ctx.prop,
581
+ labelWidth: _ctx.lWidth,
582
+ size: _ctx.size,
583
+ onChange: _ctx.change
584
+ }, null, 8, ["model", "rules", "config", "prop", "labelWidth", "size", "onChange"]);
585
+ }), 128)) : vue.createCommentVNode("", true)
586
+ ], 4)) : vue.createCommentVNode("", true);
587
+ }
588
+ var Fieldset = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["render", _sfc_render$o]]);
589
+
590
+ const _sfc_main$q = vue.defineComponent({
591
+ name: "m-form-group-list-item",
592
+ components: { CaretRight: icons.CaretRight, CaretBottom: icons.CaretBottom },
593
+ props: {
594
+ labelWidth: String,
595
+ model: {
596
+ type: Object,
597
+ default: () => ({})
598
+ },
599
+ config: {
600
+ type: Object,
601
+ default: () => ({})
602
+ },
603
+ prop: String,
604
+ size: String,
605
+ index: {
606
+ type: [Number, String, Symbol],
607
+ default: 0
608
+ },
609
+ groupModel: {
610
+ type: Array,
611
+ default: () => []
612
+ }
613
+ },
614
+ emits: ["swap-item", "remove-item", "change"],
615
+ setup(props, { emit }) {
616
+ const mForm = vue.inject("mForm");
617
+ const expand = vue.ref(false);
618
+ vue.watchEffect(() => {
619
+ expand.value = !props.index;
620
+ });
621
+ const rowConfig = vue.computed(() => ({
622
+ type: "row",
623
+ span: props.config.span || 24,
624
+ items: props.config.items,
625
+ labelWidth: props.config.labelWidth,
626
+ [mForm?.keyProp || "__key"]: `${props.config[mForm?.keyProp || "__key"]}${String(props.index)}`
627
+ }));
628
+ const title = vue.computed(() => {
629
+ if (props.config.titleKey && props.model[props.config.titleKey]) {
630
+ return props.model[props.config.titleKey];
631
+ }
632
+ return `\u7EC4 ${String(props.index)}`;
633
+ });
634
+ const length = vue.computed(() => props.groupModel?.length || 0);
635
+ const itemExtra = vue.computed(() => filterFunction(mForm, props.config.itemExtra, props));
636
+ const removeHandler = () => emit("remove-item", props.index);
637
+ const changeHandler = () => emit("change");
638
+ const expandHandler = () => {
639
+ expand.value = !expand.value;
640
+ };
641
+ const showDelete = (index) => {
642
+ const deleteFunc = props.config.delete;
643
+ if (deleteFunc && typeof deleteFunc === "function") {
644
+ return deleteFunc(props.model, index, mForm?.values);
645
+ }
646
+ return true;
647
+ };
648
+ const changeOrder = (offset = 0) => emit("swap-item", props.index, `${String(props.index)}${offset}`);
649
+ const movable = () => {
650
+ const { movable: movable2 } = props.config;
651
+ if (movable2 === void 0)
652
+ return true;
653
+ if (typeof movable2 === "function") {
654
+ return movable2(mForm, props.index || 0, props.model, props.groupModel);
655
+ }
656
+ return movable2;
657
+ };
658
+ return {
659
+ expand,
660
+ expandHandler,
661
+ title,
662
+ showDelete,
663
+ removeHandler,
664
+ movable,
665
+ changeOrder,
666
+ itemExtra,
667
+ rowConfig,
668
+ changeHandler,
669
+ length,
670
+ Delete: icons.Delete
671
+ };
672
+ }
673
+ });
674
+ const _hoisted_1$e = { class: "m-fields-group-list-item" };
675
+ const _hoisted_2$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u79FB");
676
+ const _hoisted_3$5 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u79FB");
677
+ const _hoisted_4$4 = ["innerHTML"];
678
+ function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
679
+ const _component_caret_bottom = vue.resolveComponent("caret-bottom");
680
+ const _component_caret_right = vue.resolveComponent("caret-right");
681
+ const _component_el_icon = vue.resolveComponent("el-icon");
682
+ const _component_el_button = vue.resolveComponent("el-button");
683
+ const _component_CaretRight = vue.resolveComponent("CaretRight");
684
+ const _component_CaretBottom = vue.resolveComponent("CaretBottom");
685
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
686
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
687
+ vue.createElementVNode("div", null, [
688
+ vue.createVNode(_component_el_icon, {
689
+ style: { "margin-right": "7px" },
690
+ onClick: _ctx.expandHandler
691
+ }, {
692
+ default: vue.withCtx(() => [
693
+ _ctx.expand ? (vue.openBlock(), vue.createBlock(_component_caret_bottom, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_caret_right, { key: 1 }))
694
+ ]),
695
+ _: 1
696
+ }, 8, ["onClick"]),
697
+ vue.createVNode(_component_el_button, {
698
+ type: "text",
699
+ onClick: _ctx.expandHandler
700
+ }, {
701
+ default: vue.withCtx(() => [
702
+ vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
703
+ ]),
704
+ _: 1
705
+ }, 8, ["onClick"]),
706
+ vue.withDirectives(vue.createVNode(_component_el_button, {
707
+ type: "text",
708
+ icon: _ctx.Delete,
709
+ style: { "color": "#f56c6c" },
710
+ onClick: _ctx.removeHandler
711
+ }, null, 8, ["icon", "onClick"]), [
712
+ [vue.vShow, _ctx.showDelete(parseInt(String(_ctx.index)))]
713
+ ]),
714
+ _ctx.movable() ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
715
+ vue.withDirectives(vue.createVNode(_component_el_button, {
716
+ type: "text",
717
+ size: "small",
718
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.changeOrder(-1))
719
+ }, {
720
+ default: vue.withCtx(() => [
721
+ _hoisted_2$5,
722
+ vue.createVNode(_component_el_icon, null, {
723
+ default: vue.withCtx(() => [
724
+ vue.createVNode(_component_CaretRight)
725
+ ]),
726
+ _: 1
727
+ })
728
+ ]),
729
+ _: 1
730
+ }, 512), [
731
+ [vue.vShow, _ctx.index !== 0]
732
+ ]),
733
+ vue.withDirectives(vue.createVNode(_component_el_button, {
734
+ type: "text",
735
+ size: "small",
736
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.changeOrder(1))
737
+ }, {
738
+ default: vue.withCtx(() => [
739
+ _hoisted_3$5,
740
+ vue.createVNode(_component_el_icon, null, {
741
+ default: vue.withCtx(() => [
742
+ vue.createVNode(_component_CaretBottom)
743
+ ]),
744
+ _: 1
745
+ })
746
+ ]),
747
+ _: 1
748
+ }, 512), [
749
+ [vue.vShow, _ctx.index !== _ctx.length - 1]
750
+ ])
751
+ ], 64)) : vue.createCommentVNode("", true),
752
+ _ctx.itemExtra ? (vue.openBlock(), vue.createElementBlock("span", {
753
+ key: 1,
754
+ innerHTML: _ctx.itemExtra,
755
+ class: "m-form-tip"
756
+ }, null, 8, _hoisted_4$4)) : vue.createCommentVNode("", true)
757
+ ]),
758
+ _ctx.expand ? (vue.openBlock(), vue.createBlock(_component_m_form_container, {
759
+ key: 0,
760
+ config: _ctx.rowConfig,
761
+ model: _ctx.model,
762
+ labelWidth: _ctx.labelWidth,
763
+ prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${String(_ctx.index)}`,
764
+ size: _ctx.size,
765
+ onChange: _ctx.changeHandler
766
+ }, null, 8, ["config", "model", "labelWidth", "prop", "size", "onChange"])) : vue.createCommentVNode("", true)
767
+ ]);
768
+ }
769
+ var MFieldsGroupListItem = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$n]]);
770
+
771
+ const _sfc_main$p = vue.defineComponent({
772
+ name: "m-form-group-list",
773
+ components: { MFieldsGroupListItem },
774
+ props: {
775
+ labelWidth: String,
776
+ model: {
777
+ type: Object,
778
+ default: () => ({})
779
+ },
780
+ config: {
781
+ type: Object,
782
+ default: () => ({})
783
+ },
784
+ prop: {
785
+ type: String,
786
+ default: ""
787
+ },
788
+ size: String,
789
+ name: {
790
+ type: String,
791
+ default: ""
792
+ }
793
+ },
794
+ emits: ["change"],
795
+ setup(props, { emit }) {
796
+ const mForm = vue.inject("mForm");
797
+ const addable = vue.computed(() => {
798
+ if (!props.name)
799
+ return false;
800
+ if (typeof props.config.addable === "function") {
801
+ return props.config.addable(mForm, {
802
+ model: props.model[props.name],
803
+ formValue: mForm?.values
804
+ });
805
+ }
806
+ return typeof props.config.addable === "undefined" ? true : props.config.addable;
807
+ });
808
+ const changeHandler = () => {
809
+ if (!props.name)
810
+ return false;
811
+ emit("change", props.model[props.name]);
812
+ };
813
+ const addHandler = async () => {
814
+ if (!props.name)
815
+ return false;
816
+ let initValues = {};
817
+ if (typeof props.config.defaultAdd === "function") {
818
+ initValues = await props.config.defaultAdd(mForm, {
819
+ model: props.model[props.name],
820
+ formValue: mForm?.values
821
+ });
822
+ } else if (props.config.defaultAdd) {
823
+ initValues = props.config.defaultAdd;
824
+ }
825
+ const groupValue = await initValue(mForm, {
826
+ config: props.config.items,
827
+ initValues
828
+ });
829
+ props.model[props.name].push(groupValue);
830
+ };
831
+ const removeHandler = (index) => {
832
+ if (!props.name)
833
+ return false;
834
+ props.model[props.name].splice(index, 1);
835
+ changeHandler();
836
+ };
837
+ const swapHandler = (idx1, idx2) => {
838
+ if (!props.name)
839
+ return false;
840
+ const [currRow] = props.model[props.name].splice(idx1, 1);
841
+ props.model[props.name].splice(idx2, 0, currRow);
842
+ changeHandler();
843
+ };
844
+ const toggleMode = () => {
845
+ props.config.type = "table";
846
+ props.config.groupItems = props.config.items;
847
+ props.config.items = props.config.tableItems || props.config.items.map((item) => ({
848
+ ...item,
849
+ label: item.label || item.text,
850
+ text: null
851
+ }));
852
+ };
853
+ return {
854
+ addable,
855
+ toggleMode,
856
+ removeHandler,
857
+ swapHandler,
858
+ changeHandler,
859
+ addHandler
860
+ };
861
+ }
862
+ });
863
+ const _hoisted_1$d = { class: "m-fields-group-list" };
864
+ const _hoisted_2$4 = ["innerHTML"];
865
+ const _hoisted_3$4 = {
866
+ key: 1,
867
+ class: "el-table__empty-block"
868
+ };
869
+ const _hoisted_4$3 = /* @__PURE__ */ vue.createElementVNode("span", { class: "el-table__empty-text" }, "\u6682\u65E0\u6570\u636E", -1);
870
+ const _hoisted_5$2 = [
871
+ _hoisted_4$3
872
+ ];
873
+ const _hoisted_6$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0\u7EC4");
874
+ const _hoisted_7$1 = /* @__PURE__ */ vue.createTextVNode("\u5207\u6362\u4E3A\u8868\u683C");
875
+ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
876
+ const _component_m_fields_group_list_item = vue.resolveComponent("m-fields-group-list-item");
877
+ const _component_el_button = vue.resolveComponent("el-button");
878
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$d, [
879
+ _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
880
+ key: 0,
881
+ innerHTML: _ctx.config.extra,
882
+ style: { "color": "rgba(0, 0, 0, 0.45)" }
883
+ }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("", true),
884
+ !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$4, _hoisted_5$2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 2 }, vue.renderList(_ctx.model[_ctx.name], (item, index) => {
885
+ return vue.openBlock(), vue.createBlock(_component_m_fields_group_list_item, {
886
+ key: index,
887
+ model: item,
888
+ config: _ctx.config,
889
+ prop: _ctx.prop,
890
+ index,
891
+ "label-width": _ctx.labelWidth,
892
+ size: _ctx.size,
893
+ "group-model": _ctx.model[_ctx.name],
894
+ onRemoveItem: _ctx.removeHandler,
895
+ onSwapItem: _ctx.swapHandler,
896
+ onChange: _ctx.changeHandler
897
+ }, null, 8, ["model", "config", "prop", "index", "label-width", "size", "group-model", "onRemoveItem", "onSwapItem", "onChange"]);
898
+ }), 128)),
899
+ _ctx.addable ? (vue.openBlock(), vue.createBlock(_component_el_button, {
900
+ key: 3,
901
+ onClick: _ctx.addHandler,
902
+ size: "small"
903
+ }, {
904
+ default: vue.withCtx(() => [
905
+ _hoisted_6$1
906
+ ]),
907
+ _: 1
908
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
909
+ _ctx.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(_component_el_button, {
910
+ key: 4,
911
+ icon: "el-icon-s-grid",
912
+ size: "small",
913
+ onClick: _ctx.toggleMode
914
+ }, {
915
+ default: vue.withCtx(() => [
916
+ _hoisted_7$1
917
+ ]),
918
+ _: 1
919
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true)
920
+ ]);
921
+ }
922
+ var GroupList = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$m]]);
923
+
924
+ const _sfc_main$o = vue.defineComponent({
925
+ name: "m-form-panel",
926
+ components: { CaretBottom: icons.CaretBottom, CaretRight: icons.CaretRight },
927
+ props: {
928
+ labelWidth: String,
929
+ model: {
930
+ type: Object,
931
+ default: () => ({})
932
+ },
933
+ config: {
934
+ type: Object,
935
+ default: () => ({})
936
+ },
937
+ prop: String,
938
+ size: String,
939
+ name: String
940
+ },
941
+ emits: ["change"],
942
+ setup(props, { emit }) {
943
+ const mForm = vue.inject("mForm");
944
+ const expand = vue.ref(props.config.expand !== false);
945
+ const items = vue.computed(() => props.config.items);
946
+ const filter = (config) => filterFunction(mForm, config, props);
947
+ const changeHandler = () => emit("change", props.model);
948
+ return {
949
+ mForm,
950
+ expand,
951
+ items,
952
+ filter,
953
+ changeHandler
954
+ };
955
+ }
956
+ });
957
+ const _hoisted_1$c = { class: "clearfix" };
958
+ const _hoisted_2$3 = ["innerHTML"];
959
+ const _hoisted_3$3 = {
960
+ key: 0,
961
+ style: { "display": "flex" }
962
+ };
963
+ const _hoisted_4$2 = { style: { "flex": "1" } };
964
+ const _hoisted_5$1 = ["src"];
965
+ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
966
+ const _component_caret_bottom = vue.resolveComponent("caret-bottom");
967
+ const _component_caret_right = vue.resolveComponent("caret-right");
968
+ const _component_el_icon = vue.resolveComponent("el-icon");
969
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
970
+ const _component_el_card = vue.resolveComponent("el-card");
971
+ return _ctx.items && _ctx.items.length ? (vue.openBlock(), vue.createBlock(_component_el_card, {
972
+ key: 0,
973
+ class: "box-card m-form-panel",
974
+ "body-style": { display: _ctx.expand ? "block" : "none" }
975
+ }, {
976
+ header: vue.withCtx(() => [
977
+ vue.createElementVNode("div", _hoisted_1$c, [
978
+ vue.createElementVNode("a", {
979
+ href: "javascript:",
980
+ style: { "width": "100%", "display": "block" },
981
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.expand = !_ctx.expand)
982
+ }, [
983
+ vue.createVNode(_component_el_icon, null, {
984
+ default: vue.withCtx(() => [
985
+ _ctx.expand ? (vue.openBlock(), vue.createBlock(_component_caret_bottom, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_caret_right, { key: 1 }))
986
+ ]),
987
+ _: 1
988
+ }),
989
+ vue.createTextVNode(" " + vue.toDisplayString(_ctx.filter(_ctx.config.title)) + " ", 1),
990
+ _ctx.config && _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
991
+ key: 0,
992
+ innerHTML: _ctx.config.extra,
993
+ class: "m-form-tip"
994
+ }, null, 8, _hoisted_2$3)) : vue.createCommentVNode("", true)
995
+ ])
996
+ ])
997
+ ]),
998
+ default: vue.withCtx(() => [
999
+ vue.createElementVNode("div", null, [
1000
+ vue.renderSlot(_ctx.$slots, "default"),
1001
+ _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [
1002
+ vue.createElementVNode("div", _hoisted_4$2, [
1003
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.items, (item, index) => {
1004
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
1005
+ key: item[_ctx.mForm?.keyProp || "__key"] ?? index,
1006
+ config: item,
1007
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1008
+ prop: _ctx.prop,
1009
+ size: _ctx.size,
1010
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1011
+ onChange: _ctx.changeHandler
1012
+ }, null, 8, ["config", "model", "prop", "size", "label-width", "onChange"]);
1013
+ }), 128))
1014
+ ]),
1015
+ vue.createElementVNode("img", {
1016
+ class: "m-form-schematic",
1017
+ src: _ctx.config.schematic
1018
+ }, null, 8, _hoisted_5$1)
1019
+ ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.items, (item, index) => {
1020
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
1021
+ key: item[_ctx.mForm?.keyProp || "__key"] ?? index,
1022
+ config: item,
1023
+ model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
1024
+ prop: _ctx.prop,
1025
+ size: _ctx.size,
1026
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1027
+ onChange: _ctx.changeHandler
1028
+ }, null, 8, ["config", "model", "prop", "size", "label-width", "onChange"]);
1029
+ }), 128))
1030
+ ])
1031
+ ]),
1032
+ _: 3
1033
+ }, 8, ["body-style"])) : vue.createCommentVNode("", true);
1034
+ }
1035
+ var Panel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$l]]);
1036
+
1037
+ const _sfc_main$n = vue.defineComponent({
1038
+ name: "m-form-row",
1039
+ props: {
1040
+ labelWidth: String,
1041
+ expandMore: Boolean,
1042
+ model: {
1043
+ type: Object,
1044
+ default: () => ({})
1045
+ },
1046
+ config: {
1047
+ type: Object,
1048
+ default: () => ({})
1049
+ },
1050
+ prop: String,
1051
+ name: String,
1052
+ size: String
1053
+ },
1054
+ emits: ["change"],
1055
+ setup(props, { emit }) {
1056
+ const mForm = vue.inject("mForm");
1057
+ const changeHandler = () => emit("change", props.name ? props.model[props.name] : props.model);
1058
+ return {
1059
+ mForm,
1060
+ display(config) {
1061
+ return display(mForm, config.display, props);
1062
+ },
1063
+ changeHandler
1064
+ };
1065
+ }
1066
+ });
1067
+ 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");
1070
+ const _component_el_row = vue.resolveComponent("el-row");
1071
+ return vue.openBlock(), vue.createBlock(_component_el_row, { gutter: 10 }, {
1072
+ default: vue.withCtx(() => [
1073
+ (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" : ""),
1076
+ 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"]);
1092
+ }), 128))
1093
+ ]),
1094
+ _: 1
1095
+ });
1096
+ }
1097
+ var Row = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$k]]);
1098
+
1099
+ const _sfc_main$m = vue.defineComponent({
1100
+ name: "m-form-step",
1101
+ props: {
1102
+ model: {
1103
+ type: Object,
1104
+ default: () => ({})
1105
+ },
1106
+ config: {
1107
+ type: Object,
1108
+ default: () => ({})
1109
+ },
1110
+ stepActive: {
1111
+ type: Number,
1112
+ default: () => 1
1113
+ },
1114
+ size: String,
1115
+ labelWidth: String
1116
+ },
1117
+ emits: ["change"],
1118
+ setup(props, { emit }) {
1119
+ const mForm = vue.inject("mForm");
1120
+ const active = vue.ref(1);
1121
+ vue.watchEffect(() => {
1122
+ active.value = props.stepActive;
1123
+ });
1124
+ const stepClick = (index) => {
1125
+ active.value = index + 1;
1126
+ mForm?.$emit("update:stepActive", active.value);
1127
+ };
1128
+ const changeHandler = () => {
1129
+ emit("change", props.model);
1130
+ };
1131
+ return { mForm, active, stepClick, changeHandler };
1132
+ }
1133
+ });
1134
+ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
1135
+ const _component_el_step = vue.resolveComponent("el-step");
1136
+ const _component_el_steps = vue.resolveComponent("el-steps");
1137
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
1138
+ return vue.openBlock(), vue.createElementBlock("div", null, [
1139
+ vue.createVNode(_component_el_steps, {
1140
+ active: _ctx.active,
1141
+ "align-center": "",
1142
+ space: _ctx.config.space
1143
+ }, {
1144
+ default: vue.withCtx(() => [
1145
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (item, index) => {
1146
+ return vue.openBlock(), vue.createBlock(_component_el_step, {
1147
+ key: item.__key,
1148
+ title: item.title,
1149
+ active: _ctx.active,
1150
+ onClick: ($event) => _ctx.stepClick(index)
1151
+ }, null, 8, ["title", "active", "onClick"]);
1152
+ }), 128))
1153
+ ]),
1154
+ _: 1
1155
+ }, 8, ["active", "space"]),
1156
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (step, index) => {
1157
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1158
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(step.items, (item) => {
1159
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1160
+ item ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_m_form_container, {
1161
+ key: item[_ctx.mForm?.keyProp || "__key"],
1162
+ config: item,
1163
+ model: step.name ? _ctx.model[step.name] : _ctx.model,
1164
+ prop: step.name,
1165
+ size: _ctx.size,
1166
+ "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
1167
+ onChange: _ctx.changeHandler
1168
+ }, null, 8, ["config", "model", "prop", "size", "label-width", "onChange"])), [
1169
+ [vue.vShow, _ctx.active - 1 === index]
1170
+ ]) : vue.createCommentVNode("", true)
1171
+ ], 64);
1172
+ }), 256))
1173
+ ], 64);
1174
+ }), 256))
1175
+ ]);
1176
+ }
1177
+ var MStep = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$j]]);
1178
+
1179
+ let loadedAMapJS = false;
1180
+ let firstLoadingAMapJS = true;
1181
+ const _sfc_main$l = vue.defineComponent({
1182
+ name: "m-form-table",
1183
+ props: {
1184
+ name: {
1185
+ type: String,
1186
+ required: true
1187
+ },
1188
+ model: {
1189
+ type: Object,
1190
+ required: true,
1191
+ default: () => ({})
1192
+ },
1193
+ config: {
1194
+ type: Object,
1195
+ required: true,
1196
+ default: () => ({})
1197
+ },
1198
+ prop: {
1199
+ type: String
1200
+ },
1201
+ labelWidth: {
1202
+ type: String
1203
+ },
1204
+ sort: {
1205
+ type: Boolean,
1206
+ default: false
1207
+ },
1208
+ sortKey: {
1209
+ type: String,
1210
+ default: ""
1211
+ },
1212
+ text: {
1213
+ type: String
1214
+ },
1215
+ size: String,
1216
+ enableToggleMode: {
1217
+ type: Boolean,
1218
+ default: true
1219
+ }
1220
+ },
1221
+ emits: ["change", "select"],
1222
+ setup(props, { emit }) {
1223
+ let timer = null;
1224
+ const mForm = vue.inject("mForm");
1225
+ const elTable = vue.ref();
1226
+ const excelBtn = vue.ref();
1227
+ const mTable = vue.ref();
1228
+ const pagesize = vue.ref(10);
1229
+ const pagecontext = vue.ref(0);
1230
+ const updateKey = vue.ref(1);
1231
+ const isFullscreen = vue.ref(false);
1232
+ const modelName = vue.computed(() => props.name || props.config.name || "");
1233
+ const sortChange = ({ prop, order }) => {
1234
+ if (order === "ascending") {
1235
+ props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
1236
+ } else if (order === "descending") {
1237
+ props.model[modelName.value] = props.model[modelName.value].sort((a, b) => b[prop] - a[prop]);
1238
+ }
1239
+ };
1240
+ const foreUpdate = () => {
1241
+ updateKey.value += 1;
1242
+ setTimeout(() => rowDrop());
1243
+ };
1244
+ const swapArray = (index1, index2) => {
1245
+ [props.model[modelName.value][index1]] = props.model[modelName.value].splice(index2, 1, props.model[modelName.value][index1]);
1246
+ if (props.sortKey) {
1247
+ for (let i = props.model[modelName.value].length - 1, v = 0; i >= 0; i--, v++) {
1248
+ props.model[modelName.value][v][props.sortKey] = i;
1249
+ }
1250
+ }
1251
+ mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1252
+ };
1253
+ const rowDrop = () => {
1254
+ const tableEl = elTable.value?.$el;
1255
+ if (tableEl?.querySelectorAll(".el-table__body > tbody")) {
1256
+ const el = tableEl.querySelectorAll(".el-table__body > tbody")[0];
1257
+ const sortable = Sortable__default["default"].create(el, {
1258
+ onEnd: ({ newIndex, oldIndex }) => {
1259
+ if (typeof newIndex === "undefined")
1260
+ return;
1261
+ if (typeof oldIndex === "undefined")
1262
+ return;
1263
+ swapArray(newIndex, oldIndex);
1264
+ emit("change", props.model[modelName.value]);
1265
+ foreUpdate();
1266
+ sortable.destroy();
1267
+ mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1268
+ utils.sleep(1e3).then(() => {
1269
+ const eltrs = tableEl.querySelectorAll(".el-table__body > tbody > tr");
1270
+ if (eltrs?.[newIndex]) {
1271
+ eltrs[newIndex].style.backgroundColor = "rgba(243, 89, 59, 0.2)";
1272
+ utils.sleep(1e3).then(() => {
1273
+ eltrs[newIndex].style.backgroundColor = "";
1274
+ });
1275
+ }
1276
+ });
1277
+ }
1278
+ });
1279
+ }
1280
+ };
1281
+ const newHandler = async (row) => {
1282
+ if (props.config.max && props.model[modelName.value].length >= props.config.max) {
1283
+ elementPlus.ElMessage.error(`\u6700\u591A\u65B0\u589E\u914D\u7F6E\u4E0D\u80FD\u8D85\u8FC7${props.config.max}\u6761`);
1284
+ return;
1285
+ }
1286
+ const columns = props.config.items;
1287
+ const enumValues = props.config.enum || [];
1288
+ let enumV = [];
1289
+ const { length } = props.model[modelName.value];
1290
+ const key = props.config.key || "id";
1291
+ let inputs = {};
1292
+ if (enumValues.length) {
1293
+ if (length >= enumValues.length) {
1294
+ return;
1295
+ }
1296
+ enumV = enumValues.filter((item) => {
1297
+ let i = 0;
1298
+ for (; i < length; i++) {
1299
+ if (item[key] === props.model[modelName.value][i][key]) {
1300
+ break;
1301
+ }
1302
+ }
1303
+ return i === length;
1304
+ });
1305
+ if (enumV.length > 0) {
1306
+ inputs = enumV[0];
1307
+ }
1308
+ } else if (Array.isArray(row)) {
1309
+ columns.forEach((column, index) => {
1310
+ column.name && (inputs[column.name] = row[index]);
1311
+ });
1312
+ } else {
1313
+ if (typeof props.config.defaultAdd === "function") {
1314
+ inputs = await props.config.defaultAdd(mForm, {
1315
+ model: props.model[modelName.value],
1316
+ formValue: mForm?.values
1317
+ });
1318
+ } else if (props.config.defaultAdd) {
1319
+ inputs = props.config.defaultAdd;
1320
+ }
1321
+ inputs = await initValue(mForm, {
1322
+ config: columns,
1323
+ initValues: inputs
1324
+ });
1325
+ }
1326
+ if (props.sortKey && length) {
1327
+ inputs[props.sortKey] = props.model[modelName.value][length - 1][props.sortKey] - 1;
1328
+ }
1329
+ props.model[modelName.value].push(inputs);
1330
+ emit("change", props.model[modelName.value]);
1331
+ };
1332
+ if (!loadedAMapJS && firstLoadingAMapJS && !globalThis.XLSX) {
1333
+ firstLoadingAMapJS = false;
1334
+ utils.asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js").then(() => {
1335
+ loadedAMapJS = true;
1336
+ }).catch(() => {
1337
+ firstLoadingAMapJS = true;
1338
+ });
1339
+ }
1340
+ vue.onMounted(() => {
1341
+ if (props.config.defautSort) {
1342
+ sortChange(props.config.defautSort);
1343
+ }
1344
+ if (props.sort && props.sortKey) {
1345
+ props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
1346
+ }
1347
+ if (props.config.dropSort) {
1348
+ rowDrop();
1349
+ }
1350
+ });
1351
+ return {
1352
+ mForm,
1353
+ pagesize,
1354
+ pagecontext,
1355
+ foreUpdate,
1356
+ isFullscreen,
1357
+ elTable,
1358
+ mTable,
1359
+ excelBtn,
1360
+ modelName,
1361
+ updateKey,
1362
+ ArrowDown: icons.ArrowDown,
1363
+ ArrowUp: icons.ArrowUp,
1364
+ Delete: icons.Delete,
1365
+ data: vue.computed(() => props.model[modelName.value].filter((item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value)),
1366
+ addable: vue.computed(() => {
1367
+ if (!props.model[modelName.value].length) {
1368
+ return true;
1369
+ }
1370
+ if (typeof props.config.addable === "function") {
1371
+ return props.config.addable(mForm, {
1372
+ model: props.model[modelName.value],
1373
+ formValue: mForm?.values,
1374
+ prop: props.prop
1375
+ });
1376
+ }
1377
+ return typeof props.config.addable === "undefined" ? true : props.config.addable;
1378
+ }),
1379
+ selection: vue.computed(() => {
1380
+ if (typeof props.config.selection === "function") {
1381
+ return props.config.selection(mForm, { model: props.model[modelName.value] });
1382
+ }
1383
+ return props.config.selection;
1384
+ }),
1385
+ importable: vue.computed(() => {
1386
+ if (typeof props.config.importable === "function") {
1387
+ return props.config.importable(mForm, {
1388
+ formValue: mForm?.values,
1389
+ model: props.model[modelName.value]
1390
+ });
1391
+ }
1392
+ return typeof props.config.importable === "undefined" ? false : props.config.importable;
1393
+ }),
1394
+ sortChange,
1395
+ display(fuc) {
1396
+ return display(mForm, fuc, props);
1397
+ },
1398
+ itemExtra(fuc, index) {
1399
+ if (typeof fuc === "function") {
1400
+ return fuc(mForm, {
1401
+ values: mForm?.initValues,
1402
+ model: props.model,
1403
+ formValue: mForm ? mForm.values : props.model,
1404
+ prop: props.prop,
1405
+ index
1406
+ });
1407
+ }
1408
+ return fuc;
1409
+ },
1410
+ newHandler,
1411
+ removeHandler(index) {
1412
+ props.model[modelName.value].splice(index, 1);
1413
+ emit("change", props.model[modelName.value]);
1414
+ },
1415
+ selectHandle(selection, row) {
1416
+ if (typeof props.config.selection === "string" && props.config.selection === "single") {
1417
+ elTable.value?.clearSelection();
1418
+ elTable.value?.toggleRowSelection(row, true);
1419
+ }
1420
+ emit("select", selection, row);
1421
+ if (typeof props.config.onSelect === "function") {
1422
+ props.config.onSelect(mForm, { selection, row });
1423
+ }
1424
+ },
1425
+ toggleRowSelection(row, selected) {
1426
+ elTable.value?.toggleRowSelection.call(elTable.value, row, selected);
1427
+ },
1428
+ makeConfig(config) {
1429
+ const newConfig = lodashEs.cloneDeep(config);
1430
+ delete newConfig.display;
1431
+ return newConfig;
1432
+ },
1433
+ upHandler(index) {
1434
+ if (timer) {
1435
+ clearTimeout(timer);
1436
+ }
1437
+ timer = setTimeout(() => {
1438
+ swapArray(index, index - 1);
1439
+ }, 300);
1440
+ },
1441
+ topHandler(index) {
1442
+ if (timer) {
1443
+ clearTimeout(timer);
1444
+ }
1445
+ const moveNum = index;
1446
+ for (let i = 0; i < moveNum; i++) {
1447
+ swapArray(index, index - 1);
1448
+ index -= 1;
1449
+ }
1450
+ },
1451
+ downHandler(index) {
1452
+ if (timer) {
1453
+ clearTimeout(timer);
1454
+ }
1455
+ timer = setTimeout(() => {
1456
+ swapArray(index, index + 1);
1457
+ }, 300);
1458
+ },
1459
+ bottomHandler(index) {
1460
+ if (timer) {
1461
+ clearTimeout(timer);
1462
+ }
1463
+ const moveNum = props.model[modelName.value].length - 1 - index;
1464
+ for (let i = 0; i < moveNum; i++) {
1465
+ swapArray(index, index + 1);
1466
+ index += 1;
1467
+ }
1468
+ },
1469
+ showDelete(index) {
1470
+ const deleteFunc = props.config.delete;
1471
+ if (deleteFunc && typeof deleteFunc === "function") {
1472
+ return deleteFunc(props.model[modelName.value], index, mForm?.values);
1473
+ }
1474
+ return true;
1475
+ },
1476
+ clearHandler() {
1477
+ const len = props.model[modelName.value].length;
1478
+ props.model[modelName.value].splice(0, len);
1479
+ mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
1480
+ },
1481
+ excelHandler(file) {
1482
+ if (!file || !file.raw) {
1483
+ return false;
1484
+ }
1485
+ const reader = new FileReader();
1486
+ reader.onload = () => {
1487
+ const data = reader.result;
1488
+ const pdata = globalThis.XLSX.read(data, { type: "array" });
1489
+ pdata.SheetNames.forEach((sheetName) => {
1490
+ const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
1491
+ if (arr?.[0]) {
1492
+ arr.forEach((row) => {
1493
+ newHandler(row);
1494
+ });
1495
+ }
1496
+ setTimeout(() => {
1497
+ excelBtn.value?.clearFiles();
1498
+ }, 300);
1499
+ });
1500
+ };
1501
+ reader.readAsArrayBuffer(file.raw);
1502
+ return false;
1503
+ },
1504
+ handleSizeChange(val) {
1505
+ pagesize.value = val;
1506
+ },
1507
+ handleCurrentChange(val) {
1508
+ pagecontext.value = val - 1;
1509
+ },
1510
+ toggleMode() {
1511
+ const calcLabelWidth = (label) => {
1512
+ if (!label)
1513
+ return "0px";
1514
+ const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
1515
+ const chLength = label.length - zhLength;
1516
+ return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
1517
+ };
1518
+ props.config.type = "groupList";
1519
+ props.config.enableToggleMode = true;
1520
+ props.config.tableItems = props.config.items;
1521
+ props.config.items = props.config.groupItems || props.config.items.map((item) => {
1522
+ const text = item.text || item.label;
1523
+ const labelWidth = calcLabelWidth(text);
1524
+ return {
1525
+ ...item,
1526
+ text,
1527
+ labelWidth,
1528
+ span: item.span || 12
1529
+ };
1530
+ });
1531
+ },
1532
+ toggleFullscreen() {
1533
+ if (isFullscreen.value) {
1534
+ mTable.value?.classList.remove("fixed");
1535
+ isFullscreen.value = false;
1536
+ } else {
1537
+ mTable.value?.classList.add("fixed");
1538
+ isFullscreen.value = true;
1539
+ }
1540
+ },
1541
+ getProp(index) {
1542
+ const { prop } = vue.toRefs(props);
1543
+ return `${prop.value}${prop.value ? "." : ""}${index + 1 + pagecontext.value * pagesize.value - 1}`;
1544
+ }
1545
+ };
1546
+ }
1547
+ });
1548
+ const _hoisted_1$b = ["innerHTML"];
1549
+ const _hoisted_2$2 = { class: "el-form-item__content" };
1550
+ const _hoisted_3$2 = ["innerHTML"];
1551
+ const _hoisted_4$1 = /* @__PURE__ */ vue.createTextVNode("\u6DFB\u52A0");
1552
+ const _hoisted_5 = /* @__PURE__ */ vue.createTextVNode(" \xA0 ");
1553
+ const _hoisted_6 = /* @__PURE__ */ vue.createTextVNode("\u5C55\u5F00\u914D\u7F6E");
1554
+ const _hoisted_7 = /* @__PURE__ */ vue.createTextVNode("\u5BFC\u5165EXCEL");
1555
+ const _hoisted_8 = /* @__PURE__ */ vue.createTextVNode("\xA0 ");
1556
+ const _hoisted_9 = /* @__PURE__ */ vue.createTextVNode("\u6E05\u7A7A");
1557
+ const _hoisted_10 = {
1558
+ class: "bottom",
1559
+ style: { "text-align": "right" }
1560
+ };
1561
+ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
1562
+ const _component_el_table_column = vue.resolveComponent("el-table-column");
1563
+ const _component_el_button = vue.resolveComponent("el-button");
1564
+ const _component_el_tooltip = vue.resolveComponent("el-tooltip");
1565
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
1566
+ const _component_el_table = vue.resolveComponent("el-table");
1567
+ const _component_el_upload = vue.resolveComponent("el-upload");
1568
+ const _component_el_pagination = vue.resolveComponent("el-pagination");
1569
+ return vue.openBlock(), vue.createElementBlock("div", {
1570
+ ref: "mTable",
1571
+ class: vue.normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
1572
+ }, [
1573
+ _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
1574
+ key: 0,
1575
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
1576
+ innerHTML: _ctx.config.extra
1577
+ }, null, 8, _hoisted_1$b)) : vue.createCommentVNode("", true),
1578
+ vue.createElementVNode("div", _hoisted_2$2, [
1579
+ vue.createVNode(_component_el_tooltip, {
1580
+ content: "\u62D6\u62FD\u53EF\u6392\u5E8F",
1581
+ placement: "left-start",
1582
+ disabled: _ctx.config.dropSort !== true
1583
+ }, {
1584
+ default: vue.withCtx(() => [
1585
+ _ctx.model[_ctx.modelName] ? (vue.openBlock(), vue.createBlock(_component_el_table, {
1586
+ ref: "elTable",
1587
+ style: { "width": "100%" },
1588
+ data: _ctx.model[_ctx.modelName],
1589
+ border: _ctx.config.border,
1590
+ "max-height": _ctx.config.maxHeight,
1591
+ "default-expand-all": true,
1592
+ key: _ctx.updateKey,
1593
+ onSelect: _ctx.selectHandle,
1594
+ onSortChange: _ctx.sortChange
1595
+ }, {
1596
+ default: vue.withCtx(() => [
1597
+ _ctx.config.itemExtra ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1598
+ key: 0,
1599
+ fixed: "left",
1600
+ width: "30",
1601
+ type: "expand"
1602
+ }, {
1603
+ default: vue.withCtx((scope) => [
1604
+ vue.createElementVNode("span", {
1605
+ innerHTML: _ctx.itemExtra(_ctx.config.itemExtra, scope.$index),
1606
+ class: "m-form-tip"
1607
+ }, null, 8, _hoisted_3$2)
1608
+ ]),
1609
+ _: 1
1610
+ })) : vue.createCommentVNode("", true),
1611
+ vue.createVNode(_component_el_table_column, {
1612
+ label: "\u64CD\u4F5C",
1613
+ width: "50",
1614
+ fixed: _ctx.config.fixed === false ? void 0 : "left"
1615
+ }, {
1616
+ default: vue.withCtx((scope) => [
1617
+ vue.withDirectives(vue.createVNode(_component_el_button, {
1618
+ style: { "color": "#f56c6c" },
1619
+ type: "text",
1620
+ icon: _ctx.Delete,
1621
+ onClick: ($event) => _ctx.removeHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1622
+ }, null, 8, ["icon", "onClick"]), [
1623
+ [vue.vShow, _ctx.showDelete(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)]
1624
+ ])
1625
+ ]),
1626
+ _: 1
1627
+ }, 8, ["fixed"]),
1628
+ _ctx.sort && _ctx.model[_ctx.modelName] && _ctx.model[_ctx.modelName].length > 1 ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1629
+ key: 1,
1630
+ label: "\u6392\u5E8F",
1631
+ width: "70"
1632
+ }, {
1633
+ default: vue.withCtx((scope) => [
1634
+ scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1 !== 0 ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
1635
+ key: 0,
1636
+ content: "\u70B9\u51FB\u4E0A\u79FB\uFF0C\u53CC\u51FB\u7F6E\u9876",
1637
+ placement: "top"
1638
+ }, {
1639
+ default: vue.withCtx(() => [
1640
+ vue.createVNode(_component_el_button, {
1641
+ plain: "",
1642
+ size: "small",
1643
+ icon: _ctx.ArrowUp,
1644
+ type: "text",
1645
+ onClick: ($event) => _ctx.upHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1),
1646
+ onDblclick: ($event) => _ctx.topHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1647
+ }, null, 8, ["icon", "onClick", "onDblclick"])
1648
+ ]),
1649
+ _: 2
1650
+ }, 1024)) : vue.createCommentVNode("", true),
1651
+ scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1 !== _ctx.model[_ctx.modelName].length - 1 ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
1652
+ key: 1,
1653
+ content: "\u70B9\u51FB\u4E0B\u79FB\uFF0C\u53CC\u51FB\u7F6E\u5E95",
1654
+ placement: "top"
1655
+ }, {
1656
+ default: vue.withCtx(() => [
1657
+ vue.createVNode(_component_el_button, {
1658
+ plain: "",
1659
+ size: "small",
1660
+ icon: _ctx.ArrowDown,
1661
+ type: "text",
1662
+ onClick: ($event) => _ctx.downHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1),
1663
+ onDblclick: ($event) => _ctx.bottomHandler(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize - 1)
1664
+ }, null, 8, ["icon", "onClick", "onDblclick"])
1665
+ ]),
1666
+ _: 2
1667
+ }, 1024)) : vue.createCommentVNode("", true)
1668
+ ]),
1669
+ _: 1
1670
+ })) : vue.createCommentVNode("", true),
1671
+ _ctx.selection ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1672
+ key: 2,
1673
+ align: "center",
1674
+ "header-align": "center",
1675
+ type: "selection",
1676
+ width: "45"
1677
+ })) : vue.createCommentVNode("", true),
1678
+ vue.createVNode(_component_el_table_column, {
1679
+ width: "50",
1680
+ label: "\u5E8F\u53F7"
1681
+ }, {
1682
+ default: vue.withCtx((scope) => [
1683
+ vue.createTextVNode(vue.toDisplayString(scope.$index + 1 + _ctx.pagecontext * _ctx.pagesize), 1)
1684
+ ]),
1685
+ _: 1
1686
+ }),
1687
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.items, (column, index) => {
1688
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1689
+ column.type !== "hidden" && _ctx.display(column.display) ? (vue.openBlock(), vue.createBlock(_component_el_table_column, {
1690
+ prop: column.name,
1691
+ width: column.width,
1692
+ label: column.label,
1693
+ sortable: column.sortable,
1694
+ "sort-orders": ["ascending", "descending"],
1695
+ key: column[_ctx.mForm?.keyProp || "__key"] ?? index,
1696
+ "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1697
+ }, {
1698
+ default: vue.withCtx((scope) => [
1699
+ scope.$index > -1 ? (vue.openBlock(), vue.createBlock(_component_m_form_container, {
1700
+ key: 0,
1701
+ labelWidth: "0",
1702
+ prop: _ctx.getProp(scope.$index),
1703
+ rules: column.rules,
1704
+ config: _ctx.makeConfig(column),
1705
+ model: scope.row,
1706
+ size: _ctx.size,
1707
+ onChange: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("change", _ctx.model[_ctx.modelName]))
1708
+ }, null, 8, ["prop", "rules", "config", "model", "size"])) : vue.createCommentVNode("", true)
1709
+ ]),
1710
+ _: 2
1711
+ }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : vue.createCommentVNode("", true)
1712
+ ], 64);
1713
+ }), 256))
1714
+ ]),
1715
+ _: 1
1716
+ }, 8, ["data", "border", "max-height", "onSelect", "onSortChange"])) : vue.createCommentVNode("", true)
1717
+ ]),
1718
+ _: 1
1719
+ }, 8, ["disabled"]),
1720
+ vue.renderSlot(_ctx.$slots, "default"),
1721
+ _ctx.addable ? (vue.openBlock(), vue.createBlock(_component_el_button, {
1722
+ key: 0,
1723
+ size: "small",
1724
+ type: "primary",
1725
+ plain: "",
1726
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.newHandler())
1727
+ }, {
1728
+ default: vue.withCtx(() => [
1729
+ _hoisted_4$1
1730
+ ]),
1731
+ _: 1
1732
+ })) : vue.createCommentVNode("", true),
1733
+ _hoisted_5,
1734
+ _ctx.enableToggleMode && !_ctx.isFullscreen ? (vue.openBlock(), vue.createBlock(_component_el_button, {
1735
+ key: 1,
1736
+ icon: "el-icon-s-grid",
1737
+ size: "small",
1738
+ onClick: _ctx.toggleMode
1739
+ }, {
1740
+ default: vue.withCtx(() => [
1741
+ _hoisted_6
1742
+ ]),
1743
+ _: 1
1744
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
1745
+ _ctx.config.enableFullscreen !== false ? (vue.openBlock(), vue.createBlock(_component_el_button, {
1746
+ key: 2,
1747
+ icon: "el-icon-s-grid",
1748
+ size: "small",
1749
+ onClick: _ctx.toggleFullscreen
1750
+ }, {
1751
+ default: vue.withCtx(() => [
1752
+ vue.createTextVNode(vue.toDisplayString(_ctx.isFullscreen ? "\u9000\u51FA\u5168\u5C4F" : "\u5168\u5C4F\u7F16\u8F91"), 1)
1753
+ ]),
1754
+ _: 1
1755
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
1756
+ _ctx.importable ? (vue.openBlock(), vue.createBlock(_component_el_upload, {
1757
+ key: 3,
1758
+ ref: "excelBtn",
1759
+ action: "/noop",
1760
+ "on-change": _ctx.excelHandler,
1761
+ "auto-upload": false,
1762
+ style: { "display": "inline-block" }
1763
+ }, {
1764
+ default: vue.withCtx(() => [
1765
+ vue.createVNode(_component_el_button, {
1766
+ size: "small",
1767
+ type: "success",
1768
+ plain: ""
1769
+ }, {
1770
+ default: vue.withCtx(() => [
1771
+ _hoisted_7
1772
+ ]),
1773
+ _: 1
1774
+ })
1775
+ ]),
1776
+ _: 1
1777
+ }, 8, ["on-change"])) : vue.createCommentVNode("", true),
1778
+ _hoisted_8,
1779
+ _ctx.importable ? (vue.openBlock(), vue.createBlock(_component_el_button, {
1780
+ key: 4,
1781
+ size: "small",
1782
+ type: "warning",
1783
+ plain: "",
1784
+ onClick: _cache[2] || (_cache[2] = ($event) => _ctx.clearHandler())
1785
+ }, {
1786
+ default: vue.withCtx(() => [
1787
+ _hoisted_9
1788
+ ]),
1789
+ _: 1
1790
+ })) : vue.createCommentVNode("", true)
1791
+ ]),
1792
+ vue.createElementVNode("div", _hoisted_10, [
1793
+ vue.createVNode(_component_el_pagination, {
1794
+ layout: "total, sizes, prev, pager, next, jumper",
1795
+ "hide-on-single-page": _ctx.model[_ctx.modelName].length < _ctx.pagesize,
1796
+ "current-page": _ctx.pagecontext + 1,
1797
+ "page-sizes": [_ctx.pagesize, 60, 120, 300],
1798
+ "page-size": _ctx.pagesize,
1799
+ total: _ctx.model[_ctx.modelName].length,
1800
+ onSizeChange: _ctx.handleSizeChange,
1801
+ onCurrentChange: _ctx.handleCurrentChange
1802
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
1803
+ ])
1804
+ ], 2);
1805
+ }
1806
+ var Table = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$i]]);
1807
+
1808
+ const getActive = (mForm, props, activeTabName) => {
1809
+ const { config, model, prop } = props;
1810
+ const { active } = config;
1811
+ if (typeof active === "function")
1812
+ return active(mForm, { model, formValue: mForm?.values, prop });
1813
+ if (+activeTabName >= props.config.items.length)
1814
+ return "0";
1815
+ if (typeof active !== "undefined")
1816
+ return active;
1817
+ return "0";
1818
+ };
1819
+ const tabClickHandler = (mForm, tab, props) => {
1820
+ const { config, model, prop } = props;
1821
+ if (typeof config.onTabClick === "function") {
1822
+ config.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
1823
+ }
1824
+ const tabConfig = config.items.find((item) => tab.name === item.status);
1825
+ if (tabConfig && typeof tabConfig.onTabClick === "function") {
1826
+ tabConfig.onTabClick(mForm, tab, { model, formValue: mForm?.values, prop });
1827
+ }
1828
+ };
1829
+ const Tab = vue.defineComponent({
1830
+ name: "m-form-tab",
1831
+ props: {
1832
+ labelWidth: String,
1833
+ expandMore: Boolean,
1834
+ model: {
1835
+ type: Object,
1836
+ default: () => ({})
1837
+ },
1838
+ config: {
1839
+ type: Object,
1840
+ default: () => ({})
1841
+ },
1842
+ prop: String,
1843
+ size: String
1844
+ },
1845
+ emits: {
1846
+ change(values) {
1847
+ return values;
1848
+ }
1849
+ },
1850
+ setup(props, { emit }) {
1851
+ const mForm = vue.inject("mForm");
1852
+ const activeTabName = vue.ref(getActive(mForm, props, ""));
1853
+ const tabs = vue.computed(() => {
1854
+ if (props.config.dynamic) {
1855
+ if (!props.config.name)
1856
+ throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1857
+ return props.model[props.config.name] || [];
1858
+ }
1859
+ return props.config.items;
1860
+ });
1861
+ const filter = (config) => filterFunction(mForm, config, props);
1862
+ vue.watchEffect(() => {
1863
+ if (typeof props.config.activeChange === "function") {
1864
+ props.config.activeChange(mForm, activeTabName.value, {
1865
+ model: props.model,
1866
+ prop: props.prop
1867
+ });
1868
+ }
1869
+ });
1870
+ return {
1871
+ mForm,
1872
+ activeTabName,
1873
+ tabs,
1874
+ filter,
1875
+ tabItems: (tab) => props.config.dynamic ? props.config.items : tab.items,
1876
+ tabClickHandler: (tab) => tabClickHandler(mForm, tab, props),
1877
+ onTabAdd: () => {
1878
+ if (!props.config.name)
1879
+ throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1880
+ if (typeof props.config.onTabAdd === "function") {
1881
+ props.config.onTabAdd(mForm, { model: props.model });
1882
+ } else if (tabs.value.length > 0) {
1883
+ const newObj = lodashEs.cloneDeep(tabs.value[0]);
1884
+ newObj.title = `\u6807\u7B7E${tabs.value.length + 1}`;
1885
+ props.model[props.config.name].push(newObj);
1886
+ }
1887
+ emit("change", props.model);
1888
+ mForm?.$emit("field-change", props.prop, props.model[props.config.name]);
1889
+ },
1890
+ onTabRemove: (tabName) => {
1891
+ if (!props.config.name)
1892
+ throw new Error("dynamic tab \u5FC5\u987B\u914D\u7F6Ename");
1893
+ if (typeof props.config.onTabRemove === "function") {
1894
+ props.config.onTabRemove(mForm, tabName, { model: props.model });
1895
+ } else {
1896
+ props.model[props.config.name].splice(+tabName, 1);
1897
+ if (tabName < activeTabName.value || activeTabName.value >= props.model[props.config.name].length) {
1898
+ activeTabName.value = (+activeTabName.value - 1).toString();
1899
+ tabClickHandler(mForm, { name: activeTabName.value }, props);
1900
+ }
1901
+ }
1902
+ emit("change", props.model);
1903
+ mForm?.$emit("field-change", props.prop, props.model[props.config.name]);
1904
+ },
1905
+ display: (displayConfig) => display(mForm, displayConfig, props),
1906
+ changeHandler: () => {
1907
+ emit("change", props.model);
1908
+ if (typeof props.config.onChange === "function") {
1909
+ props.config.onChange(mForm, { model: props.model });
1910
+ }
1911
+ }
1912
+ };
1913
+ }
1914
+ });
1915
+ const _sfc_main$k = Tab;
1916
+ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
1917
+ const _component_m_form_container = vue.resolveComponent("m-form-container");
1918
+ const _component_el_tab_pane = vue.resolveComponent("el-tab-pane");
1919
+ const _component_el_tabs = vue.resolveComponent("el-tabs");
1920
+ return vue.openBlock(), vue.createBlock(_component_el_tabs, {
1921
+ modelValue: _ctx.activeTabName,
1922
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.activeTabName = $event),
1923
+ class: vue.normalizeClass(_ctx.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"),
1924
+ type: _ctx.config.tabType,
1925
+ editable: _ctx.config.editable || false,
1926
+ "tab-position": _ctx.config.tabPosition || "top",
1927
+ onTabClick: _ctx.tabClickHandler,
1928
+ onTabAdd: _ctx.onTabAdd,
1929
+ onTabRemove: _ctx.onTabRemove
1930
+ }, {
1931
+ default: vue.withCtx(() => [
1932
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.tabs, (tab, tabIndex) => {
1933
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
1934
+ _ctx.display(tab.display) && _ctx.tabItems(tab).length ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
1935
+ key: tab[_ctx.mForm?.keyProp || "__key"] ?? tabIndex,
1936
+ name: _ctx.filter(tab.status) || tabIndex.toString(),
1937
+ label: _ctx.filter(tab.title),
1938
+ lazy: tab.lazy || false
1939
+ }, {
1940
+ default: vue.withCtx(() => [
1941
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.tabItems(tab), (item) => {
1942
+ return vue.openBlock(), vue.createBlock(_component_m_form_container, {
1943
+ key: item[_ctx.mForm?.keyProp || "__key"],
1944
+ config: item,
1945
+ model: _ctx.config.dynamic ? _ctx.model[_ctx.config.name || ""][tabIndex] : tab.name ? _ctx.model[tab.name] : _ctx.model,
1946
+ prop: _ctx.config.dynamic ? `${_ctx.prop}${_ctx.prop ? "." : ""}${String(tabIndex)}` : _ctx.prop,
1947
+ size: _ctx.size,
1948
+ "label-width": tab.labelWidth || _ctx.labelWidth,
1949
+ "expand-more": _ctx.expandMore,
1950
+ onChange: _ctx.changeHandler
1951
+ }, null, 8, ["config", "model", "prop", "size", "label-width", "expand-more", "onChange"]);
1952
+ }), 128))
1953
+ ]),
1954
+ _: 2
1955
+ }, 1032, ["name", "label", "lazy"])) : vue.createCommentVNode("", true)
1956
+ ], 64);
1957
+ }), 256))
1958
+ ]),
1959
+ _: 1
1960
+ }, 8, ["modelValue", "class", "type", "editable", "tab-position", "onTabClick", "onTabAdd", "onTabRemove"]);
1961
+ }
1962
+ var Tabs = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$h]]);
1963
+
1964
+ let $MAGIC_FORM = {};
1965
+ const setConfig = (option) => {
1966
+ $MAGIC_FORM = option;
1967
+ };
1968
+ const getConfig = (key) => $MAGIC_FORM[key];
1969
+
1970
+ var fieldProps = {
1971
+ model: {
1972
+ type: Object,
1973
+ required: true,
1974
+ default: () => ({})
1975
+ },
1976
+ name: {
1977
+ type: String,
1978
+ default: ""
1979
+ },
1980
+ disabled: {
1981
+ type: Boolean,
1982
+ default: false
1983
+ },
1984
+ size: String,
1985
+ prop: String,
1986
+ initValues: Object,
1987
+ values: Object
1988
+ };
1989
+
1990
+ const useAddField = (prop) => {
1991
+ if (!prop)
1992
+ return;
1993
+ const mForm = vue.inject("mForm");
1994
+ const instance = vue.getCurrentInstance();
1995
+ vue.watch(() => instance?.proxy, (vm) => {
1996
+ if (vm) {
1997
+ mForm?.setField(prop, vm);
1998
+ } else {
1999
+ mForm?.deleteField(prop);
2000
+ }
2001
+ }, {
2002
+ immediate: true
2003
+ });
2004
+ };
2005
+
2006
+ const _sfc_main$j = vue.defineComponent({
2007
+ name: "m-fields-cascader",
2008
+ props: {
2009
+ ...fieldProps,
2010
+ config: {
2011
+ type: Object,
2012
+ required: true
2013
+ }
2014
+ },
2015
+ emits: ["change"],
2016
+ setup(props, { emit }) {
2017
+ const mForm = vue.inject("mForm");
2018
+ const vm = vue.getCurrentInstance();
2019
+ useAddField(props.prop);
2020
+ const requestFunc = getConfig("request");
2021
+ const cascader = vue.ref(null);
2022
+ const dialog = vue.ref(null);
2023
+ const options = Array.isArray(props.config.options) ? vue.ref(props.config.options) : vue.ref([]);
2024
+ const remoteData = vue.ref(null);
2025
+ const setRemoteOptions = async function() {
2026
+ const { config } = props;
2027
+ const { option } = config;
2028
+ if (!option)
2029
+ return;
2030
+ let { body } = option;
2031
+ const postOptions = {
2032
+ url: option.url,
2033
+ cache: option.cache,
2034
+ timeout: option.timeout,
2035
+ data: {}
2036
+ };
2037
+ if (body && mForm) {
2038
+ if (typeof body === "function" && props.model && mForm) {
2039
+ body = body(mForm, {
2040
+ model: props.model,
2041
+ formValue: null,
2042
+ formValues: mForm.values
2043
+ });
2044
+ }
2045
+ postOptions.data = body;
2046
+ }
2047
+ const res = await requestFunc(postOptions);
2048
+ remoteData.value = res[option.root];
2049
+ if (remoteData.value && typeof option?.item === "function") {
2050
+ options.value = option.item(res[option.root]);
2051
+ }
2052
+ };
2053
+ if (typeof props.config.options === "function" && props.model && mForm) {
2054
+ vue.watchEffect(() => options.value = props.config.options(vm, { model: props.model, formValues: mForm.values }));
2055
+ } else if (!props.config.options || !props.config.options.length || props.config.remote) {
2056
+ Promise.resolve(setRemoteOptions());
2057
+ }
2058
+ const action = vue.computed(() => {
2059
+ if (props.config.add?.action.method === "post") {
2060
+ return (options2) => requestFunc({
2061
+ ...props.config?.add?.action.body,
2062
+ ...options2
2063
+ });
2064
+ }
2065
+ return null;
2066
+ });
2067
+ return {
2068
+ options,
2069
+ remoteData,
2070
+ addButtonStyle: {
2071
+ top: 0,
2072
+ left: 0,
2073
+ width: "auto"
2074
+ },
2075
+ dialogVisible: false,
2076
+ cascader,
2077
+ dialog,
2078
+ action,
2079
+ setRemoteOptions,
2080
+ changeHandler: (value) => {
2081
+ if (!cascader.value)
2082
+ return;
2083
+ cascader.value.query = "";
2084
+ cascader.value.previousQuery = null;
2085
+ emit("change", value);
2086
+ },
2087
+ addHandler: () => {
2088
+ if (!dialog.value)
2089
+ return;
2090
+ dialog.value.dialogVisible = true;
2091
+ },
2092
+ editAfterAction: () => {
2093
+ setRemoteOptions();
2094
+ }
2095
+ };
2096
+ }
2097
+ });
2098
+ const _hoisted_1$a = {
2099
+ class: "m-cascader",
2100
+ style: { "width": "100%" }
2101
+ };
2102
+ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
2103
+ const _component_el_cascader = vue.resolveComponent("el-cascader");
2104
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
2105
+ vue.createVNode(_component_el_cascader, {
2106
+ modelValue: _ctx.model[_ctx.name],
2107
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2108
+ ref: "cascader",
2109
+ style: { "width": "100%" },
2110
+ clearable: "",
2111
+ filterable: "",
2112
+ size: _ctx.size,
2113
+ placeholder: _ctx.config.placeholder,
2114
+ disabled: _ctx.disabled,
2115
+ options: _ctx.options,
2116
+ props: { multiple: _ctx.config.multiple },
2117
+ onChange: _ctx.changeHandler
2118
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "props", "onChange"])
2119
+ ]);
2120
+ }
2121
+ var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$g]]);
2122
+
2123
+ const _sfc_main$i = vue.defineComponent({
2124
+ name: "m-fields-checkbox",
2125
+ props: {
2126
+ ...fieldProps,
2127
+ config: {
2128
+ type: Object,
2129
+ required: true
2130
+ }
2131
+ },
2132
+ emits: ["change", "input"],
2133
+ setup(props, { emit }) {
2134
+ useAddField(props.prop);
2135
+ return {
2136
+ activeValue: vue.computed(() => {
2137
+ if (typeof props.config.activeValue === "undefined") {
2138
+ if (props.config.filter === "number") {
2139
+ return 1;
2140
+ }
2141
+ } else {
2142
+ return props.config.activeValue;
2143
+ }
2144
+ return "true";
2145
+ }),
2146
+ inactiveValue: vue.computed(() => {
2147
+ if (typeof props.config.inactiveValue === "undefined") {
2148
+ if (props.config.filter === "number") {
2149
+ return 0;
2150
+ }
2151
+ } else {
2152
+ return props.config.inactiveValue;
2153
+ }
2154
+ return "false";
2155
+ }),
2156
+ changeHandler(value) {
2157
+ emit("change", value);
2158
+ }
2159
+ };
2160
+ }
2161
+ });
2162
+ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
2163
+ const _component_el_checkbox = vue.resolveComponent("el-checkbox");
2164
+ return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
2165
+ modelValue: _ctx.model[_ctx.name],
2166
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2167
+ size: _ctx.size,
2168
+ trueLabel: _ctx.activeValue,
2169
+ falseLabel: _ctx.inactiveValue,
2170
+ disabled: _ctx.disabled,
2171
+ label: _ctx.config.text,
2172
+ onChange: _ctx.changeHandler
2173
+ }, null, 8, ["modelValue", "size", "trueLabel", "falseLabel", "disabled", "label", "onChange"]);
2174
+ }
2175
+ var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$f]]);
2176
+
2177
+ const _sfc_main$h = vue.defineComponent({
2178
+ name: "m-fields-checkbox-group",
2179
+ props: {
2180
+ ...fieldProps,
2181
+ config: {
2182
+ type: Object,
2183
+ required: true
2184
+ }
2185
+ },
2186
+ emits: ["change"],
2187
+ setup(props, { emit }) {
2188
+ useAddField(props.prop);
2189
+ if (props.model && !props.model[props.name]) {
2190
+ props.model[props.name] = [];
2191
+ }
2192
+ return {
2193
+ changeHandler: (v) => {
2194
+ emit("change", v);
2195
+ }
2196
+ };
2197
+ }
2198
+ });
2199
+ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
2200
+ const _component_el_checkbox = vue.resolveComponent("el-checkbox");
2201
+ const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
2202
+ return vue.openBlock(), vue.createBlock(_component_el_checkbox_group, {
2203
+ modelValue: _ctx.model[_ctx.name],
2204
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2205
+ size: _ctx.size,
2206
+ disabled: _ctx.disabled,
2207
+ onChange: _ctx.changeHandler
2208
+ }, {
2209
+ default: vue.withCtx(() => [
2210
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.options, (option) => {
2211
+ return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
2212
+ label: option.value,
2213
+ key: option.value
2214
+ }, {
2215
+ default: vue.withCtx(() => [
2216
+ vue.createTextVNode(vue.toDisplayString(option.text), 1)
2217
+ ]),
2218
+ _: 2
2219
+ }, 1032, ["label"]);
2220
+ }), 128))
2221
+ ]),
2222
+ _: 1
2223
+ }, 8, ["modelValue", "size", "disabled", "onChange"]);
2224
+ }
2225
+ var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$e]]);
2226
+
2227
+ const _hoisted_1$9 = { key: 0 };
2228
+ const __default__$2 = vue.defineComponent({
2229
+ name: "m-fields-color-picker"
2230
+ });
2231
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
2232
+ ...__default__$2,
2233
+ props: {
2234
+ ...fieldProps,
2235
+ config: {
2236
+ type: Object,
2237
+ required: true
2238
+ }
2239
+ },
2240
+ emits: ["change"],
2241
+ setup(__props, { emit }) {
2242
+ const props = __props;
2243
+ useAddField(props.prop);
2244
+ const changeHandler = (value) => emit("change", value);
2245
+ return (_ctx, _cache) => {
2246
+ const _component_el_color_picker = vue.resolveComponent("el-color-picker");
2247
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
2248
+ vue.createVNode(_component_el_color_picker, {
2249
+ modelValue: _ctx.model[_ctx.name],
2250
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2251
+ size: _ctx.size,
2252
+ disabled: _ctx.disabled,
2253
+ showAlpha: true,
2254
+ onChange: changeHandler
2255
+ }, null, 8, ["modelValue", "size", "disabled"])
2256
+ ])) : vue.createCommentVNode("", true);
2257
+ };
2258
+ }
2259
+ });
2260
+
2261
+ const _sfc_main$f = vue.defineComponent({
2262
+ name: "m-fields-date",
2263
+ props: {
2264
+ ...fieldProps,
2265
+ config: {
2266
+ type: Object,
2267
+ required: true
2268
+ }
2269
+ },
2270
+ emits: ["change", "input"],
2271
+ setup(props, { emit }) {
2272
+ useAddField(props.prop);
2273
+ const modelName = vue.computed(() => props.prop || props.config.name || "");
2274
+ props.model[modelName.value] = utils.datetimeFormatter(props.model[modelName.value], "");
2275
+ return {
2276
+ modelName,
2277
+ changeHandler(v) {
2278
+ emit("change", v);
2279
+ }
2280
+ };
2281
+ }
2282
+ });
2283
+ const _hoisted_1$8 = { key: 0 };
2284
+ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
2285
+ const _component_el_date_picker = vue.resolveComponent("el-date-picker");
2286
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$8, [
2287
+ vue.createVNode(_component_el_date_picker, {
2288
+ modelValue: _ctx.model[_ctx.modelName],
2289
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.modelName] = $event),
2290
+ type: "date",
2291
+ size: _ctx.size,
2292
+ placeholder: _ctx.config.placeholder,
2293
+ disabled: _ctx.disabled,
2294
+ format: _ctx.config.format,
2295
+ "value-format": _ctx.config.format || "YYYY-MM-DD HH:mm:ss",
2296
+ onChange: _ctx.changeHandler
2297
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "onChange"])
2298
+ ])) : vue.createCommentVNode("", true);
2299
+ }
2300
+ var Date$1 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$d]]);
2301
+
2302
+ const _sfc_main$e = vue.defineComponent({
2303
+ name: "m-fields-daterange",
2304
+ props: {
2305
+ ...fieldProps,
2306
+ config: {
2307
+ type: Object,
2308
+ required: true
2309
+ }
2310
+ },
2311
+ emits: ["change"],
2312
+ setup(props, { emit }) {
2313
+ useAddField(props.prop);
2314
+ const { names } = props.config;
2315
+ const value = vue.ref([]);
2316
+ if (props.model !== void 0) {
2317
+ if (names?.length) {
2318
+ value.value = names.map((item) => utils.datetimeFormatter(props.model?.[item], ""));
2319
+ } else if (props.name && props.model[props.name]) {
2320
+ value.value = props.model[props.name].map((item) => utils.datetimeFormatter(item, ""));
2321
+ }
2322
+ }
2323
+ const setValue = (v) => {
2324
+ if (names?.length && v instanceof Array) {
2325
+ names.forEach((item, index) => {
2326
+ if (props.model) {
2327
+ props.model[item] = utils.datetimeFormatter(v[index].toString(), "");
2328
+ }
2329
+ });
2330
+ } else if (props.model && props.name && v instanceof Date) {
2331
+ props.model[props.name] = utils.datetimeFormatter(v.toString(), "");
2332
+ }
2333
+ };
2334
+ return {
2335
+ value,
2336
+ changeHandler(v) {
2337
+ setValue(v);
2338
+ emit("change", v);
2339
+ }
2340
+ };
2341
+ }
2342
+ });
2343
+ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
2344
+ const _component_el_date_picker = vue.resolveComponent("el-date-picker");
2345
+ return vue.openBlock(), vue.createElementBlock("div", null, [
2346
+ vue.createVNode(_component_el_date_picker, {
2347
+ modelValue: _ctx.value,
2348
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.value = $event),
2349
+ type: "datetimerange",
2350
+ "range-separator": "-",
2351
+ "start-placeholder": "\u5F00\u59CB\u65E5\u671F",
2352
+ "end-placeholder": "\u7ED3\u675F\u65E5\u671F",
2353
+ size: _ctx.size,
2354
+ "unlink-panels": true,
2355
+ disabled: _ctx.disabled,
2356
+ onChange: _ctx.changeHandler
2357
+ }, null, 8, ["modelValue", "size", "disabled", "onChange"])
2358
+ ]);
2359
+ }
2360
+ var Daterange = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$c]]);
2361
+
2362
+ const _sfc_main$d = vue.defineComponent({
2363
+ name: "m-fields-datetime",
2364
+ props: {
2365
+ ...fieldProps,
2366
+ config: {
2367
+ type: Object,
2368
+ required: true
2369
+ }
2370
+ },
2371
+ emits: ["change"],
2372
+ setup(props, { emit }) {
2373
+ useAddField(props.prop);
2374
+ const value = props.model?.[props.name].toString();
2375
+ if (props.model) {
2376
+ if (value === "Invalid Date") {
2377
+ props.model[props.name] = "";
2378
+ } else {
2379
+ props.model[props.name] = utils.datetimeFormatter(props.model[props.name], "", props.config.valueFormat);
2380
+ }
2381
+ }
2382
+ return {
2383
+ value,
2384
+ changeHandler: (v) => {
2385
+ emit("change", v);
2386
+ }
2387
+ };
2388
+ }
2389
+ });
2390
+ const _hoisted_1$7 = { key: 0 };
2391
+ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
2392
+ const _component_el_date_picker = vue.resolveComponent("el-date-picker");
2393
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, [
2394
+ vue.createVNode(_component_el_date_picker, {
2395
+ modelValue: _ctx.model[_ctx.name],
2396
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2397
+ "popper-class": "magic-datetime-picker-popper",
2398
+ type: "datetime",
2399
+ size: _ctx.size,
2400
+ placeholder: _ctx.config.placeholder,
2401
+ disabled: _ctx.disabled,
2402
+ format: _ctx.config.format || "YYYY-MM-DD HH:mm:ss",
2403
+ "value-format": _ctx.config.valueFormat || "YYYY-MM-DD HH:mm:ss",
2404
+ onChange: _ctx.changeHandler
2405
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "onChange"])
2406
+ ])) : vue.createCommentVNode("", true);
2407
+ }
2408
+ var DateTime = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$b]]);
2409
+
2410
+ const _hoisted_1$6 = { key: 0 };
2411
+ const __default__$1 = vue.defineComponent({
2412
+ name: "m-fields-display"
2413
+ });
2414
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
2415
+ ...__default__$1,
2416
+ props: {
2417
+ ...fieldProps,
2418
+ config: {
2419
+ type: Object,
2420
+ required: true
2421
+ }
2422
+ },
2423
+ setup(__props) {
2424
+ const props = __props;
2425
+ const n = vue.computed(() => props.name || props.config.name || "");
2426
+ if (props.config.initValue && n.value && props.model) {
2427
+ props.model[n.value] = props.config.initValue;
2428
+ }
2429
+ useAddField(props.prop);
2430
+ return (_ctx, _cache) => {
2431
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$6, vue.toDisplayString(_ctx.model[vue.unref(n)]), 1)) : vue.createCommentVNode("", true);
2432
+ };
2433
+ }
2434
+ });
2435
+
2436
+ const _sfc_main$b = vue.defineComponent({
2437
+ name: "m-fields-dynamic-field",
2438
+ props: {
2439
+ ...fieldProps,
2440
+ config: {
2441
+ type: Object,
2442
+ required: true
2443
+ }
2444
+ },
2445
+ emits: ["change"],
2446
+ setup(props, { emit }) {
2447
+ useAddField(props.prop);
2448
+ const request = getConfig("request");
2449
+ const fieldMap = vue.reactive({
2450
+ value: {}
2451
+ });
2452
+ const fieldLabelMap = vue.reactive({
2453
+ value: {}
2454
+ });
2455
+ const changeFieldMap = async () => {
2456
+ if (typeof props.config.returnFields !== "function" || !props.model)
2457
+ return;
2458
+ const fields = await props.config.returnFields(props.config, props.model, request);
2459
+ fieldMap.value = {};
2460
+ fieldLabelMap.value = {};
2461
+ fields.forEach((v) => {
2462
+ if (typeof v !== "object" || v.name === void 0)
2463
+ return;
2464
+ let oldVal = props.model?.[v.name] || "";
2465
+ if (!oldVal && v.defaultValue !== void 0) {
2466
+ oldVal = v.defaultValue;
2467
+ emit("change", oldVal, v.name);
2468
+ }
2469
+ fieldMap.value[v.name] = oldVal;
2470
+ fieldLabelMap.value[v.name] = v.label || "";
2471
+ });
2472
+ };
2473
+ const unwatch = vue.watch(() => props.model?.[props.config.dynamicKey], (val) => {
2474
+ if (val !== "") {
2475
+ changeFieldMap();
2476
+ }
2477
+ }, {
2478
+ immediate: true
2479
+ });
2480
+ vue.onBeforeUnmount(() => {
2481
+ if (typeof unwatch === "function") {
2482
+ unwatch();
2483
+ }
2484
+ });
2485
+ return {
2486
+ request,
2487
+ fieldMap,
2488
+ fieldLabelMap,
2489
+ unwatch,
2490
+ changeFieldMap,
2491
+ inputChangeHandler: (key) => {
2492
+ emit("change", fieldMap.value[key], key);
2493
+ }
2494
+ };
2495
+ },
2496
+ methods: {
2497
+ init() {
2498
+ }
2499
+ }
2500
+ });
2501
+ const _hoisted_1$5 = { class: "m-fields-dynamic-field" };
2502
+ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
2503
+ const _component_el_input = vue.resolveComponent("el-input");
2504
+ const _component_el_form_item = vue.resolveComponent("el-form-item");
2505
+ const _component_el_form = vue.resolveComponent("el-form");
2506
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$5, [
2507
+ vue.createVNode(_component_el_form, { size: "small" }, {
2508
+ default: vue.withCtx(() => [
2509
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(Object.keys(_ctx.fieldMap.value), (key) => {
2510
+ return vue.openBlock(), vue.createBlock(_component_el_form_item, {
2511
+ key,
2512
+ label: _ctx.fieldLabelMap.value[key]
2513
+ }, {
2514
+ default: vue.withCtx(() => [
2515
+ vue.createVNode(_component_el_input, {
2516
+ modelValue: _ctx.fieldMap.value[key],
2517
+ "onUpdate:modelValue": ($event) => _ctx.fieldMap.value[key] = $event,
2518
+ placeholder: _ctx.fieldLabelMap.value[key],
2519
+ onChange: ($event) => _ctx.inputChangeHandler(key)
2520
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "onChange"])
2521
+ ]),
2522
+ _: 2
2523
+ }, 1032, ["label"]);
2524
+ }), 128))
2525
+ ]),
2526
+ _: 1
2527
+ })
2528
+ ]);
2529
+ }
2530
+ var DynamicField = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$a]]);
2531
+
2532
+ const __default__ = vue.defineComponent({
2533
+ name: "m-fields-hidden"
2534
+ });
2535
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
2536
+ ...__default__,
2537
+ props: {
2538
+ ...fieldProps,
2539
+ config: {
2540
+ type: Object,
2541
+ required: true
2542
+ }
2543
+ },
2544
+ setup(__props) {
2545
+ const props = __props;
2546
+ const n = vue.computed(() => props.name || props.config.name || "");
2547
+ useAddField(props.prop);
2548
+ return (_ctx, _cache) => {
2549
+ return _ctx.model ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
2550
+ key: 0,
2551
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[vue.unref(n)] = $event),
2552
+ type: "hidden"
2553
+ }, null, 512)), [
2554
+ [vue.vModelText, _ctx.model[vue.unref(n)]]
2555
+ ]) : vue.createCommentVNode("", true);
2556
+ };
2557
+ }
2558
+ });
2559
+
2560
+ const _sfc_main$9 = vue.defineComponent({
2561
+ name: "m-fields-link",
2562
+ props: {
2563
+ ...fieldProps,
2564
+ config: {
2565
+ type: Object,
2566
+ required: true
2567
+ }
2568
+ },
2569
+ emits: ["change"],
2570
+ setup(props, { emit }) {
2571
+ useAddField(props.prop);
2572
+ const formValue = vue.ref({});
2573
+ const editor = vue.ref();
2574
+ const mForm = vue.inject("mForm");
2575
+ const href = vue.computed(() => {
2576
+ if (typeof props.config.href === "function" && props.model) {
2577
+ return props.config.href(props.model);
2578
+ }
2579
+ return props.config.href || props.model?.[props.name];
2580
+ });
2581
+ const init = () => {
2582
+ formValue.value = props.model?.[props.name] || {};
2583
+ };
2584
+ return {
2585
+ formValue,
2586
+ editor,
2587
+ href,
2588
+ formConfig: vue.computed(() => {
2589
+ if (typeof props.config.form === "function") {
2590
+ return props.config.form(mForm, {
2591
+ model: props.model || {},
2592
+ values: props.values || {}
2593
+ });
2594
+ }
2595
+ return props.config.form;
2596
+ }),
2597
+ disable: vue.computed(() => {
2598
+ if (typeof props.config.disabled !== "undefined") {
2599
+ return props.config.disabled;
2600
+ }
2601
+ return !href.value;
2602
+ }),
2603
+ displayText: vue.computed(() => {
2604
+ if (typeof props.config.displayText === "function") {
2605
+ return props.config.displayText(mForm, { model: props.model || {} });
2606
+ }
2607
+ if (props.config.displayText) {
2608
+ return props.config.displayText;
2609
+ }
2610
+ return "\u8DF3\u8F6C";
2611
+ }),
2612
+ init,
2613
+ editHandler: () => {
2614
+ init();
2615
+ editor.value && (editor.value.dialogVisible = true);
2616
+ },
2617
+ action: (data) => {
2618
+ if (props.model) {
2619
+ props.model[props.name] = data;
2620
+ formValue.value = data;
2621
+ emit("change", props.model[props.name]);
2622
+ }
2623
+ editor.value && (editor.value.dialogVisible = false);
2624
+ }
2625
+ };
2626
+ }
2627
+ });
2628
+ const _hoisted_1$4 = ["href"];
2629
+ const _hoisted_2$1 = {
2630
+ key: 2,
2631
+ class: "m-fields-link"
2632
+ };
2633
+ const _hoisted_3$1 = /* @__PURE__ */ vue.createTextVNode("\u70B9\u51FB\u7F16\u8F91");
2634
+ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
2635
+ const _component_el_button = vue.resolveComponent("el-button");
2636
+ const _component_m_form_dialog = vue.resolveComponent("m-form-dialog");
2637
+ return _ctx.config.href && !_ctx.disabled ? (vue.openBlock(), vue.createElementBlock("a", {
2638
+ key: 0,
2639
+ target: "_blank",
2640
+ href: _ctx.href,
2641
+ style: vue.normalizeStyle(_ctx.config.css || {})
2642
+ }, vue.toDisplayString(_ctx.displayText), 13, _hoisted_1$4)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
2643
+ key: 1,
2644
+ style: vue.normalizeStyle(_ctx.config.disabledCss || {})
2645
+ }, vue.toDisplayString(_ctx.displayText), 5)) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
2646
+ vue.createVNode(_component_el_button, {
2647
+ type: "text",
2648
+ onClick: _ctx.editHandler
2649
+ }, {
2650
+ default: vue.withCtx(() => [
2651
+ _hoisted_3$1
2652
+ ]),
2653
+ _: 1
2654
+ }, 8, ["onClick"]),
2655
+ vue.createVNode(_component_m_form_dialog, {
2656
+ ref: "editor",
2657
+ title: _ctx.config.formTitle || "\u7F16\u8F91\u6269\u5C55\u914D\u7F6E",
2658
+ width: _ctx.config.formWidth,
2659
+ values: _ctx.formValue,
2660
+ config: _ctx.formConfig,
2661
+ parentValues: _ctx.values,
2662
+ fullscreen: _ctx.config.fullscreen,
2663
+ onSubmit: _ctx.action
2664
+ }, null, 8, ["title", "width", "values", "config", "parentValues", "fullscreen", "onSubmit"])
2665
+ ]));
2666
+ }
2667
+ var Link = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$9]]);
2668
+
2669
+ const _sfc_main$8 = vue.defineComponent({
2670
+ name: "m-fields-number",
2671
+ props: {
2672
+ ...fieldProps,
2673
+ config: {
2674
+ type: Object,
2675
+ required: true
2676
+ }
2677
+ },
2678
+ emits: ["change", "input"],
2679
+ setup(props, { emit }) {
2680
+ useAddField(props.prop);
2681
+ const mForm = vue.inject("mForm");
2682
+ return {
2683
+ mForm,
2684
+ changeHandler: (value) => {
2685
+ emit("change", value);
2686
+ },
2687
+ inputHandler: (v) => {
2688
+ emit("input", v);
2689
+ mForm?.$emit("field-input", props.prop, v);
2690
+ }
2691
+ };
2692
+ }
2693
+ });
2694
+ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
2695
+ const _component_el_input_number = vue.resolveComponent("el-input-number");
2696
+ return _ctx.model ? (vue.openBlock(), vue.createBlock(_component_el_input_number, {
2697
+ key: 0,
2698
+ modelValue: _ctx.model[_ctx.name],
2699
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2700
+ clearable: "",
2701
+ "controls-position": "right",
2702
+ size: _ctx.size,
2703
+ max: _ctx.config.max,
2704
+ min: _ctx.config.min,
2705
+ step: _ctx.config.step,
2706
+ placeholder: _ctx.config.placeholder,
2707
+ disabled: _ctx.disabled,
2708
+ onChange: _ctx.changeHandler,
2709
+ onInput: _ctx.inputHandler
2710
+ }, null, 8, ["modelValue", "size", "max", "min", "step", "placeholder", "disabled", "onChange", "onInput"])) : vue.createCommentVNode("", true);
2711
+ }
2712
+ var Number$1 = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$8]]);
2713
+
2714
+ const _sfc_main$7 = vue.defineComponent({
2715
+ name: "m-fields-radio-group",
2716
+ props: {
2717
+ ...fieldProps,
2718
+ config: {
2719
+ type: Object,
2720
+ required: true
2721
+ }
2722
+ },
2723
+ emits: ["change"],
2724
+ setup(props, { emit }) {
2725
+ useAddField(props.prop);
2726
+ return {
2727
+ changeHandler: (v) => emit("change", v)
2728
+ };
2729
+ }
2730
+ });
2731
+ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
2732
+ const _component_el_radio = vue.resolveComponent("el-radio");
2733
+ const _component_el_radio_group = vue.resolveComponent("el-radio-group");
2734
+ return _ctx.model ? (vue.openBlock(), vue.createBlock(_component_el_radio_group, {
2735
+ key: 0,
2736
+ modelValue: _ctx.model[_ctx.name],
2737
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
2738
+ size: _ctx.size,
2739
+ disabled: _ctx.disabled,
2740
+ onChange: _ctx.changeHandler
2741
+ }, {
2742
+ default: vue.withCtx(() => [
2743
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config.options, (option) => {
2744
+ return vue.openBlock(), vue.createBlock(_component_el_radio, {
2745
+ label: option.value,
2746
+ key: option.value
2747
+ }, {
2748
+ default: vue.withCtx(() => [
2749
+ vue.createTextVNode(vue.toDisplayString(option.text), 1)
2750
+ ]),
2751
+ _: 2
2752
+ }, 1032, ["label"]);
2753
+ }), 128))
2754
+ ]),
2755
+ _: 1
2756
+ }, 8, ["modelValue", "size", "disabled", "onChange"])) : vue.createCommentVNode("", true);
2757
+ }
2758
+ var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$7]]);
2759
+
2760
+ const _sfc_main$6 = vue.defineComponent({
2761
+ name: "m-fields-select",
2762
+ props: {
2763
+ ...fieldProps,
2764
+ config: {
2765
+ type: Object,
2766
+ required: true
2767
+ }
2768
+ },
2769
+ emits: ["change"],
2770
+ setup(props, { emit }) {
2771
+ if (!props.model)
2772
+ throw new Error("\u4E0D\u80FD\u6CA1\u6709model");
2773
+ useAddField(props.prop);
2774
+ const select = vue.ref();
2775
+ const mForm = vue.inject("mForm");
2776
+ const options = vue.ref([]);
2777
+ const localOptions = vue.ref([]);
2778
+ const loading = vue.ref(false);
2779
+ const moreLoadingVisible = vue.ref(false);
2780
+ const total = vue.ref(0);
2781
+ const pgIndex = vue.ref(0);
2782
+ const pgSize = vue.ref(20);
2783
+ const query = vue.ref("");
2784
+ const remoteData = vue.ref([]);
2785
+ const remote = vue.ref(true);
2786
+ const equalValue = (value, v) => {
2787
+ if (typeof v === "object") {
2788
+ const key = props.config.valueKey || "value";
2789
+ return v[key] === value[key];
2790
+ }
2791
+ return value === v;
2792
+ };
2793
+ const mapOptions = (data) => {
2794
+ const { option } = props.config;
2795
+ const { text } = option;
2796
+ const { value } = option;
2797
+ return data.map((item) => ({
2798
+ text: typeof text === "function" ? text(item) : item[text || "text"],
2799
+ value: typeof value === "function" ? value(item) : item[value || "value"]
2800
+ }));
2801
+ };
2802
+ const getOptions = async () => {
2803
+ if (!props.model)
2804
+ return [];
2805
+ if (localOptions.value.length) {
2806
+ return localOptions.value;
2807
+ }
2808
+ loading.value = true;
2809
+ let items = [];
2810
+ const { config } = props;
2811
+ const { option } = config;
2812
+ let { body } = option;
2813
+ let postOptions = {
2814
+ method: option.method || "POST",
2815
+ url: option.url,
2816
+ cache: option.cache,
2817
+ timeout: option.timeout,
2818
+ mode: option.mode,
2819
+ headers: option.headers || {},
2820
+ json: option.json || false
2821
+ };
2822
+ if (body) {
2823
+ if (typeof body === "function") {
2824
+ body = body(mForm, {
2825
+ model: props.model,
2826
+ formValue: mForm?.values,
2827
+ formValues: mForm?.values
2828
+ });
2829
+ }
2830
+ body.query = query.value;
2831
+ body.pgSize = pgSize.value;
2832
+ body.pgIndex = pgIndex.value;
2833
+ postOptions.data = body;
2834
+ }
2835
+ const requestFuc = getConfig("request");
2836
+ if (typeof option.beforeRequest === "function") {
2837
+ postOptions = option.beforeRequest(mForm, postOptions, {
2838
+ model: props.model,
2839
+ formValue: mForm?.values
2840
+ });
2841
+ }
2842
+ if (option.method?.toLocaleLowerCase() === "jsonp") {
2843
+ postOptions.jsonpCallback = option.jsonpCallback || "callback";
2844
+ }
2845
+ let res = await requestFuc(postOptions);
2846
+ if (typeof option.afterRequest === "function") {
2847
+ res = option.afterRequest(mForm, res, {
2848
+ model: props.model,
2849
+ formValue: mForm?.values,
2850
+ formValues: mForm?.values
2851
+ });
2852
+ }
2853
+ const optionsData = res[option.root];
2854
+ if (res.total > 0) {
2855
+ total.value = res.total;
2856
+ }
2857
+ remoteData.value = remoteData.value.concat(optionsData);
2858
+ if (optionsData) {
2859
+ if (typeof option.item === "function") {
2860
+ items = option.item(optionsData);
2861
+ } else if (optionsData.map) {
2862
+ items = mapOptions(optionsData);
2863
+ }
2864
+ }
2865
+ loading.value = false;
2866
+ const selectedOptions = [];
2867
+ if (props.config.multiple && props.model[props.name]) {
2868
+ options.value.forEach((o) => {
2869
+ const isInclude = props.model?.[props.name].includes(o.value);
2870
+ if (isInclude && !items.find((op) => op.value === o.value)) {
2871
+ selectedOptions.push(o);
2872
+ }
2873
+ });
2874
+ }
2875
+ return pgIndex.value === 0 ? selectedOptions.concat(items) : options.value.concat(items);
2876
+ };
2877
+ const getInitLocalOption = async () => {
2878
+ if (!props.model)
2879
+ return [];
2880
+ const value = props.model[props.name];
2881
+ const { config } = props;
2882
+ localOptions.value = await getOptions();
2883
+ remote.value = false;
2884
+ if (config.group) {
2885
+ if (config.multiple && value.findIndex) {
2886
+ return localOptions.value.filter((group) => group.options.findIndex((item) => value.find((v) => equalValue(item.value, v)) > -1) > -1);
2887
+ }
2888
+ return localOptions.value.filter((group) => group.options.findIndex((item) => equalValue(item.value, value)) > -1);
2889
+ }
2890
+ if (config.multiple && value.findIndex) {
2891
+ return localOptions.value.filter((item) => value.findIndex((v) => equalValue(item.value, v)) > -1);
2892
+ }
2893
+ return localOptions.value.filter((item) => equalValue(item.value, value));
2894
+ };
2895
+ const getInitOption = async () => {
2896
+ if (!props.model)
2897
+ return [];
2898
+ const { config } = props;
2899
+ const { option } = config;
2900
+ let options2 = [];
2901
+ let url = option.initUrl;
2902
+ if (!url) {
2903
+ return getInitLocalOption();
2904
+ }
2905
+ if (typeof url === "function") {
2906
+ url = await url(mForm, { model: props.model, formValue: mForm?.values });
2907
+ }
2908
+ const postOptions = {
2909
+ method: option.method || "POST",
2910
+ url,
2911
+ data: {
2912
+ id: props.model[props.name]
2913
+ },
2914
+ mode: option.mode,
2915
+ headers: option.headers || {},
2916
+ json: option.json || false
2917
+ };
2918
+ if (option.method?.toLocaleLowerCase() === "jsonp") {
2919
+ postOptions.jsonpCallback = option.jsonpCallback || "callback";
2920
+ }
2921
+ const requestFuc = getConfig("request");
2922
+ const res = await requestFuc(postOptions);
2923
+ let initData = res[option.root];
2924
+ if (initData) {
2925
+ if (!Array.isArray(initData)) {
2926
+ initData = [initData];
2927
+ }
2928
+ if (typeof option.item === "function") {
2929
+ options2 = option.item(initData);
2930
+ } else if (initData.map) {
2931
+ options2 = mapOptions(initData);
2932
+ }
2933
+ }
2934
+ return options2;
2935
+ };
2936
+ if (typeof props.config.options === "function") {
2937
+ vue.watch(() => mForm?.values, () => {
2938
+ typeof props.config.options === "function" && Promise.resolve(props.config.options(mForm, {
2939
+ model: props.model,
2940
+ formValues: mForm?.values,
2941
+ formValue: mForm?.values
2942
+ })).then((data) => {
2943
+ options.value = data;
2944
+ });
2945
+ }, {
2946
+ deep: true,
2947
+ immediate: true
2948
+ });
2949
+ } else if (Array.isArray(props.config.options)) {
2950
+ vue.watch(() => props.config.options, () => {
2951
+ options.value = props.config.options;
2952
+ }, { immediate: true });
2953
+ } else if (props.config.option) {
2954
+ vue.onBeforeMount(() => {
2955
+ if (!props.model)
2956
+ return;
2957
+ const v = props.model[props.name];
2958
+ if (Array.isArray(v) ? v.length : v) {
2959
+ getInitOption().then((data) => {
2960
+ options.value = data;
2961
+ });
2962
+ }
2963
+ });
2964
+ }
2965
+ props.config.remote && vue.onMounted(() => {
2966
+ select.value?.scrollbar.wrap$.addEventListener("scroll", async (e) => {
2967
+ const el = e.currentTarget;
2968
+ if (moreLoadingVisible.value) {
2969
+ return;
2970
+ }
2971
+ if (el.scrollHeight - el.clientHeight - el.scrollTop > 1) {
2972
+ return;
2973
+ }
2974
+ if (total.value <= options.value.length) {
2975
+ return;
2976
+ }
2977
+ moreLoadingVisible.value = true;
2978
+ pgIndex.value += 1;
2979
+ options.value = await getOptions();
2980
+ moreLoadingVisible.value = false;
2981
+ });
2982
+ });
2983
+ return {
2984
+ select,
2985
+ loading,
2986
+ remote,
2987
+ options,
2988
+ moreLoadingVisible,
2989
+ getRequestFuc() {
2990
+ return getConfig("request");
2991
+ },
2992
+ async getInitOption() {
2993
+ },
2994
+ changeHandler(value) {
2995
+ emit("change", value);
2996
+ },
2997
+ async visibleHandler(visible) {
2998
+ if (!visible)
2999
+ return;
3000
+ if (!props.config.remote)
3001
+ return;
3002
+ if (query.value && select.value) {
3003
+ select.value.query = query.value;
3004
+ select.value.previousQuery = query.value;
3005
+ select.value.selectedLabel = query.value;
3006
+ } else if (options.value.length <= (props.config.multiple ? props.model?.[props.name].length : 1)) {
3007
+ options.value = await getOptions();
3008
+ }
3009
+ },
3010
+ async editAfterAction() {
3011
+ pgIndex.value = 0;
3012
+ options.value = await getOptions();
3013
+ },
3014
+ async remoteMethod(q) {
3015
+ if (!localOptions.value.length) {
3016
+ query.value = q;
3017
+ pgIndex.value = 0;
3018
+ options.value = await getOptions();
3019
+ if (props.config.multiple)
3020
+ setTimeout(() => {
3021
+ select.value?.setSelected();
3022
+ }, 0);
3023
+ }
3024
+ }
3025
+ };
3026
+ }
3027
+ });
3028
+ const _hoisted_1$3 = { key: 2 };
3029
+ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
3030
+ const _component_el_option = vue.resolveComponent("el-option");
3031
+ const _component_el_option_group = vue.resolveComponent("el-option-group");
3032
+ const _component_el_select = vue.resolveComponent("el-select");
3033
+ const _directive_loading = vue.resolveDirective("loading");
3034
+ return _ctx.model ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_select, {
3035
+ key: 0,
3036
+ modelValue: _ctx.model[_ctx.name],
3037
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3038
+ class: "m-select",
3039
+ ref: "select",
3040
+ clearable: "",
3041
+ filterable: "",
3042
+ size: _ctx.size,
3043
+ remote: _ctx.remote,
3044
+ placeholder: _ctx.config.placeholder,
3045
+ multiple: _ctx.config.multiple,
3046
+ "value-key": _ctx.config.valueKey || "value",
3047
+ "allow-create": _ctx.config.allowCreate,
3048
+ disabled: _ctx.disabled,
3049
+ "remote-method": _ctx.remoteMethod,
3050
+ onChange: _ctx.changeHandler,
3051
+ onVisibleChange: _ctx.visibleHandler
3052
+ }, {
3053
+ default: vue.withCtx(() => [
3054
+ _ctx.config.group ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.options, (group, index) => {
3055
+ return vue.openBlock(), vue.createBlock(_component_el_option_group, {
3056
+ key: group.label + index,
3057
+ label: group.label,
3058
+ disabled: group.disabled
3059
+ }, {
3060
+ default: vue.withCtx(() => [
3061
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(group.options, (item, index2) => {
3062
+ return vue.openBlock(), vue.createBlock(_component_el_option, {
3063
+ key: item.label + index2,
3064
+ label: item.label,
3065
+ value: item.value,
3066
+ disabled: item.disabled
3067
+ }, null, 8, ["label", "value", "disabled"]);
3068
+ }), 128))
3069
+ ]),
3070
+ _: 2
3071
+ }, 1032, ["label", "disabled"]);
3072
+ }), 128)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.options, (option) => {
3073
+ return vue.openBlock(), vue.createBlock(_component_el_option, {
3074
+ label: option.text,
3075
+ value: option.value,
3076
+ key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value,
3077
+ disabled: option.disabled
3078
+ }, null, 8, ["label", "value", "disabled"]);
3079
+ }), 128)),
3080
+ _ctx.moreLoadingVisible ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, null, 512)), [
3081
+ [_directive_loading, true]
3082
+ ]) : vue.createCommentVNode("", true)
3083
+ ]),
3084
+ _: 1
3085
+ }, 8, ["modelValue", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method", "onChange", "onVisibleChange"])), [
3086
+ [_directive_loading, _ctx.loading]
3087
+ ]) : vue.createCommentVNode("", true);
3088
+ }
3089
+ var Select = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$6]]);
3090
+
3091
+ const _sfc_main$5 = vue.defineComponent({
3092
+ name: "m-fields-switch",
3093
+ props: {
3094
+ ...fieldProps,
3095
+ config: {
3096
+ type: Object,
3097
+ required: true
3098
+ }
3099
+ },
3100
+ emits: ["change"],
3101
+ setup(props, { emit }) {
3102
+ useAddField(props.prop);
3103
+ return {
3104
+ n: vue.computed(() => props.name || props.config.name || ""),
3105
+ activeValue: vue.computed(() => {
3106
+ if (typeof props.config.activeValue === "undefined") {
3107
+ if (props.config.filter === "number") {
3108
+ return 1;
3109
+ }
3110
+ } else {
3111
+ return props.config.activeValue;
3112
+ }
3113
+ return true;
3114
+ }),
3115
+ inactiveValue: vue.computed(() => {
3116
+ if (typeof props.config.inactiveValue === "undefined") {
3117
+ if (props.config.filter === "number") {
3118
+ return 0;
3119
+ }
3120
+ } else {
3121
+ return props.config.inactiveValue;
3122
+ }
3123
+ return false;
3124
+ }),
3125
+ changeHandler: (v) => {
3126
+ emit("change", v);
3127
+ }
3128
+ };
3129
+ }
3130
+ });
3131
+ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
3132
+ const _component_el_switch = vue.resolveComponent("el-switch");
3133
+ return _ctx.model ? (vue.openBlock(), vue.createBlock(_component_el_switch, {
3134
+ key: 0,
3135
+ modelValue: _ctx.model[_ctx.n],
3136
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.n] = $event),
3137
+ size: _ctx.size,
3138
+ activeValue: _ctx.activeValue,
3139
+ inactiveValue: _ctx.inactiveValue,
3140
+ disabled: _ctx.disabled,
3141
+ onChange: _ctx.changeHandler
3142
+ }, null, 8, ["modelValue", "size", "activeValue", "inactiveValue", "disabled", "onChange"])) : vue.createCommentVNode("", true);
3143
+ }
3144
+ var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
3145
+
3146
+ const _sfc_main$4 = vue.defineComponent({
3147
+ name: "m-fields-text",
3148
+ props: {
3149
+ ...fieldProps,
3150
+ config: {
3151
+ type: Object,
3152
+ required: true
3153
+ }
3154
+ },
3155
+ emits: ["change", "input"],
3156
+ setup(props, { emit }) {
3157
+ useAddField(props.prop);
3158
+ const modelName = vue.computed(() => props.name || props.config.name || "");
3159
+ return {
3160
+ modelName,
3161
+ changeHandler(v) {
3162
+ emit("change", v);
3163
+ },
3164
+ inputHandler(v) {
3165
+ const mForm = vue.inject("mForm");
3166
+ emit("input", v);
3167
+ mForm?.$emit("field-input", props.prop, v);
3168
+ },
3169
+ buttonClickHandler() {
3170
+ const mForm = vue.inject("mForm");
3171
+ if (typeof props.config.append === "string")
3172
+ return;
3173
+ if (props.config.append?.handler) {
3174
+ props.config.append.handler(mForm, {
3175
+ model: props.model,
3176
+ values: mForm?.values
3177
+ });
3178
+ }
3179
+ },
3180
+ keyUpHandler($event) {
3181
+ if (!props.model)
3182
+ return;
3183
+ if (!modelName.value)
3184
+ return;
3185
+ const arrowUp = $event.key === "ArrowUp";
3186
+ const arrowDown = $event.key === "ArrowDown";
3187
+ if (!arrowUp && !arrowDown) {
3188
+ return;
3189
+ }
3190
+ const value = props.model[modelName.value];
3191
+ let num;
3192
+ let unit;
3193
+ if (/^([0-9.]+)$/.test(value)) {
3194
+ num = +value;
3195
+ } else {
3196
+ value.replace(/^([0-9.]+)([a-z%]+)$/, ($0, $1, $2) => {
3197
+ num = +$1;
3198
+ unit = $2;
3199
+ });
3200
+ }
3201
+ if (num === void 0) {
3202
+ return;
3203
+ }
3204
+ const ctrl = navigator.platform.match("Mac") ? $event.metaKey : $event.ctrlKey;
3205
+ const shif = $event.shiftKey;
3206
+ const alt = $event.altKey;
3207
+ if (arrowUp) {
3208
+ if (ctrl) {
3209
+ num += 100;
3210
+ } else if (alt) {
3211
+ num = (num * 1e4 + 1e3) / 1e4;
3212
+ } else if (shif) {
3213
+ num = num + 10;
3214
+ } else {
3215
+ num += 1;
3216
+ }
3217
+ } else if (arrowDown) {
3218
+ if (ctrl) {
3219
+ num -= 100;
3220
+ } else if (alt) {
3221
+ num = (num * 1e4 - 1e3) / 1e4;
3222
+ } else if (shif) {
3223
+ num -= 10;
3224
+ } else {
3225
+ num -= 1;
3226
+ }
3227
+ }
3228
+ props.model[modelName.value] = `${num}${unit || ""}`;
3229
+ emit("change", props.model[modelName.value]);
3230
+ }
3231
+ };
3232
+ }
3233
+ });
3234
+ const _hoisted_1$2 = { key: 0 };
3235
+ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
3236
+ const _component_el_button = vue.resolveComponent("el-button");
3237
+ const _component_el_input = vue.resolveComponent("el-input");
3238
+ return vue.openBlock(), vue.createBlock(_component_el_input, {
3239
+ modelValue: _ctx.model[_ctx.modelName],
3240
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.modelName] = $event),
3241
+ clearable: "",
3242
+ size: _ctx.size,
3243
+ placeholder: _ctx.config.placeholder,
3244
+ disabled: _ctx.disabled,
3245
+ onChange: _ctx.changeHandler,
3246
+ onInput: _ctx.inputHandler,
3247
+ onKeyup: _cache[1] || (_cache[1] = ($event) => _ctx.keyUpHandler($event))
3248
+ }, vue.createSlots({ _: 2 }, [
3249
+ _ctx.config.append ? {
3250
+ name: "append",
3251
+ fn: vue.withCtx(() => [
3252
+ typeof _ctx.config.append === "string" ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$2, vue.toDisplayString(_ctx.config.append), 1)) : vue.createCommentVNode("", true),
3253
+ typeof _ctx.config.append === "object" && _ctx.config.append.type === "button" ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3254
+ key: 1,
3255
+ style: { "color": "#409eff" },
3256
+ onClick: _ctx.buttonClickHandler
3257
+ }, {
3258
+ default: vue.withCtx(() => [
3259
+ vue.createTextVNode(vue.toDisplayString(_ctx.config.append.text), 1)
3260
+ ]),
3261
+ _: 1
3262
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true)
3263
+ ])
3264
+ } : void 0
3265
+ ]), 1032, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"]);
3266
+ }
3267
+ var Text = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$4]]);
3268
+
3269
+ const _sfc_main$3 = vue.defineComponent({
3270
+ name: "m-fields-textarea",
3271
+ props: {
3272
+ ...fieldProps,
3273
+ config: {
3274
+ type: Object,
3275
+ required: true
3276
+ }
3277
+ },
3278
+ emits: {
3279
+ change(values) {
3280
+ return values;
3281
+ },
3282
+ input(values) {
3283
+ return values;
3284
+ }
3285
+ },
3286
+ setup(props, { emit }) {
3287
+ useAddField(props.prop);
3288
+ const mForm = vue.inject("mForm");
3289
+ return {
3290
+ mForm,
3291
+ changeHandler: (v) => {
3292
+ emit("change", v);
3293
+ },
3294
+ inputHandler: (v) => {
3295
+ emit("input", v);
3296
+ mForm?.$emit("field-input", props.prop, v);
3297
+ }
3298
+ };
3299
+ }
3300
+ });
3301
+ const _hoisted_1$1 = { key: 0 };
3302
+ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
3303
+ const _component_el_input = vue.resolveComponent("el-input");
3304
+ return _ctx.model ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
3305
+ vue.createVNode(_component_el_input, {
3306
+ modelValue: _ctx.model[_ctx.name],
3307
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3308
+ type: "textarea",
3309
+ size: _ctx.size,
3310
+ clearable: "",
3311
+ placeholder: _ctx.config.placeholder,
3312
+ disabled: _ctx.disabled,
3313
+ onChange: _ctx.changeHandler,
3314
+ onInput: _ctx.inputHandler
3315
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "onChange", "onInput"])
3316
+ ])) : vue.createCommentVNode("", true);
3317
+ }
3318
+ var Textarea = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
3319
+
3320
+ const _sfc_main$2 = vue.defineComponent({
3321
+ name: "m-fields-time",
3322
+ props: {
3323
+ ...fieldProps,
3324
+ config: {
3325
+ type: Object,
3326
+ required: true
3327
+ }
3328
+ },
3329
+ emits: {
3330
+ change(values) {
3331
+ return values;
3332
+ }
3333
+ },
3334
+ setup(props, { emit }) {
3335
+ useAddField(props.prop);
3336
+ return {
3337
+ changeHandler: (v) => {
3338
+ emit("change", v);
3339
+ }
3340
+ };
3341
+ }
3342
+ });
3343
+ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
3344
+ const _component_el_time_picker = vue.resolveComponent("el-time-picker");
3345
+ return vue.openBlock(), vue.createElementBlock("div", null, [
3346
+ vue.createVNode(_component_el_time_picker, {
3347
+ modelValue: _ctx.model[_ctx.name],
3348
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
3349
+ size: _ctx.size,
3350
+ "value-format": "HH:mm:ss",
3351
+ placeholder: _ctx.config.placeholder,
3352
+ disabled: _ctx.disabled,
3353
+ onChange: _ctx.changeHandler
3354
+ }, null, 8, ["modelValue", "size", "placeholder", "disabled", "onChange"])
3355
+ ]);
3356
+ }
3357
+ var Time = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
3358
+
3359
+ const _sfc_main$1 = vue.defineComponent({
3360
+ name: "m-form",
3361
+ components: { ElForm: elementPlus.ElForm, MContainer: Container },
3362
+ props: {
3363
+ initValues: {
3364
+ type: Object,
3365
+ required: true,
3366
+ default: () => ({})
3367
+ },
3368
+ parentValues: {
3369
+ type: Object,
3370
+ default: () => ({})
3371
+ },
3372
+ config: {
3373
+ type: Array,
3374
+ required: true,
3375
+ default: () => []
3376
+ },
3377
+ labelWidth: {
3378
+ type: String,
3379
+ default: () => "200px"
3380
+ },
3381
+ disabled: {
3382
+ type: Boolean,
3383
+ default: () => false
3384
+ },
3385
+ height: {
3386
+ type: String,
3387
+ default: () => "auto"
3388
+ },
3389
+ stepActive: {
3390
+ type: [String, Number],
3391
+ default: () => 1
3392
+ },
3393
+ size: {
3394
+ type: String,
3395
+ default: "small"
3396
+ },
3397
+ inline: {
3398
+ type: Boolean,
3399
+ default: false
3400
+ },
3401
+ labelPosition: {
3402
+ type: String,
3403
+ default: "right"
3404
+ },
3405
+ keyProp: {
3406
+ type: String,
3407
+ default: "__key"
3408
+ }
3409
+ },
3410
+ emits: ["change", "field-input", "field-change"],
3411
+ setup(props, { emit }) {
3412
+ const elForm = vue.ref();
3413
+ const initialized = vue.ref(false);
3414
+ const values = vue.ref({});
3415
+ const fields = /* @__PURE__ */ new Map();
3416
+ const requestFuc = getConfig("request");
3417
+ const formState = vue.reactive({
3418
+ keyProp: props.keyProp,
3419
+ config: props.config,
3420
+ initValues: props.initValues,
3421
+ parentValues: props.parentValues,
3422
+ values,
3423
+ $emit: emit,
3424
+ fields,
3425
+ setField: (prop, field) => fields.set(prop, field),
3426
+ getField: (prop) => fields.get(prop),
3427
+ deleteField: (prop) => fields.delete(prop),
3428
+ post: (options) => {
3429
+ if (requestFuc) {
3430
+ return requestFuc({
3431
+ ...options,
3432
+ method: "POST"
3433
+ });
3434
+ }
3435
+ }
3436
+ });
3437
+ vue.provide("mForm", formState);
3438
+ vue.watchEffect(() => {
3439
+ initialized.value = false;
3440
+ initValue(formState, {
3441
+ initValues: props.initValues,
3442
+ config: props.config
3443
+ }).then((value) => {
3444
+ values.value = value;
3445
+ initialized.value = true;
3446
+ });
3447
+ });
3448
+ return {
3449
+ initialized,
3450
+ values,
3451
+ elForm,
3452
+ formState,
3453
+ changeHandler: () => {
3454
+ emit("change", values.value);
3455
+ },
3456
+ resetForm: () => elForm.value?.resetFields(),
3457
+ submitForm: async (native) => {
3458
+ try {
3459
+ await elForm.value?.validate();
3460
+ return native ? values.value : lodashEs.cloneDeep(values.value);
3461
+ } catch (invalidFields) {
3462
+ const error = [];
3463
+ Object.entries(invalidFields).forEach(([, ValidateError]) => {
3464
+ ValidateError.forEach(({ field, message }) => {
3465
+ if (field && message)
3466
+ error.push(`${field} -> ${message}`);
3467
+ if (field && !message)
3468
+ error.push(`${field} -> \u51FA\u73B0\u9519\u8BEF`);
3469
+ if (!field && message)
3470
+ error.push(`${message}`);
3471
+ });
3472
+ });
3473
+ throw new Error(error.join("<br>"));
3474
+ }
3475
+ }
3476
+ };
3477
+ }
3478
+ });
3479
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
3480
+ const _component_MContainer = vue.resolveComponent("MContainer");
3481
+ const _component_ElForm = vue.resolveComponent("ElForm");
3482
+ return _ctx.initialized && Array.isArray(_ctx.config) ? (vue.openBlock(), vue.createBlock(_component_ElForm, {
3483
+ key: 0,
3484
+ class: "m-form",
3485
+ ref: "elForm",
3486
+ model: _ctx.values,
3487
+ "label-width": _ctx.labelWidth,
3488
+ disabled: _ctx.disabled,
3489
+ style: vue.normalizeStyle(`height: ${_ctx.height}`),
3490
+ inline: _ctx.inline,
3491
+ "label-position": _ctx.labelPosition
3492
+ }, {
3493
+ default: vue.withCtx(() => [
3494
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.config, (item, index) => {
3495
+ return vue.openBlock(), vue.createBlock(_component_MContainer, {
3496
+ key: item[_ctx.keyProp] ?? index,
3497
+ config: item,
3498
+ model: _ctx.values,
3499
+ "label-width": item.labelWidth || _ctx.labelWidth,
3500
+ "step-active": _ctx.stepActive,
3501
+ size: _ctx.size,
3502
+ onChange: _ctx.changeHandler
3503
+ }, null, 8, ["config", "model", "label-width", "step-active", "size", "onChange"]);
3504
+ }), 128))
3505
+ ]),
3506
+ _: 1
3507
+ }, 8, ["model", "label-width", "disabled", "style", "inline", "label-position"])) : vue.createCommentVNode("", true);
3508
+ }
3509
+ var Form = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
3510
+
3511
+ const _sfc_main = vue.defineComponent({
3512
+ name: "m-form-dialog",
3513
+ props: {
3514
+ values: {
3515
+ type: Object,
3516
+ default: () => ({})
3517
+ },
3518
+ width: [Number, String],
3519
+ fullscreen: Boolean,
3520
+ title: String,
3521
+ config: {
3522
+ type: Array,
3523
+ required: true,
3524
+ default: () => []
3525
+ },
3526
+ labelWidth: [Number, String],
3527
+ confirmText: {
3528
+ type: String,
3529
+ default: "\u786E\u5B9A"
3530
+ }
3531
+ },
3532
+ emits: ["close", "submit", "error", "change"],
3533
+ setup(props, { emit }) {
3534
+ const form = vue.ref();
3535
+ const dialogVisible = vue.ref(false);
3536
+ const saveFetch = vue.ref(false);
3537
+ const stepActive = vue.ref(1);
3538
+ const bodyHeight = vue.ref(`${document.body.clientHeight - 194}px`);
3539
+ const stepCount = vue.computed(() => {
3540
+ const { length } = props.config;
3541
+ for (let index = 0; index < length; index++) {
3542
+ if (props.config[index].type === "step") {
3543
+ return props.config[index].items.length;
3544
+ }
3545
+ }
3546
+ return 0;
3547
+ });
3548
+ const hasStep = vue.computed(() => {
3549
+ const { length } = props.config;
3550
+ for (let index = 0; index < length; index++) {
3551
+ if (props.config[index].type === "step") {
3552
+ return true;
3553
+ }
3554
+ }
3555
+ return false;
3556
+ });
3557
+ const cancel = () => {
3558
+ dialogVisible.value = false;
3559
+ };
3560
+ const closeHandler = () => {
3561
+ stepActive.value = 1;
3562
+ emit("close");
3563
+ };
3564
+ const save = async () => {
3565
+ try {
3566
+ const values = await form.value?.submitForm();
3567
+ emit("submit", values);
3568
+ } catch (e) {
3569
+ emit("error", e);
3570
+ }
3571
+ };
3572
+ const preStep = () => {
3573
+ stepActive.value -= 1;
3574
+ };
3575
+ const nextStep = () => {
3576
+ stepActive.value += 1;
3577
+ };
3578
+ const changeHandler = (value) => {
3579
+ emit("change", value);
3580
+ };
3581
+ return {
3582
+ form,
3583
+ saveFetch,
3584
+ stepActive,
3585
+ dialogVisible,
3586
+ bodyHeight,
3587
+ stepCount,
3588
+ hasStep,
3589
+ cancel,
3590
+ closeHandler,
3591
+ save,
3592
+ preStep,
3593
+ nextStep,
3594
+ changeHandler
3595
+ };
3596
+ }
3597
+ });
3598
+ const _hoisted_1 = { style: { "min-height": "1px" } };
3599
+ const _hoisted_2 = /* @__PURE__ */ vue.createTextVNode("\u53D6 \u6D88");
3600
+ const _hoisted_3 = /* @__PURE__ */ vue.createTextVNode("\u4E0A\u4E00\u6B65");
3601
+ const _hoisted_4 = /* @__PURE__ */ vue.createTextVNode("\u4E0B\u4E00\u6B65");
3602
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
3603
+ const _component_m_form = vue.resolveComponent("m-form");
3604
+ const _component_el_col = vue.resolveComponent("el-col");
3605
+ const _component_el_button = vue.resolveComponent("el-button");
3606
+ const _component_el_row = vue.resolveComponent("el-row");
3607
+ const _component_el_dialog = vue.resolveComponent("el-dialog");
3608
+ return vue.openBlock(), vue.createElementBlock("div", null, [
3609
+ vue.createVNode(_component_el_dialog, {
3610
+ modelValue: _ctx.dialogVisible,
3611
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.dialogVisible = $event),
3612
+ "custom-class": "m-form-dialog",
3613
+ top: "20px",
3614
+ title: _ctx.title,
3615
+ appendToBody: true,
3616
+ width: _ctx.width,
3617
+ fullscreen: _ctx.fullscreen,
3618
+ "close-on-click-modal": false,
3619
+ onClose: _ctx.closeHandler
3620
+ }, {
3621
+ footer: vue.withCtx(() => [
3622
+ vue.createVNode(_component_el_row, { class: "dialog-footer" }, {
3623
+ default: vue.withCtx(() => [
3624
+ vue.createVNode(_component_el_col, {
3625
+ span: 12,
3626
+ style: { "text-align": "left" }
3627
+ }, {
3628
+ default: vue.withCtx(() => [
3629
+ vue.createElementVNode("div", _hoisted_1, [
3630
+ vue.renderSlot(_ctx.$slots, "left")
3631
+ ])
3632
+ ]),
3633
+ _: 3
3634
+ }),
3635
+ vue.createVNode(_component_el_col, { span: 12 }, {
3636
+ default: vue.withCtx(() => [
3637
+ vue.renderSlot(_ctx.$slots, "footer", {}, () => [
3638
+ vue.createVNode(_component_el_button, {
3639
+ onClick: _ctx.cancel,
3640
+ size: "small"
3641
+ }, {
3642
+ default: vue.withCtx(() => [
3643
+ _hoisted_2
3644
+ ]),
3645
+ _: 1
3646
+ }, 8, ["onClick"]),
3647
+ _ctx.hasStep && _ctx.stepActive > 1 ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3648
+ key: 0,
3649
+ type: "info",
3650
+ size: "small",
3651
+ onClick: _ctx.preStep
3652
+ }, {
3653
+ default: vue.withCtx(() => [
3654
+ _hoisted_3
3655
+ ]),
3656
+ _: 1
3657
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true),
3658
+ _ctx.hasStep && _ctx.stepCount > _ctx.stepActive ? (vue.openBlock(), vue.createBlock(_component_el_button, {
3659
+ key: 1,
3660
+ type: "info",
3661
+ size: "small",
3662
+ onClick: _ctx.nextStep
3663
+ }, {
3664
+ default: vue.withCtx(() => [
3665
+ _hoisted_4
3666
+ ]),
3667
+ _: 1
3668
+ }, 8, ["onClick"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
3669
+ key: 2,
3670
+ type: "primary",
3671
+ size: "small",
3672
+ loading: _ctx.saveFetch,
3673
+ onClick: _ctx.save
3674
+ }, {
3675
+ default: vue.withCtx(() => [
3676
+ vue.createTextVNode(vue.toDisplayString(_ctx.confirmText), 1)
3677
+ ]),
3678
+ _: 1
3679
+ }, 8, ["loading", "onClick"]))
3680
+ ])
3681
+ ]),
3682
+ _: 3
3683
+ })
3684
+ ]),
3685
+ _: 3
3686
+ })
3687
+ ]),
3688
+ default: vue.withCtx(() => [
3689
+ vue.createElementVNode("div", {
3690
+ class: "m-dialog-body",
3691
+ style: vue.normalizeStyle(`max-height: ${_ctx.bodyHeight}; overflow-y: auto; overflow-x: hidden;`)
3692
+ }, [
3693
+ vue.createVNode(_component_m_form, {
3694
+ modelValue: _ctx.stepActive,
3695
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.stepActive = $event),
3696
+ ref: "form",
3697
+ config: _ctx.config,
3698
+ "init-values": _ctx.values,
3699
+ "label-width": _ctx.labelWidth,
3700
+ onChange: _ctx.changeHandler
3701
+ }, null, 8, ["modelValue", "config", "init-values", "label-width", "onChange"]),
3702
+ vue.renderSlot(_ctx.$slots, "default")
3703
+ ], 4)
3704
+ ]),
3705
+ _: 3
3706
+ }, 8, ["modelValue", "title", "width", "fullscreen", "onClose"])
3707
+ ]);
3708
+ }
3709
+ var FormDialog = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
3710
+
3711
+ var index$1 = '';
3712
+
3713
+ const defaultInstallOpt = {};
3714
+ const install = (app, opt) => {
3715
+ const option = Object.assign(defaultInstallOpt, opt);
3716
+ app.config.globalProperties.$MAGIC_FORM = option;
3717
+ setConfig(option);
3718
+ app.component(Form.name, Form);
3719
+ app.component(FormDialog.name, FormDialog);
3720
+ app.component(Container.name, Container);
3721
+ app.component(Fieldset.name, Fieldset);
3722
+ app.component(GroupList.name, GroupList);
3723
+ app.component(Panel.name, Panel);
3724
+ app.component(Row.name, Row);
3725
+ app.component(MStep.name, MStep);
3726
+ app.component(Table.name, Table);
3727
+ app.component(Tabs.name, Tabs);
3728
+ app.component(Text.name, Text);
3729
+ app.component(Number$1.name, Number$1);
3730
+ app.component(Textarea.name, Textarea);
3731
+ app.component(_sfc_main$a.name, _sfc_main$a);
3732
+ app.component(Date$1.name, Date$1);
3733
+ app.component(DateTime.name, DateTime);
3734
+ app.component(Time.name, Time);
3735
+ app.component(Checkbox.name, Checkbox);
3736
+ app.component(Switch.name, Switch);
3737
+ app.component(Daterange.name, Daterange);
3738
+ app.component(_sfc_main$g.name, _sfc_main$g);
3739
+ app.component(CheckboxGroup.name, CheckboxGroup);
3740
+ app.component(RadioGroup.name, RadioGroup);
3741
+ app.component(_sfc_main$c.name, _sfc_main$c);
3742
+ app.component(Link.name, Link);
3743
+ app.component(Select.name, Select);
3744
+ app.component(Cascader.name, Cascader);
3745
+ app.component(DynamicField.name, DynamicField);
3746
+ };
3747
+ var index = {
3748
+ install
3749
+ };
3750
+
3751
+ exports.MCascader = Cascader;
3752
+ exports.MCheckbox = Checkbox;
3753
+ exports.MCheckboxGroup = CheckboxGroup;
3754
+ exports.MColorPicker = _sfc_main$g;
3755
+ exports.MContainer = Container;
3756
+ exports.MDate = Date$1;
3757
+ exports.MDateTime = DateTime;
3758
+ exports.MDaterange = Daterange;
3759
+ exports.MDisplay = _sfc_main$c;
3760
+ exports.MDynamicField = DynamicField;
3761
+ exports.MFieldset = Fieldset;
3762
+ exports.MForm = Form;
3763
+ exports.MFormDialog = FormDialog;
3764
+ exports.MGroupList = GroupList;
3765
+ exports.MHidden = _sfc_main$a;
3766
+ exports.MLink = Link;
3767
+ exports.MNumber = Number$1;
3768
+ exports.MPanel = Panel;
3769
+ exports.MRadioGroup = RadioGroup;
3770
+ exports.MRow = Row;
3771
+ exports.MSelect = Select;
3772
+ exports.MSwitch = Switch;
3773
+ exports.MTable = Table;
3774
+ exports.MTabs = Tabs;
3775
+ exports.MText = Text;
3776
+ exports.MTextarea = Textarea;
3777
+ exports.MTime = Time;
3778
+ exports["default"] = index;
3779
+ exports.display = display;
3780
+ exports.fieldProps = fieldProps;
3781
+ exports.filterFunction = filterFunction;
3782
+ exports.getRules = getRules;
3783
+ exports.initValue = initValue;
3784
+ exports.useAddField = useAddField;
3785
+
3786
+ Object.defineProperty(exports, '__esModule', { value: true });
3787
+ exports[Symbol.toStringTag] = 'Module';
3788
+
3789
+ }));
3790
+ //# sourceMappingURL=tmagic-form.umd.js.map