@tmagic/form 1.8.0-beta.12 → 1.8.0-beta.14

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 (73) hide show
  1. package/dist/es/Form.vue_vue_type_script_setup_true_lang.js +51 -16
  2. package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +12 -5
  3. package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +38 -12
  4. package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +35 -27
  5. package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +6 -5
  6. package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +41 -31
  7. package/dist/es/containers/Panel.vue_vue_type_script_setup_true_lang.js +16 -10
  8. package/dist/es/containers/table/ActionsColumn.vue_vue_type_script_setup_true_lang.js +13 -6
  9. package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +4 -2
  10. package/dist/es/containers/table/useTableColumns.js +5 -1
  11. package/dist/es/containers/table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js +2 -1
  12. package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +5 -2
  13. package/dist/es/fields/Checkbox.vue_vue_type_script_setup_true_lang.js +4 -1
  14. package/dist/es/fields/CheckboxGroup.vue_vue_type_script_setup_true_lang.js +5 -2
  15. package/dist/es/fields/ColorPicker.vue_vue_type_script_setup_true_lang.js +4 -1
  16. package/dist/es/fields/Date.vue_vue_type_script_setup_true_lang.js +5 -2
  17. package/dist/es/fields/DateTime.vue_vue_type_script_setup_true_lang.js +5 -2
  18. package/dist/es/fields/Daterange.vue_vue_type_script_setup_true_lang.js +5 -2
  19. package/dist/es/fields/Display.vue_vue_type_script_setup_true_lang.js +5 -2
  20. package/dist/es/fields/DynamicField.vue_vue_type_script_setup_true_lang.js +4 -1
  21. package/dist/es/fields/Link.vue_vue_type_script_setup_true_lang.js +29 -7
  22. package/dist/es/fields/Number.vue_vue_type_script_setup_true_lang.js +7 -2
  23. package/dist/es/fields/NumberRange.vue_vue_type_script_setup_true_lang.js +4 -1
  24. package/dist/es/fields/RadioGroup.vue_vue_type_script_setup_true_lang.js +19 -9
  25. package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +4 -1
  26. package/dist/es/fields/Switch.vue_vue_type_script_setup_true_lang.js +4 -1
  27. package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +112 -77
  28. package/dist/es/fields/Textarea.vue_vue_type_script_setup_true_lang.js +4 -1
  29. package/dist/es/fields/Time.vue_vue_type_script_setup_true_lang.js +4 -1
  30. package/dist/es/fields/Timerange.vue_vue_type_script_setup_true_lang.js +6 -3
  31. package/dist/es/index.js +4 -4
  32. package/dist/es/plugin.js +3 -1
  33. package/dist/es/style.css +122 -8
  34. package/dist/es/submitForm.js +3 -9
  35. package/dist/es/utils/config.js +4 -1
  36. package/dist/es/utils/form.js +33 -3
  37. package/dist/es/utils/typeMatch.js +31 -26
  38. package/dist/style.css +122 -8
  39. package/dist/themes/magic-admin.css +499 -0
  40. package/dist/tmagic-form.umd.cjs +583 -330
  41. package/package.json +4 -4
  42. package/src/Form.vue +71 -18
  43. package/src/FormDialog.vue +14 -3
  44. package/src/FormDrawer.vue +40 -12
  45. package/src/containers/Container.vue +19 -6
  46. package/src/containers/GroupList.vue +1 -1
  47. package/src/containers/GroupListItem.vue +28 -22
  48. package/src/containers/Panel.vue +10 -3
  49. package/src/containers/table/ActionsColumn.vue +10 -4
  50. package/src/containers/table/Table.vue +1 -0
  51. package/src/containers/table/useTableColumns.ts +7 -3
  52. package/src/containers/table-group-list/TableGroupList.vue +7 -1
  53. package/src/fields/Link.vue +16 -3
  54. package/src/fields/Number.vue +2 -1
  55. package/src/fields/RadioGroup.vue +21 -6
  56. package/src/fields/Text.vue +43 -19
  57. package/src/plugin.ts +3 -0
  58. package/src/submitForm.ts +6 -12
  59. package/src/theme/container.scss +3 -0
  60. package/src/theme/fieldset.scss +51 -0
  61. package/src/theme/form.scss +6 -0
  62. package/src/theme/group-list.scss +9 -7
  63. package/src/theme/index.scss +1 -0
  64. package/src/theme/link.scss +17 -0
  65. package/src/theme/panel.scss +1 -1
  66. package/src/theme/radio-group.scss +23 -0
  67. package/src/theme/tabs.scss +2 -2
  68. package/src/theme/text.scss +38 -0
  69. package/src/theme/themes/magic-admin/index.scss +95 -0
  70. package/src/utils/config.ts +7 -1
  71. package/src/utils/form.ts +37 -0
  72. package/src/utils/typeMatch.ts +57 -28
  73. package/types/index.d.ts +72 -3
@@ -1,16 +1,16 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("@tmagic/design"), require("@tmagic/utils"), require("@element-plus/icons-vue"), require("dayjs"), require("dayjs/plugin/utc"), require("dayjs/plugin/customParseFormat"), require("@popperjs/core")) : typeof define === "function" && define.amd ? define([
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue"), require("dayjs"), require("dayjs/plugin/utc"), require("@tmagic/design"), require("@tmagic/utils"), require("dayjs/plugin/customParseFormat"), require("@element-plus/icons-vue"), require("@popperjs/core")) : typeof define === "function" && define.amd ? define([
3
3
  "exports",
4
4
  "vue",
5
- "@tmagic/design",
6
- "@tmagic/utils",
7
- "@element-plus/icons-vue",
8
5
  "dayjs",
9
6
  "dayjs/plugin/utc",
7
+ "@tmagic/design",
8
+ "@tmagic/utils",
10
9
  "dayjs/plugin/customParseFormat",
10
+ "@element-plus/icons-vue",
11
11
  "@popperjs/core"
12
- ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global._tmagic_design, global._tmagic_utils, global._element_plus_icons_vue, global.dayjs, global.dayjs_plugin_utc, global.dayjs_plugin_customParseFormat, global._popperjs_core));
13
- })(this, function(exports, vue, _tmagic_design, _tmagic_utils, _element_plus_icons_vue, dayjs, dayjs_plugin_utc, dayjs_plugin_customParseFormat, _popperjs_core) {
12
+ ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.TMagicForm = {}, global.Vue, global.dayjs, global.dayjs_plugin_utc, global._tmagic_design, global._tmagic_utils, global.dayjs_plugin_customParseFormat, global._element_plus_icons_vue, global._popperjs_core));
13
+ })(this, function(exports, vue, dayjs, dayjs_plugin_utc, _tmagic_design, _tmagic_utils, dayjs_plugin_customParseFormat, _element_plus_icons_vue, _popperjs_core) {
14
14
  Object.defineProperties(exports, {
15
15
  __esModule: { value: true },
16
16
  [Symbol.toStringTag]: { value: "Module" }
@@ -2720,59 +2720,13 @@
2720
2720
  return baseIsEqual(value, other);
2721
2721
  }
2722
2722
  //#endregion
2723
- //#region packages/form/src/utils/useAddField.ts
2724
- var useAddField = (prop) => {
2725
- if (!prop) return;
2726
- const mForm = (0, vue.inject)("mForm");
2727
- const instance = (0, vue.getCurrentInstance)();
2728
- (0, vue.watch)(() => instance?.proxy, (vm) => {
2729
- if (vm) mForm?.setField(prop, vm);
2730
- else mForm?.deleteField(prop);
2731
- }, { immediate: true });
2732
- };
2733
- //#endregion
2734
- //#region packages/form/src/fields/Hidden.vue
2735
- var Hidden_default = /* @__PURE__ */ (0, vue.defineComponent)({
2736
- name: "MFormHidden",
2737
- __name: "Hidden",
2738
- props: {
2739
- model: {},
2740
- name: {},
2741
- prop: {}
2742
- },
2743
- setup(__props) {
2744
- useAddField(__props.prop);
2745
- return (_ctx, _cache) => {
2746
- return __props.model ? (0, vue.withDirectives)(((0, vue.openBlock)(), (0, vue.createElementBlock)("input", {
2747
- key: 0,
2748
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
2749
- type: "hidden"
2750
- }, null, 512)), [[vue.vModelText, __props.model[__props.name]]]) : (0, vue.createCommentVNode)("v-if", true);
2751
- };
2752
- }
2753
- });
2754
- //#endregion
2755
- //#region packages/form/src/utils/config.ts
2756
- var $MAGIC_FORM = {};
2757
- var setConfig = (option) => {
2758
- $MAGIC_FORM = option;
2759
- };
2760
- var getConfig = (key) => $MAGIC_FORM[key];
2761
- var fieldRegistry = /* @__PURE__ */ new Map();
2762
- var registerField = (tagName, component) => {
2763
- if (fieldRegistry.has(tagName)) return;
2764
- fieldRegistry.set(tagName, component);
2765
- };
2766
- var getField = (tagName) => fieldRegistry.get(tagName);
2767
- var deleteField = (tagName) => fieldRegistry.delete(tagName);
2768
- //#endregion
2769
2723
  //#region packages/form/src/utils/typeMatch.ts
2770
2724
  dayjs.default.extend(dayjs_plugin_customParseFormat.default);
2771
2725
  var typeMatchRuleRegistry = /* @__PURE__ */ new Map();
2772
- var normalizeType = (type) => type.replace(/([A-Z])/g, "-$1").toLowerCase();
2726
+ var isPromise = (value) => typeof value === "object" && value !== null && typeof value.then === "function";
2773
2727
  /** 注册或覆盖某个字段 type 的 typeMatch 校验规则 */
2774
2728
  var registerTypeMatchRule = (type, validator) => {
2775
- typeMatchRuleRegistry.set(normalizeType(type), validator);
2729
+ typeMatchRuleRegistry.set((0, _tmagic_utils.toLine)(type), validator);
2776
2730
  };
2777
2731
  /** 批量注册 typeMatch 校验规则 */
2778
2732
  var registerTypeMatchRules = (rules) => {
@@ -2781,9 +2735,9 @@
2781
2735
  });
2782
2736
  };
2783
2737
  /** 获取某个字段 type 的自定义 typeMatch 校验规则 */
2784
- var getTypeMatchRule = (type) => typeMatchRuleRegistry.get(normalizeType(type));
2738
+ var getTypeMatchRule = (type) => typeMatchRuleRegistry.get((0, _tmagic_utils.toLine)(type));
2785
2739
  /** 删除某个字段 type 的自定义 typeMatch 校验规则 */
2786
- var deleteTypeMatchRule = (type) => typeMatchRuleRegistry.delete(normalizeType(type));
2740
+ var deleteTypeMatchRule = (type) => typeMatchRuleRegistry.delete((0, _tmagic_utils.toLine)(type));
2787
2741
  /** 清空所有自定义 typeMatch 校验规则 */
2788
2742
  var clearTypeMatchRules = () => {
2789
2743
  typeMatchRuleRegistry.clear();
@@ -2887,7 +2841,9 @@
2887
2841
  var resolveFieldDefaultValue = (mForm, props) => {
2888
2842
  const { defaultValue } = props.config || {};
2889
2843
  if (typeof defaultValue === "undefined" || defaultValue === "undefined") return void 0;
2890
- return resolveConfig(mForm, defaultValue, props);
2844
+ const resolvedDefaultValue = resolveConfig(mForm, defaultValue, props);
2845
+ if (isPromise(resolvedDefaultValue)) return;
2846
+ return resolvedDefaultValue;
2891
2847
  };
2892
2848
  var isNumberValue = (value) => typeof value === "number" && !Number.isNaN(value);
2893
2849
  var isStringValue = (value) => typeof value === "string";
@@ -2938,12 +2894,6 @@
2938
2894
  return `请参考以下示例值:["${example}", "${example}"]`;
2939
2895
  };
2940
2896
  var dateValueFormatErrorMessage = (message, valueFormat) => defaultMessage(message, isTimestampValueFormat(valueFormat) ? "值类型应为时间戳数字" : `值格式应为 ${valueFormat}`, dateSuggestion(valueFormat));
2941
- var resolveFieldType = (mForm, props) => {
2942
- let type = "type" in (props.config || {}) ? props.config.type : "";
2943
- type = type ? resolveConfig(mForm, type, props) || "" : "";
2944
- if (type === "form" || type === "container") return "";
2945
- return normalizeType(type || "") || (props.config?.items ? "" : "text");
2946
- };
2947
2897
  var resolveToggleValues = (config) => {
2948
2898
  const filterIsNumber = config.filter === "number";
2949
2899
  const { activeValue: configActiveValue, inactiveValue: configInactiveValue } = config;
@@ -2969,11 +2919,9 @@
2969
2919
  });
2970
2920
  return values;
2971
2921
  };
2972
- var resolveOptions = (mForm, props) => {
2922
+ var resolveOptions = (props) => {
2973
2923
  const { options } = props.config || {};
2974
- if (Array.isArray(options)) return options;
2975
- if (typeof options === "function") return resolveConfig(mForm, options, props) || [];
2976
- return [];
2924
+ return Array.isArray(options) ? options : [];
2977
2925
  };
2978
2926
  var includesOptionValue = (optionValues, value) => optionValues.some((item) => Object.is(item, value));
2979
2927
  var collectCascaderLeafValues = (options, result = []) => {
@@ -3026,6 +2974,7 @@
3026
2974
  return `请参考以下示例值:${stringifyExampleValue(example)}`;
3027
2975
  };
3028
2976
  var validateSelectValue = (value, config, optionValues, message) => {
2977
+ if (optionValues.length === 0) return;
3029
2978
  if (config.allowCreate || config.remote) {
3030
2979
  if (config.multiple) {
3031
2980
  if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, optionExampleSuggestion(optionValues, "[\"选项1\", \"选项2\"]", true));
@@ -3043,10 +2992,12 @@
3043
2992
  if (isStaticOptions && !includesOptionValue(optionValues, value)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
3044
2993
  };
3045
2994
  var validateCascaderValue = (value, config, props, mForm, message) => {
2995
+ const options = resolveOptions(props);
2996
+ if (!options.length) return;
3046
2997
  const valueSeparator = resolveConfig(mForm, config.valueSeparator, props);
2998
+ if (isPromise(valueSeparator)) return;
3047
2999
  const emitPath = config.emitPath !== false;
3048
3000
  const multiple = Boolean(config.multiple);
3049
- const options = resolveOptions(mForm, props);
3050
3001
  const cascaderExample = (fallbackExample) => cascaderExampleSuggestion(options, config, valueSeparator, fallbackExample);
3051
3002
  if (valueSeparator) {
3052
3003
  if (typeof value !== "string" && !Array.isArray(value)) return defaultMessage(message, `${value} 类型应为字符串或数组`, cascaderExample("\"选项1,选项2\" 或 [\"选项1\", \"选项2\"]"));
@@ -3100,14 +3051,16 @@
3100
3051
  if (!Object.is(value, activeValue) && !Object.is(value, inactiveValue)) return defaultMessage(message, `${value} 不在合法开关值中`, toggleSuggestion(activeValue, inactiveValue));
3101
3052
  return;
3102
3053
  }
3103
- if (fieldType === "select") return validateSelectValue(value, config, flattenSelectOptions(resolveOptions(mForm, props)), message);
3054
+ if (fieldType === "select") return validateSelectValue(value, config, flattenSelectOptions(resolveOptions(props)), message);
3104
3055
  if (fieldType === "radio-group") {
3105
- const optionValues = flattenSelectOptions(resolveOptions(mForm, props));
3056
+ const optionValues = flattenSelectOptions(resolveOptions(props));
3057
+ if (optionValues.length === 0) return;
3106
3058
  if (!includesOptionValue(optionValues, value)) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
3107
3059
  return;
3108
3060
  }
3109
3061
  if (fieldType === "checkbox-group") {
3110
- const optionValues = flattenSelectOptions(resolveOptions(mForm, props));
3062
+ const optionValues = flattenSelectOptions(resolveOptions(props));
3063
+ if (optionValues.length === 0) return;
3111
3064
  if (!Array.isArray(value)) return defaultMessage(message, `${value} 类型应为数组`, optionExampleSuggestion(optionValues, "[\"选项1\", \"选项2\"]", true));
3112
3065
  if (value.some((item) => !includesOptionValue(optionValues, item))) return defaultMessage(message, `${value} 不在可选项中`, optionSuggestion(optionValues));
3113
3066
  return;
@@ -3126,7 +3079,9 @@
3126
3079
  };
3127
3080
  var validateTypeMatch = (value, mForm, props, message) => {
3128
3081
  if (isEmptyValue(value) || isEmptyArray(value)) return;
3129
- const fieldType = resolveFieldType(mForm, props);
3082
+ const rawFieldType = "type" in (props.config || {}) ? props.config.type : "";
3083
+ if (typeof rawFieldType !== "string" || !rawFieldType) return;
3084
+ const fieldType = (0, _tmagic_utils.toLine)(rawFieldType);
3130
3085
  const customValidator = getTypeMatchRule(fieldType);
3131
3086
  if (customValidator) return customValidator(value, {
3132
3087
  fieldType,
@@ -3140,10 +3095,14 @@
3140
3095
  const originalValidator = typeof rule.validator === "function" ? rule.validator : void 0;
3141
3096
  return (asyncValidatorRule, value, callback, source, options) => {
3142
3097
  const actualValue = props.config?.names ? props.model : value;
3143
- const error = validateTypeMatch(actualValue, mForm, props, rule.message);
3144
- if (error) {
3145
- callback(new Error(error));
3146
- return;
3098
+ try {
3099
+ const error = validateTypeMatch(actualValue, mForm, props, rule.message);
3100
+ if (error) {
3101
+ callback(new Error(error));
3102
+ return;
3103
+ }
3104
+ } catch (error) {
3105
+ console.error(error);
3147
3106
  }
3148
3107
  if (originalValidator) return originalValidator({
3149
3108
  rule: asyncValidatorRule,
@@ -3361,6 +3320,36 @@
3361
3320
  if (order === "ascending") data.sort((a, b) => a[prop] - b[prop]);
3362
3321
  else if (order === "descending") data.sort((a, b) => b[prop] - a[prop]);
3363
3322
  };
3323
+ /**
3324
+ * 将 extendState 返回的扩展字段合并进 formState。
3325
+ *
3326
+ * - data 描述符(普通字段)通过 `formState[key] = value` 写入,走 reactive proxy 的 set,
3327
+ * 触发依赖通知;
3328
+ * - accessor 描述符(`{ get stage() { return ... } }`)按原样 defineProperty,调用方
3329
+ * 可控制读时求值;强制 `configurable: true` 以便下一次合并可再 define。
3330
+ *
3331
+ * 注意:formState 上由 props 派生的字段(keyProp / popperClass / config / initValues /
3332
+ * isCompare / lastValues / parentValues)是只读 getter(无 setter),extendState 若以
3333
+ * 普通字段形式返回同名 key,直接赋值会让 proxy 的 set trap 失败并抛出
3334
+ * `TypeError: 'set' on proxy: trap returned falsish`,这里统一跳过并告警;
3335
+ * 如确需覆盖,可在 extendState 中以 get 访问器形式返回。
3336
+ */
3337
+ var applyExtendState = (formState, state) => {
3338
+ if (!state) return;
3339
+ for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(state))) {
3340
+ if (!("value" in descriptor)) {
3341
+ descriptor.configurable = true;
3342
+ Object.defineProperty(formState, key, descriptor);
3343
+ continue;
3344
+ }
3345
+ const targetDescriptor = Object.getOwnPropertyDescriptor(formState, key);
3346
+ if (targetDescriptor && !("value" in targetDescriptor) && typeof targetDescriptor.set !== "function") {
3347
+ console.warn(`[MForm] extendState: "${key}" is a read-only field derived from props and cannot be assigned a plain value. Return it as a getter accessor if you really need to override it.`);
3348
+ continue;
3349
+ }
3350
+ formState[key] = state[key];
3351
+ }
3352
+ };
3364
3353
  var createObjectProp = (prop, key, name) => {
3365
3354
  if (prop === "") return key;
3366
3355
  const itemPath = `${prop}`.split(".");
@@ -3370,6 +3359,54 @@
3370
3359
  return `${[...itemPath, key].join(".")}`;
3371
3360
  };
3372
3361
  //#endregion
3362
+ //#region packages/form/src/utils/useAddField.ts
3363
+ var useAddField = (prop) => {
3364
+ if (!prop) return;
3365
+ const mForm = (0, vue.inject)("mForm");
3366
+ const instance = (0, vue.getCurrentInstance)();
3367
+ (0, vue.watch)(() => instance?.proxy, (vm) => {
3368
+ if (vm) mForm?.setField(prop, vm);
3369
+ else mForm?.deleteField(prop);
3370
+ }, { immediate: true });
3371
+ };
3372
+ //#endregion
3373
+ //#region packages/form/src/fields/Hidden.vue
3374
+ var Hidden_default = /* @__PURE__ */ (0, vue.defineComponent)({
3375
+ name: "MFormHidden",
3376
+ __name: "Hidden",
3377
+ props: {
3378
+ model: {},
3379
+ name: {},
3380
+ prop: {}
3381
+ },
3382
+ setup(__props) {
3383
+ useAddField(__props.prop);
3384
+ return (_ctx, _cache) => {
3385
+ return __props.model ? (0, vue.withDirectives)(((0, vue.openBlock)(), (0, vue.createElementBlock)("input", {
3386
+ key: 0,
3387
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => __props.model[__props.name] = $event),
3388
+ type: "hidden"
3389
+ }, null, 512)), [[vue.vModelText, __props.model[__props.name]]]) : (0, vue.createCommentVNode)("v-if", true);
3390
+ };
3391
+ }
3392
+ });
3393
+ //#endregion
3394
+ //#region packages/form/src/utils/config.ts
3395
+ var $MAGIC_FORM = {};
3396
+ var isGlobalFlat = (0, vue.ref)(false);
3397
+ var setConfig = (option) => {
3398
+ $MAGIC_FORM = option;
3399
+ isGlobalFlat.value = option.flat ?? false;
3400
+ };
3401
+ var getConfig = (key) => $MAGIC_FORM[key];
3402
+ var fieldRegistry = /* @__PURE__ */ new Map();
3403
+ var registerField = (tagName, component) => {
3404
+ if (fieldRegistry.has(tagName)) return;
3405
+ fieldRegistry.set(tagName, component);
3406
+ };
3407
+ var getField = (tagName) => fieldRegistry.get(tagName);
3408
+ var deleteField = (tagName) => fieldRegistry.delete(tagName);
3409
+ //#endregion
3373
3410
  //#region packages/form/src/containers/FormLabel.vue?vue&type=script&setup=true&lang.ts
3374
3411
  var _hoisted_1$15 = {
3375
3412
  key: 0,
@@ -3378,9 +3415,9 @@
3378
3415
  "align-items": "center"
3379
3416
  }
3380
3417
  };
3381
- var _hoisted_2$8 = ["innerHTML", "title"];
3382
- var _hoisted_3$7 = ["innerHTML"];
3383
- var _hoisted_4$5 = ["innerHTML", "title"];
3418
+ var _hoisted_2$9 = ["innerHTML", "title"];
3419
+ var _hoisted_3$8 = ["innerHTML"];
3420
+ var _hoisted_4$7 = ["innerHTML", "title"];
3384
3421
  //#endregion
3385
3422
  //#region packages/form/src/containers/FormLabel.vue
3386
3423
  var FormLabel_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -3397,11 +3434,11 @@
3397
3434
  return __props.tip ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_1$15, [(0, vue.createElementVNode)("span", {
3398
3435
  innerHTML: __props.type === "checkbox" && !__props.useLabel ? "" : __props.text,
3399
3436
  title: __props.labelTitle
3400
- }, null, 8, _hoisted_2$8), __props.tip && (__props.type !== "checkbox" || __props.useLabel) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
3437
+ }, null, 8, _hoisted_2$9), __props.tip && (__props.type !== "checkbox" || __props.useLabel) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
3401
3438
  key: 0,
3402
3439
  placement: "top"
3403
3440
  }, {
3404
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.tip }, null, 8, _hoisted_3$7)]),
3441
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.tip }, null, 8, _hoisted_3$8)]),
3405
3442
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), { style: {
3406
3443
  "margin-left": "5px",
3407
3444
  "display": "flex"
@@ -3414,23 +3451,27 @@
3414
3451
  key: 1,
3415
3452
  innerHTML: __props.type === "checkbox" && !__props.useLabel ? "" : __props.text,
3416
3453
  title: __props.labelTitle
3417
- }, null, 8, _hoisted_4$5));
3454
+ }, null, 8, _hoisted_4$7));
3418
3455
  };
3419
3456
  }
3420
3457
  });
3421
3458
  //#endregion
3422
3459
  //#region packages/form/src/containers/Container.vue?vue&type=script&setup=true&lang.ts
3423
3460
  var _hoisted_1$14 = ["data-tmagic-id", "data-tmagic-form-item-prop"];
3424
- var _hoisted_2$7 = ["innerHTML"];
3425
- var _hoisted_3$6 = ["innerHTML"];
3426
- var _hoisted_4$4 = ["innerHTML"];
3427
- var _hoisted_5$3 = ["innerHTML"];
3428
- var _hoisted_6$1 = ["innerHTML"];
3429
- var _hoisted_7$1 = ["innerHTML"];
3430
- var _hoisted_8$1 = ["innerHTML"];
3431
- var _hoisted_9 = {
3461
+ var _hoisted_2$8 = {
3462
+ key: 0,
3463
+ class: "m-form-tip m-form-title-extra"
3464
+ };
3465
+ var _hoisted_3$7 = ["innerHTML"];
3466
+ var _hoisted_4$6 = ["innerHTML"];
3467
+ var _hoisted_5$4 = ["innerHTML"];
3468
+ var _hoisted_6$3 = ["innerHTML"];
3469
+ var _hoisted_7$2 = ["innerHTML"];
3470
+ var _hoisted_8$2 = ["innerHTML"];
3471
+ var _hoisted_9 = ["innerHTML"];
3472
+ var _hoisted_10 = {
3432
3473
  key: 5,
3433
- style: { "text-align": "center" }
3474
+ class: "m-form-container-expand"
3434
3475
  };
3435
3476
  //#endregion
3436
3477
  //#region packages/form/src/containers/Container.vue
@@ -3558,7 +3599,8 @@
3558
3599
  labelWidth: itemLabelWidth.value,
3559
3600
  labelPosition: props.config.labelPosition,
3560
3601
  rules: rule.value,
3561
- extra: filterFunction(mForm, props.config.extra, props)
3602
+ extra: filterFunction(mForm, props.config.extra, props),
3603
+ extraTips: props.config.extraTips
3562
3604
  }));
3563
3605
  const itemLabelWidth = (0, vue.computed)(() => props.config.labelWidth ?? props.labelWidth);
3564
3606
  (0, vue.watchEffect)(() => {
@@ -3668,16 +3710,18 @@
3668
3710
  "data-tmagic-form-item-prop": itemProp.value,
3669
3711
  class: (0, vue.normalizeClass)(`m-form-container m-container-${type.value || ""} ${__props.config.className || ""}${__props.config.tip ? " has-tip" : ""}`),
3670
3712
  style: (0, vue.normalizeStyle)(__props.config.style)
3671
- }, [type.value === "hidden" ? ((0, vue.openBlock)(), (0, vue.createBlock)(Hidden_default, {
3672
- key: 0,
3673
- name: `${name.value}`,
3674
- prop: itemProp.value,
3675
- model: __props.model
3676
- }, null, 8, [
3677
- "name",
3678
- "prop",
3679
- "model"
3680
- ])) : items.value && !text.value && type.value && display$3.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)({ key: 1 }, fieldsProps.value, {
3713
+ }, [type.value === "hidden" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicFormItem), (0, vue.mergeProps)({ key: 0 }, formItemProps.value, { style: { "display": "none" } }), {
3714
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)(Hidden_default, {
3715
+ name: `${name.value}`,
3716
+ prop: itemProp.value,
3717
+ model: __props.model
3718
+ }, null, 8, [
3719
+ "name",
3720
+ "prop",
3721
+ "model"
3722
+ ])]),
3723
+ _: 1
3724
+ }, 16)) : items.value && !text.value && type.value && display$3.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)({ key: 1 }, fieldsProps.value, {
3681
3725
  model: __props.model,
3682
3726
  "last-values": __props.lastValues,
3683
3727
  "is-compare": __props.isCompare,
@@ -3714,12 +3758,12 @@
3714
3758
  "use-label",
3715
3759
  "label-title",
3716
3760
  "text"
3717
- ])])]),
3761
+ ]), __props.config.titleExtra && __props.config.labelPosition === "top" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$8, (0, vue.toDisplayString)(__props.config.titleExtra), 1)) : (0, vue.createCommentVNode)("v-if", true)])]),
3718
3762
  default: (0, vue.withCtx)(() => [tooltip.value.text ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicTooltip), {
3719
3763
  key: 0,
3720
3764
  placement: tooltip.value.placement
3721
3765
  }, {
3722
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_2$7)]),
3766
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_3$7)]),
3723
3767
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)(fieldsProps.value, {
3724
3768
  model: __props.model,
3725
3769
  "last-values": __props.lastValues,
@@ -3748,7 +3792,7 @@
3748
3792
  key: 0,
3749
3793
  placement: "top"
3750
3794
  }, {
3751
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_3$6)]),
3795
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_4$6)]),
3752
3796
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), { style: {
3753
3797
  "line-height": "40px",
3754
3798
  "margin-left": "5px"
@@ -3787,7 +3831,7 @@
3787
3831
  key: 0,
3788
3832
  placement: tooltip.value.placement
3789
3833
  }, {
3790
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_4$4)]),
3834
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_5$4)]),
3791
3835
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)(fieldsProps.value, {
3792
3836
  model: __props.model,
3793
3837
  "last-values": __props.lastValues,
@@ -3840,7 +3884,7 @@
3840
3884
  key: 0,
3841
3885
  placement: tooltip.value.placement
3842
3886
  }, {
3843
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_5$3)]),
3887
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_6$3)]),
3844
3888
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)(fieldsProps.value, {
3845
3889
  model: __props.lastValues,
3846
3890
  onChange: onChangeHandler
@@ -3856,7 +3900,7 @@
3856
3900
  key: 0,
3857
3901
  placement: "top"
3858
3902
  }, {
3859
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_6$1)]),
3903
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_7$2)]),
3860
3904
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), { style: {
3861
3905
  "line-height": "40px",
3862
3906
  "margin-left": "5px"
@@ -3897,7 +3941,7 @@
3897
3941
  key: 0,
3898
3942
  placement: tooltip.value.placement
3899
3943
  }, {
3900
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_7$1)]),
3944
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_8$2)]),
3901
3945
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(tagName.value), (0, vue.mergeProps)(fieldsProps.value, {
3902
3946
  model: __props.model,
3903
3947
  onChange: onChangeHandler
@@ -3913,7 +3957,7 @@
3913
3957
  key: 1,
3914
3958
  placement: "top"
3915
3959
  }, {
3916
- content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_8$1)]),
3960
+ content: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_9)]),
3917
3961
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), { style: {
3918
3962
  "line-height": "40px",
3919
3963
  "margin-left": "5px"
@@ -3955,16 +3999,17 @@
3955
3999
  "label-width",
3956
4000
  "prop"
3957
4001
  ]);
3958
- }), 128)) : (0, vue.createCommentVNode)("v-if", true)], 64)) : (0, vue.createCommentVNode)("v-if", true), __props.config.expand && type.value !== "fieldset" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_9, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
4002
+ }), 128)) : (0, vue.createCommentVNode)("v-if", true)], 64)) : (0, vue.createCommentVNode)("v-if", true), __props.config.expand && type.value !== "fieldset" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_10, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
3959
4003
  type: "primary",
3960
4004
  size: "small",
3961
4005
  disabled: false,
3962
4006
  link: "",
3963
- onClick: expandHandler
4007
+ onClick: expandHandler,
4008
+ icon: expand.value ? (0, vue.unref)(_element_plus_icons_vue.ArrowUp) : (0, vue.unref)(_element_plus_icons_vue.ArrowDown)
3964
4009
  }, {
3965
4010
  default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(expand.value ? "收起配置" : "展开更多配置"), 1)]),
3966
4011
  _: 1
3967
- })])) : (0, vue.createCommentVNode)("v-if", true)], 14, _hoisted_1$14);
4012
+ }, 8, ["icon"])])) : (0, vue.createCommentVNode)("v-if", true)], 14, _hoisted_1$14);
3968
4013
  };
3969
4014
  }
3970
4015
  });
@@ -4005,7 +4050,8 @@
4005
4050
  },
4006
4051
  extendState: {},
4007
4052
  showDiff: {},
4008
- selfDiffFieldTypes: {}
4053
+ selfDiffFieldTypes: {},
4054
+ theme: {}
4009
4055
  },
4010
4056
  emits: [
4011
4057
  "change",
@@ -4025,6 +4071,25 @@
4025
4071
  const fields = /* @__PURE__ */ new Map();
4026
4072
  const requestFuc = getConfig("request");
4027
4073
  /**
4074
+ * 当前表单生效的主题名称:
4075
+ * - 优先用本组件自己的 `props.theme`;
4076
+ * - 没设置时回退到最近祖先 `<MEditor>` / `<MForm>` provide 的主题,便于内嵌于编辑器
4077
+ * 时自动跟随外层主题,无需在每个 `MForm` 上重复传 `theme`。
4078
+ *
4079
+ * 同时把合并后的值再 provide 出去(见下方 `provide(M_THEME_KEY, ...)`),让 form 子树
4080
+ * 里再嵌套的 portal 组件(`TMagicPopover` 等)依然能拿到非空主题。
4081
+ */
4082
+ const ancestorTheme = (0, vue.inject)(_tmagic_design.M_THEME_KEY, null);
4083
+ const effectiveTheme = (0, vue.computed)(() => props.theme || ancestorTheme?.value || "");
4084
+ /**
4085
+ * 拼到 `formState.popperClass` 上的主题修饰类(仅 `m-theme--<theme>`,
4086
+ * 不带 `m-form` / `m-editor` 前缀,因为 Element Plus 弹层节点本身既不是 form 也不是 editor)。
4087
+ *
4088
+ * 这条类会随所有读 `mForm.popperClass` 的字段(Select / DateTime / Cascader 等)下发到
4089
+ * Element Plus 的 `popper-class`,让 portal 节点也命中 `m-theme--<theme>` 上的 CSS 变量。
4090
+ */
4091
+ const themeClass = (0, vue.computed)(() => effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : "");
4092
+ /**
4028
4093
  * formState 实现说明:
4029
4094
  *
4030
4095
  * 1. 与 props 直接对应的字段(config / initValues / lastValues / isCompare / parentValues /
@@ -4040,13 +4105,21 @@
4040
4105
  * 把最新值刷进 formState。
4041
4106
  * - accessor 描述符(`{ get stage() { return ... } }`)按原样写入,调用方可以控制
4042
4107
  * 读时求值,每次读取都会重新执行 getter。
4108
+ *
4109
+ * 4. `popperClass` 会自动拼接 `themeClass`:调用方传入的 `popperClass` + 当前主题
4110
+ * 修饰类(含祖先 `<MEditor>` provide 的主题)。这样所有透传到 Element Plus 弹层
4111
+ * `popper-class` 的字段(Select / DateTime / Cascader 等)能自带主题作用域。
4043
4112
  */
4044
4113
  const formState = (0, vue.reactive)({
4045
4114
  get keyProp() {
4046
4115
  return props.keyProp;
4047
4116
  },
4048
4117
  get popperClass() {
4049
- return props.popperClass;
4118
+ const userClass = props.popperClass ?? "";
4119
+ const tc = themeClass.value;
4120
+ if (!userClass) return tc;
4121
+ if (!tc) return userClass;
4122
+ return `${userClass} ${tc}`;
4050
4123
  },
4051
4124
  get config() {
4052
4125
  return props.config;
@@ -4094,11 +4167,10 @@
4094
4167
  * 这里不再重复同步;因此 `props.initValues` 这类高频变化也不会再触发
4095
4168
  * `extendState` 重跑(旧版的性能问题修复点)。
4096
4169
  *
4097
- * 实现细节:
4098
- * - data 描述符:通过 `formState[key] = value` 走 reactive proxy 的 set
4099
- * 触发依赖通知;与旧版「逐项赋值」语义完全等价。
4100
- * - accessor 描述符(`{ get stage() {...} }`)按原样写入 formState,调用方
4101
- * 可以自行控制读时求值;强制 `configurable: true` 以便下一次重跑可再 define。
4170
+ * 实现细节:合并逻辑统一收口在 `applyExtendState`(utils/form)——
4171
+ * data 描述符走 reactive proxy 的 set 触发依赖通知(与旧版「逐项赋值」语义等价),
4172
+ * accessor 描述符按原样 defineProperty 支持读时求值;
4173
+ * props 派生的只读 getter 字段(keyProp 等)以普通字段形式返回时会被跳过并告警。
4102
4174
  */
4103
4175
  (0, vue.watchEffect)(async (onCleanup) => {
4104
4176
  const { extendState } = props;
@@ -4115,13 +4187,16 @@
4115
4187
  return;
4116
4188
  }
4117
4189
  if (stale) return;
4118
- for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(state))) if ("value" in descriptor) formState[key] = state[key];
4119
- else {
4120
- descriptor.configurable = true;
4121
- Object.defineProperty(formState, key, descriptor);
4122
- }
4190
+ applyExtendState(formState, state);
4123
4191
  });
4124
4192
  (0, vue.provide)("mForm", formState);
4193
+ /**
4194
+ * 把生效主题(自身或祖先)再 provide 出去,供 form 子树内含 `Teleport` 的组件
4195
+ * (如 `TMagicPopover`)在传送目标上挂 `m-theme--<theme>` 类。
4196
+ * 详见 `@tmagic/design/theme.ts`。
4197
+ */
4198
+ (0, vue.provide)(_tmagic_design.M_THEME_KEY, effectiveTheme);
4199
+ (0, vue.provide)("formInline", props.inline);
4125
4200
  (0, vue.provide)(FORM_DIFF_CONFIG_KEY, {
4126
4201
  get showDiff() {
4127
4202
  return props.showDiff;
@@ -4262,7 +4337,11 @@
4262
4337
  });
4263
4338
  return (_ctx, _cache) => {
4264
4339
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicForm), {
4265
- class: "m-form",
4340
+ class: (0, vue.normalizeClass)([
4341
+ "m-form",
4342
+ effectiveTheme.value ? `m-form--${effectiveTheme.value}` : "",
4343
+ effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""
4344
+ ]),
4266
4345
  ref: "tMagicForm",
4267
4346
  model: values.value,
4268
4347
  "label-width": __props.labelWidth,
@@ -4300,6 +4379,7 @@
4300
4379
  }), 128)) : (0, vue.createCommentVNode)("v-if", true)]),
4301
4380
  _: 3
4302
4381
  }, 8, [
4382
+ "class",
4303
4383
  "model",
4304
4384
  "label-width",
4305
4385
  "style",
@@ -4362,14 +4442,7 @@
4362
4442
  console.error("[MForm] extendState failed:", e);
4363
4443
  return;
4364
4444
  }
4365
- const apply = (state) => {
4366
- if (!state) return;
4367
- for (const [key, descriptor] of Object.entries(Object.getOwnPropertyDescriptors(state))) if ("value" in descriptor) form.formState[key] = state[key];
4368
- else {
4369
- descriptor.configurable = true;
4370
- Object.defineProperty(form.formState, key, descriptor);
4371
- }
4372
- };
4445
+ const apply = (state) => applyExtendState(form.formState, state);
4373
4446
  if (result && typeof result.then === "function") result.then(apply, (e) => console.error("[MForm] extendState failed:", e));
4374
4447
  else apply(result);
4375
4448
  }, {
@@ -4776,7 +4849,8 @@
4776
4849
  type: Boolean,
4777
4850
  default: true
4778
4851
  },
4779
- extendState: {}
4852
+ extendState: {},
4853
+ theme: {}
4780
4854
  },
4781
4855
  emits: [
4782
4856
  "close",
@@ -4786,6 +4860,9 @@
4786
4860
  ],
4787
4861
  setup(__props, { expose: __expose, emit: __emit }) {
4788
4862
  const props = __props;
4863
+ const ancestorTheme = (0, vue.inject)(_tmagic_design.M_THEME_KEY, null);
4864
+ const effectiveTheme = (0, vue.computed)(() => props.theme || ancestorTheme?.value || "");
4865
+ (0, vue.provide)(_tmagic_design.M_THEME_KEY, effectiveTheme);
4789
4866
  const emit = __emit;
4790
4867
  const form = (0, vue.ref)();
4791
4868
  const dialogVisible = (0, vue.ref)(false);
@@ -4846,7 +4923,7 @@
4846
4923
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicDialog), {
4847
4924
  modelValue: dialogVisible.value,
4848
4925
  "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogVisible.value = $event),
4849
- class: "m-form-dialog",
4926
+ class: (0, vue.normalizeClass)(["m-form-dialog", effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""]),
4850
4927
  top: "20px",
4851
4928
  "append-to-body": "",
4852
4929
  title: __props.title,
@@ -4930,6 +5007,7 @@
4930
5007
  "use-field-text-in-error": __props.useFieldTextInError,
4931
5008
  "type-match-valid": __props.typeMatchValid,
4932
5009
  "extend-state": __props.extendState,
5010
+ theme: effectiveTheme.value,
4933
5011
  onChange: changeHandler
4934
5012
  }, null, 8, [
4935
5013
  "modelValue",
@@ -4944,11 +5022,13 @@
4944
5022
  "prevent-submit-default",
4945
5023
  "use-field-text-in-error",
4946
5024
  "type-match-valid",
4947
- "extend-state"
5025
+ "extend-state",
5026
+ "theme"
4948
5027
  ]), (0, vue.renderSlot)(_ctx.$slots, "default")], 4)) : (0, vue.createCommentVNode)("v-if", true)]),
4949
5028
  _: 3
4950
5029
  }, 8, [
4951
5030
  "modelValue",
5031
+ "class",
4952
5032
  "title",
4953
5033
  "width",
4954
5034
  "zIndex",
@@ -4967,7 +5047,7 @@
4967
5047
  //#endregion
4968
5048
  //#region packages/form/src/FormDrawer.vue
4969
5049
  var FormDrawer_default = /* @__PURE__ */ (0, vue.defineComponent)({
4970
- name: "MFormDialog",
5050
+ name: "MFormDrawer",
4971
5051
  __name: "FormDrawer",
4972
5052
  props: {
4973
5053
  config: { default: () => [] },
@@ -4993,7 +5073,8 @@
4993
5073
  default: true
4994
5074
  },
4995
5075
  beforeClose: {},
4996
- extendState: {}
5076
+ extendState: {},
5077
+ theme: {}
4997
5078
  },
4998
5079
  emits: [
4999
5080
  "close",
@@ -5005,11 +5086,15 @@
5005
5086
  "opened"
5006
5087
  ],
5007
5088
  setup(__props, { expose: __expose, emit: __emit }) {
5089
+ const props = __props;
5090
+ const ancestorTheme = (0, vue.inject)(_tmagic_design.M_THEME_KEY, null);
5091
+ const effectiveTheme = (0, vue.computed)(() => props.theme || ancestorTheme?.value || "");
5092
+ (0, vue.provide)(_tmagic_design.M_THEME_KEY, effectiveTheme);
5008
5093
  const emit = __emit;
5009
5094
  const drawer = (0, vue.ref)();
5010
5095
  const form = (0, vue.ref)();
5011
5096
  const drawerBody = (0, vue.ref)();
5012
- const visible = (0, vue.ref)(false);
5097
+ const dialogVisible = (0, vue.ref)(false);
5013
5098
  const saveFetch = (0, vue.ref)(false);
5014
5099
  const bodyHeight = (0, vue.ref)(0);
5015
5100
  (0, vue.watchEffect)(() => {
@@ -5040,30 +5125,48 @@
5040
5125
  emit("closed");
5041
5126
  };
5042
5127
  const show = () => {
5043
- visible.value = true;
5128
+ dialogVisible.value = true;
5044
5129
  };
5045
5130
  const hide = () => {
5046
- visible.value = false;
5131
+ dialogVisible.value = false;
5132
+ };
5133
+ const close = () => {
5134
+ dialogVisible.value = false;
5135
+ };
5136
+ const cancel = () => {
5137
+ hide();
5047
5138
  };
5048
5139
  /** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */
5049
5140
  const handleClose = () => {
5050
5141
  drawer.value?.handleClose();
5051
5142
  };
5143
+ const save = async () => {
5144
+ try {
5145
+ const changeRecords = [...form.value?.changeRecords || []];
5146
+ const values = await form.value?.submitForm();
5147
+ emit("submit", values, { changeRecords });
5148
+ } catch (e) {
5149
+ emit("error", e);
5150
+ }
5151
+ };
5052
5152
  __expose({
5053
5153
  form,
5054
5154
  saveFetch,
5055
5155
  bodyHeight,
5156
+ close,
5056
5157
  show,
5057
5158
  hide,
5159
+ save,
5160
+ cancel,
5058
5161
  handleClose
5059
5162
  });
5060
5163
  return (_ctx, _cache) => {
5061
5164
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicDrawer), {
5062
- class: "m-form-drawer",
5165
+ class: (0, vue.normalizeClass)(["m-form-drawer", effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""]),
5063
5166
  ref_key: "drawer",
5064
5167
  ref: drawer,
5065
- modelValue: visible.value,
5066
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => visible.value = $event),
5168
+ modelValue: dialogVisible.value,
5169
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
5067
5170
  title: __props.title,
5068
5171
  "close-on-press-escape": __props.closeOnPressEscape,
5069
5172
  "append-to-body": true,
@@ -5101,7 +5204,7 @@
5101
5204
  })]),
5102
5205
  _: 3
5103
5206
  })]),
5104
- default: (0, vue.withCtx)(() => [visible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
5207
+ default: (0, vue.withCtx)(() => [dialogVisible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
5105
5208
  key: 0,
5106
5209
  ref_key: "drawerBody",
5107
5210
  ref: drawerBody,
@@ -5121,6 +5224,7 @@
5121
5224
  "use-field-text-in-error": __props.useFieldTextInError,
5122
5225
  "type-match-valid": __props.typeMatchValid,
5123
5226
  "extend-state": __props.extendState,
5227
+ theme: effectiveTheme.value,
5124
5228
  onChange: changeHandler
5125
5229
  }, null, 8, [
5126
5230
  "size",
@@ -5134,10 +5238,12 @@
5134
5238
  "prevent-submit-default",
5135
5239
  "use-field-text-in-error",
5136
5240
  "type-match-valid",
5137
- "extend-state"
5241
+ "extend-state",
5242
+ "theme"
5138
5243
  ]), (0, vue.renderSlot)(_ctx.$slots, "default")], 512)) : (0, vue.createCommentVNode)("v-if", true)]),
5139
5244
  _: 3
5140
5245
  }, 8, [
5246
+ "class",
5141
5247
  "modelValue",
5142
5248
  "title",
5143
5249
  "close-on-press-escape",
@@ -5279,16 +5385,16 @@
5279
5385
  //#endregion
5280
5386
  //#region packages/form/src/containers/Fieldset.vue?vue&type=script&setup=true&lang.ts
5281
5387
  var _hoisted_1$11 = ["innerHTML"];
5282
- var _hoisted_2$6 = ["innerHTML"];
5283
- var _hoisted_3$5 = { key: 1 };
5284
- var _hoisted_4$3 = ["innerHTML"];
5285
- var _hoisted_5$2 = ["innerHTML"];
5286
- var _hoisted_6 = {
5388
+ var _hoisted_2$7 = ["innerHTML"];
5389
+ var _hoisted_3$6 = { key: 1 };
5390
+ var _hoisted_4$5 = ["innerHTML"];
5391
+ var _hoisted_5$3 = ["innerHTML"];
5392
+ var _hoisted_6$2 = {
5287
5393
  key: 2,
5288
5394
  style: { "display": "flex" }
5289
5395
  };
5290
- var _hoisted_7 = { style: { "flex": "1" } };
5291
- var _hoisted_8 = ["src"];
5396
+ var _hoisted_7$1 = { style: { "flex": "1" } };
5397
+ var _hoisted_8$1 = ["src"];
5292
5398
  //#endregion
5293
5399
  //#region packages/form/src/containers/Fieldset.vue
5294
5400
  var Fieldset_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -5358,7 +5464,7 @@
5358
5464
  key: 0,
5359
5465
  innerHTML: __props.config.extra,
5360
5466
  class: "m-form-tip"
5361
- }, null, 8, _hoisted_2$6)) : (0, vue.createCommentVNode)("v-if", true)]),
5467
+ }, null, 8, _hoisted_2$7)) : (0, vue.createCommentVNode)("v-if", true)]),
5362
5468
  _: 1
5363
5469
  }, 8, [
5364
5470
  "model-value",
@@ -5367,11 +5473,11 @@
5367
5473
  "false-value"
5368
5474
  ])]),
5369
5475
  _: 1
5370
- })) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("legend", _hoisted_3$5, [(0, vue.createElementVNode)("span", { innerHTML: legend.value }, null, 8, _hoisted_4$3), __props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
5476
+ })) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("legend", _hoisted_3$6, [(0, vue.createElementVNode)("span", { innerHTML: legend.value }, null, 8, _hoisted_4$5), __props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
5371
5477
  key: 0,
5372
5478
  innerHTML: __props.config.extra,
5373
5479
  class: "m-form-tip"
5374
- }, null, 8, _hoisted_5$2)) : (0, vue.createCommentVNode)("v-if", true)])), __props.config.schematic && show.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_6, [(0, vue.createElementVNode)("div", _hoisted_7, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.config.items, (item, index) => {
5480
+ }, null, 8, _hoisted_5$3)) : (0, vue.createCommentVNode)("v-if", true)])), __props.config.schematic && show.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_6$2, [(0, vue.createElementVNode)("div", _hoisted_7$1, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.config.items, (item, index) => {
5375
5481
  return (0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
5376
5482
  key: key(item, index),
5377
5483
  model: name.value ? __props.model[name.value] : __props.model,
@@ -5399,7 +5505,7 @@
5399
5505
  }), 128))]), (0, vue.createElementVNode)("img", {
5400
5506
  class: "m-form-schematic",
5401
5507
  src: __props.config.schematic
5402
- }, null, 8, _hoisted_8)])) : show.value ? ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 3 }, (0, vue.renderList)(__props.config.items, (item, index) => {
5508
+ }, null, 8, _hoisted_8$1)])) : show.value ? ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 3 }, (0, vue.renderList)(__props.config.items, (item, index) => {
5403
5509
  return (0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
5404
5510
  key: key(item, index),
5405
5511
  model: name.value ? __props.model[name.value] : __props.model,
@@ -5496,13 +5602,13 @@
5496
5602
  "display": "flex",
5497
5603
  "align-items": "center"
5498
5604
  } };
5499
- var _hoisted_2$5 = ["innerHTML"];
5500
- var _hoisted_3$4 = {
5605
+ var _hoisted_2$6 = ["innerHTML"];
5606
+ var _hoisted_3$5 = {
5501
5607
  key: 0,
5502
5608
  style: { "display": "flex" }
5503
5609
  };
5504
- var _hoisted_4$2 = { style: { "flex": "1" } };
5505
- var _hoisted_5$1 = ["src"];
5610
+ var _hoisted_4$4 = { style: { "flex": "1" } };
5611
+ var _hoisted_5$2 = ["src"];
5506
5612
  //#endregion
5507
5613
  //#region packages/form/src/containers/Panel.vue
5508
5614
  var Panel_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -5517,7 +5623,8 @@
5517
5623
  labelWidth: {},
5518
5624
  prop: {},
5519
5625
  size: {},
5520
- disabled: { type: Boolean }
5626
+ disabled: { type: Boolean },
5627
+ hideExpand: { type: Boolean }
5521
5628
  },
5522
5629
  emits: ["change", "addDiffCount"],
5523
5630
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -5541,26 +5648,31 @@
5541
5648
  return items.value && items.value.length ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicCard), {
5542
5649
  key: 0,
5543
5650
  class: "box-card m-form-panel",
5544
- "body-style": { display: expand.value ? "block" : "none" }
5651
+ "body-style": { display: expand.value ? "block" : "none" },
5652
+ flat: __props.config.flat
5545
5653
  }, {
5546
5654
  header: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$10, [
5547
- (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
5548
- style: { "padding": "0" },
5655
+ !__props.hideExpand ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
5656
+ key: 0,
5657
+ style: {
5658
+ "padding": "0",
5659
+ "margin-right": "10px"
5660
+ },
5549
5661
  link: "",
5550
- icon: expand.value ? (0, vue.unref)(_element_plus_icons_vue.CaretBottom) : (0, vue.unref)(_element_plus_icons_vue.CaretRight),
5662
+ icon: expand.value ? (0, vue.unref)(_element_plus_icons_vue.ArrowDown) : (0, vue.unref)(_element_plus_icons_vue.ArrowRight),
5551
5663
  onClick: _cache[0] || (_cache[0] = ($event) => expand.value = !expand.value)
5552
- }, null, 8, ["icon"]),
5664
+ }, null, 8, ["icon"])) : (0, vue.createCommentVNode)("v-if", true),
5553
5665
  (0, vue.renderSlot)(_ctx.$slots, "header", {}, () => [(0, vue.createElementVNode)("span", {
5554
5666
  style: { "cursor": "pointer" },
5555
5667
  onClick: _cache[1] || (_cache[1] = ($event) => expand.value = !expand.value)
5556
5668
  }, (0, vue.toDisplayString)(filter(__props.config.title)), 1)]),
5557
5669
  __props.config && __props.config.extra ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
5558
- key: 0,
5670
+ key: 1,
5559
5671
  innerHTML: __props.config.extra,
5560
5672
  class: "m-form-tip"
5561
- }, null, 8, _hoisted_2$5)) : (0, vue.createCommentVNode)("v-if", true)
5673
+ }, null, 8, _hoisted_2$6)) : (0, vue.createCommentVNode)("v-if", true)
5562
5674
  ])]),
5563
- default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [(0, vue.renderSlot)(_ctx.$slots, "default"), __props.config.schematic ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$4, [(0, vue.createElementVNode)("div", _hoisted_4$2, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(items.value, (item, index) => {
5675
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [(0, vue.renderSlot)(_ctx.$slots, "default"), __props.config.schematic ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$5, [(0, vue.createElementVNode)("div", _hoisted_4$4, [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(items.value, (item, index) => {
5564
5676
  return (0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
5565
5677
  key: item[(0, vue.unref)(mForm)?.keyProp || "__key"] ?? index,
5566
5678
  config: item,
@@ -5586,7 +5698,7 @@
5586
5698
  }), 128))]), (0, vue.createElementVNode)("img", {
5587
5699
  class: "m-form-schematic",
5588
5700
  src: __props.config.schematic
5589
- }, null, 8, _hoisted_5$1)])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, (0, vue.renderList)(items.value, (item, index) => {
5701
+ }, null, 8, _hoisted_5$2)])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, (0, vue.renderList)(items.value, (item, index) => {
5590
5702
  return (0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
5591
5703
  key: item[(0, vue.unref)(mForm)?.keyProp || "__key"] ?? index,
5592
5704
  config: item,
@@ -5611,7 +5723,7 @@
5611
5723
  ]);
5612
5724
  }), 128))])]),
5613
5725
  _: 3
5614
- }, 8, ["body-style"])) : (0, vue.createCommentVNode)("v-if", true);
5726
+ }, 8, ["body-style", "flat"])) : (0, vue.createCommentVNode)("v-if", true);
5615
5727
  };
5616
5728
  }
5617
5729
  });
@@ -5925,12 +6037,13 @@
5925
6037
  });
5926
6038
  //#endregion
5927
6039
  //#region packages/form/src/containers/GroupListItem.vue?vue&type=script&setup=true&lang.ts
5928
- var _hoisted_1$9 = ["innerHTML"];
5929
- var _hoisted_2$4 = { style: {
6040
+ var _hoisted_1$9 = { class: "m-fields-group-list-item-header" };
6041
+ var _hoisted_2$5 = ["innerHTML"];
6042
+ var _hoisted_3$4 = { style: {
5930
6043
  "text-align": "right",
5931
6044
  "margin-top": "20px"
5932
6045
  } };
5933
- var _hoisted_3$3 = ["innerHTML"];
6046
+ var _hoisted_4$3 = ["innerHTML"];
5934
6047
  //#endregion
5935
6048
  //#region packages/form/src/containers/GroupListItem.vue
5936
6049
  var GroupListItem_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -5969,7 +6082,10 @@
5969
6082
  [mForm?.keyProp || "__key"]: `${props.config[mForm?.keyProp || "__key"]}${String(props.index)}`
5970
6083
  }));
5971
6084
  const title = (0, vue.computed)(() => {
5972
- if (props.config.titleKey && props.model[props.config.titleKey]) return props.model[props.config.titleKey];
6085
+ if (props.config.titleKey && props.model[props.config.titleKey]) {
6086
+ const { titlePrefix } = props.config;
6087
+ return titlePrefix ? `${titlePrefix} ${String(props.index + 1)}: ${props.model[props.config.titleKey]}` : `${props.model[props.config.titleKey]}`;
6088
+ }
5973
6089
  if (props.config.title) return filterFunction(mForm, props.config.title, props);
5974
6090
  return `${props.config.titlePrefix || "组"} ${String(props.index + 1)}`;
5975
6091
  });
@@ -6008,33 +6124,39 @@
6008
6124
  return (_ctx, _cache) => {
6009
6125
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicCard), {
6010
6126
  class: "m-fields-group-list-item",
6127
+ flat: __props.config.flat,
6011
6128
  "body-style": { display: expand.value ? "block" : "none" }
6012
6129
  }, {
6013
- header: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [
6130
+ header: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$9, [
6014
6131
  (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6015
6132
  link: "",
6016
6133
  disabled: __props.disabled,
6017
- onClick: expandHandler
6134
+ onClick: expandHandler,
6135
+ class: "expand-button"
6018
6136
  }, {
6019
6137
  default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), null, {
6020
- default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretBottom), { key: 0 })) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.CaretRight), { key: 1 }))]),
6138
+ default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.ArrowDown), { key: 0 })) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_element_plus_icons_vue.ArrowRight), { key: 1 }))]),
6021
6139
  _: 1
6022
- }), (0, vue.createElementVNode)("span", { innerHTML: title.value }, null, 8, _hoisted_1$9)]),
6140
+ })]),
6023
6141
  _: 1
6024
6142
  }, 8, ["disabled"]),
6025
- !__props.isCompare ? (0, vue.withDirectives)(((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
6026
- key: 0,
6027
- type: "danger",
6028
- size: "small",
6029
- link: "",
6030
- icon: (0, vue.unref)(_element_plus_icons_vue.Delete),
6031
- disabled: __props.disabled,
6032
- onClick: removeHandler
6033
- }, null, 8, ["icon", "disabled"])), [[vue.vShow, showDelete.value]]) : (0, vue.createCommentVNode)("v-if", true),
6143
+ (0, vue.createElementVNode)("span", { innerHTML: title.value }, null, 8, _hoisted_2$5),
6144
+ (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicTooltip), { content: `删除 ${title.value}` }, {
6145
+ default: (0, vue.withCtx)(() => [!__props.isCompare ? (0, vue.withDirectives)(((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
6146
+ key: 0,
6147
+ size: "default",
6148
+ link: "",
6149
+ class: "delete-button",
6150
+ icon: (0, vue.unref)(_element_plus_icons_vue.Delete),
6151
+ disabled: __props.disabled,
6152
+ onClick: removeHandler
6153
+ }, null, 8, ["icon", "disabled"])), [[vue.vShow, showDelete.value]]) : (0, vue.createCommentVNode)("v-if", true)]),
6154
+ _: 1
6155
+ }, 8, ["content"]),
6034
6156
  copyable.value && !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
6035
- key: 1,
6157
+ key: 0,
6036
6158
  link: "",
6037
- size: "small",
6159
+ size: "default",
6038
6160
  type: "primary",
6039
6161
  icon: (0, vue.unref)(_element_plus_icons_vue.DocumentCopy),
6040
6162
  disabled: __props.disabled,
@@ -6043,27 +6165,27 @@
6043
6165
  default: (0, vue.withCtx)(() => [..._cache[6] || (_cache[6] = [(0, vue.createTextVNode)("复制", -1)])]),
6044
6166
  _: 1
6045
6167
  }, 8, ["icon", "disabled"])) : (0, vue.createCommentVNode)("v-if", true),
6046
- movable.value && !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, [(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6168
+ movable.value && !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [(0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6047
6169
  link: "",
6048
- size: "small",
6170
+ size: "default",
6049
6171
  disabled: __props.disabled,
6050
- icon: (0, vue.unref)(_element_plus_icons_vue.CaretTop),
6172
+ icon: (0, vue.unref)(_element_plus_icons_vue.Top),
6051
6173
  onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
6052
6174
  }, {
6053
6175
  default: (0, vue.withCtx)(() => [..._cache[7] || (_cache[7] = [(0, vue.createTextVNode)("上移", -1)])]),
6054
6176
  _: 1
6055
6177
  }, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== 0]]), (0, vue.withDirectives)((0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6056
6178
  link: "",
6057
- size: "small",
6179
+ size: "default",
6058
6180
  disabled: __props.disabled,
6059
- icon: (0, vue.unref)(_element_plus_icons_vue.CaretBottom),
6181
+ icon: (0, vue.unref)(_element_plus_icons_vue.Bottom),
6060
6182
  onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
6061
6183
  }, {
6062
6184
  default: (0, vue.withCtx)(() => [..._cache[8] || (_cache[8] = [(0, vue.createTextVNode)("下移", -1)])]),
6063
6185
  _: 1
6064
6186
  }, 8, ["disabled", "icon"]), [[vue.vShow, __props.index !== length.value - 1]])], 64)) : (0, vue.createCommentVNode)("v-if", true),
6065
6187
  __props.config.moveSpecifyLocation && !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicPopover), {
6066
- key: 3,
6188
+ key: 2,
6067
6189
  trigger: "click",
6068
6190
  placement: "top",
6069
6191
  width: "200",
@@ -6091,7 +6213,7 @@
6091
6213
  disabled: __props.disabled
6092
6214
  }, null, 8, ["modelValue", "disabled"]),
6093
6215
  _cache[11] || (_cache[11] = (0, vue.createTextVNode)("行 ", -1))
6094
- ]), (0, vue.createElementVNode)("div", _hoisted_2$4, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6216
+ ]), (0, vue.createElementVNode)("div", _hoisted_3$4, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
6095
6217
  size: "small",
6096
6218
  text: "",
6097
6219
  onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
@@ -6109,10 +6231,10 @@
6109
6231
  _: 1
6110
6232
  }, 8, ["visible"])) : (0, vue.createCommentVNode)("v-if", true),
6111
6233
  itemExtra.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
6112
- key: 4,
6234
+ key: 3,
6113
6235
  innerHTML: itemExtra.value,
6114
6236
  class: "m-form-tip"
6115
- }, null, 8, _hoisted_3$3)) : (0, vue.createCommentVNode)("v-if", true)
6237
+ }, null, 8, _hoisted_4$3)) : (0, vue.createCommentVNode)("v-if", true)
6116
6238
  ])]),
6117
6239
  default: (0, vue.withCtx)(() => [expand.value ? ((0, vue.openBlock)(), (0, vue.createBlock)(Container_default, {
6118
6240
  key: 0,
@@ -6137,23 +6259,24 @@
6137
6259
  "disabled"
6138
6260
  ])) : (0, vue.createCommentVNode)("v-if", true)]),
6139
6261
  _: 1
6140
- }, 8, ["body-style"]);
6262
+ }, 8, ["flat", "body-style"]);
6141
6263
  };
6142
6264
  }
6143
6265
  });
6144
6266
  //#endregion
6145
6267
  //#region packages/form/src/containers/GroupList.vue?vue&type=script&setup=true&lang.ts
6146
6268
  var _hoisted_1$8 = { class: "m-fields-group-list" };
6147
- var _hoisted_2$3 = ["innerHTML"];
6148
- var _hoisted_3$2 = {
6269
+ var _hoisted_2$4 = ["innerHTML"];
6270
+ var _hoisted_3$3 = {
6149
6271
  key: 1,
6150
6272
  class: "el-table__empty-block"
6151
6273
  };
6152
- var _hoisted_4$1 = {
6274
+ var _hoisted_4$2 = { class: "el-table__empty-text t-table__empty" };
6275
+ var _hoisted_5$1 = {
6153
6276
  key: 3,
6154
6277
  class: "m-fields-group-list-footer"
6155
6278
  };
6156
- var _hoisted_5 = { style: {
6279
+ var _hoisted_6$1 = { style: {
6157
6280
  "display": "flex",
6158
6281
  "justify-content": "flex-end",
6159
6282
  "flex": "1"
@@ -6205,8 +6328,8 @@
6205
6328
  key: 0,
6206
6329
  innerHTML: __props.config.extra,
6207
6330
  style: { "color": "rgba(0, 0, 0, 0.45)" }
6208
- }, null, 8, _hoisted_2$3)) : (0, vue.createCommentVNode)("v-if", true),
6209
- !__props.model[__props.name] || !__props.model[__props.name].length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$2, [..._cache[1] || (_cache[1] = [(0, vue.createElementVNode)("span", { class: "el-table__empty-text t-table__empty" }, "暂无数据", -1)])])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)(__props.model[__props.name], (item, index) => {
6331
+ }, null, 8, _hoisted_2$4)) : (0, vue.createCommentVNode)("v-if", true),
6332
+ !__props.model[__props.name] || !__props.model[__props.name].length ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3$3, [(0, vue.createElementVNode)("span", _hoisted_4$2, "暂无" + (0, vue.toDisplayString)(__props.config.titlePrefix || "") + "数据", 1)])) : ((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, { key: 2 }, (0, vue.renderList)(__props.model[__props.name], (item, index) => {
6210
6333
  return (0, vue.openBlock)(), (0, vue.createBlock)(GroupListItem_default, {
6211
6334
  key: index,
6212
6335
  model: item,
@@ -6237,7 +6360,7 @@
6237
6360
  "group-model"
6238
6361
  ]);
6239
6362
  }), 128)),
6240
- !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$1, [(0, vue.renderSlot)(_ctx.$slots, "toggle-button"), (0, vue.createElementVNode)("div", _hoisted_5, [(0, vue.renderSlot)(_ctx.$slots, "add-button")])])) : (0, vue.createCommentVNode)("v-if", true)
6363
+ !__props.isCompare ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_5$1, [(0, vue.renderSlot)(_ctx.$slots, "toggle-button"), (0, vue.createElementVNode)("div", _hoisted_6$1, [(0, vue.renderSlot)(_ctx.$slots, "add-button")])])) : (0, vue.createCommentVNode)("v-if", true)
6241
6364
  ]);
6242
6365
  };
6243
6366
  }
@@ -6399,7 +6522,8 @@
6399
6522
  index: {},
6400
6523
  row: {},
6401
6524
  prop: {},
6402
- sortKey: {}
6525
+ sortKey: {},
6526
+ flat: { type: Boolean }
6403
6527
  },
6404
6528
  emits: ["change"],
6405
6529
  setup(__props, { emit: __emit }) {
@@ -6470,19 +6594,25 @@
6470
6594
  type: "danger",
6471
6595
  link: "",
6472
6596
  title: "删除",
6473
- icon: __props.config.deleteActionButtonIcon || (0, vue.unref)(_element_plus_icons_vue.Delete),
6597
+ icon: __props.flat ? void 0 : __props.config.deleteActionButtonIcon || (0, vue.unref)(_element_plus_icons_vue.Delete),
6474
6598
  onClick: _cache[0] || (_cache[0] = ($event) => removeHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
6475
- }, null, 8, ["icon"]), [[vue.vShow, showDelete(__props.index + 1 + __props.currentPage * __props.pageSize - 1)]]),
6599
+ }, {
6600
+ default: (0, vue.withCtx)(() => [__props.flat ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createTextVNode)("删除")], 64)) : (0, vue.createCommentVNode)("v-if", true)]),
6601
+ _: 1
6602
+ }, 8, ["icon"]), [[vue.vShow, showDelete(__props.index + 1 + __props.currentPage * __props.pageSize - 1)]]),
6476
6603
  copyable(__props.index + 1 + __props.currentPage * __props.pageSize - 1) ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
6477
6604
  key: 1,
6478
6605
  link: "",
6479
6606
  size: "small",
6480
6607
  type: "primary",
6481
6608
  title: "复制",
6482
- icon: __props.config.copyActionButtonIcon || (0, vue.unref)(_element_plus_icons_vue.DocumentCopy),
6609
+ icon: __props.flat ? void 0 : __props.config.copyActionButtonIcon || (0, vue.unref)(_element_plus_icons_vue.DocumentCopy),
6483
6610
  disabled: __props.disabled,
6484
6611
  onClick: _cache[1] || (_cache[1] = ($event) => copyHandler(__props.index + 1 + __props.currentPage * __props.pageSize - 1))
6485
- }, null, 8, ["icon", "disabled"])) : (0, vue.createCommentVNode)("v-if", true)
6612
+ }, {
6613
+ default: (0, vue.withCtx)(() => [__props.flat ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.createTextVNode)("复制")], 64)) : (0, vue.createCommentVNode)("v-if", true)]),
6614
+ _: 1
6615
+ }, 8, ["icon", "disabled"])) : (0, vue.createCommentVNode)("v-if", true)
6486
6616
  ], 64);
6487
6617
  };
6488
6618
  }
@@ -6632,8 +6762,10 @@
6632
6762
  type: "selection",
6633
6763
  width: 45
6634
6764
  } });
6635
- let actionFixed = props.config.fixed === false ? void 0 : "left";
6765
+ const defaultFixed = isGlobalFlat.value ? "right" : "left";
6766
+ let actionFixed = props.config.fixed === false ? void 0 : defaultFixed;
6636
6767
  if (typeof props.config.fixed === "string" && ["left", "right"].includes(props.config.fixed)) actionFixed = props.config.fixed;
6768
+ const actionFlat = props.config.flat === void 0 && isGlobalFlat.value ? true : props.config.flat;
6637
6769
  const actionColumn = {
6638
6770
  props: {
6639
6771
  label: "操作",
@@ -6643,6 +6775,7 @@
6643
6775
  },
6644
6776
  cell: ({ row, $index }) => (0, vue.h)(ActionsColumn_default, {
6645
6777
  row,
6778
+ flat: actionFlat,
6646
6779
  index: $index,
6647
6780
  model: props.model,
6648
6781
  config: props.config,
@@ -6725,13 +6858,13 @@
6725
6858
  //#endregion
6726
6859
  //#region packages/form/src/containers/table/Table.vue?vue&type=script&setup=true&lang.ts
6727
6860
  var _hoisted_1$7 = ["innerHTML"];
6728
- var _hoisted_2$2 = { style: {
6861
+ var _hoisted_2$3 = { style: {
6729
6862
  "display": "flex",
6730
6863
  "justify-content": "space-between",
6731
6864
  "margin": "10px 0"
6732
6865
  } };
6733
- var _hoisted_3$1 = { style: { "display": "flex" } };
6734
- var _hoisted_4 = {
6866
+ var _hoisted_3$2 = { style: { "display": "flex" } };
6867
+ var _hoisted_4$1 = {
6735
6868
  key: 1,
6736
6869
  class: "bottom",
6737
6870
  style: { "text-align": "right" }
@@ -6816,19 +6949,21 @@
6816
6949
  "default-expand-all": true,
6817
6950
  key: updateKey.value,
6818
6951
  onSelect: (0, vue.unref)(selectHandle),
6819
- onSortChange: sortChangeHandler
6952
+ onSortChange: sortChangeHandler,
6953
+ "empty-text": `暂无${__props.config.titlePrefix || ""}数据`
6820
6954
  }, null, 8, [
6821
6955
  "row-key",
6822
6956
  "columns",
6823
6957
  "data",
6824
6958
  "border",
6825
6959
  "max-height",
6826
- "onSelect"
6960
+ "onSelect",
6961
+ "empty-text"
6827
6962
  ])) : (0, vue.createCommentVNode)("v-if", true)]),
6828
6963
  _: 1
6829
6964
  }, 8, ["disabled"]),
6830
6965
  (0, vue.renderSlot)(_ctx.$slots, "default"),
6831
- (0, vue.createElementVNode)("div", _hoisted_2$2, [(0, vue.createElementVNode)("div", _hoisted_3$1, [
6966
+ (0, vue.createElementVNode)("div", _hoisted_2$3, [(0, vue.createElementVNode)("div", _hoisted_3$2, [
6832
6967
  !(0, vue.unref)(isFullscreen) ? (0, vue.renderSlot)(_ctx.$slots, "toggle-button", {}, void 0, void 0, 0) : (0, vue.createCommentVNode)("v-if", true),
6833
6968
  __props.config.enableFullscreen !== false ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
6834
6969
  key: 1,
@@ -6871,7 +7006,7 @@
6871
7006
  _: 1
6872
7007
  }, 8, ["disabled", "onClick"])) : (0, vue.createCommentVNode)("v-if", true)
6873
7008
  ]), !__props.isCompare ? (0, vue.renderSlot)(_ctx.$slots, "add-button", {}, void 0, void 0, 0) : (0, vue.createCommentVNode)("v-if", true)]),
6874
- __props.config.pagination ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPagination), {
7009
+ __props.config.pagination ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_4$1, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicPagination), {
6875
7010
  layout: "total, sizes, prev, pager, next, jumper",
6876
7011
  "hide-on-single-page": __props.model[modelName.value].length < (0, vue.unref)(pageSize),
6877
7012
  "current-page": (0, vue.unref)(currentPage) + 1,
@@ -7091,9 +7226,10 @@
7091
7226
  size: addButtonSize.value,
7092
7227
  plain: displayMode.value === "table",
7093
7228
  icon: (0, vue.unref)(_element_plus_icons_vue.Plus),
7229
+ text: "",
7094
7230
  disabled: __props.disabled
7095
7231
  }, currentConfig.value.addButtonConfig?.props || { type: "primary" }, { onClick: (0, vue.unref)(newHandler) }), {
7096
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(currentConfig.value.addButtonConfig?.text || (displayMode.value === "table" ? "新增一行" : "新增")), 1)]),
7232
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(currentConfig.value.addButtonConfig?.text || (displayMode.value === "table" ? `新增一行${groupListConfig.value.titlePrefix || ""}` : `新增${groupListConfig.value.titlePrefix || ""}`)), 1)]),
7097
7233
  _: 1
7098
7234
  }, 16, [
7099
7235
  "class",
@@ -7123,9 +7259,17 @@
7123
7259
  });
7124
7260
  //#endregion
7125
7261
  //#region packages/form/src/fields/Text.vue?vue&type=script&setup=true&lang.ts
7126
- var _hoisted_1$6 = { class: "m-fields-text" };
7127
- var _hoisted_2$1 = { key: 1 };
7128
- var _hoisted_3 = { style: {
7262
+ var _hoisted_1$6 = { key: 0 };
7263
+ var _hoisted_2$2 = {
7264
+ key: 0,
7265
+ class: "m-fields-text__prepend"
7266
+ };
7267
+ var _hoisted_3$1 = { class: "m-fields-text__value" };
7268
+ var _hoisted_4 = ["src"];
7269
+ var _hoisted_5 = { key: 2 };
7270
+ var _hoisted_6 = ["src"];
7271
+ var _hoisted_7 = { key: 2 };
7272
+ var _hoisted_8 = { style: {
7129
7273
  "display": "flex",
7130
7274
  "justify-content": "flex-end"
7131
7275
  } };
@@ -7144,7 +7288,10 @@
7144
7288
  disabled: { type: Boolean },
7145
7289
  size: {},
7146
7290
  lastValues: {},
7147
- isCompare: { type: Boolean }
7291
+ isCompare: { type: Boolean },
7292
+ text: {},
7293
+ labelWidth: {},
7294
+ labelPosition: {}
7148
7295
  },
7149
7296
  emits: ["change", "input"],
7150
7297
  setup(__props, { emit: __emit }) {
@@ -7157,21 +7304,15 @@
7157
7304
  value.value = v;
7158
7305
  }, { immediate: true });
7159
7306
  const appendConfig = (0, vue.computed)(() => {
7160
- if (typeof props.config.append === "string") return {
7307
+ const { append } = props.config;
7308
+ if (typeof append === "string") return {
7161
7309
  type: "text",
7162
- text: props.config.append,
7310
+ text: append,
7163
7311
  handler: void 0
7164
7312
  };
7165
- if (typeof props.config.append === "object") {
7166
- if (typeof props.config.append?.handler === "function") return {
7167
- type: "button",
7168
- text: props.config.append.text,
7169
- handler: props.config.append.handler
7170
- };
7171
- if (props.config.append) {
7172
- if (props.config.append.value === 0) return false;
7173
- return props.config.append;
7174
- }
7313
+ if (typeof append === "object" && append) {
7314
+ if (append.value === 0) return false;
7315
+ return append;
7175
7316
  }
7176
7317
  return false;
7177
7318
  });
@@ -7267,67 +7408,97 @@
7267
7408
  instanceRef.value = void 0;
7268
7409
  };
7269
7410
  return (_ctx, _cache) => {
7270
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$6, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicInput), {
7271
- modelValue: value.value,
7272
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
7273
- ref_key: "input",
7274
- ref: input,
7275
- clearable: __props.config.clearable ?? true,
7276
- size: __props.size,
7277
- placeholder: __props.config.placeholder,
7278
- disabled: __props.disabled,
7279
- onChange: changeHandler,
7280
- onInput: inputHandler,
7281
- onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
7282
- }, (0, vue.createSlots)({ _: 2 }, [__props.config.prepend ? {
7283
- name: "prepend",
7284
- fn: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.config.prepend), 1)]),
7285
- key: "0"
7286
- } : void 0, appendConfig.value ? {
7287
- name: "append",
7288
- fn: (0, vue.withCtx)(() => [appendConfig.value.type === "button" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
7289
- key: 0,
7290
- style: { "color": "#409eff" },
7411
+ return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", { class: (0, vue.normalizeClass)(["m-fields-text", { "m-fields-text--static": __props.config.static }]) }, [
7412
+ __props.config.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_1$6)) : (0, vue.createCommentVNode)("v-if", true),
7413
+ (0, vue.createCommentVNode)(" 新增静态展示文本样式 "),
7414
+ __props.config.static ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [
7415
+ __props.config.prepend ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$2, (0, vue.toDisplayString)(__props.config.prepend), 1)) : (0, vue.createCommentVNode)("v-if", true),
7416
+ (0, vue.createElementVNode)("span", _hoisted_3$1, (0, vue.toDisplayString)(value.value), 1),
7417
+ appendConfig.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 1 }, [appendConfig.value.type === "button" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
7418
+ key: 0,
7419
+ style: { "color": "#0056ea" },
7420
+ size: __props.size,
7421
+ onClick: (0, vue.withModifiers)(buttonClickHandler, ["prevent"])
7422
+ }, {
7423
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(appendConfig.value.text), 1)]),
7424
+ _: 1
7425
+ }, 8, ["size"])) : appendConfig.value.type === "icon" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("img", {
7426
+ key: 1,
7427
+ class: "m-fields-text__icon",
7428
+ src: appendConfig.value.text,
7429
+ onClick: buttonClickHandler
7430
+ }, null, 8, _hoisted_4)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_5, (0, vue.toDisplayString)(appendConfig.value.text), 1))], 64)) : (0, vue.createCommentVNode)("v-if", true)
7431
+ ], 64)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicInput), {
7432
+ key: 2,
7433
+ modelValue: value.value,
7434
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
7435
+ ref_key: "input",
7436
+ ref: input,
7437
+ clearable: __props.config.clearable ?? true,
7291
7438
  size: __props.size,
7292
- onClick: (0, vue.withModifiers)(buttonClickHandler, ["prevent"])
7293
- }, {
7294
- default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(appendConfig.value.text), 1)]),
7295
- _: 1
7296
- }, 8, ["size"])) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$1, (0, vue.toDisplayString)(appendConfig.value.text), 1))]),
7297
- key: "1"
7298
- } : void 0]), 1032, [
7299
- "modelValue",
7300
- "clearable",
7301
- "size",
7302
- "placeholder",
7303
- "disabled"
7304
- ]), ((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, { to: "body" }, [popoverVisible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
7305
- key: 0,
7306
- class: "tmagic-form-text-popper m-form-item__content",
7307
- ref_key: "popoverEl",
7308
- ref: popoverEl
7309
- }, [
7310
- _cache[5] || (_cache[5] = (0, vue.createElementVNode)("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1)),
7311
- (0, vue.createElementVNode)("div", _hoisted_3, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
7312
- link: "",
7313
- size: "small",
7314
- onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
7315
- }, {
7316
- default: (0, vue.withCtx)(() => [..._cache[3] || (_cache[3] = [(0, vue.createTextVNode)("保持原样", -1)])]),
7317
- _: 1
7318
- }), (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
7319
- type: "primary",
7320
- size: "small",
7321
- onClick: confirmTrimHandler
7322
- }, {
7323
- default: (0, vue.withCtx)(() => [..._cache[4] || (_cache[4] = [(0, vue.createTextVNode)("移除空格", -1)])]),
7324
- _: 1
7325
- })]),
7326
- _cache[6] || (_cache[6] = (0, vue.createElementVNode)("span", {
7327
- class: "tmagic-form-text-popper-arrow",
7328
- "data-popper-arrow": ""
7329
- }, null, -1))
7330
- ], 512)) : (0, vue.createCommentVNode)("v-if", true)]))]);
7439
+ placeholder: __props.config.placeholder,
7440
+ disabled: __props.disabled,
7441
+ onChange: changeHandler,
7442
+ onInput: inputHandler,
7443
+ onKeyup: _cache[1] || (_cache[1] = ($event) => keyUpHandler($event))
7444
+ }, (0, vue.createSlots)({ _: 2 }, [__props.config.prepend ? {
7445
+ name: "prepend",
7446
+ fn: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("span", null, (0, vue.toDisplayString)(__props.config.prepend), 1)]),
7447
+ key: "0"
7448
+ } : void 0, appendConfig.value ? {
7449
+ name: "append",
7450
+ fn: (0, vue.withCtx)(() => [appendConfig.value.type === "button" ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicButton), {
7451
+ key: 0,
7452
+ style: { "color": "#0056ea" },
7453
+ size: __props.size,
7454
+ onClick: (0, vue.withModifiers)(buttonClickHandler, ["prevent"])
7455
+ }, {
7456
+ default: (0, vue.withCtx)(() => [(0, vue.createTextVNode)((0, vue.toDisplayString)(appendConfig.value.text), 1)]),
7457
+ _: 1
7458
+ }, 8, ["size"])) : appendConfig.value.type === "icon" ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("img", {
7459
+ key: 1,
7460
+ src: appendConfig.value.text,
7461
+ onClick: buttonClickHandler
7462
+ }, null, 8, _hoisted_6)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_7, (0, vue.toDisplayString)(appendConfig.value.text), 1))]),
7463
+ key: "1"
7464
+ } : void 0]), 1032, [
7465
+ "modelValue",
7466
+ "clearable",
7467
+ "size",
7468
+ "placeholder",
7469
+ "disabled"
7470
+ ])),
7471
+ !__props.config.static ? ((0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
7472
+ key: 3,
7473
+ to: "body"
7474
+ }, [popoverVisible.value ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
7475
+ key: 0,
7476
+ class: "tmagic-form-text-popper m-form-item__content",
7477
+ ref_key: "popoverEl",
7478
+ ref: popoverEl
7479
+ }, [
7480
+ _cache[5] || (_cache[5] = (0, vue.createElementVNode)("div", { class: "m-form-validate__warning" }, "输入内容前后有空格,是否移除空格?", -1)),
7481
+ (0, vue.createElementVNode)("div", _hoisted_8, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
7482
+ link: "",
7483
+ size: "small",
7484
+ onClick: _cache[2] || (_cache[2] = ($event) => popoverVisible.value = false)
7485
+ }, {
7486
+ default: (0, vue.withCtx)(() => [..._cache[3] || (_cache[3] = [(0, vue.createTextVNode)("保持原样", -1)])]),
7487
+ _: 1
7488
+ }), (0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
7489
+ type: "primary",
7490
+ size: "small",
7491
+ onClick: confirmTrimHandler
7492
+ }, {
7493
+ default: (0, vue.withCtx)(() => [..._cache[4] || (_cache[4] = [(0, vue.createTextVNode)("移除空格", -1)])]),
7494
+ _: 1
7495
+ })]),
7496
+ _cache[6] || (_cache[6] = (0, vue.createElementVNode)("span", {
7497
+ class: "tmagic-form-text-popper-arrow",
7498
+ "data-popper-arrow": ""
7499
+ }, null, -1))
7500
+ ], 512)) : (0, vue.createCommentVNode)("v-if", true)])) : (0, vue.createCommentVNode)("v-if", true)
7501
+ ], 2);
7331
7502
  };
7332
7503
  }
7333
7504
  });
@@ -7346,7 +7517,10 @@
7346
7517
  disabled: { type: Boolean },
7347
7518
  size: {},
7348
7519
  lastValues: {},
7349
- isCompare: { type: Boolean }
7520
+ isCompare: { type: Boolean },
7521
+ text: {},
7522
+ labelWidth: {},
7523
+ labelPosition: {}
7350
7524
  },
7351
7525
  emits: ["change", "input"],
7352
7526
  setup(__props, { emit: __emit }) {
@@ -7371,7 +7545,7 @@
7371
7545
  modelValue: value.value,
7372
7546
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event),
7373
7547
  clearable: "",
7374
- "controls-position": "right",
7548
+ "controls-position": (0, vue.unref)(isGlobalFlat) ? "" : "right",
7375
7549
  size: __props.size,
7376
7550
  max: __props.config.max,
7377
7551
  min: __props.config.min,
@@ -7382,6 +7556,7 @@
7382
7556
  onInput: inputHandler
7383
7557
  }, null, 8, [
7384
7558
  "modelValue",
7559
+ "controls-position",
7385
7560
  "size",
7386
7561
  "max",
7387
7562
  "min",
@@ -7410,7 +7585,10 @@
7410
7585
  disabled: { type: Boolean },
7411
7586
  size: {},
7412
7587
  lastValues: {},
7413
- isCompare: { type: Boolean }
7588
+ isCompare: { type: Boolean },
7589
+ text: {},
7590
+ labelWidth: {},
7591
+ labelPosition: {}
7414
7592
  },
7415
7593
  emits: ["change"],
7416
7594
  setup(__props, { emit: __emit }) {
@@ -7481,7 +7659,10 @@
7481
7659
  disabled: { type: Boolean },
7482
7660
  size: {},
7483
7661
  lastValues: {},
7484
- isCompare: { type: Boolean }
7662
+ isCompare: { type: Boolean },
7663
+ text: {},
7664
+ labelWidth: {},
7665
+ labelPosition: {}
7485
7666
  },
7486
7667
  emits: ["change", "input"],
7487
7668
  setup(__props, { emit: __emit }) {
@@ -7537,7 +7718,10 @@
7537
7718
  disabled: { type: Boolean },
7538
7719
  size: {},
7539
7720
  lastValues: {},
7540
- isCompare: { type: Boolean }
7721
+ isCompare: { type: Boolean },
7722
+ text: {},
7723
+ labelWidth: {},
7724
+ labelPosition: {}
7541
7725
  },
7542
7726
  emits: ["change"],
7543
7727
  setup(__props, { emit: __emit }) {
@@ -7584,7 +7768,10 @@
7584
7768
  disabled: { type: Boolean },
7585
7769
  size: {},
7586
7770
  lastValues: {},
7587
- isCompare: { type: Boolean }
7771
+ isCompare: { type: Boolean },
7772
+ text: {},
7773
+ labelWidth: {},
7774
+ labelPosition: {}
7588
7775
  },
7589
7776
  emits: ["change"],
7590
7777
  setup(__props, { emit: __emit }) {
@@ -7636,7 +7823,10 @@
7636
7823
  disabled: { type: Boolean },
7637
7824
  size: {},
7638
7825
  lastValues: {},
7639
- isCompare: { type: Boolean }
7826
+ isCompare: { type: Boolean },
7827
+ text: {},
7828
+ labelWidth: {},
7829
+ labelPosition: {}
7640
7830
  },
7641
7831
  emits: ["change"],
7642
7832
  setup(__props, { emit: __emit }) {
@@ -7681,7 +7871,10 @@
7681
7871
  disabled: { type: Boolean },
7682
7872
  size: {},
7683
7873
  lastValues: {},
7684
- isCompare: { type: Boolean }
7874
+ isCompare: { type: Boolean },
7875
+ text: {},
7876
+ labelWidth: {},
7877
+ labelPosition: {}
7685
7878
  },
7686
7879
  emits: ["change"],
7687
7880
  setup(__props, { emit: __emit }) {
@@ -7738,7 +7931,10 @@
7738
7931
  disabled: { type: Boolean },
7739
7932
  size: {},
7740
7933
  lastValues: {},
7741
- isCompare: { type: Boolean }
7934
+ isCompare: { type: Boolean },
7935
+ text: {},
7936
+ labelWidth: {},
7937
+ labelPosition: {}
7742
7938
  },
7743
7939
  emits: ["change"],
7744
7940
  setup(__props, { emit: __emit }) {
@@ -7793,7 +7989,10 @@
7793
7989
  disabled: { type: Boolean },
7794
7990
  size: {},
7795
7991
  lastValues: {},
7796
- isCompare: { type: Boolean }
7992
+ isCompare: { type: Boolean },
7993
+ text: {},
7994
+ labelWidth: {},
7995
+ labelPosition: {}
7797
7996
  },
7798
7997
  emits: ["change"],
7799
7998
  setup(__props, { emit: __emit }) {
@@ -7887,7 +8086,10 @@
7887
8086
  disabled: { type: Boolean },
7888
8087
  size: {},
7889
8088
  lastValues: {},
7890
- isCompare: { type: Boolean }
8089
+ isCompare: { type: Boolean },
8090
+ text: {},
8091
+ labelWidth: {},
8092
+ labelPosition: {}
7891
8093
  },
7892
8094
  emits: ["change"],
7893
8095
  setup(__props, { emit: __emit }) {
@@ -7981,7 +8183,10 @@
7981
8183
  disabled: { type: Boolean },
7982
8184
  size: {},
7983
8185
  lastValues: {},
7984
- isCompare: { type: Boolean }
8186
+ isCompare: { type: Boolean },
8187
+ text: {},
8188
+ labelWidth: {},
8189
+ labelPosition: {}
7985
8190
  },
7986
8191
  emits: ["change"],
7987
8192
  setup(__props, { emit: __emit }) {
@@ -8019,7 +8224,10 @@
8019
8224
  disabled: { type: Boolean },
8020
8225
  size: {},
8021
8226
  lastValues: {},
8022
- isCompare: { type: Boolean }
8227
+ isCompare: { type: Boolean },
8228
+ text: {},
8229
+ labelWidth: {},
8230
+ labelPosition: {}
8023
8231
  },
8024
8232
  emits: ["change"],
8025
8233
  setup(__props, { emit: __emit }) {
@@ -8064,7 +8272,11 @@
8064
8272
  });
8065
8273
  //#endregion
8066
8274
  //#region packages/form/src/fields/RadioGroup.vue?vue&type=script&setup=true&lang.ts
8067
- var _hoisted_1$4 = { key: 1 };
8275
+ var _hoisted_1$4 = { class: "m-fields-radio-group__option" };
8276
+ var _hoisted_2$1 = {
8277
+ key: 1,
8278
+ class: "m-fields-radio-group__text"
8279
+ };
8068
8280
  //#endregion
8069
8281
  //#region packages/form/src/fields/RadioGroup.vue
8070
8282
  var RadioGroup_default = /* @__PURE__ */ (0, vue.defineComponent)({
@@ -8080,7 +8292,10 @@
8080
8292
  disabled: { type: Boolean },
8081
8293
  size: {},
8082
8294
  lastValues: {},
8083
- isCompare: { type: Boolean }
8295
+ isCompare: { type: Boolean },
8296
+ text: {},
8297
+ labelWidth: {},
8298
+ labelPosition: {}
8084
8299
  },
8085
8300
  emits: ["change"],
8086
8301
  setup(__props, { emit: __emit }) {
@@ -8093,16 +8308,18 @@
8093
8308
  };
8094
8309
  useAddField(props.prop);
8095
8310
  const iconSize = (0, vue.computed)(() => {
8096
- if (props.size === "small") return "12";
8311
+ if (props.config.iconSize) return props.config.iconSize;
8312
+ if (props.size === "small") return "14";
8097
8313
  if (props.size === "large") return "16";
8098
- return "14";
8314
+ return "16";
8099
8315
  });
8100
8316
  return (_ctx, _cache) => {
8101
8317
  return __props.model ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicRadioGroup), {
8102
8318
  key: 0,
8103
8319
  "model-value": __props.model[__props.name],
8104
8320
  size: __props.size,
8105
- disabled: __props.disabled
8321
+ disabled: __props.disabled,
8322
+ class: "icon-{{ iconSize }}"
8106
8323
  }, {
8107
8324
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(true), (0, vue.createElementBlock)(vue.Fragment, null, (0, vue.renderList)(__props.config.options, (option) => {
8108
8325
  return (0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(itemComponent.value), {
@@ -8115,13 +8332,14 @@
8115
8332
  placement: "top-start",
8116
8333
  content: option.tooltip
8117
8334
  }, {
8118
- default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", null, [option.icon ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicIcon), {
8335
+ default: (0, vue.withCtx)(() => [(0, vue.createElementVNode)("div", _hoisted_1$4, [option.icon ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_tmagic_design.TMagicIcon), {
8119
8336
  key: 0,
8120
- size: iconSize.value
8337
+ size: iconSize.value,
8338
+ class: (0, vue.normalizeClass)({ "m-fields-radio-group__icon_with_text": !!option.text })
8121
8339
  }, {
8122
8340
  default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(option.icon)))]),
8123
8341
  _: 2
8124
- }, 1032, ["size"])) : (0, vue.createCommentVNode)("v-if", true), option.text ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_1$4, (0, vue.toDisplayString)(option.text), 1)) : (0, vue.createCommentVNode)("v-if", true)])]),
8342
+ }, 1032, ["size", "class"])) : (0, vue.createCommentVNode)("v-if", true), option.text ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_2$1, (0, vue.toDisplayString)(option.text), 1)) : (0, vue.createCommentVNode)("v-if", true)])]),
8125
8343
  _: 2
8126
8344
  }, 1032, ["disabled", "content"])]),
8127
8345
  _: 2
@@ -8154,7 +8372,10 @@
8154
8372
  disabled: { type: Boolean },
8155
8373
  size: {},
8156
8374
  lastValues: {},
8157
- isCompare: { type: Boolean }
8375
+ isCompare: { type: Boolean },
8376
+ text: {},
8377
+ labelWidth: {},
8378
+ labelPosition: {}
8158
8379
  },
8159
8380
  setup(__props) {
8160
8381
  const props = __props;
@@ -8173,8 +8394,9 @@
8173
8394
  //#endregion
8174
8395
  //#region packages/form/src/fields/Link.vue?vue&type=script&setup=true&lang.ts
8175
8396
  var _hoisted_1$2 = ["href"];
8176
- var _hoisted_2 = {
8177
- key: 2,
8397
+ var _hoisted_2 = ["href"];
8398
+ var _hoisted_3 = {
8399
+ key: 3,
8178
8400
  class: "m-fields-link"
8179
8401
  };
8180
8402
  //#endregion
@@ -8192,7 +8414,11 @@
8192
8414
  disabled: { type: Boolean },
8193
8415
  size: {},
8194
8416
  lastValues: {},
8195
- isCompare: { type: Boolean }
8417
+ isCompare: { type: Boolean },
8418
+ text: {},
8419
+ labelWidth: {},
8420
+ labelPosition: {},
8421
+ theme: {}
8196
8422
  },
8197
8423
  emits: ["change"],
8198
8424
  setup(__props, { emit: __emit }) {
@@ -8235,15 +8461,30 @@
8235
8461
  editor.value && (editor.value.dialogVisible = false);
8236
8462
  };
8237
8463
  return (_ctx, _cache) => {
8238
- return __props.config.href && !__props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
8464
+ return (0, vue.unref)(isGlobalFlat) && __props.config.href && !__props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
8239
8465
  key: 0,
8240
8466
  target: "_blank",
8241
8467
  href: href.value,
8468
+ class: "magic-admin-link",
8242
8469
  style: (0, vue.normalizeStyle)(__props.config.css || {})
8243
- }, (0, vue.toDisplayString)(displayText.value), 13, _hoisted_1$2)) : __props.config.href && __props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
8470
+ }, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
8471
+ link: "",
8472
+ type: "primary"
8473
+ }, {
8474
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicIcon), null, {
8475
+ default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_element_plus_icons_vue.Notebook))]),
8476
+ _: 1
8477
+ }), (0, vue.createTextVNode)((0, vue.toDisplayString)(displayText.value), 1)]),
8478
+ _: 1
8479
+ })], 12, _hoisted_1$2)) : __props.config.href && !__props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("a", {
8244
8480
  key: 1,
8481
+ target: "_blank",
8482
+ href: href.value,
8483
+ style: (0, vue.normalizeStyle)(__props.config.css || {})
8484
+ }, (0, vue.toDisplayString)(displayText.value), 13, _hoisted_2)) : __props.config.href && __props.disabled ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", {
8485
+ key: 2,
8245
8486
  style: (0, vue.normalizeStyle)(__props.config.disabledCss || {})
8246
- }, (0, vue.toDisplayString)(displayText.value), 5)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_2, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
8487
+ }, (0, vue.toDisplayString)(displayText.value), 5)) : ((0, vue.openBlock)(), (0, vue.createElementBlock)("div", _hoisted_3, [(0, vue.createVNode)((0, vue.unref)(_tmagic_design.TMagicButton), {
8247
8488
  link: "",
8248
8489
  type: "primary",
8249
8490
  onClick: editHandler
@@ -8289,7 +8530,10 @@
8289
8530
  disabled: { type: Boolean },
8290
8531
  size: {},
8291
8532
  lastValues: {},
8292
- isCompare: { type: Boolean }
8533
+ isCompare: { type: Boolean },
8534
+ text: {},
8535
+ labelWidth: {},
8536
+ labelPosition: {}
8293
8537
  },
8294
8538
  emits: ["change"],
8295
8539
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -8638,7 +8882,10 @@
8638
8882
  disabled: { type: Boolean },
8639
8883
  size: {},
8640
8884
  lastValues: {},
8641
- isCompare: { type: Boolean }
8885
+ isCompare: { type: Boolean },
8886
+ text: {},
8887
+ labelWidth: {},
8888
+ labelPosition: {}
8642
8889
  },
8643
8890
  emits: ["change"],
8644
8891
  setup(__props, { emit: __emit }) {
@@ -8758,7 +9005,10 @@
8758
9005
  disabled: { type: Boolean },
8759
9006
  size: {},
8760
9007
  lastValues: {},
8761
- isCompare: { type: Boolean }
9008
+ isCompare: { type: Boolean },
9009
+ text: {},
9010
+ labelWidth: {},
9011
+ labelPosition: {}
8762
9012
  },
8763
9013
  emits: ["change"],
8764
9014
  setup(__props, { emit: __emit }) {
@@ -8919,6 +9169,7 @@
8919
9169
  if (option.typeMatchRules) registerTypeMatchRules(option.typeMatchRules);
8920
9170
  app.component("m-form", Form_default);
8921
9171
  app.component("m-form-dialog", FormDialog_default);
9172
+ app.component("m-form-drawer", FormDrawer_default);
8922
9173
  app.component("m-form-container", Container_default);
8923
9174
  app.component("m-form-fieldset", Fieldset_default);
8924
9175
  app.component("m-form-group-list", TableGroupList_default);
@@ -8988,6 +9239,7 @@
8988
9239
  exports.MTime = Time_default;
8989
9240
  exports.MTimerange = Timerange_default;
8990
9241
  exports.adaptFormValidator = adaptFormValidator;
9242
+ exports.applyExtendState = applyExtendState;
8991
9243
  exports.clearTypeMatchRules = clearTypeMatchRules;
8992
9244
  exports.createForm = createForm;
8993
9245
  exports.createObjectProp = createObjectProp;
@@ -9008,6 +9260,7 @@
9008
9260
  exports.registerTypeMatchRules = registerTypeMatchRules;
9009
9261
  exports.sortArray = sortArray;
9010
9262
  exports.sortChange = sortChange;
9263
+ exports.stripTabItemsLazy = stripTabItemsLazy;
9011
9264
  exports.submitForm = submitForm;
9012
9265
  exports.useAddField = useAddField;
9013
9266
  exports.validateForm = validateForm;