@tmagic/form 1.6.0 → 1.7.0-beta.0

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 (43) hide show
  1. package/dist/style.css +29 -3
  2. package/dist/tmagic-form.js +1788 -1581
  3. package/dist/tmagic-form.umd.cjs +1830 -1619
  4. package/package.json +6 -6
  5. package/src/Form.vue +18 -5
  6. package/src/containers/Container.vue +109 -134
  7. package/src/containers/Fieldset.vue +31 -7
  8. package/src/containers/FlexLayout.vue +59 -0
  9. package/src/containers/Tabs.vue +11 -1
  10. package/src/fields/Cascader.vue +25 -16
  11. package/src/fields/Checkbox.vue +3 -3
  12. package/src/fields/CheckboxGroup.vue +1 -1
  13. package/src/fields/ColorPicker.vue +2 -2
  14. package/src/fields/Date.vue +2 -2
  15. package/src/fields/DateTime.vue +2 -2
  16. package/src/fields/Daterange.vue +2 -2
  17. package/src/fields/Number.vue +2 -2
  18. package/src/fields/NumberRange.vue +6 -6
  19. package/src/fields/RadioGroup.vue +18 -16
  20. package/src/fields/Select.vue +2 -2
  21. package/src/fields/Switch.vue +2 -2
  22. package/src/fields/Text.vue +21 -9
  23. package/src/fields/Textarea.vue +2 -2
  24. package/src/fields/Time.vue +2 -2
  25. package/src/fields/Timerange.vue +2 -2
  26. package/src/index.ts +5 -2
  27. package/src/table/ActionsColumn.vue +97 -0
  28. package/src/table/SortColumn.vue +101 -0
  29. package/src/table/Table.vue +170 -0
  30. package/src/table/type.ts +18 -0
  31. package/src/table/useAdd.ts +111 -0
  32. package/src/table/useFullscreen.ts +28 -0
  33. package/src/table/useImport.ts +68 -0
  34. package/src/table/usePagination.ts +30 -0
  35. package/src/table/useSelection.ts +34 -0
  36. package/src/table/useSortable.ts +48 -0
  37. package/src/table/useTableColumns.ts +194 -0
  38. package/src/theme/container.scss +17 -0
  39. package/src/theme/form.scss +15 -3
  40. package/src/theme/text.scss +6 -0
  41. package/src/utils/form.ts +56 -2
  42. package/types/index.d.ts +103 -56
  43. package/src/containers/Table.vue +0 -681
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('@tmagic/utils'), require('dayjs'), require('dayjs/plugin/utc'), require('sortablejs'), require('@popperjs/core'), require('@tmagic/form-schema')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', '@tmagic/design', '@tmagic/utils', 'dayjs', 'dayjs/plugin/utc', 'sortablejs', '@popperjs/core', '@tmagic/form-schema'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.iconsVue, global.design, global.utils, global.dayjs, global.utc, global.Sortable, global.core, global.formSchema));
5
- })(this, (function (exports, vue, iconsVue, design, utils, dayjs, utc, Sortable, core, formSchema) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('@tmagic/design'), require('@tmagic/utils'), require('dayjs'), require('dayjs/plugin/utc'), require('@popperjs/core'), require('sortablejs'), require('@tmagic/form-schema')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', '@tmagic/design', '@tmagic/utils', 'dayjs', 'dayjs/plugin/utc', '@popperjs/core', 'sortablejs', '@tmagic/form-schema'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.iconsVue, global.design, global.utils, global.dayjs, global.utc, global.core, global.Sortable, global.formSchema));
5
+ })(this, (function (exports, vue, iconsVue, design, utils, dayjs, utc, core, Sortable, formSchema) { 'use strict';
6
6
 
7
7
  /** Detect free variable `global` from Node.js. */
8
8
  var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
@@ -2968,8 +2968,10 @@
2968
2968
  value[name] = getDefaultValue(mForm, item);
2969
2969
  }
2970
2970
  if (type === "fieldset" && checkbox) {
2971
- if (typeof value[name] === "object") {
2972
- value[name].value = typeof initValue2[name] === "object" ? initValue2[name].value || 0 : 0;
2971
+ const checkboxName = typeof checkbox === "object" && typeof checkbox.name === "string" ? checkbox.name : "value";
2972
+ const checkboxFalseValue = typeof checkbox === "object" && typeof checkbox.falseValue !== "undefined" ? checkbox.falseValue : 0;
2973
+ if (name && typeof value[name] === "object") {
2974
+ value[name][checkboxName] = typeof initValue2[name] === "object" ? initValue2[name][checkboxName] || checkboxFalseValue : checkboxFalseValue;
2973
2975
  }
2974
2976
  }
2975
2977
  };
@@ -2999,6 +3001,16 @@
2999
3001
  return createValues(mForm, items, initValue2, value);
3000
3002
  }
3001
3003
  setValue(mForm, value, initValue2, item);
3004
+ if (type === "table") {
3005
+ if (item.defautSort) {
3006
+ sortChange(value[name], item.defautSort);
3007
+ } else if (item.defaultSort) {
3008
+ sortChange(value[name], item.defaultSort);
3009
+ }
3010
+ if (item.sort && item.sortKey) {
3011
+ value[name].sort((a, b) => b[item.sortKey] - a[item.sortKey]);
3012
+ }
3013
+ }
3002
3014
  return value;
3003
3015
  };
3004
3016
  const createValues = function(mForm, config = [], initValue2 = {}, value = {}) {
@@ -3039,7 +3051,8 @@
3039
3051
  formValue: mForm?.values || props.model,
3040
3052
  prop: props.prop,
3041
3053
  config: props.config,
3042
- index: props.index
3054
+ index: props.index,
3055
+ getFormValue: (prop) => utils.getValueByKeyPath(prop, mForm?.values || props.model)
3043
3056
  });
3044
3057
  }
3045
3058
  return config;
@@ -3116,25 +3129,47 @@
3116
3129
  }
3117
3130
  return defaultValue;
3118
3131
  };
3132
+ const getDataByPage = (data = [], pagecontext, pagesize) => data.filter(
3133
+ (item, index) => index >= pagecontext * pagesize && index + 1 <= (pagecontext + 1) * pagesize
3134
+ );
3135
+ const sortArray = (data, newIndex, oldIndex, sortKey) => {
3136
+ if (newIndex === oldIndex) {
3137
+ return data;
3138
+ }
3139
+ if (newIndex < 0 || newIndex >= data.length || oldIndex < 0 || oldIndex >= data.length) {
3140
+ return data;
3141
+ }
3142
+ const newData = data.toSpliced(newIndex, 0, ...data.splice(oldIndex, 1));
3143
+ if (sortKey) {
3144
+ for (let i = newData.length - 1, v = 0; i >= 0; i--, v++) {
3145
+ newData[v][sortKey] = i;
3146
+ }
3147
+ }
3148
+ return newData;
3149
+ };
3150
+ const sortChange = (data, { prop, order }) => {
3151
+ if (order === "ascending") {
3152
+ data = data.sort((a, b) => a[prop] - b[prop]);
3153
+ } else if (order === "descending") {
3154
+ data = data.sort((a, b) => b[prop] - a[prop]);
3155
+ }
3156
+ };
3119
3157
 
3120
- const _hoisted_1$e = ["data-tmagic-id", "data-tmagic-form-item-prop"];
3158
+ const _hoisted_1$d = ["data-tmagic-id", "data-tmagic-form-item-prop"];
3121
3159
  const _hoisted_2$7 = ["innerHTML", "title"];
3122
- const _hoisted_3$5 = ["innerHTML"];
3160
+ const _hoisted_3$6 = ["innerHTML"];
3123
3161
  const _hoisted_4$3 = ["innerHTML"];
3124
- const _hoisted_5$3 = ["innerHTML"];
3125
- const _hoisted_6$2 = ["innerHTML", "title"];
3162
+ const _hoisted_5$3 = ["innerHTML", "title"];
3163
+ const _hoisted_6$1 = ["innerHTML"];
3126
3164
  const _hoisted_7$1 = ["innerHTML"];
3127
- const _hoisted_8$1 = ["innerHTML"];
3165
+ const _hoisted_8$1 = ["innerHTML", "title"];
3128
3166
  const _hoisted_9 = ["innerHTML"];
3129
- const _hoisted_10 = ["innerHTML", "title"];
3130
- const _hoisted_11 = ["innerHTML"];
3131
- const _hoisted_12 = ["innerHTML"];
3132
- const _hoisted_13 = ["innerHTML"];
3133
- const _hoisted_14 = {
3167
+ const _hoisted_10 = ["innerHTML"];
3168
+ const _hoisted_11 = {
3134
3169
  key: 5,
3135
3170
  style: { "text-align": "center" }
3136
3171
  };
3137
- const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
3172
+ const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
3138
3173
  ...{
3139
3174
  name: "MFormContainer"
3140
3175
  },
@@ -3188,8 +3223,19 @@
3188
3223
  });
3189
3224
  const disabled = vue.computed(() => props.disabled || filterFunction(mForm, props.config.disabled, props));
3190
3225
  const text = vue.computed(() => filterFunction(mForm, props.config.text, props));
3191
- const tooltip = vue.computed(() => filterFunction(mForm, props.config.tooltip, props));
3192
- const extra = vue.computed(() => filterFunction(mForm, props.config.extra, props));
3226
+ const tooltip = vue.computed(() => {
3227
+ const config = filterFunction(mForm, props.config.tooltip, props);
3228
+ if (typeof config === "string") {
3229
+ return {
3230
+ text: config,
3231
+ placement: "top"
3232
+ };
3233
+ }
3234
+ return {
3235
+ text: config?.text,
3236
+ placement: config?.placement || "top"
3237
+ };
3238
+ });
3193
3239
  const rule = vue.computed(() => getRules(mForm, props.config.rules, props));
3194
3240
  const type = vue.computed(() => {
3195
3241
  let { type: type2 } = props.config;
@@ -3205,6 +3251,22 @@
3205
3251
  }
3206
3252
  return value;
3207
3253
  });
3254
+ const fieldsProps = vue.computed(() => ({
3255
+ size: props.size,
3256
+ config: props.config,
3257
+ name: name.value,
3258
+ disabled: disabled.value,
3259
+ prop: itemProp.value,
3260
+ key: props.config[mForm?.keyProps],
3261
+ style: props.config.fieldStyle
3262
+ }));
3263
+ const formItemProps = vue.computed(() => ({
3264
+ prop: itemProp.value,
3265
+ labelWidth: itemLabelWidth.value,
3266
+ labelPosition: props.config.labelPosition,
3267
+ rules: rule.value,
3268
+ extra: filterFunction(mForm, props.config.extra, props)
3269
+ }));
3208
3270
  const itemLabelWidth = vue.computed(() => props.config.labelWidth ?? props.labelWidth);
3209
3271
  vue.watchEffect(() => {
3210
3272
  expand.value = props.expandMore;
@@ -3231,7 +3293,8 @@
3231
3293
  values: mForm?.initValues,
3232
3294
  formValue: mForm?.values,
3233
3295
  prop: itemProp.value,
3234
- config: props.config
3296
+ config: props.config,
3297
+ getFormValue: (prop) => utils.getValueByKeyPath(prop, mForm?.values || props.model)
3235
3298
  });
3236
3299
  }
3237
3300
  if (filter === "number") {
@@ -3259,27 +3322,50 @@
3259
3322
  }
3260
3323
  return true;
3261
3324
  };
3325
+ const createModelProxy = (target, setModelFn, pathPrefix = "") => {
3326
+ return new Proxy(target, {
3327
+ get: (obj, key2) => {
3328
+ const value = obj[key2];
3329
+ if (value && typeof value === "object") {
3330
+ const newPath = pathPrefix ? `${pathPrefix}.${key2}` : key2;
3331
+ return createModelProxy(value, setModelFn, newPath);
3332
+ }
3333
+ return value;
3334
+ },
3335
+ set: (obj, key2, value) => {
3336
+ setModelFn(pathPrefix ? `${pathPrefix}.${key2}` : key2, value);
3337
+ return true;
3338
+ }
3339
+ });
3340
+ };
3262
3341
  const onChangeHandler = async function(v, eventData = {}) {
3263
- const { filter, onChange, trim, dynamicKey } = props.config;
3342
+ const { filter, onChange, trim } = props.config;
3264
3343
  let value = vue.toRaw(v);
3265
3344
  const changeRecords = eventData.changeRecords || [];
3266
3345
  const newChangeRecords = [...changeRecords];
3267
3346
  try {
3268
3347
  value = filterHandler(filter, v);
3269
3348
  if (typeof onChange === "function") {
3349
+ const setModel = (key2, value2) => {
3350
+ if (props.config.name) {
3351
+ newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
3352
+ } else {
3353
+ newChangeRecords.push({ propPath: itemProp.value, value: value2 });
3354
+ }
3355
+ };
3356
+ const setFormValue = (key2, value2) => {
3357
+ newChangeRecords.push({ propPath: key2, value: value2 });
3358
+ };
3270
3359
  value = await onChange(mForm, value, {
3271
- model: props.model,
3272
- values: mForm?.initValues,
3273
- formValue: mForm?.values,
3360
+ model: createModelProxy(props.model, setModel),
3361
+ values: mForm ? vue.readonly(mForm.initValues) : null,
3362
+ formValue: createModelProxy(mForm?.values || {}, setFormValue),
3274
3363
  prop: itemProp.value,
3275
3364
  config: props.config,
3276
3365
  changeRecords: newChangeRecords,
3277
- setModel: (key2, value2) => {
3278
- utils.setValueByKeyPath(key2, value2, props.model);
3279
- if (props.config.name) {
3280
- newChangeRecords.push({ propPath: itemProp.value.replace(`${props.config.name}`, key2), value: value2 });
3281
- }
3282
- }
3366
+ setModel,
3367
+ setFormValue,
3368
+ getFormValue: (prop) => utils.getValueByKeyPath(prop, mForm?.values || props.model)
3283
3369
  }) ?? value;
3284
3370
  }
3285
3371
  value = trimHandler(trim, value) ?? value;
@@ -3288,15 +3374,8 @@
3288
3374
  }
3289
3375
  let valueProp = itemProp.value;
3290
3376
  if (hasModifyKey(eventData)) {
3291
- if (dynamicKey) {
3292
- props.model[eventData.modifyKey] = value;
3293
- } else if (isValidName()) {
3294
- props.model[name.value][eventData.modifyKey] = value;
3295
- }
3296
3377
  valueProp = valueProp ? `${valueProp}.${eventData.modifyKey}` : eventData.modifyKey;
3297
3378
  delete eventData.modifyKey;
3298
- } else if (isValidName() && props.model !== value && (v !== value || props.model[name.value] !== value)) {
3299
- props.model[name.value] = value;
3300
3379
  }
3301
3380
  if (changeRecords.length === 0) {
3302
3381
  newChangeRecords.push({
@@ -3312,103 +3391,73 @@
3312
3391
  return (_ctx, _cache) => {
3313
3392
  const _component_m_fields_hidden = vue.resolveComponent("m-fields-hidden");
3314
3393
  const _component_Container = vue.resolveComponent("Container", true);
3315
- return _ctx.config ? (vue.openBlock(), vue.createElementBlock("div", {
3316
- key: 0,
3317
- "data-tmagic-id": _ctx.config.id,
3394
+ return vue.openBlock(), vue.createElementBlock("div", {
3395
+ "data-tmagic-id": __props.config.id,
3318
3396
  "data-tmagic-form-item-prop": itemProp.value,
3319
- style: vue.normalizeStyle(_ctx.config.tip ? "display: flex;align-items: baseline;" : ""),
3320
- class: vue.normalizeClass(`m-form-container m-container-${type.value || ""} ${_ctx.config.className || ""}`)
3397
+ class: vue.normalizeClass(`m-form-container m-container-${type.value || ""} ${__props.config.className || ""}${__props.config.tip ? " has-tip" : ""}`),
3398
+ style: vue.normalizeStyle(__props.config.style)
3321
3399
  }, [
3322
- type.value === "hidden" ? (vue.openBlock(), vue.createBlock(_component_m_fields_hidden, {
3323
- key: 0,
3324
- model: _ctx.model,
3325
- config: _ctx.config,
3326
- name: _ctx.config.name,
3327
- disabled: disabled.value,
3328
- prop: itemProp.value
3329
- }, null, 8, ["model", "config", "name", "disabled", "prop"])) : items.value && !text.value && type.value && display$1.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3330
- key: key(_ctx.config),
3331
- size: _ctx.size,
3332
- model: _ctx.model,
3333
- "last-values": _ctx.lastValues,
3334
- "is-compare": _ctx.isCompare,
3335
- config: _ctx.config,
3336
- disabled: disabled.value,
3337
- name: name.value,
3338
- prop: itemProp.value,
3339
- "step-active": _ctx.stepActive,
3400
+ type.value === "hidden" ? (vue.openBlock(), vue.createBlock(_component_m_fields_hidden, vue.mergeProps({ key: 0 }, fieldsProps.value, { model: __props.model }), null, 16, ["model"])) : items.value && !text.value && type.value && display$1.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps({ key: 1 }, fieldsProps.value, {
3401
+ model: __props.model,
3402
+ "last-values": __props.lastValues,
3403
+ "is-compare": __props.isCompare,
3404
+ "step-active": __props.stepActive,
3340
3405
  "expand-more": expand.value,
3341
3406
  "label-width": itemLabelWidth.value,
3407
+ style: __props.config.fieldStyle,
3342
3408
  onChange: onChangeHandler,
3343
3409
  onAddDiffCount
3344
- }, null, 40, ["size", "model", "last-values", "is-compare", "config", "disabled", "name", "prop", "step-active", "expand-more", "label-width"])) : type.value && display$1.value && !showDiff.value ? (vue.openBlock(), vue.createElementBlock(
3410
+ }), null, 16, ["model", "last-values", "is-compare", "step-active", "expand-more", "label-width", "style"])) : type.value && display$1.value && !showDiff.value ? (vue.openBlock(), vue.createElementBlock(
3345
3411
  vue.Fragment,
3346
3412
  { key: 2 },
3347
3413
  [
3348
- vue.createVNode(vue.unref(design.TMagicFormItem), {
3349
- style: vue.normalizeStyle(_ctx.config.tip ? "flex: 1" : ""),
3350
- class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
3351
- prop: itemProp.value,
3352
- "label-width": itemLabelWidth.value,
3353
- "label-position": _ctx.config.labelPosition,
3354
- rules: rule.value
3355
- }, {
3414
+ vue.createVNode(vue.unref(design.TMagicFormItem), vue.mergeProps(formItemProps.value, {
3415
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }
3416
+ }), {
3356
3417
  label: vue.withCtx(() => [
3357
3418
  vue.createElementVNode("span", {
3358
- innerHTML: type.value === "checkbox" ? "" : text.value,
3359
- title: _ctx.config.labelTitle
3419
+ innerHTML: type.value === "checkbox" && !__props.config.useLabel ? "" : text.value,
3420
+ title: __props.config.labelTitle
3360
3421
  }, null, 8, _hoisted_2$7)
3361
3422
  ]),
3362
3423
  default: vue.withCtx(() => [
3363
- tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
3424
+ tooltip.value.text ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3425
+ key: 0,
3426
+ placement: tooltip.value.placement
3427
+ }, {
3364
3428
  content: vue.withCtx(() => [
3365
- vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_3$5)
3429
+ vue.createElementVNode("div", {
3430
+ innerHTML: tooltip.value.text
3431
+ }, null, 8, _hoisted_3$6)
3366
3432
  ]),
3367
3433
  default: vue.withCtx(() => [
3368
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3369
- key: key(_ctx.config),
3370
- size: _ctx.size,
3371
- model: _ctx.model,
3372
- "last-values": _ctx.lastValues,
3373
- config: _ctx.config,
3374
- name: name.value,
3375
- disabled: disabled.value,
3376
- prop: itemProp.value,
3434
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps(fieldsProps.value, {
3435
+ model: __props.model,
3436
+ "last-values": __props.lastValues,
3377
3437
  onChange: onChangeHandler,
3378
3438
  onAddDiffCount
3379
- }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"]))
3439
+ }), null, 16, ["model", "last-values"]))
3380
3440
  ]),
3381
3441
  _: 1
3382
3442
  /* STABLE */
3383
- })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3384
- key: key(_ctx.config),
3385
- size: _ctx.size,
3386
- model: _ctx.model,
3387
- "last-values": _ctx.lastValues,
3388
- config: _ctx.config,
3389
- name: name.value,
3390
- disabled: disabled.value,
3391
- prop: itemProp.value,
3443
+ }, 8, ["placement"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps({ key: 1 }, fieldsProps.value, {
3444
+ model: __props.model,
3445
+ "last-values": __props.lastValues,
3392
3446
  onChange: onChangeHandler,
3393
3447
  onAddDiffCount
3394
- }, null, 40, ["size", "model", "last-values", "config", "name", "disabled", "prop"])),
3395
- extra.value && type.value !== "table" ? (vue.openBlock(), vue.createElementBlock("div", {
3396
- key: 2,
3397
- innerHTML: extra.value,
3398
- class: "m-form-tip"
3399
- }, null, 8, _hoisted_4$3)) : vue.createCommentVNode("v-if", true)
3448
+ }), null, 16, ["model", "last-values"]))
3400
3449
  ]),
3401
3450
  _: 1
3402
3451
  /* STABLE */
3403
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
3404
- _ctx.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3452
+ }, 16, ["class"]),
3453
+ __props.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3405
3454
  key: 0,
3406
3455
  placement: "left"
3407
3456
  }, {
3408
3457
  content: vue.withCtx(() => [
3409
3458
  vue.createElementVNode("div", {
3410
- innerHTML: _ctx.config.tip
3411
- }, null, 8, _hoisted_5$3)
3459
+ innerHTML: __props.config.tip
3460
+ }, null, 8, _hoisted_4$3)
3412
3461
  ]),
3413
3462
  default: vue.withCtx(() => [
3414
3463
  vue.createVNode(vue.unref(design.TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -3431,66 +3480,49 @@
3431
3480
  [
3432
3481
  vue.createCommentVNode(" 对比 "),
3433
3482
  vue.createCommentVNode(" 上次内容 "),
3434
- vue.createVNode(vue.unref(design.TMagicFormItem), {
3435
- style: vue.normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#f7dadd" }]),
3436
- class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
3437
- prop: itemProp.value,
3438
- "label-width": itemLabelWidth.value,
3439
- "label-position": _ctx.config.labelPosition,
3440
- rules: rule.value
3441
- }, {
3483
+ vue.createVNode(vue.unref(design.TMagicFormItem), vue.mergeProps(formItemProps.value, {
3484
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
3485
+ }), {
3442
3486
  label: vue.withCtx(() => [
3443
3487
  vue.createElementVNode("span", {
3444
3488
  innerHTML: type.value === "checkbox" ? "" : text.value,
3445
- title: _ctx.config.labelTitle
3446
- }, null, 8, _hoisted_6$2)
3489
+ title: __props.config.labelTitle
3490
+ }, null, 8, _hoisted_5$3)
3447
3491
  ]),
3448
3492
  default: vue.withCtx(() => [
3449
- tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
3493
+ tooltip.value.text ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3494
+ key: 0,
3495
+ placement: tooltip.value.placement
3496
+ }, {
3450
3497
  content: vue.withCtx(() => [
3451
- vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_7$1)
3498
+ vue.createElementVNode("div", {
3499
+ innerHTML: tooltip.value.text
3500
+ }, null, 8, _hoisted_6$1)
3452
3501
  ]),
3453
3502
  default: vue.withCtx(() => [
3454
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3455
- key: key(_ctx.config),
3456
- size: _ctx.size,
3457
- model: _ctx.lastValues,
3458
- config: _ctx.config,
3459
- name: name.value,
3460
- disabled: disabled.value,
3461
- prop: itemProp.value,
3503
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps(fieldsProps.value, {
3504
+ model: __props.lastValues,
3462
3505
  onChange: onChangeHandler
3463
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
3506
+ }), null, 16, ["model"]))
3464
3507
  ]),
3465
3508
  _: 1
3466
3509
  /* STABLE */
3467
- })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3468
- key: key(_ctx.config),
3469
- size: _ctx.size,
3470
- model: _ctx.lastValues,
3471
- config: _ctx.config,
3472
- name: name.value,
3473
- disabled: disabled.value,
3474
- prop: itemProp.value,
3510
+ }, 8, ["placement"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps({ key: 1 }, fieldsProps.value, {
3511
+ model: __props.lastValues,
3475
3512
  onChange: onChangeHandler
3476
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
3477
- extra.value ? (vue.openBlock(), vue.createElementBlock("div", {
3478
- key: 2,
3479
- innerHTML: extra.value,
3480
- class: "m-form-tip"
3481
- }, null, 8, _hoisted_8$1)) : vue.createCommentVNode("v-if", true)
3513
+ }), null, 16, ["model"]))
3482
3514
  ]),
3483
3515
  _: 1
3484
3516
  /* STABLE */
3485
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
3486
- _ctx.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3517
+ }, 16, ["class"]),
3518
+ __props.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3487
3519
  key: 0,
3488
3520
  placement: "left"
3489
3521
  }, {
3490
3522
  content: vue.withCtx(() => [
3491
3523
  vue.createElementVNode("div", {
3492
- innerHTML: _ctx.config.tip
3493
- }, null, 8, _hoisted_9)
3524
+ innerHTML: __props.config.tip
3525
+ }, null, 8, _hoisted_7$1)
3494
3526
  ]),
3495
3527
  default: vue.withCtx(() => [
3496
3528
  vue.createVNode(vue.unref(design.TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -3505,66 +3537,50 @@
3505
3537
  /* STABLE */
3506
3538
  })) : vue.createCommentVNode("v-if", true),
3507
3539
  vue.createCommentVNode(" 当前内容 "),
3508
- vue.createVNode(vue.unref(design.TMagicFormItem), {
3509
- style: vue.normalizeStyle([_ctx.config.tip ? "flex: 1" : "", { "background": "#def7da" }]),
3510
- class: vue.normalizeClass({ "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value }),
3511
- prop: itemProp.value,
3512
- "label-width": itemLabelWidth.value,
3513
- "label-position": _ctx.config.labelPosition,
3514
- rules: rule.value
3515
- }, {
3540
+ vue.createVNode(vue.unref(design.TMagicFormItem), vue.mergeProps(formItemProps.value, {
3541
+ style: __props.config.tip ? "flex: 1" : "",
3542
+ class: { "tmagic-form-hidden": `${itemLabelWidth.value}` === "0" || !text.value, "show-diff": true }
3543
+ }), {
3516
3544
  label: vue.withCtx(() => [
3517
3545
  vue.createElementVNode("span", {
3518
3546
  innerHTML: type.value === "checkbox" ? "" : text.value,
3519
- title: _ctx.config.labelTitle
3520
- }, null, 8, _hoisted_10)
3547
+ title: __props.config.labelTitle
3548
+ }, null, 8, _hoisted_8$1)
3521
3549
  ]),
3522
3550
  default: vue.withCtx(() => [
3523
- tooltip.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), { key: 0 }, {
3551
+ tooltip.value.text ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3552
+ key: 0,
3553
+ placement: tooltip.value.placement
3554
+ }, {
3524
3555
  content: vue.withCtx(() => [
3525
- vue.createElementVNode("div", { innerHTML: tooltip.value }, null, 8, _hoisted_11)
3556
+ vue.createElementVNode("div", {
3557
+ innerHTML: tooltip.value.text
3558
+ }, null, 8, _hoisted_9)
3526
3559
  ]),
3527
3560
  default: vue.withCtx(() => [
3528
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3529
- key: key(_ctx.config),
3530
- size: _ctx.size,
3531
- model: _ctx.model,
3532
- config: _ctx.config,
3533
- name: name.value,
3534
- disabled: disabled.value,
3535
- prop: itemProp.value,
3561
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps(fieldsProps.value, {
3562
+ model: __props.model,
3536
3563
  onChange: onChangeHandler
3537
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"]))
3564
+ }), null, 16, ["model"]))
3538
3565
  ]),
3539
3566
  _: 1
3540
3567
  /* STABLE */
3541
- })) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), {
3542
- key: key(_ctx.config),
3543
- size: _ctx.size,
3544
- model: _ctx.model,
3545
- config: _ctx.config,
3546
- name: name.value,
3547
- disabled: disabled.value,
3548
- prop: itemProp.value,
3568
+ }, 8, ["placement"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(tagName.value), vue.mergeProps({ key: 1 }, fieldsProps.value, {
3569
+ model: __props.model,
3549
3570
  onChange: onChangeHandler
3550
- }, null, 40, ["size", "model", "config", "name", "disabled", "prop"])),
3551
- extra.value ? (vue.openBlock(), vue.createElementBlock("div", {
3552
- key: 2,
3553
- innerHTML: extra.value,
3554
- class: "m-form-tip"
3555
- }, null, 8, _hoisted_12)) : vue.createCommentVNode("v-if", true)
3571
+ }), null, 16, ["model"]))
3556
3572
  ]),
3557
3573
  _: 1
3558
3574
  /* STABLE */
3559
- }, 8, ["style", "class", "prop", "label-width", "label-position", "rules"]),
3560
- _ctx.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3575
+ }, 16, ["style", "class"]),
3576
+ __props.config.tip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
3561
3577
  key: 1,
3562
3578
  placement: "left"
3563
3579
  }, {
3564
3580
  content: vue.withCtx(() => [
3565
3581
  vue.createElementVNode("div", {
3566
- innerHTML: _ctx.config.tip
3567
- }, null, 8, _hoisted_13)
3582
+ innerHTML: __props.config.tip
3583
+ }, null, 8, _hoisted_10)
3568
3584
  ]),
3569
3585
  default: vue.withCtx(() => [
3570
3586
  vue.createVNode(vue.unref(design.TMagicIcon), { style: { "line-height": "40px", "margin-left": "5px" } }, {
@@ -3585,19 +3601,19 @@
3585
3601
  vue.Fragment,
3586
3602
  { key: 4 },
3587
3603
  [
3588
- (isValidName() ? _ctx.model[name.value] : _ctx.model) ? (vue.openBlock(true), vue.createElementBlock(
3604
+ (isValidName() ? __props.model[name.value] : __props.model) ? (vue.openBlock(true), vue.createElementBlock(
3589
3605
  vue.Fragment,
3590
3606
  { key: 0 },
3591
3607
  vue.renderList(items.value, (item) => {
3592
3608
  return vue.openBlock(), vue.createBlock(_component_Container, {
3593
3609
  key: key(item),
3594
- model: isValidName() ? _ctx.model[name.value] : _ctx.model,
3595
- "last-values": isValidName() ? _ctx.lastValues[name.value] || {} : _ctx.lastValues,
3596
- "is-compare": _ctx.isCompare,
3610
+ model: isValidName() ? __props.model[name.value] : __props.model,
3611
+ "last-values": isValidName() ? __props.lastValues[name.value] || {} : __props.lastValues,
3612
+ "is-compare": __props.isCompare,
3597
3613
  config: item,
3598
- size: _ctx.size,
3614
+ size: __props.size,
3599
3615
  disabled: disabled.value,
3600
- "step-active": _ctx.stepActive,
3616
+ "step-active": __props.stepActive,
3601
3617
  "expand-more": expand.value,
3602
3618
  "label-width": itemLabelWidth.value,
3603
3619
  prop: itemProp.value,
@@ -3612,7 +3628,7 @@
3612
3628
  64
3613
3629
  /* STABLE_FRAGMENT */
3614
3630
  )) : vue.createCommentVNode("v-if", true),
3615
- _ctx.config.expand && type.value !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_14, [
3631
+ __props.config.expand && type.value !== "fieldset" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_11, [
3616
3632
  vue.createVNode(vue.unref(design.TMagicButton), {
3617
3633
  type: "primary",
3618
3634
  size: "small",
@@ -3631,23 +3647,23 @@
3631
3647
  /* STABLE */
3632
3648
  })
3633
3649
  ])) : vue.createCommentVNode("v-if", true)
3634
- ], 14, _hoisted_1$e)) : vue.createCommentVNode("v-if", true);
3650
+ ], 14, _hoisted_1$d);
3635
3651
  };
3636
3652
  }
3637
3653
  });
3638
3654
 
3639
- const _hoisted_1$d = ["innerHTML"];
3655
+ const _hoisted_1$c = ["innerHTML"];
3640
3656
  const _hoisted_2$6 = ["innerHTML"];
3641
- const _hoisted_3$4 = { key: 1 };
3657
+ const _hoisted_3$5 = { key: 1 };
3642
3658
  const _hoisted_4$2 = ["innerHTML"];
3643
3659
  const _hoisted_5$2 = ["innerHTML"];
3644
- const _hoisted_6$1 = {
3660
+ const _hoisted_6 = {
3645
3661
  key: 2,
3646
3662
  style: { "display": "flex" }
3647
3663
  };
3648
3664
  const _hoisted_7 = { style: { "flex": "1" } };
3649
3665
  const _hoisted_8 = ["src"];
3650
- const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
3666
+ const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
3651
3667
  ...{
3652
3668
  name: "MFormFieldset"
3653
3669
  },
@@ -3669,9 +3685,27 @@
3669
3685
  const emit = __emit;
3670
3686
  const mForm = vue.inject("mForm");
3671
3687
  const name = vue.computed(() => props.config.name || "");
3688
+ const checkboxName = vue.computed(() => {
3689
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.name === "string") {
3690
+ return props.config.checkbox.name;
3691
+ }
3692
+ return "value";
3693
+ });
3694
+ const checkboxTrueValue = vue.computed(() => {
3695
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.trueValue !== "undefined") {
3696
+ return props.config.checkbox.trueValue;
3697
+ }
3698
+ return 1;
3699
+ });
3700
+ const checkboxFalseValue = vue.computed(() => {
3701
+ if (typeof props.config.checkbox === "object" && typeof props.config.checkbox.falseValue !== "undefined") {
3702
+ return props.config.checkbox.falseValue;
3703
+ }
3704
+ return 0;
3705
+ });
3672
3706
  const show = vue.computed(() => {
3673
- if (props.config.expand && name.value) {
3674
- return props.model[name.value]?.value;
3707
+ if (props.config.expand && checkboxName.value) {
3708
+ return (name.value ? props.model[name.value] : props.model)?.[checkboxName.value] === checkboxTrueValue.value;
3675
3709
  }
3676
3710
  return true;
3677
3711
  });
@@ -3682,13 +3716,13 @@
3682
3716
  return props.config.labelWidth || props.labelWidth || (props.config.text ? void 0 : "0");
3683
3717
  });
3684
3718
  const valueChangeHandler = (value) => {
3685
- emit("change", value, { modifyKey: "value" });
3719
+ emit("change", value, { modifyKey: checkboxName.value });
3686
3720
  };
3687
3721
  const changeHandler = (v, eventData) => emit("change", v, eventData);
3688
3722
  const key = (item, index) => item[mForm?.keyProp || "__key"] ?? index;
3689
3723
  const onAddDiffCount = () => emit("addDiffCount");
3690
3724
  return (_ctx, _cache) => {
3691
- return (name.value ? _ctx.model[name.value] : _ctx.model) ? (vue.openBlock(), vue.createElementBlock(
3725
+ return (name.value ? __props.model[name.value] : __props.model) ? (vue.openBlock(), vue.createElementBlock(
3692
3726
  "fieldset",
3693
3727
  {
3694
3728
  key: 0,
@@ -3696,63 +3730,60 @@
3696
3730
  style: vue.normalizeStyle(show.value ? "padding: 15px" : "border: 0")
3697
3731
  },
3698
3732
  [
3699
- name.value && _ctx.config.checkbox ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!show.value ? "div" : "legend"), { key: 0 }, {
3733
+ name.value && __props.config.checkbox ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!show.value ? "div" : "legend"), { key: 0 }, {
3700
3734
  default: vue.withCtx(() => [
3701
3735
  vue.createVNode(vue.unref(design.TMagicCheckbox), {
3702
- modelValue: _ctx.model[name.value].value,
3703
- "onUpdate:modelValue": [
3704
- _cache[0] || (_cache[0] = ($event) => _ctx.model[name.value].value = $event),
3705
- valueChangeHandler
3706
- ],
3707
- prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${_ctx.config.name}.value`,
3708
- "true-value": 1,
3709
- "false-value": 0
3736
+ "model-value": (name.value ? __props.model[name.value] : __props.model)[checkboxName.value],
3737
+ prop: `${__props.prop}${__props.prop ? "." : ""}${__props.config.name}.${checkboxName.value}`,
3738
+ "true-value": checkboxTrueValue.value,
3739
+ "false-value": checkboxFalseValue.value,
3740
+ "onUpdate:modelValue": valueChangeHandler
3710
3741
  }, {
3711
3742
  default: vue.withCtx(() => [
3712
3743
  vue.createElementVNode("span", {
3713
- innerHTML: _ctx.config.legend
3714
- }, null, 8, _hoisted_1$d),
3715
- _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
3744
+ innerHTML: __props.config.legend
3745
+ }, null, 8, _hoisted_1$c),
3746
+ __props.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
3716
3747
  key: 0,
3717
- innerHTML: _ctx.config.extra,
3748
+ innerHTML: __props.config.extra,
3718
3749
  class: "m-form-tip"
3719
3750
  }, null, 8, _hoisted_2$6)) : vue.createCommentVNode("v-if", true)
3720
3751
  ]),
3721
3752
  _: 1
3722
3753
  /* STABLE */
3723
- }, 8, ["modelValue", "prop"])
3754
+ }, 8, ["model-value", "prop", "true-value", "false-value"])
3724
3755
  ]),
3725
3756
  _: 1
3726
3757
  /* STABLE */
3727
- })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$4, [
3758
+ })) : (vue.openBlock(), vue.createElementBlock("legend", _hoisted_3$5, [
3728
3759
  vue.createElementVNode("span", {
3729
- innerHTML: _ctx.config.legend
3760
+ innerHTML: __props.config.legend
3730
3761
  }, null, 8, _hoisted_4$2),
3731
- _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
3762
+ __props.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
3732
3763
  key: 0,
3733
- innerHTML: _ctx.config.extra,
3764
+ innerHTML: __props.config.extra,
3734
3765
  class: "m-form-tip"
3735
3766
  }, null, 8, _hoisted_5$2)) : vue.createCommentVNode("v-if", true)
3736
3767
  ])),
3737
- _ctx.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6$1, [
3768
+ __props.config.schematic && show.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
3738
3769
  vue.createElementVNode("div", _hoisted_7, [
3739
3770
  (vue.openBlock(true), vue.createElementBlock(
3740
3771
  vue.Fragment,
3741
3772
  null,
3742
- vue.renderList(_ctx.config.items, (item, index) => {
3743
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
3773
+ vue.renderList(__props.config.items, (item, index) => {
3774
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
3744
3775
  key: key(item, index),
3745
- model: name.value ? _ctx.model[name.value] : _ctx.model,
3746
- lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
3747
- "is-compare": _ctx.isCompare,
3748
- rules: name.value ? _ctx.rules[name.value] : [],
3776
+ model: name.value ? __props.model[name.value] : __props.model,
3777
+ lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
3778
+ "is-compare": __props.isCompare,
3779
+ rules: name.value ? __props.rules[name.value] : [],
3749
3780
  config: item,
3750
- prop: _ctx.prop,
3751
- disabled: _ctx.disabled,
3781
+ prop: __props.prop,
3782
+ disabled: __props.disabled,
3752
3783
  labelWidth: lWidth.value,
3753
- size: _ctx.size,
3784
+ size: __props.size,
3754
3785
  onChange: changeHandler,
3755
- onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
3786
+ onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
3756
3787
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "disabled", "labelWidth", "size"]);
3757
3788
  }),
3758
3789
  128
@@ -3761,25 +3792,25 @@
3761
3792
  ]),
3762
3793
  vue.createElementVNode("img", {
3763
3794
  class: "m-form-schematic",
3764
- src: _ctx.config.schematic
3795
+ src: __props.config.schematic
3765
3796
  }, null, 8, _hoisted_8)
3766
3797
  ])) : show.value ? (vue.openBlock(true), vue.createElementBlock(
3767
3798
  vue.Fragment,
3768
3799
  { key: 3 },
3769
- vue.renderList(_ctx.config.items, (item, index) => {
3770
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
3800
+ vue.renderList(__props.config.items, (item, index) => {
3801
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
3771
3802
  key: key(item, index),
3772
- model: name.value ? _ctx.model[name.value] : _ctx.model,
3773
- lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
3774
- "is-compare": _ctx.isCompare,
3775
- rules: name.value ? _ctx.rules[name.value] : [],
3803
+ model: name.value ? __props.model[name.value] : __props.model,
3804
+ lastValues: name.value ? __props.lastValues[name.value] : __props.lastValues,
3805
+ "is-compare": __props.isCompare,
3806
+ rules: name.value ? __props.rules[name.value] : [],
3776
3807
  config: item,
3777
- prop: _ctx.prop,
3808
+ prop: __props.prop,
3778
3809
  labelWidth: lWidth.value,
3779
- size: _ctx.size,
3780
- disabled: _ctx.disabled,
3810
+ size: __props.size,
3811
+ disabled: __props.disabled,
3781
3812
  onChange: changeHandler,
3782
- onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
3813
+ onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
3783
3814
  }, null, 8, ["model", "lastValues", "is-compare", "rules", "config", "prop", "labelWidth", "size", "disabled"]);
3784
3815
  }),
3785
3816
  128
@@ -3793,10 +3824,73 @@
3793
3824
  }
3794
3825
  });
3795
3826
 
3796
- const _hoisted_1$c = { class: "m-fields-group-list-item" };
3827
+ const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
3828
+ ...{
3829
+ name: "MFormFlexLayout"
3830
+ },
3831
+ __name: "FlexLayout",
3832
+ props: {
3833
+ model: {},
3834
+ lastValues: {},
3835
+ isCompare: { type: Boolean },
3836
+ config: {},
3837
+ name: {},
3838
+ labelWidth: {},
3839
+ prop: {},
3840
+ size: {},
3841
+ disabled: { type: Boolean }
3842
+ },
3843
+ emits: ["change", "addDiffCount"],
3844
+ setup(__props, { emit: __emit }) {
3845
+ const props = __props;
3846
+ const emit = __emit;
3847
+ const mForm = vue.inject("mForm");
3848
+ const gap = vue.computed(() => props.config.gap || "16px");
3849
+ const changeHandler = (v, eventData) => {
3850
+ emit("change", props.model, eventData);
3851
+ };
3852
+ const onAddDiffCount = () => emit("addDiffCount");
3853
+ return (_ctx, _cache) => {
3854
+ return vue.openBlock(), vue.createElementBlock(
3855
+ "div",
3856
+ {
3857
+ class: "m-form-flex-layout",
3858
+ style: vue.normalizeStyle({ display: "flex", flexWrap: "wrap", gap: gap.value })
3859
+ },
3860
+ [
3861
+ (vue.openBlock(true), vue.createElementBlock(
3862
+ vue.Fragment,
3863
+ null,
3864
+ vue.renderList(__props.config.items, (item, index) => {
3865
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
3866
+ key: item[vue.unref(mForm)?.keyProp || "__key"] ?? index,
3867
+ config: item,
3868
+ model: __props.name ? __props.model[__props.name] : __props.model,
3869
+ lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
3870
+ "is-compare": __props.isCompare,
3871
+ prop: __props.prop,
3872
+ size: __props.size,
3873
+ disabled: __props.disabled,
3874
+ "label-width": __props.config.labelWidth || __props.labelWidth,
3875
+ onChange: changeHandler,
3876
+ onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
3877
+ }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
3878
+ }),
3879
+ 128
3880
+ /* KEYED_FRAGMENT */
3881
+ ))
3882
+ ],
3883
+ 4
3884
+ /* STYLE */
3885
+ );
3886
+ };
3887
+ }
3888
+ });
3889
+
3890
+ const _hoisted_1$b = { class: "m-fields-group-list-item" };
3797
3891
  const _hoisted_2$5 = { style: { "text-align": "right", "margin-top": "20px" } };
3798
- const _hoisted_3$3 = ["innerHTML"];
3799
- const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
3892
+ const _hoisted_3$4 = ["innerHTML"];
3893
+ const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
3800
3894
  ...{
3801
3895
  name: "MFormGroupListItem"
3802
3896
  },
@@ -3874,11 +3968,11 @@
3874
3968
  emit("swap-item", props.index, moveSpecifyLocationIndex.value - 1);
3875
3969
  };
3876
3970
  return (_ctx, _cache) => {
3877
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
3971
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
3878
3972
  vue.createElementVNode("div", null, [
3879
3973
  vue.createVNode(vue.unref(design.TMagicButton), {
3880
3974
  link: "",
3881
- disabled: _ctx.disabled,
3975
+ disabled: __props.disabled,
3882
3976
  onClick: expandHandler
3883
3977
  }, {
3884
3978
  default: vue.withCtx(() => [
@@ -3903,7 +3997,7 @@
3903
3997
  size: "small",
3904
3998
  link: "",
3905
3999
  icon: vue.unref(iconsVue.Delete),
3906
- disabled: _ctx.disabled,
4000
+ disabled: __props.disabled,
3907
4001
  onClick: removeHandler
3908
4002
  }, null, 8, ["icon", "disabled"]), [
3909
4003
  [vue.vShow, showDelete.value]
@@ -3914,7 +4008,7 @@
3914
4008
  size: "small",
3915
4009
  type: "primary",
3916
4010
  icon: vue.unref(iconsVue.DocumentCopy),
3917
- disabled: _ctx.disabled,
4011
+ disabled: __props.disabled,
3918
4012
  onClick: copyHandler
3919
4013
  }, {
3920
4014
  default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
@@ -3934,7 +4028,7 @@
3934
4028
  vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
3935
4029
  link: "",
3936
4030
  size: "small",
3937
- disabled: _ctx.disabled,
4031
+ disabled: __props.disabled,
3938
4032
  icon: vue.unref(iconsVue.CaretTop),
3939
4033
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
3940
4034
  }, {
@@ -3948,12 +4042,12 @@
3948
4042
  _: 1
3949
4043
  /* STABLE */
3950
4044
  }, 8, ["disabled", "icon"]), [
3951
- [vue.vShow, _ctx.index !== 0]
4045
+ [vue.vShow, __props.index !== 0]
3952
4046
  ]),
3953
4047
  vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
3954
4048
  link: "",
3955
4049
  size: "small",
3956
- disabled: _ctx.disabled,
4050
+ disabled: __props.disabled,
3957
4051
  icon: vue.unref(iconsVue.CaretBottom),
3958
4052
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
3959
4053
  }, {
@@ -3967,13 +4061,13 @@
3967
4061
  _: 1
3968
4062
  /* STABLE */
3969
4063
  }, 8, ["disabled", "icon"]), [
3970
- [vue.vShow, _ctx.index !== length.value - 1]
4064
+ [vue.vShow, __props.index !== length.value - 1]
3971
4065
  ])
3972
4066
  ],
3973
4067
  64
3974
4068
  /* STABLE_FRAGMENT */
3975
4069
  )) : vue.createCommentVNode("v-if", true),
3976
- _ctx.config.moveSpecifyLocation ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
4070
+ __props.config.moveSpecifyLocation ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicPopover), {
3977
4071
  key: 2,
3978
4072
  trigger: "click",
3979
4073
  placement: "top",
@@ -3986,7 +4080,7 @@
3986
4080
  size: "small",
3987
4081
  type: "primary",
3988
4082
  icon: vue.unref(iconsVue.Position),
3989
- disabled: _ctx.disabled,
4083
+ disabled: __props.disabled,
3990
4084
  onClick: _cache[2] || (_cache[2] = ($event) => moveSpecifyLocationVisible.value = true)
3991
4085
  }, {
3992
4086
  default: vue.withCtx(() => [..._cache[9] || (_cache[9] = [
@@ -4014,7 +4108,7 @@
4014
4108
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moveSpecifyLocationIndex.value = $event),
4015
4109
  size: "small",
4016
4110
  min: 1,
4017
- disabled: _ctx.disabled
4111
+ disabled: __props.disabled
4018
4112
  }, null, 8, ["modelValue", "disabled"]),
4019
4113
  _cache[11] || (_cache[11] = vue.createTextVNode(
4020
4114
  "行 ",
@@ -4063,18 +4157,18 @@
4063
4157
  key: 3,
4064
4158
  innerHTML: itemExtra.value,
4065
4159
  class: "m-form-tip"
4066
- }, null, 8, _hoisted_3$3)) : vue.createCommentVNode("v-if", true)
4160
+ }, null, 8, _hoisted_3$4)) : vue.createCommentVNode("v-if", true)
4067
4161
  ]),
4068
- expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$x, {
4162
+ expand.value ? (vue.openBlock(), vue.createBlock(_sfc_main$A, {
4069
4163
  key: 0,
4070
4164
  config: rowConfig.value,
4071
- model: _ctx.model,
4072
- lastValues: _ctx.lastValues,
4073
- "is-compare": _ctx.isCompare,
4074
- labelWidth: _ctx.labelWidth,
4075
- prop: `${_ctx.prop}${_ctx.prop ? "." : ""}${String(_ctx.index)}`,
4076
- size: _ctx.size,
4077
- disabled: _ctx.disabled,
4165
+ model: __props.model,
4166
+ lastValues: __props.lastValues,
4167
+ "is-compare": __props.isCompare,
4168
+ labelWidth: __props.labelWidth,
4169
+ prop: `${__props.prop}${__props.prop ? "." : ""}${String(__props.index)}`,
4170
+ size: __props.size,
4171
+ disabled: __props.disabled,
4078
4172
  onChange: changeHandler,
4079
4173
  onAddDiffCount: _cache[5] || (_cache[5] = ($event) => onAddDiffCount())
4080
4174
  }, null, 8, ["config", "model", "lastValues", "is-compare", "labelWidth", "prop", "size", "disabled"])) : vue.createCommentVNode("v-if", true)
@@ -4083,13 +4177,13 @@
4083
4177
  }
4084
4178
  });
4085
4179
 
4086
- const _hoisted_1$b = { class: "m-fields-group-list" };
4180
+ const _hoisted_1$a = { class: "m-fields-group-list" };
4087
4181
  const _hoisted_2$4 = ["innerHTML"];
4088
- const _hoisted_3$2 = {
4182
+ const _hoisted_3$3 = {
4089
4183
  key: 1,
4090
4184
  class: "el-table__empty-block"
4091
4185
  };
4092
- const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
4186
+ const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
4093
4187
  ...{
4094
4188
  name: "MFormGroupList"
4095
4189
  },
@@ -4179,13 +4273,13 @@
4179
4273
  const onAddDiffCount = () => emit("addDiffCount");
4180
4274
  const getLastValues = (item, index) => item?.[index] || {};
4181
4275
  return (_ctx, _cache) => {
4182
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
4183
- _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
4276
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$a, [
4277
+ __props.config.extra ? (vue.openBlock(), vue.createElementBlock("div", {
4184
4278
  key: 0,
4185
- innerHTML: _ctx.config.extra,
4279
+ innerHTML: __props.config.extra,
4186
4280
  style: { "color": "rgba(0, 0, 0, 0.45)" }
4187
4281
  }, null, 8, _hoisted_2$4)) : vue.createCommentVNode("v-if", true),
4188
- !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [..._cache[1] || (_cache[1] = [
4282
+ !__props.model[__props.name] || !__props.model[__props.name].length ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$3, [..._cache[1] || (_cache[1] = [
4189
4283
  vue.createElementVNode(
4190
4284
  "span",
4191
4285
  { class: "el-table__empty-text" },
@@ -4196,19 +4290,19 @@
4196
4290
  ])])) : (vue.openBlock(true), vue.createElementBlock(
4197
4291
  vue.Fragment,
4198
4292
  { key: 2 },
4199
- vue.renderList(_ctx.model[_ctx.name], (item, index) => {
4200
- return vue.openBlock(), vue.createBlock(_sfc_main$v, {
4293
+ vue.renderList(__props.model[__props.name], (item, index) => {
4294
+ return vue.openBlock(), vue.createBlock(_sfc_main$x, {
4201
4295
  key: index,
4202
4296
  model: item,
4203
- lastValues: getLastValues(_ctx.lastValues[_ctx.name], index),
4204
- "is-compare": _ctx.isCompare,
4205
- config: _ctx.config,
4206
- prop: _ctx.prop,
4297
+ lastValues: getLastValues(__props.lastValues[__props.name], index),
4298
+ "is-compare": __props.isCompare,
4299
+ config: __props.config,
4300
+ prop: __props.prop,
4207
4301
  index,
4208
- "label-width": _ctx.labelWidth,
4209
- size: _ctx.size,
4210
- disabled: _ctx.disabled,
4211
- "group-model": _ctx.model[_ctx.name],
4302
+ "label-width": __props.labelWidth,
4303
+ size: __props.size,
4304
+ disabled: __props.disabled,
4305
+ "group-model": __props.model[__props.name],
4212
4306
  onRemoveItem: removeHandler,
4213
4307
  onCopyItem: copyHandler,
4214
4308
  onSwapItem: swapHandler,
@@ -4222,8 +4316,8 @@
4222
4316
  addable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4223
4317
  key: 3,
4224
4318
  type: "primary",
4225
- size: _ctx.config.enableToggleMode ? "small" : "default",
4226
- disabled: _ctx.disabled,
4319
+ size: __props.config.enableToggleMode ? "small" : "default",
4320
+ disabled: __props.disabled,
4227
4321
  onClick: addHandler
4228
4322
  }, {
4229
4323
  default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
@@ -4236,7 +4330,7 @@
4236
4330
  _: 1
4237
4331
  /* STABLE */
4238
4332
  }, 8, ["size", "disabled"])) : vue.createCommentVNode("v-if", true),
4239
- _ctx.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4333
+ __props.config.enableToggleMode ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
4240
4334
  key: 4,
4241
4335
  icon: vue.unref(iconsVue.Grid),
4242
4336
  size: "small",
@@ -4257,15 +4351,15 @@
4257
4351
  }
4258
4352
  });
4259
4353
 
4260
- const _hoisted_1$a = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
4354
+ const _hoisted_1$9 = { style: { "width": "100%", "display": "flex", "align-items": "center" } };
4261
4355
  const _hoisted_2$3 = ["innerHTML"];
4262
- const _hoisted_3$1 = {
4356
+ const _hoisted_3$2 = {
4263
4357
  key: 0,
4264
4358
  style: { "display": "flex" }
4265
4359
  };
4266
4360
  const _hoisted_4$1 = { style: { "flex": "1" } };
4267
4361
  const _hoisted_5$1 = ["src"];
4268
- const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
4362
+ const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
4269
4363
  ...{
4270
4364
  name: "MFormPanel"
4271
4365
  },
@@ -4300,21 +4394,21 @@
4300
4394
  "body-style": { display: expand.value ? "block" : "none" }
4301
4395
  }, {
4302
4396
  header: vue.withCtx(() => [
4303
- vue.createElementVNode("div", _hoisted_1$a, [
4397
+ vue.createElementVNode("div", _hoisted_1$9, [
4304
4398
  vue.createVNode(vue.unref(design.TMagicButton), {
4305
4399
  style: { "padding": "0" },
4306
4400
  link: "",
4307
4401
  icon: expand.value ? vue.unref(iconsVue.CaretBottom) : vue.unref(iconsVue.CaretRight),
4308
4402
  onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
4309
4403
  }, null, 8, ["icon"]),
4310
- _ctx.config && _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
4404
+ __props.config && __props.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
4311
4405
  key: 0,
4312
- innerHTML: _ctx.config.extra,
4406
+ innerHTML: __props.config.extra,
4313
4407
  class: "m-form-tip"
4314
4408
  }, null, 8, _hoisted_2$3)) : vue.createCommentVNode("v-if", true),
4315
4409
  vue.renderSlot(_ctx.$slots, "header", {}, () => [
4316
4410
  vue.createTextVNode(
4317
- vue.toDisplayString(filter(_ctx.config.title)),
4411
+ vue.toDisplayString(filter(__props.config.title)),
4318
4412
  1
4319
4413
  /* TEXT */
4320
4414
  )
@@ -4324,22 +4418,22 @@
4324
4418
  default: vue.withCtx(() => [
4325
4419
  vue.createElementVNode("div", null, [
4326
4420
  vue.renderSlot(_ctx.$slots, "default"),
4327
- _ctx.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$1, [
4421
+ __props.config.schematic ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_3$2, [
4328
4422
  vue.createElementVNode("div", _hoisted_4$1, [
4329
4423
  (vue.openBlock(true), vue.createElementBlock(
4330
4424
  vue.Fragment,
4331
4425
  null,
4332
4426
  vue.renderList(items.value, (item, index) => {
4333
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
4427
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
4334
4428
  key: item[vue.unref(mForm)?.keyProp || "__key"] ?? index,
4335
4429
  config: item,
4336
- model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
4337
- lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
4338
- "is-compare": _ctx.isCompare,
4339
- prop: _ctx.prop,
4340
- size: _ctx.size,
4341
- disabled: _ctx.disabled,
4342
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
4430
+ model: __props.name ? __props.model[__props.name] : __props.model,
4431
+ lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
4432
+ "is-compare": __props.isCompare,
4433
+ prop: __props.prop,
4434
+ size: __props.size,
4435
+ disabled: __props.disabled,
4436
+ "label-width": __props.config.labelWidth || __props.labelWidth,
4343
4437
  onChange: changeHandler,
4344
4438
  onAddDiffCount: _cache[1] || (_cache[1] = ($event) => onAddDiffCount())
4345
4439
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
@@ -4350,22 +4444,22 @@
4350
4444
  ]),
4351
4445
  vue.createElementVNode("img", {
4352
4446
  class: "m-form-schematic",
4353
- src: _ctx.config.schematic
4447
+ src: __props.config.schematic
4354
4448
  }, null, 8, _hoisted_5$1)
4355
4449
  ])) : (vue.openBlock(true), vue.createElementBlock(
4356
4450
  vue.Fragment,
4357
4451
  { key: 1 },
4358
4452
  vue.renderList(items.value, (item, index) => {
4359
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
4453
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
4360
4454
  key: item[vue.unref(mForm)?.keyProp || "__key"] ?? index,
4361
4455
  config: item,
4362
- model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
4363
- lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
4364
- "is-compare": _ctx.isCompare,
4365
- prop: _ctx.prop,
4366
- size: _ctx.size,
4367
- disabled: _ctx.disabled,
4368
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
4456
+ model: __props.name ? __props.model[__props.name] : __props.model,
4457
+ lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
4458
+ "is-compare": __props.isCompare,
4459
+ prop: __props.prop,
4460
+ size: __props.size,
4461
+ disabled: __props.disabled,
4462
+ "label-width": __props.config.labelWidth || __props.labelWidth,
4369
4463
  onChange: changeHandler,
4370
4464
  onAddDiffCount: _cache[2] || (_cache[2] = ($event) => onAddDiffCount())
4371
4465
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"]);
@@ -4382,7 +4476,7 @@
4382
4476
  }
4383
4477
  });
4384
4478
 
4385
- const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
4479
+ const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
4386
4480
  ...{
4387
4481
  name: "MFormCol"
4388
4482
  },
@@ -4408,18 +4502,18 @@
4408
4502
  const changeHandler = (v, eventData) => emit("change", v, eventData);
4409
4503
  const onAddDiffCount = () => emit("addDiffCount");
4410
4504
  return (_ctx, _cache) => {
4411
- return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCol), { span: _ctx.span }, {
4505
+ return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCol), { span: __props.span }, {
4412
4506
  default: vue.withCtx(() => [
4413
- vue.createVNode(_sfc_main$x, {
4414
- model: _ctx.model,
4415
- lastValues: _ctx.lastValues,
4416
- "is-compare": _ctx.isCompare,
4417
- config: _ctx.config,
4418
- prop: _ctx.prop,
4419
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
4420
- "expand-more": _ctx.expandMore,
4421
- size: _ctx.size,
4422
- disabled: _ctx.disabled,
4507
+ vue.createVNode(_sfc_main$A, {
4508
+ model: __props.model,
4509
+ lastValues: __props.lastValues,
4510
+ "is-compare": __props.isCompare,
4511
+ config: __props.config,
4512
+ prop: __props.prop,
4513
+ "label-width": __props.config.labelWidth || __props.labelWidth,
4514
+ "expand-more": __props.expandMore,
4515
+ size: __props.size,
4516
+ disabled: __props.disabled,
4423
4517
  onChange: changeHandler,
4424
4518
  onAddDiffCount
4425
4519
  }, null, 8, ["model", "lastValues", "is-compare", "config", "prop", "label-width", "expand-more", "size", "disabled"])
@@ -4427,13 +4521,13 @@
4427
4521
  _: 1
4428
4522
  /* STABLE */
4429
4523
  }, 8, ["span"])), [
4430
- [vue.vShow, display$1.value && _ctx.config.type !== "hidden"]
4524
+ [vue.vShow, display$1.value && __props.config.type !== "hidden"]
4431
4525
  ]);
4432
4526
  };
4433
4527
  }
4434
4528
  });
4435
4529
 
4436
- const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
4530
+ const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
4437
4531
  ...{
4438
4532
  name: "MFormRow"
4439
4533
  },
@@ -4465,19 +4559,19 @@
4465
4559
  (vue.openBlock(true), vue.createElementBlock(
4466
4560
  vue.Fragment,
4467
4561
  null,
4468
- vue.renderList(_ctx.config.items, (col, index) => {
4469
- return vue.openBlock(), vue.createBlock(_sfc_main$s, {
4562
+ vue.renderList(__props.config.items, (col, index) => {
4563
+ return vue.openBlock(), vue.createBlock(_sfc_main$u, {
4470
4564
  key: col[vue.unref(mForm)?.keyProp || "__key"] ?? index,
4471
- span: col.span || _ctx.config.span || 24 / _ctx.config.items.length,
4565
+ span: col.span || __props.config.span || 24 / __props.config.items.length,
4472
4566
  config: col,
4473
- labelWidth: _ctx.config.labelWidth || _ctx.labelWidth,
4474
- expandMore: _ctx.expandMore,
4475
- model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
4476
- lastValues: _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
4477
- "is-compare": _ctx.isCompare,
4478
- prop: _ctx.prop,
4479
- size: _ctx.size,
4480
- disabled: _ctx.disabled,
4567
+ labelWidth: __props.config.labelWidth || __props.labelWidth,
4568
+ expandMore: __props.expandMore,
4569
+ model: __props.name ? __props.model[__props.name] : __props.model,
4570
+ lastValues: __props.name ? __props.lastValues[__props.name] : __props.lastValues,
4571
+ "is-compare": __props.isCompare,
4572
+ prop: __props.prop,
4573
+ size: __props.size,
4574
+ disabled: __props.disabled,
4481
4575
  onChange: changeHandler,
4482
4576
  onAddDiffCount
4483
4577
  }, null, 8, ["span", "config", "labelWidth", "expandMore", "model", "lastValues", "is-compare", "prop", "size", "disabled"]);
@@ -4493,7 +4587,7 @@
4493
4587
  }
4494
4588
  });
4495
4589
 
4496
- const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
4590
+ const _sfc_main$s = /* @__PURE__ */ vue.defineComponent({
4497
4591
  ...{
4498
4592
  name: "MFormStep"
4499
4593
  },
@@ -4531,13 +4625,13 @@
4531
4625
  vue.createVNode(vue.unref(design.TMagicSteps), {
4532
4626
  active: active.value,
4533
4627
  "align-center": "",
4534
- space: _ctx.config.space
4628
+ space: __props.config.space
4535
4629
  }, {
4536
4630
  default: vue.withCtx(() => [
4537
4631
  (vue.openBlock(true), vue.createElementBlock(
4538
4632
  vue.Fragment,
4539
4633
  null,
4540
- vue.renderList(_ctx.config.items, (item, index) => {
4634
+ vue.renderList(__props.config.items, (item, index) => {
4541
4635
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicStep), {
4542
4636
  key: item.__key,
4543
4637
  title: item.title,
@@ -4555,7 +4649,7 @@
4555
4649
  (vue.openBlock(true), vue.createElementBlock(
4556
4650
  vue.Fragment,
4557
4651
  null,
4558
- vue.renderList(_ctx.config.items, (step, index) => {
4652
+ vue.renderList(__props.config.items, (step, index) => {
4559
4653
  return vue.openBlock(), vue.createElementBlock(
4560
4654
  vue.Fragment,
4561
4655
  null,
@@ -4568,16 +4662,16 @@
4568
4662
  vue.Fragment,
4569
4663
  null,
4570
4664
  [
4571
- item ? vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$x, {
4665
+ item ? vue.withDirectives((vue.openBlock(), vue.createBlock(_sfc_main$A, {
4572
4666
  key: item[vue.unref(mForm)?.keyProp || "__key"],
4573
4667
  config: item,
4574
- model: step.name ? _ctx.model[step.name] : _ctx.model,
4575
- lastValues: step.name ? _ctx.lastValues[step.name] : _ctx.lastValues,
4576
- "is-compare": _ctx.isCompare,
4668
+ model: step.name ? __props.model[step.name] : __props.model,
4669
+ lastValues: step.name ? __props.lastValues[step.name] : __props.lastValues,
4670
+ "is-compare": __props.isCompare,
4577
4671
  prop: `${step.name}`,
4578
- size: _ctx.size,
4579
- disabled: _ctx.disabled,
4580
- "label-width": _ctx.config.labelWidth || _ctx.labelWidth,
4672
+ size: __props.size,
4673
+ disabled: __props.disabled,
4674
+ "label-width": __props.config.labelWidth || __props.labelWidth,
4581
4675
  onChange: changeHandler,
4582
4676
  onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
4583
4677
  }, null, 8, ["config", "model", "lastValues", "is-compare", "prop", "size", "disabled", "label-width"])), [
@@ -4604,812 +4698,86 @@
4604
4698
  }
4605
4699
  });
4606
4700
 
4607
- const _hoisted_1$9 = { class: "m-fields-table-wrap" };
4608
- const _hoisted_2$2 = ["innerHTML"];
4609
- const _hoisted_3 = ["innerHTML"];
4610
- const _hoisted_4 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
4611
- const _hoisted_5 = { style: { "display": "flex" } };
4612
- const _hoisted_6 = {
4613
- key: 1,
4614
- class: "bottom",
4615
- style: { "text-align": "right" }
4616
- };
4617
- const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
4701
+ const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
4618
4702
  ...{
4619
- name: "MFormTable"
4703
+ name: "MFormTabs"
4620
4704
  },
4621
- __name: "Table",
4705
+ __name: "Tabs",
4622
4706
  props: {
4623
4707
  model: {},
4624
4708
  lastValues: { default: () => ({}) },
4625
4709
  isCompare: { type: Boolean, default: false },
4626
4710
  config: {},
4627
4711
  name: {},
4628
- prop: { default: "" },
4629
- labelWidth: {},
4630
- sort: { type: Boolean },
4631
- disabled: { type: Boolean },
4632
- sortKey: { default: "" },
4633
- text: {},
4634
4712
  size: {},
4635
- enableToggleMode: { type: Boolean, default: true },
4636
- showIndex: { type: Boolean, default: true }
4713
+ labelWidth: {},
4714
+ prop: {},
4715
+ expandMore: { type: Boolean },
4716
+ disabled: { type: Boolean }
4637
4717
  },
4638
- emits: ["change", "select", "addDiffCount"],
4639
- setup(__props, { expose: __expose, emit: __emit }) {
4640
- const props = __props;
4641
- const emit = __emit;
4642
- let timer = null;
4643
- const mForm = vue.inject("mForm");
4644
- const { nextZIndex } = design.useZIndex();
4645
- const tMagicTable = vue.ref();
4646
- const excelBtn = vue.ref();
4647
- const mTable = vue.ref();
4648
- const pagesize = vue.ref(10);
4649
- const pagecontext = vue.ref(0);
4650
- const updateKey = vue.ref(1);
4651
- const isFullscreen = vue.ref(false);
4652
- const modelName = vue.computed(() => props.name || props.config.name || "");
4653
- const getDataByPage = (data2 = []) => data2.filter(
4654
- (item, index) => index >= pagecontext.value * pagesize.value && index + 1 <= (pagecontext.value + 1) * pagesize.value
4655
- );
4656
- const pageinationData = vue.computed(() => getDataByPage(props.model[modelName.value]));
4657
- const data = vue.computed(() => props.config.pagination ? pageinationData.value : props.model[modelName.value]);
4658
- const lastData = vue.computed(
4659
- () => props.config.pagination ? getDataByPage(props.lastValues[modelName.value]) : props.lastValues[modelName.value] || []
4660
- );
4661
- const sortChange = ({ prop, order }) => {
4662
- if (order === "ascending") {
4663
- props.model[modelName.value] = props.model[modelName.value].sort((a, b) => a[prop] - b[prop]);
4664
- } else if (order === "descending") {
4665
- props.model[modelName.value] = props.model[modelName.value].sort((a, b) => b[prop] - a[prop]);
4666
- }
4667
- };
4668
- const swapArray = (index1, index2) => {
4669
- props.model[modelName.value].splice(index1, 0, props.model[modelName.value].splice(index2, 1)[0]);
4670
- if (props.sortKey) {
4671
- for (let i = props.model[modelName.value].length - 1, v = 0; i >= 0; i--, v++) {
4672
- props.model[modelName.value][v][props.sortKey] = i;
4673
- }
4674
- }
4675
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
4676
- };
4677
- let sortable;
4678
- const rowDrop = () => {
4679
- sortable?.destroy();
4680
- const tableEl = tMagicTable.value?.instance.$el;
4681
- const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
4682
- if (!tBodyEl) {
4683
- return;
4684
- }
4685
- sortable = Sortable.create(tBodyEl, {
4686
- draggable: ".tmagic-design-table-row",
4687
- filter: "input",
4688
- // 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
4689
- preventOnFilter: false,
4690
- // 允许选字
4691
- direction: "vertical",
4692
- onEnd: ({ newIndex, oldIndex }) => {
4693
- if (typeof newIndex === "undefined") return;
4694
- if (typeof oldIndex === "undefined") return;
4695
- swapArray(newIndex, oldIndex);
4696
- emit("change", props.model[modelName.value]);
4697
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
4698
- }
4699
- });
4718
+ emits: ["change", "addDiffCount"],
4719
+ setup(__props, { emit: __emit }) {
4720
+ const tabPaneComponent = design.getDesignConfig("components")?.tabPane;
4721
+ const tabsComponent = design.getDesignConfig("components")?.tabs;
4722
+ const getActive = (mForm2, props2, activeTabName2) => {
4723
+ const { config, model, prop } = props2;
4724
+ const { active } = config;
4725
+ if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
4726
+ if (0 >= props2.config.items.length) return "0";
4727
+ if (typeof active !== "undefined") return active;
4728
+ return "0";
4700
4729
  };
4701
- const newHandler = async (row) => {
4702
- if (props.config.max && props.model[modelName.value].length >= props.config.max) {
4703
- design.tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
4704
- return;
4705
- }
4706
- if (typeof props.config.beforeAddRow === "function") {
4707
- const beforeCheckRes = props.config.beforeAddRow(mForm, {
4708
- model: props.model[modelName.value],
4709
- formValue: mForm?.values,
4710
- prop: props.prop
4711
- });
4712
- if (!beforeCheckRes) return;
4713
- }
4714
- const columns = props.config.items;
4715
- const enumValues = props.config.enum || [];
4716
- let enumV = [];
4717
- const { length } = props.model[modelName.value];
4718
- const key = props.config.key || "id";
4719
- let inputs = {};
4720
- if (enumValues.length) {
4721
- if (length >= enumValues.length) {
4722
- return;
4723
- }
4724
- enumV = enumValues.filter((item) => {
4725
- let i = 0;
4726
- for (; i < length; i++) {
4727
- if (item[key] === props.model[modelName.value][i][key]) {
4728
- break;
4729
- }
4730
- }
4731
- return i === length;
4732
- });
4733
- if (enumV.length > 0) {
4734
- inputs = enumV[0];
4735
- }
4736
- } else if (Array.isArray(row)) {
4737
- columns.forEach((column, index) => {
4738
- column.name && (inputs[column.name] = row[index]);
4739
- });
4740
- } else {
4741
- if (typeof props.config.defaultAdd === "function") {
4742
- inputs = await props.config.defaultAdd(mForm, {
4743
- model: props.model[modelName.value],
4744
- formValue: mForm?.values
4745
- });
4746
- } else if (props.config.defaultAdd) {
4747
- inputs = props.config.defaultAdd;
4748
- }
4749
- inputs = await initValue(mForm, {
4750
- config: columns,
4751
- initValues: inputs
4752
- });
4730
+ const tabClick = (mForm2, tab, props2) => {
4731
+ const { config, model, prop } = props2;
4732
+ tab.name = tab.paneName;
4733
+ if (typeof config.onTabClick === "function") {
4734
+ config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
4753
4735
  }
4754
- if (props.sortKey && length) {
4755
- inputs[props.sortKey] = props.model[modelName.value][length - 1][props.sortKey] - 1;
4736
+ const tabConfig = config.items.find((item) => tab.name === item.status);
4737
+ if (tabConfig && typeof tabConfig.onTabClick === "function") {
4738
+ tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
4756
4739
  }
4757
- props.model[modelName.value].push(inputs);
4758
- emit("change", props.model[modelName.value], {
4759
- changeRecords: [
4760
- {
4761
- propPath: `${props.prop}.${props.model[modelName.value].length - 1}`,
4762
- value: inputs
4763
- }
4764
- ]
4765
- });
4766
4740
  };
4767
- vue.onMounted(() => {
4768
- if (props.config.defautSort) {
4769
- sortChange(props.config.defautSort);
4770
- } else if (props.config.defaultSort) {
4771
- sortChange(props.config.defaultSort);
4772
- }
4773
- if (props.sort && props.sortKey) {
4774
- props.model[modelName.value].sort((a, b) => b[props.sortKey] - a[props.sortKey]);
4741
+ const props = __props;
4742
+ const emit = __emit;
4743
+ const mForm = vue.inject("mForm");
4744
+ const activeTabName = vue.ref(getActive(mForm, props));
4745
+ const diffCount = vue.ref({});
4746
+ const tabs = vue.computed(() => {
4747
+ if (props.config.dynamic) {
4748
+ if (!props.config.name) throw new Error("dynamic tab 必须配置name");
4749
+ return props.model[props.config.name] || [];
4775
4750
  }
4751
+ return props.config.items.filter((item) => display(mForm, item.display, props));
4776
4752
  });
4753
+ const filter = (config) => filterFunction(mForm, config, props);
4777
4754
  vue.watchEffect(() => {
4778
- if (props.config.dropSort) {
4779
- rowDrop();
4780
- }
4781
- });
4782
- const addable = vue.computed(() => {
4783
- if (!props.model[modelName.value].length) {
4784
- return true;
4785
- }
4786
- if (typeof props.config.addable === "function") {
4787
- return props.config.addable(mForm, {
4788
- model: props.model[modelName.value],
4789
- formValue: mForm?.values,
4755
+ if (typeof props.config.activeChange === "function") {
4756
+ props.config.activeChange(mForm, activeTabName.value, {
4757
+ model: props.model,
4790
4758
  prop: props.prop
4791
4759
  });
4792
4760
  }
4793
- return typeof props.config.addable === "undefined" ? true : props.config.addable;
4794
- });
4795
- const selection = vue.computed(() => {
4796
- if (typeof props.config.selection === "function") {
4797
- return props.config.selection(mForm, { model: props.model[modelName.value] });
4798
- }
4799
- return props.config.selection;
4800
4761
  });
4801
- const importable = vue.computed(() => {
4802
- if (typeof props.config.importable === "function") {
4803
- return props.config.importable(mForm, {
4804
- formValue: mForm?.values,
4805
- model: props.model[modelName.value]
4806
- });
4762
+ const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
4763
+ const tabClickHandler = (tab) => {
4764
+ if (typeof tab === "object") {
4765
+ tabClick(mForm, tab, props);
4766
+ } else {
4767
+ let item = tabs.value.find((tab2) => tab2.status === tab2);
4768
+ if (!item) {
4769
+ item = tabs.value[tab];
4770
+ }
4771
+ tabClick(mForm, item, props);
4807
4772
  }
4808
- return typeof props.config.importable === "undefined" ? false : props.config.importable;
4809
- });
4810
- const display$1 = (fuc) => display(mForm, fuc, props);
4811
- const itemExtra = (fuc, index) => {
4812
- if (typeof fuc === "function") {
4813
- return fuc(mForm, {
4814
- values: mForm?.initValues,
4773
+ };
4774
+ const onTabAdd = async () => {
4775
+ if (!props.name) throw new Error("dynamic tab 必须配置name");
4776
+ if (typeof props.config.onTabAdd === "function") {
4777
+ props.config.onTabAdd(mForm, {
4815
4778
  model: props.model,
4816
- formValue: mForm ? mForm.values : props.model,
4817
4779
  prop: props.prop,
4818
- index
4819
- });
4820
- }
4821
- return fuc;
4822
- };
4823
- const removeHandler = (index) => {
4824
- if (props.disabled) return;
4825
- props.model[modelName.value].splice(index, 1);
4826
- emit("change", props.model[modelName.value]);
4827
- };
4828
- const selectHandle = (selection2, row) => {
4829
- if (typeof props.config.selection === "string" && props.config.selection === "single") {
4830
- tMagicTable.value?.clearSelection();
4831
- tMagicTable.value?.toggleRowSelection(row, true);
4832
- }
4833
- emit("select", selection2, row);
4834
- if (typeof props.config.onSelect === "function") {
4835
- props.config.onSelect(mForm, { selection: selection2, row, config: props.config });
4836
- }
4837
- };
4838
- const toggleRowSelection = (row, selected) => {
4839
- tMagicTable.value?.toggleRowSelection.call(tMagicTable.value, row, selected);
4840
- };
4841
- const makeConfig = (config, row) => {
4842
- const newConfig = cloneDeep(config);
4843
- if (typeof config.itemsFunction === "function") {
4844
- newConfig.items = config.itemsFunction(row);
4845
- }
4846
- delete newConfig.display;
4847
- return newConfig;
4848
- };
4849
- const upHandler = (index) => {
4850
- if (timer) {
4851
- clearTimeout(timer);
4852
- }
4853
- timer = setTimeout(() => {
4854
- swapArray(index, index - 1);
4855
- timer = void 0;
4856
- }, 300);
4857
- };
4858
- const topHandler = (index) => {
4859
- if (timer) {
4860
- clearTimeout(timer);
4861
- }
4862
- const moveNum = index;
4863
- for (let i = 0; i < moveNum; i++) {
4864
- swapArray(index, index - 1);
4865
- index -= 1;
4866
- }
4867
- };
4868
- const downHandler = (index) => {
4869
- if (timer) {
4870
- clearTimeout(timer);
4871
- }
4872
- timer = setTimeout(() => {
4873
- swapArray(index, index + 1);
4874
- timer = void 0;
4875
- }, 300);
4876
- };
4877
- const bottomHandler = (index) => {
4878
- if (timer) {
4879
- clearTimeout(timer);
4880
- }
4881
- const moveNum = props.model[modelName.value].length - 1 - index;
4882
- for (let i = 0; i < moveNum; i++) {
4883
- swapArray(index, index + 1);
4884
- index += 1;
4885
- }
4886
- };
4887
- const showDelete = (index) => {
4888
- const deleteFunc = props.config.delete;
4889
- if (deleteFunc && typeof deleteFunc === "function") {
4890
- return deleteFunc(props.model[modelName.value], index, mForm?.values);
4891
- }
4892
- return true;
4893
- };
4894
- const copyable = (index) => {
4895
- const copyableFunc = props.config.copyable;
4896
- if (copyableFunc && typeof copyableFunc === "function") {
4897
- return copyableFunc(mForm, {
4898
- values: mForm?.initValues || {},
4899
- model: props.model,
4900
- parent: mForm?.parentValues || {},
4901
- formValue: mForm?.values || props.model,
4902
- prop: props.prop,
4903
- config: props.config,
4904
- index
4905
- });
4906
- }
4907
- return true;
4908
- };
4909
- const clearHandler = () => {
4910
- const len = props.model[modelName.value].length;
4911
- props.model[modelName.value].splice(0, len);
4912
- mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
4913
- };
4914
- const excelHandler = async (file) => {
4915
- if (!file?.raw) {
4916
- return false;
4917
- }
4918
- if (!globalThis.XLSX) {
4919
- await utils.asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
4920
- }
4921
- const reader = new FileReader();
4922
- reader.onload = () => {
4923
- const data2 = reader.result;
4924
- const pdata = globalThis.XLSX.read(data2, { type: "array" });
4925
- pdata.SheetNames.forEach((sheetName) => {
4926
- const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
4927
- if (arr?.[0]) {
4928
- arr.forEach((row) => {
4929
- newHandler(row);
4930
- });
4931
- }
4932
- setTimeout(() => {
4933
- excelBtn.value?.clearFiles();
4934
- }, 300);
4935
- });
4936
- };
4937
- reader.readAsArrayBuffer(file.raw);
4938
- return false;
4939
- };
4940
- const handleSizeChange = (val) => {
4941
- pagesize.value = val;
4942
- };
4943
- const handleCurrentChange = (val) => {
4944
- pagecontext.value = val - 1;
4945
- };
4946
- const copyHandler = (index) => {
4947
- props.model[modelName.value].push(cloneDeep(props.model[modelName.value][index]));
4948
- };
4949
- const toggleMode = () => {
4950
- const calcLabelWidth = (label) => {
4951
- if (!label) return "0px";
4952
- const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
4953
- const chLength = label.length - zhLength;
4954
- return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
4955
- };
4956
- props.config.type = "groupList";
4957
- props.config.enableToggleMode = true;
4958
- props.config.tableItems = props.config.items;
4959
- props.config.items = props.config.groupItems || props.config.items.map((item) => {
4960
- const text = item.text || item.label;
4961
- const labelWidth = calcLabelWidth(text);
4962
- return {
4963
- ...item,
4964
- text,
4965
- labelWidth,
4966
- span: item.span || 12
4967
- };
4968
- });
4969
- };
4970
- const toggleFullscreen = () => {
4971
- if (!mTable.value) return;
4972
- if (isFullscreen.value) {
4973
- mTable.value.classList.remove("fixed");
4974
- isFullscreen.value = false;
4975
- } else {
4976
- mTable.value.classList.add("fixed");
4977
- mTable.value.style.zIndex = `${nextZIndex()}`;
4978
- isFullscreen.value = true;
4979
- }
4980
- };
4981
- const getProp = (index) => {
4982
- const { prop } = vue.toRefs(props);
4983
- return `${prop.value}${prop.value ? "." : ""}${index + 1 + pagecontext.value * pagesize.value - 1}`;
4984
- };
4985
- const onAddDiffCount = () => emit("addDiffCount");
4986
- const changeHandler = (v, eventData) => {
4987
- emit("change", props.model, eventData);
4988
- };
4989
- __expose({
4990
- toggleRowSelection
4991
- });
4992
- return (_ctx, _cache) => {
4993
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
4994
- (vue.openBlock(), vue.createBlock(vue.Teleport, {
4995
- to: "body",
4996
- disabled: !isFullscreen.value
4997
- }, [
4998
- vue.createElementVNode(
4999
- "div",
5000
- {
5001
- ref_key: "mTable",
5002
- ref: mTable,
5003
- class: vue.normalizeClass(["m-fields-table", { "m-fields-table-item-extra": _ctx.config.itemExtra }])
5004
- },
5005
- [
5006
- _ctx.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
5007
- key: 0,
5008
- style: { "color": "rgba(0, 0, 0, 0.45)" },
5009
- innerHTML: _ctx.config.extra
5010
- }, null, 8, _hoisted_2$2)) : vue.createCommentVNode("v-if", true),
5011
- vue.createVNode(vue.unref(design.TMagicTooltip), {
5012
- content: "拖拽可排序",
5013
- placement: "left-start",
5014
- disabled: _ctx.config.dropSort !== true
5015
- }, {
5016
- default: vue.withCtx(() => [
5017
- _ctx.model[modelName.value] ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTable), {
5018
- ref_key: "tMagicTable",
5019
- ref: tMagicTable,
5020
- style: { "width": "100%" },
5021
- "row-key": _ctx.config.rowKey || "id",
5022
- data: data.value,
5023
- lastData: lastData.value,
5024
- border: _ctx.config.border,
5025
- "max-height": _ctx.config.maxHeight,
5026
- "default-expand-all": true,
5027
- key: updateKey.value,
5028
- onSelect: selectHandle,
5029
- onSortChange: sortChange
5030
- }, {
5031
- default: vue.withCtx(() => [
5032
- _ctx.config.itemExtra && !_ctx.config.dropSort ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
5033
- key: 0,
5034
- fixed: "left",
5035
- width: "30",
5036
- type: "expand"
5037
- }, {
5038
- default: vue.withCtx((scope) => [
5039
- vue.createElementVNode("span", {
5040
- innerHTML: itemExtra(_ctx.config.itemExtra, scope.$index),
5041
- class: "m-form-tip"
5042
- }, null, 8, _hoisted_3)
5043
- ]),
5044
- _: 1
5045
- /* STABLE */
5046
- })) : vue.createCommentVNode("v-if", true),
5047
- vue.createVNode(vue.unref(design.TMagicTableColumn), {
5048
- label: "操作",
5049
- width: _ctx.config.operateColWidth || 100,
5050
- align: "center",
5051
- fixed: _ctx.config.fixed === false ? void 0 : "left"
5052
- }, {
5053
- default: vue.withCtx((scope) => [
5054
- vue.renderSlot(_ctx.$slots, "operateCol", { scope }),
5055
- vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
5056
- size: "small",
5057
- type: "danger",
5058
- link: "",
5059
- title: "删除",
5060
- icon: vue.unref(iconsVue.Delete),
5061
- onClick: ($event) => removeHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
5062
- }, null, 8, ["icon", "onClick"]), [
5063
- [vue.vShow, showDelete(scope.$index + 1 + pagecontext.value * pagesize.value - 1)]
5064
- ]),
5065
- copyable(scope.$index + 1 + pagecontext.value * pagesize.value - 1) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5066
- key: 0,
5067
- link: "",
5068
- size: "small",
5069
- type: "primary",
5070
- title: "复制",
5071
- icon: vue.unref(iconsVue.DocumentCopy),
5072
- disabled: _ctx.disabled,
5073
- onClick: ($event) => copyHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
5074
- }, null, 8, ["icon", "disabled", "onClick"])) : vue.createCommentVNode("v-if", true)
5075
- ]),
5076
- _: 3
5077
- /* FORWARDED */
5078
- }, 8, ["width", "fixed"]),
5079
- _ctx.sort && _ctx.model[modelName.value] && _ctx.model[modelName.value].length > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
5080
- key: 1,
5081
- label: "排序",
5082
- width: "60"
5083
- }, {
5084
- default: vue.withCtx((scope) => [
5085
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== 0 ? (vue.openBlock(), vue.createBlock(
5086
- vue.unref(design.TMagicTooltip),
5087
- {
5088
- key: 0,
5089
- content: "点击上移,双击置顶",
5090
- placement: "top"
5091
- },
5092
- {
5093
- default: vue.withCtx(() => [
5094
- vue.createVNode(vue.unref(design.TMagicButton), {
5095
- plain: "",
5096
- size: "small",
5097
- type: "primary",
5098
- icon: vue.unref(iconsVue.ArrowUp),
5099
- disabled: _ctx.disabled,
5100
- link: "",
5101
- onClick: ($event) => upHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
5102
- onDblclick: ($event) => topHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
5103
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
5104
- ]),
5105
- _: 2
5106
- /* DYNAMIC */
5107
- },
5108
- 1024
5109
- /* DYNAMIC_SLOTS */
5110
- )) : vue.createCommentVNode("v-if", true),
5111
- scope.$index + 1 + pagecontext.value * pagesize.value - 1 !== _ctx.model[modelName.value].length - 1 ? (vue.openBlock(), vue.createBlock(
5112
- vue.unref(design.TMagicTooltip),
5113
- {
5114
- key: 1,
5115
- content: "点击下移,双击置底",
5116
- placement: "top"
5117
- },
5118
- {
5119
- default: vue.withCtx(() => [
5120
- vue.createVNode(vue.unref(design.TMagicButton), {
5121
- plain: "",
5122
- size: "small",
5123
- type: "primary",
5124
- icon: vue.unref(iconsVue.ArrowDown),
5125
- disabled: _ctx.disabled,
5126
- link: "",
5127
- onClick: ($event) => downHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1),
5128
- onDblclick: ($event) => bottomHandler(scope.$index + 1 + pagecontext.value * pagesize.value - 1)
5129
- }, null, 8, ["icon", "disabled", "onClick", "onDblclick"])
5130
- ]),
5131
- _: 2
5132
- /* DYNAMIC */
5133
- },
5134
- 1024
5135
- /* DYNAMIC_SLOTS */
5136
- )) : vue.createCommentVNode("v-if", true)
5137
- ]),
5138
- _: 1
5139
- /* STABLE */
5140
- })) : vue.createCommentVNode("v-if", true),
5141
- selection.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
5142
- key: 2,
5143
- align: "center",
5144
- "header-align": "center",
5145
- type: "selection",
5146
- width: "45"
5147
- })) : vue.createCommentVNode("v-if", true),
5148
- _ctx.showIndex && _ctx.config.showIndex ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
5149
- key: 3,
5150
- width: "60",
5151
- label: "序号"
5152
- }, {
5153
- default: vue.withCtx((scope) => [
5154
- vue.createTextVNode(
5155
- vue.toDisplayString(scope.$index + 1 + pagecontext.value * pagesize.value),
5156
- 1
5157
- /* TEXT */
5158
- )
5159
- ]),
5160
- _: 1
5161
- /* STABLE */
5162
- })) : vue.createCommentVNode("v-if", true),
5163
- (vue.openBlock(true), vue.createElementBlock(
5164
- vue.Fragment,
5165
- null,
5166
- vue.renderList(_ctx.config.items, (column, index) => {
5167
- return vue.openBlock(), vue.createElementBlock(
5168
- vue.Fragment,
5169
- null,
5170
- [
5171
- column.type !== "hidden" && display$1(column.display) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTableColumn), {
5172
- prop: column.name,
5173
- width: column.width,
5174
- label: column.label,
5175
- sortable: column.sortable,
5176
- "sort-orders": ["ascending", "descending"],
5177
- key: column[vue.unref(mForm)?.keyProp || "__key"] ?? index,
5178
- "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
5179
- }, {
5180
- default: vue.withCtx((scope) => [
5181
- scope.$index > -1 ? (vue.openBlock(), vue.createBlock(_sfc_main$x, {
5182
- key: 0,
5183
- labelWidth: "0",
5184
- disabled: _ctx.disabled,
5185
- prop: getProp(scope.$index),
5186
- rules: column.rules,
5187
- config: makeConfig(column, scope.row),
5188
- model: scope.row,
5189
- lastValues: lastData.value[scope.$index],
5190
- "is-compare": _ctx.isCompare,
5191
- size: _ctx.size,
5192
- onChange: changeHandler,
5193
- onAddDiffCount: _cache[0] || (_cache[0] = ($event) => onAddDiffCount())
5194
- }, null, 8, ["disabled", "prop", "rules", "config", "model", "lastValues", "is-compare", "size"])) : vue.createCommentVNode("v-if", true)
5195
- ]),
5196
- _: 2
5197
- /* DYNAMIC */
5198
- }, 1032, ["prop", "width", "label", "sortable", "class-name"])) : vue.createCommentVNode("v-if", true)
5199
- ],
5200
- 64
5201
- /* STABLE_FRAGMENT */
5202
- );
5203
- }),
5204
- 256
5205
- /* UNKEYED_FRAGMENT */
5206
- ))
5207
- ]),
5208
- _: 3
5209
- /* FORWARDED */
5210
- }, 8, ["row-key", "data", "lastData", "border", "max-height"])) : vue.createCommentVNode("v-if", true)
5211
- ]),
5212
- _: 3
5213
- /* FORWARDED */
5214
- }, 8, ["disabled"]),
5215
- vue.renderSlot(_ctx.$slots, "default"),
5216
- vue.createElementVNode("div", _hoisted_4, [
5217
- addable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5218
- key: 0,
5219
- size: "small",
5220
- type: "primary",
5221
- disabled: _ctx.disabled,
5222
- plain: "",
5223
- onClick: _cache[1] || (_cache[1] = ($event) => newHandler())
5224
- }, {
5225
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
5226
- vue.createTextVNode(
5227
- "新增一行",
5228
- -1
5229
- /* CACHED */
5230
- )
5231
- ])]),
5232
- _: 1
5233
- /* STABLE */
5234
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
5235
- vue.createElementVNode("div", _hoisted_5, [
5236
- _ctx.enableToggleMode && _ctx.config.enableToggleMode !== false && !isFullscreen.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5237
- key: 0,
5238
- icon: vue.unref(iconsVue.Grid),
5239
- size: "small",
5240
- type: "primary",
5241
- onClick: toggleMode
5242
- }, {
5243
- default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
5244
- vue.createTextVNode(
5245
- "展开配置",
5246
- -1
5247
- /* CACHED */
5248
- )
5249
- ])]),
5250
- _: 1
5251
- /* STABLE */
5252
- }, 8, ["icon"])) : vue.createCommentVNode("v-if", true),
5253
- _ctx.config.enableFullscreen !== false ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5254
- key: 1,
5255
- icon: vue.unref(iconsVue.FullScreen),
5256
- size: "small",
5257
- type: "primary",
5258
- onClick: toggleFullscreen
5259
- }, {
5260
- default: vue.withCtx(() => [
5261
- vue.createTextVNode(
5262
- vue.toDisplayString(isFullscreen.value ? "退出全屏" : "全屏编辑"),
5263
- 1
5264
- /* TEXT */
5265
- )
5266
- ]),
5267
- _: 1
5268
- /* STABLE */
5269
- }, 8, ["icon"])) : vue.createCommentVNode("v-if", true),
5270
- importable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicUpload), {
5271
- key: 2,
5272
- style: { "display": "inline-block" },
5273
- ref_key: "excelBtn",
5274
- ref: excelBtn,
5275
- action: "/noop",
5276
- disabled: _ctx.disabled,
5277
- "on-change": excelHandler,
5278
- "auto-upload": false
5279
- }, {
5280
- default: vue.withCtx(() => [
5281
- vue.createVNode(vue.unref(design.TMagicButton), {
5282
- size: "small",
5283
- type: "success",
5284
- disabled: _ctx.disabled,
5285
- plain: ""
5286
- }, {
5287
- default: vue.withCtx(() => [..._cache[5] || (_cache[5] = [
5288
- vue.createTextVNode(
5289
- "导入EXCEL",
5290
- -1
5291
- /* CACHED */
5292
- )
5293
- ])]),
5294
- _: 1
5295
- /* STABLE */
5296
- }, 8, ["disabled"])
5297
- ]),
5298
- _: 1
5299
- /* STABLE */
5300
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
5301
- importable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
5302
- key: 3,
5303
- size: "small",
5304
- type: "warning",
5305
- disabled: _ctx.disabled,
5306
- plain: "",
5307
- onClick: _cache[2] || (_cache[2] = ($event) => clearHandler())
5308
- }, {
5309
- default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
5310
- vue.createTextVNode(
5311
- "清空",
5312
- -1
5313
- /* CACHED */
5314
- )
5315
- ])]),
5316
- _: 1
5317
- /* STABLE */
5318
- }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true)
5319
- ])
5320
- ]),
5321
- _ctx.config.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
5322
- vue.createVNode(vue.unref(design.TMagicPagination), {
5323
- layout: "total, sizes, prev, pager, next, jumper",
5324
- "hide-on-single-page": _ctx.model[modelName.value].length < pagesize.value,
5325
- "current-page": pagecontext.value + 1,
5326
- "page-sizes": [pagesize.value, 60, 120, 300],
5327
- "page-size": pagesize.value,
5328
- total: _ctx.model[modelName.value].length,
5329
- onSizeChange: handleSizeChange,
5330
- onCurrentChange: handleCurrentChange
5331
- }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total"])
5332
- ])) : vue.createCommentVNode("v-if", true)
5333
- ],
5334
- 2
5335
- /* CLASS */
5336
- )
5337
- ], 8, ["disabled"]))
5338
- ]);
5339
- };
5340
- }
5341
- });
5342
-
5343
- const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5344
- ...{
5345
- name: "MFormTabs"
5346
- },
5347
- __name: "Tabs",
5348
- props: {
5349
- model: {},
5350
- lastValues: { default: () => ({}) },
5351
- isCompare: { type: Boolean, default: false },
5352
- config: {},
5353
- name: {},
5354
- size: {},
5355
- labelWidth: {},
5356
- prop: {},
5357
- expandMore: { type: Boolean },
5358
- disabled: { type: Boolean }
5359
- },
5360
- emits: ["change", "addDiffCount"],
5361
- setup(__props, { emit: __emit }) {
5362
- const tabPaneComponent = design.getDesignConfig("components")?.tabPane;
5363
- const tabsComponent = design.getDesignConfig("components")?.tabs;
5364
- const getActive = (mForm2, props2, activeTabName2) => {
5365
- const { config, model, prop } = props2;
5366
- const { active } = config;
5367
- if (typeof active === "function") return active(mForm2, { model, formValue: mForm2?.values, prop });
5368
- if (0 >= props2.config.items.length) return "0";
5369
- if (typeof active !== "undefined") return active;
5370
- return "0";
5371
- };
5372
- const tabClick = (mForm2, tab, props2) => {
5373
- const { config, model, prop } = props2;
5374
- tab.name = tab.paneName;
5375
- if (typeof config.onTabClick === "function") {
5376
- config.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
5377
- }
5378
- const tabConfig = config.items.find((item) => tab.name === item.status);
5379
- if (tabConfig && typeof tabConfig.onTabClick === "function") {
5380
- tabConfig.onTabClick(mForm2, tab, { model, formValue: mForm2?.values, prop, config });
5381
- }
5382
- };
5383
- const props = __props;
5384
- const emit = __emit;
5385
- const mForm = vue.inject("mForm");
5386
- const activeTabName = vue.ref(getActive(mForm, props));
5387
- const diffCount = vue.ref({});
5388
- const tabs = vue.computed(() => {
5389
- if (props.config.dynamic) {
5390
- if (!props.config.name) throw new Error("dynamic tab 必须配置name");
5391
- return props.model[props.config.name] || [];
5392
- }
5393
- return props.config.items.filter((item) => display(mForm, item.display, props));
5394
- });
5395
- const filter = (config) => filterFunction(mForm, config, props);
5396
- vue.watchEffect(() => {
5397
- if (typeof props.config.activeChange === "function") {
5398
- props.config.activeChange(mForm, activeTabName.value, {
5399
- model: props.model,
5400
- prop: props.prop
5401
- });
5402
- }
5403
- });
5404
- const tabItems = (tab) => props.config.dynamic ? props.config.items : tab.items;
5405
- const tabClickHandler = (tab) => tabClick(mForm, tab, props);
5406
- const onTabAdd = async () => {
5407
- if (!props.name) throw new Error("dynamic tab 必须配置name");
5408
- if (typeof props.config.onTabAdd === "function") {
5409
- props.config.onTabAdd(mForm, {
5410
- model: props.model,
5411
- prop: props.prop,
5412
- config: props.config
4780
+ config: props.config
5413
4781
  });
5414
4782
  emit("change", props.model);
5415
4783
  } else {
@@ -5466,12 +4834,12 @@
5466
4834
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event)
5467
4835
  },
5468
4836
  vue.unref(tabsComponent)?.props({
5469
- type: _ctx.config.tabType,
5470
- editable: _ctx.config.editable || false,
5471
- tabPosition: _ctx.config.tabPosition || "top"
4837
+ type: __props.config.tabType,
4838
+ editable: __props.config.editable || false,
4839
+ tabPosition: __props.config.tabPosition || "top"
5472
4840
  }) || {},
5473
4841
  {
5474
- class: `tmagic-design-tabs ${_ctx.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
4842
+ class: `tmagic-design-tabs ${__props.config.dynamic ? "magic-form-dynamic-tab" : "magic-form-tab"}`,
5475
4843
  onTabClick: tabClickHandler,
5476
4844
  onTabAdd,
5477
4845
  onTabRemove
@@ -5511,17 +4879,17 @@
5511
4879
  vue.Fragment,
5512
4880
  null,
5513
4881
  vue.renderList(tabItems(tab), (item) => {
5514
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
4882
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
5515
4883
  key: item[vue.unref(mForm)?.keyProp || "__key"],
5516
4884
  config: item,
5517
- disabled: _ctx.disabled,
5518
- model: _ctx.config.dynamic ? (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model)[tabIndex] : tab.name ? (_ctx.name ? _ctx.model[_ctx.name] : _ctx.model)[tab.name] : _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
5519
- "last-values": vue.unref(isEmpty)(_ctx.lastValues) ? {} : _ctx.config.dynamic ? (_ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues)[tabIndex] : tab.name ? (_ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues)[tab.name] : _ctx.name ? _ctx.lastValues[_ctx.name] : _ctx.lastValues,
5520
- "is-compare": _ctx.isCompare,
5521
- prop: _ctx.config.dynamic ? `${_ctx.prop}${_ctx.prop ? "." : ""}${String(tabIndex)}` : _ctx.prop,
5522
- size: _ctx.size,
5523
- "label-width": tab.labelWidth || _ctx.labelWidth,
5524
- "expand-more": _ctx.expandMore,
4885
+ disabled: __props.disabled,
4886
+ model: __props.config.dynamic ? (__props.name ? __props.model[__props.name] : __props.model)[tabIndex] : tab.name ? (__props.name ? __props.model[__props.name] : __props.model)[tab.name] : __props.name ? __props.model[__props.name] : __props.model,
4887
+ "last-values": vue.unref(isEmpty)(__props.lastValues) ? {} : __props.config.dynamic ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tabIndex] : tab.name ? (__props.name ? __props.lastValues[__props.name] : __props.lastValues)[tab.name] : __props.name ? __props.lastValues[__props.name] : __props.lastValues,
4888
+ "is-compare": __props.isCompare,
4889
+ prop: __props.config.dynamic ? `${__props.prop}${__props.prop ? "." : ""}${String(tabIndex)}` : __props.prop,
4890
+ size: __props.size,
4891
+ "label-width": tab.labelWidth || __props.labelWidth,
4892
+ "expand-more": __props.expandMore,
5525
4893
  onChange: changeHandler,
5526
4894
  onAddDiffCount: ($event) => onAddDiffCount(tabIndex)
5527
4895
  }, null, 8, ["config", "disabled", "model", "last-values", "is-compare", "prop", "size", "label-width", "expand-more", "onAddDiffCount"]);
@@ -5573,7 +4941,7 @@
5573
4941
  );
5574
4942
  };
5575
4943
 
5576
- const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
4944
+ const _sfc_main$q = /* @__PURE__ */ vue.defineComponent({
5577
4945
  ...{
5578
4946
  name: "MFormCascader"
5579
4947
  },
@@ -5601,21 +4969,28 @@
5601
4969
  const remoteData = vue.ref(null);
5602
4970
  const checkStrictly = vue.computed(() => filterFunction(mForm, props.config.checkStrictly, props));
5603
4971
  const valueSeparator = vue.computed(() => filterFunction(mForm, props.config.valueSeparator, props));
5604
- const value = vue.computed({
5605
- get() {
5606
- if (typeof props.model[props.name] === "string" && valueSeparator.value) {
5607
- return props.model[props.name].split(valueSeparator.value);
5608
- }
5609
- return props.model[props.name];
5610
- },
5611
- set(value2) {
5612
- let result = value2;
5613
- if (valueSeparator.value) {
5614
- result = value2.join(valueSeparator.value);
5615
- }
5616
- props.model[props.name] = result;
4972
+ const value = vue.computed(() => {
4973
+ if (typeof props.model[props.name] === "string" && valueSeparator.value) {
4974
+ return props.model[props.name].split(valueSeparator.value);
5617
4975
  }
4976
+ return props.model[props.name];
5618
4977
  });
4978
+ const updateModelValueHandler = (value2) => {
4979
+ let result = value2;
4980
+ if (valueSeparator.value) {
4981
+ result = value2.join(valueSeparator.value);
4982
+ }
4983
+ if (typeof result === "undefined") {
4984
+ if (Array.isArray(props.model[props.name])) {
4985
+ emit("change", []);
4986
+ } else if (typeof props.model[props.name] === "string") {
4987
+ emit("change", "");
4988
+ } else if (typeof props.model[props.name] === "object") {
4989
+ emit("change", null);
4990
+ }
4991
+ }
4992
+ emit("change", result);
4993
+ };
5619
4994
  const setRemoteOptions = async function() {
5620
4995
  const { config } = props;
5621
4996
  const { option } = config;
@@ -5667,34 +5042,33 @@
5667
5042
  if (!tMagicCascader.value) return;
5668
5043
  tMagicCascader.value.setQuery("");
5669
5044
  tMagicCascader.value.setPreviousQuery(null);
5670
- emit("change", props.model[props.name]);
5671
5045
  };
5672
5046
  return (_ctx, _cache) => {
5673
5047
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCascader), {
5674
- modelValue: value.value,
5675
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
5048
+ "model-value": value.value,
5676
5049
  ref_key: "tMagicCascader",
5677
5050
  ref: tMagicCascader,
5678
5051
  style: { "width": "100%" },
5679
5052
  clearable: "",
5680
5053
  filterable: "",
5681
- size: _ctx.size,
5682
- placeholder: _ctx.config.placeholder,
5683
- disabled: _ctx.disabled,
5054
+ size: __props.size,
5055
+ placeholder: __props.config.placeholder,
5056
+ disabled: __props.disabled,
5684
5057
  options: options.value,
5685
- "popper-class": _ctx.config.popperClass,
5058
+ "popper-class": __props.config.popperClass,
5686
5059
  props: {
5687
- multiple: _ctx.config.multiple ?? false,
5688
- emitPath: _ctx.config.emitPath ?? true,
5060
+ multiple: __props.config.multiple ?? false,
5061
+ emitPath: __props.config.emitPath ?? true,
5689
5062
  checkStrictly: checkStrictly.value ?? false
5690
5063
  },
5064
+ "onUpdate:modelValue": updateModelValueHandler,
5691
5065
  onChange: changeHandler
5692
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
5066
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "options", "popper-class", "props"]);
5693
5067
  };
5694
5068
  }
5695
5069
  });
5696
5070
 
5697
- const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
5071
+ const _sfc_main$p = /* @__PURE__ */ vue.defineComponent({
5698
5072
  ...{
5699
5073
  name: "MFormCheckbox"
5700
5074
  },
@@ -5740,29 +5114,33 @@
5740
5114
  };
5741
5115
  return (_ctx, _cache) => {
5742
5116
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCheckbox), {
5743
- modelValue: _ctx.model[_ctx.name],
5744
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5745
- size: _ctx.size,
5117
+ "model-value": __props.model[__props.name],
5118
+ size: __props.size,
5746
5119
  trueValue: activeValue.value,
5747
5120
  falseValue: inactiveValue.value,
5748
- disabled: _ctx.disabled,
5749
- onChange: changeHandler
5750
- }, {
5751
- default: vue.withCtx(() => [
5752
- vue.createTextVNode(
5753
- vue.toDisplayString(_ctx.config.text),
5754
- 1
5755
- /* TEXT */
5756
- )
5757
- ]),
5758
- _: 1
5759
- /* STABLE */
5760
- }, 8, ["modelValue", "size", "trueValue", "falseValue", "disabled"]);
5121
+ disabled: __props.disabled,
5122
+ "onUpdate:modelValue": changeHandler
5123
+ }, vue.createSlots({
5124
+ _: 2
5125
+ /* DYNAMIC */
5126
+ }, [
5127
+ !__props.config.useLabel ? {
5128
+ name: "default",
5129
+ fn: vue.withCtx(() => [
5130
+ vue.createTextVNode(
5131
+ vue.toDisplayString(__props.config.text),
5132
+ 1
5133
+ /* TEXT */
5134
+ )
5135
+ ]),
5136
+ key: "0"
5137
+ } : void 0
5138
+ ]), 1032, ["model-value", "size", "trueValue", "falseValue", "disabled"]);
5761
5139
  };
5762
5140
  }
5763
5141
  });
5764
5142
 
5765
- const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
5143
+ const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
5766
5144
  ...{
5767
5145
  name: "MFormCheckGroup"
5768
5146
  },
@@ -5798,11 +5176,10 @@
5798
5176
  });
5799
5177
  return (_ctx, _cache) => {
5800
5178
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCheckboxGroup), {
5801
- modelValue: _ctx.model[_ctx.name],
5802
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5803
- size: _ctx.size,
5804
- disabled: _ctx.disabled,
5805
- onChange: changeHandler
5179
+ "model-value": __props.model[__props.name],
5180
+ size: __props.size,
5181
+ disabled: __props.disabled,
5182
+ "onUpdate:modelValue": changeHandler
5806
5183
  }, {
5807
5184
  default: vue.withCtx(() => [
5808
5185
  (vue.openBlock(true), vue.createElementBlock(
@@ -5831,12 +5208,12 @@
5831
5208
  ]),
5832
5209
  _: 1
5833
5210
  /* STABLE */
5834
- }, 8, ["modelValue", "size", "disabled"]);
5211
+ }, 8, ["model-value", "size", "disabled"]);
5835
5212
  };
5836
5213
  }
5837
5214
  });
5838
5215
 
5839
- const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
5216
+ const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
5840
5217
  ...{
5841
5218
  name: "MFormColorPicker"
5842
5219
  },
@@ -5860,18 +5237,17 @@
5860
5237
  const changeHandler = (value) => emit("change", value);
5861
5238
  return (_ctx, _cache) => {
5862
5239
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicColorPicker), {
5863
- modelValue: _ctx.model[_ctx.name],
5864
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5865
- size: _ctx.size,
5866
- disabled: _ctx.disabled,
5240
+ "model-value": __props.model[__props.name],
5241
+ size: __props.size,
5242
+ disabled: __props.disabled,
5867
5243
  showAlpha: true,
5868
- onChange: changeHandler
5869
- }, null, 8, ["modelValue", "size", "disabled"]);
5244
+ "onUpdate:modelValue": changeHandler
5245
+ }, null, 8, ["model-value", "size", "disabled"]);
5870
5246
  };
5871
5247
  }
5872
5248
  });
5873
5249
 
5874
- const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
5250
+ const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
5875
5251
  ...{
5876
5252
  name: "MFormDate"
5877
5253
  },
@@ -5898,21 +5274,20 @@
5898
5274
  };
5899
5275
  return (_ctx, _cache) => {
5900
5276
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDatePicker), {
5901
- modelValue: _ctx.model[_ctx.name],
5902
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5277
+ "model-value": __props.model[__props.name],
5903
5278
  type: "date",
5904
- size: _ctx.size,
5905
- placeholder: _ctx.config.placeholder,
5906
- disabled: _ctx.disabled,
5907
- format: _ctx.config.format || "YYYY/MM/DD",
5908
- "value-format": _ctx.config.valueFormat || "YYYY/MM/DD",
5909
- onChange: changeHandler
5910
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format"]);
5279
+ size: __props.size,
5280
+ placeholder: __props.config.placeholder,
5281
+ disabled: __props.disabled,
5282
+ format: __props.config.format || "YYYY/MM/DD",
5283
+ "value-format": __props.config.valueFormat || "YYYY/MM/DD",
5284
+ "onUpdate:modelValue": changeHandler
5285
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format"]);
5911
5286
  };
5912
5287
  }
5913
5288
  });
5914
5289
 
5915
- const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
5290
+ const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
5916
5291
  ...{
5917
5292
  name: "MFormDateRange"
5918
5293
  },
@@ -5993,26 +5368,25 @@
5993
5368
  };
5994
5369
  return (_ctx, _cache) => {
5995
5370
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDatePicker), {
5996
- modelValue: value.value,
5997
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
5371
+ "model-value": value.value,
5998
5372
  type: "datetimerange",
5999
5373
  "range-separator": "-",
6000
5374
  "start-placeholder": "开始日期",
6001
5375
  "end-placeholder": "结束日期",
6002
- size: _ctx.size,
5376
+ size: __props.size,
6003
5377
  "unlink-panels": true,
6004
- disabled: _ctx.disabled,
6005
- "default-time": _ctx.config.defaultTime,
6006
- "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
6007
- "date-format": _ctx.config.dateFormat || "YYYY/MM/DD",
6008
- "time-format": _ctx.config.timeFormat || "HH:mm:ss",
6009
- onChange: changeHandler
6010
- }, null, 8, ["modelValue", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
5378
+ disabled: __props.disabled,
5379
+ "default-time": __props.config.defaultTime,
5380
+ "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
5381
+ "date-format": __props.config.dateFormat || "YYYY/MM/DD",
5382
+ "time-format": __props.config.timeFormat || "HH:mm:ss",
5383
+ "onUpdate:modelValue": changeHandler
5384
+ }, null, 8, ["model-value", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
6011
5385
  };
6012
5386
  }
6013
5387
  });
6014
5388
 
6015
- const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
5389
+ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
6016
5390
  ...{
6017
5391
  name: "MFormDateTime"
6018
5392
  },
@@ -6050,24 +5424,23 @@
6050
5424
  };
6051
5425
  return (_ctx, _cache) => {
6052
5426
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDatePicker), {
6053
- modelValue: _ctx.model[_ctx.name],
6054
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5427
+ "model-value": __props.model[__props.name],
6055
5428
  "popper-class": "magic-datetime-picker-popper",
6056
5429
  type: "datetime",
6057
- size: _ctx.size,
6058
- placeholder: _ctx.config.placeholder,
6059
- disabled: _ctx.disabled,
6060
- format: _ctx.config.format || "YYYY/MM/DD HH:mm:ss",
6061
- "value-format": _ctx.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
6062
- "default-time": _ctx.config.defaultTime,
6063
- onChange: changeHandler
6064
- }, null, 8, ["modelValue", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
5430
+ size: __props.size,
5431
+ placeholder: __props.config.placeholder,
5432
+ disabled: __props.disabled,
5433
+ format: __props.config.format || "YYYY/MM/DD HH:mm:ss",
5434
+ "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
5435
+ "default-time": __props.config.defaultTime,
5436
+ "onUpdate:modelValue": changeHandler
5437
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "format", "value-format", "default-time"]);
6065
5438
  };
6066
5439
  }
6067
5440
  });
6068
5441
 
6069
5442
  const _hoisted_1$8 = { key: 0 };
6070
- const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
5443
+ const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
6071
5444
  ...{
6072
5445
  name: "MFormDisplay"
6073
5446
  },
@@ -6090,10 +5463,10 @@
6090
5463
  }
6091
5464
  useAddField(props.prop);
6092
5465
  return (_ctx, _cache) => {
6093
- return _ctx.model ? (vue.openBlock(), vue.createElementBlock(
5466
+ return __props.model ? (vue.openBlock(), vue.createElementBlock(
6094
5467
  "span",
6095
5468
  _hoisted_1$8,
6096
- vue.toDisplayString(_ctx.model[_ctx.name]),
5469
+ vue.toDisplayString(__props.model[__props.name]),
6097
5470
  1
6098
5471
  /* TEXT */
6099
5472
  )) : vue.createCommentVNode("v-if", true);
@@ -6102,7 +5475,7 @@
6102
5475
  });
6103
5476
 
6104
5477
  const _hoisted_1$7 = { class: "m-fields-dynamic-field" };
6105
- const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
5478
+ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
6106
5479
  ...{
6107
5480
  name: "MFormDynamicField"
6108
5481
  },
@@ -6203,7 +5576,7 @@
6203
5576
  }
6204
5577
  });
6205
5578
 
6206
- const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
5579
+ const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
6207
5580
  ...{
6208
5581
  name: "MFormHidden"
6209
5582
  },
@@ -6223,24 +5596,24 @@
6223
5596
  const props = __props;
6224
5597
  useAddField(props.prop);
6225
5598
  return (_ctx, _cache) => {
6226
- return _ctx.model ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
5599
+ return __props.model ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
6227
5600
  "input",
6228
5601
  {
6229
5602
  key: 0,
6230
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
5603
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
6231
5604
  type: "hidden"
6232
5605
  },
6233
5606
  null,
6234
5607
  512
6235
5608
  /* NEED_PATCH */
6236
5609
  )), [
6237
- [vue.vModelText, _ctx.model[_ctx.name]]
5610
+ [vue.vModelText, __props.model[__props.name]]
6238
5611
  ]) : vue.createCommentVNode("v-if", true);
6239
5612
  };
6240
5613
  }
6241
5614
  });
6242
5615
 
6243
- const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
5616
+ const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
6244
5617
  ...{
6245
5618
  name: "MForm"
6246
5619
  },
@@ -6267,7 +5640,7 @@
6267
5640
  setup(__props, { expose: __expose, emit: __emit }) {
6268
5641
  const props = __props;
6269
5642
  const emit = __emit;
6270
- const tMagicForm = vue.ref();
5643
+ const tMagicFormRef = vue.useTemplateRef("tMagicForm");
6271
5644
  const initialized = vue.ref(false);
6272
5645
  const values = vue.ref({});
6273
5646
  const lastValuesProcessed = vue.ref({});
@@ -6344,7 +5717,17 @@
6344
5717
  );
6345
5718
  const changeHandler = (v, eventData) => {
6346
5719
  if (eventData.changeRecords?.length) {
6347
- changeRecords.value.push(...eventData.changeRecords);
5720
+ for (const record of eventData.changeRecords) {
5721
+ if (record.propPath) {
5722
+ const index = changeRecords.value.findIndex((item) => item.propPath === record.propPath);
5723
+ if (index > -1) {
5724
+ changeRecords.value[index] = record;
5725
+ } else {
5726
+ changeRecords.value.push(record);
5727
+ }
5728
+ utils.setValueByKeyPath(record.propPath, record.value, values.value);
5729
+ }
5730
+ }
6348
5731
  }
6349
5732
  emit("change", values.value, eventData);
6350
5733
  };
@@ -6361,12 +5744,13 @@
6361
5744
  changeRecords,
6362
5745
  changeHandler,
6363
5746
  resetForm: () => {
6364
- tMagicForm.value?.resetFields();
5747
+ tMagicFormRef.value?.resetFields();
6365
5748
  changeRecords.value = [];
6366
5749
  },
6367
5750
  submitForm: async (native) => {
6368
5751
  try {
6369
- await tMagicForm.value?.validate();
5752
+ await tMagicFormRef.value?.validate();
5753
+ changeRecords.value = [];
6370
5754
  return native ? values.value : cloneDeep(vue.toRaw(values.value));
6371
5755
  } catch (invalidFields) {
6372
5756
  emit("error", invalidFields);
@@ -6385,30 +5769,29 @@
6385
5769
  return (_ctx, _cache) => {
6386
5770
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicForm), {
6387
5771
  class: "m-form",
6388
- ref_key: "tMagicForm",
6389
- ref: tMagicForm,
5772
+ ref: "tMagicForm",
6390
5773
  model: values.value,
6391
- "label-width": _ctx.labelWidth,
6392
- style: vue.normalizeStyle(`height: ${_ctx.height}`),
6393
- inline: _ctx.inline,
6394
- "label-position": _ctx.labelPosition,
5774
+ "label-width": __props.labelWidth,
5775
+ style: vue.normalizeStyle(`height: ${__props.height}`),
5776
+ inline: __props.inline,
5777
+ "label-position": __props.labelPosition,
6395
5778
  onSubmit: submitHandler
6396
5779
  }, {
6397
5780
  default: vue.withCtx(() => [
6398
- initialized.value && Array.isArray(_ctx.config) ? (vue.openBlock(true), vue.createElementBlock(
5781
+ initialized.value && Array.isArray(__props.config) ? (vue.openBlock(true), vue.createElementBlock(
6399
5782
  vue.Fragment,
6400
5783
  { key: 0 },
6401
- vue.renderList(_ctx.config, (item, index) => {
6402
- return vue.openBlock(), vue.createBlock(_sfc_main$x, {
6403
- disabled: _ctx.disabled,
6404
- key: item[_ctx.keyProp] ?? index,
5784
+ vue.renderList(__props.config, (item, index) => {
5785
+ return vue.openBlock(), vue.createBlock(_sfc_main$A, {
5786
+ disabled: __props.disabled,
5787
+ key: item[__props.keyProp] ?? index,
6405
5788
  config: item,
6406
5789
  model: values.value,
6407
5790
  "last-values": lastValuesProcessed.value,
6408
- "is-compare": _ctx.isCompare,
6409
- "label-width": item.labelWidth || _ctx.labelWidth,
6410
- "step-active": _ctx.stepActive,
6411
- size: _ctx.size,
5791
+ "is-compare": __props.isCompare,
5792
+ "label-width": item.labelWidth || __props.labelWidth,
5793
+ "step-active": __props.stepActive,
5794
+ size: __props.size,
6412
5795
  onChange: changeHandler
6413
5796
  }, null, 8, ["disabled", "config", "model", "last-values", "is-compare", "label-width", "step-active", "size"]);
6414
5797
  }),
@@ -6424,7 +5807,7 @@
6424
5807
  });
6425
5808
 
6426
5809
  const _hoisted_1$6 = { style: { "min-height": "1px" } };
6427
- const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
5810
+ const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
6428
5811
  ...{
6429
5812
  name: "MFormDialog"
6430
5813
  },
@@ -6518,10 +5901,10 @@
6518
5901
  class: "m-form-dialog",
6519
5902
  top: "20px",
6520
5903
  "append-to-body": "",
6521
- title: _ctx.title,
6522
- width: _ctx.width,
6523
- zIndex: _ctx.zIndex,
6524
- fullscreen: _ctx.fullscreen,
5904
+ title: __props.title,
5905
+ width: __props.width,
5906
+ zIndex: __props.zIndex,
5907
+ fullscreen: __props.fullscreen,
6525
5908
  "close-on-click-modal": false,
6526
5909
  onClose: closeHandler
6527
5910
  }, {
@@ -6592,13 +5975,13 @@
6592
5975
  key: 2,
6593
5976
  type: "primary",
6594
5977
  size: "small",
6595
- disabled: _ctx.disabled,
5978
+ disabled: __props.disabled,
6596
5979
  loading: saveFetch.value,
6597
5980
  onClick: save
6598
5981
  }, {
6599
5982
  default: vue.withCtx(() => [
6600
5983
  vue.createTextVNode(
6601
- vue.toDisplayString(_ctx.confirmText),
5984
+ vue.toDisplayString(__props.confirmText),
6602
5985
  1
6603
5986
  /* TEXT */
6604
5987
  )
@@ -6625,20 +6008,20 @@
6625
6008
  style: vue.normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
6626
6009
  },
6627
6010
  [
6628
- vue.createVNode(_sfc_main$d, {
6011
+ vue.createVNode(_sfc_main$g, {
6629
6012
  modelValue: stepActive.value,
6630
6013
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
6631
6014
  ref_key: "form",
6632
6015
  ref: form,
6633
- size: _ctx.size,
6634
- disabled: _ctx.disabled,
6635
- config: _ctx.config,
6636
- "init-values": _ctx.values,
6637
- "parent-values": _ctx.parentValues,
6638
- "label-width": _ctx.labelWidth,
6639
- "label-position": _ctx.labelPosition,
6640
- inline: _ctx.inline,
6641
- "prevent-submit-default": _ctx.preventSubmitDefault,
6016
+ size: __props.size,
6017
+ disabled: __props.disabled,
6018
+ config: __props.config,
6019
+ "init-values": __props.values,
6020
+ "parent-values": __props.parentValues,
6021
+ "label-width": __props.labelWidth,
6022
+ "label-position": __props.labelPosition,
6023
+ inline: __props.inline,
6024
+ "prevent-submit-default": __props.preventSubmitDefault,
6642
6025
  onChange: changeHandler
6643
6026
  }, null, 8, ["modelValue", "size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
6644
6027
  vue.renderSlot(_ctx.$slots, "default")
@@ -6655,11 +6038,11 @@
6655
6038
  });
6656
6039
 
6657
6040
  const _hoisted_1$5 = ["href"];
6658
- const _hoisted_2$1 = {
6041
+ const _hoisted_2$2 = {
6659
6042
  key: 2,
6660
6043
  class: "m-fields-link"
6661
6044
  };
6662
- const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
6045
+ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
6663
6046
  ...{
6664
6047
  name: "MFormLink"
6665
6048
  },
@@ -6723,21 +6106,21 @@
6723
6106
  editor.value && (editor.value.dialogVisible = false);
6724
6107
  };
6725
6108
  return (_ctx, _cache) => {
6726
- return _ctx.config.href && !_ctx.disabled ? (vue.openBlock(), vue.createElementBlock("a", {
6109
+ return __props.config.href && !__props.disabled ? (vue.openBlock(), vue.createElementBlock("a", {
6727
6110
  key: 0,
6728
6111
  target: "_blank",
6729
6112
  href: href.value,
6730
- style: vue.normalizeStyle(_ctx.config.css || {})
6731
- }, vue.toDisplayString(displayText.value), 13, _hoisted_1$5)) : _ctx.config.href && _ctx.disabled ? (vue.openBlock(), vue.createElementBlock(
6113
+ style: vue.normalizeStyle(__props.config.css || {})
6114
+ }, vue.toDisplayString(displayText.value), 13, _hoisted_1$5)) : __props.config.href && __props.disabled ? (vue.openBlock(), vue.createElementBlock(
6732
6115
  "span",
6733
6116
  {
6734
6117
  key: 1,
6735
- style: vue.normalizeStyle(_ctx.config.disabledCss || {})
6118
+ style: vue.normalizeStyle(__props.config.disabledCss || {})
6736
6119
  },
6737
6120
  vue.toDisplayString(displayText.value),
6738
6121
  5
6739
6122
  /* TEXT, STYLE */
6740
- )) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$1, [
6123
+ )) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$2, [
6741
6124
  vue.createVNode(vue.unref(design.TMagicButton), {
6742
6125
  link: "",
6743
6126
  type: "primary",
@@ -6753,15 +6136,15 @@
6753
6136
  _: 1
6754
6137
  /* STABLE */
6755
6138
  }),
6756
- vue.createVNode(_sfc_main$c, {
6139
+ vue.createVNode(_sfc_main$f, {
6757
6140
  ref_key: "editor",
6758
6141
  ref: editor,
6759
- title: _ctx.config.formTitle || "编辑扩展配置",
6760
- width: _ctx.config.formWidth,
6142
+ title: __props.config.formTitle || "编辑扩展配置",
6143
+ width: __props.config.formWidth,
6761
6144
  values: formValue.value,
6762
6145
  config: formConfig.value,
6763
- parentValues: _ctx.values,
6764
- fullscreen: _ctx.config.fullscreen,
6146
+ parentValues: __props.values,
6147
+ fullscreen: __props.config.fullscreen,
6765
6148
  onSubmit: action
6766
6149
  }, null, 8, ["title", "width", "values", "config", "parentValues", "fullscreen"])
6767
6150
  ]));
@@ -6769,7 +6152,7 @@
6769
6152
  }
6770
6153
  });
6771
6154
 
6772
- const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
6155
+ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
6773
6156
  ...{
6774
6157
  name: "MFormNumber"
6775
6158
  },
@@ -6799,27 +6182,26 @@
6799
6182
  mForm?.$emit("field-input", props.prop, v);
6800
6183
  };
6801
6184
  return (_ctx, _cache) => {
6802
- return _ctx.model ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInputNumber), {
6185
+ return __props.model ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInputNumber), {
6803
6186
  key: 0,
6804
- modelValue: _ctx.model[_ctx.name],
6805
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
6187
+ "model-value": __props.model[__props.name],
6806
6188
  clearable: "",
6807
6189
  "controls-position": "right",
6808
- size: _ctx.size,
6809
- max: _ctx.config.max,
6810
- min: _ctx.config.min,
6811
- step: _ctx.config.step,
6812
- placeholder: _ctx.config.placeholder,
6813
- disabled: _ctx.disabled,
6814
- onChange: changeHandler,
6190
+ size: __props.size,
6191
+ max: __props.config.max,
6192
+ min: __props.config.min,
6193
+ step: __props.config.step,
6194
+ placeholder: __props.config.placeholder,
6195
+ disabled: __props.disabled,
6196
+ "onUpdate:modelValue": changeHandler,
6815
6197
  onInput: inputHandler
6816
- }, null, 8, ["modelValue", "size", "max", "min", "step", "placeholder", "disabled"])) : vue.createCommentVNode("v-if", true);
6198
+ }, null, 8, ["model-value", "size", "max", "min", "step", "placeholder", "disabled"])) : vue.createCommentVNode("v-if", true);
6817
6199
  };
6818
6200
  }
6819
6201
  });
6820
6202
 
6821
6203
  const _hoisted_1$4 = { class: "m-fields-number-range" };
6822
- const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
6204
+ const _sfc_main$c = /* @__PURE__ */ vue.defineComponent({
6823
6205
  ...{
6824
6206
  name: "MFormNumberRange"
6825
6207
  },
@@ -6852,14 +6234,13 @@
6852
6234
  return (_ctx, _cache) => {
6853
6235
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, [
6854
6236
  vue.createVNode(vue.unref(design.TMagicInput), {
6855
- modelValue: _ctx.model[_ctx.name][0],
6856
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name][0] = $event),
6857
- clearable: "",
6858
- size: _ctx.size,
6859
- disabled: _ctx.disabled,
6860
- onChange: minChangeHandler
6861
- }, null, 8, ["modelValue", "size", "disabled"]),
6862
- _cache[2] || (_cache[2] = vue.createElementVNode(
6237
+ "model-value": __props.model[__props.name][0],
6238
+ clearable: __props.config.clearable ?? true,
6239
+ size: __props.size,
6240
+ disabled: __props.disabled,
6241
+ "onUpdate:modelValue": minChangeHandler
6242
+ }, null, 8, ["model-value", "clearable", "size", "disabled"]),
6243
+ _cache[0] || (_cache[0] = vue.createElementVNode(
6863
6244
  "span",
6864
6245
  { class: "split-tag" },
6865
6246
  "-",
@@ -6867,20 +6248,18 @@
6867
6248
  /* CACHED */
6868
6249
  )),
6869
6250
  vue.createVNode(vue.unref(design.TMagicInput), {
6870
- modelValue: _ctx.model[_ctx.name][1],
6871
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.model[_ctx.name][1] = $event),
6872
- clearable: "",
6873
- size: _ctx.size,
6874
- disabled: _ctx.disabled,
6875
- onChange: maxChangeHandler
6876
- }, null, 8, ["modelValue", "size", "disabled"])
6251
+ "model-value": __props.model[__props.name][1],
6252
+ clearable: __props.config.clearable ?? true,
6253
+ size: __props.size,
6254
+ disabled: __props.disabled,
6255
+ "onUpdate:modelValue": maxChangeHandler
6256
+ }, null, 8, ["model-value", "clearable", "size", "disabled"])
6877
6257
  ]);
6878
6258
  };
6879
6259
  }
6880
6260
  });
6881
6261
 
6882
- const _hoisted_1$3 = { key: 1 };
6883
- const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
6262
+ const _sfc_main$b = /* @__PURE__ */ vue.defineComponent({
6884
6263
  ...{
6885
6264
  name: "MFormRadioGroup"
6886
6265
  },
@@ -6901,56 +6280,54 @@
6901
6280
  const props = __props;
6902
6281
  const itemComponent = vue.computed(() => props.config.childType === "button" ? design.TMagicRadioButton : design.TMagicRadio);
6903
6282
  const emit = __emit;
6904
- const changeHandler = (value) => {
6905
- emit("change", value);
6906
- };
6907
6283
  const clickHandler = (item) => {
6908
- props.model[props.name] = props.model[props.name] === item ? "" : item;
6909
- changeHandler(props.model[props.name]);
6284
+ emit("change", props.model[props.name] === item ? "" : item);
6910
6285
  };
6911
6286
  useAddField(props.prop);
6287
+ const iconSize = vue.computed(() => {
6288
+ if (props.size === "small") {
6289
+ return "12";
6290
+ }
6291
+ if (props.size === "large") {
6292
+ return "16";
6293
+ }
6294
+ return "14";
6295
+ });
6912
6296
  return (_ctx, _cache) => {
6913
- return _ctx.model ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicRadioGroup), {
6297
+ return __props.model ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicRadioGroup), {
6914
6298
  key: 0,
6915
- modelValue: _ctx.model[_ctx.name],
6916
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
6917
- size: _ctx.size,
6918
- disabled: _ctx.disabled
6299
+ "model-value": __props.model[__props.name],
6300
+ size: __props.size,
6301
+ disabled: __props.disabled
6919
6302
  }, {
6920
6303
  default: vue.withCtx(() => [
6921
6304
  (vue.openBlock(true), vue.createElementBlock(
6922
6305
  vue.Fragment,
6923
6306
  null,
6924
- vue.renderList(_ctx.config.options, (option) => {
6307
+ vue.renderList(__props.config.options, (option) => {
6925
6308
  return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(itemComponent.value), {
6926
6309
  value: option.value,
6927
6310
  key: `${option.value}`,
6928
- onClick: vue.withModifiers(($event) => clickHandler(option.value), ["prevent"])
6311
+ onClick: ($event) => clickHandler(option.value)
6929
6312
  }, {
6930
6313
  default: vue.withCtx(() => [
6931
- option.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
6932
- key: 0,
6314
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
6315
+ disabled: !Boolean(option.tooltip),
6933
6316
  placement: "top-start",
6934
6317
  content: option.tooltip
6935
6318
  }, {
6936
6319
  default: vue.withCtx(() => [
6937
6320
  vue.createElementVNode("div", null, [
6938
- option.icon ? (vue.openBlock(), vue.createBlock(
6939
- vue.unref(design.TMagicIcon),
6940
- {
6941
- key: 0,
6942
- size: "16"
6943
- },
6944
- {
6945
- default: vue.withCtx(() => [
6946
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(option.icon)))
6947
- ]),
6948
- _: 2
6949
- /* DYNAMIC */
6950
- },
6951
- 1024
6952
- /* DYNAMIC_SLOTS */
6953
- )) : vue.createCommentVNode("v-if", true),
6321
+ option.icon ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicIcon), {
6322
+ key: 0,
6323
+ size: iconSize.value
6324
+ }, {
6325
+ default: vue.withCtx(() => [
6326
+ (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(option.icon)))
6327
+ ]),
6328
+ _: 2
6329
+ /* DYNAMIC */
6330
+ }, 1032, ["size"])) : vue.createCommentVNode("v-if", true),
6954
6331
  vue.createElementVNode(
6955
6332
  "span",
6956
6333
  null,
@@ -6962,31 +6339,7 @@
6962
6339
  ]),
6963
6340
  _: 2
6964
6341
  /* DYNAMIC */
6965
- }, 1032, ["content"])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
6966
- option.icon ? (vue.openBlock(), vue.createBlock(
6967
- vue.unref(design.TMagicIcon),
6968
- {
6969
- key: 0,
6970
- size: "16"
6971
- },
6972
- {
6973
- default: vue.withCtx(() => [
6974
- (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(option.icon)))
6975
- ]),
6976
- _: 2
6977
- /* DYNAMIC */
6978
- },
6979
- 1024
6980
- /* DYNAMIC_SLOTS */
6981
- )) : vue.createCommentVNode("v-if", true),
6982
- vue.createElementVNode(
6983
- "span",
6984
- null,
6985
- vue.toDisplayString(option.text),
6986
- 1
6987
- /* TEXT */
6988
- )
6989
- ]))
6342
+ }, 1032, ["disabled", "content"])
6990
6343
  ]),
6991
6344
  _: 2
6992
6345
  /* DYNAMIC */
@@ -6998,13 +6351,13 @@
6998
6351
  ]),
6999
6352
  _: 1
7000
6353
  /* STABLE */
7001
- }, 8, ["modelValue", "size", "disabled"])) : vue.createCommentVNode("v-if", true);
6354
+ }, 8, ["model-value", "size", "disabled"])) : vue.createCommentVNode("v-if", true);
7002
6355
  };
7003
6356
  }
7004
6357
  });
7005
6358
 
7006
- const _hoisted_1$2 = { key: 2 };
7007
- const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
6359
+ const _hoisted_1$3 = { key: 2 };
6360
+ const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
7008
6361
  ...{
7009
6362
  name: "MFormSelect"
7010
6363
  },
@@ -7329,29 +6682,28 @@
7329
6682
  });
7330
6683
  return (_ctx, _cache) => {
7331
6684
  const _directive_loading = vue.resolveDirective("loading");
7332
- return _ctx.model ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(design.TMagicSelect), {
6685
+ return __props.model ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(design.TMagicSelect), {
7333
6686
  key: 0,
7334
- modelValue: _ctx.model[_ctx.name],
7335
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
6687
+ "model-value": __props.model[__props.name],
7336
6688
  class: "m-select",
7337
6689
  ref_key: "tMagicSelect",
7338
6690
  ref: tMagicSelect,
7339
- clearable: typeof _ctx.config.clearable !== "undefined" ? _ctx.config.clearable : true,
7340
- filterable: typeof _ctx.config.filterable !== "undefined" ? _ctx.config.filterable : true,
6691
+ clearable: typeof __props.config.clearable !== "undefined" ? __props.config.clearable : true,
6692
+ filterable: typeof __props.config.filterable !== "undefined" ? __props.config.filterable : true,
7341
6693
  "popper-class": `m-select-popper ${vue.unref(popperClass)}`,
7342
- size: _ctx.size,
6694
+ size: __props.size,
7343
6695
  remote: remote.value,
7344
- placeholder: _ctx.config.placeholder,
7345
- multiple: _ctx.config.multiple,
7346
- "value-key": _ctx.config.valueKey || "value",
7347
- "allow-create": _ctx.config.allowCreate,
7348
- disabled: _ctx.disabled,
7349
- "remote-method": _ctx.config.remote && remoteMethod,
7350
- onChange: changeHandler,
6696
+ placeholder: __props.config.placeholder,
6697
+ multiple: __props.config.multiple,
6698
+ "value-key": __props.config.valueKey || "value",
6699
+ "allow-create": __props.config.allowCreate,
6700
+ disabled: __props.disabled,
6701
+ "remote-method": __props.config.remote && remoteMethod,
6702
+ "onUpdate:modelValue": changeHandler,
7351
6703
  onVisibleChange: visibleHandler
7352
6704
  }, {
7353
6705
  default: vue.withCtx(() => [
7354
- _ctx.config.group ? (vue.openBlock(true), vue.createElementBlock(
6706
+ __props.config.group ? (vue.openBlock(true), vue.createElementBlock(
7355
6707
  vue.Fragment,
7356
6708
  { key: 0 },
7357
6709
  vue.renderList(options.value, (group, index) => {
@@ -7416,7 +6768,7 @@
7416
6768
  vue.mergeProps(
7417
6769
  {
7418
6770
  class: "tmagic-design-option",
7419
- key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value
6771
+ key: __props.config.valueKey ? option.value[__props.config.valueKey] : option.value
7420
6772
  },
7421
6773
  { ref_for: true },
7422
6774
  vue.unref(optionComponent)?.props({
@@ -7439,7 +6791,7 @@
7439
6791
  )),
7440
6792
  moreLoadingVisible.value ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
7441
6793
  "div",
7442
- _hoisted_1$2,
6794
+ _hoisted_1$3,
7443
6795
  null,
7444
6796
  512
7445
6797
  /* NEED_PATCH */
@@ -7449,14 +6801,14 @@
7449
6801
  ]),
7450
6802
  _: 1
7451
6803
  /* STABLE */
7452
- }, 8, ["modelValue", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
6804
+ }, 8, ["model-value", "clearable", "filterable", "popper-class", "size", "remote", "placeholder", "multiple", "value-key", "allow-create", "disabled", "remote-method"])), [
7453
6805
  [_directive_loading, loading.value]
7454
6806
  ]) : vue.createCommentVNode("v-if", true);
7455
6807
  };
7456
6808
  }
7457
6809
  });
7458
6810
 
7459
- const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
6811
+ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
7460
6812
  ...{
7461
6813
  name: "MFormSwitch"
7462
6814
  },
@@ -7502,21 +6854,21 @@
7502
6854
  });
7503
6855
  return (_ctx, _cache) => {
7504
6856
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicSwitch), {
7505
- modelValue: _ctx.model[_ctx.name],
7506
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
7507
- size: _ctx.size,
6857
+ "model-value": __props.model[__props.name],
6858
+ size: __props.size,
7508
6859
  activeValue: activeValue.value,
7509
6860
  inactiveValue: inactiveValue.value,
7510
- disabled: _ctx.disabled,
7511
- onChange: changeHandler
7512
- }, null, 8, ["modelValue", "size", "activeValue", "inactiveValue", "disabled"]);
6861
+ disabled: __props.disabled,
6862
+ "onUpdate:modelValue": changeHandler
6863
+ }, null, 8, ["model-value", "size", "activeValue", "inactiveValue", "disabled"]);
7513
6864
  };
7514
6865
  }
7515
6866
  });
7516
6867
 
7517
- const _hoisted_1$1 = { style: { "width": "100%" } };
7518
- const _hoisted_2 = { style: { "display": "flex", "justify-content": "flex-end" } };
7519
- const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
6868
+ const _hoisted_1$2 = { class: "m-fields-text" };
6869
+ const _hoisted_2$1 = { key: 1 };
6870
+ const _hoisted_3$1 = { style: { "display": "flex", "justify-content": "flex-end" } };
6871
+ const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
7520
6872
  ...{
7521
6873
  name: "MFormText"
7522
6874
  },
@@ -7541,16 +6893,25 @@
7541
6893
  const appendConfig = vue.computed(() => {
7542
6894
  if (typeof props.config.append === "string") {
7543
6895
  return {
6896
+ type: "text",
7544
6897
  text: props.config.append,
7545
- type: "button",
7546
6898
  handler: void 0
7547
6899
  };
7548
6900
  }
7549
- if (props.config.append && typeof props.config.append === "object") {
7550
- if (props.config.append.value === 0) {
7551
- return false;
6901
+ if (typeof props.config.append === "object") {
6902
+ if (typeof props.config.append?.handler === "function") {
6903
+ return {
6904
+ type: "button",
6905
+ text: props.config.append.text,
6906
+ handler: props.config.append.handler
6907
+ };
6908
+ }
6909
+ if (props.config.append) {
6910
+ if (props.config.append.value === 0) {
6911
+ return false;
6912
+ }
6913
+ return props.config.append;
7552
6914
  }
7553
- return props.config.append;
7554
6915
  }
7555
6916
  return false;
7556
6917
  });
@@ -7655,30 +7016,42 @@
7655
7016
  instanceRef.value = void 0;
7656
7017
  };
7657
7018
  return (_ctx, _cache) => {
7658
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
7019
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
7659
7020
  vue.createVNode(vue.unref(design.TMagicInput), {
7660
- modelValue: _ctx.model[_ctx.name],
7661
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
7021
+ "model-value": __props.model[__props.name],
7662
7022
  ref_key: "input",
7663
7023
  ref: input,
7664
7024
  clearable: "",
7665
- size: _ctx.size,
7666
- placeholder: _ctx.config.placeholder,
7667
- disabled: _ctx.disabled,
7668
- onChange: changeHandler,
7025
+ size: __props.size,
7026
+ placeholder: __props.config.placeholder,
7027
+ disabled: __props.disabled,
7028
+ "onUpdate:modelValue": changeHandler,
7669
7029
  onInput: inputHandler,
7670
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
7030
+ onKeyup: _cache[0] || (_cache[0] = ($event) => keyUpHandler($event))
7671
7031
  }, vue.createSlots({
7672
7032
  _: 2
7673
7033
  /* DYNAMIC */
7674
7034
  }, [
7035
+ __props.config.prepend ? {
7036
+ name: "prepend",
7037
+ fn: vue.withCtx(() => [
7038
+ vue.createElementVNode(
7039
+ "span",
7040
+ null,
7041
+ vue.toDisplayString(__props.config.prepend),
7042
+ 1
7043
+ /* TEXT */
7044
+ )
7045
+ ]),
7046
+ key: "0"
7047
+ } : void 0,
7675
7048
  appendConfig.value ? {
7676
7049
  name: "append",
7677
7050
  fn: vue.withCtx(() => [
7678
7051
  appendConfig.value.type === "button" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
7679
7052
  key: 0,
7680
7053
  style: { "color": "#409eff" },
7681
- size: _ctx.size,
7054
+ size: __props.size,
7682
7055
  onClick: vue.withModifiers(buttonClickHandler, ["prevent"])
7683
7056
  }, {
7684
7057
  default: vue.withCtx(() => [
@@ -7690,11 +7063,17 @@
7690
7063
  ]),
7691
7064
  _: 1
7692
7065
  /* STABLE */
7693
- }, 8, ["size"])) : vue.createCommentVNode("v-if", true)
7066
+ }, 8, ["size"])) : (vue.openBlock(), vue.createElementBlock(
7067
+ "span",
7068
+ _hoisted_2$1,
7069
+ vue.toDisplayString(appendConfig.value.text),
7070
+ 1
7071
+ /* TEXT */
7072
+ ))
7694
7073
  ]),
7695
- key: "0"
7074
+ key: "1"
7696
7075
  } : void 0
7697
- ]), 1032, ["modelValue", "size", "placeholder", "disabled"]),
7076
+ ]), 1032, ["model-value", "size", "placeholder", "disabled"]),
7698
7077
  (vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
7699
7078
  popoverVisible.value ? (vue.openBlock(), vue.createElementBlock(
7700
7079
  "div",
@@ -7705,20 +7084,20 @@
7705
7084
  ref: popoverEl
7706
7085
  },
7707
7086
  [
7708
- _cache[5] || (_cache[5] = vue.createElementVNode(
7087
+ _cache[4] || (_cache[4] = vue.createElementVNode(
7709
7088
  "div",
7710
7089
  { class: "m-form-validate__warning" },
7711
7090
  "输入内容前后有空格,是否移除空格?",
7712
7091
  -1
7713
7092
  /* CACHED */
7714
7093
  )),
7715
- vue.createElementVNode("div", _hoisted_2, [
7094
+ vue.createElementVNode("div", _hoisted_3$1, [
7716
7095
  vue.createVNode(vue.unref(design.TMagicButton), {
7717
7096
  link: "",
7718
7097
  size: "small",
7719
- onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
7098
+ onClick: _cache[1] || (_cache[1] = ($event) => popoverVisible.value = false)
7720
7099
  }, {
7721
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
7100
+ default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
7722
7101
  vue.createTextVNode(
7723
7102
  "保持原样",
7724
7103
  -1
@@ -7733,7 +7112,7 @@
7733
7112
  size: "small",
7734
7113
  onClick: confirmTrimHandler
7735
7114
  }, {
7736
- default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
7115
+ default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
7737
7116
  vue.createTextVNode(
7738
7117
  "移除空格",
7739
7118
  -1
@@ -7744,7 +7123,7 @@
7744
7123
  /* STABLE */
7745
7124
  })
7746
7125
  ]),
7747
- _cache[6] || (_cache[6] = vue.createElementVNode(
7126
+ _cache[5] || (_cache[5] = vue.createElementVNode(
7748
7127
  "span",
7749
7128
  {
7750
7129
  class: "tmagic-form-text-popper-arrow",
@@ -7764,162 +7143,989 @@
7764
7143
  }
7765
7144
  });
7766
7145
 
7146
+ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
7147
+ ...{
7148
+ name: "MFormTextarea"
7149
+ },
7150
+ __name: "Textarea",
7151
+ props: {
7152
+ config: {},
7153
+ model: {},
7154
+ initValues: {},
7155
+ values: {},
7156
+ name: {},
7157
+ prop: {},
7158
+ disabled: { type: Boolean },
7159
+ size: {},
7160
+ lastValues: {}
7161
+ },
7162
+ emits: ["change", "input"],
7163
+ setup(__props, { emit: __emit }) {
7164
+ const props = __props;
7165
+ const emit = __emit;
7166
+ useAddField(props.prop);
7167
+ const mForm = vue.inject("mForm");
7168
+ const changeHandler = (value) => {
7169
+ emit("change", value);
7170
+ };
7171
+ const inputHandler = (v) => {
7172
+ emit("input", v);
7173
+ mForm?.$emit("field-input", props.prop, v);
7174
+ };
7175
+ return (_ctx, _cache) => {
7176
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
7177
+ "model-value": __props.model[__props.name],
7178
+ type: "textarea",
7179
+ size: __props.size,
7180
+ clearable: "",
7181
+ placeholder: __props.config.placeholder,
7182
+ disabled: __props.disabled,
7183
+ "onUpdate:modelValue": changeHandler,
7184
+ onInput: inputHandler
7185
+ }, null, 8, ["model-value", "size", "placeholder", "disabled"]);
7186
+ };
7187
+ }
7188
+ });
7189
+
7190
+ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
7191
+ ...{
7192
+ name: "MFormTime"
7193
+ },
7194
+ __name: "Time",
7195
+ props: {
7196
+ config: {},
7197
+ model: {},
7198
+ initValues: {},
7199
+ values: {},
7200
+ name: {},
7201
+ prop: {},
7202
+ disabled: { type: Boolean },
7203
+ size: {},
7204
+ lastValues: {}
7205
+ },
7206
+ emits: ["change"],
7207
+ setup(__props, { emit: __emit }) {
7208
+ const props = __props;
7209
+ const emit = __emit;
7210
+ useAddField(props.prop);
7211
+ const changeHandler = (v) => {
7212
+ emit("change", v);
7213
+ };
7214
+ return (_ctx, _cache) => {
7215
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTimePicker), {
7216
+ "model-value": __props.model[__props.name],
7217
+ "value-format": __props.config.valueFormat || "HH:mm:ss",
7218
+ format: __props.config.format || "HH:mm:ss",
7219
+ size: __props.size,
7220
+ placeholder: __props.config.placeholder,
7221
+ disabled: __props.disabled,
7222
+ "onUpdate:modelValue": changeHandler
7223
+ }, null, 8, ["model-value", "value-format", "format", "size", "placeholder", "disabled"]);
7224
+ };
7225
+ }
7226
+ });
7227
+
7228
+ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
7229
+ ...{
7230
+ name: "MFormTimeRange"
7231
+ },
7232
+ __name: "Timerange",
7233
+ props: {
7234
+ config: {},
7235
+ model: {},
7236
+ initValues: {},
7237
+ values: {},
7238
+ name: {},
7239
+ prop: {},
7240
+ disabled: { type: Boolean },
7241
+ size: {},
7242
+ lastValues: {}
7243
+ },
7244
+ emits: ["change"],
7245
+ setup(__props, { emit: __emit }) {
7246
+ const props = __props;
7247
+ const emit = __emit;
7248
+ useAddField(props.prop);
7249
+ const { names } = props.config;
7250
+ const value = vue.ref([]);
7251
+ if (props.model !== void 0 && names?.length) {
7252
+ vue.watch(
7253
+ [() => props.model[names[0]], () => props.model[names[1]]],
7254
+ ([start, end], [preStart, preEnd]) => {
7255
+ if (!value.value) {
7256
+ value.value = [];
7257
+ }
7258
+ if (!start || !end) value.value = [];
7259
+ if (start !== preStart) value.value[0] = start;
7260
+ if (end !== preEnd) value.value[1] = end;
7261
+ },
7262
+ {
7263
+ immediate: true
7264
+ }
7265
+ );
7266
+ }
7267
+ const setValue = (v) => {
7268
+ names?.forEach((item, index) => {
7269
+ if (!props.model) {
7270
+ return;
7271
+ }
7272
+ if (Array.isArray(v)) {
7273
+ props.model[item] = v[index];
7274
+ } else {
7275
+ props.model[item] = void 0;
7276
+ }
7277
+ });
7278
+ };
7279
+ const changeHandler = (v) => {
7280
+ const value2 = v || [];
7281
+ if (names?.length) {
7282
+ setValue(value2);
7283
+ }
7284
+ emit("change", value2);
7285
+ };
7286
+ return (_ctx, _cache) => {
7287
+ return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTimePicker), {
7288
+ "model-value": value.value,
7289
+ "is-range": "",
7290
+ "range-separator": "-",
7291
+ "start-placeholder": "开始时间",
7292
+ "end-placeholder": "结束时间",
7293
+ size: __props.size,
7294
+ "unlink-panels": true,
7295
+ disabled: __props.disabled,
7296
+ "default-time": __props.config.defaultTime,
7297
+ "onUpdate:modelValue": changeHandler
7298
+ }, null, 8, ["model-value", "size", "disabled", "default-time"]);
7299
+ };
7300
+ }
7301
+ });
7302
+
7303
+ const useAdd = (props, emit) => {
7304
+ const mForm = vue.inject("mForm");
7305
+ const addable = vue.computed(() => {
7306
+ const modelName = props.name || props.config.name || "";
7307
+ if (!props.model[modelName].length) {
7308
+ return true;
7309
+ }
7310
+ if (typeof props.config.addable === "function") {
7311
+ return props.config.addable(mForm, {
7312
+ model: props.model[modelName],
7313
+ formValue: mForm?.values,
7314
+ prop: props.prop
7315
+ });
7316
+ }
7317
+ return typeof props.config.addable === "undefined" ? true : props.config.addable;
7318
+ });
7319
+ const newHandler = async (row) => {
7320
+ const modelName = props.name || props.config.name || "";
7321
+ if (props.config.max && props.model[modelName].length >= props.config.max) {
7322
+ design.tMagicMessage.error(`最多新增配置不能超过${props.config.max}条`);
7323
+ return;
7324
+ }
7325
+ if (typeof props.config.beforeAddRow === "function") {
7326
+ const beforeCheckRes = props.config.beforeAddRow(mForm, {
7327
+ model: props.model[modelName],
7328
+ formValue: mForm?.values,
7329
+ prop: props.prop
7330
+ });
7331
+ if (!beforeCheckRes) return;
7332
+ }
7333
+ const columns = props.config.items;
7334
+ const enumValues = props.config.enum || [];
7335
+ let enumV = [];
7336
+ const { length } = props.model[modelName];
7337
+ const key = props.config.key || "id";
7338
+ let inputs = {};
7339
+ if (enumValues.length) {
7340
+ if (length >= enumValues.length) {
7341
+ return;
7342
+ }
7343
+ enumV = enumValues.filter((item) => {
7344
+ let i = 0;
7345
+ for (; i < length; i++) {
7346
+ if (item[key] === props.model[modelName][i][key]) {
7347
+ break;
7348
+ }
7349
+ }
7350
+ return i === length;
7351
+ });
7352
+ if (enumV.length > 0) {
7353
+ inputs = enumV[0];
7354
+ }
7355
+ } else if (Array.isArray(row)) {
7356
+ columns.forEach((column, index) => {
7357
+ column.name && (inputs[column.name] = row[index]);
7358
+ });
7359
+ } else {
7360
+ if (typeof props.config.defaultAdd === "function") {
7361
+ inputs = await props.config.defaultAdd(mForm, {
7362
+ model: props.model[modelName],
7363
+ formValue: mForm?.values
7364
+ });
7365
+ } else if (props.config.defaultAdd) {
7366
+ inputs = props.config.defaultAdd;
7367
+ }
7368
+ inputs = await initValue(mForm, {
7369
+ config: columns,
7370
+ initValues: inputs
7371
+ });
7372
+ }
7373
+ if (props.sortKey && length) {
7374
+ inputs[props.sortKey] = props.model[modelName][length - 1][props.sortKey] - 1;
7375
+ }
7376
+ emit("change", [...props.model[modelName], inputs], {
7377
+ changeRecords: [
7378
+ {
7379
+ propPath: `${props.prop}.${props.model[modelName].length}`,
7380
+ value: inputs
7381
+ }
7382
+ ]
7383
+ });
7384
+ };
7385
+ return {
7386
+ addable,
7387
+ newHandler
7388
+ };
7389
+ };
7390
+
7391
+ const useFullscreen = () => {
7392
+ const isFullscreen = vue.ref(false);
7393
+ const mTableEl = vue.useTemplateRef("mTable");
7394
+ const { nextZIndex } = design.useZIndex();
7395
+ const toggleFullscreen = () => {
7396
+ if (!mTableEl.value) return;
7397
+ if (isFullscreen.value) {
7398
+ mTableEl.value.classList.remove("fixed");
7399
+ isFullscreen.value = false;
7400
+ } else {
7401
+ mTableEl.value.classList.add("fixed");
7402
+ mTableEl.value.style.zIndex = `${nextZIndex()}`;
7403
+ isFullscreen.value = true;
7404
+ }
7405
+ };
7406
+ return {
7407
+ isFullscreen,
7408
+ toggleFullscreen
7409
+ };
7410
+ };
7411
+
7412
+ const useImport = (props, emit, newHandler) => {
7413
+ const mForm = vue.inject("mForm");
7414
+ const modelName = vue.computed(() => props.name || props.config.name || "");
7415
+ const importable = vue.computed(() => {
7416
+ if (typeof props.config.importable === "function") {
7417
+ return props.config.importable(mForm, {
7418
+ formValue: mForm?.values,
7419
+ model: props.model[modelName.value]
7420
+ });
7421
+ }
7422
+ return typeof props.config.importable === "undefined" ? false : props.config.importable;
7423
+ });
7424
+ const excelBtn = vue.useTemplateRef("excelBtn");
7425
+ const excelHandler = async (file) => {
7426
+ if (!file?.raw) {
7427
+ return false;
7428
+ }
7429
+ if (!globalThis.XLSX) {
7430
+ await utils.asyncLoadJs("https://cdn.bootcdn.net/ajax/libs/xlsx/0.17.0/xlsx.full.min.js");
7431
+ }
7432
+ const reader = new FileReader();
7433
+ reader.onload = () => {
7434
+ const data = reader.result;
7435
+ const pdata = globalThis.XLSX.read(data, { type: "array" });
7436
+ pdata.SheetNames.forEach((sheetName) => {
7437
+ const arr = globalThis.XLSX.utils.sheet_to_json(pdata.Sheets[sheetName], { header: 1 });
7438
+ if (arr?.[0]) {
7439
+ arr.forEach((row) => {
7440
+ newHandler(row);
7441
+ });
7442
+ }
7443
+ setTimeout(() => {
7444
+ excelBtn.value?.clearFiles();
7445
+ }, 300);
7446
+ });
7447
+ };
7448
+ reader.readAsArrayBuffer(file.raw);
7449
+ return false;
7450
+ };
7451
+ const clearHandler = () => {
7452
+ emit("change", []);
7453
+ mForm?.$emit("field-change", props.prop, props.model[modelName.value]);
7454
+ };
7455
+ return {
7456
+ importable,
7457
+ excelHandler,
7458
+ clearHandler
7459
+ };
7460
+ };
7461
+
7462
+ const usePagination = (props, modelName) => {
7463
+ const pageSize = vue.ref(10);
7464
+ const currentPage = vue.ref(0);
7465
+ const paginationData = vue.computed(() => getDataByPage(props.model[modelName.value], currentPage.value, pageSize.value));
7466
+ const handleSizeChange = (val) => {
7467
+ pageSize.value = val;
7468
+ };
7469
+ const handleCurrentChange = (val) => {
7470
+ currentPage.value = val - 1;
7471
+ };
7472
+ return {
7473
+ pageSize,
7474
+ currentPage,
7475
+ paginationData,
7476
+ handleSizeChange,
7477
+ handleCurrentChange
7478
+ };
7479
+ };
7480
+
7481
+ const useSelection = (props, emit, tMagicTableRef) => {
7482
+ const mForm = vue.inject("mForm");
7483
+ const selectHandle = (selection, row) => {
7484
+ if (typeof props.config.selection === "string" && props.config.selection === "single") {
7485
+ tMagicTableRef.value?.clearSelection();
7486
+ tMagicTableRef.value?.toggleRowSelection(row, true);
7487
+ }
7488
+ emit("select", selection, row);
7489
+ if (typeof props.config.onSelect === "function") {
7490
+ props.config.onSelect(mForm, { selection, row, config: props.config });
7491
+ }
7492
+ };
7493
+ const toggleRowSelection = (row, selected) => {
7494
+ tMagicTableRef.value?.toggleRowSelection.call(tMagicTableRef.value?.getTableRef(), row, selected);
7495
+ };
7496
+ return {
7497
+ selectHandle,
7498
+ toggleRowSelection
7499
+ };
7500
+ };
7501
+
7502
+ const useSortable = (props, emit, tMagicTableRef, modelName) => {
7503
+ const mForm = vue.inject("mForm");
7504
+ let sortable;
7505
+ const rowDrop = () => {
7506
+ sortable?.destroy();
7507
+ const tableEl = tMagicTableRef.value?.getEl();
7508
+ const tBodyEl = tableEl?.querySelector(".el-table__body > tbody");
7509
+ if (!tBodyEl) {
7510
+ return;
7511
+ }
7512
+ sortable = Sortable.create(tBodyEl, {
7513
+ draggable: ".tmagic-design-table-row",
7514
+ filter: "input",
7515
+ // 表单组件选字操作和触发拖拽会冲突,优先保证选字操作
7516
+ preventOnFilter: false,
7517
+ // 允许选字
7518
+ direction: "vertical",
7519
+ onEnd: ({ newIndex, oldIndex }) => {
7520
+ if (typeof newIndex === "undefined") return;
7521
+ if (typeof oldIndex === "undefined") return;
7522
+ const newData = sortArray(props.model[modelName.value], newIndex, oldIndex, props.sortKey);
7523
+ emit("change", newData);
7524
+ mForm?.$emit("field-change", newData);
7525
+ }
7526
+ });
7527
+ };
7528
+ vue.watchEffect(() => {
7529
+ if (props.config.dropSort) {
7530
+ rowDrop();
7531
+ }
7532
+ });
7533
+ };
7534
+
7767
7535
  const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
7768
- ...{
7769
- name: "MFormTextarea"
7770
- },
7771
- __name: "Textarea",
7536
+ __name: "ActionsColumn",
7772
7537
  props: {
7773
7538
  config: {},
7774
7539
  model: {},
7775
- initValues: {},
7776
- values: {},
7777
7540
  name: {},
7778
- prop: {},
7779
7541
  disabled: { type: Boolean },
7780
- size: {},
7781
- lastValues: {}
7542
+ currentPage: {},
7543
+ pageSize: {},
7544
+ index: {},
7545
+ row: {},
7546
+ prop: {},
7547
+ sortKey: {}
7782
7548
  },
7783
- emits: ["change", "input"],
7549
+ emits: ["change"],
7784
7550
  setup(__props, { emit: __emit }) {
7785
- const props = __props;
7786
7551
  const emit = __emit;
7787
- useAddField(props.prop);
7552
+ const props = __props;
7788
7553
  const mForm = vue.inject("mForm");
7789
- const changeHandler = (value) => {
7790
- emit("change", value);
7554
+ const removeHandler = (index) => {
7555
+ if (props.disabled) return;
7556
+ emit("change", props.model[props.name].toSpliced(index, 1));
7791
7557
  };
7792
- const inputHandler = (v) => {
7793
- emit("input", v);
7794
- mForm?.$emit("field-input", props.prop, v);
7558
+ const copyHandler = (index) => {
7559
+ const inputs = cloneDeep(props.model[props.name][index]);
7560
+ const { length } = props.model[props.name];
7561
+ if (props.sortKey && length) {
7562
+ inputs[props.sortKey] = props.model[props.name][length - 1][props.sortKey] - 1;
7563
+ }
7564
+ emit("change", [...props.model[props.name], inputs], {
7565
+ changeRecords: [
7566
+ {
7567
+ propPath: `${props.prop}.${props.model[props.name].length}`,
7568
+ value: inputs
7569
+ }
7570
+ ]
7571
+ });
7572
+ };
7573
+ const showDelete = (index) => {
7574
+ const deleteFunc = props.config.delete;
7575
+ if (deleteFunc && typeof deleteFunc === "function") {
7576
+ return deleteFunc(props.model[props.name], index, mForm?.values);
7577
+ }
7578
+ return props.config.delete ?? true;
7579
+ };
7580
+ const copyable = (index) => {
7581
+ const copyableFunc = props.config.copyable;
7582
+ if (copyableFunc && typeof copyableFunc === "function") {
7583
+ return copyableFunc(mForm, {
7584
+ values: mForm?.initValues || {},
7585
+ model: props.model,
7586
+ parent: mForm?.parentValues || {},
7587
+ formValue: mForm?.values || props.model,
7588
+ prop: props.prop,
7589
+ config: props.config,
7590
+ index
7591
+ });
7592
+ }
7593
+ return props.config.copyable ?? true;
7795
7594
  };
7796
7595
  return (_ctx, _cache) => {
7797
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicInput), {
7798
- modelValue: _ctx.model[_ctx.name],
7799
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
7800
- type: "textarea",
7801
- size: _ctx.size,
7802
- clearable: "",
7803
- placeholder: _ctx.config.placeholder,
7804
- disabled: _ctx.disabled,
7805
- onChange: changeHandler,
7806
- onInput: inputHandler
7807
- }, null, 8, ["modelValue", "size", "placeholder", "disabled"]);
7596
+ return vue.openBlock(), vue.createElementBlock(
7597
+ vue.Fragment,
7598
+ null,
7599
+ [
7600
+ vue.renderSlot(_ctx.$slots, "operateCol", {
7601
+ scope: { $index: __props.index, row: __props.row }
7602
+ }),
7603
+ vue.withDirectives(vue.createVNode(vue.unref(design.TMagicButton), {
7604
+ size: "small",
7605
+ type: "danger",
7606
+ link: "",
7607
+ title: "删除",
7608
+ icon: vue.unref(iconsVue.Delete),
7609
+ onClick: _cache[0] || (_cache[0] = ($event) => removeHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
7610
+ }, null, 8, ["icon"]), [
7611
+ [vue.vShow, showDelete(__props.index + 1 + __props.currentPage * __props.pageSize - 1)]
7612
+ ]),
7613
+ copyable(__props.index + 1 + __props.currentPage * __props.pageSize - 1) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
7614
+ key: 0,
7615
+ link: "",
7616
+ size: "small",
7617
+ type: "primary",
7618
+ title: "复制",
7619
+ icon: vue.unref(iconsVue.DocumentCopy),
7620
+ disabled: __props.disabled,
7621
+ onClick: _cache[1] || (_cache[1] = ($event) => copyHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
7622
+ }, null, 8, ["icon", "disabled"])) : vue.createCommentVNode("v-if", true)
7623
+ ],
7624
+ 64
7625
+ /* STABLE_FRAGMENT */
7626
+ );
7808
7627
  };
7809
7628
  }
7810
7629
  });
7811
7630
 
7812
7631
  const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
7813
- ...{
7814
- name: "MFormTime"
7815
- },
7816
- __name: "Time",
7632
+ __name: "SortColumn",
7817
7633
  props: {
7818
- config: {},
7819
- model: {},
7820
- initValues: {},
7821
- values: {},
7822
- name: {},
7823
- prop: {},
7634
+ index: {},
7824
7635
  disabled: { type: Boolean },
7825
- size: {},
7826
- lastValues: {}
7636
+ currentPage: {},
7637
+ pageSize: {},
7638
+ name: {},
7639
+ model: {}
7827
7640
  },
7828
- emits: ["change"],
7641
+ emits: ["swap"],
7829
7642
  setup(__props, { emit: __emit }) {
7830
7643
  const props = __props;
7831
7644
  const emit = __emit;
7832
- useAddField(props.prop);
7833
- const changeHandler = (v) => {
7834
- emit("change", v);
7645
+ let timer = null;
7646
+ const upHandler = (index) => {
7647
+ if (timer) {
7648
+ clearTimeout(timer);
7649
+ }
7650
+ timer = setTimeout(() => {
7651
+ emit("swap", index, index - 1);
7652
+ timer = null;
7653
+ }, 300);
7654
+ };
7655
+ const topHandler = (index) => {
7656
+ if (timer) {
7657
+ clearTimeout(timer);
7658
+ }
7659
+ const moveNum = index;
7660
+ for (let i = 0; i < moveNum; i++) {
7661
+ emit("swap", index, index - 1);
7662
+ index -= 1;
7663
+ }
7664
+ };
7665
+ const downHandler = (index) => {
7666
+ if (timer) {
7667
+ clearTimeout(timer);
7668
+ }
7669
+ timer = setTimeout(() => {
7670
+ emit("swap", index, index + 1);
7671
+ timer = null;
7672
+ }, 300);
7673
+ };
7674
+ const bottomHandler = (index) => {
7675
+ if (timer) {
7676
+ clearTimeout(timer);
7677
+ }
7678
+ const moveNum = props.model[props.name].length - 1 - index;
7679
+ for (let i = 0; i < moveNum; i++) {
7680
+ emit("swap", index, index + 1);
7681
+ index += 1;
7682
+ }
7835
7683
  };
7836
7684
  return (_ctx, _cache) => {
7837
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTimePicker), {
7838
- modelValue: _ctx.model[_ctx.name],
7839
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.model[_ctx.name] = $event),
7840
- "value-format": _ctx.config.valueFormat || "HH:mm:ss",
7841
- format: _ctx.config.format || "HH:mm:ss",
7842
- size: _ctx.size,
7843
- placeholder: _ctx.config.placeholder,
7844
- disabled: _ctx.disabled,
7845
- onChange: changeHandler
7846
- }, null, 8, ["modelValue", "value-format", "format", "size", "placeholder", "disabled"]);
7685
+ return vue.openBlock(), vue.createElementBlock(
7686
+ vue.Fragment,
7687
+ null,
7688
+ [
7689
+ __props.index + 1 + __props.currentPage * __props.pageSize - 1 !== 0 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
7690
+ key: 0,
7691
+ content: "点击上移,双击置顶",
7692
+ placement: "top"
7693
+ }, {
7694
+ default: vue.withCtx(() => [
7695
+ vue.createVNode(vue.unref(design.TMagicButton), {
7696
+ plain: "",
7697
+ size: "small",
7698
+ type: "primary",
7699
+ icon: vue.unref(iconsVue.ArrowUp),
7700
+ disabled: __props.disabled,
7701
+ link: "",
7702
+ onClick: _cache[0] || (_cache[0] = ($event) => upHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
7703
+ onDblclick: _cache[1] || (_cache[1] = ($event) => topHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
7704
+ }, null, 8, ["icon", "disabled"])
7705
+ ]),
7706
+ _: 1
7707
+ /* STABLE */
7708
+ })) : vue.createCommentVNode("v-if", true),
7709
+ __props.index + 1 + __props.currentPage * __props.pageSize - 1 !== __props.model[__props.name].length - 1 ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
7710
+ key: 1,
7711
+ content: "点击下移,双击置底",
7712
+ placement: "top"
7713
+ }, {
7714
+ default: vue.withCtx(() => [
7715
+ vue.createVNode(vue.unref(design.TMagicButton), {
7716
+ plain: "",
7717
+ size: "small",
7718
+ type: "primary",
7719
+ icon: vue.unref(iconsVue.ArrowDown),
7720
+ disabled: __props.disabled,
7721
+ link: "",
7722
+ onClick: _cache[2] || (_cache[2] = ($event) => downHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1)),
7723
+ onDblclick: _cache[3] || (_cache[3] = ($event) => bottomHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
7724
+ }, null, 8, ["icon", "disabled"])
7725
+ ]),
7726
+ _: 1
7727
+ /* STABLE */
7728
+ })) : vue.createCommentVNode("v-if", true)
7729
+ ],
7730
+ 64
7731
+ /* STABLE_FRAGMENT */
7732
+ );
7847
7733
  };
7848
7734
  }
7849
7735
  });
7850
7736
 
7737
+ const useTableColumns = (props, emit, currentPage, pageSize, modelName) => {
7738
+ const mForm = vue.inject("mForm");
7739
+ const display$1 = (fuc) => display(mForm, fuc, props);
7740
+ const lastData = vue.computed(
7741
+ () => props.config.pagination ? getDataByPage(props.lastValues[modelName.value], currentPage.value, pageSize.value) : props.lastValues[modelName.value] || []
7742
+ );
7743
+ const itemExtra = (fuc, index) => {
7744
+ if (typeof fuc === "function") {
7745
+ return fuc(mForm, {
7746
+ values: mForm?.initValues,
7747
+ model: props.model,
7748
+ formValue: mForm ? mForm.values : props.model,
7749
+ prop: props.prop,
7750
+ index
7751
+ });
7752
+ }
7753
+ return fuc;
7754
+ };
7755
+ const selection = vue.computed(() => {
7756
+ if (typeof props.config.selection === "function") {
7757
+ return props.config.selection(mForm, { model: props.model[modelName.value] });
7758
+ }
7759
+ return props.config.selection;
7760
+ });
7761
+ const getProp = (index) => {
7762
+ return `${props.prop}${props.prop ? "." : ""}${index + 1 + currentPage.value * pageSize.value - 1}`;
7763
+ };
7764
+ const makeConfig = (config, row) => {
7765
+ const newConfig = cloneDeep(config);
7766
+ if (typeof config.itemsFunction === "function") {
7767
+ newConfig.items = config.itemsFunction(row);
7768
+ }
7769
+ delete newConfig.display;
7770
+ return newConfig;
7771
+ };
7772
+ const changeHandler = (v, eventData) => {
7773
+ emit("change", props.model, eventData);
7774
+ };
7775
+ const onAddDiffCount = () => emit("addDiffCount");
7776
+ const columns = vue.computed(() => {
7777
+ const columns2 = [];
7778
+ if (props.config.itemExtra && !props.config.dropSort) {
7779
+ columns2.push({
7780
+ props: {
7781
+ fixed: "left",
7782
+ width: 30,
7783
+ type: "expand"
7784
+ },
7785
+ cell: ({ $index }) => vue.h("span", {
7786
+ innerHTML: itemExtra(props.config.itemExtra, $index),
7787
+ class: "m-form-tip"
7788
+ })
7789
+ });
7790
+ }
7791
+ columns2.push({
7792
+ props: {
7793
+ label: "操作",
7794
+ fixed: props.config.fixed === false ? void 0 : "left",
7795
+ width: props.config.operateColWidth || 112,
7796
+ align: "center"
7797
+ },
7798
+ cell: ({ row, $index }) => vue.h(_sfc_main$4, {
7799
+ row,
7800
+ index: $index,
7801
+ model: props.model,
7802
+ config: props.config,
7803
+ prop: props.prop,
7804
+ disabled: props.disabled,
7805
+ sortKey: props.sortKey,
7806
+ name: modelName.value,
7807
+ currentPage: currentPage.value,
7808
+ pageSize: pageSize.value,
7809
+ onChange: (v) => {
7810
+ emit("change", v);
7811
+ }
7812
+ })
7813
+ });
7814
+ if (props.sort && props.model[modelName.value] && props.model[modelName.value].length > 1) {
7815
+ columns2.push({
7816
+ props: {
7817
+ label: "排序",
7818
+ width: 80
7819
+ },
7820
+ cell: ({ $index }) => vue.h(_sfc_main$3, {
7821
+ index: $index,
7822
+ model: props.model,
7823
+ disabled: props.disabled,
7824
+ name: modelName.value,
7825
+ currentPage: currentPage.value,
7826
+ pageSize: pageSize.value,
7827
+ onSwap: (index1, index2) => {
7828
+ const newData = sortArray(props.model[modelName.value], index1, index2, props.sortKey);
7829
+ emit("change", newData);
7830
+ mForm?.$emit("field-change", newData);
7831
+ }
7832
+ })
7833
+ });
7834
+ }
7835
+ if (selection.value) {
7836
+ columns2.push({
7837
+ props: {
7838
+ align: "center",
7839
+ headerAlign: "center",
7840
+ type: "selection",
7841
+ width: 45
7842
+ }
7843
+ });
7844
+ }
7845
+ if (props.showIndex && props.config.showIndex) {
7846
+ columns2.push({
7847
+ props: {
7848
+ label: "序号",
7849
+ width: 60
7850
+ },
7851
+ cell: ({ $index }) => vue.h("span", $index + 1 + currentPage.value * pageSize.value)
7852
+ });
7853
+ }
7854
+ for (const column of props.config.items) {
7855
+ if (column.type !== "hidden" && display$1(column.display)) {
7856
+ columns2.push({
7857
+ props: {
7858
+ prop: column.name,
7859
+ label: column.label,
7860
+ width: column.width,
7861
+ sortable: column.sortable,
7862
+ sortOrders: ["ascending", "descending"],
7863
+ class: props.config.dropSort === true ? "el-table__column--dropable" : ""
7864
+ },
7865
+ cell: ({ row, $index }) => vue.h(_sfc_main$A, {
7866
+ labelWidth: "0",
7867
+ disabled: props.disabled,
7868
+ prop: getProp($index),
7869
+ rules: column.rules,
7870
+ config: makeConfig(column, row),
7871
+ model: row,
7872
+ lastValues: lastData.value[$index],
7873
+ isCompare: props.isCompare,
7874
+ size: props.size,
7875
+ onChange: changeHandler,
7876
+ onAddDiffCount
7877
+ })
7878
+ });
7879
+ }
7880
+ }
7881
+ return columns2;
7882
+ });
7883
+ return {
7884
+ columns
7885
+ };
7886
+ };
7887
+
7888
+ const _hoisted_1$1 = { class: "m-fields-table-wrap" };
7889
+ const _hoisted_2 = ["innerHTML"];
7890
+ const _hoisted_3 = { style: { "display": "flex", "justify-content": "space-between", "margin": "10px 0" } };
7891
+ const _hoisted_4 = { style: { "display": "flex" } };
7892
+ const _hoisted_5 = {
7893
+ key: 1,
7894
+ class: "bottom",
7895
+ style: { "text-align": "right" }
7896
+ };
7851
7897
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
7852
7898
  ...{
7853
- name: "MFormTimeRange"
7899
+ name: "MFormTable"
7854
7900
  },
7855
- __name: "Timerange",
7901
+ __name: "Table",
7856
7902
  props: {
7857
- config: {},
7858
7903
  model: {},
7859
- initValues: {},
7860
- values: {},
7904
+ lastValues: { default: () => ({}) },
7905
+ isCompare: { type: Boolean, default: false },
7906
+ config: {},
7861
7907
  name: {},
7862
- prop: {},
7908
+ prop: { default: "" },
7909
+ labelWidth: {},
7910
+ sort: { type: Boolean },
7863
7911
  disabled: { type: Boolean },
7912
+ sortKey: { default: "" },
7913
+ text: {},
7864
7914
  size: {},
7865
- lastValues: {}
7915
+ enableToggleMode: { type: Boolean, default: true },
7916
+ showIndex: { type: Boolean, default: true }
7866
7917
  },
7867
- emits: ["change"],
7868
- setup(__props, { emit: __emit }) {
7918
+ emits: ["change", "select", "addDiffCount"],
7919
+ setup(__props, { expose: __expose, emit: __emit }) {
7869
7920
  const props = __props;
7870
7921
  const emit = __emit;
7871
- useAddField(props.prop);
7872
- const { names } = props.config;
7873
- const value = vue.ref([]);
7874
- if (props.model !== void 0 && names?.length) {
7875
- vue.watch(
7876
- [() => props.model[names[0]], () => props.model[names[1]]],
7877
- ([start, end], [preStart, preEnd]) => {
7878
- if (!value.value) {
7879
- value.value = [];
7880
- }
7881
- if (!start || !end) value.value = [];
7882
- if (start !== preStart) value.value[0] = start;
7883
- if (end !== preEnd) value.value[1] = end;
7884
- },
7885
- {
7886
- immediate: true
7887
- }
7888
- );
7889
- }
7890
- const setValue = (v) => {
7891
- names?.forEach((item, index) => {
7892
- if (!props.model) {
7893
- return;
7894
- }
7895
- if (Array.isArray(v)) {
7896
- props.model[item] = v[index];
7897
- } else {
7898
- props.model[item] = void 0;
7899
- }
7922
+ const modelName = vue.computed(() => props.name || props.config.name || "");
7923
+ const tMagicTableRef = vue.useTemplateRef("tMagicTable");
7924
+ const { pageSize, currentPage, paginationData, handleSizeChange, handleCurrentChange } = usePagination(
7925
+ props,
7926
+ modelName
7927
+ );
7928
+ const { addable, newHandler } = useAdd(props, emit);
7929
+ const { columns } = useTableColumns(props, emit, currentPage, pageSize, modelName);
7930
+ useSortable(props, emit, tMagicTableRef, modelName);
7931
+ const { isFullscreen, toggleFullscreen } = useFullscreen();
7932
+ const { importable, excelHandler, clearHandler } = useImport(props, emit, newHandler);
7933
+ const { selectHandle, toggleRowSelection } = useSelection(props, emit, tMagicTableRef);
7934
+ const updateKey = vue.ref(1);
7935
+ const data = vue.computed(() => props.config.pagination ? paginationData.value : props.model[modelName.value]);
7936
+ const toggleMode = () => {
7937
+ const calcLabelWidth = (label) => {
7938
+ if (!label) return "0px";
7939
+ const zhLength = label.match(/[^\x00-\xff]/g)?.length || 0;
7940
+ const chLength = label.length - zhLength;
7941
+ return `${Math.max(chLength * 8 + zhLength * 20, 80)}px`;
7942
+ };
7943
+ props.config.type = "groupList";
7944
+ props.config.enableToggleMode = true;
7945
+ props.config.tableItems = props.config.items;
7946
+ props.config.items = props.config.groupItems || props.config.items.map((item) => {
7947
+ const text = item.text || item.label;
7948
+ const labelWidth = calcLabelWidth(text);
7949
+ return {
7950
+ ...item,
7951
+ text,
7952
+ labelWidth,
7953
+ span: item.span || 12
7954
+ };
7900
7955
  });
7901
7956
  };
7902
- const changeHandler = (v) => {
7903
- const value2 = v || [];
7904
- if (names?.length) {
7905
- setValue(value2);
7906
- }
7907
- emit("change", value2);
7957
+ const sortChangeHandler = (sortOptions) => {
7958
+ const modelName2 = props.name || props.config.name || "";
7959
+ sortChange(props.model[modelName2], sortOptions);
7908
7960
  };
7961
+ __expose({
7962
+ toggleRowSelection
7963
+ });
7909
7964
  return (_ctx, _cache) => {
7910
- return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTimePicker), {
7911
- modelValue: value.value,
7912
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
7913
- "is-range": "",
7914
- "range-separator": "-",
7915
- "start-placeholder": "开始时间",
7916
- "end-placeholder": "结束时间",
7917
- size: _ctx.size,
7918
- "unlink-panels": true,
7919
- disabled: _ctx.disabled,
7920
- "default-time": _ctx.config.defaultTime,
7921
- onChange: changeHandler
7922
- }, null, 8, ["modelValue", "size", "disabled", "default-time"]);
7965
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
7966
+ (vue.openBlock(), vue.createBlock(vue.Teleport, {
7967
+ to: "body",
7968
+ disabled: !vue.unref(isFullscreen)
7969
+ }, [
7970
+ vue.createElementVNode(
7971
+ "div",
7972
+ {
7973
+ ref: "mTable",
7974
+ class: vue.normalizeClass(["m-fields-table", { "m-fields-table-item-extra": __props.config.itemExtra }])
7975
+ },
7976
+ [
7977
+ __props.config.extra ? (vue.openBlock(), vue.createElementBlock("span", {
7978
+ key: 0,
7979
+ style: { "color": "rgba(0, 0, 0, 0.45)" },
7980
+ innerHTML: __props.config.extra
7981
+ }, null, 8, _hoisted_2)) : vue.createCommentVNode("v-if", true),
7982
+ vue.createVNode(vue.unref(design.TMagicTooltip), {
7983
+ content: "拖拽可排序",
7984
+ placement: "left-start",
7985
+ disabled: __props.config.dropSort !== true
7986
+ }, {
7987
+ default: vue.withCtx(() => [
7988
+ __props.model[modelName.value] ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTable), {
7989
+ ref: "tMagicTable",
7990
+ style: { "width": "100%" },
7991
+ "show-header": "",
7992
+ "row-key": __props.config.rowKey || "id",
7993
+ columns: vue.unref(columns),
7994
+ data: data.value,
7995
+ border: __props.config.border,
7996
+ "max-height": __props.config.maxHeight,
7997
+ "default-expand-all": true,
7998
+ key: updateKey.value,
7999
+ onSelect: vue.unref(selectHandle),
8000
+ onSortChange: sortChangeHandler
8001
+ }, null, 8, ["row-key", "columns", "data", "border", "max-height", "onSelect"])) : vue.createCommentVNode("v-if", true)
8002
+ ]),
8003
+ _: 1
8004
+ /* STABLE */
8005
+ }, 8, ["disabled"]),
8006
+ vue.renderSlot(_ctx.$slots, "default"),
8007
+ vue.createElementVNode("div", _hoisted_3, [
8008
+ vue.unref(addable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8009
+ key: 0,
8010
+ size: "small",
8011
+ type: "primary",
8012
+ disabled: __props.disabled,
8013
+ plain: "",
8014
+ onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(newHandler)())
8015
+ }, {
8016
+ default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
8017
+ vue.createTextVNode(
8018
+ "新增一行",
8019
+ -1
8020
+ /* CACHED */
8021
+ )
8022
+ ])]),
8023
+ _: 1
8024
+ /* STABLE */
8025
+ }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true),
8026
+ vue.createElementVNode("div", _hoisted_4, [
8027
+ __props.enableToggleMode && __props.config.enableToggleMode !== false && !vue.unref(isFullscreen) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8028
+ key: 0,
8029
+ icon: vue.unref(iconsVue.Grid),
8030
+ size: "small",
8031
+ type: "primary",
8032
+ onClick: toggleMode
8033
+ }, {
8034
+ default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
8035
+ vue.createTextVNode(
8036
+ "展开配置",
8037
+ -1
8038
+ /* CACHED */
8039
+ )
8040
+ ])]),
8041
+ _: 1
8042
+ /* STABLE */
8043
+ }, 8, ["icon"])) : vue.createCommentVNode("v-if", true),
8044
+ __props.config.enableFullscreen !== false ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8045
+ key: 1,
8046
+ icon: vue.unref(iconsVue.FullScreen),
8047
+ size: "small",
8048
+ type: "primary",
8049
+ onClick: vue.unref(toggleFullscreen)
8050
+ }, {
8051
+ default: vue.withCtx(() => [
8052
+ vue.createTextVNode(
8053
+ vue.toDisplayString(vue.unref(isFullscreen) ? "退出全屏" : "全屏编辑"),
8054
+ 1
8055
+ /* TEXT */
8056
+ )
8057
+ ]),
8058
+ _: 1
8059
+ /* STABLE */
8060
+ }, 8, ["icon", "onClick"])) : vue.createCommentVNode("v-if", true),
8061
+ vue.unref(importable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicUpload), {
8062
+ key: 2,
8063
+ style: { "display": "inline-block" },
8064
+ ref: "excelBtn",
8065
+ action: "/noop",
8066
+ disabled: __props.disabled,
8067
+ "on-change": vue.unref(excelHandler),
8068
+ "auto-upload": false
8069
+ }, {
8070
+ default: vue.withCtx(() => [
8071
+ vue.createVNode(vue.unref(design.TMagicButton), {
8072
+ size: "small",
8073
+ type: "success",
8074
+ disabled: __props.disabled,
8075
+ plain: ""
8076
+ }, {
8077
+ default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
8078
+ vue.createTextVNode(
8079
+ "导入EXCEL",
8080
+ -1
8081
+ /* CACHED */
8082
+ )
8083
+ ])]),
8084
+ _: 1
8085
+ /* STABLE */
8086
+ }, 8, ["disabled"])
8087
+ ]),
8088
+ _: 1
8089
+ /* STABLE */
8090
+ }, 8, ["disabled", "on-change"])) : vue.createCommentVNode("v-if", true),
8091
+ vue.unref(importable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8092
+ key: 3,
8093
+ size: "small",
8094
+ type: "warning",
8095
+ disabled: __props.disabled,
8096
+ plain: "",
8097
+ onClick: vue.unref(clearHandler)
8098
+ }, {
8099
+ default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
8100
+ vue.createTextVNode(
8101
+ "清空",
8102
+ -1
8103
+ /* CACHED */
8104
+ )
8105
+ ])]),
8106
+ _: 1
8107
+ /* STABLE */
8108
+ }, 8, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true)
8109
+ ])
8110
+ ]),
8111
+ __props.config.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
8112
+ vue.createVNode(vue.unref(design.TMagicPagination), {
8113
+ layout: "total, sizes, prev, pager, next, jumper",
8114
+ "hide-on-single-page": __props.model[modelName.value].length < vue.unref(pageSize),
8115
+ "current-page": vue.unref(currentPage) + 1,
8116
+ "page-sizes": [vue.unref(pageSize), 60, 120, 300],
8117
+ "page-size": vue.unref(pageSize),
8118
+ total: __props.model[modelName.value].length,
8119
+ onSizeChange: vue.unref(handleSizeChange),
8120
+ onCurrentChange: vue.unref(handleCurrentChange)
8121
+ }, null, 8, ["hide-on-single-page", "current-page", "page-sizes", "page-size", "total", "onSizeChange", "onCurrentChange"])
8122
+ ])) : vue.createCommentVNode("v-if", true)
8123
+ ],
8124
+ 2
8125
+ /* CLASS */
8126
+ )
8127
+ ], 8, ["disabled"]))
8128
+ ]);
7923
8129
  };
7924
8130
  }
7925
8131
  });
@@ -8008,14 +8214,14 @@
8008
8214
  ref: drawer,
8009
8215
  modelValue: visible.value,
8010
8216
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
8011
- title: _ctx.title,
8012
- "close-on-press-escape": _ctx.closeOnPressEscape,
8217
+ title: __props.title,
8218
+ "close-on-press-escape": __props.closeOnPressEscape,
8013
8219
  "append-to-body": true,
8014
8220
  "show-close": true,
8015
8221
  "close-on-click-modal": true,
8016
- size: _ctx.width,
8017
- zIndex: _ctx.zIndex,
8018
- "before-close": _ctx.beforeClose,
8222
+ size: __props.width,
8223
+ zIndex: __props.zIndex,
8224
+ "before-close": __props.beforeClose,
8019
8225
  onOpen: openHandler,
8020
8226
  onOpened: openedHandler,
8021
8227
  onClose: closeHandler,
@@ -8052,13 +8258,13 @@
8052
8258
  }),
8053
8259
  vue.createVNode(vue.unref(design.TMagicButton), {
8054
8260
  type: "primary",
8055
- disabled: _ctx.disabled,
8261
+ disabled: __props.disabled,
8056
8262
  loading: saveFetch.value,
8057
8263
  onClick: submitHandler
8058
8264
  }, {
8059
8265
  default: vue.withCtx(() => [
8060
8266
  vue.createTextVNode(
8061
- vue.toDisplayString(_ctx.confirmText),
8267
+ vue.toDisplayString(__props.confirmText),
8062
8268
  1
8063
8269
  /* TEXT */
8064
8270
  )
@@ -8086,18 +8292,18 @@
8086
8292
  class: "m-drawer-body"
8087
8293
  },
8088
8294
  [
8089
- vue.createVNode(_sfc_main$d, {
8295
+ vue.createVNode(_sfc_main$g, {
8090
8296
  ref_key: "form",
8091
8297
  ref: form,
8092
- size: _ctx.size,
8093
- disabled: _ctx.disabled,
8094
- config: _ctx.config,
8095
- "init-values": _ctx.values,
8096
- "parent-values": _ctx.parentValues,
8097
- "label-width": _ctx.labelWidth,
8098
- "label-position": _ctx.labelPosition,
8099
- inline: _ctx.inline,
8100
- "prevent-submit-default": _ctx.preventSubmitDefault,
8298
+ size: __props.size,
8299
+ disabled: __props.disabled,
8300
+ config: __props.config,
8301
+ "init-values": __props.values,
8302
+ "parent-values": __props.parentValues,
8303
+ "label-width": __props.labelWidth,
8304
+ "label-position": __props.labelPosition,
8305
+ inline: __props.inline,
8306
+ "prevent-submit-default": __props.preventSubmitDefault,
8101
8307
  onChange: changeHandler
8102
8308
  }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
8103
8309
  vue.renderSlot(_ctx.$slots, "default")
@@ -8194,18 +8400,18 @@
8194
8400
  [
8195
8401
  vue.createVNode(vue.unref(design.TMagicScrollbar), null, {
8196
8402
  default: vue.withCtx(() => [
8197
- vue.createVNode(_sfc_main$d, {
8403
+ vue.createVNode(_sfc_main$g, {
8198
8404
  ref_key: "form",
8199
8405
  ref: form,
8200
- size: _ctx.size,
8201
- disabled: _ctx.disabled,
8202
- config: _ctx.config,
8203
- "init-values": _ctx.values,
8204
- "parent-values": _ctx.parentValues,
8205
- "label-width": _ctx.labelWidth,
8206
- "label-position": _ctx.labelPosition,
8207
- inline: _ctx.inline,
8208
- "prevent-submit-default": _ctx.preventSubmitDefault,
8406
+ size: __props.size,
8407
+ disabled: __props.disabled,
8408
+ config: __props.config,
8409
+ "init-values": __props.values,
8410
+ "parent-values": __props.parentValues,
8411
+ "label-width": __props.labelWidth,
8412
+ "label-position": __props.labelPosition,
8413
+ inline: __props.inline,
8414
+ "prevent-submit-default": __props.preventSubmitDefault,
8209
8415
  onChange: changeHandler
8210
8416
  }, null, 8, ["size", "disabled", "config", "init-values", "parent-values", "label-width", "label-position", "inline", "prevent-submit-default"]),
8211
8417
  vue.renderSlot(_ctx.$slots, "default")
@@ -8231,14 +8437,14 @@
8231
8437
  vue.renderSlot(_ctx.$slots, "footer", {}, () => [
8232
8438
  vue.createVNode(vue.unref(design.TMagicButton), {
8233
8439
  type: "primary",
8234
- size: _ctx.size,
8235
- disabled: _ctx.disabled,
8440
+ size: __props.size,
8441
+ disabled: __props.disabled,
8236
8442
  loading: saveFetch.value,
8237
8443
  onClick: submitHandler
8238
8444
  }, {
8239
8445
  default: vue.withCtx(() => [
8240
8446
  vue.createTextVNode(
8241
- vue.toDisplayString(_ctx.confirmText),
8447
+ vue.toDisplayString(__props.confirmText),
8242
8448
  1
8243
8449
  /* TEXT */
8244
8450
  )
@@ -8267,79 +8473,84 @@
8267
8473
  const option = Object.assign(defaultInstallOpt, opt);
8268
8474
  app.config.globalProperties.$MAGIC_FORM = option;
8269
8475
  setConfig(option);
8270
- app.component("m-form", _sfc_main$d);
8271
- app.component("m-form-dialog", _sfc_main$c);
8272
- app.component("m-form-container", _sfc_main$x);
8273
- app.component("m-form-fieldset", _sfc_main$w);
8274
- app.component("m-form-group-list", _sfc_main$u);
8275
- app.component("m-form-panel", _sfc_main$t);
8276
- app.component("m-form-row", _sfc_main$r);
8277
- app.component("m-form-step", _sfc_main$q);
8278
- app.component("m-form-table", _sfc_main$p);
8279
- app.component("m-form-tab", _sfc_main$o);
8280
- app.component("m-fields-text", _sfc_main$5);
8281
- app.component("m-fields-img-upload", _sfc_main$5);
8282
- app.component("m-fields-number", _sfc_main$a);
8283
- app.component("m-fields-number-range", _sfc_main$9);
8284
- app.component("m-fields-textarea", _sfc_main$4);
8285
- app.component("m-fields-hidden", _sfc_main$e);
8286
- app.component("m-fields-date", _sfc_main$j);
8287
- app.component("m-fields-datetime", _sfc_main$h);
8288
- app.component("m-fields-daterange", _sfc_main$i);
8289
- app.component("m-fields-timerange", _sfc_main$2);
8290
- app.component("m-fields-time", _sfc_main$3);
8291
- app.component("m-fields-checkbox", _sfc_main$m);
8292
- app.component("m-fields-switch", _sfc_main$6);
8293
- app.component("m-fields-color-picker", _sfc_main$k);
8294
- app.component("m-fields-checkbox-group", _sfc_main$l);
8295
- app.component("m-fields-radio-group", _sfc_main$8);
8296
- app.component("m-fields-display", _sfc_main$g);
8297
- app.component("m-fields-link", _sfc_main$b);
8298
- app.component("m-fields-select", _sfc_main$7);
8299
- app.component("m-fields-cascader", _sfc_main$n);
8300
- app.component("m-fields-dynamic-field", _sfc_main$f);
8476
+ app.component("m-form", _sfc_main$g);
8477
+ app.component("m-form-dialog", _sfc_main$f);
8478
+ app.component("m-form-container", _sfc_main$A);
8479
+ app.component("m-form-fieldset", _sfc_main$z);
8480
+ app.component("m-form-group-list", _sfc_main$w);
8481
+ app.component("m-form-panel", _sfc_main$v);
8482
+ app.component("m-form-row", _sfc_main$t);
8483
+ app.component("m-form-step", _sfc_main$s);
8484
+ app.component("m-form-table", _sfc_main$2);
8485
+ app.component("m-form-tab", _sfc_main$r);
8486
+ app.component("m-form-flex-layout", _sfc_main$y);
8487
+ app.component("m-fields-text", _sfc_main$8);
8488
+ app.component("m-fields-img-upload", _sfc_main$8);
8489
+ app.component("m-fields-number", _sfc_main$d);
8490
+ app.component("m-fields-number-range", _sfc_main$c);
8491
+ app.component("m-fields-textarea", _sfc_main$7);
8492
+ app.component("m-fields-hidden", _sfc_main$h);
8493
+ app.component("m-fields-date", _sfc_main$m);
8494
+ app.component("m-fields-datetime", _sfc_main$k);
8495
+ app.component("m-fields-daterange", _sfc_main$l);
8496
+ app.component("m-fields-timerange", _sfc_main$5);
8497
+ app.component("m-fields-time", _sfc_main$6);
8498
+ app.component("m-fields-checkbox", _sfc_main$p);
8499
+ app.component("m-fields-switch", _sfc_main$9);
8500
+ app.component("m-fields-color-picker", _sfc_main$n);
8501
+ app.component("m-fields-checkbox-group", _sfc_main$o);
8502
+ app.component("m-fields-radio-group", _sfc_main$b);
8503
+ app.component("m-fields-display", _sfc_main$j);
8504
+ app.component("m-fields-link", _sfc_main$e);
8505
+ app.component("m-fields-select", _sfc_main$a);
8506
+ app.component("m-fields-cascader", _sfc_main$q);
8507
+ app.component("m-fields-dynamic-field", _sfc_main$i);
8301
8508
  }
8302
8509
  };
8303
8510
 
8304
- exports.MCascader = _sfc_main$n;
8305
- exports.MCheckbox = _sfc_main$m;
8306
- exports.MCheckboxGroup = _sfc_main$l;
8307
- exports.MColorPicker = _sfc_main$k;
8308
- exports.MContainer = _sfc_main$x;
8309
- exports.MDate = _sfc_main$j;
8310
- exports.MDateTime = _sfc_main$h;
8311
- exports.MDaterange = _sfc_main$i;
8312
- exports.MDisplay = _sfc_main$g;
8313
- exports.MDynamicField = _sfc_main$f;
8314
- exports.MFieldset = _sfc_main$w;
8315
- exports.MForm = _sfc_main$d;
8511
+ exports.MCascader = _sfc_main$q;
8512
+ exports.MCheckbox = _sfc_main$p;
8513
+ exports.MCheckboxGroup = _sfc_main$o;
8514
+ exports.MColorPicker = _sfc_main$n;
8515
+ exports.MContainer = _sfc_main$A;
8516
+ exports.MDate = _sfc_main$m;
8517
+ exports.MDateTime = _sfc_main$k;
8518
+ exports.MDaterange = _sfc_main$l;
8519
+ exports.MDisplay = _sfc_main$j;
8520
+ exports.MDynamicField = _sfc_main$i;
8521
+ exports.MFieldset = _sfc_main$z;
8522
+ exports.MFlexLayout = _sfc_main$y;
8523
+ exports.MForm = _sfc_main$g;
8316
8524
  exports.MFormBox = _sfc_main;
8317
- exports.MFormDialog = _sfc_main$c;
8525
+ exports.MFormDialog = _sfc_main$f;
8318
8526
  exports.MFormDrawer = _sfc_main$1;
8319
- exports.MGroupList = _sfc_main$u;
8320
- exports.MHidden = _sfc_main$e;
8321
- exports.MLink = _sfc_main$b;
8322
- exports.MNumber = _sfc_main$a;
8323
- exports.MNumberRange = _sfc_main$9;
8324
- exports.MPanel = _sfc_main$t;
8325
- exports.MRadioGroup = _sfc_main$8;
8326
- exports.MRow = _sfc_main$r;
8327
- exports.MSelect = _sfc_main$7;
8328
- exports.MSwitch = _sfc_main$6;
8329
- exports.MTable = _sfc_main$p;
8330
- exports.MTabs = _sfc_main$o;
8331
- exports.MText = _sfc_main$5;
8332
- exports.MTextarea = _sfc_main$4;
8333
- exports.MTime = _sfc_main$3;
8334
- exports.MTimerange = _sfc_main$2;
8527
+ exports.MGroupList = _sfc_main$w;
8528
+ exports.MHidden = _sfc_main$h;
8529
+ exports.MLink = _sfc_main$e;
8530
+ exports.MNumber = _sfc_main$d;
8531
+ exports.MNumberRange = _sfc_main$c;
8532
+ exports.MPanel = _sfc_main$v;
8533
+ exports.MRadioGroup = _sfc_main$b;
8534
+ exports.MRow = _sfc_main$t;
8535
+ exports.MSelect = _sfc_main$a;
8536
+ exports.MSwitch = _sfc_main$9;
8537
+ exports.MTable = _sfc_main$2;
8538
+ exports.MTabs = _sfc_main$r;
8539
+ exports.MText = _sfc_main$8;
8540
+ exports.MTextarea = _sfc_main$7;
8541
+ exports.MTime = _sfc_main$6;
8542
+ exports.MTimerange = _sfc_main$5;
8335
8543
  exports.createForm = createForm;
8336
8544
  exports.createValues = createValues;
8337
8545
  exports.datetimeFormatter = datetimeFormatter;
8338
8546
  exports.default = index;
8339
8547
  exports.display = display;
8340
8548
  exports.filterFunction = filterFunction;
8549
+ exports.getDataByPage = getDataByPage;
8341
8550
  exports.getRules = getRules;
8342
8551
  exports.initValue = initValue;
8552
+ exports.sortArray = sortArray;
8553
+ exports.sortChange = sortChange;
8343
8554
  exports.useAddField = useAddField;
8344
8555
  Object.keys(formSchema).forEach(k => {
8345
8556
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {