@tmagic/form 1.4.1 → 1.4.2

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.
@@ -1,7 +1,7 @@
1
1
  import { toRaw, defineComponent, inject, ref, computed, resolveComponent, watchEffect, watch, openBlock, createElementBlock, normalizeStyle, normalizeClass, createBlock, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, createCommentVNode, renderList, createTextVNode, toDisplayString, withDirectives, vShow, renderSlot, onMounted, Teleport, toRefs, mergeProps, getCurrentInstance, reactive, onBeforeUnmount, vModelText, provide, onBeforeMount, nextTick, resolveDirective, createSlots, withModifiers } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, CaretTop, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual, isEmpty } from 'lodash-es';
4
- import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicOptionGroup, TMagicOption, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
4
+ import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, useZIndex, TMagicTable, TMagicTableColumn, TMagicUpload, TMagicPagination, tMagicMessage, getConfig as getConfig$1, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, TMagicDialog, TMagicInputNumber, TMagicRadioGroup, TMagicRadio, TMagicSelect, TMagicSwitch, TMagicPopover, TMagicTimePicker, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
5
5
  import Sortable from 'sortablejs';
6
6
  import { sleep, asyncLoadJs, datetimeFormatter, getValueByKeyPath, isNumber } from '@tmagic/utils';
7
7
 
@@ -183,7 +183,7 @@ const _hoisted_14 = {
183
183
  key: 5,
184
184
  style: { "text-align": "center" }
185
185
  };
186
- const _sfc_main$z = /* @__PURE__ */ defineComponent({
186
+ const _sfc_main$x = /* @__PURE__ */ defineComponent({
187
187
  ...{
188
188
  name: "MFormContainer"
189
189
  },
@@ -620,7 +620,7 @@ const _hoisted_6$1 = {
620
620
  };
621
621
  const _hoisted_7 = { style: { "flex": "1" } };
622
622
  const _hoisted_8 = ["src"];
623
- const _sfc_main$y = /* @__PURE__ */ defineComponent({
623
+ const _sfc_main$w = /* @__PURE__ */ defineComponent({
624
624
  ...{
625
625
  name: "MFormFieldset"
626
626
  },
@@ -704,7 +704,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
704
704
  _ctx.config.schematic && show.value ? (openBlock(), createElementBlock("div", _hoisted_6$1, [
705
705
  createElementVNode("div", _hoisted_7, [
706
706
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (item, index) => {
707
- return openBlock(), createBlock(_sfc_main$z, {
707
+ return openBlock(), createBlock(_sfc_main$x, {
708
708
  key: key(item, index),
709
709
  model: name.value ? _ctx.model[name.value] : _ctx.model,
710
710
  lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
@@ -725,7 +725,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
725
725
  src: _ctx.config.schematic
726
726
  }, null, 8, _hoisted_8)
727
727
  ])) : show.value ? (openBlock(true), createElementBlock(Fragment, { key: 3 }, renderList(_ctx.config.items, (item, index) => {
728
- return openBlock(), createBlock(_sfc_main$z, {
728
+ return openBlock(), createBlock(_sfc_main$x, {
729
729
  key: key(item, index),
730
730
  model: name.value ? _ctx.model[name.value] : _ctx.model,
731
731
  lastValues: name.value ? _ctx.lastValues[name.value] : _ctx.lastValues,
@@ -747,7 +747,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
747
747
 
748
748
  const _hoisted_1$b = { class: "m-fields-group-list-item" };
749
749
  const _hoisted_2$6 = ["innerHTML"];
750
- const _sfc_main$x = /* @__PURE__ */ defineComponent({
750
+ const _sfc_main$v = /* @__PURE__ */ defineComponent({
751
751
  ...{
752
752
  name: "MFormGroupListItem"
753
753
  },
@@ -886,7 +886,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
886
886
  class: "m-form-tip"
887
887
  }, null, 8, _hoisted_2$6)) : createCommentVNode("", true)
888
888
  ]),
889
- expand.value ? (openBlock(), createBlock(_sfc_main$z, {
889
+ expand.value ? (openBlock(), createBlock(_sfc_main$x, {
890
890
  key: 0,
891
891
  config: rowConfig.value,
892
892
  model: _ctx.model,
@@ -914,7 +914,7 @@ const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("span", { class: "el-tab
914
914
  const _hoisted_5$2 = [
915
915
  _hoisted_4$2
916
916
  ];
917
- const _sfc_main$w = /* @__PURE__ */ defineComponent({
917
+ const _sfc_main$u = /* @__PURE__ */ defineComponent({
918
918
  ...{
919
919
  name: "MFormGroupList"
920
920
  },
@@ -1005,7 +1005,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
1005
1005
  style: { "color": "rgba(0, 0, 0, 0.45)" }
1006
1006
  }, null, 8, _hoisted_2$5)) : createCommentVNode("", true),
1007
1007
  !_ctx.model[_ctx.name] || !_ctx.model[_ctx.name].length ? (openBlock(), createElementBlock("div", _hoisted_3$3, _hoisted_5$2)) : (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(_ctx.model[_ctx.name], (item, index) => {
1008
- return openBlock(), createBlock(_sfc_main$x, {
1008
+ return openBlock(), createBlock(_sfc_main$v, {
1009
1009
  key: index,
1010
1010
  model: item,
1011
1011
  lastValues: getLastValues(_ctx.lastValues[_ctx.name], index),
@@ -1058,7 +1058,7 @@ const _hoisted_3$2 = {
1058
1058
  };
1059
1059
  const _hoisted_4$1 = { style: { "flex": "1" } };
1060
1060
  const _hoisted_5$1 = ["src"];
1061
- const _sfc_main$v = /* @__PURE__ */ defineComponent({
1061
+ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1062
1062
  ...{
1063
1063
  name: "MFormPanel"
1064
1064
  },
@@ -1114,7 +1114,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1114
1114
  _ctx.config.schematic ? (openBlock(), createElementBlock("div", _hoisted_3$2, [
1115
1115
  createElementVNode("div", _hoisted_4$1, [
1116
1116
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
1117
- return openBlock(), createBlock(_sfc_main$z, {
1117
+ return openBlock(), createBlock(_sfc_main$x, {
1118
1118
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1119
1119
  config: item,
1120
1120
  model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
@@ -1134,7 +1134,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1134
1134
  src: _ctx.config.schematic
1135
1135
  }, null, 8, _hoisted_5$1)
1136
1136
  ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(items.value, (item, index) => {
1137
- return openBlock(), createBlock(_sfc_main$z, {
1137
+ return openBlock(), createBlock(_sfc_main$x, {
1138
1138
  key: item[unref(mForm)?.keyProp || "__key"] ?? index,
1139
1139
  config: item,
1140
1140
  model: _ctx.name ? _ctx.model[_ctx.name] : _ctx.model,
@@ -1156,7 +1156,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
1156
1156
  }
1157
1157
  });
1158
1158
 
1159
- const _sfc_main$u = /* @__PURE__ */ defineComponent({
1159
+ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1160
1160
  ...{
1161
1161
  name: "MFormCol"
1162
1162
  },
@@ -1184,7 +1184,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1184
1184
  return (_ctx, _cache) => {
1185
1185
  return withDirectives((openBlock(), createBlock(unref(TMagicCol), { span: _ctx.span }, {
1186
1186
  default: withCtx(() => [
1187
- createVNode(_sfc_main$z, {
1187
+ createVNode(_sfc_main$x, {
1188
1188
  model: _ctx.model,
1189
1189
  lastValues: _ctx.lastValues,
1190
1190
  "is-compare": _ctx.isCompare,
@@ -1206,7 +1206,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
1206
1206
  }
1207
1207
  });
1208
1208
 
1209
- const _sfc_main$t = /* @__PURE__ */ defineComponent({
1209
+ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1210
1210
  ...{
1211
1211
  name: "MFormRow"
1212
1212
  },
@@ -1234,7 +1234,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1234
1234
  return openBlock(), createBlock(unref(TMagicRow), { gutter: 10 }, {
1235
1235
  default: withCtx(() => [
1236
1236
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.config.items, (col, index) => {
1237
- return openBlock(), createBlock(_sfc_main$u, {
1237
+ return openBlock(), createBlock(_sfc_main$s, {
1238
1238
  key: col[unref(mForm)?.keyProp || "__key"] ?? index,
1239
1239
  span: col.span || _ctx.config.span || 24 / _ctx.config.items.length,
1240
1240
  config: col,
@@ -1257,7 +1257,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
1257
1257
  }
1258
1258
  });
1259
1259
 
1260
- const _sfc_main$s = /* @__PURE__ */ defineComponent({
1260
+ const _sfc_main$q = /* @__PURE__ */ defineComponent({
1261
1261
  ...{
1262
1262
  name: "MFormStep"
1263
1263
  },
@@ -1312,7 +1312,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
1312
1312
  return openBlock(), createElementBlock(Fragment, null, [
1313
1313
  (openBlock(true), createElementBlock(Fragment, null, renderList(step.items, (item) => {
1314
1314
  return openBlock(), createElementBlock(Fragment, null, [
1315
- item ? withDirectives((openBlock(), createBlock(_sfc_main$z, {
1315
+ item ? withDirectives((openBlock(), createBlock(_sfc_main$x, {
1316
1316
  key: item[unref(mForm)?.keyProp || "__key"],
1317
1317
  config: item,
1318
1318
  model: step.name ? _ctx.model[step.name] : _ctx.model,
@@ -1346,7 +1346,7 @@ const _hoisted_6 = {
1346
1346
  class: "bottom",
1347
1347
  style: { "text-align": "right" }
1348
1348
  };
1349
- const _sfc_main$r = /* @__PURE__ */ defineComponent({
1349
+ const _sfc_main$p = /* @__PURE__ */ defineComponent({
1350
1350
  ...{
1351
1351
  name: "MFormTable"
1352
1352
  },
@@ -1854,7 +1854,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1854
1854
  "class-name": _ctx.config.dropSort === true ? "el-table__column--dropable" : ""
1855
1855
  }, {
1856
1856
  default: withCtx((scope) => [
1857
- scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$z, {
1857
+ scope.$index > -1 ? (openBlock(), createBlock(_sfc_main$x, {
1858
1858
  key: 0,
1859
1859
  labelWidth: "0",
1860
1860
  disabled: _ctx.disabled,
@@ -1978,7 +1978,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
1978
1978
  }
1979
1979
  });
1980
1980
 
1981
- const _sfc_main$q = /* @__PURE__ */ defineComponent({
1981
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1982
1982
  ...{
1983
1983
  name: "MFormTabs"
1984
1984
  },
@@ -2133,7 +2133,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
2133
2133
  ]),
2134
2134
  default: withCtx(() => [
2135
2135
  (openBlock(true), createElementBlock(Fragment, null, renderList(tabItems(tab), (item) => {
2136
- return openBlock(), createBlock(_sfc_main$z, {
2136
+ return openBlock(), createBlock(_sfc_main$x, {
2137
2137
  key: item[unref(mForm)?.keyProp || "__key"],
2138
2138
  config: item,
2139
2139
  disabled: _ctx.disabled,
@@ -2185,7 +2185,7 @@ const useAddField = (prop) => {
2185
2185
  );
2186
2186
  };
2187
2187
 
2188
- const _sfc_main$p = /* @__PURE__ */ defineComponent({
2188
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2189
2189
  ...{
2190
2190
  name: "MFormCascader"
2191
2191
  },
@@ -2283,7 +2283,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
2283
2283
  }
2284
2284
  });
2285
2285
 
2286
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
2286
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2287
2287
  ...{
2288
2288
  name: "MFormCheckbox"
2289
2289
  },
@@ -2346,7 +2346,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
2346
2346
  }
2347
2347
  });
2348
2348
 
2349
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
2349
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2350
2350
  ...{
2351
2351
  name: "MFormCheckGroup"
2352
2352
  },
@@ -2409,7 +2409,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
2409
2409
  }
2410
2410
  });
2411
2411
 
2412
- const _sfc_main$m = /* @__PURE__ */ defineComponent({
2412
+ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2413
2413
  ...{
2414
2414
  name: "MFormColorPicker"
2415
2415
  },
@@ -2444,7 +2444,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
2444
2444
  }
2445
2445
  });
2446
2446
 
2447
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
2447
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2448
2448
  ...{
2449
2449
  name: "MFormDate"
2450
2450
  },
@@ -2485,7 +2485,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2485
2485
  }
2486
2486
  });
2487
2487
 
2488
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
2488
+ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2489
2489
  ...{
2490
2490
  name: "MFormDateRange"
2491
2491
  },
@@ -2588,7 +2588,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
2588
2588
  }
2589
2589
  });
2590
2590
 
2591
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
2591
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2592
2592
  ...{
2593
2593
  name: "MFormDateTime"
2594
2594
  },
@@ -2639,7 +2639,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2639
2639
  });
2640
2640
 
2641
2641
  const _hoisted_1$7 = { key: 0 };
2642
- const _sfc_main$i = /* @__PURE__ */ defineComponent({
2642
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2643
2643
  ...{
2644
2644
  name: "MFormDisplay"
2645
2645
  },
@@ -2668,7 +2668,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2668
2668
  });
2669
2669
 
2670
2670
  const _hoisted_1$6 = { class: "m-fields-dynamic-field" };
2671
- const _sfc_main$h = /* @__PURE__ */ defineComponent({
2671
+ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2672
2672
  ...{
2673
2673
  name: "MFormDynamicField"
2674
2674
  },
@@ -2761,7 +2761,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2761
2761
  }
2762
2762
  });
2763
2763
 
2764
- const _sfc_main$g = /* @__PURE__ */ defineComponent({
2764
+ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2765
2765
  ...{
2766
2766
  name: "MFormHidden"
2767
2767
  },
@@ -2792,7 +2792,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2792
2792
  }
2793
2793
  });
2794
2794
 
2795
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2795
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2796
2796
  ...{
2797
2797
  name: "MForm"
2798
2798
  },
@@ -2933,7 +2933,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2933
2933
  }, {
2934
2934
  default: withCtx(() => [
2935
2935
  initialized.value && Array.isArray(_ctx.config) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.config, (item, index) => {
2936
- return openBlock(), createBlock(_sfc_main$z, {
2936
+ return openBlock(), createBlock(_sfc_main$x, {
2937
2937
  disabled: _ctx.disabled,
2938
2938
  key: item[_ctx.keyProp] ?? index,
2939
2939
  config: item,
@@ -2954,7 +2954,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2954
2954
  });
2955
2955
 
2956
2956
  const _hoisted_1$5 = { style: { "min-height": "1px" } };
2957
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
2957
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2958
2958
  ...{
2959
2959
  name: "MFormDialog"
2960
2960
  },
@@ -3128,7 +3128,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3128
3128
  class: "m-dialog-body",
3129
3129
  style: normalizeStyle(`max-height: ${bodyHeight.value}; overflow-y: auto; overflow-x: hidden;`)
3130
3130
  }, [
3131
- createVNode(_sfc_main$f, {
3131
+ createVNode(_sfc_main$d, {
3132
3132
  modelValue: stepActive.value,
3133
3133
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => stepActive.value = $event),
3134
3134
  ref_key: "form",
@@ -3157,7 +3157,7 @@ const _hoisted_2$2 = {
3157
3157
  key: 2,
3158
3158
  class: "m-fields-link"
3159
3159
  };
3160
- const _sfc_main$d = /* @__PURE__ */ defineComponent({
3160
+ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3161
3161
  ...{
3162
3162
  name: "MFormLink"
3163
3163
  },
@@ -3240,7 +3240,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3240
3240
  ]),
3241
3241
  _: 1
3242
3242
  }),
3243
- createVNode(_sfc_main$e, {
3243
+ createVNode(_sfc_main$c, {
3244
3244
  ref_key: "editor",
3245
3245
  ref: editor,
3246
3246
  title: _ctx.config.formTitle || "编辑扩展配置",
@@ -3256,7 +3256,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
3256
3256
  }
3257
3257
  });
3258
3258
 
3259
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
3259
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3260
3260
  ...{
3261
3261
  name: "MFormNumber"
3262
3262
  },
@@ -3307,7 +3307,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3307
3307
 
3308
3308
  const _hoisted_1$3 = { class: "m-fields-number-range" };
3309
3309
  const _hoisted_2$1 = /* @__PURE__ */ createElementVNode("span", { class: "split-tag" }, "-", -1);
3310
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
3310
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3311
3311
  ...{
3312
3312
  name: "MFormNumberRange"
3313
3313
  },
@@ -3361,7 +3361,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3361
3361
  }
3362
3362
  });
3363
3363
 
3364
- const _sfc_main$a = /* @__PURE__ */ defineComponent({
3364
+ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3365
3365
  ...{
3366
3366
  name: "MFormRadioGroup"
3367
3367
  },
@@ -3413,63 +3413,6 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3413
3413
  }
3414
3414
  });
3415
3415
 
3416
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3417
- ...{
3418
- name: "MFormSelectOptionGroups"
3419
- },
3420
- __name: "SelectOptionGroups",
3421
- props: {
3422
- options: {}
3423
- },
3424
- setup(__props) {
3425
- const uiComponent = getConfig$1("components")?.option.component || "el-option";
3426
- return (_ctx, _cache) => {
3427
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (group, index) => {
3428
- return openBlock(), createBlock(unref(TMagicOptionGroup), {
3429
- key: index,
3430
- label: group.label,
3431
- disabled: group.disabled
3432
- }, {
3433
- default: withCtx(() => [
3434
- (openBlock(true), createElementBlock(Fragment, null, renderList(group.options, (item, index2) => {
3435
- return openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent)), {
3436
- key: index2,
3437
- label: item.label || item.text,
3438
- value: item.value,
3439
- disabled: item.disabled
3440
- }, null, 8, ["label", "value", "disabled"]);
3441
- }), 128))
3442
- ]),
3443
- _: 2
3444
- }, 1032, ["label", "disabled"]);
3445
- }), 128);
3446
- };
3447
- }
3448
- });
3449
-
3450
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3451
- ...{
3452
- name: "MFormSelectOptions"
3453
- },
3454
- __name: "SelectOptions",
3455
- props: {
3456
- options: {},
3457
- valueKey: {}
3458
- },
3459
- setup(__props) {
3460
- return (_ctx, _cache) => {
3461
- return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option) => {
3462
- return openBlock(), createBlock(unref(TMagicOption), {
3463
- label: option.text,
3464
- value: option.value,
3465
- key: _ctx.valueKey ? option.value[_ctx.valueKey] : option.value,
3466
- disabled: option.disabled
3467
- }, null, 8, ["label", "value", "disabled"]);
3468
- }), 128);
3469
- };
3470
- }
3471
- });
3472
-
3473
3416
  const _hoisted_1$2 = { key: 2 };
3474
3417
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3475
3418
  ...{
@@ -3491,6 +3434,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3491
3434
  setup(__props, { emit: __emit }) {
3492
3435
  const props = __props;
3493
3436
  const emit = __emit;
3437
+ const optionComponent = getConfig$1("components")?.option;
3438
+ const optionGroupComponent = getConfig$1("components")?.optionGroup;
3494
3439
  if (!props.model)
3495
3440
  throw new Error("不能没有model");
3496
3441
  useAddField(props.prop);
@@ -3786,8 +3731,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3786
3731
  }, 0);
3787
3732
  }
3788
3733
  };
3789
- const itemOptions = options;
3790
- const groupOptions = options;
3791
3734
  return (_ctx, _cache) => {
3792
3735
  const _directive_loading = resolveDirective("loading");
3793
3736
  return _ctx.model ? withDirectives((openBlock(), createBlock(unref(TMagicSelect), {
@@ -3812,13 +3755,41 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3812
3755
  onVisibleChange: visibleHandler
3813
3756
  }, {
3814
3757
  default: withCtx(() => [
3815
- _ctx.config.group ? (openBlock(), createBlock(_sfc_main$9, {
3816
- key: 0,
3817
- options: unref(groupOptions)
3818
- }, null, 8, ["options"])) : (openBlock(), createBlock(_sfc_main$8, {
3819
- key: 1,
3820
- options: unref(itemOptions)
3821
- }, null, 8, ["options"])),
3758
+ _ctx.config.group ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(options.value, (group, index) => {
3759
+ return openBlock(), createBlock(resolveDynamicComponent(unref(optionGroupComponent)?.component), mergeProps(
3760
+ { key: index },
3761
+ unref(optionGroupComponent)?.props({
3762
+ label: group.label,
3763
+ disabled: group.disabled
3764
+ })
3765
+ ), {
3766
+ default: withCtx(() => [
3767
+ (openBlock(true), createElementBlock(Fragment, null, renderList(group.options, (item, index2) => {
3768
+ return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component), mergeProps(
3769
+ { key: index2 },
3770
+ unref(optionComponent)?.props({
3771
+ label: item.label || item.text,
3772
+ value: item.value,
3773
+ disabled: item.disabled
3774
+ })
3775
+ ), null, 16);
3776
+ }), 128))
3777
+ ]),
3778
+ _: 2
3779
+ }, 1040);
3780
+ }), 128)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(options.value, (option) => {
3781
+ return openBlock(), createBlock(resolveDynamicComponent(unref(optionComponent)?.component), mergeProps(
3782
+ {
3783
+ class: "tmagic-design-option",
3784
+ key: _ctx.config.valueKey ? option.value[_ctx.config.valueKey] : option.value
3785
+ },
3786
+ unref(optionComponent)?.props({
3787
+ label: option.text,
3788
+ value: option.value,
3789
+ disabled: option.disabled
3790
+ })
3791
+ ), null, 16);
3792
+ }), 128)),
3822
3793
  moreLoadingVisible.value ? withDirectives((openBlock(), createElementBlock("div", _hoisted_1$2, null, 512)), [
3823
3794
  [_directive_loading, true]
3824
3795
  ]) : createCommentVNode("", true)
@@ -4386,7 +4357,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4386
4357
  ref: drawerBody,
4387
4358
  class: "m-drawer-body"
4388
4359
  }, [
4389
- createVNode(_sfc_main$f, {
4360
+ createVNode(_sfc_main$d, {
4390
4361
  ref_key: "form",
4391
4362
  ref: form,
4392
4363
  size: _ctx.size,
@@ -4482,7 +4453,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4482
4453
  }, [
4483
4454
  createVNode(unref(TMagicScrollbar), null, {
4484
4455
  default: withCtx(() => [
4485
- createVNode(_sfc_main$f, {
4456
+ createVNode(_sfc_main$d, {
4486
4457
  ref_key: "form",
4487
4458
  ref: form,
4488
4459
  size: _ctx.size,
@@ -4536,37 +4507,37 @@ const index = {
4536
4507
  const option = Object.assign(defaultInstallOpt, opt);
4537
4508
  app.config.globalProperties.$MAGIC_FORM = option;
4538
4509
  setConfig(option);
4539
- app.component("m-form", _sfc_main$f);
4540
- app.component("m-form-dialog", _sfc_main$e);
4541
- app.component("m-form-container", _sfc_main$z);
4542
- app.component("m-form-fieldset", _sfc_main$y);
4543
- app.component("m-form-group-list", _sfc_main$w);
4544
- app.component("m-form-panel", _sfc_main$v);
4545
- app.component("m-form-row", _sfc_main$t);
4546
- app.component("m-form-step", _sfc_main$s);
4547
- app.component("m-form-table", _sfc_main$r);
4548
- app.component("m-form-tab", _sfc_main$q);
4510
+ app.component("m-form", _sfc_main$d);
4511
+ app.component("m-form-dialog", _sfc_main$c);
4512
+ app.component("m-form-container", _sfc_main$x);
4513
+ app.component("m-form-fieldset", _sfc_main$w);
4514
+ app.component("m-form-group-list", _sfc_main$u);
4515
+ app.component("m-form-panel", _sfc_main$t);
4516
+ app.component("m-form-row", _sfc_main$r);
4517
+ app.component("m-form-step", _sfc_main$q);
4518
+ app.component("m-form-table", _sfc_main$p);
4519
+ app.component("m-form-tab", _sfc_main$o);
4549
4520
  app.component("m-fields-text", _sfc_main$5);
4550
- app.component("m-fields-number", _sfc_main$c);
4551
- app.component("m-fields-number-range", _sfc_main$b);
4521
+ app.component("m-fields-number", _sfc_main$a);
4522
+ app.component("m-fields-number-range", _sfc_main$9);
4552
4523
  app.component("m-fields-textarea", _sfc_main$4);
4553
- app.component("m-fields-hidden", _sfc_main$g);
4554
- app.component("m-fields-date", _sfc_main$l);
4555
- app.component("m-fields-datetime", _sfc_main$j);
4556
- app.component("m-fields-daterange", _sfc_main$k);
4524
+ app.component("m-fields-hidden", _sfc_main$e);
4525
+ app.component("m-fields-date", _sfc_main$j);
4526
+ app.component("m-fields-datetime", _sfc_main$h);
4527
+ app.component("m-fields-daterange", _sfc_main$i);
4557
4528
  app.component("m-fields-timerange", _sfc_main$2);
4558
4529
  app.component("m-fields-time", _sfc_main$3);
4559
- app.component("m-fields-checkbox", _sfc_main$o);
4530
+ app.component("m-fields-checkbox", _sfc_main$m);
4560
4531
  app.component("m-fields-switch", _sfc_main$6);
4561
- app.component("m-fields-color-picker", _sfc_main$m);
4562
- app.component("m-fields-checkbox-group", _sfc_main$n);
4563
- app.component("m-fields-radio-group", _sfc_main$a);
4564
- app.component("m-fields-display", _sfc_main$i);
4565
- app.component("m-fields-link", _sfc_main$d);
4532
+ app.component("m-fields-color-picker", _sfc_main$k);
4533
+ app.component("m-fields-checkbox-group", _sfc_main$l);
4534
+ app.component("m-fields-radio-group", _sfc_main$8);
4535
+ app.component("m-fields-display", _sfc_main$g);
4536
+ app.component("m-fields-link", _sfc_main$b);
4566
4537
  app.component("m-fields-select", _sfc_main$7);
4567
- app.component("m-fields-cascader", _sfc_main$p);
4568
- app.component("m-fields-dynamic-field", _sfc_main$h);
4538
+ app.component("m-fields-cascader", _sfc_main$n);
4539
+ app.component("m-fields-dynamic-field", _sfc_main$f);
4569
4540
  }
4570
4541
  };
4571
4542
 
4572
- export { _sfc_main$p as MCascader, _sfc_main$o as MCheckbox, _sfc_main$n as MCheckboxGroup, _sfc_main$m as MColorPicker, _sfc_main$z as MContainer, _sfc_main$l as MDate, _sfc_main$j as MDateTime, _sfc_main$k as MDaterange, _sfc_main$i as MDisplay, _sfc_main$h as MDynamicField, _sfc_main$y as MFieldset, _sfc_main$f as MForm, _sfc_main as MFormBox, _sfc_main$e as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$w as MGroupList, _sfc_main$g as MHidden, _sfc_main$d as MLink, _sfc_main$c as MNumber, _sfc_main$b as MNumberRange, _sfc_main$v as MPanel, _sfc_main$a as MRadioGroup, _sfc_main$t as MRow, _sfc_main$7 as MSelect, _sfc_main$6 as MSwitch, _sfc_main$r as MTable, _sfc_main$q as MTabs, _sfc_main$5 as MText, _sfc_main$4 as MTextarea, _sfc_main$3 as MTime, _sfc_main$2 as MTimerange, createForm, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };
4543
+ export { _sfc_main$n as MCascader, _sfc_main$m as MCheckbox, _sfc_main$l as MCheckboxGroup, _sfc_main$k as MColorPicker, _sfc_main$x as MContainer, _sfc_main$j as MDate, _sfc_main$h as MDateTime, _sfc_main$i as MDaterange, _sfc_main$g as MDisplay, _sfc_main$f as MDynamicField, _sfc_main$w as MFieldset, _sfc_main$d as MForm, _sfc_main as MFormBox, _sfc_main$c as MFormDialog, _sfc_main$1 as MFormDrawer, _sfc_main$u as MGroupList, _sfc_main$e as MHidden, _sfc_main$b as MLink, _sfc_main$a as MNumber, _sfc_main$9 as MNumberRange, _sfc_main$t as MPanel, _sfc_main$8 as MRadioGroup, _sfc_main$r as MRow, _sfc_main$7 as MSelect, _sfc_main$6 as MSwitch, _sfc_main$p as MTable, _sfc_main$o as MTabs, _sfc_main$5 as MText, _sfc_main$4 as MTextarea, _sfc_main$3 as MTime, _sfc_main$2 as MTimerange, createForm, createValues, index as default, display, filterFunction, getRules, initValue, useAddField };