@tmagic/form 1.2.0-beta.2 → 1.2.0-beta.4
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 +2081 -2500
- package/dist/tmagic-form.mjs.map +1 -1
- package/dist/tmagic-form.umd.js +2104 -2524
- package/dist/tmagic-form.umd.js.map +1 -1
- package/package.json +3 -4
- package/src/Form.vue +116 -159
- package/src/FormDialog.vue +104 -126
- package/src/containers/Col.vue +22 -38
- package/src/containers/Container.vue +135 -171
- package/src/containers/Fieldset.vue +11 -7
- 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 +437 -478
- package/src/containers/Tabs.vue +89 -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 +4 -2
- package/src/fields/Date.vue +20 -26
- package/src/fields/DateTime.vue +31 -39
- package/src/fields/Daterange.vue +3 -2
- package/src/fields/DynamicField.vue +63 -77
- 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 +10 -5
- package/src/fields/SelectOptions.vue +4 -2
- 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 +45 -12
- package/types/Form.vue.d.ts +213 -111
- package/types/FormDialog.vue.d.ts +812 -155
- package/types/containers/Col.vue.d.ts +94 -40
- package/types/containers/Container.vue.d.ts +124 -65
- package/types/containers/GroupList.vue.d.ts +88 -53
- package/types/containers/GroupListItem.vue.d.ts +99 -67
- package/types/containers/Panel.vue.d.ts +92 -39
- package/types/containers/Row.vue.d.ts +94 -39
- package/types/containers/Step.vue.d.ts +104 -42
- package/types/containers/Table.vue.d.ts +157 -130
- package/types/containers/Tabs.vue.d.ts +95 -50
- package/types/fields/Cascader.vue.d.ts +97 -71
- package/types/fields/Checkbox.vue.d.ts +97 -56
- package/types/fields/CheckboxGroup.vue.d.ts +97 -53
- package/types/fields/Date.vue.d.ts +97 -54
- package/types/fields/DateTime.vue.d.ts +97 -54
- package/types/fields/DynamicField.vue.d.ts +97 -64
- package/types/fields/Link.vue.d.ts +62 -657
- package/types/fields/Number.vue.d.ts +101 -56
- package/types/fields/RadioGroup.vue.d.ts +98 -52
- package/types/fields/Select.vue.d.ts +99 -65
- package/types/fields/Switch.vue.d.ts +97 -56
- package/types/fields/Text.vue.d.ts +100 -57
- package/types/fields/Textarea.vue.d.ts +102 -60
- package/types/fields/Time.vue.d.ts +97 -55
- package/types/index.d.ts +0 -1
- package/types/schema.d.ts +37 -9
- package/src/utils/fieldProps.ts +0 -39
- package/types/utils/fieldProps.d.ts +0 -21
package/src/fields/Number.vue
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
2
|
+
<TMagicInputNumber
|
|
3
3
|
v-if="model"
|
|
4
4
|
v-model="model[name]"
|
|
5
5
|
clearable
|
|
@@ -12,42 +12,40 @@
|
|
|
12
12
|
:disabled="disabled"
|
|
13
13
|
@change="changeHandler"
|
|
14
14
|
@input="inputHandler"
|
|
15
|
-
></
|
|
15
|
+
></TMagicInputNumber>
|
|
16
16
|
</template>
|
|
17
17
|
|
|
18
|
-
<script lang="ts">
|
|
19
|
-
import {
|
|
18
|
+
<script lang="ts" setup>
|
|
19
|
+
import { inject } from 'vue';
|
|
20
|
+
|
|
21
|
+
import { TMagicInputNumber } from '@tmagic/design';
|
|
20
22
|
|
|
21
23
|
import { FormState, NumberConfig } from '../schema';
|
|
22
|
-
import fieldProps from '../utils/fieldProps';
|
|
23
24
|
import { useAddField } from '../utils/useAddField';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
},
|
|
52
|
-
});
|
|
25
|
+
|
|
26
|
+
const props = defineProps<{
|
|
27
|
+
config: NumberConfig;
|
|
28
|
+
model: any;
|
|
29
|
+
initValues?: any;
|
|
30
|
+
values?: any;
|
|
31
|
+
name: string;
|
|
32
|
+
prop: string;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
size: 'mini' | 'small' | 'medium';
|
|
35
|
+
}>();
|
|
36
|
+
|
|
37
|
+
const emit = defineEmits(['change', 'input']);
|
|
38
|
+
|
|
39
|
+
useAddField(props.prop);
|
|
40
|
+
|
|
41
|
+
const mForm = inject<FormState | null>('mForm');
|
|
42
|
+
|
|
43
|
+
const changeHandler = (value: number) => {
|
|
44
|
+
emit('change', value);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const inputHandler = (v: string) => {
|
|
48
|
+
emit('input', v);
|
|
49
|
+
mForm?.$emit('field-input', props.prop, v);
|
|
50
|
+
};
|
|
53
51
|
</script>
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
2
|
+
<TMagicRadioGroup v-if="model" v-model="model[name]" :size="size" :disabled="disabled" @change="changeHandler">
|
|
3
|
+
<TMagicRadio v-for="option in config.options" :label="option.value" :key="`${option.value}`">{{
|
|
4
|
+
option.text
|
|
5
|
+
}}</TMagicRadio>
|
|
6
|
+
</TMagicRadioGroup>
|
|
5
7
|
</template>
|
|
6
8
|
|
|
7
|
-
<script lang="ts">
|
|
8
|
-
import {
|
|
9
|
+
<script lang="ts" setup>
|
|
10
|
+
import { TMagicRadio, TMagicRadioGroup } from '@tmagic/design';
|
|
9
11
|
|
|
10
|
-
import
|
|
12
|
+
import { RadioGroupConfig } from '../schema';
|
|
11
13
|
import { useAddField } from '../utils/useAddField';
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
config: RadioGroupConfig;
|
|
17
|
+
model: any;
|
|
18
|
+
initValues?: any;
|
|
19
|
+
values?: any;
|
|
20
|
+
name: string;
|
|
21
|
+
prop: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
size: 'mini' | 'small' | 'medium';
|
|
24
|
+
}>();
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
...fieldProps,
|
|
18
|
-
config: {
|
|
19
|
-
type: Object,
|
|
20
|
-
required: true,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
26
|
+
const emit = defineEmits(['change']);
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
const changeHandler = (value: number) => {
|
|
29
|
+
emit('change', value);
|
|
30
|
+
};
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
useAddField(props.prop);
|
|
28
|
-
return {
|
|
29
|
-
changeHandler: (v: string | number | boolean) => emit('change', v),
|
|
30
|
-
};
|
|
31
|
-
},
|
|
32
|
-
});
|
|
32
|
+
useAddField(props.prop);
|
|
33
33
|
</script>
|