@tmagic/form 1.3.0-alpha.9 → 1.3.0-beta.1
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 +21 -0
- package/dist/tmagic-form.js +716 -388
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +744 -413
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +4 -4
- package/src/Form.vue +12 -4
- package/src/FormDialog.vue +19 -5
- package/src/FormDrawer.vue +159 -0
- package/src/containers/Container.vue +11 -10
- package/src/containers/GroupList.vue +1 -0
- package/src/containers/GroupListItem.vue +8 -2
- package/src/containers/Table.vue +148 -150
- package/src/fields/Cascader.vue +2 -12
- package/src/fields/Checkbox.vue +2 -12
- package/src/fields/CheckboxGroup.vue +2 -12
- package/src/fields/ColorPicker.vue +5 -13
- package/src/fields/Date.vue +6 -14
- package/src/fields/DateTime.vue +7 -15
- package/src/fields/Daterange.vue +2 -12
- package/src/fields/Display.vue +2 -10
- package/src/fields/DynamicField.vue +3 -13
- package/src/fields/Hidden.vue +2 -10
- package/src/fields/Link.vue +2 -12
- package/src/fields/Number.vue +7 -14
- package/src/fields/NumberRange.vue +50 -0
- package/src/fields/RadioGroup.vue +2 -12
- package/src/fields/Select.vue +2 -12
- package/src/fields/Switch.vue +6 -14
- package/src/fields/Text.vue +7 -14
- package/src/fields/Textarea.vue +7 -14
- package/src/fields/Time.vue +5 -13
- package/src/fields/Timerange.vue +76 -0
- package/src/index.ts +7 -0
- package/src/schema.ts +23 -2
- package/src/theme/form-drawer.scss +11 -0
- package/src/theme/index.scss +2 -0
- package/src/theme/number-range.scss +8 -0
- package/src/theme/panel.scss +6 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/form.ts +2 -1
- package/types/Form.vue.d.ts +13 -11
- package/types/FormDialog.vue.d.ts +30 -17
- package/types/FormDrawer.vue.d.ts +348 -0
- package/types/fields/Cascader.vue.d.ts +2 -22
- package/types/fields/Checkbox.vue.d.ts +2 -22
- package/types/fields/CheckboxGroup.vue.d.ts +2 -22
- package/types/fields/ColorPicker.vue.d.ts +2 -24
- package/types/fields/Date.vue.d.ts +2 -24
- package/types/fields/DateTime.vue.d.ts +2 -24
- package/types/fields/Daterange.vue.d.ts +2 -22
- package/types/fields/Display.vue.d.ts +2 -18
- package/types/fields/DynamicField.vue.d.ts +2 -22
- package/types/fields/Hidden.vue.d.ts +2 -18
- package/types/fields/Link.vue.d.ts +2 -22
- package/types/fields/Number.vue.d.ts +2 -25
- package/types/fields/NumberRange.vue.d.ts +12 -0
- package/types/fields/RadioGroup.vue.d.ts +2 -22
- package/types/fields/Select.vue.d.ts +2 -22
- package/types/fields/Switch.vue.d.ts +2 -24
- package/types/fields/Text.vue.d.ts +2 -25
- package/types/fields/Textarea.vue.d.ts +2 -25
- package/types/fields/Time.vue.d.ts +2 -24
- package/types/fields/Timerange.vue.d.ts +14 -0
- package/types/index.d.ts +3 -0
- package/types/schema.d.ts +21 -2
- package/types/utils/config.d.ts +1 -1
package/src/containers/Table.vue
CHANGED
|
@@ -1,162 +1,160 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div ref="mTable" class="m-fields-table" :class="{ 'm-fields-table-item-extra': config.itemExtra }">
|
|
3
3
|
<span v-if="config.extra" style="color: rgba(0, 0, 0, 0.45)" v-html="config.extra"></span>
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
<TMagicTooltip content="拖拽可排序" placement="left-start" :disabled="config.dropSort !== true">
|
|
5
|
+
<TMagicTable
|
|
6
|
+
v-if="model[modelName]"
|
|
7
|
+
ref="tMagicTable"
|
|
8
|
+
style="width: 100%"
|
|
9
|
+
:row-key="config.rowKey || 'id'"
|
|
10
|
+
:data="data"
|
|
11
|
+
:lastData="lastData"
|
|
12
|
+
:border="config.border"
|
|
13
|
+
:max-height="config.maxHeight"
|
|
14
|
+
:default-expand-all="true"
|
|
15
|
+
:key="updateKey"
|
|
16
|
+
@select="selectHandle"
|
|
17
|
+
@sort-change="sortChange"
|
|
18
|
+
>
|
|
19
|
+
<TMagicTableColumn v-if="config.itemExtra" :fixed="'left'" width="30" type="expand">
|
|
20
|
+
<template v-slot="scope">
|
|
21
|
+
<span v-html="itemExtra(config.itemExtra, scope.$index)" class="m-form-tip"></span>
|
|
22
|
+
</template>
|
|
23
|
+
</TMagicTableColumn>
|
|
24
|
+
|
|
25
|
+
<TMagicTableColumn
|
|
26
|
+
label="操作"
|
|
27
|
+
:width="config.operateColWidth || 55"
|
|
28
|
+
align="center"
|
|
29
|
+
:fixed="config.fixed === false ? undefined : 'left'"
|
|
19
30
|
>
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
31
|
+
<template v-slot="scope">
|
|
32
|
+
<slot name="operateCol" :scope="scope"></slot>
|
|
33
|
+
<TMagicIcon
|
|
34
|
+
v-show="showDelete(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
35
|
+
class="m-table-delete-icon"
|
|
36
|
+
@click="removeHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
37
|
+
><Delete
|
|
38
|
+
/></TMagicIcon>
|
|
39
|
+
</template>
|
|
40
|
+
</TMagicTableColumn>
|
|
41
|
+
|
|
42
|
+
<TMagicTableColumn v-if="sort && model[modelName] && model[modelName].length > 1" label="排序" width="60">
|
|
43
|
+
<template v-slot="scope">
|
|
44
|
+
<TMagicTooltip
|
|
45
|
+
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== 0"
|
|
46
|
+
content="点击上移,双击置顶"
|
|
47
|
+
placement="top"
|
|
48
|
+
>
|
|
49
|
+
<TMagicButton
|
|
50
|
+
plain
|
|
51
|
+
size="small"
|
|
52
|
+
type="primary"
|
|
53
|
+
:icon="ArrowUp"
|
|
54
|
+
:disabled="disabled"
|
|
55
|
+
text
|
|
56
|
+
@click="upHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
57
|
+
@dblclick="topHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
58
|
+
></TMagicButton>
|
|
59
|
+
</TMagicTooltip>
|
|
60
|
+
<TMagicTooltip
|
|
61
|
+
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== model[modelName].length - 1"
|
|
62
|
+
content="点击下移,双击置底"
|
|
63
|
+
placement="top"
|
|
64
|
+
>
|
|
65
|
+
<TMagicButton
|
|
66
|
+
plain
|
|
67
|
+
size="small"
|
|
68
|
+
type="primary"
|
|
69
|
+
:icon="ArrowDown"
|
|
70
|
+
:disabled="disabled"
|
|
71
|
+
text
|
|
72
|
+
@click="downHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
73
|
+
@dblclick="bottomHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
74
|
+
></TMagicButton>
|
|
75
|
+
</TMagicTooltip>
|
|
76
|
+
</template>
|
|
77
|
+
</TMagicTableColumn>
|
|
25
78
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<slot name="operateCol" :scope="scope"></slot>
|
|
34
|
-
<TMagicIcon
|
|
35
|
-
v-show="showDelete(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
36
|
-
class="m-table-delete-icon"
|
|
37
|
-
@click="removeHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
38
|
-
><Delete
|
|
39
|
-
/></TMagicIcon>
|
|
40
|
-
</template>
|
|
41
|
-
</TMagicTableColumn>
|
|
79
|
+
<TMagicTableColumn
|
|
80
|
+
v-if="selection"
|
|
81
|
+
align="center"
|
|
82
|
+
header-align="center"
|
|
83
|
+
type="selection"
|
|
84
|
+
width="45"
|
|
85
|
+
></TMagicTableColumn>
|
|
42
86
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== 0"
|
|
47
|
-
content="点击上移,双击置顶"
|
|
48
|
-
placement="top"
|
|
49
|
-
>
|
|
50
|
-
<TMagicButton
|
|
51
|
-
plain
|
|
52
|
-
size="small"
|
|
53
|
-
type="primary"
|
|
54
|
-
:icon="ArrowUp"
|
|
55
|
-
:disabled="disabled"
|
|
56
|
-
text
|
|
57
|
-
@click="upHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
58
|
-
@dblclick="topHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
59
|
-
></TMagicButton>
|
|
60
|
-
</TMagicTooltip>
|
|
61
|
-
<TMagicTooltip
|
|
62
|
-
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== model[modelName].length - 1"
|
|
63
|
-
content="点击下移,双击置底"
|
|
64
|
-
placement="top"
|
|
65
|
-
>
|
|
66
|
-
<TMagicButton
|
|
67
|
-
plain
|
|
68
|
-
size="small"
|
|
69
|
-
type="primary"
|
|
70
|
-
:icon="ArrowDown"
|
|
71
|
-
:disabled="disabled"
|
|
72
|
-
text
|
|
73
|
-
@click="downHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
74
|
-
@dblclick="bottomHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
75
|
-
></TMagicButton>
|
|
76
|
-
</TMagicTooltip>
|
|
77
|
-
</template>
|
|
78
|
-
</TMagicTableColumn>
|
|
87
|
+
<TMagicTableColumn width="60" label="序号" v-if="showIndex && config.showIndex">
|
|
88
|
+
<template v-slot="scope">{{ scope.$index + 1 + pagecontext * pagesize }}</template>
|
|
89
|
+
</TMagicTableColumn>
|
|
79
90
|
|
|
91
|
+
<template v-for="(column, index) in config.items">
|
|
80
92
|
<TMagicTableColumn
|
|
81
|
-
v-if="
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
93
|
+
v-if="column.type !== 'hidden' && display(column.display)"
|
|
94
|
+
:prop="column.name"
|
|
95
|
+
:width="column.width"
|
|
96
|
+
:label="column.label"
|
|
97
|
+
:sortable="column.sortable"
|
|
98
|
+
:sort-orders="['ascending', 'descending']"
|
|
99
|
+
:key="column[mForm?.keyProp || '__key'] ?? index"
|
|
100
|
+
:class-name="config.dropSort === true ? 'el-table__column--dropable' : ''"
|
|
101
|
+
>
|
|
102
|
+
<template #default="scope">
|
|
103
|
+
<Container
|
|
104
|
+
v-if="scope.$index > -1"
|
|
105
|
+
labelWidth="0"
|
|
106
|
+
:disabled="disabled"
|
|
107
|
+
:prop="getProp(scope.$index)"
|
|
108
|
+
:rules="column.rules"
|
|
109
|
+
:config="makeConfig(column, scope.row)"
|
|
110
|
+
:model="scope.row"
|
|
111
|
+
:lastValues="lastData[scope.$index]"
|
|
112
|
+
:is-compare="isCompare"
|
|
113
|
+
:size="size"
|
|
114
|
+
@change="$emit('change', model[modelName])"
|
|
115
|
+
@addDiffCount="onAddDiffCount()"
|
|
116
|
+
></Container>
|
|
117
|
+
</template>
|
|
90
118
|
</TMagicTableColumn>
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
size="small"
|
|
131
|
-
type="primary"
|
|
132
|
-
@click="toggleMode"
|
|
133
|
-
v-if="enableToggleMode && !isFullscreen"
|
|
134
|
-
>展开配置</TMagicButton
|
|
135
|
-
>
|
|
136
|
-
<TMagicButton
|
|
137
|
-
:icon="FullScreen"
|
|
138
|
-
size="small"
|
|
139
|
-
type="primary"
|
|
140
|
-
@click="toggleFullscreen"
|
|
141
|
-
v-if="config.enableFullscreen !== false"
|
|
142
|
-
>
|
|
143
|
-
{{ isFullscreen ? '退出全屏' : '全屏编辑' }}
|
|
144
|
-
</TMagicButton>
|
|
145
|
-
<TMagicUpload
|
|
146
|
-
v-if="importable"
|
|
147
|
-
style="display: inline-block"
|
|
148
|
-
ref="excelBtn"
|
|
149
|
-
action="/noop"
|
|
150
|
-
:disabled="disabled"
|
|
151
|
-
:on-change="excelHandler"
|
|
152
|
-
:auto-upload="false"
|
|
153
|
-
>
|
|
154
|
-
<TMagicButton size="small" type="success" :disabled="disabled" plain>导入EXCEL</TMagicButton> </TMagicUpload
|
|
155
|
-
>
|
|
156
|
-
<TMagicButton v-if="importable" size="small" type="warning" :disabled="disabled" plain @click="clearHandler()"
|
|
157
|
-
>清空</TMagicButton
|
|
158
|
-
>
|
|
159
|
-
</div>
|
|
119
|
+
</template>
|
|
120
|
+
</TMagicTable>
|
|
121
|
+
</TMagicTooltip>
|
|
122
|
+
<slot></slot>
|
|
123
|
+
<TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
|
|
124
|
+
>新增一行</TMagicButton
|
|
125
|
+
>
|
|
126
|
+
|
|
127
|
+
<TMagicButton
|
|
128
|
+
:icon="Grid"
|
|
129
|
+
size="small"
|
|
130
|
+
type="primary"
|
|
131
|
+
@click="toggleMode"
|
|
132
|
+
v-if="enableToggleMode && config.enableToggleMode !== false && !isFullscreen"
|
|
133
|
+
>展开配置</TMagicButton
|
|
134
|
+
>
|
|
135
|
+
<TMagicButton
|
|
136
|
+
:icon="FullScreen"
|
|
137
|
+
size="small"
|
|
138
|
+
type="primary"
|
|
139
|
+
@click="toggleFullscreen"
|
|
140
|
+
v-if="config.enableFullscreen !== false"
|
|
141
|
+
>
|
|
142
|
+
{{ isFullscreen ? '退出全屏' : '全屏编辑' }}
|
|
143
|
+
</TMagicButton>
|
|
144
|
+
<TMagicUpload
|
|
145
|
+
v-if="importable"
|
|
146
|
+
style="display: inline-block"
|
|
147
|
+
ref="excelBtn"
|
|
148
|
+
action="/noop"
|
|
149
|
+
:disabled="disabled"
|
|
150
|
+
:on-change="excelHandler"
|
|
151
|
+
:auto-upload="false"
|
|
152
|
+
>
|
|
153
|
+
<TMagicButton size="small" type="success" :disabled="disabled" plain>导入EXCEL</TMagicButton> </TMagicUpload
|
|
154
|
+
>
|
|
155
|
+
<TMagicButton v-if="importable" size="small" type="warning" :disabled="disabled" plain @click="clearHandler()"
|
|
156
|
+
>清空</TMagicButton
|
|
157
|
+
>
|
|
160
158
|
|
|
161
159
|
<div class="bottom" style="text-align: right" v-if="config.pagination">
|
|
162
160
|
<TMagicPagination
|
package/src/fields/Cascader.vue
CHANGED
|
@@ -19,7 +19,7 @@ import { inject, ref, watchEffect } from 'vue';
|
|
|
19
19
|
|
|
20
20
|
import { TMagicCascader } from '@tmagic/design';
|
|
21
21
|
|
|
22
|
-
import { CascaderConfig, FormState } from '../schema';
|
|
22
|
+
import type { CascaderConfig, FieldProps, FormState } from '../schema';
|
|
23
23
|
import { getConfig } from '../utils/config';
|
|
24
24
|
import { useAddField } from '../utils/useAddField';
|
|
25
25
|
|
|
@@ -27,17 +27,7 @@ defineOptions({
|
|
|
27
27
|
name: 'MFormCascader',
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
const props = defineProps<
|
|
31
|
-
config: CascaderConfig;
|
|
32
|
-
model: any;
|
|
33
|
-
initValues?: any;
|
|
34
|
-
values?: any;
|
|
35
|
-
name: string;
|
|
36
|
-
prop: string;
|
|
37
|
-
disabled?: boolean;
|
|
38
|
-
size?: 'large' | 'default' | 'small';
|
|
39
|
-
lastValues?: Record<string, any>;
|
|
40
|
-
}>();
|
|
30
|
+
const props = defineProps<FieldProps<CascaderConfig>>();
|
|
41
31
|
|
|
42
32
|
const emit = defineEmits(['change']);
|
|
43
33
|
|
package/src/fields/Checkbox.vue
CHANGED
|
@@ -15,24 +15,14 @@ import { computed } from 'vue';
|
|
|
15
15
|
|
|
16
16
|
import { TMagicCheckbox } from '@tmagic/design';
|
|
17
17
|
|
|
18
|
-
import { CheckboxConfig } from '../schema';
|
|
18
|
+
import type { CheckboxConfig, FieldProps } from '../schema';
|
|
19
19
|
import { useAddField } from '../utils/useAddField';
|
|
20
20
|
|
|
21
21
|
defineOptions({
|
|
22
22
|
name: 'MFormCheckbox',
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const props = defineProps<
|
|
26
|
-
config: CheckboxConfig;
|
|
27
|
-
model: any;
|
|
28
|
-
initValues?: any;
|
|
29
|
-
values?: any;
|
|
30
|
-
name: string;
|
|
31
|
-
prop: string;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
size?: 'large' | 'default' | 'small';
|
|
34
|
-
lastValues?: Record<string, any>;
|
|
35
|
-
}>();
|
|
25
|
+
const props = defineProps<FieldProps<CheckboxConfig>>();
|
|
36
26
|
|
|
37
27
|
const emit = defineEmits(['change']);
|
|
38
28
|
|
|
@@ -16,7 +16,7 @@ import { computed, inject } from 'vue';
|
|
|
16
16
|
|
|
17
17
|
import { TMagicCheckbox, TMagicCheckboxGroup } from '@tmagic/design';
|
|
18
18
|
|
|
19
|
-
import { CheckboxGroupConfig, FormState } from '../schema';
|
|
19
|
+
import type { CheckboxGroupConfig, FieldProps, FormState } from '../schema';
|
|
20
20
|
import { filterFunction } from '../utils/form';
|
|
21
21
|
import { useAddField } from '../utils/useAddField';
|
|
22
22
|
|
|
@@ -24,17 +24,7 @@ defineOptions({
|
|
|
24
24
|
name: 'MFormCheckGroup',
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const props = defineProps<
|
|
28
|
-
config: CheckboxGroupConfig;
|
|
29
|
-
model: any;
|
|
30
|
-
initValues?: any;
|
|
31
|
-
values?: any;
|
|
32
|
-
name: string;
|
|
33
|
-
prop: string;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
size?: 'large' | 'default' | 'small';
|
|
36
|
-
lastValues?: Record<string, any>;
|
|
37
|
-
}>();
|
|
27
|
+
const props = defineProps<FieldProps<CheckboxGroupConfig>>();
|
|
38
28
|
|
|
39
29
|
const emit = defineEmits(['change']);
|
|
40
30
|
|
|
@@ -11,26 +11,18 @@
|
|
|
11
11
|
<script lang="ts" setup>
|
|
12
12
|
import { TMagicColorPicker } from '@tmagic/design';
|
|
13
13
|
|
|
14
|
-
import { ColorPickConfig } from '../schema';
|
|
14
|
+
import type { ColorPickConfig, FieldProps } from '../schema';
|
|
15
15
|
import { useAddField } from '../utils/useAddField';
|
|
16
16
|
|
|
17
17
|
defineOptions({
|
|
18
18
|
name: 'MFormColorPicker',
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
const props = defineProps<
|
|
22
|
-
config: ColorPickConfig;
|
|
23
|
-
model: any;
|
|
24
|
-
initValues?: any;
|
|
25
|
-
values?: any;
|
|
26
|
-
name: string;
|
|
27
|
-
prop: string;
|
|
28
|
-
disabled?: boolean;
|
|
29
|
-
size?: 'large' | 'default' | 'small';
|
|
30
|
-
lastValues?: Record<string, any>;
|
|
31
|
-
}>();
|
|
21
|
+
const props = defineProps<FieldProps<ColorPickConfig>>();
|
|
32
22
|
|
|
33
|
-
const emit = defineEmits
|
|
23
|
+
const emit = defineEmits<{
|
|
24
|
+
change: [value: string];
|
|
25
|
+
}>();
|
|
34
26
|
|
|
35
27
|
useAddField(props.prop);
|
|
36
28
|
|
package/src/fields/Date.vue
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:placeholder="config.placeholder"
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
:format="config.format"
|
|
9
|
-
:value-format="config.valueFormat || 'YYYY
|
|
9
|
+
:value-format="config.valueFormat || 'YYYY/MM/DD HH:mm:ss'"
|
|
10
10
|
@change="changeHandler"
|
|
11
11
|
></TMagicDatePicker>
|
|
12
12
|
</template>
|
|
@@ -15,26 +15,18 @@
|
|
|
15
15
|
import { TMagicDatePicker } from '@tmagic/design';
|
|
16
16
|
import { datetimeFormatter } from '@tmagic/utils';
|
|
17
17
|
|
|
18
|
-
import { DateConfig } from '../schema';
|
|
18
|
+
import type { DateConfig, FieldProps } from '../schema';
|
|
19
19
|
import { useAddField } from '../utils/useAddField';
|
|
20
20
|
|
|
21
21
|
defineOptions({
|
|
22
22
|
name: 'MFormDate',
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
-
const props = defineProps<
|
|
26
|
-
config: DateConfig;
|
|
27
|
-
model: any;
|
|
28
|
-
initValues?: any;
|
|
29
|
-
values?: any;
|
|
30
|
-
name: string;
|
|
31
|
-
prop: string;
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
size?: 'large' | 'default' | 'small';
|
|
34
|
-
lastValues?: Record<string, any>;
|
|
35
|
-
}>();
|
|
25
|
+
const props = defineProps<FieldProps<DateConfig>>();
|
|
36
26
|
|
|
37
|
-
const emit = defineEmits
|
|
27
|
+
const emit = defineEmits<{
|
|
28
|
+
change: [value: string];
|
|
29
|
+
}>();
|
|
38
30
|
|
|
39
31
|
useAddField(props.prop);
|
|
40
32
|
|
package/src/fields/DateTime.vue
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
:size="size"
|
|
7
7
|
:placeholder="config.placeholder"
|
|
8
8
|
:disabled="disabled"
|
|
9
|
-
:format="config.format || 'YYYY
|
|
10
|
-
:value-format="config.valueFormat || 'YYYY
|
|
9
|
+
:format="config.format || 'YYYY/MM/DD HH:mm:ss'"
|
|
10
|
+
:value-format="config.valueFormat || 'YYYY/MM/DD HH:mm:ss'"
|
|
11
11
|
:default-time="config.defaultTime"
|
|
12
12
|
@change="changeHandler"
|
|
13
13
|
></TMagicDatePicker>
|
|
@@ -17,26 +17,18 @@
|
|
|
17
17
|
import { TMagicDatePicker } from '@tmagic/design';
|
|
18
18
|
import { datetimeFormatter } from '@tmagic/utils';
|
|
19
19
|
|
|
20
|
-
import { DateTimeConfig } from '../schema';
|
|
20
|
+
import type { DateTimeConfig, FieldProps } from '../schema';
|
|
21
21
|
import { useAddField } from '../utils/useAddField';
|
|
22
22
|
|
|
23
23
|
defineOptions({
|
|
24
24
|
name: 'MFormDateTime',
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
const props = defineProps<
|
|
28
|
-
config: DateTimeConfig;
|
|
29
|
-
model: any;
|
|
30
|
-
initValues?: any;
|
|
31
|
-
values?: any;
|
|
32
|
-
name: string;
|
|
33
|
-
prop: string;
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
size?: 'large' | 'default' | 'small';
|
|
36
|
-
lastValues?: Record<string, any>;
|
|
37
|
-
}>();
|
|
27
|
+
const props = defineProps<FieldProps<DateTimeConfig>>();
|
|
38
28
|
|
|
39
|
-
const emit = defineEmits
|
|
29
|
+
const emit = defineEmits<{
|
|
30
|
+
change: [value: string];
|
|
31
|
+
}>();
|
|
40
32
|
|
|
41
33
|
useAddField(props.prop);
|
|
42
34
|
|
package/src/fields/Daterange.vue
CHANGED
|
@@ -19,24 +19,14 @@ import { ref, watch } from 'vue';
|
|
|
19
19
|
import { TMagicDatePicker } from '@tmagic/design';
|
|
20
20
|
import { datetimeFormatter } from '@tmagic/utils';
|
|
21
21
|
|
|
22
|
-
import { DaterangeConfig } from '../schema';
|
|
22
|
+
import type { DaterangeConfig, FieldProps } from '../schema';
|
|
23
23
|
import { useAddField } from '../utils/useAddField';
|
|
24
24
|
|
|
25
25
|
defineOptions({
|
|
26
26
|
name: 'MFormDateRange',
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
const props = defineProps<
|
|
30
|
-
config: DaterangeConfig;
|
|
31
|
-
model: any;
|
|
32
|
-
initValues?: any;
|
|
33
|
-
values?: any;
|
|
34
|
-
name: string;
|
|
35
|
-
prop: string;
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
size?: 'large' | 'default' | 'small';
|
|
38
|
-
lastValues?: Record<string, any>;
|
|
39
|
-
}>();
|
|
29
|
+
const props = defineProps<FieldProps<DaterangeConfig>>();
|
|
40
30
|
|
|
41
31
|
const emit = defineEmits(['change']);
|
|
42
32
|
|
package/src/fields/Display.vue
CHANGED
|
@@ -3,22 +3,14 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
|
-
import { DisplayConfig } from '../schema';
|
|
6
|
+
import type { DisplayConfig, FieldProps } from '../schema';
|
|
7
7
|
import { useAddField } from '../utils/useAddField';
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
10
10
|
name: 'MFormDisplay',
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
const props = defineProps<
|
|
14
|
-
config: DisplayConfig;
|
|
15
|
-
model: any;
|
|
16
|
-
initValues?: any;
|
|
17
|
-
values?: any;
|
|
18
|
-
name: string;
|
|
19
|
-
prop: string;
|
|
20
|
-
lastValues?: Record<string, any>;
|
|
21
|
-
}>();
|
|
13
|
+
const props = defineProps<FieldProps<DisplayConfig>>();
|
|
22
14
|
|
|
23
15
|
if (props.config.initValue && props.model) {
|
|
24
16
|
// eslint-disable-next-line vue/no-setup-props-destructure
|
|
@@ -27,7 +27,7 @@ import { onBeforeUnmount, reactive, watch } from 'vue';
|
|
|
27
27
|
|
|
28
28
|
import { TMagicForm, TMagicFormItem, TMagicInput } from '@tmagic/design';
|
|
29
29
|
|
|
30
|
-
import { DynamicFieldConfig } from '../schema';
|
|
30
|
+
import type { DynamicFieldConfig, FieldProps } from '../schema';
|
|
31
31
|
import { getConfig } from '../utils/config';
|
|
32
32
|
import { useAddField } from '../utils/useAddField';
|
|
33
33
|
|
|
@@ -35,23 +35,13 @@ defineOptions({
|
|
|
35
35
|
name: 'MFormDynamicField',
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
const props = defineProps<
|
|
39
|
-
config: DynamicFieldConfig;
|
|
40
|
-
model: any;
|
|
41
|
-
initValues?: any;
|
|
42
|
-
values?: any;
|
|
43
|
-
name: string;
|
|
44
|
-
prop: string;
|
|
45
|
-
disabled?: boolean;
|
|
46
|
-
size?: 'large' | 'default' | 'small';
|
|
47
|
-
lastValues?: Record<string, any>;
|
|
48
|
-
}>();
|
|
38
|
+
const props = defineProps<FieldProps<DynamicFieldConfig>>();
|
|
49
39
|
|
|
50
40
|
const emit = defineEmits(['change']);
|
|
51
41
|
|
|
52
42
|
useAddField(props.prop);
|
|
53
43
|
|
|
54
|
-
const request = getConfig('request')
|
|
44
|
+
const request = getConfig<Function>('request');
|
|
55
45
|
const fieldMap = reactive<{ [key: string]: any }>({
|
|
56
46
|
value: {},
|
|
57
47
|
});
|
package/src/fields/Hidden.vue
CHANGED
|
@@ -3,22 +3,14 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script setup lang="ts">
|
|
6
|
-
import { HiddenConfig } from '../schema';
|
|
6
|
+
import type { FieldProps, HiddenConfig } from '../schema';
|
|
7
7
|
import { useAddField } from '../utils/useAddField';
|
|
8
8
|
|
|
9
9
|
defineOptions({
|
|
10
10
|
name: 'MFormHidden',
|
|
11
11
|
});
|
|
12
12
|
|
|
13
|
-
const props = defineProps<
|
|
14
|
-
config: HiddenConfig;
|
|
15
|
-
model: any;
|
|
16
|
-
initValues?: any;
|
|
17
|
-
values?: any;
|
|
18
|
-
name: string;
|
|
19
|
-
prop: string;
|
|
20
|
-
lastValues?: Record<string, any>;
|
|
21
|
-
}>();
|
|
13
|
+
const props = defineProps<FieldProps<HiddenConfig>>();
|
|
22
14
|
|
|
23
15
|
useAddField(props.prop);
|
|
24
16
|
</script>
|
package/src/fields/Link.vue
CHANGED
|
@@ -22,24 +22,14 @@ import { computed, inject, ref } from 'vue';
|
|
|
22
22
|
import { TMagicButton } from '@tmagic/design';
|
|
23
23
|
|
|
24
24
|
import FormDialog from '../FormDialog.vue';
|
|
25
|
-
import { FormState, LinkConfig } from '../schema';
|
|
25
|
+
import type { FieldProps, FormState, LinkConfig } from '../schema';
|
|
26
26
|
import { useAddField } from '../utils/useAddField';
|
|
27
27
|
|
|
28
28
|
defineOptions({
|
|
29
29
|
name: 'MFormLink',
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
const props = defineProps<
|
|
33
|
-
config: LinkConfig;
|
|
34
|
-
model: any;
|
|
35
|
-
initValues?: any;
|
|
36
|
-
values?: any;
|
|
37
|
-
name: string;
|
|
38
|
-
prop: string;
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
size?: 'large' | 'default' | 'small';
|
|
41
|
-
lastValues?: Record<string, any>;
|
|
42
|
-
}>();
|
|
32
|
+
const props = defineProps<FieldProps<LinkConfig>>();
|
|
43
33
|
|
|
44
34
|
const emit = defineEmits(['change']);
|
|
45
35
|
|