@tmagic/form 1.2.0-beta.1 → 1.2.0-beta.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/tmagic-form.mjs +2302 -2605
- package/dist/tmagic-form.mjs.map +1 -1
- package/dist/tmagic-form.umd.js +2325 -2629
- package/dist/tmagic-form.umd.js.map +1 -1
- package/package.json +5 -5
- package/src/Form.vue +123 -158
- package/src/FormDialog.vue +140 -158
- package/src/containers/Col.vue +22 -38
- package/src/containers/Container.vue +138 -171
- package/src/containers/Fieldset.vue +12 -8
- package/src/containers/GroupList.vue +80 -112
- package/src/containers/GroupListItem.vue +87 -124
- package/src/containers/Panel.vue +26 -49
- package/src/containers/Row.vue +18 -40
- package/src/containers/Step.vue +36 -48
- package/src/containers/Table.vue +449 -479
- package/src/containers/Tabs.vue +92 -118
- package/src/fields/Cascader.vue +88 -136
- package/src/fields/Checkbox.vue +46 -50
- package/src/fields/CheckboxGroup.vue +39 -35
- package/src/fields/ColorPicker.vue +5 -3
- package/src/fields/Date.vue +20 -26
- package/src/fields/DateTime.vue +31 -39
- package/src/fields/Daterange.vue +4 -3
- package/src/fields/Display.vue +1 -1
- package/src/fields/DynamicField.vue +63 -77
- package/src/fields/Hidden.vue +1 -1
- package/src/fields/Link.vue +65 -86
- package/src/fields/Number.vue +32 -34
- package/src/fields/RadioGroup.vue +23 -23
- package/src/fields/Select.vue +294 -310
- package/src/fields/SelectOptionGroups.vue +11 -6
- package/src/fields/SelectOptions.vue +5 -3
- package/src/fields/Switch.vue +46 -49
- package/src/fields/Text.vue +99 -107
- package/src/fields/Textarea.vue +32 -44
- package/src/fields/Time.vue +19 -30
- package/src/index.ts +22 -23
- package/src/schema.ts +46 -12
- package/src/utils/form.ts +4 -0
- package/types/Form.vue.d.ts +211 -111
- package/types/FormDialog.vue.d.ts +809 -154
- package/types/containers/Col.vue.d.ts +92 -40
- package/types/containers/Container.vue.d.ts +122 -65
- package/types/containers/Fieldset.vue.d.ts +1 -3
- package/types/containers/GroupList.vue.d.ts +86 -53
- package/types/containers/GroupListItem.vue.d.ts +97 -67
- package/types/containers/Panel.vue.d.ts +92 -39
- package/types/containers/Row.vue.d.ts +92 -39
- package/types/containers/Step.vue.d.ts +102 -42
- package/types/containers/Table.vue.d.ts +157 -130
- package/types/containers/Tabs.vue.d.ts +93 -50
- package/types/fields/Cascader.vue.d.ts +95 -71
- package/types/fields/Checkbox.vue.d.ts +95 -56
- package/types/fields/CheckboxGroup.vue.d.ts +95 -53
- package/types/fields/ColorPicker.vue.d.ts +1 -3
- package/types/fields/Date.vue.d.ts +95 -54
- package/types/fields/DateTime.vue.d.ts +95 -54
- package/types/fields/Daterange.vue.d.ts +1 -3
- package/types/fields/Display.vue.d.ts +1 -3
- package/types/fields/DynamicField.vue.d.ts +95 -64
- package/types/fields/Hidden.vue.d.ts +1 -3
- package/types/fields/Link.vue.d.ts +60 -657
- package/types/fields/Number.vue.d.ts +99 -56
- package/types/fields/RadioGroup.vue.d.ts +96 -52
- package/types/fields/Select.vue.d.ts +97 -65
- package/types/fields/SelectOptionGroups.vue.d.ts +1 -3
- package/types/fields/SelectOptions.vue.d.ts +1 -3
- package/types/fields/Switch.vue.d.ts +95 -56
- package/types/fields/Text.vue.d.ts +98 -57
- package/types/fields/Textarea.vue.d.ts +100 -60
- package/types/fields/Time.vue.d.ts +95 -55
- package/types/index.d.ts +0 -1
- package/types/schema.d.ts +38 -9
- package/src/utils/fieldProps.ts +0 -39
- package/types/utils/fieldProps.d.ts +0 -21
package/src/containers/Step.vue
CHANGED
|
@@ -1,82 +1,70 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<
|
|
4
|
-
<
|
|
3
|
+
<TMagicSteps :active="active" align-center :space="config.space">
|
|
4
|
+
<TMagicStep
|
|
5
5
|
v-for="(item, index) in config.items"
|
|
6
6
|
:key="item.__key"
|
|
7
7
|
:title="item.title"
|
|
8
8
|
:active="active"
|
|
9
9
|
@click="stepClick(index)"
|
|
10
|
-
></
|
|
11
|
-
</
|
|
10
|
+
></TMagicStep>
|
|
11
|
+
</TMagicSteps>
|
|
12
12
|
|
|
13
13
|
<template v-for="(step, index) in config.items">
|
|
14
14
|
<template v-for="item in step.items">
|
|
15
|
-
<
|
|
15
|
+
<Container
|
|
16
16
|
v-if="item"
|
|
17
17
|
v-show="active - 1 === index"
|
|
18
18
|
:key="item[mForm?.keyProp || '__key']"
|
|
19
19
|
:config="item"
|
|
20
20
|
:model="step.name ? model[step.name] : model"
|
|
21
|
-
:prop="step.name"
|
|
21
|
+
:prop="`${step.name}`"
|
|
22
22
|
:size="size"
|
|
23
23
|
:label-width="config.labelWidth || labelWidth"
|
|
24
24
|
@change="changeHandler"
|
|
25
|
-
></
|
|
25
|
+
></Container>
|
|
26
26
|
</template>
|
|
27
27
|
</template>
|
|
28
28
|
</div>
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
|
-
<script lang="ts">
|
|
32
|
-
import {
|
|
31
|
+
<script setup lang="ts" name="MFormStep">
|
|
32
|
+
import { inject, ref, watchEffect } from 'vue';
|
|
33
33
|
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
export default defineComponent({
|
|
37
|
-
name: 'm-form-step',
|
|
38
|
-
|
|
39
|
-
props: {
|
|
40
|
-
model: {
|
|
41
|
-
type: Object,
|
|
42
|
-
default: () => ({}),
|
|
43
|
-
},
|
|
34
|
+
import { TMagicStep, TMagicSteps } from '@tmagic/design';
|
|
44
35
|
|
|
45
|
-
|
|
46
|
-
type: Object as PropType<StepConfig>,
|
|
47
|
-
default: () => ({}),
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
stepActive: {
|
|
51
|
-
type: Number,
|
|
52
|
-
default: () => 1,
|
|
53
|
-
},
|
|
36
|
+
import { FormState, StepConfig } from '../schema';
|
|
54
37
|
|
|
55
|
-
|
|
38
|
+
import Container from './Container.vue';
|
|
56
39
|
|
|
57
|
-
|
|
40
|
+
const props = withDefaults(
|
|
41
|
+
defineProps<{
|
|
42
|
+
model: any;
|
|
43
|
+
config: StepConfig;
|
|
44
|
+
stepActive?: number;
|
|
45
|
+
labelWidth?: string;
|
|
46
|
+
size?: string;
|
|
47
|
+
}>(),
|
|
48
|
+
{
|
|
49
|
+
stepActive: 1,
|
|
58
50
|
},
|
|
51
|
+
);
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
const emit = defineEmits(['change']);
|
|
61
54
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const active = ref(1);
|
|
55
|
+
const mForm = inject<FormState | undefined>('mForm');
|
|
56
|
+
const active = ref(1);
|
|
65
57
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const stepClick = (index: number) => {
|
|
71
|
-
active.value = index + 1;
|
|
72
|
-
mForm?.$emit('update:stepActive', active.value);
|
|
73
|
-
};
|
|
58
|
+
watchEffect(() => {
|
|
59
|
+
active.value = props.stepActive;
|
|
60
|
+
});
|
|
74
61
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
62
|
+
const stepClick = (index: number) => {
|
|
63
|
+
active.value = index + 1;
|
|
64
|
+
mForm?.$emit('update:stepActive', active.value);
|
|
65
|
+
};
|
|
78
66
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
67
|
+
const changeHandler = () => {
|
|
68
|
+
emit('change', props.model);
|
|
69
|
+
};
|
|
82
70
|
</script>
|