@tmagic/form 1.3.0-alpha.13 → 1.3.0-alpha.15
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/style.css +13 -0
- package/dist/tmagic-form.js +258 -107
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +284 -132
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/FormDialog.vue +14 -4
- package/src/FormDrawer.vue +130 -0
- package/src/containers/Container.vue +1 -2
- package/src/index.ts +1 -0
- package/src/schema.ts +1 -1
- package/src/theme/form-drawer.scss +11 -0
- package/src/theme/index.scss +1 -0
- package/src/theme/panel.scss +6 -0
- package/types/FormDialog.vue.d.ts +2 -0
- package/types/FormDrawer.vue.d.ts +333 -0
- package/types/index.d.ts +1 -0
- package/types/schema.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.0-alpha.
|
|
2
|
+
"version": "1.3.0-alpha.15",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@element-plus/icons-vue": "^2.0.9",
|
|
39
|
-
"@tmagic/design": "1.3.0-alpha.
|
|
40
|
-
"@tmagic/utils": "1.3.0-alpha.
|
|
39
|
+
"@tmagic/design": "1.3.0-alpha.15",
|
|
40
|
+
"@tmagic/utils": "1.3.0-alpha.15",
|
|
41
41
|
"lodash-es": "^4.17.21",
|
|
42
42
|
"sortablejs": "^1.14.0",
|
|
43
43
|
"vue": "^3.3.4"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"rimraf": "^3.0.2",
|
|
57
57
|
"sass": "^1.35.1",
|
|
58
58
|
"typescript": "^5.0.4",
|
|
59
|
-
"vite": "^4.
|
|
59
|
+
"vite": "^4.4.4",
|
|
60
60
|
"vue-tsc": "^1.6.5"
|
|
61
61
|
}
|
|
62
62
|
}
|
package/src/FormDialog.vue
CHANGED
|
@@ -118,10 +118,6 @@ const hasStep = computed(() => {
|
|
|
118
118
|
return false;
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
const cancel = () => {
|
|
122
|
-
dialogVisible.value = false;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
121
|
const closeHandler = () => {
|
|
126
122
|
stepActive.value = 1;
|
|
127
123
|
emit('close');
|
|
@@ -148,6 +144,18 @@ const changeHandler = (value: any) => {
|
|
|
148
144
|
emit('change', value);
|
|
149
145
|
};
|
|
150
146
|
|
|
147
|
+
const show = () => {
|
|
148
|
+
dialogVisible.value = true;
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const hide = () => {
|
|
152
|
+
dialogVisible.value = false;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
const cancel = () => {
|
|
156
|
+
hide();
|
|
157
|
+
};
|
|
158
|
+
|
|
151
159
|
defineExpose({
|
|
152
160
|
form,
|
|
153
161
|
saveFetch,
|
|
@@ -155,5 +163,7 @@ defineExpose({
|
|
|
155
163
|
|
|
156
164
|
cancel,
|
|
157
165
|
save,
|
|
166
|
+
show,
|
|
167
|
+
hide,
|
|
158
168
|
});
|
|
159
169
|
</script>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<TMagicDrawer
|
|
3
|
+
class="m-form-drawer"
|
|
4
|
+
v-model="visible"
|
|
5
|
+
:title="title"
|
|
6
|
+
:close-on-press-escape="true"
|
|
7
|
+
:append-to-body="true"
|
|
8
|
+
:show-close="true"
|
|
9
|
+
:close-on-click-modal="true"
|
|
10
|
+
:size="width"
|
|
11
|
+
:zIndex="zIndex"
|
|
12
|
+
@open="openHandler"
|
|
13
|
+
@opened="openedHandler"
|
|
14
|
+
>
|
|
15
|
+
<div v-if="visible" ref="drawerBody" class="m-drawer-body">
|
|
16
|
+
<Form
|
|
17
|
+
ref="form"
|
|
18
|
+
:size="size"
|
|
19
|
+
:disabled="disabled"
|
|
20
|
+
:config="config"
|
|
21
|
+
:init-values="values"
|
|
22
|
+
:parent-values="parentValues"
|
|
23
|
+
:label-width="labelWidth"
|
|
24
|
+
@change="changeHandler"
|
|
25
|
+
></Form>
|
|
26
|
+
<slot></slot>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<template #footer>
|
|
30
|
+
<TMagicRow class="dialog-footer">
|
|
31
|
+
<TMagicCol :span="12" style="text-align: left">
|
|
32
|
+
<div style="min-height: 1px">
|
|
33
|
+
<slot name="left"></slot>
|
|
34
|
+
</div>
|
|
35
|
+
</TMagicCol>
|
|
36
|
+
<TMagicCol :span="12">
|
|
37
|
+
<slot name="footer">
|
|
38
|
+
<TMagicButton @click="hide">关闭</TMagicButton>
|
|
39
|
+
<TMagicButton type="primary" @click="submitHandler" :loading="saveFetch">{{ confirmText }}</TMagicButton>
|
|
40
|
+
</slot>
|
|
41
|
+
</TMagicCol>
|
|
42
|
+
</TMagicRow>
|
|
43
|
+
</template>
|
|
44
|
+
</TMagicDrawer>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { ref, watchEffect } from 'vue';
|
|
49
|
+
|
|
50
|
+
import { TMagicButton, TMagicCol, TMagicDrawer, TMagicRow } from '@tmagic/design';
|
|
51
|
+
|
|
52
|
+
import Form from './Form.vue';
|
|
53
|
+
import type { FormConfig } from './schema';
|
|
54
|
+
|
|
55
|
+
defineOptions({
|
|
56
|
+
name: 'MFormDialog',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
withDefaults(
|
|
60
|
+
defineProps<{
|
|
61
|
+
config?: FormConfig;
|
|
62
|
+
values?: Object;
|
|
63
|
+
parentValues?: Object;
|
|
64
|
+
width?: string | number;
|
|
65
|
+
labelWidth?: string;
|
|
66
|
+
disabled?: boolean;
|
|
67
|
+
title?: string;
|
|
68
|
+
zIndex?: number;
|
|
69
|
+
size?: 'small' | 'default' | 'large';
|
|
70
|
+
confirmText?: string;
|
|
71
|
+
}>(),
|
|
72
|
+
{
|
|
73
|
+
config: () => [],
|
|
74
|
+
values: () => ({}),
|
|
75
|
+
confirmText: '确定',
|
|
76
|
+
},
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const emit = defineEmits(['close', 'submit', 'error', 'change', 'open', 'opened']);
|
|
80
|
+
|
|
81
|
+
const form = ref<InstanceType<typeof Form>>();
|
|
82
|
+
const drawerBody = ref<HTMLDivElement>();
|
|
83
|
+
const visible = ref(false);
|
|
84
|
+
const saveFetch = ref(false);
|
|
85
|
+
const bodyHeight = ref(0);
|
|
86
|
+
|
|
87
|
+
watchEffect(() => {
|
|
88
|
+
if (drawerBody.value) {
|
|
89
|
+
bodyHeight.value = drawerBody.value.clientHeight;
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const submitHandler = async () => {
|
|
94
|
+
try {
|
|
95
|
+
const values = await form.value?.submitForm();
|
|
96
|
+
emit('submit', values);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
emit('error', e);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const changeHandler = (value: any) => {
|
|
103
|
+
emit('change', value);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const openHandler = (value: any) => {
|
|
107
|
+
emit('open', value);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
const openedHandler = (value: any) => {
|
|
111
|
+
emit('opened', value);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const show = () => {
|
|
115
|
+
visible.value = true;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const hide = () => {
|
|
119
|
+
visible.value = false;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
defineExpose({
|
|
123
|
+
form,
|
|
124
|
+
saveFetch,
|
|
125
|
+
bodyHeight,
|
|
126
|
+
|
|
127
|
+
show,
|
|
128
|
+
hide,
|
|
129
|
+
});
|
|
130
|
+
</script>
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
<div
|
|
3
3
|
v-if="config"
|
|
4
4
|
:style="config.tip ? 'display: flex;align-items: baseline;' : ''"
|
|
5
|
-
:class="config.className"
|
|
6
|
-
class="m-form-container"
|
|
5
|
+
:class="`m-form-container m-container-${type || ''} ${config.className || ''}`"
|
|
7
6
|
>
|
|
8
7
|
<m-fields-hidden
|
|
9
8
|
v-if="type === 'hidden'"
|
package/src/index.ts
CHANGED
|
@@ -56,6 +56,7 @@ export * from './utils/useAddField';
|
|
|
56
56
|
|
|
57
57
|
export { default as MForm } from './Form.vue';
|
|
58
58
|
export { default as MFormDialog } from './FormDialog.vue';
|
|
59
|
+
export { default as MFormDrawer } from './FormDrawer.vue';
|
|
59
60
|
export { default as MContainer } from './containers/Container.vue';
|
|
60
61
|
export { default as MFieldset } from './containers/Fieldset.vue';
|
|
61
62
|
export { default as MPanel } from './containers/Panel.vue';
|
package/src/schema.ts
CHANGED
package/src/theme/index.scss
CHANGED
package/src/theme/panel.scss
CHANGED
|
@@ -278,6 +278,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
278
278
|
dialogVisible: import("vue").Ref<boolean>;
|
|
279
279
|
cancel: () => void;
|
|
280
280
|
save: () => Promise<void>;
|
|
281
|
+
show: () => void;
|
|
282
|
+
hide: () => void;
|
|
281
283
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "submit" | "error")[], "change" | "close" | "submit" | "error", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
282
284
|
config?: FormConfig | undefined;
|
|
283
285
|
values?: Object | undefined;
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import type { FormConfig } from './schema';
|
|
2
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
3
|
+
config?: FormConfig | undefined;
|
|
4
|
+
values?: Object | undefined;
|
|
5
|
+
parentValues?: Object | undefined;
|
|
6
|
+
width?: string | number | undefined;
|
|
7
|
+
labelWidth?: string | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
title?: string | undefined;
|
|
10
|
+
zIndex?: number | undefined;
|
|
11
|
+
size?: "default" | "small" | "large" | undefined;
|
|
12
|
+
confirmText?: string | undefined;
|
|
13
|
+
}>, {
|
|
14
|
+
config: () => never[];
|
|
15
|
+
values: () => {};
|
|
16
|
+
confirmText: string;
|
|
17
|
+
}>, {
|
|
18
|
+
form: import("vue").Ref<({
|
|
19
|
+
$: import("vue").ComponentInternalInstance;
|
|
20
|
+
$data: {};
|
|
21
|
+
$props: {
|
|
22
|
+
config?: FormConfig | undefined;
|
|
23
|
+
initValues?: Object | undefined;
|
|
24
|
+
lastValues?: Object | undefined;
|
|
25
|
+
isCompare?: boolean | undefined;
|
|
26
|
+
keyProp?: string | undefined;
|
|
27
|
+
parentValues?: Object | undefined;
|
|
28
|
+
labelWidth?: string | undefined;
|
|
29
|
+
disabled?: boolean | undefined;
|
|
30
|
+
stepActive?: string | number | undefined;
|
|
31
|
+
height?: string | undefined;
|
|
32
|
+
inline?: boolean | undefined;
|
|
33
|
+
labelPosition?: string | undefined;
|
|
34
|
+
readonly popperClass?: string | undefined;
|
|
35
|
+
key?: string | number | symbol | undefined;
|
|
36
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
37
|
+
readonly size?: "default" | "small" | "large" | undefined;
|
|
38
|
+
ref?: import("vue").VNodeRef | undefined;
|
|
39
|
+
ref_for?: boolean | undefined;
|
|
40
|
+
ref_key?: string | undefined;
|
|
41
|
+
onVnodeBeforeMount?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
42
|
+
[key: string]: any;
|
|
43
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
}>) => void)[] | undefined;
|
|
46
|
+
onVnodeMounted?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}>) => void)[] | undefined;
|
|
51
|
+
onVnodeBeforeUpdate?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
52
|
+
[key: string]: any;
|
|
53
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
54
|
+
[key: string]: any;
|
|
55
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
}>) => void)[] | undefined;
|
|
60
|
+
onVnodeUpdated?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}>, oldVNode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}>) => void)[] | undefined;
|
|
69
|
+
onVnodeBeforeUnmount?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
70
|
+
[key: string]: any;
|
|
71
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
72
|
+
[key: string]: any;
|
|
73
|
+
}>) => void)[] | undefined;
|
|
74
|
+
onVnodeUnmounted?: ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
75
|
+
[key: string]: any;
|
|
76
|
+
}>) => void) | ((vnode: import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}>) => void)[] | undefined;
|
|
79
|
+
class?: unknown;
|
|
80
|
+
style?: unknown;
|
|
81
|
+
readonly extendState?: ((state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
82
|
+
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
84
|
+
};
|
|
85
|
+
$attrs: {
|
|
86
|
+
[x: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
$refs: {
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
};
|
|
91
|
+
$slots: Readonly<{
|
|
92
|
+
[name: string]: import("vue").Slot<any> | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
95
|
+
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
96
|
+
$emit: (event: "change" | "field-input" | "field-change", ...args: any[]) => void;
|
|
97
|
+
$el: any;
|
|
98
|
+
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
99
|
+
config: {
|
|
100
|
+
type: import("vue").PropType<FormConfig>;
|
|
101
|
+
required: true;
|
|
102
|
+
default: () => never[];
|
|
103
|
+
};
|
|
104
|
+
popperClass: {
|
|
105
|
+
type: import("vue").PropType<string>;
|
|
106
|
+
};
|
|
107
|
+
initValues: {
|
|
108
|
+
type: import("vue").PropType<Object>;
|
|
109
|
+
required: true;
|
|
110
|
+
default: () => {};
|
|
111
|
+
};
|
|
112
|
+
lastValues: {
|
|
113
|
+
type: import("vue").PropType<Object>;
|
|
114
|
+
default: () => {};
|
|
115
|
+
};
|
|
116
|
+
isCompare: {
|
|
117
|
+
type: import("vue").PropType<boolean>;
|
|
118
|
+
default: boolean;
|
|
119
|
+
};
|
|
120
|
+
keyProp: {
|
|
121
|
+
type: import("vue").PropType<string>;
|
|
122
|
+
default: string;
|
|
123
|
+
};
|
|
124
|
+
parentValues: {
|
|
125
|
+
type: import("vue").PropType<Object>;
|
|
126
|
+
default: () => {};
|
|
127
|
+
};
|
|
128
|
+
labelWidth: {
|
|
129
|
+
type: import("vue").PropType<string>;
|
|
130
|
+
default: string;
|
|
131
|
+
};
|
|
132
|
+
disabled: {
|
|
133
|
+
type: import("vue").PropType<boolean>;
|
|
134
|
+
default: boolean;
|
|
135
|
+
};
|
|
136
|
+
stepActive: {
|
|
137
|
+
type: import("vue").PropType<string | number>;
|
|
138
|
+
default: number;
|
|
139
|
+
};
|
|
140
|
+
size: {
|
|
141
|
+
type: import("vue").PropType<"default" | "small" | "large">;
|
|
142
|
+
};
|
|
143
|
+
height: {
|
|
144
|
+
type: import("vue").PropType<string>;
|
|
145
|
+
default: string;
|
|
146
|
+
};
|
|
147
|
+
inline: {
|
|
148
|
+
type: import("vue").PropType<boolean>;
|
|
149
|
+
default: boolean;
|
|
150
|
+
};
|
|
151
|
+
labelPosition: {
|
|
152
|
+
type: import("vue").PropType<string>;
|
|
153
|
+
default: string;
|
|
154
|
+
};
|
|
155
|
+
extendState: {
|
|
156
|
+
type: import("vue").PropType<(state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>>;
|
|
157
|
+
};
|
|
158
|
+
}>> & {
|
|
159
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
160
|
+
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
161
|
+
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
values: import("vue").Ref<import("./schema").FormValue>;
|
|
164
|
+
lastValuesProcessed: import("vue").Ref<import("./schema").FormValue>;
|
|
165
|
+
formState: import("./schema").FormState;
|
|
166
|
+
initialized: import("vue").Ref<boolean>;
|
|
167
|
+
changeHandler: () => void;
|
|
168
|
+
resetForm: () => any;
|
|
169
|
+
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
170
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "field-input" | "field-change")[], string, {
|
|
171
|
+
config: FormConfig;
|
|
172
|
+
initValues: Object;
|
|
173
|
+
lastValues: Object;
|
|
174
|
+
isCompare: boolean;
|
|
175
|
+
keyProp: string;
|
|
176
|
+
parentValues: Object;
|
|
177
|
+
labelWidth: string;
|
|
178
|
+
disabled: boolean;
|
|
179
|
+
stepActive: string | number;
|
|
180
|
+
height: string;
|
|
181
|
+
inline: boolean;
|
|
182
|
+
labelPosition: string;
|
|
183
|
+
}, {}, string, {}> & {
|
|
184
|
+
beforeCreate?: ((() => void) | (() => void)[]) | undefined;
|
|
185
|
+
created?: ((() => void) | (() => void)[]) | undefined;
|
|
186
|
+
beforeMount?: ((() => void) | (() => void)[]) | undefined;
|
|
187
|
+
mounted?: ((() => void) | (() => void)[]) | undefined;
|
|
188
|
+
beforeUpdate?: ((() => void) | (() => void)[]) | undefined;
|
|
189
|
+
updated?: ((() => void) | (() => void)[]) | undefined;
|
|
190
|
+
activated?: ((() => void) | (() => void)[]) | undefined;
|
|
191
|
+
deactivated?: ((() => void) | (() => void)[]) | undefined;
|
|
192
|
+
beforeDestroy?: ((() => void) | (() => void)[]) | undefined;
|
|
193
|
+
beforeUnmount?: ((() => void) | (() => void)[]) | undefined;
|
|
194
|
+
destroyed?: ((() => void) | (() => void)[]) | undefined;
|
|
195
|
+
unmounted?: ((() => void) | (() => void)[]) | undefined;
|
|
196
|
+
renderTracked?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
197
|
+
renderTriggered?: (((e: import("vue").DebuggerEvent) => void) | ((e: import("vue").DebuggerEvent) => void)[]) | undefined;
|
|
198
|
+
errorCaptured?: (((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void) | ((err: unknown, instance: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null, info: string) => boolean | void)[]) | undefined;
|
|
199
|
+
};
|
|
200
|
+
$forceUpdate: () => void;
|
|
201
|
+
$nextTick: typeof import("vue").nextTick;
|
|
202
|
+
$watch<T extends string | ((...args: any) => any)>(source: T, cb: T extends (...args: any) => infer R ? (args_0: R, args_1: R) => any : (...args: any) => any, options?: import("vue").WatchOptions<boolean> | undefined): import("vue").WatchStopHandle;
|
|
203
|
+
} & Readonly<import("vue").ExtractPropTypes<{
|
|
204
|
+
config: {
|
|
205
|
+
type: import("vue").PropType<FormConfig>;
|
|
206
|
+
required: true;
|
|
207
|
+
default: () => never[];
|
|
208
|
+
};
|
|
209
|
+
popperClass: {
|
|
210
|
+
type: import("vue").PropType<string>;
|
|
211
|
+
};
|
|
212
|
+
initValues: {
|
|
213
|
+
type: import("vue").PropType<Object>;
|
|
214
|
+
required: true;
|
|
215
|
+
default: () => {};
|
|
216
|
+
};
|
|
217
|
+
lastValues: {
|
|
218
|
+
type: import("vue").PropType<Object>;
|
|
219
|
+
default: () => {};
|
|
220
|
+
};
|
|
221
|
+
isCompare: {
|
|
222
|
+
type: import("vue").PropType<boolean>;
|
|
223
|
+
default: boolean;
|
|
224
|
+
};
|
|
225
|
+
keyProp: {
|
|
226
|
+
type: import("vue").PropType<string>;
|
|
227
|
+
default: string;
|
|
228
|
+
};
|
|
229
|
+
parentValues: {
|
|
230
|
+
type: import("vue").PropType<Object>;
|
|
231
|
+
default: () => {};
|
|
232
|
+
};
|
|
233
|
+
labelWidth: {
|
|
234
|
+
type: import("vue").PropType<string>;
|
|
235
|
+
default: string;
|
|
236
|
+
};
|
|
237
|
+
disabled: {
|
|
238
|
+
type: import("vue").PropType<boolean>;
|
|
239
|
+
default: boolean;
|
|
240
|
+
};
|
|
241
|
+
stepActive: {
|
|
242
|
+
type: import("vue").PropType<string | number>;
|
|
243
|
+
default: number;
|
|
244
|
+
};
|
|
245
|
+
size: {
|
|
246
|
+
type: import("vue").PropType<"default" | "small" | "large">;
|
|
247
|
+
};
|
|
248
|
+
height: {
|
|
249
|
+
type: import("vue").PropType<string>;
|
|
250
|
+
default: string;
|
|
251
|
+
};
|
|
252
|
+
inline: {
|
|
253
|
+
type: import("vue").PropType<boolean>;
|
|
254
|
+
default: boolean;
|
|
255
|
+
};
|
|
256
|
+
labelPosition: {
|
|
257
|
+
type: import("vue").PropType<string>;
|
|
258
|
+
default: string;
|
|
259
|
+
};
|
|
260
|
+
extendState: {
|
|
261
|
+
type: import("vue").PropType<(state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>>;
|
|
262
|
+
};
|
|
263
|
+
}>> & {
|
|
264
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
265
|
+
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
266
|
+
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
267
|
+
} & import("vue").ShallowUnwrapRef<{
|
|
268
|
+
values: import("vue").Ref<import("./schema").FormValue>;
|
|
269
|
+
lastValuesProcessed: import("vue").Ref<import("./schema").FormValue>;
|
|
270
|
+
formState: import("./schema").FormState;
|
|
271
|
+
initialized: import("vue").Ref<boolean>;
|
|
272
|
+
changeHandler: () => void;
|
|
273
|
+
resetForm: () => any;
|
|
274
|
+
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
275
|
+
}> & {} & import("vue").ComponentCustomProperties & {}) | undefined>;
|
|
276
|
+
saveFetch: import("vue").Ref<boolean>;
|
|
277
|
+
bodyHeight: import("vue").Ref<number>;
|
|
278
|
+
show: () => void;
|
|
279
|
+
hide: () => void;
|
|
280
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "close" | "submit" | "error" | "open" | "opened")[], "change" | "close" | "submit" | "error" | "open" | "opened", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
281
|
+
config?: FormConfig | undefined;
|
|
282
|
+
values?: Object | undefined;
|
|
283
|
+
parentValues?: Object | undefined;
|
|
284
|
+
width?: string | number | undefined;
|
|
285
|
+
labelWidth?: string | undefined;
|
|
286
|
+
disabled?: boolean | undefined;
|
|
287
|
+
title?: string | undefined;
|
|
288
|
+
zIndex?: number | undefined;
|
|
289
|
+
size?: "default" | "small" | "large" | undefined;
|
|
290
|
+
confirmText?: string | undefined;
|
|
291
|
+
}>, {
|
|
292
|
+
config: () => never[];
|
|
293
|
+
values: () => {};
|
|
294
|
+
confirmText: string;
|
|
295
|
+
}>>> & {
|
|
296
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
297
|
+
onSubmit?: ((...args: any[]) => any) | undefined;
|
|
298
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
299
|
+
onClose?: ((...args: any[]) => any) | undefined;
|
|
300
|
+
onOpen?: ((...args: any[]) => any) | undefined;
|
|
301
|
+
onOpened?: ((...args: any[]) => any) | undefined;
|
|
302
|
+
}, {
|
|
303
|
+
config: FormConfig;
|
|
304
|
+
values: Object;
|
|
305
|
+
confirmText: string;
|
|
306
|
+
}, {}>, {
|
|
307
|
+
default?(_: {}): any;
|
|
308
|
+
left?(_: {}): any;
|
|
309
|
+
footer?(_: {}): any;
|
|
310
|
+
}>;
|
|
311
|
+
export default _default;
|
|
312
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
313
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
314
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
315
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
316
|
+
} : {
|
|
317
|
+
type: import('vue').PropType<T[K]>;
|
|
318
|
+
required: true;
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
type __VLS_WithDefaults<P, D> = {
|
|
322
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
|
|
323
|
+
default: D[K];
|
|
324
|
+
}> : P[K];
|
|
325
|
+
};
|
|
326
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
327
|
+
new (): {
|
|
328
|
+
$slots: S;
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
type __VLS_Prettify<T> = {
|
|
332
|
+
[K in keyof T]: T[K];
|
|
333
|
+
} & {};
|
package/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from './utils/form';
|
|
|
5
5
|
export * from './utils/useAddField';
|
|
6
6
|
export { default as MForm } from './Form.vue';
|
|
7
7
|
export { default as MFormDialog } from './FormDialog.vue';
|
|
8
|
+
export { default as MFormDrawer } from './FormDrawer.vue';
|
|
8
9
|
export { default as MContainer } from './containers/Container.vue';
|
|
9
10
|
export { default as MFieldset } from './containers/Fieldset.vue';
|
|
10
11
|
export { default as MPanel } from './containers/Panel.vue';
|
package/types/schema.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface Input {
|
|
|
109
109
|
export type TypeFunction = (mForm: FormState | undefined, data: {
|
|
110
110
|
model: Record<any, any>;
|
|
111
111
|
}) => string;
|
|
112
|
-
type FilterFunction = (mForm: FormState | undefined, data: {
|
|
112
|
+
export type FilterFunction = (mForm: FormState | undefined, data: {
|
|
113
113
|
model: Record<any, any>;
|
|
114
114
|
values: Record<any, any>;
|
|
115
115
|
parent?: Record<any, any>;
|