@tmagic/form 1.8.0-beta.7 → 1.8.0-manmanyu.10
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.
- package/dist/es/Form.vue_vue_type_script_setup_true_lang.js +45 -6
- package/dist/es/FormBox.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/FormDialog.vue_vue_type_script_setup_true_lang.js +13 -6
- package/dist/es/FormDrawer.vue_vue_type_script_setup_true_lang.js +38 -13
- package/dist/es/containers/Col.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/Container.vue_vue_type_script_setup_true_lang.js +22 -17
- package/dist/es/containers/Fieldset.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/FlexLayout.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/FormLabel.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/GroupList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/GroupListItem.vue_vue_type_script_setup_true_lang.js +23 -19
- package/dist/es/containers/Panel.vue_vue_type_script_setup_true_lang.js +17 -11
- package/dist/es/containers/Row.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/Step.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/Tabs.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/table/ActionsColumn.vue_vue_type_script_setup_true_lang.js +14 -7
- package/dist/es/containers/table/SortColumn.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/table/Table.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/containers/table/useTableColumns.js +5 -2
- package/dist/es/containers/table-group-list/TableGroupList.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/es/fields/Cascader.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Checkbox.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/CheckboxGroup.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/ColorPicker.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Date.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DateTime.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Daterange.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Display.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/DynamicField.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Hidden.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/fields/Link.vue_vue_type_script_setup_true_lang.js +30 -8
- package/dist/es/fields/Number.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/NumberRange.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/RadioGroup.vue_vue_type_script_setup_true_lang.js +17 -9
- package/dist/es/fields/Select.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Switch.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Text.vue_vue_type_script_setup_true_lang.js +113 -78
- package/dist/es/fields/Textarea.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Time.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/fields/Timerange.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/es/plugin.js +2 -0
- package/dist/es/style.css +120 -8
- package/dist/es/utils/form.js +2 -2
- package/dist/style.css +120 -8
- package/dist/themes/magic-admin.css +494 -0
- package/dist/tmagic-form.umd.cjs +1850 -1640
- package/package.json +5 -5
- package/src/Form.vue +53 -4
- package/src/FormDialog.vue +14 -3
- package/src/FormDrawer.vue +40 -12
- package/src/containers/Container.vue +14 -5
- package/src/containers/GroupListItem.vue +14 -12
- package/src/containers/Panel.vue +10 -3
- package/src/containers/table/ActionsColumn.vue +10 -4
- package/src/containers/table/useTableColumns.ts +8 -2
- package/src/containers/table-group-list/TableGroupList.vue +7 -1
- package/src/fields/Link.vue +17 -3
- package/src/fields/RadioGroup.vue +11 -5
- package/src/fields/Text.vue +43 -19
- package/src/plugin.ts +2 -0
- package/src/theme/container.scss +3 -0
- package/src/theme/fieldset.scss +50 -0
- package/src/theme/form.scss +6 -0
- package/src/theme/group-list.scss +8 -7
- package/src/theme/index.scss +1 -0
- package/src/theme/link.scss +17 -0
- package/src/theme/panel.scss +1 -1
- package/src/theme/radio-group.scss +23 -0
- package/src/theme/tabs.scss +2 -2
- package/src/theme/text.scss +38 -0
- package/src/theme/themes/magic-admin/index.scss +91 -0
- package/types/index.d.ts +46 -1
|
@@ -2,12 +2,12 @@ import { FORM_DIFF_CONFIG_KEY } from "./schema.js";
|
|
|
2
2
|
import { getConfig } from "./utils/config.js";
|
|
3
3
|
import { initValue } from "./utils/form.js";
|
|
4
4
|
import Container_default from "./containers/Container.js";
|
|
5
|
-
import { Fragment, createBlock, createCommentVNode, createElementBlock, createSlots, defineComponent, mergeProps, normalizeStyle, openBlock, provide, reactive, ref, renderList, renderSlot, shallowRef, toRaw, unref, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
5
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, defineComponent, inject, mergeProps, normalizeClass, normalizeStyle, openBlock, provide, reactive, ref, renderList, renderSlot, shallowRef, toRaw, unref, useTemplateRef, watch, watchEffect, withCtx } from "vue";
|
|
6
6
|
import { cloneDeep, isEqual } from "lodash-es";
|
|
7
|
-
import { TMagicForm, tMagicMessage, tMagicMessageBox } from "@tmagic/design";
|
|
7
|
+
import { M_THEME_KEY, TMagicForm, tMagicMessage, tMagicMessageBox } from "@tmagic/design";
|
|
8
8
|
import { setValueByKeyPath } from "@tmagic/utils";
|
|
9
9
|
//#region packages/form/src/Form.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var Form_vue_vue_type_script_setup_true_lang_default =
|
|
10
|
+
var Form_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
11
11
|
name: "MForm",
|
|
12
12
|
__name: "Form",
|
|
13
13
|
props: {
|
|
@@ -37,7 +37,8 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
37
37
|
preventSubmitDefault: { type: Boolean },
|
|
38
38
|
extendState: {},
|
|
39
39
|
showDiff: {},
|
|
40
|
-
selfDiffFieldTypes: {}
|
|
40
|
+
selfDiffFieldTypes: {},
|
|
41
|
+
theme: {}
|
|
41
42
|
},
|
|
42
43
|
emits: [
|
|
43
44
|
"change",
|
|
@@ -56,6 +57,25 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
56
57
|
const fields = /* @__PURE__ */ new Map();
|
|
57
58
|
const requestFuc = getConfig("request");
|
|
58
59
|
/**
|
|
60
|
+
* 当前表单生效的主题名称:
|
|
61
|
+
* - 优先用本组件自己的 `props.theme`;
|
|
62
|
+
* - 没设置时回退到最近祖先 `<MEditor>` / `<MForm>` provide 的主题,便于内嵌于编辑器
|
|
63
|
+
* 时自动跟随外层主题,无需在每个 `MForm` 上重复传 `theme`。
|
|
64
|
+
*
|
|
65
|
+
* 同时把合并后的值再 provide 出去(见下方 `provide(M_THEME_KEY, ...)`),让 form 子树
|
|
66
|
+
* 里再嵌套的 portal 组件(`TMagicPopover` 等)依然能拿到非空主题。
|
|
67
|
+
*/
|
|
68
|
+
const ancestorTheme = inject(M_THEME_KEY, null);
|
|
69
|
+
const effectiveTheme = computed(() => props.theme || ancestorTheme?.value || "");
|
|
70
|
+
/**
|
|
71
|
+
* 拼到 `formState.popperClass` 上的主题修饰类(仅 `m-theme--<theme>`,
|
|
72
|
+
* 不带 `m-form` / `m-editor` 前缀,因为 Element Plus 弹层节点本身既不是 form 也不是 editor)。
|
|
73
|
+
*
|
|
74
|
+
* 这条类会随所有读 `mForm.popperClass` 的字段(Select / DateTime / Cascader 等)下发到
|
|
75
|
+
* Element Plus 的 `popper-class`,让 portal 节点也命中 `m-theme--<theme>` 上的 CSS 变量。
|
|
76
|
+
*/
|
|
77
|
+
const themeClass = computed(() => effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : "");
|
|
78
|
+
/**
|
|
59
79
|
* formState 实现说明:
|
|
60
80
|
*
|
|
61
81
|
* 1. 与 props 直接对应的字段(config / initValues / lastValues / isCompare / parentValues /
|
|
@@ -71,13 +91,21 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
71
91
|
* 把最新值刷进 formState。
|
|
72
92
|
* - accessor 描述符(`{ get stage() { return ... } }`)按原样写入,调用方可以控制
|
|
73
93
|
* 读时求值,每次读取都会重新执行 getter。
|
|
94
|
+
*
|
|
95
|
+
* 4. `popperClass` 会自动拼接 `themeClass`:调用方传入的 `popperClass` + 当前主题
|
|
96
|
+
* 修饰类(含祖先 `<MEditor>` provide 的主题)。这样所有透传到 Element Plus 弹层
|
|
97
|
+
* `popper-class` 的字段(Select / DateTime / Cascader 等)能自带主题作用域。
|
|
74
98
|
*/
|
|
75
99
|
const formState = reactive({
|
|
76
100
|
get keyProp() {
|
|
77
101
|
return props.keyProp;
|
|
78
102
|
},
|
|
79
103
|
get popperClass() {
|
|
80
|
-
|
|
104
|
+
const userClass = props.popperClass ?? "";
|
|
105
|
+
const tc = themeClass.value;
|
|
106
|
+
if (!userClass) return tc;
|
|
107
|
+
if (!tc) return userClass;
|
|
108
|
+
return `${userClass} ${tc}`;
|
|
81
109
|
},
|
|
82
110
|
get config() {
|
|
83
111
|
return props.config;
|
|
@@ -153,6 +181,12 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
153
181
|
}
|
|
154
182
|
});
|
|
155
183
|
provide("mForm", formState);
|
|
184
|
+
/**
|
|
185
|
+
* 把生效主题(自身或祖先)再 provide 出去,供 form 子树内含 `Teleport` 的组件
|
|
186
|
+
* (如 `TMagicPopover`)在传送目标上挂 `m-theme--<theme>` 类。
|
|
187
|
+
* 详见 `@tmagic/design/theme.ts`。
|
|
188
|
+
*/
|
|
189
|
+
provide(M_THEME_KEY, effectiveTheme);
|
|
156
190
|
provide(FORM_DIFF_CONFIG_KEY, {
|
|
157
191
|
get showDiff() {
|
|
158
192
|
return props.showDiff;
|
|
@@ -256,7 +290,11 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
256
290
|
});
|
|
257
291
|
return (_ctx, _cache) => {
|
|
258
292
|
return openBlock(), createBlock(unref(TMagicForm), {
|
|
259
|
-
class:
|
|
293
|
+
class: normalizeClass([
|
|
294
|
+
"m-form",
|
|
295
|
+
effectiveTheme.value ? `m-form--${effectiveTheme.value}` : "",
|
|
296
|
+
effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""
|
|
297
|
+
]),
|
|
260
298
|
ref: "tMagicForm",
|
|
261
299
|
model: values.value,
|
|
262
300
|
"label-width": __props.labelWidth,
|
|
@@ -294,6 +332,7 @@ var Form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
294
332
|
}), 128)) : createCommentVNode("v-if", true)]),
|
|
295
333
|
_: 3
|
|
296
334
|
}, 8, [
|
|
335
|
+
"class",
|
|
297
336
|
"model",
|
|
298
337
|
"label-width",
|
|
299
338
|
"style",
|
|
@@ -3,7 +3,7 @@ import { computed, createElementBlock, createElementVNode, createTextVNode, crea
|
|
|
3
3
|
import { TMagicButton, TMagicScrollbar } from "@tmagic/design";
|
|
4
4
|
//#region packages/form/src/FormBox.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var footerHeight = 60;
|
|
6
|
-
var FormBox_vue_vue_type_script_setup_true_lang_default =
|
|
6
|
+
var FormBox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "MFormBox",
|
|
8
8
|
__name: "FormBox",
|
|
9
9
|
props: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import Form_default from "./Form.js";
|
|
2
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeStyle, openBlock, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
3
|
-
import { TMagicButton, TMagicCol, TMagicDialog, TMagicRow } from "@tmagic/design";
|
|
2
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, normalizeStyle, openBlock, provide, ref, renderSlot, toDisplayString, unref, withCtx } from "vue";
|
|
3
|
+
import { M_THEME_KEY, TMagicButton, TMagicCol, TMagicDialog, TMagicRow } from "@tmagic/design";
|
|
4
4
|
//#region packages/form/src/FormDialog.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = { style: { "min-height": "1px" } };
|
|
6
|
-
var FormDialog_vue_vue_type_script_setup_true_lang_default =
|
|
6
|
+
var FormDialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "MFormDialog",
|
|
8
8
|
__name: "FormDialog",
|
|
9
9
|
props: {
|
|
@@ -41,7 +41,8 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
41
41
|
type: Boolean,
|
|
42
42
|
default: true
|
|
43
43
|
},
|
|
44
|
-
extendState: {}
|
|
44
|
+
extendState: {},
|
|
45
|
+
theme: {}
|
|
45
46
|
},
|
|
46
47
|
emits: [
|
|
47
48
|
"close",
|
|
@@ -51,6 +52,9 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
51
52
|
],
|
|
52
53
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
53
54
|
const props = __props;
|
|
55
|
+
const ancestorTheme = inject(M_THEME_KEY, null);
|
|
56
|
+
const effectiveTheme = computed(() => props.theme || ancestorTheme?.value || "");
|
|
57
|
+
provide(M_THEME_KEY, effectiveTheme);
|
|
54
58
|
const emit = __emit;
|
|
55
59
|
const form = ref();
|
|
56
60
|
const dialogVisible = ref(false);
|
|
@@ -110,7 +114,7 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
110
114
|
return openBlock(), createBlock(unref(TMagicDialog), {
|
|
111
115
|
modelValue: dialogVisible.value,
|
|
112
116
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => dialogVisible.value = $event),
|
|
113
|
-
class: "m-form-dialog",
|
|
117
|
+
class: normalizeClass(["m-form-dialog", effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""]),
|
|
114
118
|
top: "20px",
|
|
115
119
|
"append-to-body": "",
|
|
116
120
|
title: __props.title,
|
|
@@ -192,6 +196,7 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
192
196
|
inline: __props.inline,
|
|
193
197
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
194
198
|
"extend-state": __props.extendState,
|
|
199
|
+
theme: effectiveTheme.value,
|
|
195
200
|
onChange: changeHandler
|
|
196
201
|
}, null, 8, [
|
|
197
202
|
"modelValue",
|
|
@@ -204,11 +209,13 @@ var FormDialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
204
209
|
"label-position",
|
|
205
210
|
"inline",
|
|
206
211
|
"prevent-submit-default",
|
|
207
|
-
"extend-state"
|
|
212
|
+
"extend-state",
|
|
213
|
+
"theme"
|
|
208
214
|
]), renderSlot(_ctx.$slots, "default")], 4)) : createCommentVNode("v-if", true)]),
|
|
209
215
|
_: 3
|
|
210
216
|
}, 8, [
|
|
211
217
|
"modelValue",
|
|
218
|
+
"class",
|
|
212
219
|
"title",
|
|
213
220
|
"width",
|
|
214
221
|
"zIndex",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import Form_default from "./Form.js";
|
|
2
|
-
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderSlot, toDisplayString, unref, watchEffect, withCtx } from "vue";
|
|
3
|
-
import { TMagicButton, TMagicCol, TMagicDrawer, TMagicRow } from "@tmagic/design";
|
|
2
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, provide, ref, renderSlot, toDisplayString, unref, watchEffect, withCtx } from "vue";
|
|
3
|
+
import { M_THEME_KEY, TMagicButton, TMagicCol, TMagicDrawer, TMagicRow } from "@tmagic/design";
|
|
4
4
|
//#region packages/form/src/FormDrawer.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = { style: { "min-height": "1px" } };
|
|
6
|
-
var FormDrawer_vue_vue_type_script_setup_true_lang_default =
|
|
7
|
-
name: "
|
|
6
|
+
var FormDrawer_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
|
+
name: "MFormDrawer",
|
|
8
8
|
__name: "FormDrawer",
|
|
9
9
|
props: {
|
|
10
10
|
config: { default: () => [] },
|
|
@@ -25,7 +25,8 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
25
25
|
labelPosition: {},
|
|
26
26
|
preventSubmitDefault: { type: Boolean },
|
|
27
27
|
beforeClose: {},
|
|
28
|
-
extendState: {}
|
|
28
|
+
extendState: {},
|
|
29
|
+
theme: {}
|
|
29
30
|
},
|
|
30
31
|
emits: [
|
|
31
32
|
"close",
|
|
@@ -37,11 +38,15 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
37
38
|
"opened"
|
|
38
39
|
],
|
|
39
40
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
41
|
+
const props = __props;
|
|
42
|
+
const ancestorTheme = inject(M_THEME_KEY, null);
|
|
43
|
+
const effectiveTheme = computed(() => props.theme || ancestorTheme?.value || "");
|
|
44
|
+
provide(M_THEME_KEY, effectiveTheme);
|
|
40
45
|
const emit = __emit;
|
|
41
46
|
const drawer = ref();
|
|
42
47
|
const form = ref();
|
|
43
48
|
const drawerBody = ref();
|
|
44
|
-
const
|
|
49
|
+
const dialogVisible = ref(false);
|
|
45
50
|
const saveFetch = ref(false);
|
|
46
51
|
const bodyHeight = ref(0);
|
|
47
52
|
watchEffect(() => {
|
|
@@ -71,30 +76,47 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
71
76
|
emit("closed");
|
|
72
77
|
};
|
|
73
78
|
const show = () => {
|
|
74
|
-
|
|
79
|
+
dialogVisible.value = true;
|
|
75
80
|
};
|
|
76
81
|
const hide = () => {
|
|
77
|
-
|
|
82
|
+
dialogVisible.value = false;
|
|
83
|
+
};
|
|
84
|
+
const close = () => {
|
|
85
|
+
dialogVisible.value = false;
|
|
86
|
+
};
|
|
87
|
+
const cancel = () => {
|
|
88
|
+
hide();
|
|
78
89
|
};
|
|
79
90
|
/** 用于关闭 Drawer, 该方法会调用传入的 before-close 方法 */
|
|
80
91
|
const handleClose = () => {
|
|
81
92
|
drawer.value?.handleClose();
|
|
82
93
|
};
|
|
94
|
+
const save = async () => {
|
|
95
|
+
try {
|
|
96
|
+
const changeRecords = [...form.value?.changeRecords || []];
|
|
97
|
+
emit("submit", await form.value?.submitForm(), { changeRecords });
|
|
98
|
+
} catch (e) {
|
|
99
|
+
emit("error", e);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
83
102
|
__expose({
|
|
84
103
|
form,
|
|
85
104
|
saveFetch,
|
|
86
105
|
bodyHeight,
|
|
106
|
+
close,
|
|
87
107
|
show,
|
|
88
108
|
hide,
|
|
109
|
+
save,
|
|
110
|
+
cancel,
|
|
89
111
|
handleClose
|
|
90
112
|
});
|
|
91
113
|
return (_ctx, _cache) => {
|
|
92
114
|
return openBlock(), createBlock(unref(TMagicDrawer), {
|
|
93
|
-
class: "m-form-drawer",
|
|
115
|
+
class: normalizeClass(["m-form-drawer", effectiveTheme.value ? `m-theme--${effectiveTheme.value}` : ""]),
|
|
94
116
|
ref_key: "drawer",
|
|
95
117
|
ref: drawer,
|
|
96
|
-
modelValue:
|
|
97
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) =>
|
|
118
|
+
modelValue: dialogVisible.value,
|
|
119
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => dialogVisible.value = $event),
|
|
98
120
|
title: __props.title,
|
|
99
121
|
"close-on-press-escape": __props.closeOnPressEscape,
|
|
100
122
|
"append-to-body": true,
|
|
@@ -132,7 +154,7 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
132
154
|
})]),
|
|
133
155
|
_: 3
|
|
134
156
|
})]),
|
|
135
|
-
default: withCtx(() => [
|
|
157
|
+
default: withCtx(() => [dialogVisible.value ? (openBlock(), createElementBlock("div", {
|
|
136
158
|
key: 0,
|
|
137
159
|
ref_key: "drawerBody",
|
|
138
160
|
ref: drawerBody,
|
|
@@ -150,6 +172,7 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
150
172
|
inline: __props.inline,
|
|
151
173
|
"prevent-submit-default": __props.preventSubmitDefault,
|
|
152
174
|
"extend-state": __props.extendState,
|
|
175
|
+
theme: effectiveTheme.value,
|
|
153
176
|
onChange: changeHandler
|
|
154
177
|
}, null, 8, [
|
|
155
178
|
"size",
|
|
@@ -161,10 +184,12 @@ var FormDrawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ def
|
|
|
161
184
|
"label-position",
|
|
162
185
|
"inline",
|
|
163
186
|
"prevent-submit-default",
|
|
164
|
-
"extend-state"
|
|
187
|
+
"extend-state",
|
|
188
|
+
"theme"
|
|
165
189
|
]), renderSlot(_ctx.$slots, "default")], 512)) : createCommentVNode("v-if", true)]),
|
|
166
190
|
_: 3
|
|
167
191
|
}, 8, [
|
|
192
|
+
"class",
|
|
168
193
|
"modelValue",
|
|
169
194
|
"title",
|
|
170
195
|
"close-on-press-escape",
|
|
@@ -3,7 +3,7 @@ import Container_default from "./Container.js";
|
|
|
3
3
|
import { computed, createBlock, createVNode, defineComponent, inject, openBlock, unref, vShow, withCtx, withDirectives } from "vue";
|
|
4
4
|
import { TMagicCol } from "@tmagic/design";
|
|
5
5
|
//#region packages/form/src/containers/Col.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var Col_vue_vue_type_script_setup_true_lang_default =
|
|
6
|
+
var Col_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
7
|
name: "MFormCol",
|
|
8
8
|
__name: "Col",
|
|
9
9
|
props: {
|
|
@@ -7,21 +7,25 @@ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock
|
|
|
7
7
|
import { isEqual } from "lodash-es";
|
|
8
8
|
import { TMagicButton, TMagicFormItem, TMagicIcon, TMagicTooltip } from "@tmagic/design";
|
|
9
9
|
import { getValueByKeyPath } from "@tmagic/utils";
|
|
10
|
-
import { WarningFilled } from "@element-plus/icons-vue";
|
|
10
|
+
import { ArrowDown, ArrowUp, WarningFilled } from "@element-plus/icons-vue";
|
|
11
11
|
//#region packages/form/src/containers/Container.vue?vue&type=script&setup=true&lang.ts
|
|
12
12
|
var _hoisted_1 = ["data-tmagic-id", "data-tmagic-form-item-prop"];
|
|
13
|
-
var _hoisted_2 =
|
|
13
|
+
var _hoisted_2 = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "m-form-tip m-form-title-extra"
|
|
16
|
+
};
|
|
14
17
|
var _hoisted_3 = ["innerHTML"];
|
|
15
18
|
var _hoisted_4 = ["innerHTML"];
|
|
16
19
|
var _hoisted_5 = ["innerHTML"];
|
|
17
20
|
var _hoisted_6 = ["innerHTML"];
|
|
18
21
|
var _hoisted_7 = ["innerHTML"];
|
|
19
22
|
var _hoisted_8 = ["innerHTML"];
|
|
20
|
-
var _hoisted_9 =
|
|
23
|
+
var _hoisted_9 = ["innerHTML"];
|
|
24
|
+
var _hoisted_10 = {
|
|
21
25
|
key: 5,
|
|
22
|
-
|
|
26
|
+
class: "m-form-container-expand"
|
|
23
27
|
};
|
|
24
|
-
var Container_vue_vue_type_script_setup_true_lang_default =
|
|
28
|
+
var Container_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
25
29
|
name: "MFormContainer",
|
|
26
30
|
__name: "Container",
|
|
27
31
|
props: {
|
|
@@ -107,7 +111,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
107
111
|
const effectiveSelfDiffFieldTypes = computed(() => {
|
|
108
112
|
const custom = diffConfig.selfDiffFieldTypes;
|
|
109
113
|
if (typeof custom === "function") return new Set(custom([...DEFAULT_SELF_DIFF_FIELD_TYPES]));
|
|
110
|
-
if (Array.isArray(custom)) return new Set([...DEFAULT_SELF_DIFF_FIELD_TYPES, ...custom]);
|
|
114
|
+
if (Array.isArray(custom)) return /* @__PURE__ */ new Set([...DEFAULT_SELF_DIFF_FIELD_TYPES, ...custom]);
|
|
111
115
|
return new Set(DEFAULT_SELF_DIFF_FIELD_TYPES);
|
|
112
116
|
});
|
|
113
117
|
const isSelfDiffField = computed(() => effectiveSelfDiffFieldTypes.value.has(type.value));
|
|
@@ -297,12 +301,12 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
297
301
|
"use-label",
|
|
298
302
|
"label-title",
|
|
299
303
|
"text"
|
|
300
|
-
])])]),
|
|
304
|
+
]), __props.config.titleExtra && __props.config.labelPosition === "top" ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(__props.config.titleExtra), 1)) : createCommentVNode("v-if", true)])]),
|
|
301
305
|
default: withCtx(() => [tooltip.value.text ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
302
306
|
key: 0,
|
|
303
307
|
placement: tooltip.value.placement
|
|
304
308
|
}, {
|
|
305
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8,
|
|
309
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_3)]),
|
|
306
310
|
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
307
311
|
model: __props.model,
|
|
308
312
|
"last-values": __props.lastValues,
|
|
@@ -331,7 +335,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
331
335
|
key: 0,
|
|
332
336
|
placement: "top"
|
|
333
337
|
}, {
|
|
334
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8,
|
|
338
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_4)]),
|
|
335
339
|
default: withCtx(() => [createVNode(unref(TMagicIcon), { style: {
|
|
336
340
|
"line-height": "40px",
|
|
337
341
|
"margin-left": "5px"
|
|
@@ -370,7 +374,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
370
374
|
key: 0,
|
|
371
375
|
placement: tooltip.value.placement
|
|
372
376
|
}, {
|
|
373
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8,
|
|
377
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_5)]),
|
|
374
378
|
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
375
379
|
model: __props.model,
|
|
376
380
|
"last-values": __props.lastValues,
|
|
@@ -423,7 +427,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
423
427
|
key: 0,
|
|
424
428
|
placement: tooltip.value.placement
|
|
425
429
|
}, {
|
|
426
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8,
|
|
430
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_6)]),
|
|
427
431
|
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
428
432
|
model: __props.lastValues,
|
|
429
433
|
onChange: onChangeHandler
|
|
@@ -439,7 +443,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
439
443
|
key: 0,
|
|
440
444
|
placement: "top"
|
|
441
445
|
}, {
|
|
442
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8,
|
|
446
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_7)]),
|
|
443
447
|
default: withCtx(() => [createVNode(unref(TMagicIcon), { style: {
|
|
444
448
|
"line-height": "40px",
|
|
445
449
|
"margin-left": "5px"
|
|
@@ -480,7 +484,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
480
484
|
key: 0,
|
|
481
485
|
placement: tooltip.value.placement
|
|
482
486
|
}, {
|
|
483
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8,
|
|
487
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: tooltip.value.text }, null, 8, _hoisted_8)]),
|
|
484
488
|
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(tagName.value), mergeProps(fieldsProps.value, {
|
|
485
489
|
model: __props.model,
|
|
486
490
|
onChange: onChangeHandler
|
|
@@ -496,7 +500,7 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
496
500
|
key: 1,
|
|
497
501
|
placement: "top"
|
|
498
502
|
}, {
|
|
499
|
-
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8,
|
|
503
|
+
content: withCtx(() => [createElementVNode("div", { innerHTML: __props.config.tip }, null, 8, _hoisted_9)]),
|
|
500
504
|
default: withCtx(() => [createVNode(unref(TMagicIcon), { style: {
|
|
501
505
|
"line-height": "40px",
|
|
502
506
|
"margin-left": "5px"
|
|
@@ -538,16 +542,17 @@ var Container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defi
|
|
|
538
542
|
"label-width",
|
|
539
543
|
"prop"
|
|
540
544
|
]);
|
|
541
|
-
}), 128)) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true), __props.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div",
|
|
545
|
+
}), 128)) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true), __props.config.expand && type.value !== "fieldset" ? (openBlock(), createElementBlock("div", _hoisted_10, [createVNode(unref(TMagicButton), {
|
|
542
546
|
type: "primary",
|
|
543
547
|
size: "small",
|
|
544
548
|
disabled: false,
|
|
545
549
|
link: "",
|
|
546
|
-
onClick: expandHandler
|
|
550
|
+
onClick: expandHandler,
|
|
551
|
+
icon: expand.value ? unref(ArrowUp) : unref(ArrowDown)
|
|
547
552
|
}, {
|
|
548
553
|
default: withCtx(() => [createTextVNode(toDisplayString(expand.value ? "收起配置" : "展开更多配置"), 1)]),
|
|
549
554
|
_: 1
|
|
550
|
-
})])) : createCommentVNode("v-if", true)], 14, _hoisted_1);
|
|
555
|
+
}, 8, ["icon"])])) : createCommentVNode("v-if", true)], 14, _hoisted_1);
|
|
551
556
|
};
|
|
552
557
|
}
|
|
553
558
|
});
|
|
@@ -14,7 +14,7 @@ var _hoisted_6 = {
|
|
|
14
14
|
};
|
|
15
15
|
var _hoisted_7 = { style: { "flex": "1" } };
|
|
16
16
|
var _hoisted_8 = ["src"];
|
|
17
|
-
var Fieldset_vue_vue_type_script_setup_true_lang_default =
|
|
17
|
+
var Fieldset_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
18
18
|
name: "MFormFieldset",
|
|
19
19
|
__name: "Fieldset",
|
|
20
20
|
props: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Container_default from "./Container.js";
|
|
2
2
|
import { Fragment, computed, createBlock, createElementBlock, defineComponent, inject, normalizeStyle, openBlock, renderList, unref } from "vue";
|
|
3
3
|
//#region packages/form/src/containers/FlexLayout.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
-
var FlexLayout_vue_vue_type_script_setup_true_lang_default =
|
|
4
|
+
var FlexLayout_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
5
5
|
name: "MFormFlexLayout",
|
|
6
6
|
__name: "FlexLayout",
|
|
7
7
|
props: {
|
|
@@ -12,7 +12,7 @@ var _hoisted_1 = {
|
|
|
12
12
|
var _hoisted_2 = ["innerHTML", "title"];
|
|
13
13
|
var _hoisted_3 = ["innerHTML"];
|
|
14
14
|
var _hoisted_4 = ["innerHTML", "title"];
|
|
15
|
-
var FormLabel_vue_vue_type_script_setup_true_lang_default =
|
|
15
|
+
var FormLabel_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
16
16
|
__name: "FormLabel",
|
|
17
17
|
props: {
|
|
18
18
|
tip: {},
|
|
@@ -17,7 +17,7 @@ var _hoisted_5 = { style: {
|
|
|
17
17
|
"justify-content": "flex-end",
|
|
18
18
|
"flex": "1"
|
|
19
19
|
} };
|
|
20
|
-
var GroupList_vue_vue_type_script_setup_true_lang_default =
|
|
20
|
+
var GroupList_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
21
21
|
name: "MFormGroupList",
|
|
22
22
|
__name: "GroupList",
|
|
23
23
|
props: {
|
|
@@ -2,15 +2,16 @@ import { filterFunction } from "../utils/form.js";
|
|
|
2
2
|
import Container_default from "./Container.js";
|
|
3
3
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, openBlock, ref, unref, vShow, withCtx, withDirectives } from "vue";
|
|
4
4
|
import { TMagicButton, TMagicCard, TMagicIcon, TMagicInputNumber, TMagicPopover } from "@tmagic/design";
|
|
5
|
-
import {
|
|
5
|
+
import { ArrowDown, ArrowRight, Bottom, Delete, DocumentCopy, Position, Top } from "@element-plus/icons-vue";
|
|
6
6
|
//#region packages/form/src/containers/GroupListItem.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var _hoisted_1 =
|
|
8
|
-
var _hoisted_2 =
|
|
7
|
+
var _hoisted_1 = { class: "m-fields-group-list-item-header" };
|
|
8
|
+
var _hoisted_2 = ["innerHTML"];
|
|
9
|
+
var _hoisted_3 = { style: {
|
|
9
10
|
"text-align": "right",
|
|
10
11
|
"margin-top": "20px"
|
|
11
12
|
} };
|
|
12
|
-
var
|
|
13
|
-
var GroupListItem_vue_vue_type_script_setup_true_lang_default =
|
|
13
|
+
var _hoisted_4 = ["innerHTML"];
|
|
14
|
+
var GroupListItem_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
14
15
|
name: "MFormGroupListItem",
|
|
15
16
|
__name: "GroupListItem",
|
|
16
17
|
props: {
|
|
@@ -85,25 +86,28 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
85
86
|
return (_ctx, _cache) => {
|
|
86
87
|
return openBlock(), createBlock(unref(TMagicCard), {
|
|
87
88
|
class: "m-fields-group-list-item",
|
|
89
|
+
flat: __props.config.flat,
|
|
88
90
|
"body-style": { display: expand.value ? "block" : "none" }
|
|
89
91
|
}, {
|
|
90
|
-
header: withCtx(() => [createElementVNode("div",
|
|
92
|
+
header: withCtx(() => [createElementVNode("div", _hoisted_1, [
|
|
91
93
|
createVNode(unref(TMagicButton), {
|
|
92
94
|
link: "",
|
|
93
95
|
disabled: __props.disabled,
|
|
94
|
-
onClick: expandHandler
|
|
96
|
+
onClick: expandHandler,
|
|
97
|
+
class: "expand-button"
|
|
95
98
|
}, {
|
|
96
99
|
default: withCtx(() => [createVNode(unref(TMagicIcon), null, {
|
|
97
|
-
default: withCtx(() => [expand.value ? (openBlock(), createBlock(unref(
|
|
100
|
+
default: withCtx(() => [expand.value ? (openBlock(), createBlock(unref(ArrowDown), { key: 0 })) : (openBlock(), createBlock(unref(ArrowRight), { key: 1 }))]),
|
|
98
101
|
_: 1
|
|
99
|
-
})
|
|
102
|
+
})]),
|
|
100
103
|
_: 1
|
|
101
104
|
}, 8, ["disabled"]),
|
|
105
|
+
createElementVNode("span", { innerHTML: title.value }, null, 8, _hoisted_2),
|
|
102
106
|
!__props.isCompare ? withDirectives((openBlock(), createBlock(unref(TMagicButton), {
|
|
103
107
|
key: 0,
|
|
104
|
-
|
|
105
|
-
size: "small",
|
|
108
|
+
size: "default",
|
|
106
109
|
link: "",
|
|
110
|
+
class: "delete-button",
|
|
107
111
|
icon: unref(Delete),
|
|
108
112
|
disabled: __props.disabled,
|
|
109
113
|
onClick: removeHandler
|
|
@@ -111,7 +115,7 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
111
115
|
copyable.value && !__props.isCompare ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
112
116
|
key: 1,
|
|
113
117
|
link: "",
|
|
114
|
-
size: "
|
|
118
|
+
size: "default",
|
|
115
119
|
type: "primary",
|
|
116
120
|
icon: unref(DocumentCopy),
|
|
117
121
|
disabled: __props.disabled,
|
|
@@ -122,18 +126,18 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
122
126
|
}, 8, ["icon", "disabled"])) : createCommentVNode("v-if", true),
|
|
123
127
|
movable.value && !__props.isCompare ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [withDirectives(createVNode(unref(TMagicButton), {
|
|
124
128
|
link: "",
|
|
125
|
-
size: "
|
|
129
|
+
size: "default",
|
|
126
130
|
disabled: __props.disabled,
|
|
127
|
-
icon: unref(
|
|
131
|
+
icon: unref(Top),
|
|
128
132
|
onClick: _cache[0] || (_cache[0] = ($event) => changeOrder(-1))
|
|
129
133
|
}, {
|
|
130
134
|
default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("上移", -1)])]),
|
|
131
135
|
_: 1
|
|
132
136
|
}, 8, ["disabled", "icon"]), [[vShow, __props.index !== 0]]), withDirectives(createVNode(unref(TMagicButton), {
|
|
133
137
|
link: "",
|
|
134
|
-
size: "
|
|
138
|
+
size: "default",
|
|
135
139
|
disabled: __props.disabled,
|
|
136
|
-
icon: unref(
|
|
140
|
+
icon: unref(Bottom),
|
|
137
141
|
onClick: _cache[1] || (_cache[1] = ($event) => changeOrder(1))
|
|
138
142
|
}, {
|
|
139
143
|
default: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode("下移", -1)])]),
|
|
@@ -168,7 +172,7 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
168
172
|
disabled: __props.disabled
|
|
169
173
|
}, null, 8, ["modelValue", "disabled"]),
|
|
170
174
|
_cache[11] || (_cache[11] = createTextVNode("行 ", -1))
|
|
171
|
-
]), createElementVNode("div",
|
|
175
|
+
]), createElementVNode("div", _hoisted_3, [createVNode(unref(TMagicButton), {
|
|
172
176
|
size: "small",
|
|
173
177
|
text: "",
|
|
174
178
|
onClick: _cache[4] || (_cache[4] = ($event) => moveSpecifyLocationVisible.value = false)
|
|
@@ -189,7 +193,7 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
189
193
|
key: 4,
|
|
190
194
|
innerHTML: itemExtra.value,
|
|
191
195
|
class: "m-form-tip"
|
|
192
|
-
}, null, 8,
|
|
196
|
+
}, null, 8, _hoisted_4)) : createCommentVNode("v-if", true)
|
|
193
197
|
])]),
|
|
194
198
|
default: withCtx(() => [expand.value ? (openBlock(), createBlock(Container_default, {
|
|
195
199
|
key: 0,
|
|
@@ -214,7 +218,7 @@ var GroupListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
214
218
|
"disabled"
|
|
215
219
|
])) : createCommentVNode("v-if", true)]),
|
|
216
220
|
_: 1
|
|
217
|
-
}, 8, ["body-style"]);
|
|
221
|
+
}, 8, ["flat", "body-style"]);
|
|
218
222
|
};
|
|
219
223
|
}
|
|
220
224
|
});
|