vxe-table 3.7.0-beta.5 → 3.7.0-beta.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.
Files changed (137) hide show
  1. package/README.md +4 -8
  2. package/lib/edit/src/mixin.js +3 -3
  3. package/lib/edit/src/mixin.min.js +1 -1
  4. package/lib/filter/src/mixin.js +13 -7
  5. package/lib/filter/src/mixin.min.js +1 -1
  6. package/lib/form/src/form.js +27 -5
  7. package/lib/form/src/form.min.js +1 -1
  8. package/lib/grid/src/grid.js +7 -3
  9. package/lib/grid/src/grid.min.js +1 -1
  10. package/lib/icon/style/style.css +1 -1
  11. package/lib/icon/style/style.min.css +1 -1
  12. package/lib/index.css +1 -1
  13. package/lib/index.umd.js +394 -127
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/input/src/input.js +11 -1
  16. package/lib/input/src/input.min.js +1 -1
  17. package/lib/locale/lang/en-US.js +7 -0
  18. package/lib/locale/lang/en-US.min.js +1 -1
  19. package/lib/locale/lang/en-US.umd.js +7 -0
  20. package/lib/locale/lang/es-ES.js +7 -0
  21. package/lib/locale/lang/es-ES.min.js +1 -1
  22. package/lib/locale/lang/es-ES.umd.js +7 -0
  23. package/lib/locale/lang/ja-JP.js +7 -0
  24. package/lib/locale/lang/ja-JP.min.js +1 -1
  25. package/lib/locale/lang/ja-JP.umd.js +7 -0
  26. package/lib/locale/lang/zh-CN.js +7 -0
  27. package/lib/locale/lang/zh-CN.min.js +1 -1
  28. package/lib/locale/lang/zh-CN.umd.js +7 -0
  29. package/lib/locale/lang/zh-HK.min.js +1 -1
  30. package/lib/locale/lang/zh-HK.umd.js +7 -0
  31. package/lib/locale/lang/zh-MO.min.js +1 -1
  32. package/lib/locale/lang/zh-MO.umd.js +7 -0
  33. package/lib/locale/lang/zh-TC.js +7 -0
  34. package/lib/locale/lang/zh-TC.min.js +1 -1
  35. package/lib/locale/lang/zh-TC.umd.js +7 -0
  36. package/lib/locale/lang/zh-TW.min.js +1 -1
  37. package/lib/locale/lang/zh-TW.umd.js +7 -0
  38. package/lib/menu/src/mixin.js +3 -3
  39. package/lib/menu/src/mixin.min.js +1 -1
  40. package/lib/select/src/select.js +6 -1
  41. package/lib/select/src/select.min.js +1 -1
  42. package/lib/style.css +1 -1
  43. package/lib/style.min.css +1 -1
  44. package/lib/table/src/cell.js +4 -2
  45. package/lib/table/src/cell.min.js +1 -1
  46. package/lib/table/src/columnInfo.js +6 -6
  47. package/lib/table/src/columnInfo.min.js +1 -1
  48. package/lib/table/src/methods.js +74 -47
  49. package/lib/table/src/methods.min.js +1 -1
  50. package/lib/table/src/table.js +12 -25
  51. package/lib/table/src/table.min.js +1 -1
  52. package/lib/table/style/style.css +2 -2
  53. package/lib/table/style/style.min.css +1 -1
  54. package/lib/textarea/src/textarea.js +6 -1
  55. package/lib/textarea/src/textarea.min.js +1 -1
  56. package/lib/toolbar/src/toolbar.js +18 -6
  57. package/lib/toolbar/src/toolbar.min.js +1 -1
  58. package/lib/tools/log.js +1 -1
  59. package/lib/tools/log.min.js +1 -1
  60. package/lib/v-x-e-table/index.js +3 -1
  61. package/lib/v-x-e-table/index.min.js +1 -1
  62. package/lib/v-x-e-table/src/commands.js +58 -2
  63. package/lib/v-x-e-table/src/commands.min.js +1 -1
  64. package/lib/v-x-e-table/src/conf.js +4 -1
  65. package/lib/v-x-e-table/src/conf.min.js +1 -1
  66. package/lib/v-x-e-table/src/formats.js +58 -2
  67. package/lib/v-x-e-table/src/formats.min.js +1 -1
  68. package/lib/v-x-e-table/src/menus.js +58 -2
  69. package/lib/v-x-e-table/src/menus.min.js +1 -1
  70. package/lib/v-x-e-table/src/store.js +5 -2
  71. package/lib/v-x-e-table/src/store.min.js +1 -1
  72. package/lib/v-x-e-table/src/validators.js +15 -0
  73. package/lib/v-x-e-table/src/validators.min.js +1 -0
  74. package/lib/validator/src/mixin.js +26 -4
  75. package/lib/validator/src/mixin.min.js +1 -1
  76. package/package.json +2 -2
  77. package/packages/edit/src/mixin.js +3 -3
  78. package/packages/filter/src/mixin.js +5 -1
  79. package/packages/form/src/form.js +27 -6
  80. package/packages/grid/src/grid.js +7 -3
  81. package/packages/input/src/input.js +9 -1
  82. package/packages/locale/lang/en-US.js +7 -0
  83. package/packages/locale/lang/es-ES.js +7 -0
  84. package/packages/locale/lang/ja-JP.js +7 -0
  85. package/packages/locale/lang/zh-CN.js +7 -0
  86. package/packages/locale/lang/zh-TC.js +7 -0
  87. package/packages/menu/src/mixin.js +3 -3
  88. package/packages/select/src/select.js +4 -1
  89. package/packages/table/src/cell.js +4 -2
  90. package/packages/table/src/columnInfo.js +6 -6
  91. package/packages/table/src/methods.js +67 -46
  92. package/packages/table/src/table.js +6 -2
  93. package/packages/textarea/src/textarea.js +4 -1
  94. package/packages/toolbar/src/toolbar.js +18 -6
  95. package/packages/v-x-e-table/index.js +2 -0
  96. package/packages/v-x-e-table/src/commands.js +48 -2
  97. package/packages/v-x-e-table/src/conf.js +4 -1
  98. package/packages/v-x-e-table/src/formats.js +48 -2
  99. package/packages/v-x-e-table/src/menus.js +48 -2
  100. package/packages/v-x-e-table/src/store.js +4 -2
  101. package/packages/v-x-e-table/src/validators.js +7 -0
  102. package/packages/validator/src/mixin.js +25 -4
  103. package/styles/table.scss +2 -2
  104. package/types/colgroup.d.ts +3 -1
  105. package/types/column.d.ts +3 -0
  106. package/types/edit.d.ts +4 -2
  107. package/types/export.d.ts +2 -0
  108. package/types/filter.d.ts +3 -1
  109. package/types/footer.d.ts +3 -1
  110. package/types/form-item.d.ts +2 -0
  111. package/types/form.d.ts +16 -12
  112. package/types/grid.d.ts +3 -0
  113. package/types/header.d.ts +3 -1
  114. package/types/index.d.ts +1 -1
  115. package/types/input.d.ts +2 -0
  116. package/types/list.d.ts +1 -1
  117. package/types/menu.d.ts +2 -0
  118. package/types/modal.d.ts +7 -3
  119. package/types/pulldown.d.ts +2 -3
  120. package/types/table.d.ts +33 -26
  121. package/types/textarea.d.ts +1 -0
  122. package/types/toolbar.d.ts +2 -0
  123. package/types/tooltip.d.ts +1 -1
  124. package/types/v-x-e-table/commands.d.ts +23 -13
  125. package/types/v-x-e-table/formats.d.ts +21 -12
  126. package/types/v-x-e-table/index.d.ts +31 -24
  127. package/types/v-x-e-table/interceptor.d.ts +1 -1
  128. package/types/v-x-e-table/menus.d.ts +17 -6
  129. package/types/v-x-e-table/renderer.d.ts +5 -3
  130. package/types/v-x-e-table/validators.d.ts +30 -0
  131. package/types/validator.d.ts +15 -4
  132. /package/lib/icon/style/{iconfont.1689384538396.ttf → iconfont.1690156580206.ttf} +0 -0
  133. /package/lib/icon/style/{iconfont.1689384538396.woff → iconfont.1690156580206.woff} +0 -0
  134. /package/lib/icon/style/{iconfont.1689384538396.woff2 → iconfont.1690156580206.woff2} +0 -0
  135. /package/lib/{iconfont.1689384538396.ttf → iconfont.1690156580206.ttf} +0 -0
  136. /package/lib/{iconfont.1689384538396.woff → iconfont.1690156580206.woff} +0 -0
  137. /package/lib/{iconfont.1689384538396.woff2 → iconfont.1690156580206.woff2} +0 -0
@@ -1,5 +1,9 @@
1
1
  export default {
2
2
  vxe: {
3
+ base: {
4
+ pleaseInput: '请输入',
5
+ pleaseSelect: '请选择'
6
+ },
3
7
  loading: {
4
8
  text: '加载中...'
5
9
  },
@@ -19,6 +23,9 @@ export default {
19
23
  errProp: '不支持的参数 "{0}",可能为 "{1}"',
20
24
  colRepet: 'column.{0}="{1}" 重复了,这可能会导致某些功能无法使用',
21
25
  notFunc: '方法 "{0}" 不存在',
26
+ notValidators: '全局校验 "{0}" 不存在',
27
+ notFormats: '全局格式化 "{0}" 不存在',
28
+ notCommands: '全局指令 "{0}" 不存在',
22
29
  notSlot: '插槽 "{0}" 不存在',
23
30
  noTree: '树结构不支持 "{0}"',
24
31
  notProp: '不支持的参数 "{0}"',
@@ -1,5 +1,9 @@
1
1
  export default {
2
2
  vxe: {
3
+ base: {
4
+ pleaseInput: '请输入',
5
+ pleaseSelect: '请选择'
6
+ },
3
7
  loading: {
4
8
  text: '加載中...'
5
9
  },
@@ -19,6 +23,9 @@ export default {
19
23
  errProp: '不支持的參數 "{0}",可能為 "{1}"',
20
24
  colRepet: 'column.{0}="{1}" 重複了,這可能會導致某些功能無法使用',
21
25
  notFunc: '方法 "{0}" 不存在',
26
+ notValidators: '全局校验 "{0}" 不存在',
27
+ notFormats: '全局格式化 "{0}" 不存在',
28
+ notCommands: '全局指令 "{0}" 不存在',
22
29
  notSlot: '插槽 "{0}" 不存在',
23
30
  noTree: '樹狀結構不支援 {0}',
24
31
  notProp: '不支持的參數 "{0}"',
@@ -249,10 +249,10 @@ export default {
249
249
  ctxMenuLinkEvent (evnt, menu) {
250
250
  // 如果一级菜单有配置 code 则允许点击,否则不能点击
251
251
  if (!menu.disabled && (menu.code || !menu.children || !menu.children.length)) {
252
- const ctxMenuMethod = VXETable.menus.get(menu.code)
252
+ const gMenuOpts = VXETable.menus.get(menu.code)
253
253
  const params = Object.assign({ menu, $grid: this.$xegrid, $table: this, $event: evnt }, this.ctxMenuStore.args)
254
- if (ctxMenuMethod) {
255
- ctxMenuMethod.call(this, params, evnt)
254
+ if (gMenuOpts && gMenuOpts.menuMethod) {
255
+ gMenuOpts.menuMethod(params, evnt)
256
256
  }
257
257
  // 在 v4 中废弃事件 context-menu-click
258
258
  if (this.$listeners['context-menu-click']) {
@@ -241,7 +241,10 @@ export default {
241
241
  props: {
242
242
  value: null,
243
243
  clearable: Boolean,
244
- placeholder: String,
244
+ placeholder: {
245
+ type: String,
246
+ default: () => XEUtils.eqNull(GlobalConfig.select.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseSelect') : GlobalConfig.select.placeholder
247
+ },
245
248
  loading: Boolean,
246
249
  disabled: Boolean,
247
250
  multiple: Boolean,
@@ -407,7 +407,7 @@ export const Cell = {
407
407
  },
408
408
  renderCheckboxCell (h, params) {
409
409
  const { $table, row, column, isHidden } = params
410
- const { treeConfig, treeIndeterminates, selection } = $table
410
+ const { treeConfig, treeIndeterminates, selectCheckboxRows } = $table
411
411
  const { labelField, checkMethod, visibleMethod } = $table.checkboxOpts
412
412
  const { slots } = column
413
413
  const defaultSlot = slots ? slots.default : null
@@ -418,7 +418,7 @@ export const Cell = {
418
418
  let isDisabled = !!checkMethod
419
419
  let on
420
420
  if (!isHidden) {
421
- isChecked = $table.findRowIndexOf(selection, row) > -1
421
+ isChecked = $table.findRowIndexOf(selectCheckboxRows, row) > -1
422
422
  on = {
423
423
  click (evnt) {
424
424
  if (!isDisabled && isVisible) {
@@ -639,6 +639,7 @@ export const Cell = {
639
639
  },
640
640
  on: {
641
641
  click (evnt) {
642
+ evnt.stopPropagation()
642
643
  $table.triggerSortEvent(evnt, column, 'asc')
643
644
  }
644
645
  }
@@ -652,6 +653,7 @@ export const Cell = {
652
653
  },
653
654
  on: {
654
655
  click (evnt) {
656
+ evnt.stopPropagation()
655
657
  $table.triggerSortEvent(evnt, column, 'desc')
656
658
  }
657
659
  }
@@ -40,14 +40,14 @@ export class ColumnInfo {
40
40
  }
41
41
  if (formatter) {
42
42
  if (XEUtils.isString(formatter)) {
43
- const globalFunc = formats.get(formatter) || XEUtils[formatter]
44
- if (!XEUtils.isFunction(globalFunc)) {
45
- errLog('vxe.error.notFunc', [formatter])
43
+ const gFormatOpts = formats.get(formatter) || XEUtils[formatter]
44
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.formatMethod)) {
45
+ errLog('vxe.error.notFormats', [formatter])
46
46
  }
47
47
  } else if (XEUtils.isArray(formatter)) {
48
- const globalFunc = formats.get(formatter[0]) || XEUtils[formatter[0]]
49
- if (!XEUtils.isFunction(globalFunc)) {
50
- errLog('vxe.error.notFunc', [formatter[0]])
48
+ const gFormatOpts = formats.get(formatter[0]) || XEUtils[formatter[0]]
49
+ if (!gFormatOpts || !XEUtils.isFunction(gFormatOpts.formatMethod)) {
50
+ errLog('vxe.error.notFormats', [formatter[0]])
51
51
  }
52
52
  }
53
53
  }
@@ -1167,11 +1167,11 @@ const Methods = {
1167
1167
  rowList = currTableData.filter(row => XEUtils.get(row, checkField))
1168
1168
  }
1169
1169
  } else {
1170
- const { selection } = this
1170
+ const { selectCheckboxRows } = this
1171
1171
  if (treeConfig) {
1172
- rowList = XEUtils.filterTree(currTableData, row => this.findRowIndexOf(selection, row) > -1, { children: transform ? mapChildren : children })
1172
+ rowList = XEUtils.filterTree(currTableData, row => this.findRowIndexOf(selectCheckboxRows, row) > -1, { children: transform ? mapChildren : children })
1173
1173
  } else {
1174
- rowList = currTableData.filter(row => this.findRowIndexOf(selection, row) > -1)
1174
+ rowList = currTableData.filter(row => this.findRowIndexOf(selectCheckboxRows, row) > -1)
1175
1175
  }
1176
1176
  }
1177
1177
  return rowList
@@ -2049,6 +2049,7 @@ const Methods = {
2049
2049
  },
2050
2050
  updateHeight () {
2051
2051
  this.customHeight = calcHeight(this, 'height')
2052
+ this.customMinHeight = calcHeight(this, 'minHeight')
2052
2053
  this.customMaxHeight = calcHeight(this, 'maxHeight')
2053
2054
  },
2054
2055
  updateStyle () {
@@ -2058,6 +2059,7 @@ const Methods = {
2058
2059
  fullColumnIdData,
2059
2060
  tableColumn,
2060
2061
  customHeight,
2062
+ customMinHeight,
2061
2063
  customMaxHeight,
2062
2064
  border,
2063
2065
  headerHeight,
@@ -2170,15 +2172,22 @@ const Methods = {
2170
2172
  } else if (layout === 'body') {
2171
2173
  const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
2172
2174
  if (isNodeElement(wrapperElem)) {
2175
+ const bodyMinHeight = fixedType ? ((customMinHeight - headerHeight - footerHeight) - (showFooter ? 0 : scrollbarHeight)) : (customMinHeight - headerHeight - footerHeight)
2176
+ let bodyMaxHeight = 0
2173
2177
  if (customMaxHeight) {
2174
- wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight - footerHeight}px`
2175
- } else {
2176
- if (customHeight > 0) {
2177
- wrapperElem.style.height = `${fixedType ? (customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight) : customHeight - headerHeight - footerHeight}px`
2178
- } else {
2179
- wrapperElem.style.height = ''
2178
+ bodyMaxHeight = Math.max(bodyMinHeight, fixedType ? (customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight)) : (customMaxHeight - headerHeight - footerHeight))
2179
+ wrapperElem.style.maxHeight = `${bodyMaxHeight}px`
2180
+ }
2181
+ if (customHeight > 0) {
2182
+ let bodyHeight = fixedType ? ((customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) - (showFooter ? 0 : scrollbarHeight)) : (customHeight - headerHeight - footerHeight)
2183
+ if (bodyMaxHeight) {
2184
+ bodyHeight = Math.min(bodyMaxHeight, bodyHeight)
2180
2185
  }
2186
+ wrapperElem.style.height = `${Math.max(bodyMinHeight, bodyHeight)}px`
2187
+ } else {
2188
+ wrapperElem.style.height = ''
2181
2189
  }
2190
+ wrapperElem.style.minHeight = `${bodyMinHeight}px`
2182
2191
  }
2183
2192
 
2184
2193
  // 如果是固定列
@@ -2947,12 +2956,12 @@ const Methods = {
2947
2956
  return this.handleCheckedCheckboxRow(rows, value, true)
2948
2957
  },
2949
2958
  isCheckedByCheckboxRow (row) {
2950
- const { selection } = this
2959
+ const { selectCheckboxRows } = this
2951
2960
  const { checkField } = this.checkboxOpts
2952
2961
  if (checkField) {
2953
2962
  return XEUtils.get(row, checkField)
2954
2963
  }
2955
- return this.findRowIndexOf(selection, row) > -1
2964
+ return this.findRowIndexOf(selectCheckboxRows, row) > -1
2956
2965
  },
2957
2966
  isIndeterminateByCheckboxRow (row) {
2958
2967
  const { treeIndeterminates } = this
@@ -2963,7 +2972,7 @@ const Methods = {
2963
2972
  * value 选中true 不选false 半选-1
2964
2973
  */
2965
2974
  handleSelectRow ({ row }, value, isForce) {
2966
- const { selection, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
2975
+ const { selectCheckboxRows, afterFullData, treeConfig, treeOpts, treeIndeterminates, checkboxOpts } = this
2967
2976
  const { checkField, checkStrictly, checkMethod } = checkboxOpts
2968
2977
  if (checkField) {
2969
2978
  if (treeConfig && !checkStrictly) {
@@ -3008,15 +3017,15 @@ const Methods = {
3008
3017
  if (this.findRowIndexOf(treeIndeterminates, row) === -1) {
3009
3018
  treeIndeterminates.push(row)
3010
3019
  }
3011
- XEUtils.remove(selection, item => this.eqRow(item, row))
3020
+ XEUtils.remove(selectCheckboxRows, item => this.eqRow(item, row))
3012
3021
  } else {
3013
3022
  // 更新子节点状态
3014
3023
  XEUtils.eachTree([row], (item) => {
3015
3024
  if (this.eqRow(item, row) || (isForce || (!checkMethod || checkMethod({ row: item })))) {
3016
3025
  if (value) {
3017
- selection.push(item)
3026
+ selectCheckboxRows.push(item)
3018
3027
  } else {
3019
- XEUtils.remove(selection, select => this.eqRow(select, item))
3028
+ XEUtils.remove(selectCheckboxRows, select => this.eqRow(select, item))
3020
3029
  }
3021
3030
  XEUtils.remove(treeIndeterminates, half => this.eqRow(half, item))
3022
3031
  this.handleCheckboxReserveRow(row, value)
@@ -3032,7 +3041,7 @@ const Methods = {
3032
3041
  if (indeterminatesItem) {
3033
3042
  parentStatus = -1
3034
3043
  } else {
3035
- const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selection, item) > -1)
3044
+ const selectItems = matchObj.items.filter(item => this.findRowIndexOf(selectCheckboxRows, item) > -1)
3036
3045
  parentStatus = selectItems.filter(item => this.findRowIndexOf(vItems, item) > -1).length === vItems.length ? true : (selectItems.length || value === -1 ? -1 : false)
3037
3046
  }
3038
3047
  return this.handleSelectRow({ row: matchObj.parent }, parentStatus, isForce)
@@ -3040,11 +3049,11 @@ const Methods = {
3040
3049
  } else {
3041
3050
  if (isForce || (!checkMethod || checkMethod({ row }))) {
3042
3051
  if (value) {
3043
- if (this.findRowIndexOf(selection, row) === -1) {
3044
- selection.push(row)
3052
+ if (this.findRowIndexOf(selectCheckboxRows, row) === -1) {
3053
+ selectCheckboxRows.push(row)
3045
3054
  }
3046
3055
  } else {
3047
- XEUtils.remove(selection, item => this.eqRow(item, row))
3056
+ XEUtils.remove(selectCheckboxRows, item => this.eqRow(item, row))
3048
3057
  }
3049
3058
  this.handleCheckboxReserveRow(row, value)
3050
3059
  }
@@ -3053,10 +3062,10 @@ const Methods = {
3053
3062
  this.checkSelectionStatus()
3054
3063
  },
3055
3064
  handleToggleCheckRowEvent (evnt, params) {
3056
- const { selection, checkboxOpts } = this
3065
+ const { selectCheckboxRows, checkboxOpts } = this
3057
3066
  const { checkField } = checkboxOpts
3058
3067
  const { row } = params
3059
- const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selection, row) === -1
3068
+ const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1
3060
3069
  if (evnt) {
3061
3070
  this.triggerCheckRowEvent(evnt, params, value)
3062
3071
  } else {
@@ -3079,17 +3088,17 @@ const Methods = {
3079
3088
  * 多选,切换某一行的选中状态
3080
3089
  */
3081
3090
  toggleCheckboxRow (row) {
3082
- const { selection, checkboxOpts } = this
3091
+ const { selectCheckboxRows, checkboxOpts } = this
3083
3092
  const { checkField } = checkboxOpts
3084
- const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selection, row) === -1
3093
+ const value = checkField ? !XEUtils.get(row, checkField) : this.findRowIndexOf(selectCheckboxRows, row) === -1
3085
3094
  this.handleSelectRow({ row }, value, true)
3086
3095
  return this.$nextTick()
3087
3096
  },
3088
3097
  handleCheckedAllCheckboxRow (value, isForce) {
3089
- const { afterFullData, treeConfig, treeOpts, selection, checkboxReserveRowMap, checkboxOpts } = this
3098
+ const { afterFullData, treeConfig, treeOpts, selectCheckboxRows, checkboxReserveRowMap, checkboxOpts } = this
3090
3099
  const { checkField, reserve, checkStrictly, checkMethod } = checkboxOpts
3091
3100
  let selectRows = []
3092
- const beforeSelection = treeConfig ? [] : selection.filter(row => this.findRowIndexOf(afterFullData, row) === -1)
3101
+ const beforeSelection = treeConfig ? [] : selectCheckboxRows.filter(row => this.findRowIndexOf(afterFullData, row) === -1)
3093
3102
  if (checkStrictly) {
3094
3103
  this.isAllSelected = value
3095
3104
  } else {
@@ -3136,7 +3145,7 @@ const Methods = {
3136
3145
  */
3137
3146
  if (!isForce && checkMethod) {
3138
3147
  XEUtils.eachTree(afterFullData, (row) => {
3139
- if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1) {
3148
+ if (checkMethod({ row }) ? 0 : this.findRowIndexOf(selectCheckboxRows, row) > -1) {
3140
3149
  selectRows.push(row)
3141
3150
  }
3142
3151
  }, treeOpts)
@@ -3150,7 +3159,7 @@ const Methods = {
3150
3159
  * 如果不存在选中方法,则添加所有数据到临时集合中
3151
3160
  */
3152
3161
  if (!isForce && checkMethod) {
3153
- selectRows = afterFullData.filter((row) => this.findRowIndexOf(selection, row) > -1 || checkMethod({ row }))
3162
+ selectRows = afterFullData.filter((row) => this.findRowIndexOf(selectCheckboxRows, row) > -1 || checkMethod({ row }))
3154
3163
  } else {
3155
3164
  selectRows = afterFullData.slice(0)
3156
3165
  }
@@ -3161,7 +3170,7 @@ const Methods = {
3161
3170
  * 如果不存在选中方法,无需处理,临时集合默认为空
3162
3171
  */
3163
3172
  if (!isForce && checkMethod) {
3164
- selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selection, row) > -1)
3173
+ selectRows = afterFullData.filter((row) => checkMethod({ row }) ? 0 : this.findRowIndexOf(selectCheckboxRows, row) > -1)
3165
3174
  }
3166
3175
  }
3167
3176
  }
@@ -3175,7 +3184,7 @@ const Methods = {
3175
3184
  afterFullData.forEach(row => this.handleCheckboxReserveRow(row, false))
3176
3185
  }
3177
3186
  }
3178
- this.selection = checkField ? [] : beforeSelection.concat(selectRows)
3187
+ this.selectCheckboxRows = checkField ? [] : beforeSelection.concat(selectRows)
3179
3188
  }
3180
3189
  this.treeIndeterminates = []
3181
3190
  this.checkSelectionStatus()
@@ -3189,7 +3198,7 @@ const Methods = {
3189
3198
  return this.handleCheckedAllCheckboxRow(value, true)
3190
3199
  },
3191
3200
  checkSelectionStatus () {
3192
- const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
3201
+ const { afterFullData, selectCheckboxRows, treeIndeterminates, checkboxOpts, treeConfig } = this
3193
3202
  const { checkField, halfField, checkStrictly, checkMethod } = checkboxOpts
3194
3203
  if (!checkStrictly) {
3195
3204
  const disableRows = []
@@ -3235,19 +3244,19 @@ const Methods = {
3235
3244
  disableRows.push(row)
3236
3245
  return true
3237
3246
  }
3238
- if (this.findRowIndexOf(selection, row) > -1) {
3247
+ if (this.findRowIndexOf(selectCheckboxRows, row) > -1) {
3239
3248
  checkRows.push(row)
3240
3249
  return true
3241
3250
  }
3242
3251
  return false
3243
3252
  }
3244
- : row => this.findRowIndexOf(selection, row) > -1
3253
+ : row => this.findRowIndexOf(selectCheckboxRows, row) > -1
3245
3254
  )
3246
3255
  isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
3247
3256
  if (treeConfig) {
3248
- isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(treeIndeterminates, row) > -1 || this.findRowIndexOf(selection, row) > -1)
3257
+ isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(treeIndeterminates, row) > -1 || this.findRowIndexOf(selectCheckboxRows, row) > -1)
3249
3258
  } else {
3250
- isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(selection, row) > -1)
3259
+ isIndeterminate = !isAllSelected && afterFullData.some(row => this.findRowIndexOf(selectCheckboxRows, row) > -1)
3251
3260
  }
3252
3261
  }
3253
3262
  this.isAllSelected = isAllSelected
@@ -3256,7 +3265,7 @@ const Methods = {
3256
3265
  },
3257
3266
  // 还原展开、选中等相关状态
3258
3267
  handleReserveStatus () {
3259
- const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRow, radioReserveRow, radioOpts, checkboxOpts, selection, rowExpandeds, treeExpandeds, expandOpts } = this
3268
+ const { expandColumn, treeOpts, treeConfig, fullDataRowIdData, fullAllDataRowMap, currentRow, selectRow, radioReserveRow, radioOpts, checkboxOpts, selectCheckboxRows, rowExpandeds, treeExpandeds, expandOpts } = this
3260
3269
  // 单选框
3261
3270
  if (selectRow && !fullAllDataRowMap.has(selectRow)) {
3262
3271
  this.selectRow = null // 刷新单选行状态
@@ -3269,7 +3278,7 @@ const Methods = {
3269
3278
  }
3270
3279
  }
3271
3280
  // 复选框
3272
- this.selection = getRecoverRow(this, selection) // 刷新多选行状态
3281
+ this.selectCheckboxRows = getRecoverRow(this, selectCheckboxRows) // 刷新多选行状态
3273
3282
  // 还原保留选中状态
3274
3283
  if (checkboxOpts.reserve) {
3275
3284
  this.handleCheckedCheckboxRow(handleReserveRow(this, this.checkboxReserveRowMap), true, true)
@@ -3407,7 +3416,7 @@ const Methods = {
3407
3416
  }
3408
3417
  this.isAllSelected = false
3409
3418
  this.isIndeterminate = false
3410
- this.selection = []
3419
+ this.selectCheckboxRows = []
3411
3420
  this.treeIndeterminates = []
3412
3421
  return this.$nextTick()
3413
3422
  },
@@ -3757,7 +3766,10 @@ const Methods = {
3757
3766
  } else {
3758
3767
  this.sort({ field, order })
3759
3768
  }
3760
- const params = { column, field, property: field, order: column.order, sortList: this.getSortColumns() }
3769
+ const params = { $table: this, $event: evnt, column, field, property: field, order: column.order, sortList: this.getSortColumns(), sortTime: column.sortTime }
3770
+ if (this.mouseConfig && this.mouseOpts.area && this.handleSortEvent) {
3771
+ return this.handleSortEvent(evnt, params)
3772
+ }
3761
3773
  this.emitEvent('sort-change', params, evnt)
3762
3774
  }
3763
3775
  },
@@ -3972,7 +3984,16 @@ const Methods = {
3972
3984
  * @param {Boolean} expanded 是否展开
3973
3985
  */
3974
3986
  setAllRowExpand (expanded) {
3975
- return this.setRowExpand(this.expandOpts.lazy ? this.tableData : this.tableFullData, expanded)
3987
+ const { treeConfig, treeOpts, tableFullData, tableFullTreeData } = this
3988
+ let expandedRows = []
3989
+ if (treeConfig) {
3990
+ XEUtils.eachTree(tableFullTreeData, (row) => {
3991
+ expandedRows.push(row)
3992
+ }, treeOpts)
3993
+ } else {
3994
+ expandedRows = tableFullData
3995
+ }
3996
+ return this.setRowExpand(expandedRows, expanded)
3976
3997
  },
3977
3998
  handleAsyncRowExpand (row) {
3978
3999
  const rest = this.fullAllDataRowMap.get(row)
@@ -4671,12 +4692,12 @@ const Methods = {
4671
4692
  * 如果组件值 v-model 发生 change 时,调用改函数用于更新某一列编辑状态
4672
4693
  * 如果单元格配置了校验规则,则会进行校验
4673
4694
  */
4674
- updateStatus (scope, cellValue) {
4695
+ updateStatus (slotParams, cellValue) {
4675
4696
  const customVal = !XEUtils.isUndefined(cellValue)
4676
4697
  return this.$nextTick().then(() => {
4677
4698
  const { $refs, editRules, validStore } = this
4678
- if (scope && $refs.tableBody && editRules) {
4679
- const { row, column } = scope
4699
+ if (slotParams && $refs.tableBody && editRules) {
4700
+ const { row, column } = slotParams
4680
4701
  const type = 'change'
4681
4702
  if (this.hasCellRules(type, row, column)) {
4682
4703
  const cell = this.getCell(row, column)
@@ -4843,11 +4864,11 @@ const Methods = {
4843
4864
  }
4844
4865
  const formatParams = { cellValue, row, rowIndex: this.getRowIndex(row), column, columnIndex: this.getColumnIndex(column) }
4845
4866
  if (XEUtils.isString(formatter)) {
4846
- const globalFunc = formats.get(formatter)
4847
- cellLabel = globalFunc ? globalFunc(formatParams) : ''
4867
+ const gFormatOpts = formats.get(formatter)
4868
+ cellLabel = gFormatOpts && gFormatOpts.formatMethod ? gFormatOpts.formatMethod(formatParams) : ''
4848
4869
  } else if (XEUtils.isArray(formatter)) {
4849
- const globalFunc = formats.get(formatter[0])
4850
- cellLabel = globalFunc ? globalFunc(formatParams, ...formatter.slice(1)) : ''
4870
+ const gFormatOpts = formats.get(formatter[0])
4871
+ cellLabel = gFormatOpts && gFormatOpts.formatMethod ? gFormatOpts.formatMethod(formatParams, ...formatter.slice(1)) : ''
4851
4872
  } else {
4852
4873
  cellLabel = formatter(formatParams)
4853
4874
  }
@@ -96,6 +96,8 @@ export default {
96
96
  data: Array,
97
97
  // 表格的高度
98
98
  height: [Number, String],
99
+ // 表格的最小高度
100
+ minHeight: { type: [Number, String], default: () => GlobalConfig.table.minHeight },
99
101
  // 表格的最大高度
100
102
  maxHeight: [Number, String],
101
103
  // 已废弃,被 column-config.resizable 替换
@@ -303,7 +305,7 @@ export default {
303
305
  // 复选框属性,有选中且非全选状态
304
306
  isIndeterminate: false,
305
307
  // 复选框属性,已选中的行
306
- selection: [],
308
+ selectCheckboxRows: [],
307
309
  // 当前行
308
310
  currentRow: null,
309
311
  // 单选框属性,选中列
@@ -1015,11 +1017,13 @@ export default {
1015
1017
  hasTip,
1016
1018
  columnOpts,
1017
1019
  rowOpts,
1018
- loadingOpts
1020
+ loadingOpts,
1021
+ editRules
1019
1022
  } = this
1020
1023
  const { leftList, rightList } = columnStore
1021
1024
  return h('div', {
1022
1025
  class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
1026
+ [`vaild-msg--${validOpts.msgMode}`]: !!editRules,
1023
1027
  'vxe-editable': !!editConfig,
1024
1028
  'cell--highlight': highlightCell,
1025
1029
  'cell--selected': mouseConfig && mouseOpts.selected,
@@ -18,7 +18,10 @@ export default {
18
18
  name: String,
19
19
  readonly: Boolean,
20
20
  disabled: Boolean,
21
- placeholder: String,
21
+ placeholder: {
22
+ type: String,
23
+ default: () => XEUtils.eqNull(GlobalConfig.textarea.placeholder) ? GlobalConfig.i18n('vxe.base.pleaseInput') : GlobalConfig.textarea.placeholder
24
+ },
22
25
  maxlength: [String, Number],
23
26
  rows: { type: [String, Number], default: 2 },
24
27
  cols: { type: [String, Number], default: null },
@@ -649,10 +649,16 @@ export default {
649
649
  if ($xegrid) {
650
650
  $xegrid.triggerToolbarBtnEvent(item, evnt)
651
651
  } else {
652
- const commandMethod = VXETable.commands.get(code)
652
+ const gCommandOpts = VXETable.commands.get(code)
653
653
  const params = { code, button: item, $table: $xetable, $grid: $xegrid, $event: evnt }
654
- if (commandMethod) {
655
- commandMethod.call(this, params, evnt)
654
+ if (gCommandOpts) {
655
+ if (gCommandOpts.commandMethod) {
656
+ gCommandOpts.commandMethod(params)
657
+ } else {
658
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
659
+ errLog('vxe.error.notCommands', [code])
660
+ }
661
+ }
656
662
  }
657
663
  this.$emit('button-click', params)
658
664
  }
@@ -665,10 +671,16 @@ export default {
665
671
  if ($xegrid) {
666
672
  $xegrid.triggerToolbarTolEvent(item, evnt)
667
673
  } else {
668
- const commandMethod = VXETable.commands.get(code)
674
+ const gCommandOpts = VXETable.commands.get(code)
669
675
  const params = { code, tool: item, $xegrid, $table: $xetable, $event: evnt }
670
- if (commandMethod) {
671
- commandMethod.call(this, params, evnt)
676
+ if (gCommandOpts) {
677
+ if (gCommandOpts.commandMethod) {
678
+ gCommandOpts.commandMethod(params)
679
+ } else {
680
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
681
+ errLog('vxe.error.notCommands', [code])
682
+ }
683
+ }
672
684
  }
673
685
  this.$emit('tool-click', params)
674
686
  }
@@ -5,6 +5,7 @@ import { renderer } from './src/renderer'
5
5
  import { commands } from './src/commands'
6
6
  import { menus } from './src/menus'
7
7
  import { formats } from './src/formats'
8
+ import { validators } from './src/validators'
8
9
  import { setup } from './src/setup'
9
10
  import { UtilTools } from '../tools/utils'
10
11
  import { errLog } from '../tools/log'
@@ -98,6 +99,7 @@ export const VXETable = {
98
99
  commands,
99
100
  formats,
100
101
  menus,
102
+ validators,
101
103
  config,
102
104
  t,
103
105
  _t
@@ -1,6 +1,52 @@
1
- import VXEStore from './store'
1
+ import XEUtils from 'xe-utils'
2
+ import { warnLog } from '../../tools/log'
2
3
 
3
- export const commands = new VXEStore()
4
+ class VXECommandsStore {
5
+ constructor () {
6
+ this.store = {}
7
+ }
8
+
9
+ mixin (options) {
10
+ XEUtils.each(options, (item, key) => {
11
+ this.add(key, item)
12
+ })
13
+ return VXECommandsStore
14
+ }
15
+
16
+ get (name) {
17
+ return this.store[name]
18
+ }
19
+
20
+ add (name, render) {
21
+ const conf = this.store[name]
22
+ // 兼容
23
+ if (XEUtils.isFunction(render)) {
24
+ // warnLog('vxe.error.delProp', ['callback', 'commandMethod'])
25
+ render = {
26
+ commandMethod: render
27
+ }
28
+ }
29
+
30
+ // 检测是否覆盖
31
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
32
+ const confKeys = XEUtils.keys(conf)
33
+ XEUtils.each(render, (item, key) => {
34
+ if (confKeys.includes(key)) {
35
+ warnLog('vxe.error.coverProp', [name, key])
36
+ }
37
+ })
38
+ }
39
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
40
+ return VXECommandsStore
41
+ }
42
+
43
+ delete (name) {
44
+ delete this.store[name]
45
+ return VXECommandsStore
46
+ }
47
+ }
48
+
49
+ export const commands = new VXECommandsStore()
4
50
 
5
51
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
6
52
  Object.assign(commands, { _name: 'Commands' })
@@ -13,6 +13,7 @@ export default {
13
13
  animat: true,
14
14
  delayHover: 250,
15
15
  autoResize: true,
16
+ minHeight: 144,
16
17
  // keepSource: false,
17
18
  // showOverflow: null,
18
19
  // showHeaderOverflow: null,
@@ -46,7 +47,9 @@ export default {
46
47
  },
47
48
  validConfig: {
48
49
  showMessage: true,
49
- message: 'default'
50
+ autoClear: true,
51
+ message: 'inline',
52
+ msgMode: 'single'
50
53
  },
51
54
  columnConfig: {
52
55
  maxFixedSize: 4