@tmagic/form 1.3.7 → 1.3.9
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.js +265 -253
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +265 -253
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +3 -3
- package/src/Form.vue +4 -1
- package/src/containers/Table.vue +185 -168
- package/src/schema.ts +2 -0
- package/types/Form.vue.d.ts +2 -0
- package/types/FormBox.vue.d.ts +7 -2
- package/types/FormDialog.vue.d.ts +7 -2
- package/types/FormDrawer.vue.d.ts +7 -2
- package/types/schema.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
2
|
+
"version": "1.3.9",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@element-plus/icons-vue": "^2.3.1",
|
|
35
|
-
"@tmagic/design": "1.3.
|
|
36
|
-
"@tmagic/utils": "1.3.
|
|
35
|
+
"@tmagic/design": "1.3.9",
|
|
36
|
+
"@tmagic/utils": "1.3.9",
|
|
37
37
|
"lodash-es": "^4.17.21",
|
|
38
38
|
"sortablejs": "^1.14.0",
|
|
39
39
|
"vue": "^3.3.8"
|
package/src/Form.vue
CHANGED
|
@@ -79,7 +79,7 @@ const props = withDefaults(
|
|
|
79
79
|
},
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
const emit = defineEmits(['change', 'field-input', 'field-change']);
|
|
82
|
+
const emit = defineEmits(['change', 'error', 'field-input', 'field-change']);
|
|
83
83
|
|
|
84
84
|
const tMagicForm = ref<InstanceType<typeof TMagicForm>>();
|
|
85
85
|
const initialized = ref(false);
|
|
@@ -182,6 +182,8 @@ defineExpose({
|
|
|
182
182
|
await tMagicForm.value?.validate();
|
|
183
183
|
return native ? values.value : cloneDeep(toRaw(values.value));
|
|
184
184
|
} catch (invalidFields: any) {
|
|
185
|
+
emit('error', invalidFields);
|
|
186
|
+
|
|
185
187
|
const error: string[] = [];
|
|
186
188
|
|
|
187
189
|
Object.entries(invalidFields).forEach(([, ValidateError]) => {
|
|
@@ -191,6 +193,7 @@ defineExpose({
|
|
|
191
193
|
if (!field && message) error.push(`${message}`);
|
|
192
194
|
});
|
|
193
195
|
});
|
|
196
|
+
|
|
194
197
|
throw new Error(error.join('<br>'));
|
|
195
198
|
}
|
|
196
199
|
},
|
package/src/containers/Table.vue
CHANGED
|
@@ -1,182 +1,190 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
<
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<TMagicTableColumn v-if="config.itemExtra" :fixed="'left'" width="30" type="expand">
|
|
21
|
-
<template v-slot="scope">
|
|
22
|
-
<span v-html="itemExtra(config.itemExtra, scope.$index)" class="m-form-tip"></span>
|
|
23
|
-
</template>
|
|
24
|
-
</TMagicTableColumn>
|
|
25
|
-
|
|
26
|
-
<TMagicTableColumn
|
|
27
|
-
label="操作"
|
|
28
|
-
:width="config.operateColWidth || 55"
|
|
29
|
-
align="center"
|
|
30
|
-
:fixed="config.fixed === false ? undefined : 'left'"
|
|
2
|
+
<div>
|
|
3
|
+
<teleport to="body" :disabled="!isFullscreen">
|
|
4
|
+
<div ref="mTable" class="m-fields-table" :class="{ 'm-fields-table-item-extra': config.itemExtra }">
|
|
5
|
+
<span v-if="config.extra" style="color: rgba(0, 0, 0, 0.45)" v-html="config.extra"></span>
|
|
6
|
+
<TMagicTooltip content="拖拽可排序" placement="left-start" :disabled="config.dropSort !== true">
|
|
7
|
+
<TMagicTable
|
|
8
|
+
v-if="model[modelName]"
|
|
9
|
+
ref="tMagicTable"
|
|
10
|
+
style="width: 100%"
|
|
11
|
+
:row-key="config.rowKey || 'id'"
|
|
12
|
+
:data="data"
|
|
13
|
+
:lastData="lastData"
|
|
14
|
+
:border="config.border"
|
|
15
|
+
:max-height="config.maxHeight"
|
|
16
|
+
:default-expand-all="true"
|
|
17
|
+
:key="updateKey"
|
|
18
|
+
@select="selectHandle"
|
|
19
|
+
@sort-change="sortChange"
|
|
31
20
|
>
|
|
32
|
-
<
|
|
33
|
-
<slot
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
@click="removeHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
38
|
-
><Delete
|
|
39
|
-
/></TMagicIcon>
|
|
40
|
-
</template>
|
|
41
|
-
</TMagicTableColumn>
|
|
42
|
-
|
|
43
|
-
<TMagicTableColumn v-if="sort && model[modelName] && model[modelName].length > 1" label="排序" width="60">
|
|
44
|
-
<template v-slot="scope">
|
|
45
|
-
<TMagicTooltip
|
|
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>
|
|
79
|
-
|
|
80
|
-
<TMagicTableColumn
|
|
81
|
-
v-if="selection"
|
|
82
|
-
align="center"
|
|
83
|
-
header-align="center"
|
|
84
|
-
type="selection"
|
|
85
|
-
width="45"
|
|
86
|
-
></TMagicTableColumn>
|
|
87
|
-
|
|
88
|
-
<TMagicTableColumn width="60" label="序号" v-if="showIndex && config.showIndex">
|
|
89
|
-
<template v-slot="scope">{{ scope.$index + 1 + pagecontext * pagesize }}</template>
|
|
90
|
-
</TMagicTableColumn>
|
|
21
|
+
<TMagicTableColumn v-if="config.itemExtra" :fixed="'left'" width="30" type="expand">
|
|
22
|
+
<template v-slot="scope">
|
|
23
|
+
<span v-html="itemExtra(config.itemExtra, scope.$index)" class="m-form-tip"></span>
|
|
24
|
+
</template>
|
|
25
|
+
</TMagicTableColumn>
|
|
91
26
|
|
|
92
|
-
<template v-for="(column, index) in config.items">
|
|
93
27
|
<TMagicTableColumn
|
|
94
|
-
|
|
95
|
-
:
|
|
96
|
-
|
|
97
|
-
:
|
|
98
|
-
:sortable="column.sortable"
|
|
99
|
-
:sort-orders="['ascending', 'descending']"
|
|
100
|
-
:key="column[mForm?.keyProp || '__key'] ?? index"
|
|
101
|
-
:class-name="config.dropSort === true ? 'el-table__column--dropable' : ''"
|
|
28
|
+
label="操作"
|
|
29
|
+
:width="config.operateColWidth || 55"
|
|
30
|
+
align="center"
|
|
31
|
+
:fixed="config.fixed === false ? undefined : 'left'"
|
|
102
32
|
>
|
|
103
|
-
<template
|
|
104
|
-
<
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
:model="scope.row"
|
|
112
|
-
:lastValues="lastData[scope.$index]"
|
|
113
|
-
:is-compare="isCompare"
|
|
114
|
-
:size="size"
|
|
115
|
-
@change="$emit('change', model[modelName])"
|
|
116
|
-
@addDiffCount="onAddDiffCount()"
|
|
117
|
-
></Container>
|
|
33
|
+
<template v-slot="scope">
|
|
34
|
+
<slot name="operateCol" :scope="scope"></slot>
|
|
35
|
+
<TMagicIcon
|
|
36
|
+
v-show="showDelete(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
37
|
+
class="m-table-delete-icon"
|
|
38
|
+
@click="removeHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
39
|
+
><Delete
|
|
40
|
+
/></TMagicIcon>
|
|
118
41
|
</template>
|
|
119
42
|
</TMagicTableColumn>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
43
|
+
|
|
44
|
+
<TMagicTableColumn v-if="sort && model[modelName] && model[modelName].length > 1" label="排序" width="60">
|
|
45
|
+
<template v-slot="scope">
|
|
46
|
+
<TMagicTooltip
|
|
47
|
+
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== 0"
|
|
48
|
+
content="点击上移,双击置顶"
|
|
49
|
+
placement="top"
|
|
50
|
+
>
|
|
51
|
+
<TMagicButton
|
|
52
|
+
plain
|
|
53
|
+
size="small"
|
|
54
|
+
type="primary"
|
|
55
|
+
:icon="ArrowUp"
|
|
56
|
+
:disabled="disabled"
|
|
57
|
+
text
|
|
58
|
+
@click="upHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
59
|
+
@dblclick="topHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
60
|
+
></TMagicButton>
|
|
61
|
+
</TMagicTooltip>
|
|
62
|
+
<TMagicTooltip
|
|
63
|
+
v-if="scope.$index + 1 + pagecontext * pagesize - 1 !== model[modelName].length - 1"
|
|
64
|
+
content="点击下移,双击置底"
|
|
65
|
+
placement="top"
|
|
66
|
+
>
|
|
67
|
+
<TMagicButton
|
|
68
|
+
plain
|
|
69
|
+
size="small"
|
|
70
|
+
type="primary"
|
|
71
|
+
:icon="ArrowDown"
|
|
72
|
+
:disabled="disabled"
|
|
73
|
+
text
|
|
74
|
+
@click="downHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
75
|
+
@dblclick="bottomHandler(scope.$index + 1 + pagecontext * pagesize - 1)"
|
|
76
|
+
></TMagicButton>
|
|
77
|
+
</TMagicTooltip>
|
|
78
|
+
</template>
|
|
79
|
+
</TMagicTableColumn>
|
|
80
|
+
|
|
81
|
+
<TMagicTableColumn
|
|
82
|
+
v-if="selection"
|
|
83
|
+
align="center"
|
|
84
|
+
header-align="center"
|
|
85
|
+
type="selection"
|
|
86
|
+
width="45"
|
|
87
|
+
></TMagicTableColumn>
|
|
88
|
+
|
|
89
|
+
<TMagicTableColumn width="60" label="序号" v-if="showIndex && config.showIndex">
|
|
90
|
+
<template v-slot="scope">{{ scope.$index + 1 + pagecontext * pagesize }}</template>
|
|
91
|
+
</TMagicTableColumn>
|
|
92
|
+
|
|
93
|
+
<template v-for="(column, index) in config.items">
|
|
94
|
+
<TMagicTableColumn
|
|
95
|
+
v-if="column.type !== 'hidden' && display(column.display)"
|
|
96
|
+
:prop="column.name"
|
|
97
|
+
:width="column.width"
|
|
98
|
+
:label="column.label"
|
|
99
|
+
:sortable="column.sortable"
|
|
100
|
+
:sort-orders="['ascending', 'descending']"
|
|
101
|
+
:key="column[mForm?.keyProp || '__key'] ?? index"
|
|
102
|
+
:class-name="config.dropSort === true ? 'el-table__column--dropable' : ''"
|
|
103
|
+
>
|
|
104
|
+
<template #default="scope">
|
|
105
|
+
<Container
|
|
106
|
+
v-if="scope.$index > -1"
|
|
107
|
+
labelWidth="0"
|
|
108
|
+
:disabled="disabled"
|
|
109
|
+
:prop="getProp(scope.$index)"
|
|
110
|
+
:rules="column.rules"
|
|
111
|
+
:config="makeConfig(column, scope.row)"
|
|
112
|
+
:model="scope.row"
|
|
113
|
+
:lastValues="lastData[scope.$index]"
|
|
114
|
+
:is-compare="isCompare"
|
|
115
|
+
:size="size"
|
|
116
|
+
@change="$emit('change', model[modelName])"
|
|
117
|
+
@addDiffCount="onAddDiffCount()"
|
|
118
|
+
></Container>
|
|
119
|
+
</template>
|
|
120
|
+
</TMagicTableColumn>
|
|
121
|
+
</template>
|
|
122
|
+
</TMagicTable>
|
|
123
|
+
</TMagicTooltip>
|
|
124
|
+
<slot></slot>
|
|
125
|
+
|
|
126
|
+
<div style="display: flex; justify-content: space-between; margin: 10px 0">
|
|
127
|
+
<TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
|
|
128
|
+
>新增一行</TMagicButton
|
|
161
129
|
>
|
|
130
|
+
|
|
131
|
+
<div style="display: flex">
|
|
132
|
+
<TMagicButton
|
|
133
|
+
:icon="Grid"
|
|
134
|
+
size="small"
|
|
135
|
+
type="primary"
|
|
136
|
+
@click="toggleMode"
|
|
137
|
+
v-if="enableToggleMode && config.enableToggleMode !== false && !isFullscreen"
|
|
138
|
+
>展开配置</TMagicButton
|
|
139
|
+
>
|
|
140
|
+
<TMagicButton
|
|
141
|
+
:icon="FullScreen"
|
|
142
|
+
size="small"
|
|
143
|
+
type="primary"
|
|
144
|
+
@click="toggleFullscreen"
|
|
145
|
+
v-if="config.enableFullscreen !== false"
|
|
146
|
+
>
|
|
147
|
+
{{ isFullscreen ? '退出全屏' : '全屏编辑' }}
|
|
148
|
+
</TMagicButton>
|
|
149
|
+
<TMagicUpload
|
|
150
|
+
v-if="importable"
|
|
151
|
+
style="display: inline-block"
|
|
152
|
+
ref="excelBtn"
|
|
153
|
+
action="/noop"
|
|
154
|
+
:disabled="disabled"
|
|
155
|
+
:on-change="excelHandler"
|
|
156
|
+
:auto-upload="false"
|
|
157
|
+
>
|
|
158
|
+
<TMagicButton size="small" type="success" :disabled="disabled" plain>导入EXCEL</TMagicButton>
|
|
159
|
+
</TMagicUpload>
|
|
160
|
+
<TMagicButton
|
|
161
|
+
v-if="importable"
|
|
162
|
+
size="small"
|
|
163
|
+
type="warning"
|
|
164
|
+
:disabled="disabled"
|
|
165
|
+
plain
|
|
166
|
+
@click="clearHandler()"
|
|
167
|
+
>清空</TMagicButton
|
|
168
|
+
>
|
|
169
|
+
</div>
|
|
162
170
|
</div>
|
|
163
|
-
</div>
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
<div class="bottom" style="text-align: right" v-if="config.pagination">
|
|
173
|
+
<TMagicPagination
|
|
174
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
175
|
+
:hide-on-single-page="model[modelName].length < pagesize"
|
|
176
|
+
:current-page="pagecontext + 1"
|
|
177
|
+
:page-sizes="[pagesize, 60, 120, 300]"
|
|
178
|
+
:page-size="pagesize"
|
|
179
|
+
:total="model[modelName].length"
|
|
180
|
+
@size-change="handleSizeChange"
|
|
181
|
+
@current-change="handleCurrentChange"
|
|
182
|
+
>
|
|
183
|
+
</TMagicPagination>
|
|
184
|
+
</div>
|
|
177
185
|
</div>
|
|
178
|
-
</
|
|
179
|
-
</
|
|
186
|
+
</teleport>
|
|
187
|
+
</div>
|
|
180
188
|
</template>
|
|
181
189
|
|
|
182
190
|
<script setup lang="ts">
|
|
@@ -325,6 +333,15 @@ const newHandler = async (row?: any) => {
|
|
|
325
333
|
return;
|
|
326
334
|
}
|
|
327
335
|
|
|
336
|
+
if (typeof props.config.beforeAddRow === 'function') {
|
|
337
|
+
const beforeCheckRes = props.config.beforeAddRow(mForm, {
|
|
338
|
+
model: props.model[modelName.value],
|
|
339
|
+
formValue: mForm?.values,
|
|
340
|
+
prop: props.prop,
|
|
341
|
+
});
|
|
342
|
+
if (!beforeCheckRes) return;
|
|
343
|
+
}
|
|
344
|
+
|
|
328
345
|
const columns = props.config.items;
|
|
329
346
|
const enumValues = props.config.enum || [];
|
|
330
347
|
let enumV = [];
|
package/src/schema.ts
CHANGED
|
@@ -669,6 +669,8 @@ export interface TableConfig extends FormItem {
|
|
|
669
669
|
fixed?: boolean;
|
|
670
670
|
itemExtra?: string | FilterFunction<string>;
|
|
671
671
|
rowKey?: string;
|
|
672
|
+
/** table 新增行时前置回调 */
|
|
673
|
+
beforeAddRow?: (mForm: FormState | undefined, data: any) => boolean;
|
|
672
674
|
}
|
|
673
675
|
|
|
674
676
|
export interface GroupListConfig extends FormItem {
|
package/types/Form.vue.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
42
42
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
43
43
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
44
|
change: (...args: any[]) => void;
|
|
45
|
+
error: (...args: any[]) => void;
|
|
45
46
|
"field-input": (...args: any[]) => void;
|
|
46
47
|
"field-change": (...args: any[]) => void;
|
|
47
48
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
@@ -79,6 +80,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
79
80
|
keyProp: string;
|
|
80
81
|
}>>> & {
|
|
81
82
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
83
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
82
84
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
83
85
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
84
86
|
}, {
|
package/types/FormBox.vue.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
48
48
|
readonly size?: "large" | "default" | "small" | undefined;
|
|
49
49
|
readonly extendState?: ((state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
50
50
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
51
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
51
52
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
52
53
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
53
54
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -112,6 +113,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
112
113
|
};
|
|
113
114
|
}>> & {
|
|
114
115
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
116
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
115
117
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
116
118
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
117
119
|
}, "config" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "labelWidth" | "disabled" | "stepActive" | "height" | "inline" | "labelPosition">;
|
|
@@ -126,7 +128,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
126
128
|
}>;
|
|
127
129
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
128
130
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
129
|
-
$emit: ((event: "change", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
131
|
+
$emit: ((event: "change", ...args: any[]) => void) & ((event: "error", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
130
132
|
$el: any;
|
|
131
133
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
132
134
|
config: {
|
|
@@ -190,6 +192,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
190
192
|
};
|
|
191
193
|
}>> & {
|
|
192
194
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
195
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
193
196
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
194
197
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
195
198
|
}, {
|
|
@@ -202,6 +205,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
202
205
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
203
206
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
204
207
|
change: (...args: any[]) => void;
|
|
208
|
+
error: (...args: any[]) => void;
|
|
205
209
|
"field-input": (...args: any[]) => void;
|
|
206
210
|
"field-change": (...args: any[]) => void;
|
|
207
211
|
}, string, {
|
|
@@ -299,6 +303,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
299
303
|
};
|
|
300
304
|
}>> & {
|
|
301
305
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
306
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
302
307
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
303
308
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
304
309
|
} & import("vue").ShallowUnwrapRef<{
|
|
@@ -316,8 +321,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
316
321
|
hide: () => void;
|
|
317
322
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
318
323
|
change: (...args: any[]) => void;
|
|
319
|
-
submit: (...args: any[]) => void;
|
|
320
324
|
error: (...args: any[]) => void;
|
|
325
|
+
submit: (...args: any[]) => void;
|
|
321
326
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
322
327
|
config?: FormConfig | undefined;
|
|
323
328
|
values?: Object | undefined;
|
|
@@ -51,6 +51,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
51
51
|
readonly size?: "large" | "default" | "small" | undefined;
|
|
52
52
|
readonly extendState?: ((state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
53
53
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
54
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
54
55
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
55
56
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
56
57
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -115,6 +116,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
115
116
|
};
|
|
116
117
|
}>> & {
|
|
117
118
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
119
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
118
120
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
119
121
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
120
122
|
}, "config" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "labelWidth" | "disabled" | "stepActive" | "height" | "inline" | "labelPosition">;
|
|
@@ -129,7 +131,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
129
131
|
}>;
|
|
130
132
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
131
133
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
132
|
-
$emit: ((event: "change", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
134
|
+
$emit: ((event: "change", ...args: any[]) => void) & ((event: "error", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
133
135
|
$el: any;
|
|
134
136
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
135
137
|
config: {
|
|
@@ -193,6 +195,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
193
195
|
};
|
|
194
196
|
}>> & {
|
|
195
197
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
198
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
196
199
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
197
200
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
198
201
|
}, {
|
|
@@ -205,6 +208,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
205
208
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
206
209
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
207
210
|
change: (...args: any[]) => void;
|
|
211
|
+
error: (...args: any[]) => void;
|
|
208
212
|
"field-input": (...args: any[]) => void;
|
|
209
213
|
"field-change": (...args: any[]) => void;
|
|
210
214
|
}, string, {
|
|
@@ -302,6 +306,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
302
306
|
};
|
|
303
307
|
}>> & {
|
|
304
308
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
309
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
305
310
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
306
311
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
307
312
|
} & import("vue").ShallowUnwrapRef<{
|
|
@@ -321,8 +326,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
321
326
|
hide: () => void;
|
|
322
327
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
323
328
|
change: (...args: any[]) => void;
|
|
324
|
-
submit: (...args: any[]) => void;
|
|
325
329
|
error: (...args: any[]) => void;
|
|
330
|
+
submit: (...args: any[]) => void;
|
|
326
331
|
close: (...args: any[]) => void;
|
|
327
332
|
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
328
333
|
config?: FormConfig | undefined;
|
|
@@ -54,6 +54,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
54
54
|
readonly size?: "large" | "default" | "small" | undefined;
|
|
55
55
|
readonly extendState?: ((state: import("./schema").FormState) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
56
56
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
57
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
57
58
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
58
59
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
59
60
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -118,6 +119,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
118
119
|
};
|
|
119
120
|
}>> & {
|
|
120
121
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
122
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
121
123
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
122
124
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
123
125
|
}, "config" | "initValues" | "lastValues" | "isCompare" | "keyProp" | "parentValues" | "labelWidth" | "disabled" | "stepActive" | "height" | "inline" | "labelPosition">;
|
|
@@ -132,7 +134,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
132
134
|
}>;
|
|
133
135
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
134
136
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
135
|
-
$emit: ((event: "change", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
137
|
+
$emit: ((event: "change", ...args: any[]) => void) & ((event: "error", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
136
138
|
$el: any;
|
|
137
139
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
138
140
|
config: {
|
|
@@ -196,6 +198,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
196
198
|
};
|
|
197
199
|
}>> & {
|
|
198
200
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
201
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
199
202
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
200
203
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
201
204
|
}, {
|
|
@@ -208,6 +211,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
208
211
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
209
212
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
210
213
|
change: (...args: any[]) => void;
|
|
214
|
+
error: (...args: any[]) => void;
|
|
211
215
|
"field-input": (...args: any[]) => void;
|
|
212
216
|
"field-change": (...args: any[]) => void;
|
|
213
217
|
}, string, {
|
|
@@ -305,6 +309,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
305
309
|
};
|
|
306
310
|
}>> & {
|
|
307
311
|
onChange?: ((...args: any[]) => any) | undefined;
|
|
312
|
+
onError?: ((...args: any[]) => any) | undefined;
|
|
308
313
|
"onField-input"?: ((...args: any[]) => any) | undefined;
|
|
309
314
|
"onField-change"?: ((...args: any[]) => any) | undefined;
|
|
310
315
|
} & import("vue").ShallowUnwrapRef<{
|
|
@@ -323,8 +328,8 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
323
328
|
handleClose: () => void;
|
|
324
329
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
325
330
|
change: (...args: any[]) => void;
|
|
326
|
-
submit: (...args: any[]) => void;
|
|
327
331
|
error: (...args: any[]) => void;
|
|
332
|
+
submit: (...args: any[]) => void;
|
|
328
333
|
close: (...args: any[]) => void;
|
|
329
334
|
closed: (...args: any[]) => void;
|
|
330
335
|
open: (...args: any[]) => void;
|
package/types/schema.d.ts
CHANGED
|
@@ -552,6 +552,8 @@ export interface TableConfig extends FormItem {
|
|
|
552
552
|
fixed?: boolean;
|
|
553
553
|
itemExtra?: string | FilterFunction<string>;
|
|
554
554
|
rowKey?: string;
|
|
555
|
+
/** table 新增行时前置回调 */
|
|
556
|
+
beforeAddRow?: (mForm: FormState | undefined, data: any) => boolean;
|
|
555
557
|
}
|
|
556
558
|
export interface GroupListConfig extends FormItem {
|
|
557
559
|
type: 'table' | 'groupList' | 'group-list';
|