vxe-table 3.12.12 → 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.
Files changed (57) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/table/module/edit/mixin.js +5 -6
  6. package/es/table/module/validator/mixin.js +13 -1
  7. package/es/table/render/index.js +104 -43
  8. package/es/table/src/header.js +4 -2
  9. package/es/table/src/methods.js +35 -28
  10. package/es/table/src/table.js +68 -28
  11. package/es/table/style.css +33 -2
  12. package/es/table/style.min.css +1 -1
  13. package/es/ui/index.js +5 -3
  14. package/es/ui/src/log.js +1 -1
  15. package/es/vxe-table/style.css +33 -2
  16. package/es/vxe-table/style.min.css +1 -1
  17. package/lib/index.css +1 -1
  18. package/lib/index.min.css +1 -1
  19. package/lib/index.umd.js +232 -106
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/style.css +1 -1
  22. package/lib/style.min.css +1 -1
  23. package/lib/table/module/edit/mixin.js +5 -6
  24. package/lib/table/module/edit/mixin.min.js +1 -1
  25. package/lib/table/module/validator/mixin.js +18 -4
  26. package/lib/table/module/validator/mixin.min.js +1 -1
  27. package/lib/table/render/index.js +109 -41
  28. package/lib/table/render/index.min.js +1 -1
  29. package/lib/table/src/header.js +4 -2
  30. package/lib/table/src/header.min.js +1 -1
  31. package/lib/table/src/methods.js +46 -40
  32. package/lib/table/src/methods.min.js +1 -1
  33. package/lib/table/src/table.js +44 -9
  34. package/lib/table/src/table.min.js +1 -1
  35. package/lib/table/style/style.css +33 -2
  36. package/lib/table/style/style.min.css +1 -1
  37. package/lib/ui/index.js +5 -3
  38. package/lib/ui/index.min.js +1 -1
  39. package/lib/ui/src/log.js +1 -1
  40. package/lib/ui/src/log.min.js +1 -1
  41. package/lib/vxe-table/style/style.css +33 -2
  42. package/lib/vxe-table/style/style.min.css +1 -1
  43. package/package.json +2 -2
  44. package/packages/table/module/edit/mixin.ts +5 -6
  45. package/packages/table/module/validator/mixin.ts +15 -2
  46. package/packages/table/render/index.ts +120 -51
  47. package/packages/table/src/header.ts +4 -2
  48. package/packages/table/src/methods.ts +42 -30
  49. package/packages/table/src/table.ts +71 -28
  50. package/packages/ui/index.ts +4 -2
  51. package/styles/components/table.scss +31 -2
  52. /package/es/{iconfont.1739010705633.ttf → iconfont.1739181382716.ttf} +0 -0
  53. /package/es/{iconfont.1739010705633.woff → iconfont.1739181382716.woff} +0 -0
  54. /package/es/{iconfont.1739010705633.woff2 → iconfont.1739181382716.woff2} +0 -0
  55. /package/lib/{iconfont.1739010705633.ttf → iconfont.1739181382716.ttf} +0 -0
  56. /package/lib/{iconfont.1739010705633.woff → iconfont.1739181382716.woff} +0 -0
  57. /package/lib/{iconfont.1739010705633.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, afterFullData, treeConfig, treeOpts } = this
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, modelFunc?: any, changeFunc?: 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 (...args: any[]) {
142
- changeFunc(...args)
146
+ ons[getOnName(changeEvent)] = function (evnt: Event) {
147
+ changeFunc(evnt)
143
148
  if (events && events[changeEvent]) {
144
- events[changeEvent](params, ...args)
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, modelFunc?: any, changeFunc?: 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: any, params: any) {
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, (cellValue: any) => {
198
- // 处理 model 值双向绑定
199
- model.update = true
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
- $table.updateStatus(params, cellValue)
211
- } else {
212
- $table.updateStatus(params)
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, (value: any) => {
219
- // 处理 model 值双向绑定
220
- option.data = value
221
- }, () => {
222
- handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
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, (evnt: any) => {
230
- // 处理 model 值双向绑定
231
- const cellValue = evnt.target.value
232
- if (isImmediateCell(renderOpts, params)) {
233
- setCellValue(row, column, cellValue)
234
- } else {
235
- model.update = true
236
- model.value = cellValue
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, (evnt: any) => {
247
- // 处理 model 值双向绑定
248
- option.data = evnt.target.value
249
- }, () => {
250
- handleConfirmFilter(params, !XEUtils.eqNull(option.data), option)
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 (scrollXLoad && !column.fixed && (_columnIndex < scrollXStore.visibleStartIndex - scrollXStore.preloadSize || _columnIndex > scrollXStore.visibleEndIndex + scrollXStore.preloadSize)) {
93
- isVNPreEmptyStatus = true
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: any, column: any, order: any) {
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, remoteSort } = column
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 customVal = !XEUtils.isUndefined(cellValue)
8520
+ const $xeTable = this
8521
+ const props = $xeTable
8522
+
8489
8523
  return this.$nextTick().then(() => {
8490
- const { $refs, editRules, validStore } = this
8491
- const refTableBody = $refs.refTableBody
8492
- if (slotParams && refTableBody && editRules) {
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
  },
@@ -126,7 +126,7 @@ const renderDragTipContents = (h: CreateElement, $xeTable: any) => {
126
126
  const renderDragTip = (h: CreateElement, $xeTable: any) => {
127
127
  const reactData = $xeTable
128
128
 
129
- const { dragRow } = reactData
129
+ const { dragRow, dragCol } = reactData
130
130
  const rowOpts = $xeTable.computeRowOpts
131
131
  const columnOpts = $xeTable.computeColumnOpts
132
132
  const rowDragOpts = $xeTable.computeRowDragOpts
@@ -148,31 +148,33 @@ const renderDragTip = (h: CreateElement, $xeTable: any) => {
148
148
  'is--guides': columnDragOpts.showGuidesStatus
149
149
  }]
150
150
  }),
151
- h('div', {
152
- ref: 'refDragTipElem',
153
- class: 'vxe-table--drag-sort-tip'
154
- }, [
155
- h('div', {
156
- class: 'vxe-table--drag-sort-tip-wrapper'
151
+ (dragRow && rowDragOpts.showDragTip) || (dragCol && columnDragOpts.showDragTip)
152
+ ? h('div', {
153
+ ref: 'refDragTipElem',
154
+ class: 'vxe-table--drag-sort-tip'
157
155
  }, [
158
156
  h('div', {
159
- class: 'vxe-table--drag-sort-tip-status'
157
+ class: 'vxe-table--drag-sort-tip-wrapper'
160
158
  }, [
161
- h('span', {
162
- class: ['vxe-table--drag-sort-tip-normal-status', dragRow ? getIcon().TABLE_DRAG_STATUS_ROW : getIcon().TABLE_DRAG_STATUS_COLUMN]
163
- }),
164
- h('span', {
165
- class: ['vxe-table--drag-sort-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
166
- }),
167
- h('span', {
168
- class: ['vxe-table--drag-sort-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
169
- })
170
- ]),
171
- h('div', {
172
- class: 'vxe-table--drag-sort-tip-content'
173
- }, renderDragTipContents(h, $xeTable))
159
+ h('div', {
160
+ class: 'vxe-table--drag-sort-tip-status'
161
+ }, [
162
+ h('span', {
163
+ class: ['vxe-table--drag-sort-tip-normal-status', dragRow ? getIcon().TABLE_DRAG_STATUS_ROW : getIcon().TABLE_DRAG_STATUS_COLUMN]
164
+ }),
165
+ h('span', {
166
+ class: ['vxe-table--drag-sort-tip-sub-status', getIcon().TABLE_DRAG_STATUS_SUB_ROW]
167
+ }),
168
+ h('span', {
169
+ class: ['vxe-table--drag-sort-tip-disabled-status', getIcon().TABLE_DRAG_DISABLED]
170
+ })
171
+ ]),
172
+ h('div', {
173
+ class: 'vxe-table--drag-sort-tip-content'
174
+ }, renderDragTipContents(h, $xeTable))
175
+ ])
174
176
  ])
175
- ])
177
+ : renderEmptyElement($xeTable)
176
178
  ])
177
179
  }
178
180
  return renderEmptyElement($xeTable)
@@ -573,6 +575,13 @@ export default {
573
575
  isFooter: false
574
576
  },
575
577
 
578
+ rowHeightStore: {
579
+ default: 48,
580
+ medium: 44,
581
+ small: 40,
582
+ mini: 36
583
+ },
584
+
576
585
  scrollVMLoading: false,
577
586
 
578
587
  calcCellHeightFlag: 0,
@@ -684,12 +693,10 @@ export default {
684
693
  return this.computeRowHeightMaps
685
694
  },
686
695
  computeRowHeightMaps () {
687
- return {
688
- default: 48,
689
- medium: 44,
690
- small: 40,
691
- mini: 36
692
- }
696
+ const $xeTable = this
697
+ const reactData = $xeTable as TableReactData
698
+
699
+ return reactData.rowHeightStore
693
700
  },
694
701
  computeDefaultRowHeight () {
695
702
  const $xeTable = this
@@ -1433,11 +1440,30 @@ export default {
1433
1440
  mounted () {
1434
1441
  const $xeTable = this
1435
1442
  const props = $xeTable
1443
+ const reactData = $xeTable
1436
1444
 
1445
+ const { rowHeightStore } = reactData
1446
+ const varEl = $xeTable.$refs.refVarElem
1437
1447
  const columnOpts = $xeTable.computeColumnOpts
1438
1448
  const rowOpts = $xeTable.computeRowOpts
1439
1449
  const customOpts = $xeTable.computeCustomOpts
1440
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
+
1441
1467
  if (columnOpts.drag || rowOpts.drag || customOpts.allowSort) {
1442
1468
  initTpImg()
1443
1469
  }
@@ -1594,6 +1620,23 @@ export default {
1594
1620
  class: 'vxe-table-slots',
1595
1621
  ref: 'hideColumn'
1596
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
+ ]),
1597
1640
  h('div', {
1598
1641
  key: 'tw',
1599
1642
  class: 'vxe-table--render-wrapper'
@@ -53,12 +53,14 @@ VxeUI.setConfig({
53
53
  rowDragConfig: {
54
54
  showIcon: true,
55
55
  animation: true,
56
- showGuidesStatus: true
56
+ showGuidesStatus: true,
57
+ showDragTip: true
57
58
  },
58
59
  columnDragConfig: {
59
60
  showIcon: true,
60
61
  animation: true,
61
- showGuidesStatus: true
62
+ showGuidesStatus: true,
63
+ showDragTip: true
62
64
  },
63
65
  checkboxConfig: {
64
66
  // trigger: 'default',