vxe-table 3.7.0-beta.1 → 3.7.0-beta.10

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 (189) hide show
  1. package/README.md +6 -9
  2. package/helper/vetur/attributes.json +86 -22
  3. package/helper/vetur/tags.json +17 -1
  4. package/lib/button/src/button.js +9 -3
  5. package/lib/button/src/button.min.js +1 -1
  6. package/lib/edit/src/mixin.js +10 -10
  7. package/lib/edit/src/mixin.min.js +1 -1
  8. package/lib/export/src/mixin.js +24 -13
  9. package/lib/export/src/mixin.min.js +1 -1
  10. package/lib/filter/src/mixin.js +13 -7
  11. package/lib/filter/src/mixin.min.js +1 -1
  12. package/lib/form/src/form.js +27 -5
  13. package/lib/form/src/form.min.js +1 -1
  14. package/lib/grid/src/grid.js +7 -3
  15. package/lib/grid/src/grid.min.js +1 -1
  16. package/lib/icon/style/style.css +1 -1
  17. package/lib/icon/style/style.min.css +1 -1
  18. package/lib/index.css +1 -1
  19. package/lib/index.umd.js +544 -229
  20. package/lib/index.umd.min.js +1 -1
  21. package/lib/input/src/input.js +11 -1
  22. package/lib/input/src/input.min.js +1 -1
  23. package/lib/locale/lang/en-US.js +8 -0
  24. package/lib/locale/lang/en-US.min.js +1 -1
  25. package/lib/locale/lang/en-US.umd.js +8 -0
  26. package/lib/locale/lang/es-ES.js +8 -0
  27. package/lib/locale/lang/es-ES.min.js +1 -1
  28. package/lib/locale/lang/es-ES.umd.js +8 -0
  29. package/lib/locale/lang/ja-JP.d.ts +1 -1
  30. package/lib/locale/lang/ja-JP.js +8 -0
  31. package/lib/locale/lang/ja-JP.min.js +1 -1
  32. package/lib/locale/lang/ja-JP.umd.js +8 -0
  33. package/lib/locale/lang/pt-BR.d.ts +8 -0
  34. package/lib/locale/lang/pt-BR.js +330 -0
  35. package/lib/locale/lang/pt-BR.min.js +1 -0
  36. package/lib/locale/lang/pt-BR.umd.js +344 -0
  37. package/lib/locale/lang/zh-CN.d.ts +1 -1
  38. package/lib/locale/lang/zh-CN.js +8 -0
  39. package/lib/locale/lang/zh-CN.min.js +1 -1
  40. package/lib/locale/lang/zh-CN.umd.js +8 -0
  41. package/lib/locale/lang/zh-HK.d.ts +1 -1
  42. package/lib/locale/lang/zh-HK.min.js +1 -1
  43. package/lib/locale/lang/zh-HK.umd.js +8 -0
  44. package/lib/locale/lang/zh-MO.d.ts +1 -1
  45. package/lib/locale/lang/zh-MO.min.js +1 -1
  46. package/lib/locale/lang/zh-MO.umd.js +8 -0
  47. package/lib/locale/lang/zh-TC.d.ts +1 -1
  48. package/lib/locale/lang/zh-TC.js +8 -0
  49. package/lib/locale/lang/zh-TC.min.js +1 -1
  50. package/lib/locale/lang/zh-TC.umd.js +8 -0
  51. package/lib/locale/lang/zh-TW.d.ts +1 -1
  52. package/lib/locale/lang/zh-TW.min.js +1 -1
  53. package/lib/locale/lang/zh-TW.umd.js +8 -0
  54. package/lib/menu/src/mixin.js +3 -3
  55. package/lib/menu/src/mixin.min.js +1 -1
  56. package/lib/pulldown/src/pulldown.js +11 -2
  57. package/lib/pulldown/src/pulldown.min.js +1 -1
  58. package/lib/select/src/select.js +11 -2
  59. package/lib/select/src/select.min.js +1 -1
  60. package/lib/style.css +1 -1
  61. package/lib/style.min.css +1 -1
  62. package/lib/table/src/body.js +3 -2
  63. package/lib/table/src/body.min.js +1 -1
  64. package/lib/table/src/cell.js +9 -7
  65. package/lib/table/src/cell.min.js +1 -1
  66. package/lib/table/src/columnInfo.js +7 -7
  67. package/lib/table/src/columnInfo.min.js +1 -1
  68. package/lib/table/src/methods.js +171 -124
  69. package/lib/table/src/methods.min.js +1 -1
  70. package/lib/table/src/table.js +22 -29
  71. package/lib/table/src/table.min.js +1 -1
  72. package/lib/table/src/util.js +3 -1
  73. package/lib/table/src/util.min.js +1 -1
  74. package/lib/table/style/style.css +7 -2
  75. package/lib/table/style/style.min.css +1 -1
  76. package/lib/textarea/src/textarea.js +6 -1
  77. package/lib/textarea/src/textarea.min.js +1 -1
  78. package/lib/toolbar/src/toolbar.js +23 -7
  79. package/lib/toolbar/src/toolbar.min.js +1 -1
  80. package/lib/tools/log.js +1 -1
  81. package/lib/tools/log.min.js +1 -1
  82. package/lib/tooltip/src/tooltip.js +5 -1
  83. package/lib/tooltip/src/tooltip.min.js +1 -1
  84. package/lib/tooltip/style/style.css +0 -6
  85. package/lib/tooltip/style/style.min.css +1 -1
  86. package/lib/v-x-e-table/index.js +3 -1
  87. package/lib/v-x-e-table/index.min.js +1 -1
  88. package/lib/v-x-e-table/src/commands.js +60 -2
  89. package/lib/v-x-e-table/src/commands.min.js +1 -1
  90. package/lib/v-x-e-table/src/conf.js +7 -4
  91. package/lib/v-x-e-table/src/conf.min.js +1 -1
  92. package/lib/v-x-e-table/src/formats.js +60 -2
  93. package/lib/v-x-e-table/src/formats.min.js +1 -1
  94. package/lib/v-x-e-table/src/menus.js +60 -2
  95. package/lib/v-x-e-table/src/menus.min.js +1 -1
  96. package/lib/v-x-e-table/src/renderer.js +10 -0
  97. package/lib/v-x-e-table/src/renderer.min.js +1 -1
  98. package/lib/v-x-e-table/src/store.js +5 -2
  99. package/lib/v-x-e-table/src/store.min.js +1 -1
  100. package/lib/v-x-e-table/src/validators.js +15 -0
  101. package/lib/v-x-e-table/src/validators.min.js +1 -0
  102. package/lib/validator/src/mixin.js +36 -4
  103. package/lib/validator/src/mixin.min.js +1 -1
  104. package/package.json +2 -2
  105. package/packages/button/src/button.js +5 -4
  106. package/packages/edit/src/mixin.js +10 -9
  107. package/packages/export/src/mixin.js +22 -13
  108. package/packages/filter/src/mixin.js +5 -1
  109. package/packages/form/src/form.js +27 -6
  110. package/packages/grid/src/grid.js +7 -3
  111. package/packages/input/src/input.js +9 -1
  112. package/packages/locale/lang/en-US.js +8 -0
  113. package/packages/locale/lang/es-ES.js +8 -0
  114. package/packages/locale/lang/ja-JP.d.ts +1 -1
  115. package/packages/locale/lang/ja-JP.js +8 -0
  116. package/packages/locale/lang/pt-BR.d.ts +8 -0
  117. package/packages/locale/lang/pt-BR.js +323 -0
  118. package/packages/locale/lang/zh-CN.d.ts +1 -1
  119. package/packages/locale/lang/zh-CN.js +8 -0
  120. package/packages/locale/lang/zh-HK.d.ts +1 -1
  121. package/packages/locale/lang/zh-MO.d.ts +1 -1
  122. package/packages/locale/lang/zh-TC.d.ts +1 -1
  123. package/packages/locale/lang/zh-TC.js +8 -0
  124. package/packages/locale/lang/zh-TW.d.ts +1 -1
  125. package/packages/menu/src/mixin.js +3 -3
  126. package/packages/pulldown/src/pulldown.js +6 -3
  127. package/packages/select/src/select.js +7 -3
  128. package/packages/table/src/body.js +3 -2
  129. package/packages/table/src/cell.js +9 -5
  130. package/packages/table/src/columnInfo.js +7 -7
  131. package/packages/table/src/methods.js +142 -93
  132. package/packages/table/src/table.js +17 -7
  133. package/packages/table/src/util.js +3 -1
  134. package/packages/textarea/src/textarea.js +4 -1
  135. package/packages/toolbar/src/toolbar.js +22 -7
  136. package/packages/tooltip/src/tooltip.js +3 -2
  137. package/packages/v-x-e-table/index.js +2 -0
  138. package/packages/v-x-e-table/src/commands.js +50 -2
  139. package/packages/v-x-e-table/src/conf.js +7 -4
  140. package/packages/v-x-e-table/src/formats.js +50 -2
  141. package/packages/v-x-e-table/src/menus.js +50 -2
  142. package/packages/v-x-e-table/src/renderer.js +11 -1
  143. package/packages/v-x-e-table/src/store.js +4 -2
  144. package/packages/v-x-e-table/src/validators.js +7 -0
  145. package/packages/validator/src/mixin.js +35 -4
  146. package/styles/all.scss +30 -0
  147. package/styles/css-variable.scss +272 -0
  148. package/styles/cssvar.scss +2 -275
  149. package/styles/index.scss +2 -0
  150. package/styles/modules.scss +4 -1
  151. package/styles/table.scss +11 -4
  152. package/styles/tooltip.scss +0 -8
  153. package/styles/variable.scss +1 -4
  154. package/types/all.d.ts +2 -2
  155. package/types/colgroup.d.ts +3 -1
  156. package/types/column.d.ts +3 -0
  157. package/types/edit.d.ts +4 -2
  158. package/types/export.d.ts +3 -0
  159. package/types/filter.d.ts +3 -1
  160. package/types/footer.d.ts +3 -1
  161. package/types/form-item.d.ts +2 -0
  162. package/types/form.d.ts +16 -12
  163. package/types/grid.d.ts +3 -0
  164. package/types/header.d.ts +3 -1
  165. package/types/index.d.ts +1 -1
  166. package/types/input.d.ts +2 -0
  167. package/types/list.d.ts +1 -1
  168. package/types/menu.d.ts +2 -0
  169. package/types/modal.d.ts +7 -3
  170. package/types/pulldown.d.ts +2 -3
  171. package/types/table.d.ts +54 -30
  172. package/types/textarea.d.ts +1 -0
  173. package/types/toolbar.d.ts +2 -0
  174. package/types/tooltip.d.ts +1 -1
  175. package/types/v-x-e-table/commands.d.ts +23 -13
  176. package/types/v-x-e-table/formats.d.ts +21 -12
  177. package/types/v-x-e-table/index.d.ts +33 -26
  178. package/types/v-x-e-table/interceptor.d.ts +1 -1
  179. package/types/v-x-e-table/menus.d.ts +17 -6
  180. package/types/v-x-e-table/renderer.d.ts +5 -3
  181. package/types/v-x-e-table/setup.d.ts +10 -33
  182. package/types/v-x-e-table/validators.d.ts +30 -0
  183. package/types/validator.d.ts +15 -4
  184. /package/lib/icon/style/{iconfont.1688948811910.ttf → iconfont.1690849077922.ttf} +0 -0
  185. /package/lib/icon/style/{iconfont.1688948811910.woff → iconfont.1690849077922.woff} +0 -0
  186. /package/lib/icon/style/{iconfont.1688948811910.woff2 → iconfont.1690849077922.woff2} +0 -0
  187. /package/lib/{iconfont.1688948811910.ttf → iconfont.1690849077922.ttf} +0 -0
  188. /package/lib/{iconfont.1688948811910.woff → iconfont.1690849077922.woff} +0 -0
  189. /package/lib/{iconfont.1688948811910.woff2 → iconfont.1690849077922.woff2} +0 -0
@@ -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
  // 单选框属性,选中列
@@ -773,7 +775,7 @@ export default {
773
775
  if (this.editConfig && editOpts.showStatus && !this.keepSource) {
774
776
  warnLog('vxe.error.reqProp', ['keep-source'])
775
777
  }
776
- if (treeConfig && treeOpts.line && (!(this.rowKey || rowOpts.useKey) || !showOverflow)) {
778
+ if (treeConfig && (treeOpts.showLine || treeOpts.line) && (!(this.rowKey || rowOpts.useKey) || !showOverflow)) {
777
779
  warnLog('vxe.error.reqProp', ['row-config.useKey | show-overflow'])
778
780
  }
779
781
  if (this.showFooter && !this.footerMethod) {
@@ -830,6 +832,12 @@ export default {
830
832
  return
831
833
  }
832
834
  }
835
+ if (this.treeConfig && treeOpts.children) {
836
+ warnLog('vxe.error.delProp', ['tree-config.children', 'tree-config.childrenField'])
837
+ }
838
+ if (this.treeConfig && treeOpts.line) {
839
+ warnLog('vxe.error.delProp', ['tree-config.line', 'tree-config.showLine'])
840
+ }
833
841
  if (this.mouseOpts.area && this.mouseOpts.selected) {
834
842
  warnLog('vxe.error.errConflicts', ['mouse-config.area', 'mouse-config.selected'])
835
843
  }
@@ -874,9 +882,9 @@ export default {
874
882
  if (this.emptyRender && !XEUtils.isObject(this.emptyRender)) {
875
883
  warnLog('vxe.error.errProp', [`table.empty-render=${this.emptyRender}`, 'table.empty-render={}'])
876
884
  }
877
- // if (this.editConfig && this.editConfig.activeMethod) {
878
- // warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
879
- // }
885
+ if (this.editConfig && this.editOpts.activeMethod) {
886
+ warnLog('vxe.error.delProp', ['table.edit-config.activeMethod', 'table.edit-config.beforeEditMethod'])
887
+ }
880
888
  }
881
889
 
882
890
  // 检查是否有安装需要的模块
@@ -1015,11 +1023,13 @@ export default {
1015
1023
  hasTip,
1016
1024
  columnOpts,
1017
1025
  rowOpts,
1018
- loadingOpts
1026
+ loadingOpts,
1027
+ editRules
1019
1028
  } = this
1020
1029
  const { leftList, rightList } = columnStore
1021
1030
  return h('div', {
1022
1031
  class: ['vxe-table', 'vxe-table--render-default', `tid_${tId}`, vSize ? `size--${vSize}` : '', `border--${tableBorder}`, {
1032
+ [`vaild-msg--${validOpts.msgMode}`]: !!editRules,
1023
1033
  'vxe-editable': !!editConfig,
1024
1034
  'cell--highlight': highlightCell,
1025
1035
  'cell--selected': mouseConfig && mouseOpts.selected,
@@ -1029,7 +1039,7 @@ export default {
1029
1039
  'is--header': showHeader,
1030
1040
  'is--footer': showFooter,
1031
1041
  'is--group': isGroup,
1032
- 'is--tree-line': treeConfig && treeOpts.line,
1042
+ 'is--tree-line': treeConfig && (treeOpts.showLine || treeOpts.line),
1033
1043
  'is--fixed-left': leftList.length,
1034
1044
  'is--fixed-right': rightList.length,
1035
1045
  'is--animat': !!this.animat,
@@ -157,7 +157,9 @@ function countTreeExpand (prevRow, params) {
157
157
  return count
158
158
  }
159
159
  const { $table } = params
160
- const rowChildren = prevRow[$table.treeOpts.children]
160
+ const { treeOpts } = $table
161
+ const childrenField = treeOpts.children || treeOpts.childrenField
162
+ const rowChildren = prevRow[childrenField]
161
163
  if ($table.isTreeExpandByRow(prevRow)) {
162
164
  for (let index = 0; index < rowChildren.length; index++) {
163
165
  count += countTreeExpand(rowChildren[index], params)
@@ -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 },
@@ -352,7 +352,7 @@ export default {
352
352
  }
353
353
  },
354
354
  created () {
355
- const { refresh, refreshOpts } = this
355
+ const { refresh, refreshOpts, customOpts } = this
356
356
  this.$nextTick(() => {
357
357
  const $xetable = this.fintTable()
358
358
  const queryMethod = refreshOpts.queryMethod || refreshOpts.query
@@ -363,6 +363,9 @@ export default {
363
363
  $xetable.connect(this)
364
364
  }
365
365
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
366
+ if (customOpts.isFooter) {
367
+ warnLog('vxe.error.notValidators', ['custom.isFooter', 'custom.showFooter'])
368
+ }
366
369
  if (this.buttons) {
367
370
  this.buttons.forEach(item => {
368
371
  const { buttonRender } = item
@@ -649,10 +652,16 @@ export default {
649
652
  if ($xegrid) {
650
653
  $xegrid.triggerToolbarBtnEvent(item, evnt)
651
654
  } else {
652
- const commandMethod = VXETable.commands.get(code)
655
+ const gCommandOpts = VXETable.commands.get(code)
653
656
  const params = { code, button: item, $table: $xetable, $grid: $xegrid, $event: evnt }
654
- if (commandMethod) {
655
- commandMethod.call(this, params, evnt)
657
+ if (gCommandOpts) {
658
+ if (gCommandOpts.commandMethod) {
659
+ gCommandOpts.commandMethod(params)
660
+ } else {
661
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
662
+ errLog('vxe.error.notCommands', [code])
663
+ }
664
+ }
656
665
  }
657
666
  this.$emit('button-click', params)
658
667
  }
@@ -665,10 +674,16 @@ export default {
665
674
  if ($xegrid) {
666
675
  $xegrid.triggerToolbarTolEvent(item, evnt)
667
676
  } else {
668
- const commandMethod = VXETable.commands.get(code)
677
+ const gCommandOpts = VXETable.commands.get(code)
669
678
  const params = { code, tool: item, $xegrid, $table: $xetable, $event: evnt }
670
- if (commandMethod) {
671
- commandMethod.call(this, params, evnt)
679
+ if (gCommandOpts) {
680
+ if (gCommandOpts.commandMethod) {
681
+ gCommandOpts.commandMethod(params)
682
+ } else {
683
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
684
+ errLog('vxe.error.notCommands', [code])
685
+ }
686
+ }
672
687
  }
673
688
  this.$emit('tool-click', params)
674
689
  }
@@ -75,6 +75,7 @@ export default {
75
75
  content: { type: [String, Number], default: null },
76
76
  useHTML: Boolean,
77
77
  zIndex: [String, Number],
78
+ popupClassName: [String, Function],
78
79
  isArrow: { type: Boolean, default: true },
79
80
  enterable: Boolean,
80
81
  enterDelay: { type: Number, default: () => GlobalConfig.tooltip.enterDelay },
@@ -159,7 +160,7 @@ export default {
159
160
  }
160
161
  },
161
162
  render (h) {
162
- const { $scopedSlots, vSize, theme, tipActive, isArrow, visible, tipStore, enterable } = this
163
+ const { $scopedSlots, vSize, popupClassName, theme, tipActive, isArrow, visible, tipStore, enterable } = this
163
164
  let on
164
165
  if (enterable) {
165
166
  on = {
@@ -168,7 +169,7 @@ export default {
168
169
  }
169
170
  }
170
171
  return h('div', {
171
- class: ['vxe-table--tooltip-wrapper', `theme--${theme}`, {
172
+ class: ['vxe-table--tooltip-wrapper', `theme--${theme}`, popupClassName ? (XEUtils.isFunction(popupClassName) ? popupClassName({ $tooltip: this }) : popupClassName) : '', {
172
173
  [`size--${vSize}`]: vSize,
173
174
  [`placement--${tipStore.placement}`]: tipStore.placement,
174
175
  'is--enterable': enterable,
@@ -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,54 @@
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 (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
24
+ if (XEUtils.isFunction(render)) {
25
+ warnLog('vxe.error.delProp', ['callback', 'commandMethod'])
26
+ render = {
27
+ commandMethod: render
28
+ }
29
+ }
30
+ }
31
+
32
+ // 检测是否覆盖
33
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
34
+ const confKeys = XEUtils.keys(conf)
35
+ XEUtils.each(render, (item, key) => {
36
+ if (confKeys.includes(key)) {
37
+ warnLog('vxe.error.coverProp', [name, key])
38
+ }
39
+ })
40
+ }
41
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
42
+ return VXECommandsStore
43
+ }
44
+
45
+ delete (name) {
46
+ delete this.store[name]
47
+ return VXECommandsStore
48
+ }
49
+ }
50
+
51
+ export const commands = new VXECommandsStore()
4
52
 
5
53
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
6
54
  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
@@ -73,9 +76,9 @@ export default {
73
76
  treeConfig: {
74
77
  rowField: 'id',
75
78
  parentField: 'parentId',
76
- children: 'children',
77
- hasChild: 'hasChild',
78
- mapChildren: '_X_ROW_CHILD',
79
+ childrenField: 'children',
80
+ hasChildField: 'hasChild',
81
+ mapChildrenField: '_X_ROW_CHILD',
79
82
  indent: 20,
80
83
  showIcon: true
81
84
  },
@@ -1,6 +1,54 @@
1
- import VXEStore from './store'
1
+ import XEUtils from 'xe-utils'
2
+ import { warnLog } from '../../tools/log'
2
3
 
3
- export const formats = new VXEStore()
4
+ class VXEFormatsStore {
5
+ constructor () {
6
+ this.store = {}
7
+ }
8
+
9
+ mixin (options) {
10
+ XEUtils.each(options, (item, key) => {
11
+ this.add(key, item)
12
+ })
13
+ return VXEFormatsStore
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 (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
24
+ if (XEUtils.isFunction(render)) {
25
+ warnLog('vxe.error.delProp', ['callback', 'cellFormatMethod'])
26
+ render = {
27
+ cellFormatMethod: render
28
+ }
29
+ }
30
+ }
31
+
32
+ // 检测是否覆盖
33
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
34
+ const confKeys = XEUtils.keys(conf)
35
+ XEUtils.each(render, (item, key) => {
36
+ if (confKeys.includes(key)) {
37
+ warnLog('vxe.error.coverProp', [name, key])
38
+ }
39
+ })
40
+ }
41
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
42
+ return VXEFormatsStore
43
+ }
44
+
45
+ delete (name) {
46
+ delete this.store[name]
47
+ return VXEFormatsStore
48
+ }
49
+ }
50
+
51
+ export const formats = new VXEFormatsStore()
4
52
 
5
53
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
6
54
  Object.assign(formats, { _name: 'Formats' })
@@ -1,6 +1,54 @@
1
- import VXEStore from './store'
1
+ import XEUtils from 'xe-utils'
2
+ import { warnLog } from '../../tools/log'
2
3
 
3
- export const menus = new VXEStore()
4
+ class VXEMenusStore {
5
+ constructor () {
6
+ this.store = {}
7
+ }
8
+
9
+ mixin (options) {
10
+ XEUtils.each(options, (item, key) => {
11
+ this.add(key, item)
12
+ })
13
+ return VXEMenusStore
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 (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
24
+ if (XEUtils.isFunction(render)) {
25
+ warnLog('vxe.error.delProp', ['callback', 'menuMethod'])
26
+ render = {
27
+ menuMethod: render
28
+ }
29
+ }
30
+ }
31
+
32
+ // 检测是否覆盖
33
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
34
+ const confKeys = XEUtils.keys(conf)
35
+ XEUtils.each(render, (item, key) => {
36
+ if (confKeys.includes(key)) {
37
+ warnLog('vxe.error.coverProp', [name, key])
38
+ }
39
+ })
40
+ }
41
+ this.store[name] = conf ? XEUtils.merge(conf, render) : render
42
+ return VXEMenusStore
43
+ }
44
+
45
+ delete (name) {
46
+ delete this.store[name]
47
+ return VXEMenusStore
48
+ }
49
+ }
50
+
51
+ export const menus = new VXEMenusStore()
4
52
 
5
53
  if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
6
54
  Object.assign(menus, { _name: 'Menus' })
@@ -1,7 +1,7 @@
1
1
  import XEUtils from 'xe-utils'
2
2
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
3
  import UtilTools, { getFuncText } from '../../tools/utils'
4
- import { warnLog } from '../../tools/log'
4
+ import { errLog, warnLog } from '../../tools/log'
5
5
 
6
6
  const defaultCompProps = { transfer: true }
7
7
 
@@ -103,6 +103,11 @@ function getNativeOns (renderOpts, params) {
103
103
  const nativeOns = {}
104
104
  XEUtils.objectEach(nativeEvents, (func, key) => {
105
105
  nativeOns[key] = function (...args) {
106
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
107
+ if (!XEUtils.isFunction(key)) {
108
+ errLog('vxe.error.errFunc', [key])
109
+ }
110
+ }
106
111
  func(params, ...args)
107
112
  }
108
113
  })
@@ -117,6 +122,11 @@ function getOns (renderOpts, params, inputFunc, changeFunc) {
117
122
  const ons = {}
118
123
  XEUtils.objectEach(events, (func, key) => {
119
124
  ons[key] = function (...args) {
125
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
126
+ if (!XEUtils.isFunction(key)) {
127
+ errLog('vxe.error.errFunc', [key])
128
+ }
129
+ }
120
130
  func(params, ...args)
121
131
  }
122
132
  })
@@ -9,8 +9,10 @@ class Store {
9
9
  this.store = {}
10
10
  }
11
11
 
12
- mixin (map) {
13
- Object.assign(this.store, map)
12
+ mixin (options) {
13
+ XEUtils.each(options, (item, key) => {
14
+ this.add(key, item)
15
+ })
14
16
  return Store
15
17
  }
16
18
 
@@ -0,0 +1,7 @@
1
+ import VXEStore from './store'
2
+
3
+ export const validators = new VXEStore()
4
+
5
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
6
+ Object.assign(validators, { _name: 'Validators' })
7
+ }
@@ -1,6 +1,8 @@
1
1
  import XEUtils from 'xe-utils'
2
+ import VXETable from '../../v-x-e-table'
2
3
  import GlobalConfig from '../../v-x-e-table/src/conf'
3
4
  import { eqEmptyValue, getFuncText } from '../../tools/utils'
5
+ import { warnLog, errLog } from '../../tools/log'
4
6
  import DomTools from '../../tools/dom'
5
7
 
6
8
  /**
@@ -63,12 +65,22 @@ export default {
63
65
  * 完整校验,和 validate 的区别就是会给有效数据中的每一行进行校验
64
66
  */
65
67
  _fullValidate (rows, cb) {
68
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
69
+ if (XEUtils.isFunction(cb)) {
70
+ warnLog('vxe.error.notValidators', ['fullValidate(rows, callback)', 'fullValidate(rows)'])
71
+ }
72
+ }
66
73
  return this.beginValidate(rows, cb, true)
67
74
  },
68
75
  /**
69
76
  * 快速校验,如果存在记录不通过的记录,则返回不再继续校验(异步校验除外)
70
77
  */
71
78
  _validate (rows, cb) {
79
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
80
+ if (XEUtils.isFunction(cb)) {
81
+ warnLog('vxe.error.notValidators', ['validate(rows, callback)', 'validate(rows)'])
82
+ }
83
+ }
72
84
  return this.beginValidate(rows, cb)
73
85
  },
74
86
  /**
@@ -248,10 +260,10 @@ export default {
248
260
  if (rules) {
249
261
  const cellValue = XEUtils.isUndefined(val) ? XEUtils.get(row, property) : val
250
262
  rules.forEach(rule => {
251
- const { type, trigger, required } = rule
263
+ const { type, trigger, required, validator } = rule
252
264
  if (validType === 'all' || !trigger || validType === trigger) {
253
- if (XEUtils.isFunction(rule.validator)) {
254
- const customValid = rule.validator({
265
+ if (validator) {
266
+ const validParams = {
255
267
  cellValue,
256
268
  rule,
257
269
  rules,
@@ -261,7 +273,26 @@ export default {
261
273
  columnIndex: this.getColumnIndex(column),
262
274
  field: column.property,
263
275
  $table: this
264
- })
276
+ }
277
+ let customValid
278
+ if (XEUtils.isString(validator)) {
279
+ const gvItem = VXETable.validators.get(validator)
280
+ if (gvItem) {
281
+ if (gvItem.cellValidatorMethod) {
282
+ customValid = gvItem.cellValidatorMethod(validParams)
283
+ } else {
284
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
285
+ warnLog('vxe.error.notValidators', [validator])
286
+ }
287
+ }
288
+ } else {
289
+ if (process.env.VUE_APP_VXE_TABLE_ENV === 'development') {
290
+ errLog('vxe.error.notValidators', [validator])
291
+ }
292
+ }
293
+ } else {
294
+ customValid = validator(validParams)
295
+ }
265
296
  if (customValid) {
266
297
  if (XEUtils.isError(customValid)) {
267
298
  this.validRuleErr = true
@@ -0,0 +1,30 @@
1
+ @import './variable.scss';
2
+ // @import './css-variable.scss';
3
+ @import './icon.scss';
4
+ @import './filter.scss';
5
+ @import './menu.scss';
6
+ @import './export.scss';
7
+
8
+ @import './table.scss';
9
+ @import './grid.scss';
10
+ @import './toolbar.scss';
11
+ @import './pager.scss';
12
+ @import './checkbox.scss';
13
+ @import './checkbox-group.scss';
14
+ @import './radio.scss';
15
+ @import './radio-group.scss';
16
+ @import './radio-button.scss';
17
+ @import './input.scss';
18
+ @import './textarea.scss';
19
+ @import './button.scss';
20
+ @import './modal.scss';
21
+ @import './tooltip.scss';
22
+ @import './form.scss';
23
+ @import './form-item.scss';
24
+ @import './form-gather.scss';
25
+ @import './select.scss';
26
+ @import './optgroup.scss';
27
+ @import './option.scss';
28
+ @import './switch.scss';
29
+ @import './list.scss';
30
+ @import './pulldown.scss';