@tmagic/form 1.1.0-beta.4 → 1.1.0-beta.7
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.es.js → tmagic-form.mjs} +213 -177
- package/dist/tmagic-form.mjs.map +1 -0
- package/dist/tmagic-form.umd.js +217 -181
- package/dist/tmagic-form.umd.js.map +1 -1
- package/package.json +16 -15
- package/src/Form.vue +3 -7
- package/src/fields/Cascader.vue +3 -5
- package/src/fields/ColorPicker.vue +19 -26
- package/src/fields/Daterange.vue +73 -52
- package/src/fields/Display.vue +13 -23
- package/src/fields/Hidden.vue +10 -20
- package/src/fields/Select.vue +1 -2
- package/src/index.ts +4 -4
- package/tsconfig.build.json +13 -0
- package/types/Form.vue.d.ts +125 -0
- package/types/FormDialog.vue.d.ts +300 -0
- package/{dist/types/src → types}/containers/Col.vue.d.ts +4 -4
- package/types/containers/Container.vue.d.ts +70 -0
- package/types/containers/Fieldset.vue.d.ts +118 -0
- package/{dist/types/src → types}/containers/GroupList.vue.d.ts +6 -6
- package/{dist/types/src → types}/containers/GroupListItem.vue.d.ts +15 -15
- package/{dist/types/src → types}/containers/Panel.vue.d.ts +6 -6
- package/{dist/types/src → types}/containers/Row.vue.d.ts +3 -3
- package/{dist/types/src → types}/containers/Step.vue.d.ts +4 -4
- package/types/containers/Table.vue.d.ts +128 -0
- package/{dist/types/src → types}/containers/Tabs.vue.d.ts +11 -7
- package/types/fields/Cascader.vue.d.ts +74 -0
- package/{dist/types/src → types}/fields/Checkbox.vue.d.ts +5 -5
- package/{dist/types/src → types}/fields/CheckboxGroup.vue.d.ts +3 -3
- package/types/fields/ColorPicker.vue.d.ts +100 -0
- package/{dist/types/src → types}/fields/Date.vue.d.ts +3 -3
- package/{dist/types/src → types}/fields/DateTime.vue.d.ts +3 -3
- package/types/fields/Daterange.vue.d.ts +100 -0
- package/types/fields/Display.vue.d.ts +84 -0
- package/{dist/types/src → types}/fields/DynamicField.vue.d.ts +4 -4
- package/types/fields/Hidden.vue.d.ts +84 -0
- package/types/fields/Link.vue.d.ts +686 -0
- package/{dist/types/src → types}/fields/Number.vue.d.ts +3 -3
- package/{dist/types/src → types}/fields/RadioGroup.vue.d.ts +4 -5
- package/types/fields/Select.vue.d.ts +67 -0
- package/types/fields/SelectOptionGroups.vue.d.ts +64 -0
- package/types/fields/SelectOptions.vue.d.ts +68 -0
- package/{dist/types/src → types}/fields/Switch.vue.d.ts +6 -6
- package/{dist/types/src → types}/fields/Text.vue.d.ts +4 -4
- package/{dist/types/src → types}/fields/Textarea.vue.d.ts +10 -4
- package/{dist/types/src → types}/fields/Time.vue.d.ts +8 -4
- package/{dist/types/src → types}/index.d.ts +1 -0
- package/{dist/types/src → types}/schema.d.ts +0 -0
- package/{dist/types/src → types}/utils/config.d.ts +0 -0
- package/types/utils/containerProps.d.ts +26 -0
- package/types/utils/createForm.d.ts +3 -0
- package/{dist/types/src → types}/utils/fieldProps.d.ts +0 -0
- package/{dist/types/src → types}/utils/form.d.ts +0 -0
- package/types/utils/useAddField.d.ts +1 -0
- package/dist/tmagic-form.es.js.map +0 -1
- package/dist/types/src/containers/Container.vue.d.ts +0 -70
- package/dist/types/src/containers/Fieldset.vue.d.ts +0 -79
- package/dist/types/src/containers/Table.vue.d.ts +0 -128
- package/dist/types/src/fields/Daterange.vue.d.ts +0 -57
- package/dist/types/src/fields/Display.vue.d.ts +0 -3
- package/dist/types/src/fields/Hidden.vue.d.ts +0 -3
- package/dist/types/src/fields/SelectOptionGroups.vue.d.ts +0 -13
- package/dist/types/src/fields/SelectOptions.vue.d.ts +0 -21
- package/dist/types/src/shims-vue.d.ts +0 -6
- package/dist/types/src/utils/useAddField.d.ts +0 -1
- package/dist/types/src/vite-env.d.ts +0 -1
- package/src/vite-env.d.ts +0 -1
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.1.0-beta.
|
|
2
|
+
"version": "1.1.0-beta.7",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"dist/*",
|
|
6
6
|
"src/theme/*"
|
|
7
7
|
],
|
|
8
8
|
"main": "dist/tmagic-form.umd.js",
|
|
9
|
-
"module": "dist/tmagic-form.
|
|
9
|
+
"module": "dist/tmagic-form.mjs",
|
|
10
10
|
"style": "dist/style.css",
|
|
11
|
-
"types": "
|
|
11
|
+
"types": "types/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
13
|
".": {
|
|
14
|
-
"import": "./dist/tmagic-form.
|
|
14
|
+
"import": "./dist/tmagic-form.mjs",
|
|
15
15
|
"require": "./dist/tmagic-form.umd.js"
|
|
16
16
|
},
|
|
17
17
|
"./dist/style.css": {
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
},
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "
|
|
25
|
+
"build": "npm run build:type && vite build",
|
|
26
|
+
"build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
|
|
27
|
+
"clear:type": "rimraf ./types"
|
|
26
28
|
},
|
|
27
29
|
"engines": {
|
|
28
30
|
"node": ">=14"
|
|
@@ -33,29 +35,28 @@
|
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@element-plus/icons-vue": "^2.0.6",
|
|
36
|
-
"@tmagic/utils": "1.1.0-beta.
|
|
38
|
+
"@tmagic/utils": "1.1.0-beta.7",
|
|
37
39
|
"element-plus": "^2.2.6",
|
|
38
40
|
"lodash-es": "^4.17.21",
|
|
39
|
-
"moment": "^2.29.2",
|
|
40
41
|
"sortablejs": "^1.14.0",
|
|
41
|
-
"vue": "^3.2.
|
|
42
|
+
"vue": "^3.2.37"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"element-plus": "^2.2.6",
|
|
45
|
-
"vue": "^3.2.
|
|
46
|
+
"vue": "^3.2.37"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@babel/core": "^7.18.0",
|
|
49
50
|
"@types/lodash-es": "^4.17.4",
|
|
50
51
|
"@types/node": "^15.12.4",
|
|
51
52
|
"@types/sortablejs": "^1.10.7",
|
|
52
|
-
"@vitejs/plugin-vue": "^
|
|
53
|
-
"@vue/compiler-sfc": "^3.2.
|
|
53
|
+
"@vitejs/plugin-vue": "^3.0.1",
|
|
54
|
+
"@vue/compiler-sfc": "^3.2.37",
|
|
54
55
|
"@vue/test-utils": "^2.0.0",
|
|
56
|
+
"rimraf": "^3.0.2",
|
|
55
57
|
"sass": "^1.35.1",
|
|
56
|
-
"typescript": "^4.
|
|
57
|
-
"vite": "^
|
|
58
|
-
"
|
|
59
|
-
"vue-tsc": "^0.38.2"
|
|
58
|
+
"typescript": "^4.7.4",
|
|
59
|
+
"vite": "^3.0.4",
|
|
60
|
+
"vue-tsc": "^0.39.4"
|
|
60
61
|
}
|
|
61
62
|
}
|
package/src/Form.vue
CHANGED
|
@@ -26,22 +26,17 @@
|
|
|
26
26
|
|
|
27
27
|
<script lang="ts">
|
|
28
28
|
import { defineComponent, PropType, provide, reactive, ref, toRaw, watch } from 'vue';
|
|
29
|
-
import { ElForm } from 'element-plus';
|
|
30
29
|
import { cloneDeep, isEqual } from 'lodash-es';
|
|
31
30
|
|
|
32
31
|
import { getConfig } from './utils/config';
|
|
33
32
|
import { initValue } from './utils/form';
|
|
34
33
|
import { FormConfig, FormState, FormValue } from './schema';
|
|
35
34
|
|
|
36
|
-
|
|
35
|
+
interface ValidateError {
|
|
37
36
|
message: string;
|
|
38
37
|
field: string;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
export interface FieldErrorList {
|
|
42
|
-
[field: string]: ValidateError[];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
40
|
export default defineComponent({
|
|
46
41
|
name: 'm-form',
|
|
47
42
|
|
|
@@ -112,7 +107,8 @@ export default defineComponent({
|
|
|
112
107
|
emits: ['change', 'field-input', 'field-change'],
|
|
113
108
|
|
|
114
109
|
setup(props, { emit }) {
|
|
115
|
-
|
|
110
|
+
// InstanceType<typeof ElForm>,构建types的时候会出错
|
|
111
|
+
const elForm = ref<any>();
|
|
116
112
|
const initialized = ref(false);
|
|
117
113
|
const values = ref<FormValue>({});
|
|
118
114
|
const fields = new Map<string, any>();
|
package/src/fields/Cascader.vue
CHANGED
|
@@ -24,11 +24,9 @@ import {
|
|
|
24
24
|
getCurrentInstance,
|
|
25
25
|
inject,
|
|
26
26
|
PropType,
|
|
27
|
-
Ref,
|
|
28
27
|
ref,
|
|
29
28
|
watchEffect,
|
|
30
29
|
} from 'vue';
|
|
31
|
-
import { ElCascader, ElDialog } from 'element-plus';
|
|
32
30
|
|
|
33
31
|
import { CascaderConfig, FormState } from '../schema';
|
|
34
32
|
import { getConfig } from '../utils/config';
|
|
@@ -56,11 +54,11 @@ export default defineComponent({
|
|
|
56
54
|
|
|
57
55
|
const requestFunc = getConfig('request') as Function;
|
|
58
56
|
|
|
59
|
-
const cascader
|
|
60
|
-
const dialog
|
|
57
|
+
const cascader = ref<any>();
|
|
58
|
+
const dialog = ref<any>();
|
|
61
59
|
|
|
62
60
|
const options = Array.isArray(props.config.options) ? ref(props.config.options) : ref([]);
|
|
63
|
-
const remoteData
|
|
61
|
+
const remoteData = ref<any>(null);
|
|
64
62
|
|
|
65
63
|
const setRemoteOptions = async function () {
|
|
66
64
|
const { config } = props;
|
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
></el-color-picker>
|
|
10
|
-
</div>
|
|
2
|
+
<el-color-picker
|
|
3
|
+
v-model="model[name]"
|
|
4
|
+
:size="size"
|
|
5
|
+
:disabled="disabled"
|
|
6
|
+
:showAlpha="true"
|
|
7
|
+
@change="changeHandler"
|
|
8
|
+
></el-color-picker>
|
|
11
9
|
</template>
|
|
12
10
|
|
|
13
|
-
<script lang="ts">
|
|
14
|
-
import { defineComponent, PropType } from 'vue';
|
|
15
|
-
|
|
11
|
+
<script lang="ts" setup>
|
|
16
12
|
import { ColorPickConfig } from '../schema';
|
|
17
|
-
import fieldProps from '../utils/fieldProps';
|
|
18
13
|
import { useAddField } from '../utils/useAddField';
|
|
19
|
-
export default defineComponent({
|
|
20
|
-
name: 'm-fields-color-picker',
|
|
21
|
-
});
|
|
22
|
-
</script>
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
15
|
+
const props = defineProps<{
|
|
16
|
+
config: ColorPickConfig;
|
|
17
|
+
model: any;
|
|
18
|
+
initValues?: any;
|
|
19
|
+
values?: any;
|
|
20
|
+
name: string;
|
|
21
|
+
prop: string;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
size: 'mini' | 'small' | 'medium';
|
|
24
|
+
}>();
|
|
26
25
|
|
|
27
|
-
const
|
|
28
|
-
...fieldProps,
|
|
29
|
-
config: {
|
|
30
|
-
type: Object as PropType<ColorPickConfig>,
|
|
31
|
-
required: true,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
26
|
+
const emit = defineEmits(['change']);
|
|
34
27
|
|
|
35
28
|
useAddField(props.prop);
|
|
36
29
|
|
package/src/fields/Daterange.vue
CHANGED
|
@@ -13,70 +13,91 @@
|
|
|
13
13
|
></el-date-picker>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
|
-
<script lang="ts">
|
|
17
|
-
import {
|
|
16
|
+
<script lang="ts" setup>
|
|
17
|
+
import { ref, watch } from 'vue';
|
|
18
18
|
|
|
19
19
|
import { datetimeFormatter } from '@tmagic/utils';
|
|
20
20
|
|
|
21
21
|
import { DaterangeConfig } from '../schema';
|
|
22
|
-
import fieldProps from '../utils/fieldProps';
|
|
23
22
|
import { useAddField } from '../utils/useAddField';
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const props = defineProps<{
|
|
25
|
+
config: DaterangeConfig;
|
|
26
|
+
model: any;
|
|
27
|
+
initValues?: any;
|
|
28
|
+
values?: any;
|
|
29
|
+
name: string;
|
|
30
|
+
prop: string;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
size: 'mini' | 'small' | 'medium';
|
|
33
|
+
}>();
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
...fieldProps,
|
|
30
|
-
config: {
|
|
31
|
-
type: Object as PropType<DaterangeConfig>,
|
|
32
|
-
required: true,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
+
const emit = defineEmits(['change']);
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
useAddField(props.prop);
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
40
|
+
const { names } = props.config;
|
|
41
|
+
const value = ref<(Date | undefined)[] | null>([]);
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
if (props.model !== undefined) {
|
|
44
|
+
if (names?.length) {
|
|
45
|
+
watch(
|
|
46
|
+
[() => props.model[names[0]], () => props.model[names[1]]],
|
|
47
|
+
([start, end], [preStart, preEnd]) => {
|
|
48
|
+
if (!value.value) {
|
|
49
|
+
value.value = [];
|
|
50
|
+
}
|
|
51
|
+
if (!start || !end) value.value = [];
|
|
52
|
+
if (start !== preStart) value.value[0] = new Date(start);
|
|
53
|
+
if (end !== preEnd) value.value[1] = new Date(end);
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
immediate: true,
|
|
57
|
+
},
|
|
58
|
+
);
|
|
59
|
+
} else if (props.name && props.model[props.name]) {
|
|
60
|
+
watch(
|
|
61
|
+
() => props.model[props.name],
|
|
62
|
+
(start, preStart) => {
|
|
63
|
+
if (start !== preStart) value.value = start.map((item: string) => (item ? new Date(item) : undefined));
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
immediate: true,
|
|
67
|
+
},
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
44
71
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
value.value = props.model[props.name].map((item: string) => datetimeFormatter(item, ''));
|
|
50
|
-
}
|
|
72
|
+
const setValue = (v: Date[] | Date) => {
|
|
73
|
+
names?.forEach((item, index) => {
|
|
74
|
+
if (!props.model) {
|
|
75
|
+
return;
|
|
51
76
|
}
|
|
77
|
+
if (Array.isArray(v)) {
|
|
78
|
+
props.model[item] = datetimeFormatter(v[index]?.toString(), '');
|
|
79
|
+
} else {
|
|
80
|
+
props.model[item] = undefined;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
52
84
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
names.forEach((item, index) => {
|
|
56
|
-
if (props.model) {
|
|
57
|
-
props.model[item] = datetimeFormatter(v[index].toString(), '');
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
} else if (props.model && props.name && v instanceof Date) {
|
|
61
|
-
props.model[props.name] = datetimeFormatter(v.toString(), '');
|
|
62
|
-
} else if (names?.length) {
|
|
63
|
-
names.forEach((item) => {
|
|
64
|
-
if (props.model) {
|
|
65
|
-
props.model[item] = undefined;
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
} else if (props.name) {
|
|
69
|
-
props.model[props.name] = undefined;
|
|
70
|
-
}
|
|
71
|
-
};
|
|
85
|
+
const changeHandler = (v: Date[]) => {
|
|
86
|
+
const value = v || [];
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
88
|
+
if (props.name) {
|
|
89
|
+
emit(
|
|
90
|
+
'change',
|
|
91
|
+
value.map((item?: Date) => {
|
|
92
|
+
if (item) return datetimeFormatter(item, '');
|
|
93
|
+
return undefined;
|
|
94
|
+
}),
|
|
95
|
+
);
|
|
96
|
+
} else {
|
|
97
|
+
if (names?.length) {
|
|
98
|
+
setValue(value);
|
|
99
|
+
}
|
|
100
|
+
emit('change', value);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
82
103
|
</script>
|
package/src/fields/Display.vue
CHANGED
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<span v-if="model">{{ model[
|
|
2
|
+
<span v-if="model">{{ model[name] }}</span>
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { computed, defineComponent, PropType } from 'vue';
|
|
7
|
-
|
|
5
|
+
<script setup lang="ts">
|
|
8
6
|
import { DisplayConfig } from '../schema';
|
|
9
|
-
import fieldProps from '../utils/fieldProps';
|
|
10
7
|
import { useAddField } from '../utils/useAddField';
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
config: {
|
|
21
|
-
type: Object as PropType<DisplayConfig>,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const n = computed(() => props.name || props.config.name || '');
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
config: DisplayConfig;
|
|
11
|
+
model: any;
|
|
12
|
+
initValues?: any;
|
|
13
|
+
values?: any;
|
|
14
|
+
name: string;
|
|
15
|
+
prop: string;
|
|
16
|
+
}>();
|
|
27
17
|
|
|
28
|
-
if (props.config.initValue &&
|
|
29
|
-
// eslint-disable-next-line
|
|
30
|
-
props.model[
|
|
18
|
+
if (props.config.initValue && props.model) {
|
|
19
|
+
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
20
|
+
props.model[props.name] = props.config.initValue;
|
|
31
21
|
}
|
|
32
22
|
|
|
33
23
|
useAddField(props.prop);
|
package/src/fields/Hidden.vue
CHANGED
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<input v-if="model" v-model="model[
|
|
2
|
+
<input v-if="model" v-model="model[name]" type="hidden" />
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
|
-
<script lang="ts">
|
|
6
|
-
import { computed, defineComponent, PropType } from 'vue';
|
|
7
|
-
|
|
5
|
+
<script setup lang="ts">
|
|
8
6
|
import { HiddenConfig } from '../schema';
|
|
9
|
-
import fieldProps from '../utils/fieldProps';
|
|
10
7
|
import { useAddField } from '../utils/useAddField';
|
|
11
8
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
config: {
|
|
21
|
-
type: Object as PropType<HiddenConfig>,
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const n = computed(() => props.name || props.config.name || '');
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
config: HiddenConfig;
|
|
11
|
+
model: any;
|
|
12
|
+
initValues?: any;
|
|
13
|
+
values?: any;
|
|
14
|
+
name: string;
|
|
15
|
+
prop: string;
|
|
16
|
+
}>();
|
|
27
17
|
|
|
28
18
|
useAddField(props.prop);
|
|
29
19
|
</script>
|
package/src/fields/Select.vue
CHANGED
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
29
|
import { defineComponent, inject, onBeforeMount, onMounted, PropType, Ref, ref, watch } from 'vue';
|
|
30
|
-
import { ElSelect } from 'element-plus';
|
|
31
30
|
|
|
32
31
|
import { FormState, SelectConfig, SelectGroupOption, SelectOption } from '../schema';
|
|
33
32
|
import { getConfig } from '../utils/config';
|
|
@@ -56,7 +55,7 @@ export default defineComponent({
|
|
|
56
55
|
if (!props.model) throw new Error('不能没有model');
|
|
57
56
|
useAddField(props.prop);
|
|
58
57
|
|
|
59
|
-
const select = ref<
|
|
58
|
+
const select = ref<any>();
|
|
60
59
|
const mForm = inject<FormState | undefined>('mForm');
|
|
61
60
|
const options = ref<SelectOption[] | SelectGroupOption[]>([]);
|
|
62
61
|
const localOptions = ref<SelectOption[] | SelectGroupOption[]>([]);
|
package/src/index.ts
CHANGED
|
@@ -105,17 +105,17 @@ const install = (app: App, opt: any) => {
|
|
|
105
105
|
app.component(Text.name, Text);
|
|
106
106
|
app.component(Number.name, Number);
|
|
107
107
|
app.component(Textarea.name, Textarea);
|
|
108
|
-
app.component(
|
|
108
|
+
app.component('m-fields-hidden', Hidden);
|
|
109
109
|
app.component(Date.name, Date);
|
|
110
110
|
app.component(DateTime.name, DateTime);
|
|
111
111
|
app.component(Time.name, Time);
|
|
112
112
|
app.component(Checkbox.name, Checkbox);
|
|
113
113
|
app.component(Switch.name, Switch);
|
|
114
|
-
app.component(
|
|
115
|
-
app.component(
|
|
114
|
+
app.component('m-fields-daterange', Daterange);
|
|
115
|
+
app.component('m-fields-color-picker', ColorPicker);
|
|
116
116
|
app.component(CheckboxGroup.name, CheckboxGroup);
|
|
117
117
|
app.component(RadioGroup.name, RadioGroup);
|
|
118
|
-
app.component(
|
|
118
|
+
app.component('m-fields-display', Display);
|
|
119
119
|
app.component(Link.name, Link);
|
|
120
120
|
app.component(Select.name, Select);
|
|
121
121
|
app.component(Cascader.name, Cascader);
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
import { FormConfig, FormState, FormValue } from './schema';
|
|
3
|
+
declare const _default: import("vue").DefineComponent<{
|
|
4
|
+
initValues: {
|
|
5
|
+
type: ObjectConstructor;
|
|
6
|
+
required: true;
|
|
7
|
+
default: () => {};
|
|
8
|
+
};
|
|
9
|
+
parentValues: {
|
|
10
|
+
type: ObjectConstructor;
|
|
11
|
+
default: () => {};
|
|
12
|
+
};
|
|
13
|
+
config: {
|
|
14
|
+
type: PropType<FormConfig>;
|
|
15
|
+
required: true;
|
|
16
|
+
default: () => never[];
|
|
17
|
+
};
|
|
18
|
+
labelWidth: {
|
|
19
|
+
type: StringConstructor;
|
|
20
|
+
default: () => string;
|
|
21
|
+
};
|
|
22
|
+
disabled: {
|
|
23
|
+
type: BooleanConstructor;
|
|
24
|
+
default: () => boolean;
|
|
25
|
+
};
|
|
26
|
+
height: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: () => string;
|
|
29
|
+
};
|
|
30
|
+
stepActive: {
|
|
31
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
32
|
+
default: () => number;
|
|
33
|
+
};
|
|
34
|
+
size: {
|
|
35
|
+
type: PropType<"small" | "default" | "large">;
|
|
36
|
+
};
|
|
37
|
+
inline: {
|
|
38
|
+
type: BooleanConstructor;
|
|
39
|
+
default: boolean;
|
|
40
|
+
};
|
|
41
|
+
labelPosition: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
keyProp: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
default: string;
|
|
48
|
+
};
|
|
49
|
+
popperClass: {
|
|
50
|
+
type: StringConstructor;
|
|
51
|
+
};
|
|
52
|
+
}, {
|
|
53
|
+
initialized: import("vue").Ref<boolean>;
|
|
54
|
+
values: import("vue").Ref<FormValue>;
|
|
55
|
+
elForm: import("vue").Ref<any>;
|
|
56
|
+
formState: FormState;
|
|
57
|
+
changeHandler: () => void;
|
|
58
|
+
resetForm: () => any;
|
|
59
|
+
submitForm: (native?: boolean) => Promise<any>;
|
|
60
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("change" | "field-input" | "field-change")[], "change" | "field-input" | "field-change", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
61
|
+
initValues: {
|
|
62
|
+
type: ObjectConstructor;
|
|
63
|
+
required: true;
|
|
64
|
+
default: () => {};
|
|
65
|
+
};
|
|
66
|
+
parentValues: {
|
|
67
|
+
type: ObjectConstructor;
|
|
68
|
+
default: () => {};
|
|
69
|
+
};
|
|
70
|
+
config: {
|
|
71
|
+
type: PropType<FormConfig>;
|
|
72
|
+
required: true;
|
|
73
|
+
default: () => never[];
|
|
74
|
+
};
|
|
75
|
+
labelWidth: {
|
|
76
|
+
type: StringConstructor;
|
|
77
|
+
default: () => string;
|
|
78
|
+
};
|
|
79
|
+
disabled: {
|
|
80
|
+
type: BooleanConstructor;
|
|
81
|
+
default: () => boolean;
|
|
82
|
+
};
|
|
83
|
+
height: {
|
|
84
|
+
type: StringConstructor;
|
|
85
|
+
default: () => string;
|
|
86
|
+
};
|
|
87
|
+
stepActive: {
|
|
88
|
+
type: (NumberConstructor | StringConstructor)[];
|
|
89
|
+
default: () => number;
|
|
90
|
+
};
|
|
91
|
+
size: {
|
|
92
|
+
type: PropType<"small" | "default" | "large">;
|
|
93
|
+
};
|
|
94
|
+
inline: {
|
|
95
|
+
type: BooleanConstructor;
|
|
96
|
+
default: boolean;
|
|
97
|
+
};
|
|
98
|
+
labelPosition: {
|
|
99
|
+
type: StringConstructor;
|
|
100
|
+
default: string;
|
|
101
|
+
};
|
|
102
|
+
keyProp: {
|
|
103
|
+
type: StringConstructor;
|
|
104
|
+
default: string;
|
|
105
|
+
};
|
|
106
|
+
popperClass: {
|
|
107
|
+
type: StringConstructor;
|
|
108
|
+
};
|
|
109
|
+
}>> & {
|
|
110
|
+
onChange?: ((...args: any[]) => any) | undefined;
|
|
111
|
+
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
112
|
+
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
113
|
+
}, {
|
|
114
|
+
config: FormConfig;
|
|
115
|
+
initValues: Record<string, any>;
|
|
116
|
+
keyProp: string;
|
|
117
|
+
parentValues: Record<string, any>;
|
|
118
|
+
labelWidth: string;
|
|
119
|
+
disabled: boolean;
|
|
120
|
+
height: string;
|
|
121
|
+
stepActive: string | number;
|
|
122
|
+
inline: boolean;
|
|
123
|
+
labelPosition: string;
|
|
124
|
+
}>;
|
|
125
|
+
export default _default;
|