vxe-table 3.12.13 → 3.12.14
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/es/index.css +1 -1
- package/es/index.min.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/module/edit/mixin.js +5 -6
- package/es/table/module/validator/mixin.js +13 -1
- package/es/table/render/index.js +104 -43
- package/es/table/src/header.js +4 -2
- package/es/table/src/methods.js +35 -28
- package/es/table/src/table.js +44 -6
- package/es/table/style.css +33 -2
- package/es/table/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/vxe-table/style.css +33 -2
- package/es/vxe-table/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.min.css +1 -1
- package/lib/index.umd.js +224 -101
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/module/edit/mixin.js +5 -6
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/validator/mixin.js +18 -4
- package/lib/table/module/validator/mixin.min.js +1 -1
- package/lib/table/render/index.js +109 -41
- package/lib/table/render/index.min.js +1 -1
- package/lib/table/src/header.js +4 -2
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/methods.js +46 -40
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +40 -6
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/style/style.css +33 -2
- package/lib/table/style/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/vxe-table/style/style.css +33 -2
- package/lib/vxe-table/style/style.min.css +1 -1
- package/package.json +2 -2
- package/packages/table/module/edit/mixin.ts +5 -6
- package/packages/table/module/validator/mixin.ts +15 -2
- package/packages/table/render/index.ts +120 -51
- package/packages/table/src/header.ts +4 -2
- package/packages/table/src/methods.ts +42 -30
- package/packages/table/src/table.ts +47 -6
- package/styles/components/table.scss +31 -2
- /package/es/{iconfont.1739152166680.ttf → iconfont.1739181382716.ttf} +0 -0
- /package/es/{iconfont.1739152166680.woff → iconfont.1739181382716.woff} +0 -0
- /package/es/{iconfont.1739152166680.woff2 → iconfont.1739181382716.woff2} +0 -0
- /package/lib/{iconfont.1739152166680.ttf → iconfont.1739181382716.ttf} +0 -0
- /package/lib/{iconfont.1739152166680.woff → iconfont.1739181382716.woff} +0 -0
- /package/lib/{iconfont.1739152166680.woff2 → iconfont.1739181382716.woff2} +0 -0
|
@@ -5,7 +5,7 @@ import { scrollToView } from '../../../ui/src/dom'
|
|
|
5
5
|
import { handleFieldOrColumn, getRowid } from '../../src/util'
|
|
6
6
|
import { warnLog, errLog } from '../../../ui/src/log'
|
|
7
7
|
|
|
8
|
-
import type { VxeTableDefines } from '../../../../types'
|
|
8
|
+
import type { VxeTableDefines, TableReactData, TableInternalData } from '../../../../types'
|
|
9
9
|
|
|
10
10
|
const { getConfig, validators } = VxeUI
|
|
11
11
|
|
|
@@ -154,8 +154,16 @@ export default {
|
|
|
154
154
|
* 返回 Promise 对象,或者使用回调方式
|
|
155
155
|
*/
|
|
156
156
|
beginValidate (rows: any, cols: VxeTableDefines.ColumnInfo[] | null, cb: any, isFull: any) {
|
|
157
|
+
const $xeTable = this
|
|
158
|
+
const props = $xeTable
|
|
159
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
160
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
161
|
+
|
|
157
162
|
const validRest: any = {}
|
|
158
|
-
const { editRules,
|
|
163
|
+
const { editRules, treeConfig } = props
|
|
164
|
+
const { pendingRowMaps } = reactData
|
|
165
|
+
const { afterFullData } = internalData
|
|
166
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
159
167
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
160
168
|
let validList
|
|
161
169
|
if (rows === true) {
|
|
@@ -178,6 +186,11 @@ export default {
|
|
|
178
186
|
if (editRules) {
|
|
179
187
|
const columns = cols && cols.length ? cols : this.getColumns()
|
|
180
188
|
const handleVaild = (row: any) => {
|
|
189
|
+
const rowid = getRowid($xeTable, row)
|
|
190
|
+
// 是否标记删除
|
|
191
|
+
if (pendingRowMaps[rowid]) {
|
|
192
|
+
return
|
|
193
|
+
}
|
|
181
194
|
if (isFull || !this.validRuleErr) {
|
|
182
195
|
const colVailds: any[] = []
|
|
183
196
|
columns.forEach((column: any) => {
|
|
@@ -6,7 +6,7 @@ import { getFuncText, formatText, isEmptyValue } from '../../ui/src/utils'
|
|
|
6
6
|
import { getOnName, getModelEvent, getChangeEvent } from '../../ui/src/vn'
|
|
7
7
|
import { errLog } from '../../ui/src/log'
|
|
8
8
|
|
|
9
|
-
import type { VxeGlobalRendererHandles, VxeColumnPropTypes } from '../../../types'
|
|
9
|
+
import type { VxeGlobalRendererHandles, VxeColumnPropTypes, VxeTableConstructor, VxeTablePrivateMethods } from '../../../types'
|
|
10
10
|
|
|
11
11
|
const { getConfig, renderer, getI18n } = VxeUI
|
|
12
12
|
|
|
@@ -113,10 +113,15 @@ function getCellLabelVNs (h: CreateElement, renderOpts: any, params: any, cellLa
|
|
|
113
113
|
* @param modelFunc
|
|
114
114
|
* @param changeFunc
|
|
115
115
|
*/
|
|
116
|
-
function getNativeElementOns (renderOpts: any, params: any,
|
|
116
|
+
function getNativeElementOns (renderOpts: any, params: any, eFns?: {
|
|
117
|
+
model: (evnt: Event) => void
|
|
118
|
+
change?: (evnt: Event) => void
|
|
119
|
+
blur?: (evnt: Event) => void
|
|
120
|
+
}) {
|
|
117
121
|
const { events } = renderOpts
|
|
118
122
|
const modelEvent = getModelEvent(renderOpts)
|
|
119
123
|
const changeEvent = getChangeEvent(renderOpts)
|
|
124
|
+
const { model: modelFunc, change: changeFunc, blur: blurFunc } = eFns || {}
|
|
120
125
|
const isSameEvent = changeEvent === modelEvent
|
|
121
126
|
const ons: any = {}
|
|
122
127
|
if (events) {
|
|
@@ -138,16 +143,26 @@ function getNativeElementOns (renderOpts: any, params: any, modelFunc?: any, cha
|
|
|
138
143
|
}
|
|
139
144
|
}
|
|
140
145
|
if (!isSameEvent && changeFunc) {
|
|
141
|
-
ons[getOnName(changeEvent)] = function (
|
|
142
|
-
changeFunc(
|
|
146
|
+
ons[getOnName(changeEvent)] = function (evnt: Event) {
|
|
147
|
+
changeFunc(evnt)
|
|
143
148
|
if (events && events[changeEvent]) {
|
|
144
|
-
events[changeEvent](params,
|
|
149
|
+
events[changeEvent](params, evnt)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
if (blurFunc) {
|
|
154
|
+
ons[getOnName(blurEvent)] = function (evnt: Event) {
|
|
155
|
+
blurFunc(evnt)
|
|
156
|
+
if (events && events[blurEvent]) {
|
|
157
|
+
events[blurEvent](params, evnt)
|
|
145
158
|
}
|
|
146
159
|
}
|
|
147
160
|
}
|
|
148
161
|
return ons
|
|
149
162
|
}
|
|
150
163
|
|
|
164
|
+
const blurEvent = 'blur'
|
|
165
|
+
|
|
151
166
|
/**
|
|
152
167
|
* 组件事件处理
|
|
153
168
|
* @param renderOpts
|
|
@@ -155,10 +170,15 @@ function getNativeElementOns (renderOpts: any, params: any, modelFunc?: any, cha
|
|
|
155
170
|
* @param modelFunc
|
|
156
171
|
* @param changeFunc
|
|
157
172
|
*/
|
|
158
|
-
function getComponentOns (renderOpts: any, params: any,
|
|
173
|
+
function getComponentOns (renderOpts: any, params: any, eFns?: {
|
|
174
|
+
model: (cellValue: any) => void
|
|
175
|
+
change?: (...args: any[]) => void
|
|
176
|
+
blur?: (...args: any[]) => void
|
|
177
|
+
}) {
|
|
159
178
|
const { events } = renderOpts
|
|
160
179
|
const modelEvent = getModelEvent(renderOpts)
|
|
161
180
|
const changeEvent = getChangeEvent(renderOpts)
|
|
181
|
+
const { model: modelFunc, change: changeFunc, blur: blurFunc } = eFns || {}
|
|
162
182
|
const ons: any = {}
|
|
163
183
|
XEUtils.objectEach(events, (func, key: any) => {
|
|
164
184
|
ons[getOnName(key)] = function (...args: any[]) {
|
|
@@ -186,68 +206,117 @@ function getComponentOns (renderOpts: any, params: any, modelFunc?: any, changeF
|
|
|
186
206
|
}
|
|
187
207
|
}
|
|
188
208
|
}
|
|
209
|
+
if (blurFunc) {
|
|
210
|
+
ons[getOnName(blurEvent)] = function (...args: any[]) {
|
|
211
|
+
blurFunc(...args)
|
|
212
|
+
if (events && events[blurEvent]) {
|
|
213
|
+
events[blurEvent](params, ...args)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
189
217
|
return ons
|
|
190
218
|
}
|
|
191
219
|
|
|
192
|
-
function getEditOns (renderOpts:
|
|
220
|
+
function getEditOns (renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderTableEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
193
221
|
const { $table, row, column } = params
|
|
194
222
|
const { name } = renderOpts
|
|
195
223
|
const { model } = column
|
|
196
224
|
const isImmediate = isImmediateCell(renderOpts, params)
|
|
197
|
-
return getComponentOns(renderOpts, params,
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
model.value = cellValue
|
|
201
|
-
if (isImmediate) {
|
|
202
|
-
setCellValue(row, column, cellValue)
|
|
203
|
-
}
|
|
204
|
-
}, (eventParams: any) => {
|
|
205
|
-
// 处理 change 事件相关逻辑
|
|
206
|
-
if (!isImmediate && (['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name))) {
|
|
207
|
-
const cellValue = eventParams.value
|
|
225
|
+
return getComponentOns(renderOpts, params, {
|
|
226
|
+
model (cellValue) {
|
|
227
|
+
// 处理 model 值双向绑定
|
|
208
228
|
model.update = true
|
|
209
229
|
model.value = cellValue
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
230
|
+
if (isImmediate) {
|
|
231
|
+
setCellValue(row, column, cellValue)
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
change (eventParams) {
|
|
235
|
+
// 处理 change 事件相关逻辑
|
|
236
|
+
if (!isImmediate && name && (['VxeInput', 'VxeNumberInput', 'VxeTextarea', '$input', '$textarea'].includes(name))) {
|
|
237
|
+
const cellValue = eventParams.value
|
|
238
|
+
model.update = true
|
|
239
|
+
model.value = cellValue
|
|
240
|
+
$table.updateStatus(params, cellValue)
|
|
241
|
+
} else {
|
|
242
|
+
$table.updateStatus(params)
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
blur () {
|
|
246
|
+
if (isImmediate) {
|
|
247
|
+
$table.handleCellRuleUpdateStatus('blur', params)
|
|
248
|
+
} else {
|
|
249
|
+
$table.handleCellRuleUpdateStatus('blur', params, model.value)
|
|
250
|
+
}
|
|
213
251
|
}
|
|
214
252
|
})
|
|
215
253
|
}
|
|
216
254
|
|
|
217
255
|
function getFilterOns (renderOpts: any, params: any, option: any) {
|
|
218
|
-
return getComponentOns(renderOpts, params,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
256
|
+
return getComponentOns(renderOpts, params, {
|
|
257
|
+
model (value) {
|
|
258
|
+
// 处理 model 值双向绑定
|
|
259
|
+
option.data = value
|
|
260
|
+
},
|
|
261
|
+
change () {
|
|
262
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
|
|
263
|
+
},
|
|
264
|
+
blur () {
|
|
265
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
|
|
266
|
+
}
|
|
223
267
|
})
|
|
224
268
|
}
|
|
225
269
|
|
|
226
270
|
function getNativeEditOns (renderOpts: any, params: any) {
|
|
227
271
|
const { $table, row, column } = params
|
|
228
272
|
const { model } = column
|
|
229
|
-
return getNativeElementOns(renderOpts, params,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
273
|
+
return getNativeElementOns(renderOpts, params, {
|
|
274
|
+
model (evnt) {
|
|
275
|
+
// 处理 model 值双向绑定
|
|
276
|
+
const targetEl = evnt.target as HTMLInputElement
|
|
277
|
+
if (targetEl) {
|
|
278
|
+
const cellValue = targetEl.value
|
|
279
|
+
if (isImmediateCell(renderOpts, params)) {
|
|
280
|
+
setCellValue(row, column, cellValue)
|
|
281
|
+
} else {
|
|
282
|
+
model.update = true
|
|
283
|
+
model.value = cellValue
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
change (evnt) {
|
|
288
|
+
// 处理 change 事件相关逻辑
|
|
289
|
+
const targetEl = evnt.target as HTMLInputElement
|
|
290
|
+
if (targetEl) {
|
|
291
|
+
const cellValue = targetEl.value
|
|
292
|
+
$table.updateStatus(params, cellValue)
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
blur (evnt) {
|
|
296
|
+
const targetEl = evnt.target as HTMLInputElement
|
|
297
|
+
if (targetEl) {
|
|
298
|
+
const cellValue = targetEl.value
|
|
299
|
+
$table.updateStatus(params, cellValue)
|
|
300
|
+
}
|
|
237
301
|
}
|
|
238
|
-
}, (evnt: any) => {
|
|
239
|
-
// 处理 change 事件相关逻辑
|
|
240
|
-
const cellValue = evnt.target.value
|
|
241
|
-
$table.updateStatus(params, cellValue)
|
|
242
302
|
})
|
|
243
303
|
}
|
|
244
304
|
|
|
245
305
|
function getNativeFilterOns (renderOpts: any, params: any, option: any) {
|
|
246
|
-
return getNativeElementOns(renderOpts, params,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
306
|
+
return getNativeElementOns(renderOpts, params, {
|
|
307
|
+
model (evnt) {
|
|
308
|
+
// 处理 model 值双向绑定
|
|
309
|
+
const targetEl = evnt.target as HTMLInputElement
|
|
310
|
+
if (targetEl) {
|
|
311
|
+
option.data = targetEl.value
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
change () {
|
|
315
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
|
|
316
|
+
},
|
|
317
|
+
blur () {
|
|
318
|
+
handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
|
|
319
|
+
}
|
|
251
320
|
})
|
|
252
321
|
}
|
|
253
322
|
|
|
@@ -280,7 +349,7 @@ function buttonCellRender (h: CreateElement, renderOpts: any, params: any) {
|
|
|
280
349
|
]
|
|
281
350
|
}
|
|
282
351
|
|
|
283
|
-
function defaultEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
|
|
352
|
+
function defaultEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
284
353
|
const { row, column } = params
|
|
285
354
|
const cellValue = getCellValue(row, column)
|
|
286
355
|
return [
|
|
@@ -291,7 +360,7 @@ function defaultEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandl
|
|
|
291
360
|
]
|
|
292
361
|
}
|
|
293
362
|
|
|
294
|
-
function radioAndCheckboxEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
|
|
363
|
+
function radioAndCheckboxEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
295
364
|
const { options } = renderOpts
|
|
296
365
|
const { row, column } = params
|
|
297
366
|
const cellValue = getCellValue(row, column)
|
|
@@ -310,7 +379,7 @@ function radioAndCheckboxEditRender (h: CreateElement, renderOpts: VxeGlobalRend
|
|
|
310
379
|
* 已废弃
|
|
311
380
|
* @deprecated
|
|
312
381
|
*/
|
|
313
|
-
function oldEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams) {
|
|
382
|
+
function oldEditRender (h: CreateElement, renderOpts: VxeGlobalRendererHandles.RenderTableEditOptions, params: VxeGlobalRendererHandles.RenderEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
314
383
|
const { row, column } = params
|
|
315
384
|
const cellValue = getCellValue(row, column)
|
|
316
385
|
return [
|
|
@@ -776,7 +845,7 @@ renderer.mixin({
|
|
|
776
845
|
},
|
|
777
846
|
VxeColorPicker: {
|
|
778
847
|
tableAutoFocus: 'input',
|
|
779
|
-
renderTableEdit (h, renderOpts, params) {
|
|
848
|
+
renderTableEdit (h, renderOpts, params: VxeGlobalRendererHandles.RenderTableEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
780
849
|
const { row, column } = params
|
|
781
850
|
const { options } = renderOpts
|
|
782
851
|
const cellValue = getCellValue(row, column)
|
|
@@ -804,7 +873,7 @@ renderer.mixin({
|
|
|
804
873
|
},
|
|
805
874
|
VxeIconPicker: {
|
|
806
875
|
tableAutoFocus: 'input',
|
|
807
|
-
renderTableEdit (h, renderOpts, params) {
|
|
876
|
+
renderTableEdit (h, renderOpts, params: VxeGlobalRendererHandles.RenderTableEditParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
808
877
|
const { row, column } = params
|
|
809
878
|
const { options } = renderOpts
|
|
810
879
|
const cellValue = getCellValue(row, column)
|
|
@@ -840,7 +909,7 @@ renderer.mixin({
|
|
|
840
909
|
renderTableDefault: defaultEditRender
|
|
841
910
|
},
|
|
842
911
|
VxeImage: {
|
|
843
|
-
renderTableDefault (h, renderOpts, params) {
|
|
912
|
+
renderTableDefault (h, renderOpts, params: VxeGlobalRendererHandles.RenderTableDefaultParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
844
913
|
const { row, column } = params
|
|
845
914
|
const { props } = renderOpts
|
|
846
915
|
const cellValue = getCellValue(row, column)
|
|
@@ -856,7 +925,7 @@ renderer.mixin({
|
|
|
856
925
|
}
|
|
857
926
|
},
|
|
858
927
|
VxeImageGroup: {
|
|
859
|
-
renderTableDefault (h, renderOpts, params) {
|
|
928
|
+
renderTableDefault (h, renderOpts, params: VxeGlobalRendererHandles.RenderTableDefaultParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
860
929
|
const { row, column } = params
|
|
861
930
|
const { props } = renderOpts
|
|
862
931
|
const cellValue = getCellValue(row, column)
|
|
@@ -872,7 +941,7 @@ renderer.mixin({
|
|
|
872
941
|
}
|
|
873
942
|
},
|
|
874
943
|
VxeTextEllipsis: {
|
|
875
|
-
renderTableDefault (h, renderOpts, params) {
|
|
944
|
+
renderTableDefault (h, renderOpts, params: VxeGlobalRendererHandles.RenderTableDefaultParams & { $table: VxeTableConstructor & VxeTablePrivateMethods }) {
|
|
876
945
|
const { row, column } = params
|
|
877
946
|
const { props } = renderOpts
|
|
878
947
|
const cellValue = getCellValue(row, column)
|
|
@@ -89,8 +89,10 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
89
89
|
const isAutoCellWidth = !column.resizeWidth && (column.minWidth === 'auto' || column.width === 'auto')
|
|
90
90
|
|
|
91
91
|
let isVNPreEmptyStatus = false
|
|
92
|
-
if (
|
|
93
|
-
|
|
92
|
+
if (!isGroup) {
|
|
93
|
+
if (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
|
|
94
|
+
isVNPreEmptyStatus = true
|
|
95
|
+
}
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
const tcStyle: Record<string, string> = {}
|
|
@@ -7,7 +7,7 @@ import { getRowUniqueId, clearTableAllStatus, getRowkey, getRowid, rowToVisible,
|
|
|
7
7
|
import { getSlotVNs } from '../../ui/src/vn'
|
|
8
8
|
import { warnLog, errLog } from '../../ui/src/log'
|
|
9
9
|
|
|
10
|
-
import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeTablePrivateMethods, VxeTooltipInstance } from '../../../types'
|
|
10
|
+
import type { VxeTableDefines, VxeColumnPropTypes, VxeTableEmits, ValueOf, TableReactData, VxeTableConstructor, VxeToolbarConstructor, TableInternalData, VxeTablePrivateMethods, VxeTooltipInstance, VxeTablePropTypes } from '../../../types'
|
|
11
11
|
|
|
12
12
|
const { getConfig, getI18n, renderer, formats, interceptor, createEvent } = VxeUI
|
|
13
13
|
|
|
@@ -6121,13 +6121,13 @@ const Methods = {
|
|
|
6121
6121
|
/**
|
|
6122
6122
|
* 点击排序事件
|
|
6123
6123
|
*/
|
|
6124
|
-
triggerSortEvent (evnt:
|
|
6124
|
+
triggerSortEvent (evnt: Event, column: VxeTableDefines.ColumnInfo, order: VxeTablePropTypes.SortOrder) {
|
|
6125
6125
|
const $xeTable = this
|
|
6126
6126
|
|
|
6127
6127
|
const sortOpts = $xeTable.computeSortOpts
|
|
6128
6128
|
const { multiple, allowClear } = sortOpts
|
|
6129
|
-
const { field, sortable
|
|
6130
|
-
if (sortable || remoteSort) {
|
|
6129
|
+
const { field, sortable } = column
|
|
6130
|
+
if (sortable || (column as any).remoteSort) {
|
|
6131
6131
|
if (!order || column.order === order) {
|
|
6132
6132
|
if (allowClear) {
|
|
6133
6133
|
$xeTable.clearSort(multiple ? column : null)
|
|
@@ -6138,6 +6138,38 @@ const Methods = {
|
|
|
6138
6138
|
$xeTable.handleColumnSortEvent(evnt, column)
|
|
6139
6139
|
}
|
|
6140
6140
|
},
|
|
6141
|
+
handleCellRuleUpdateStatus (type: 'change' | 'blur', cellParams: {
|
|
6142
|
+
row: any
|
|
6143
|
+
column: VxeTableDefines.ColumnInfo
|
|
6144
|
+
}, cellValue?: any) {
|
|
6145
|
+
const $xeTable = this
|
|
6146
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
6147
|
+
|
|
6148
|
+
const { validStore } = reactData
|
|
6149
|
+
const { row, column } = cellParams
|
|
6150
|
+
if ($xeTable.hasCellRules) {
|
|
6151
|
+
if ($xeTable.hasCellRules(type, row, column)) {
|
|
6152
|
+
const cell = $xeTable.getCellElement(row, column)
|
|
6153
|
+
if (cell) {
|
|
6154
|
+
const customVal = !XEUtils.isUndefined(cellValue)
|
|
6155
|
+
return $xeTable.validCellRules(type, row, column, cellValue)
|
|
6156
|
+
.then(() => {
|
|
6157
|
+
if (customVal && validStore.visible) {
|
|
6158
|
+
setCellValue(row, column, cellValue)
|
|
6159
|
+
}
|
|
6160
|
+
$xeTable.clearValidate(row, column)
|
|
6161
|
+
})
|
|
6162
|
+
.catch(({ rule }: any) => {
|
|
6163
|
+
if (customVal) {
|
|
6164
|
+
setCellValue(row, column, cellValue)
|
|
6165
|
+
}
|
|
6166
|
+
$xeTable.showValidTooltip({ rule, row, column, cell })
|
|
6167
|
+
})
|
|
6168
|
+
}
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
return $xeTable.$nextTick()
|
|
6172
|
+
},
|
|
6141
6173
|
/**
|
|
6142
6174
|
* 表头单元格按下事件
|
|
6143
6175
|
*/
|
|
@@ -8485,33 +8517,13 @@ const Methods = {
|
|
|
8485
8517
|
* 如果单元格配置了校验规则,则会进行校验
|
|
8486
8518
|
*/
|
|
8487
8519
|
updateStatus (slotParams: any, cellValue: any) {
|
|
8488
|
-
const
|
|
8520
|
+
const $xeTable = this
|
|
8521
|
+
const props = $xeTable
|
|
8522
|
+
|
|
8489
8523
|
return this.$nextTick().then(() => {
|
|
8490
|
-
const {
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
const { row, column } = slotParams
|
|
8494
|
-
const type = 'change'
|
|
8495
|
-
if (this.hasCellRules) {
|
|
8496
|
-
if (this.hasCellRules(type, row, column)) {
|
|
8497
|
-
const cell = this.getCellElement(row, column)
|
|
8498
|
-
if (cell) {
|
|
8499
|
-
return this.validCellRules(type, row, column, cellValue)
|
|
8500
|
-
.then(() => {
|
|
8501
|
-
if (customVal && validStore.visible) {
|
|
8502
|
-
setCellValue(row, column, cellValue)
|
|
8503
|
-
}
|
|
8504
|
-
this.clearValidate(row, column)
|
|
8505
|
-
})
|
|
8506
|
-
.catch(({ rule }: any) => {
|
|
8507
|
-
if (customVal) {
|
|
8508
|
-
setCellValue(row, column, cellValue)
|
|
8509
|
-
}
|
|
8510
|
-
this.showValidTooltip({ rule, row, column, cell })
|
|
8511
|
-
})
|
|
8512
|
-
}
|
|
8513
|
-
}
|
|
8514
|
-
}
|
|
8524
|
+
const { editRules } = props
|
|
8525
|
+
if (slotParams && editRules) {
|
|
8526
|
+
return $xeTable.handleCellRuleUpdateStatus('change', slotParams, cellValue)
|
|
8515
8527
|
}
|
|
8516
8528
|
})
|
|
8517
8529
|
},
|
|
@@ -575,6 +575,13 @@ export default {
|
|
|
575
575
|
isFooter: false
|
|
576
576
|
},
|
|
577
577
|
|
|
578
|
+
rowHeightStore: {
|
|
579
|
+
default: 48,
|
|
580
|
+
medium: 44,
|
|
581
|
+
small: 40,
|
|
582
|
+
mini: 36
|
|
583
|
+
},
|
|
584
|
+
|
|
578
585
|
scrollVMLoading: false,
|
|
579
586
|
|
|
580
587
|
calcCellHeightFlag: 0,
|
|
@@ -686,12 +693,10 @@ export default {
|
|
|
686
693
|
return this.computeRowHeightMaps
|
|
687
694
|
},
|
|
688
695
|
computeRowHeightMaps () {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
mini: 36
|
|
694
|
-
}
|
|
696
|
+
const $xeTable = this
|
|
697
|
+
const reactData = $xeTable as TableReactData
|
|
698
|
+
|
|
699
|
+
return reactData.rowHeightStore
|
|
695
700
|
},
|
|
696
701
|
computeDefaultRowHeight () {
|
|
697
702
|
const $xeTable = this
|
|
@@ -1435,11 +1440,30 @@ export default {
|
|
|
1435
1440
|
mounted () {
|
|
1436
1441
|
const $xeTable = this
|
|
1437
1442
|
const props = $xeTable
|
|
1443
|
+
const reactData = $xeTable
|
|
1438
1444
|
|
|
1445
|
+
const { rowHeightStore } = reactData
|
|
1446
|
+
const varEl = $xeTable.$refs.refVarElem
|
|
1439
1447
|
const columnOpts = $xeTable.computeColumnOpts
|
|
1440
1448
|
const rowOpts = $xeTable.computeRowOpts
|
|
1441
1449
|
const customOpts = $xeTable.computeCustomOpts
|
|
1442
1450
|
|
|
1451
|
+
if (varEl) {
|
|
1452
|
+
const [defEl, mediumEl, smallEl, miniEl] = varEl.children
|
|
1453
|
+
if (defEl) {
|
|
1454
|
+
rowHeightStore.default = defEl.clientHeight
|
|
1455
|
+
}
|
|
1456
|
+
if (mediumEl) {
|
|
1457
|
+
rowHeightStore.medium = mediumEl.clientHeight
|
|
1458
|
+
}
|
|
1459
|
+
if (smallEl) {
|
|
1460
|
+
rowHeightStore.small = smallEl.clientHeight
|
|
1461
|
+
}
|
|
1462
|
+
if (miniEl) {
|
|
1463
|
+
rowHeightStore.mini = miniEl.clientHeight
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1443
1467
|
if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
|
|
1444
1468
|
initTpImg()
|
|
1445
1469
|
}
|
|
@@ -1596,6 +1620,23 @@ export default {
|
|
|
1596
1620
|
class: 'vxe-table-slots',
|
|
1597
1621
|
ref: 'hideColumn'
|
|
1598
1622
|
}, this.$slots.default),
|
|
1623
|
+
h('div', {
|
|
1624
|
+
ref: 'refVarElem',
|
|
1625
|
+
class: 'vxe-table-vars'
|
|
1626
|
+
}, [
|
|
1627
|
+
h('div', {
|
|
1628
|
+
class: 'vxe-table-var-default'
|
|
1629
|
+
}),
|
|
1630
|
+
h('div', {
|
|
1631
|
+
class: 'vxe-table-var-medium'
|
|
1632
|
+
}),
|
|
1633
|
+
h('div', {
|
|
1634
|
+
class: 'vxe-table-var-small'
|
|
1635
|
+
}),
|
|
1636
|
+
h('div', {
|
|
1637
|
+
class: 'vxe-table-var-mini'
|
|
1638
|
+
})
|
|
1639
|
+
]),
|
|
1599
1640
|
h('div', {
|
|
1600
1641
|
key: 'tw',
|
|
1601
1642
|
class: 'vxe-table--render-wrapper'
|
|
@@ -7,6 +7,27 @@
|
|
|
7
7
|
display: none;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
.vxe-table-vars {
|
|
11
|
+
height: 0;
|
|
12
|
+
width: 0;
|
|
13
|
+
visibility: hidden;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
user-select: none;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
.vxe-table-var-default {
|
|
18
|
+
height: var(--vxe-ui-table-row-height-default);
|
|
19
|
+
}
|
|
20
|
+
.vxe-table-var-medium {
|
|
21
|
+
height: var(--vxe-ui-table-row-height-medium);
|
|
22
|
+
}
|
|
23
|
+
.vxe-table-var-small {
|
|
24
|
+
height: var(--vxe-ui-table-row-height-small);
|
|
25
|
+
}
|
|
26
|
+
.vxe-table-var-mini {
|
|
27
|
+
height: var(--vxe-ui-table-row-height-mini);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
10
31
|
.vxe-table--print-frame {
|
|
11
32
|
position: fixed;
|
|
12
33
|
bottom: -100%;
|
|
@@ -1234,6 +1255,9 @@
|
|
|
1234
1255
|
}
|
|
1235
1256
|
}
|
|
1236
1257
|
}
|
|
1258
|
+
.vxe-cell--valid-error-tip {
|
|
1259
|
+
padding: 0 var(--vxe-ui-table-cell-padding-medium);
|
|
1260
|
+
}
|
|
1237
1261
|
}
|
|
1238
1262
|
&.size--small {
|
|
1239
1263
|
font-size: var(--vxe-ui-font-size-small);
|
|
@@ -1265,6 +1289,9 @@
|
|
|
1265
1289
|
}
|
|
1266
1290
|
}
|
|
1267
1291
|
}
|
|
1292
|
+
.vxe-cell--valid-error-tip {
|
|
1293
|
+
padding: 0 var(--vxe-ui-table-cell-padding-small);
|
|
1294
|
+
}
|
|
1268
1295
|
}
|
|
1269
1296
|
&.size--mini {
|
|
1270
1297
|
font-size: var(--vxe-ui-font-size-mini);
|
|
@@ -1296,6 +1323,9 @@
|
|
|
1296
1323
|
}
|
|
1297
1324
|
}
|
|
1298
1325
|
}
|
|
1326
|
+
.vxe-cell--valid-error-tip {
|
|
1327
|
+
padding: 0 var(--vxe-ui-table-cell-padding-mini);
|
|
1328
|
+
}
|
|
1299
1329
|
}
|
|
1300
1330
|
|
|
1301
1331
|
.vxe-header--column,
|
|
@@ -1894,8 +1924,7 @@
|
|
|
1894
1924
|
transform: translateX(-50%);
|
|
1895
1925
|
text-align: left;
|
|
1896
1926
|
z-index: 4;
|
|
1897
|
-
padding
|
|
1898
|
-
padding-right: var(--vxe-ui-table-cell-padding-right);
|
|
1927
|
+
padding: 0 var(--vxe-ui-table-cell-padding-default);
|
|
1899
1928
|
}
|
|
1900
1929
|
.vxe-cell--valid-error-wrapper {
|
|
1901
1930
|
display: inline-block;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|