@tmagic/form 1.7.0-beta.0 → 1.7.0-beta.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,4 +1,4 @@
1
- import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, createCommentVNode, mergeProps, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, readonly, withDirectives, vShow, renderSlot, getCurrentInstance, createSlots, reactive, onBeforeUnmount, vModelText, useTemplateRef, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, withModifiers, Teleport, h } from 'vue';
1
+ import { toRaw, defineComponent, inject, ref, computed, watchEffect, watch, resolveComponent, createElementBlock, openBlock, normalizeStyle, normalizeClass, createBlock, createCommentVNode, mergeProps, resolveDynamicComponent, Fragment, createVNode, unref, withCtx, createElementVNode, renderList, createTextVNode, toDisplayString, readonly, withDirectives, vShow, renderSlot, getCurrentInstance, createSlots, onUnmounted, reactive, onBeforeUnmount, vModelText, useTemplateRef, provide, shallowRef, onBeforeMount, nextTick, resolveDirective, withModifiers, Teleport, h } from 'vue';
2
2
  import { WarningFilled, CaretBottom, CaretRight, Delete, DocumentCopy, CaretTop, Position, Grid, ArrowUp, ArrowDown, FullScreen } from '@element-plus/icons-vue';
3
3
  import { cloneDeep, isEqual, isEmpty, debounce } from 'lodash-es';
4
4
  import { TMagicFormItem, TMagicTooltip, TMagicIcon, TMagicButton, TMagicCheckbox, TMagicPopover, TMagicInputNumber, TMagicCard, TMagicCol, TMagicRow, TMagicSteps, TMagicStep, getDesignConfig, TMagicBadge, TMagicCascader, TMagicCheckboxGroup, TMagicColorPicker, TMagicDatePicker, TMagicForm, TMagicInput, tMagicMessage, tMagicMessageBox, TMagicDialog, TMagicRadioButton, TMagicRadio, TMagicRadioGroup, TMagicSelect, TMagicSwitch, TMagicTimePicker, useZIndex, TMagicTable, TMagicUpload, TMagicPagination, TMagicDrawer, TMagicScrollbar } from '@tmagic/design';
@@ -272,10 +272,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
272
272
  const items = computed(() => props.config.items);
273
273
  const itemProp = computed(() => {
274
274
  let n = "";
275
- const { names } = props.config;
276
- if (names?.[0]) {
277
- [n] = names;
278
- } else if (name.value) {
275
+ if (name.value) {
279
276
  n = name.value;
280
277
  } else {
281
278
  return props.prop;
@@ -2382,7 +2379,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2382
2379
  const value = ref([]);
2383
2380
  if (props.model !== void 0) {
2384
2381
  if (names?.length) {
2385
- watch(
2382
+ const unWatch = watch(
2386
2383
  [() => props.model[names[0]], () => props.model[names[1]]],
2387
2384
  ([start, end], [preStart, preEnd]) => {
2388
2385
  if (!value.value) {
@@ -2397,8 +2394,11 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2397
2394
  immediate: true
2398
2395
  }
2399
2396
  );
2397
+ onUnmounted(() => {
2398
+ unWatch();
2399
+ });
2400
2400
  } else if (props.name && props.model[props.name]) {
2401
- watch(
2401
+ const unWatch = watch(
2402
2402
  () => props.model[props.name],
2403
2403
  (start, preStart) => {
2404
2404
  const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
@@ -2411,29 +2411,38 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2411
2411
  immediate: true
2412
2412
  }
2413
2413
  );
2414
+ onUnmounted(() => {
2415
+ unWatch();
2416
+ });
2414
2417
  }
2415
2418
  }
2416
- const setValue = (v) => {
2417
- names?.forEach((item, index) => {
2418
- if (!props.model) {
2419
- return;
2420
- }
2421
- if (Array.isArray(v)) {
2422
- props.model[item] = v[index];
2423
- } else {
2424
- props.model[item] = void 0;
2425
- }
2426
- });
2427
- };
2428
2419
  const changeHandler = (v) => {
2429
2420
  const value2 = v || [];
2430
2421
  if (props.name) {
2431
2422
  emit("change", value2);
2432
2423
  } else {
2433
- if (names?.length) {
2434
- setValue(value2);
2424
+ if (props.config.names?.length) {
2425
+ const newChangeRecords = [];
2426
+ props.config.names.forEach((item, index) => {
2427
+ if (!props.model) {
2428
+ return;
2429
+ }
2430
+ if (Array.isArray(v)) {
2431
+ newChangeRecords.push({
2432
+ propPath: props.prop ? `${props.prop}.${item}` : item,
2433
+ value: v[index]
2434
+ });
2435
+ } else {
2436
+ newChangeRecords.push({
2437
+ propPath: props.prop ? `${props.prop}.${item}` : item,
2438
+ value: void 0
2439
+ });
2440
+ }
2441
+ });
2442
+ emit("change", props.model, {
2443
+ changeRecords: newChangeRecords
2444
+ });
2435
2445
  }
2436
- emit("change", props.model);
2437
2446
  }
2438
2447
  };
2439
2448
  return (_ctx, _cache) => {
@@ -2447,11 +2456,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
2447
2456
  "unlink-panels": true,
2448
2457
  disabled: __props.disabled,
2449
2458
  "default-time": __props.config.defaultTime,
2459
+ format: `${__props.config.dateFormat || "YYYY/MM/DD"} ${__props.config.timeFormat || "HH:mm:ss"}`,
2450
2460
  "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
2451
2461
  "date-format": __props.config.dateFormat || "YYYY/MM/DD",
2452
2462
  "time-format": __props.config.timeFormat || "HH:mm:ss",
2453
2463
  "onUpdate:modelValue": changeHandler
2454
- }, null, 8, ["model-value", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
2464
+ }, null, 8, ["model-value", "size", "disabled", "default-time", "format", "value-format", "date-format", "time-format"]);
2455
2465
  };
2456
2466
  }
2457
2467
  });
@@ -2806,6 +2816,31 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2806
2816
  e.preventDefault();
2807
2817
  }
2808
2818
  };
2819
+ const getTextByName = (name, config = props.config) => {
2820
+ if (!name || !Array.isArray(config)) return void 0;
2821
+ const nameParts = name.split(".");
2822
+ const findInConfig = (configs, parts) => {
2823
+ if (parts.length === 0) return void 0;
2824
+ const [currentPart, ...remainingParts] = parts;
2825
+ for (const item of configs) {
2826
+ if (item.name === currentPart) {
2827
+ if (remainingParts.length === 0) {
2828
+ return typeof item.text === "string" ? item.text : void 0;
2829
+ }
2830
+ if (item.items && Array.isArray(item.items)) {
2831
+ const result = findInConfig(item.items, remainingParts);
2832
+ if (result !== void 0) return result;
2833
+ }
2834
+ }
2835
+ if (item.items && Array.isArray(item.items)) {
2836
+ const result = findInConfig(item.items, parts);
2837
+ if (result !== void 0) return result;
2838
+ }
2839
+ }
2840
+ return void 0;
2841
+ };
2842
+ return findInConfig(config, nameParts);
2843
+ };
2809
2844
  __expose({
2810
2845
  values,
2811
2846
  lastValuesProcessed,
@@ -2819,22 +2854,26 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2819
2854
  },
2820
2855
  submitForm: async (native) => {
2821
2856
  try {
2822
- await tMagicFormRef.value?.validate();
2857
+ const result = await tMagicFormRef.value?.validate();
2858
+ if (result !== true) {
2859
+ throw result;
2860
+ }
2823
2861
  changeRecords.value = [];
2824
2862
  return native ? values.value : cloneDeep(toRaw(values.value));
2825
2863
  } catch (invalidFields) {
2826
2864
  emit("error", invalidFields);
2827
2865
  const error = [];
2828
- Object.entries(invalidFields).forEach(([, ValidateError]) => {
2866
+ Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
2829
2867
  ValidateError.forEach(({ field, message }) => {
2830
- if (field && message) error.push(`${field} -> ${message}`);
2831
- if (field && !message) error.push(`${field} -> 出现错误`);
2832
- if (!field && message) error.push(`${message}`);
2868
+ const name = field || prop;
2869
+ const text = getTextByName(name, props.config) || name;
2870
+ error.push(`${text} -> ${message}`);
2833
2871
  });
2834
2872
  });
2835
2873
  throw new Error(error.join("<br>"));
2836
2874
  }
2837
- }
2875
+ },
2876
+ getTextByName
2838
2877
  });
2839
2878
  return (_ctx, _cache) => {
2840
2879
  return openBlock(), createBlock(unref(TMagicForm), {
@@ -2931,8 +2970,9 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2931
2970
  };
2932
2971
  const save = async () => {
2933
2972
  try {
2973
+ const changeRecords = form.value?.changeRecords;
2934
2974
  const values = await form.value?.submitForm();
2935
- emit("submit", values, { changeRecords: form.value?.changeRecords });
2975
+ emit("submit", values, { changeRecords });
2936
2976
  } catch (e) {
2937
2977
  emit("error", e);
2938
2978
  }
@@ -2997,6 +3037,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2997
3037
  default: withCtx(() => [
2998
3038
  renderSlot(_ctx.$slots, "footer", {}, () => [
2999
3039
  createVNode(unref(TMagicButton), {
3040
+ type: "default",
3000
3041
  onClick: cancel,
3001
3042
  size: "small"
3002
3043
  }, {
@@ -4250,9 +4291,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
4250
4291
  clearable: "",
4251
4292
  placeholder: __props.config.placeholder,
4252
4293
  disabled: __props.disabled,
4294
+ rows: __props.config.rows,
4253
4295
  "onUpdate:modelValue": changeHandler,
4254
4296
  onInput: inputHandler
4255
- }, null, 8, ["model-value", "size", "placeholder", "disabled"]);
4297
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "rows"]);
4256
4298
  };
4257
4299
  }
4258
4300
  });
@@ -5075,33 +5117,15 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5075
5117
  }, 8, ["disabled"]),
5076
5118
  renderSlot(_ctx.$slots, "default"),
5077
5119
  createElementVNode("div", _hoisted_3, [
5078
- unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
5079
- key: 0,
5080
- size: "small",
5081
- type: "primary",
5082
- disabled: __props.disabled,
5083
- plain: "",
5084
- onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
5085
- }, {
5086
- default: withCtx(() => [..._cache[1] || (_cache[1] = [
5087
- createTextVNode(
5088
- "新增一行",
5089
- -1
5090
- /* CACHED */
5091
- )
5092
- ])]),
5093
- _: 1
5094
- /* STABLE */
5095
- }, 8, ["disabled"])) : createCommentVNode("v-if", true),
5096
5120
  createElementVNode("div", _hoisted_4, [
5097
5121
  __props.enableToggleMode && __props.config.enableToggleMode !== false && !unref(isFullscreen) ? (openBlock(), createBlock(unref(TMagicButton), {
5098
5122
  key: 0,
5099
5123
  icon: unref(Grid),
5100
5124
  size: "small",
5101
- type: "primary",
5125
+ type: "defalut",
5102
5126
  onClick: toggleMode
5103
5127
  }, {
5104
- default: withCtx(() => [..._cache[2] || (_cache[2] = [
5128
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
5105
5129
  createTextVNode(
5106
5130
  "展开配置",
5107
5131
  -1
@@ -5115,7 +5139,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5115
5139
  key: 1,
5116
5140
  icon: unref(FullScreen),
5117
5141
  size: "small",
5118
- type: "primary",
5142
+ type: "defalut",
5119
5143
  onClick: unref(toggleFullscreen)
5120
5144
  }, {
5121
5145
  default: withCtx(() => [
@@ -5144,7 +5168,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5144
5168
  disabled: __props.disabled,
5145
5169
  plain: ""
5146
5170
  }, {
5147
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
5171
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
5148
5172
  createTextVNode(
5149
5173
  "导入EXCEL",
5150
5174
  -1
@@ -5166,7 +5190,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5166
5190
  plain: "",
5167
5191
  onClick: unref(clearHandler)
5168
5192
  }, {
5169
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
5193
+ default: withCtx(() => [..._cache[3] || (_cache[3] = [
5170
5194
  createTextVNode(
5171
5195
  "清空",
5172
5196
  -1
@@ -5176,7 +5200,25 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
5176
5200
  _: 1
5177
5201
  /* STABLE */
5178
5202
  }, 8, ["disabled", "onClick"])) : createCommentVNode("v-if", true)
5179
- ])
5203
+ ]),
5204
+ unref(addable) ? (openBlock(), createBlock(unref(TMagicButton), {
5205
+ key: 0,
5206
+ size: "small",
5207
+ type: "primary",
5208
+ disabled: __props.disabled,
5209
+ plain: "",
5210
+ onClick: _cache[0] || (_cache[0] = ($event) => unref(newHandler)())
5211
+ }, {
5212
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
5213
+ createTextVNode(
5214
+ "新增一行",
5215
+ -1
5216
+ /* CACHED */
5217
+ )
5218
+ ])]),
5219
+ _: 1
5220
+ /* STABLE */
5221
+ }, 8, ["disabled"])) : createCommentVNode("v-if", true)
5180
5222
  ]),
5181
5223
  __props.config.pagination ? (openBlock(), createElementBlock("div", _hoisted_5, [
5182
5224
  createVNode(unref(TMagicPagination), {
@@ -5239,8 +5281,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5239
5281
  });
5240
5282
  const submitHandler = async () => {
5241
5283
  try {
5284
+ const changeRecords = form.value?.changeRecords;
5242
5285
  const values = await form.value?.submitForm();
5243
- emit("submit", values, { changeRecords: form.value?.changeRecords });
5286
+ emit("submit", values, { changeRecords });
5244
5287
  } catch (e) {
5245
5288
  emit("error", e);
5246
5289
  }
@@ -5315,7 +5358,10 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
5315
5358
  createVNode(unref(TMagicCol), { span: 12 }, {
5316
5359
  default: withCtx(() => [
5317
5360
  renderSlot(_ctx.$slots, "footer", {}, () => [
5318
- createVNode(unref(TMagicButton), { onClick: handleClose }, {
5361
+ createVNode(unref(TMagicButton), {
5362
+ type: "default",
5363
+ onClick: handleClose
5364
+ }, {
5319
5365
  default: withCtx(() => [..._cache[1] || (_cache[1] = [
5320
5366
  createTextVNode(
5321
5367
  "关闭",
@@ -5434,8 +5480,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
5434
5480
  });
5435
5481
  const submitHandler = async () => {
5436
5482
  try {
5483
+ const changeRecords = form.value?.changeRecords;
5437
5484
  const values = await form.value?.submitForm();
5438
- emit("submit", values, { changeRecords: form.value?.changeRecords });
5485
+ emit("submit", values, { changeRecords });
5439
5486
  } catch (e) {
5440
5487
  emit("error", e);
5441
5488
  }
@@ -3202,10 +3202,7 @@
3202
3202
  const items = vue.computed(() => props.config.items);
3203
3203
  const itemProp = vue.computed(() => {
3204
3204
  let n = "";
3205
- const { names } = props.config;
3206
- if (names?.[0]) {
3207
- [n] = names;
3208
- } else if (name.value) {
3205
+ if (name.value) {
3209
3206
  n = name.value;
3210
3207
  } else {
3211
3208
  return props.prop;
@@ -5312,7 +5309,7 @@
5312
5309
  const value = vue.ref([]);
5313
5310
  if (props.model !== void 0) {
5314
5311
  if (names?.length) {
5315
- vue.watch(
5312
+ const unWatch = vue.watch(
5316
5313
  [() => props.model[names[0]], () => props.model[names[1]]],
5317
5314
  ([start, end], [preStart, preEnd]) => {
5318
5315
  if (!value.value) {
@@ -5327,8 +5324,11 @@
5327
5324
  immediate: true
5328
5325
  }
5329
5326
  );
5327
+ vue.onUnmounted(() => {
5328
+ unWatch();
5329
+ });
5330
5330
  } else if (props.name && props.model[props.name]) {
5331
- vue.watch(
5331
+ const unWatch = vue.watch(
5332
5332
  () => props.model[props.name],
5333
5333
  (start, preStart) => {
5334
5334
  const format = `${props.config.dateFormat || "YYYY/MM/DD"} ${props.config.timeFormat || "HH:mm:ss"}`;
@@ -5341,29 +5341,38 @@
5341
5341
  immediate: true
5342
5342
  }
5343
5343
  );
5344
+ vue.onUnmounted(() => {
5345
+ unWatch();
5346
+ });
5344
5347
  }
5345
5348
  }
5346
- const setValue = (v) => {
5347
- names?.forEach((item, index) => {
5348
- if (!props.model) {
5349
- return;
5350
- }
5351
- if (Array.isArray(v)) {
5352
- props.model[item] = v[index];
5353
- } else {
5354
- props.model[item] = void 0;
5355
- }
5356
- });
5357
- };
5358
5349
  const changeHandler = (v) => {
5359
5350
  const value2 = v || [];
5360
5351
  if (props.name) {
5361
5352
  emit("change", value2);
5362
5353
  } else {
5363
- if (names?.length) {
5364
- setValue(value2);
5354
+ if (props.config.names?.length) {
5355
+ const newChangeRecords = [];
5356
+ props.config.names.forEach((item, index) => {
5357
+ if (!props.model) {
5358
+ return;
5359
+ }
5360
+ if (Array.isArray(v)) {
5361
+ newChangeRecords.push({
5362
+ propPath: props.prop ? `${props.prop}.${item}` : item,
5363
+ value: v[index]
5364
+ });
5365
+ } else {
5366
+ newChangeRecords.push({
5367
+ propPath: props.prop ? `${props.prop}.${item}` : item,
5368
+ value: void 0
5369
+ });
5370
+ }
5371
+ });
5372
+ emit("change", props.model, {
5373
+ changeRecords: newChangeRecords
5374
+ });
5365
5375
  }
5366
- emit("change", props.model);
5367
5376
  }
5368
5377
  };
5369
5378
  return (_ctx, _cache) => {
@@ -5377,11 +5386,12 @@
5377
5386
  "unlink-panels": true,
5378
5387
  disabled: __props.disabled,
5379
5388
  "default-time": __props.config.defaultTime,
5389
+ format: `${__props.config.dateFormat || "YYYY/MM/DD"} ${__props.config.timeFormat || "HH:mm:ss"}`,
5380
5390
  "value-format": __props.config.valueFormat || "YYYY/MM/DD HH:mm:ss",
5381
5391
  "date-format": __props.config.dateFormat || "YYYY/MM/DD",
5382
5392
  "time-format": __props.config.timeFormat || "HH:mm:ss",
5383
5393
  "onUpdate:modelValue": changeHandler
5384
- }, null, 8, ["model-value", "size", "disabled", "default-time", "value-format", "date-format", "time-format"]);
5394
+ }, null, 8, ["model-value", "size", "disabled", "default-time", "format", "value-format", "date-format", "time-format"]);
5385
5395
  };
5386
5396
  }
5387
5397
  });
@@ -5736,6 +5746,31 @@
5736
5746
  e.preventDefault();
5737
5747
  }
5738
5748
  };
5749
+ const getTextByName = (name, config = props.config) => {
5750
+ if (!name || !Array.isArray(config)) return void 0;
5751
+ const nameParts = name.split(".");
5752
+ const findInConfig = (configs, parts) => {
5753
+ if (parts.length === 0) return void 0;
5754
+ const [currentPart, ...remainingParts] = parts;
5755
+ for (const item of configs) {
5756
+ if (item.name === currentPart) {
5757
+ if (remainingParts.length === 0) {
5758
+ return typeof item.text === "string" ? item.text : void 0;
5759
+ }
5760
+ if (item.items && Array.isArray(item.items)) {
5761
+ const result = findInConfig(item.items, remainingParts);
5762
+ if (result !== void 0) return result;
5763
+ }
5764
+ }
5765
+ if (item.items && Array.isArray(item.items)) {
5766
+ const result = findInConfig(item.items, parts);
5767
+ if (result !== void 0) return result;
5768
+ }
5769
+ }
5770
+ return void 0;
5771
+ };
5772
+ return findInConfig(config, nameParts);
5773
+ };
5739
5774
  __expose({
5740
5775
  values,
5741
5776
  lastValuesProcessed,
@@ -5749,22 +5784,26 @@
5749
5784
  },
5750
5785
  submitForm: async (native) => {
5751
5786
  try {
5752
- await tMagicFormRef.value?.validate();
5787
+ const result = await tMagicFormRef.value?.validate();
5788
+ if (result !== true) {
5789
+ throw result;
5790
+ }
5753
5791
  changeRecords.value = [];
5754
5792
  return native ? values.value : cloneDeep(vue.toRaw(values.value));
5755
5793
  } catch (invalidFields) {
5756
5794
  emit("error", invalidFields);
5757
5795
  const error = [];
5758
- Object.entries(invalidFields).forEach(([, ValidateError]) => {
5796
+ Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
5759
5797
  ValidateError.forEach(({ field, message }) => {
5760
- if (field && message) error.push(`${field} -> ${message}`);
5761
- if (field && !message) error.push(`${field} -> 出现错误`);
5762
- if (!field && message) error.push(`${message}`);
5798
+ const name = field || prop;
5799
+ const text = getTextByName(name, props.config) || name;
5800
+ error.push(`${text} -> ${message}`);
5763
5801
  });
5764
5802
  });
5765
5803
  throw new Error(error.join("<br>"));
5766
5804
  }
5767
- }
5805
+ },
5806
+ getTextByName
5768
5807
  });
5769
5808
  return (_ctx, _cache) => {
5770
5809
  return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicForm), {
@@ -5861,8 +5900,9 @@
5861
5900
  };
5862
5901
  const save = async () => {
5863
5902
  try {
5903
+ const changeRecords = form.value?.changeRecords;
5864
5904
  const values = await form.value?.submitForm();
5865
- emit("submit", values, { changeRecords: form.value?.changeRecords });
5905
+ emit("submit", values, { changeRecords });
5866
5906
  } catch (e) {
5867
5907
  emit("error", e);
5868
5908
  }
@@ -5927,6 +5967,7 @@
5927
5967
  default: vue.withCtx(() => [
5928
5968
  vue.renderSlot(_ctx.$slots, "footer", {}, () => [
5929
5969
  vue.createVNode(vue.unref(design.TMagicButton), {
5970
+ type: "default",
5930
5971
  onClick: cancel,
5931
5972
  size: "small"
5932
5973
  }, {
@@ -7180,9 +7221,10 @@
7180
7221
  clearable: "",
7181
7222
  placeholder: __props.config.placeholder,
7182
7223
  disabled: __props.disabled,
7224
+ rows: __props.config.rows,
7183
7225
  "onUpdate:modelValue": changeHandler,
7184
7226
  onInput: inputHandler
7185
- }, null, 8, ["model-value", "size", "placeholder", "disabled"]);
7227
+ }, null, 8, ["model-value", "size", "placeholder", "disabled", "rows"]);
7186
7228
  };
7187
7229
  }
7188
7230
  });
@@ -8005,33 +8047,15 @@
8005
8047
  }, 8, ["disabled"]),
8006
8048
  vue.renderSlot(_ctx.$slots, "default"),
8007
8049
  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
8050
  vue.createElementVNode("div", _hoisted_4, [
8027
8051
  __props.enableToggleMode && __props.config.enableToggleMode !== false && !vue.unref(isFullscreen) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8028
8052
  key: 0,
8029
8053
  icon: vue.unref(iconsVue.Grid),
8030
8054
  size: "small",
8031
- type: "primary",
8055
+ type: "defalut",
8032
8056
  onClick: toggleMode
8033
8057
  }, {
8034
- default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
8058
+ default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
8035
8059
  vue.createTextVNode(
8036
8060
  "展开配置",
8037
8061
  -1
@@ -8045,7 +8069,7 @@
8045
8069
  key: 1,
8046
8070
  icon: vue.unref(iconsVue.FullScreen),
8047
8071
  size: "small",
8048
- type: "primary",
8072
+ type: "defalut",
8049
8073
  onClick: vue.unref(toggleFullscreen)
8050
8074
  }, {
8051
8075
  default: vue.withCtx(() => [
@@ -8074,7 +8098,7 @@
8074
8098
  disabled: __props.disabled,
8075
8099
  plain: ""
8076
8100
  }, {
8077
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
8101
+ default: vue.withCtx(() => [..._cache[2] || (_cache[2] = [
8078
8102
  vue.createTextVNode(
8079
8103
  "导入EXCEL",
8080
8104
  -1
@@ -8096,7 +8120,7 @@
8096
8120
  plain: "",
8097
8121
  onClick: vue.unref(clearHandler)
8098
8122
  }, {
8099
- default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
8123
+ default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
8100
8124
  vue.createTextVNode(
8101
8125
  "清空",
8102
8126
  -1
@@ -8106,7 +8130,25 @@
8106
8130
  _: 1
8107
8131
  /* STABLE */
8108
8132
  }, 8, ["disabled", "onClick"])) : vue.createCommentVNode("v-if", true)
8109
- ])
8133
+ ]),
8134
+ vue.unref(addable) ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
8135
+ key: 0,
8136
+ size: "small",
8137
+ type: "primary",
8138
+ disabled: __props.disabled,
8139
+ plain: "",
8140
+ onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(newHandler)())
8141
+ }, {
8142
+ default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
8143
+ vue.createTextVNode(
8144
+ "新增一行",
8145
+ -1
8146
+ /* CACHED */
8147
+ )
8148
+ ])]),
8149
+ _: 1
8150
+ /* STABLE */
8151
+ }, 8, ["disabled"])) : vue.createCommentVNode("v-if", true)
8110
8152
  ]),
8111
8153
  __props.config.pagination ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
8112
8154
  vue.createVNode(vue.unref(design.TMagicPagination), {
@@ -8169,8 +8211,9 @@
8169
8211
  });
8170
8212
  const submitHandler = async () => {
8171
8213
  try {
8214
+ const changeRecords = form.value?.changeRecords;
8172
8215
  const values = await form.value?.submitForm();
8173
- emit("submit", values, { changeRecords: form.value?.changeRecords });
8216
+ emit("submit", values, { changeRecords });
8174
8217
  } catch (e) {
8175
8218
  emit("error", e);
8176
8219
  }
@@ -8245,7 +8288,10 @@
8245
8288
  vue.createVNode(vue.unref(design.TMagicCol), { span: 12 }, {
8246
8289
  default: vue.withCtx(() => [
8247
8290
  vue.renderSlot(_ctx.$slots, "footer", {}, () => [
8248
- vue.createVNode(vue.unref(design.TMagicButton), { onClick: handleClose }, {
8291
+ vue.createVNode(vue.unref(design.TMagicButton), {
8292
+ type: "default",
8293
+ onClick: handleClose
8294
+ }, {
8249
8295
  default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
8250
8296
  vue.createTextVNode(
8251
8297
  "关闭",
@@ -8364,8 +8410,9 @@
8364
8410
  });
8365
8411
  const submitHandler = async () => {
8366
8412
  try {
8413
+ const changeRecords = form.value?.changeRecords;
8367
8414
  const values = await form.value?.submitForm();
8368
- emit("submit", values, { changeRecords: form.value?.changeRecords });
8415
+ emit("submit", values, { changeRecords });
8369
8416
  } catch (e) {
8370
8417
  emit("error", e);
8371
8418
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.7.0-beta.0",
2
+ "version": "1.7.0-beta.2",
3
3
  "name": "@tmagic/form",
4
4
  "type": "module",
5
5
  "sideEffects": [
@@ -51,9 +51,9 @@
51
51
  "peerDependencies": {
52
52
  "vue": "^3.5.22",
53
53
  "typescript": "^5.9.3",
54
- "@tmagic/design": "1.7.0-beta.0",
55
- "@tmagic/form-schema": "1.7.0-beta.0",
56
- "@tmagic/utils": "1.7.0-beta.0"
54
+ "@tmagic/utils": "1.7.0-beta.2",
55
+ "@tmagic/design": "1.7.0-beta.2",
56
+ "@tmagic/form-schema": "1.7.0-beta.2"
57
57
  },
58
58
  "peerDependenciesMeta": {
59
59
  "typescript": {
package/src/Form.vue CHANGED
@@ -196,6 +196,46 @@ const submitHandler = (e: SubmitEvent) => {
196
196
  }
197
197
  };
198
198
 
199
+ /**
200
+ * 通过 name 从 config 中查找对应的 text
201
+ * @param name - 字段名,支持点分隔的路径格式,如 'a.b.c'
202
+ * @param config - 表单配置数组
203
+ * @returns 找到的 text 值,如果未找到则返回 undefined
204
+ */
205
+ const getTextByName = (name: string, config: FormConfig = props.config): string | undefined => {
206
+ if (!name || !Array.isArray(config)) return undefined;
207
+
208
+ const nameParts = name.split('.');
209
+
210
+ const findInConfig = (configs: FormConfig, parts: string[]): string | undefined => {
211
+ if (parts.length === 0) return undefined;
212
+
213
+ const [currentPart, ...remainingParts] = parts;
214
+
215
+ for (const item of configs) {
216
+ if (item.name === currentPart) {
217
+ if (remainingParts.length === 0) {
218
+ return typeof item.text === 'string' ? item.text : undefined;
219
+ }
220
+
221
+ if (item.items && Array.isArray(item.items)) {
222
+ const result = findInConfig(item.items, remainingParts);
223
+ if (result !== undefined) return result;
224
+ }
225
+ }
226
+
227
+ if (item.items && Array.isArray(item.items)) {
228
+ const result = findInConfig(item.items, parts);
229
+ if (result !== undefined) return result;
230
+ }
231
+ }
232
+
233
+ return undefined;
234
+ };
235
+
236
+ return findInConfig(config, nameParts);
237
+ };
238
+
199
239
  defineExpose({
200
240
  values,
201
241
  lastValuesProcessed,
@@ -212,7 +252,12 @@ defineExpose({
212
252
 
213
253
  submitForm: async (native?: boolean): Promise<any> => {
214
254
  try {
215
- await tMagicFormRef.value?.validate();
255
+ const result = await tMagicFormRef.value?.validate();
256
+ // tdesign 错误通过返回值返回
257
+ // element-plus 通过throw error
258
+ if (result !== true) {
259
+ throw result;
260
+ }
216
261
  changeRecords.value = [];
217
262
  return native ? values.value : cloneDeep(toRaw(values.value));
218
263
  } catch (invalidFields: any) {
@@ -220,16 +265,19 @@ defineExpose({
220
265
 
221
266
  const error: string[] = [];
222
267
 
223
- Object.entries(invalidFields).forEach(([, ValidateError]) => {
268
+ Object.entries(invalidFields).forEach(([prop, ValidateError]) => {
224
269
  (ValidateError as ValidateError[]).forEach(({ field, message }) => {
225
- if (field && message) error.push(`${field} -> ${message}`);
226
- if (field && !message) error.push(`${field} -> 出现错误`);
227
- if (!field && message) error.push(`${message}`);
270
+ const name = field || prop;
271
+ const text = getTextByName(name, props.config) || name;
272
+
273
+ error.push(`${text} -> ${message}`);
228
274
  });
229
275
  });
230
276
 
231
277
  throw new Error(error.join('<br>'));
232
278
  }
233
279
  },
280
+
281
+ getTextByName,
234
282
  });
235
283
  </script>
package/src/FormBox.vue CHANGED
@@ -101,8 +101,9 @@ watchEffect(() => {
101
101
 
102
102
  const submitHandler = async () => {
103
103
  try {
104
+ const changeRecords = form.value?.changeRecords;
104
105
  const values = await form.value?.submitForm();
105
- emit('submit', values, { changeRecords: form.value?.changeRecords });
106
+ emit('submit', values, { changeRecords });
106
107
  } catch (e) {
107
108
  emit('error', e);
108
109
  }
@@ -42,7 +42,7 @@
42
42
  </TMagicCol>
43
43
  <TMagicCol :span="12">
44
44
  <slot name="footer">
45
- <TMagicButton @click="cancel" size="small">取 消</TMagicButton>
45
+ <TMagicButton type="default" @click="cancel" size="small">取 消</TMagicButton>
46
46
  <TMagicButton v-if="hasStep && stepActive > 1" type="info" size="small" @click="preStep"
47
47
  >上一步</TMagicButton
48
48
  >
@@ -131,8 +131,9 @@ const closeHandler = () => {
131
131
 
132
132
  const save = async () => {
133
133
  try {
134
+ const changeRecords = form.value?.changeRecords;
134
135
  const values = await form.value?.submitForm();
135
- emit('submit', values, { changeRecords: form.value?.changeRecords });
136
+ emit('submit', values, { changeRecords });
136
137
  } catch (e) {
137
138
  emit('error', e);
138
139
  }
@@ -42,7 +42,7 @@
42
42
  </TMagicCol>
43
43
  <TMagicCol :span="12">
44
44
  <slot name="footer">
45
- <TMagicButton @click="handleClose">关闭</TMagicButton>
45
+ <TMagicButton type="default" @click="handleClose">关闭</TMagicButton>
46
46
  <TMagicButton type="primary" :disabled="disabled" :loading="saveFetch" @click="submitHandler">{{
47
47
  confirmText
48
48
  }}</TMagicButton>
@@ -109,8 +109,9 @@ watchEffect(() => {
109
109
 
110
110
  const submitHandler = async () => {
111
111
  try {
112
+ const changeRecords = form.value?.changeRecords;
112
113
  const values = await form.value?.submitForm();
113
- emit('submit', values, { changeRecords: form.value?.changeRecords });
114
+ emit('submit', values, { changeRecords });
114
115
  } catch (e) {
115
116
  emit('error', e);
116
117
  }
@@ -208,10 +208,7 @@ const items = computed(() => (props.config as ContainerCommonConfig).items);
208
208
 
209
209
  const itemProp = computed(() => {
210
210
  let n: string | number = '';
211
- const { names } = props.config as any;
212
- if (names?.[0]) {
213
- [n] = names;
214
- } else if (name.value) {
211
+ if (name.value) {
215
212
  n = name.value;
216
213
  } else {
217
214
  return props.prop;
@@ -9,6 +9,7 @@
9
9
  :unlink-panels="true"
10
10
  :disabled="disabled"
11
11
  :default-time="config.defaultTime"
12
+ :format="`${config.dateFormat || 'YYYY/MM/DD'} ${config.timeFormat || 'HH:mm:ss'}`"
12
13
  :value-format="config.valueFormat || 'YYYY/MM/DD HH:mm:ss'"
13
14
  :date-format="config.dateFormat || 'YYYY/MM/DD'"
14
15
  :time-format="config.timeFormat || 'HH:mm:ss'"
@@ -17,11 +18,11 @@
17
18
  </template>
18
19
 
19
20
  <script lang="ts" setup>
20
- import { ref, watch } from 'vue';
21
+ import { onUnmounted, ref, watch } from 'vue';
21
22
 
22
23
  import { TMagicDatePicker } from '@tmagic/design';
23
24
 
24
- import type { DaterangeConfig, FieldProps } from '../schema';
25
+ import type { ChangeRecord, DaterangeConfig, FieldProps } from '../schema';
25
26
  import { datetimeFormatter } from '../utils/form';
26
27
  import { useAddField } from '../utils/useAddField';
27
28
 
@@ -40,7 +41,7 @@ const value = ref<(Date | string | undefined)[] | null>([]);
40
41
 
41
42
  if (props.model !== undefined) {
42
43
  if (names?.length) {
43
- watch(
44
+ const unWatch = watch(
44
45
  [() => props.model[names[0]], () => props.model[names[1]]],
45
46
  ([start, end], [preStart, preEnd]) => {
46
47
  if (!value.value) {
@@ -56,8 +57,12 @@ if (props.model !== undefined) {
56
57
  immediate: true,
57
58
  },
58
59
  );
60
+
61
+ onUnmounted(() => {
62
+ unWatch();
63
+ });
59
64
  } else if (props.name && props.model[props.name]) {
60
- watch(
65
+ const unWatch = watch(
61
66
  () => props.model[props.name],
62
67
  (start, preStart) => {
63
68
  const format = `${props.config.dateFormat || 'YYYY/MM/DD'} ${props.config.timeFormat || 'HH:mm:ss'}`;
@@ -71,32 +76,41 @@ if (props.model !== undefined) {
71
76
  immediate: true,
72
77
  },
73
78
  );
79
+ onUnmounted(() => {
80
+ unWatch();
81
+ });
74
82
  }
75
83
  }
76
84
 
77
- const setValue = (v: Date[] | Date) => {
78
- names?.forEach((item, index) => {
79
- if (!props.model) {
80
- return;
81
- }
82
- if (Array.isArray(v)) {
83
- props.model[item] = v[index];
84
- } else {
85
- props.model[item] = undefined;
86
- }
87
- });
88
- };
89
-
90
85
  const changeHandler = (v: Date[]) => {
91
86
  const value = v || [];
92
87
 
93
88
  if (props.name) {
94
89
  emit('change', value);
95
90
  } else {
96
- if (names?.length) {
97
- setValue(value);
91
+ if (props.config.names?.length) {
92
+ const newChangeRecords: ChangeRecord[] = [];
93
+ props.config.names.forEach((item, index) => {
94
+ if (!props.model) {
95
+ return;
96
+ }
97
+ if (Array.isArray(v)) {
98
+ newChangeRecords.push({
99
+ propPath: props.prop ? `${props.prop}.${item}` : item,
100
+ value: v[index],
101
+ });
102
+ } else {
103
+ newChangeRecords.push({
104
+ propPath: props.prop ? `${props.prop}.${item}` : item,
105
+ value: undefined,
106
+ });
107
+ }
108
+ });
109
+
110
+ emit('change', props.model, {
111
+ changeRecords: newChangeRecords,
112
+ });
98
113
  }
99
- emit('change', props.model);
100
114
  }
101
115
  };
102
116
  </script>
@@ -6,6 +6,7 @@
6
6
  clearable
7
7
  :placeholder="config.placeholder"
8
8
  :disabled="disabled"
9
+ :rows="config.rows"
9
10
  @update:model-value="changeHandler"
10
11
  @input="inputHandler"
11
12
  >
@@ -24,15 +24,11 @@
24
24
  <slot></slot>
25
25
 
26
26
  <div style="display: flex; justify-content: space-between; margin: 10px 0">
27
- <TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
28
- >新增一行</TMagicButton
29
- >
30
-
31
27
  <div style="display: flex">
32
28
  <TMagicButton
33
29
  :icon="Grid"
34
30
  size="small"
35
- type="primary"
31
+ type="defalut"
36
32
  @click="toggleMode"
37
33
  v-if="enableToggleMode && config.enableToggleMode !== false && !isFullscreen"
38
34
  >展开配置</TMagicButton
@@ -40,7 +36,7 @@
40
36
  <TMagicButton
41
37
  :icon="FullScreen"
42
38
  size="small"
43
- type="primary"
39
+ type="defalut"
44
40
  @click="toggleFullscreen"
45
41
  v-if="config.enableFullscreen !== false"
46
42
  >
@@ -61,6 +57,9 @@
61
57
  >清空</TMagicButton
62
58
  >
63
59
  </div>
60
+ <TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
61
+ >新增一行</TMagicButton
62
+ >
64
63
  </div>
65
64
 
66
65
  <div class="bottom" style="text-align: right" v-if="config.pagination">
package/types/index.d.ts CHANGED
@@ -65,15 +65,16 @@ declare const __VLS_export$v: _vue_runtime_core.DefineComponent<__VLS_Props$u, {
65
65
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
66
66
  resetForm: () => void;
67
67
  submitForm: (native?: boolean) => Promise<any>;
68
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
68
69
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
69
- change: (...args: any[]) => void;
70
70
  error: (...args: any[]) => void;
71
+ change: (...args: any[]) => void;
71
72
  "update:stepActive": (...args: any[]) => void;
72
73
  "field-change": (...args: any[]) => void;
73
74
  "field-input": (...args: any[]) => void;
74
75
  }, string, _vue_runtime_core.PublicProps, Readonly<__VLS_Props$u> & Readonly<{
75
- onChange?: ((...args: any[]) => any) | undefined;
76
76
  onError?: ((...args: any[]) => any) | undefined;
77
+ onChange?: ((...args: any[]) => any) | undefined;
77
78
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
78
79
  "onField-change"?: ((...args: any[]) => any) | undefined;
79
80
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -138,8 +139,8 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
138
139
  preventSubmitDefault?: boolean;
139
140
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
140
141
  }> & Readonly<{
141
- onChange?: ((...args: any[]) => any) | undefined;
142
142
  onError?: ((...args: any[]) => any) | undefined;
143
+ onChange?: ((...args: any[]) => any) | undefined;
143
144
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
144
145
  "onField-change"?: ((...args: any[]) => any) | undefined;
145
146
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -152,9 +153,10 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
152
153
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
153
154
  resetForm: () => void;
154
155
  submitForm: (native?: boolean) => Promise<any>;
156
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
155
157
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
156
- change: (...args: any[]) => void;
157
158
  error: (...args: any[]) => void;
159
+ change: (...args: any[]) => void;
158
160
  "update:stepActive": (...args: any[]) => void;
159
161
  "field-change": (...args: any[]) => void;
160
162
  "field-input": (...args: any[]) => void;
@@ -196,8 +198,8 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
196
198
  preventSubmitDefault?: boolean;
197
199
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
198
200
  }> & Readonly<{
199
- onChange?: ((...args: any[]) => any) | undefined;
200
201
  onError?: ((...args: any[]) => any) | undefined;
202
+ onChange?: ((...args: any[]) => any) | undefined;
201
203
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
202
204
  "onField-change"?: ((...args: any[]) => any) | undefined;
203
205
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -210,6 +212,7 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
210
212
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
211
213
  resetForm: () => void;
212
214
  submitForm: (native?: boolean) => Promise<any>;
215
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
213
216
  }, {}, {}, {}, {
214
217
  disabled: boolean;
215
218
  labelWidth: string;
@@ -241,8 +244,8 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
241
244
  preventSubmitDefault?: boolean;
242
245
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
243
246
  }> & Readonly<{
244
- onChange?: ((...args: any[]) => any) | undefined;
245
247
  onError?: ((...args: any[]) => any) | undefined;
248
+ onChange?: ((...args: any[]) => any) | undefined;
246
249
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
247
250
  "onField-change"?: ((...args: any[]) => any) | undefined;
248
251
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -255,9 +258,10 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
255
258
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
256
259
  resetForm: () => void;
257
260
  submitForm: (native?: boolean) => Promise<any>;
261
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
258
262
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
259
- change: (...args: any[]) => void;
260
263
  error: (...args: any[]) => void;
264
+ change: (...args: any[]) => void;
261
265
  "update:stepActive": (...args: any[]) => void;
262
266
  "field-change": (...args: any[]) => void;
263
267
  "field-input": (...args: any[]) => void;
@@ -299,8 +303,8 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
299
303
  preventSubmitDefault?: boolean;
300
304
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
301
305
  }> & Readonly<{
302
- onChange?: ((...args: any[]) => any) | undefined;
303
306
  onError?: ((...args: any[]) => any) | undefined;
307
+ onChange?: ((...args: any[]) => any) | undefined;
304
308
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
305
309
  "onField-change"?: ((...args: any[]) => any) | undefined;
306
310
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -313,6 +317,7 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
313
317
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
314
318
  resetForm: () => void;
315
319
  submitForm: (native?: boolean) => Promise<any>;
320
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
316
321
  }, {}, {}, {}, {
317
322
  disabled: boolean;
318
323
  labelWidth: string;
@@ -334,14 +339,14 @@ declare const __VLS_base$4: _vue_runtime_core.DefineComponent<__VLS_Props$t, {
334
339
  show: () => void;
335
340
  hide: () => void;
336
341
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
342
+ error: (...args: any[]) => void;
337
343
  change: (...args: any[]) => void;
338
344
  close: (...args: any[]) => void;
339
- error: (...args: any[]) => void;
340
345
  submit: (...args: any[]) => void;
341
346
  }, string, _vue_runtime_core.PublicProps, Readonly<__VLS_Props$t> & Readonly<{
347
+ onError?: ((...args: any[]) => any) | undefined;
342
348
  onChange?: ((...args: any[]) => any) | undefined;
343
349
  onClose?: ((...args: any[]) => any) | undefined;
344
- onError?: ((...args: any[]) => any) | undefined;
345
350
  onSubmit?: ((...args: any[]) => any) | undefined;
346
351
  }>, {
347
352
  values: Object;
@@ -404,8 +409,8 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
404
409
  preventSubmitDefault?: boolean;
405
410
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
406
411
  }> & Readonly<{
407
- onChange?: ((...args: any[]) => any) | undefined;
408
412
  onError?: ((...args: any[]) => any) | undefined;
413
+ onChange?: ((...args: any[]) => any) | undefined;
409
414
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
410
415
  "onField-change"?: ((...args: any[]) => any) | undefined;
411
416
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -418,9 +423,10 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
418
423
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
419
424
  resetForm: () => void;
420
425
  submitForm: (native?: boolean) => Promise<any>;
426
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
421
427
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
422
- change: (...args: any[]) => void;
423
428
  error: (...args: any[]) => void;
429
+ change: (...args: any[]) => void;
424
430
  "update:stepActive": (...args: any[]) => void;
425
431
  "field-change": (...args: any[]) => void;
426
432
  "field-input": (...args: any[]) => void;
@@ -462,8 +468,8 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
462
468
  preventSubmitDefault?: boolean;
463
469
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
464
470
  }> & Readonly<{
465
- onChange?: ((...args: any[]) => any) | undefined;
466
471
  onError?: ((...args: any[]) => any) | undefined;
472
+ onChange?: ((...args: any[]) => any) | undefined;
467
473
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
468
474
  "onField-change"?: ((...args: any[]) => any) | undefined;
469
475
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -476,6 +482,7 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
476
482
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
477
483
  resetForm: () => void;
478
484
  submitForm: (native?: boolean) => Promise<any>;
485
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
479
486
  }, {}, {}, {}, {
480
487
  disabled: boolean;
481
488
  labelWidth: string;
@@ -507,8 +514,8 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
507
514
  preventSubmitDefault?: boolean;
508
515
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
509
516
  }> & Readonly<{
510
- onChange?: ((...args: any[]) => any) | undefined;
511
517
  onError?: ((...args: any[]) => any) | undefined;
518
+ onChange?: ((...args: any[]) => any) | undefined;
512
519
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
513
520
  "onField-change"?: ((...args: any[]) => any) | undefined;
514
521
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -521,9 +528,10 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
521
528
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
522
529
  resetForm: () => void;
523
530
  submitForm: (native?: boolean) => Promise<any>;
531
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
524
532
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
525
- change: (...args: any[]) => void;
526
533
  error: (...args: any[]) => void;
534
+ change: (...args: any[]) => void;
527
535
  "update:stepActive": (...args: any[]) => void;
528
536
  "field-change": (...args: any[]) => void;
529
537
  "field-input": (...args: any[]) => void;
@@ -565,8 +573,8 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
565
573
  preventSubmitDefault?: boolean;
566
574
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
567
575
  }> & Readonly<{
568
- onChange?: ((...args: any[]) => any) | undefined;
569
576
  onError?: ((...args: any[]) => any) | undefined;
577
+ onChange?: ((...args: any[]) => any) | undefined;
570
578
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
571
579
  "onField-change"?: ((...args: any[]) => any) | undefined;
572
580
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -579,6 +587,7 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
579
587
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
580
588
  resetForm: () => void;
581
589
  submitForm: (native?: boolean) => Promise<any>;
590
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
582
591
  }, {}, {}, {}, {
583
592
  disabled: boolean;
584
593
  labelWidth: string;
@@ -599,17 +608,17 @@ declare const __VLS_base$3: _vue_runtime_core.DefineComponent<__VLS_Props$s, {
599
608
  hide: () => void;
600
609
  handleClose: () => void;
601
610
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
611
+ error: (...args: any[]) => void;
602
612
  change: (...args: any[]) => void;
603
613
  close: (...args: any[]) => void;
604
- error: (...args: any[]) => void;
605
614
  submit: (...args: any[]) => void;
606
615
  open: (...args: any[]) => void;
607
616
  opened: (...args: any[]) => void;
608
617
  closed: (...args: any[]) => void;
609
618
  }, string, _vue_runtime_core.PublicProps, Readonly<__VLS_Props$s> & Readonly<{
619
+ onError?: ((...args: any[]) => any) | undefined;
610
620
  onChange?: ((...args: any[]) => any) | undefined;
611
621
  onClose?: ((...args: any[]) => any) | undefined;
612
- onError?: ((...args: any[]) => any) | undefined;
613
622
  onSubmit?: ((...args: any[]) => any) | undefined;
614
623
  onOpen?: ((...args: any[]) => any) | undefined;
615
624
  onOpened?: ((...args: any[]) => any) | undefined;
@@ -672,8 +681,8 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
672
681
  preventSubmitDefault?: boolean;
673
682
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
674
683
  }> & Readonly<{
675
- onChange?: ((...args: any[]) => any) | undefined;
676
684
  onError?: ((...args: any[]) => any) | undefined;
685
+ onChange?: ((...args: any[]) => any) | undefined;
677
686
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
678
687
  "onField-change"?: ((...args: any[]) => any) | undefined;
679
688
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -686,9 +695,10 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
686
695
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
687
696
  resetForm: () => void;
688
697
  submitForm: (native?: boolean) => Promise<any>;
698
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
689
699
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
690
- change: (...args: any[]) => void;
691
700
  error: (...args: any[]) => void;
701
+ change: (...args: any[]) => void;
692
702
  "update:stepActive": (...args: any[]) => void;
693
703
  "field-change": (...args: any[]) => void;
694
704
  "field-input": (...args: any[]) => void;
@@ -730,8 +740,8 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
730
740
  preventSubmitDefault?: boolean;
731
741
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
732
742
  }> & Readonly<{
733
- onChange?: ((...args: any[]) => any) | undefined;
734
743
  onError?: ((...args: any[]) => any) | undefined;
744
+ onChange?: ((...args: any[]) => any) | undefined;
735
745
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
736
746
  "onField-change"?: ((...args: any[]) => any) | undefined;
737
747
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -744,6 +754,7 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
744
754
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
745
755
  resetForm: () => void;
746
756
  submitForm: (native?: boolean) => Promise<any>;
757
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
747
758
  }, {}, {}, {}, {
748
759
  disabled: boolean;
749
760
  labelWidth: string;
@@ -775,8 +786,8 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
775
786
  preventSubmitDefault?: boolean;
776
787
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
777
788
  }> & Readonly<{
778
- onChange?: ((...args: any[]) => any) | undefined;
779
789
  onError?: ((...args: any[]) => any) | undefined;
790
+ onChange?: ((...args: any[]) => any) | undefined;
780
791
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
781
792
  "onField-change"?: ((...args: any[]) => any) | undefined;
782
793
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -789,9 +800,10 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
789
800
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
790
801
  resetForm: () => void;
791
802
  submitForm: (native?: boolean) => Promise<any>;
803
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
792
804
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
793
- change: (...args: any[]) => void;
794
805
  error: (...args: any[]) => void;
806
+ change: (...args: any[]) => void;
795
807
  "update:stepActive": (...args: any[]) => void;
796
808
  "field-change": (...args: any[]) => void;
797
809
  "field-input": (...args: any[]) => void;
@@ -833,8 +845,8 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
833
845
  preventSubmitDefault?: boolean;
834
846
  extendState?: (_state: _tmagic_form_schema.FormState) => Record<string, any> | Promise<Record<string, any>>;
835
847
  }> & Readonly<{
836
- onChange?: ((...args: any[]) => any) | undefined;
837
848
  onError?: ((...args: any[]) => any) | undefined;
849
+ onChange?: ((...args: any[]) => any) | undefined;
838
850
  "onUpdate:stepActive"?: ((...args: any[]) => any) | undefined;
839
851
  "onField-change"?: ((...args: any[]) => any) | undefined;
840
852
  "onField-input"?: ((...args: any[]) => any) | undefined;
@@ -847,6 +859,7 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
847
859
  changeHandler: (v: FormValue, eventData: ContainerChangeEventData) => void;
848
860
  resetForm: () => void;
849
861
  submitForm: (native?: boolean) => Promise<any>;
862
+ getTextByName: (name: string, config?: FormConfig) => string | undefined;
850
863
  }, {}, {}, {}, {
851
864
  disabled: boolean;
852
865
  labelWidth: string;
@@ -865,12 +878,12 @@ declare const __VLS_base$2: _vue_runtime_core.DefineComponent<__VLS_Props$r, {
865
878
  show: () => void;
866
879
  hide: () => void;
867
880
  }, {}, {}, {}, _vue_runtime_core.ComponentOptionsMixin, _vue_runtime_core.ComponentOptionsMixin, {
868
- change: (v: any, eventData: ContainerChangeEventData) => any;
869
881
  error: (e: any) => any;
882
+ change: (v: any, eventData: ContainerChangeEventData) => any;
870
883
  submit: (v: any, eventData: ContainerChangeEventData) => any;
871
884
  }, string, _vue_runtime_core.PublicProps, Readonly<__VLS_Props$r> & Readonly<{
872
- onChange?: ((v: any, eventData: ContainerChangeEventData) => any) | undefined;
873
885
  onError?: ((e: any) => any) | undefined;
886
+ onChange?: ((v: any, eventData: ContainerChangeEventData) => any) | undefined;
874
887
  onSubmit?: ((v: any, eventData: ContainerChangeEventData) => any) | undefined;
875
888
  }>, {
876
889
  values: Object;