@tmagic/form 1.3.5 → 1.3.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/LICENSE +5432 -0
- package/dist/style.css +2 -10
- package/dist/tmagic-form.js +280 -270
- package/dist/tmagic-form.js.map +1 -1
- package/dist/tmagic-form.umd.cjs +279 -269
- package/dist/tmagic-form.umd.cjs.map +1 -1
- package/package.json +15 -15
- package/src/containers/Container.vue +2 -0
- package/src/containers/Table.vue +168 -166
- package/src/fields/Cascader.vue +6 -2
- package/src/fields/Select.vue +5 -3
- package/src/theme/table.scss +4 -11
- package/types/Form.vue.d.ts +5 -1
- package/types/FormBox.vue.d.ts +14 -6
- package/types/FormDialog.vue.d.ts +15 -6
- package/types/FormDrawer.vue.d.ts +18 -6
- package/types/containers/Col.vue.d.ts +4 -1
- package/types/containers/Container.vue.d.ts +4 -1
- package/types/containers/Fieldset.vue.d.ts +4 -1
- package/types/containers/GroupList.vue.d.ts +4 -1
- package/types/containers/GroupListItem.vue.d.ts +6 -1
- package/types/containers/Panel.vue.d.ts +4 -1
- package/types/containers/Row.vue.d.ts +4 -1
- package/types/containers/Step.vue.d.ts +4 -1
- package/types/containers/Table.vue.d.ts +8 -4
- package/types/containers/Tabs.vue.d.ts +4 -1
- package/types/fields/Cascader.vue.d.ts +3 -1
- package/types/fields/Checkbox.vue.d.ts +3 -1
- package/types/fields/CheckboxGroup.vue.d.ts +3 -1
- package/types/fields/ColorPicker.vue.d.ts +5 -1
- package/types/fields/Date.vue.d.ts +5 -1
- package/types/fields/DateTime.vue.d.ts +5 -1
- package/types/fields/Daterange.vue.d.ts +3 -1
- package/types/fields/DynamicField.vue.d.ts +3 -1
- package/types/fields/Link.vue.d.ts +3 -1
- package/types/fields/Number.vue.d.ts +7 -1
- package/types/fields/NumberRange.vue.d.ts +5 -1
- package/types/fields/RadioGroup.vue.d.ts +3 -1
- package/types/fields/Select.vue.d.ts +3 -1
- package/types/fields/Switch.vue.d.ts +5 -1
- package/types/fields/Text.vue.d.ts +7 -1
- package/types/fields/Textarea.vue.d.ts +7 -1
- package/types/fields/Time.vue.d.ts +5 -1
- package/types/fields/Timerange.vue.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.3.
|
|
2
|
+
"version": "1.3.7",
|
|
3
3
|
"name": "@tmagic/form",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
@@ -23,22 +23,17 @@
|
|
|
23
23
|
"./*": "./*"
|
|
24
24
|
},
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
|
-
"scripts": {
|
|
27
|
-
"build": "npm run build:type && vite build",
|
|
28
|
-
"build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
|
|
29
|
-
"clear:type": "rimraf ./types"
|
|
30
|
-
},
|
|
31
26
|
"engines": {
|
|
32
|
-
"node": ">=
|
|
27
|
+
"node": ">=18"
|
|
33
28
|
},
|
|
34
29
|
"repository": {
|
|
35
30
|
"type": "git",
|
|
36
31
|
"url": "https://github.com/Tencent/tmagic-editor.git"
|
|
37
32
|
},
|
|
38
33
|
"dependencies": {
|
|
39
|
-
"@element-plus/icons-vue": "^2.
|
|
40
|
-
"@tmagic/design": "1.3.
|
|
41
|
-
"@tmagic/utils": "1.3.
|
|
34
|
+
"@element-plus/icons-vue": "^2.3.1",
|
|
35
|
+
"@tmagic/design": "1.3.7",
|
|
36
|
+
"@tmagic/utils": "1.3.7",
|
|
42
37
|
"lodash-es": "^4.17.21",
|
|
43
38
|
"sortablejs": "^1.14.0",
|
|
44
39
|
"vue": "^3.3.8"
|
|
@@ -49,15 +44,20 @@
|
|
|
49
44
|
"devDependencies": {
|
|
50
45
|
"@babel/core": "^7.18.0",
|
|
51
46
|
"@types/lodash-es": "^4.17.4",
|
|
52
|
-
"@types/node": "^
|
|
47
|
+
"@types/node": "^18.19.0",
|
|
53
48
|
"@types/sortablejs": "^1.10.7",
|
|
54
|
-
"@vitejs/plugin-vue": "^4.2
|
|
49
|
+
"@vitejs/plugin-vue": "^4.5.2",
|
|
55
50
|
"@vue/compiler-sfc": "^3.3.8",
|
|
56
51
|
"@vue/test-utils": "^2.3.2",
|
|
57
52
|
"rimraf": "^3.0.2",
|
|
58
53
|
"sass": "^1.35.1",
|
|
59
54
|
"typescript": "^5.0.4",
|
|
60
|
-
"vite": "^
|
|
61
|
-
"vue-tsc": "^1.
|
|
55
|
+
"vite": "^5.0.7",
|
|
56
|
+
"vue-tsc": "^1.8.25"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "npm run build:type && vite build",
|
|
60
|
+
"build:type": "npm run clear:type && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build.json",
|
|
61
|
+
"clear:type": "rimraf ./types"
|
|
62
62
|
}
|
|
63
|
-
}
|
|
63
|
+
}
|
package/src/containers/Table.vue
CHANGED
|
@@ -1,180 +1,182 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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'"
|
|
2
|
+
<teleport to="body" :disabled="!isFullscreen">
|
|
3
|
+
<div ref="mTable" class="m-fields-table" :class="{ 'm-fields-table-item-extra': config.itemExtra }">
|
|
4
|
+
<span v-if="config.extra" style="color: rgba(0, 0, 0, 0.45)" v-html="config.extra"></span>
|
|
5
|
+
<TMagicTooltip content="拖拽可排序" placement="left-start" :disabled="config.dropSort !== true">
|
|
6
|
+
<TMagicTable
|
|
7
|
+
v-if="model[modelName]"
|
|
8
|
+
ref="tMagicTable"
|
|
9
|
+
style="width: 100%"
|
|
10
|
+
:row-key="config.rowKey || 'id'"
|
|
11
|
+
:data="data"
|
|
12
|
+
:lastData="lastData"
|
|
13
|
+
:border="config.border"
|
|
14
|
+
:max-height="config.maxHeight"
|
|
15
|
+
:default-expand-all="true"
|
|
16
|
+
:key="updateKey"
|
|
17
|
+
@select="selectHandle"
|
|
18
|
+
@sort-change="sortChange"
|
|
30
19
|
>
|
|
31
|
-
<
|
|
32
|
-
<slot
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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>
|
|
78
|
-
|
|
79
|
-
<TMagicTableColumn
|
|
80
|
-
v-if="selection"
|
|
81
|
-
align="center"
|
|
82
|
-
header-align="center"
|
|
83
|
-
type="selection"
|
|
84
|
-
width="45"
|
|
85
|
-
></TMagicTableColumn>
|
|
86
|
-
|
|
87
|
-
<TMagicTableColumn width="60" label="序号" v-if="showIndex && config.showIndex">
|
|
88
|
-
<template v-slot="scope">{{ scope.$index + 1 + pagecontext * pagesize }}</template>
|
|
89
|
-
</TMagicTableColumn>
|
|
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>
|
|
90
25
|
|
|
91
|
-
<template v-for="(column, index) in config.items">
|
|
92
26
|
<TMagicTableColumn
|
|
93
|
-
|
|
94
|
-
:
|
|
95
|
-
|
|
96
|
-
:
|
|
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' : ''"
|
|
27
|
+
label="操作"
|
|
28
|
+
:width="config.operateColWidth || 55"
|
|
29
|
+
align="center"
|
|
30
|
+
:fixed="config.fixed === false ? undefined : 'left'"
|
|
101
31
|
>
|
|
102
|
-
<template
|
|
103
|
-
<
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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>
|
|
32
|
+
<template v-slot="scope">
|
|
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>
|
|
117
40
|
</template>
|
|
118
41
|
</TMagicTableColumn>
|
|
119
|
-
|
|
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
|
-
|
|
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>
|
|
91
|
+
|
|
92
|
+
<template v-for="(column, index) in config.items">
|
|
93
|
+
<TMagicTableColumn
|
|
94
|
+
v-if="column.type !== 'hidden' && display(column.display)"
|
|
95
|
+
:prop="column.name"
|
|
96
|
+
:width="column.width"
|
|
97
|
+
:label="column.label"
|
|
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' : ''"
|
|
102
|
+
>
|
|
103
|
+
<template #default="scope">
|
|
104
|
+
<Container
|
|
105
|
+
v-if="scope.$index > -1"
|
|
106
|
+
labelWidth="0"
|
|
107
|
+
:disabled="disabled"
|
|
108
|
+
:prop="getProp(scope.$index)"
|
|
109
|
+
:rules="column.rules"
|
|
110
|
+
:config="makeConfig(column, scope.row)"
|
|
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>
|
|
118
|
+
</template>
|
|
119
|
+
</TMagicTableColumn>
|
|
120
|
+
</template>
|
|
121
|
+
</TMagicTable>
|
|
122
|
+
</TMagicTooltip>
|
|
123
|
+
<slot></slot>
|
|
124
|
+
|
|
125
|
+
<div style="display: flex; justify-content: space-between; margin: 10px 0">
|
|
126
|
+
<TMagicButton v-if="addable" size="small" type="primary" :disabled="disabled" plain @click="newHandler()"
|
|
127
|
+
>新增一行</TMagicButton
|
|
160
128
|
>
|
|
129
|
+
|
|
130
|
+
<div style="display: flex">
|
|
131
|
+
<TMagicButton
|
|
132
|
+
:icon="Grid"
|
|
133
|
+
size="small"
|
|
134
|
+
type="primary"
|
|
135
|
+
@click="toggleMode"
|
|
136
|
+
v-if="enableToggleMode && config.enableToggleMode !== false && !isFullscreen"
|
|
137
|
+
>展开配置</TMagicButton
|
|
138
|
+
>
|
|
139
|
+
<TMagicButton
|
|
140
|
+
:icon="FullScreen"
|
|
141
|
+
size="small"
|
|
142
|
+
type="primary"
|
|
143
|
+
@click="toggleFullscreen"
|
|
144
|
+
v-if="config.enableFullscreen !== false"
|
|
145
|
+
>
|
|
146
|
+
{{ isFullscreen ? '退出全屏' : '全屏编辑' }}
|
|
147
|
+
</TMagicButton>
|
|
148
|
+
<TMagicUpload
|
|
149
|
+
v-if="importable"
|
|
150
|
+
style="display: inline-block"
|
|
151
|
+
ref="excelBtn"
|
|
152
|
+
action="/noop"
|
|
153
|
+
:disabled="disabled"
|
|
154
|
+
:on-change="excelHandler"
|
|
155
|
+
:auto-upload="false"
|
|
156
|
+
>
|
|
157
|
+
<TMagicButton size="small" type="success" :disabled="disabled" plain>导入EXCEL</TMagicButton>
|
|
158
|
+
</TMagicUpload>
|
|
159
|
+
<TMagicButton v-if="importable" size="small" type="warning" :disabled="disabled" plain @click="clearHandler()"
|
|
160
|
+
>清空</TMagicButton
|
|
161
|
+
>
|
|
162
|
+
</div>
|
|
161
163
|
</div>
|
|
162
|
-
</div>
|
|
163
164
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
<div class="bottom" style="text-align: right" v-if="config.pagination">
|
|
166
|
+
<TMagicPagination
|
|
167
|
+
layout="total, sizes, prev, pager, next, jumper"
|
|
168
|
+
:hide-on-single-page="model[modelName].length < pagesize"
|
|
169
|
+
:current-page="pagecontext + 1"
|
|
170
|
+
:page-sizes="[pagesize, 60, 120, 300]"
|
|
171
|
+
:page-size="pagesize"
|
|
172
|
+
:total="model[modelName].length"
|
|
173
|
+
@size-change="handleSizeChange"
|
|
174
|
+
@current-change="handleCurrentChange"
|
|
175
|
+
>
|
|
176
|
+
</TMagicPagination>
|
|
177
|
+
</div>
|
|
176
178
|
</div>
|
|
177
|
-
</
|
|
179
|
+
</teleport>
|
|
178
180
|
</template>
|
|
179
181
|
|
|
180
182
|
<script setup lang="ts">
|
package/src/fields/Cascader.vue
CHANGED
|
@@ -23,7 +23,7 @@ import { inject, ref, watchEffect } from 'vue';
|
|
|
23
23
|
|
|
24
24
|
import { TMagicCascader } from '@tmagic/design';
|
|
25
25
|
|
|
26
|
-
import type { CascaderConfig, FieldProps, FormState } from '../schema';
|
|
26
|
+
import type { CascaderConfig, CascaderOption, FieldProps, FormState } from '../schema';
|
|
27
27
|
import { getConfig } from '../utils/config';
|
|
28
28
|
import { useAddField } from '../utils/useAddField';
|
|
29
29
|
|
|
@@ -43,7 +43,7 @@ const requestFunc = getConfig('request') as Function;
|
|
|
43
43
|
|
|
44
44
|
const tMagicCascader = ref<InstanceType<typeof TMagicCascader>>();
|
|
45
45
|
|
|
46
|
-
const options =
|
|
46
|
+
const options = ref<CascaderOption[]>([]);
|
|
47
47
|
const remoteData = ref<any>(null);
|
|
48
48
|
|
|
49
49
|
const setRemoteOptions = async function () {
|
|
@@ -86,6 +86,10 @@ if (typeof props.config.options === 'function' && props.model && mForm) {
|
|
|
86
86
|
);
|
|
87
87
|
} else if (!props.config.options?.length || props.config.remote) {
|
|
88
88
|
Promise.resolve(setRemoteOptions());
|
|
89
|
+
} else if (Array.isArray(props.config.options)) {
|
|
90
|
+
watchEffect(() => {
|
|
91
|
+
options.value = props.config.options as CascaderOption[];
|
|
92
|
+
});
|
|
89
93
|
}
|
|
90
94
|
|
|
91
95
|
const changeHandler = (value: any) => {
|
package/src/fields/Select.vue
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script lang="ts" setup>
|
|
29
|
-
import { inject, onBeforeMount, Ref, ref, watch, watchEffect } from 'vue';
|
|
29
|
+
import { inject, nextTick, onBeforeMount, Ref, ref, watch, watchEffect } from 'vue';
|
|
30
30
|
|
|
31
31
|
import { TMagicSelect } from '@tmagic/design';
|
|
32
32
|
import { getValueByKeyPath } from '@tmagic/utils';
|
|
@@ -331,12 +331,15 @@ if (typeof props.config.options === 'function') {
|
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
if (props.config.remote) {
|
|
334
|
-
const
|
|
334
|
+
const unWatch = watch(
|
|
335
335
|
() => tMagicSelect.value?.scrollbarWrap,
|
|
336
336
|
(scrollbarWrap) => {
|
|
337
337
|
if (!scrollbarWrap) {
|
|
338
338
|
return;
|
|
339
339
|
}
|
|
340
|
+
|
|
341
|
+
nextTick(() => unWatch());
|
|
342
|
+
|
|
340
343
|
scrollbarWrap.addEventListener('scroll', async (e: Event) => {
|
|
341
344
|
const el = e.currentTarget as HTMLDivElement;
|
|
342
345
|
if (moreLoadingVisible.value) {
|
|
@@ -353,7 +356,6 @@ if (props.config.remote) {
|
|
|
353
356
|
options.value = await getOptions();
|
|
354
357
|
moreLoadingVisible.value = false;
|
|
355
358
|
});
|
|
356
|
-
unWacth();
|
|
357
359
|
},
|
|
358
360
|
{
|
|
359
361
|
immediate: true,
|
package/src/theme/table.scss
CHANGED
|
@@ -2,22 +2,15 @@
|
|
|
2
2
|
width: 100%;
|
|
3
3
|
&.fixed {
|
|
4
4
|
position: fixed;
|
|
5
|
+
height: 100%;
|
|
6
|
+
overflow: auto;
|
|
5
7
|
top: 0;
|
|
6
8
|
right: 0;
|
|
7
9
|
left: 0;
|
|
8
10
|
bottom: 0;
|
|
9
11
|
z-index: 100;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
display: block;
|
|
13
|
-
background: rgba(0, 0, 0, 0.5);
|
|
14
|
-
position: fixed;
|
|
15
|
-
top: 0;
|
|
16
|
-
right: 0;
|
|
17
|
-
left: 0;
|
|
18
|
-
bottom: 0;
|
|
19
|
-
z-index: 100;
|
|
20
|
-
}
|
|
12
|
+
background: rgba(0, 0, 0, 0.5);
|
|
13
|
+
|
|
21
14
|
& > .el-form-item__content {
|
|
22
15
|
z-index: 101;
|
|
23
16
|
position: relative;
|
package/types/Form.vue.d.ts
CHANGED
|
@@ -40,7 +40,11 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
40
40
|
changeHandler: () => void;
|
|
41
41
|
resetForm: () => any;
|
|
42
42
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
43
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
43
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
|
+
change: (...args: any[]) => void;
|
|
45
|
+
"field-input": (...args: any[]) => void;
|
|
46
|
+
"field-change": (...args: any[]) => void;
|
|
47
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
44
48
|
/** 表单配置 */
|
|
45
49
|
config: FormConfig;
|
|
46
50
|
/** 表单值 */
|
package/types/FormBox.vue.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
126
126
|
}>;
|
|
127
127
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
128
128
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
129
|
-
$emit: (event: "change"
|
|
129
|
+
$emit: ((event: "change", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
130
130
|
$el: any;
|
|
131
131
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
132
132
|
config: {
|
|
@@ -200,7 +200,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
200
200
|
changeHandler: () => void;
|
|
201
201
|
resetForm: () => any;
|
|
202
202
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
203
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
203
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
204
|
+
change: (...args: any[]) => void;
|
|
205
|
+
"field-input": (...args: any[]) => void;
|
|
206
|
+
"field-change": (...args: any[]) => void;
|
|
207
|
+
}, string, {
|
|
204
208
|
config: FormConfig;
|
|
205
209
|
initValues: Record<string, any>;
|
|
206
210
|
lastValues: Record<string, any>;
|
|
@@ -310,7 +314,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
310
314
|
bodyHeight: import("vue").Ref<number>;
|
|
311
315
|
show: () => void;
|
|
312
316
|
hide: () => void;
|
|
313
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
317
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
318
|
+
change: (...args: any[]) => void;
|
|
319
|
+
submit: (...args: any[]) => void;
|
|
320
|
+
error: (...args: any[]) => void;
|
|
321
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
314
322
|
config?: FormConfig | undefined;
|
|
315
323
|
values?: Object | undefined;
|
|
316
324
|
parentValues?: Object | undefined;
|
|
@@ -353,11 +361,11 @@ type __VLS_WithDefaults<P, D> = {
|
|
|
353
361
|
default: D[K];
|
|
354
362
|
}> : P[K];
|
|
355
363
|
};
|
|
364
|
+
type __VLS_Prettify<T> = {
|
|
365
|
+
[K in keyof T]: T[K];
|
|
366
|
+
} & {};
|
|
356
367
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
357
368
|
new (): {
|
|
358
369
|
$slots: S;
|
|
359
370
|
};
|
|
360
371
|
};
|
|
361
|
-
type __VLS_Prettify<T> = {
|
|
362
|
-
[K in keyof T]: T[K];
|
|
363
|
-
} & {};
|
|
@@ -129,7 +129,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
129
129
|
}>;
|
|
130
130
|
$root: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
131
131
|
$parent: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}> | null;
|
|
132
|
-
$emit: (event: "change"
|
|
132
|
+
$emit: ((event: "change", ...args: any[]) => void) & ((event: "field-input", ...args: any[]) => void) & ((event: "field-change", ...args: any[]) => void);
|
|
133
133
|
$el: any;
|
|
134
134
|
$options: import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
|
|
135
135
|
config: {
|
|
@@ -203,7 +203,11 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
203
203
|
changeHandler: () => void;
|
|
204
204
|
resetForm: () => any;
|
|
205
205
|
submitForm: (native?: boolean | undefined) => Promise<any>;
|
|
206
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
206
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
207
|
+
change: (...args: any[]) => void;
|
|
208
|
+
"field-input": (...args: any[]) => void;
|
|
209
|
+
"field-change": (...args: any[]) => void;
|
|
210
|
+
}, string, {
|
|
207
211
|
config: FormConfig;
|
|
208
212
|
initValues: Record<string, any>;
|
|
209
213
|
lastValues: Record<string, any>;
|
|
@@ -315,7 +319,12 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
315
319
|
save: () => Promise<void>;
|
|
316
320
|
show: () => void;
|
|
317
321
|
hide: () => void;
|
|
318
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
322
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
323
|
+
change: (...args: any[]) => void;
|
|
324
|
+
submit: (...args: any[]) => void;
|
|
325
|
+
error: (...args: any[]) => void;
|
|
326
|
+
close: (...args: any[]) => void;
|
|
327
|
+
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
319
328
|
config?: FormConfig | undefined;
|
|
320
329
|
values?: Object | undefined;
|
|
321
330
|
parentValues?: Object | undefined;
|
|
@@ -362,11 +371,11 @@ type __VLS_WithDefaults<P, D> = {
|
|
|
362
371
|
default: D[K];
|
|
363
372
|
}> : P[K];
|
|
364
373
|
};
|
|
374
|
+
type __VLS_Prettify<T> = {
|
|
375
|
+
[K in keyof T]: T[K];
|
|
376
|
+
} & {};
|
|
365
377
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
366
378
|
new (): {
|
|
367
379
|
$slots: S;
|
|
368
380
|
};
|
|
369
381
|
};
|
|
370
|
-
type __VLS_Prettify<T> = {
|
|
371
|
-
[K in keyof T]: T[K];
|
|
372
|
-
} & {};
|