vxe-table 3.5.9-beta.6 → 3.5.9-beta.9

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 (38) hide show
  1. package/lib/edit/src/mixin.js +1 -1
  2. package/lib/edit/src/mixin.min.js +1 -1
  3. package/lib/export/src/mixin.js +1 -1
  4. package/lib/export/src/mixin.min.js +1 -1
  5. package/lib/filter/src/panel.js +6 -2
  6. package/lib/filter/src/panel.min.js +1 -1
  7. package/lib/form/src/form-config-item.js +2 -1
  8. package/lib/form/src/form-config-item.min.js +1 -1
  9. package/lib/form/src/form-item.js +2 -1
  10. package/lib/form/src/form-item.min.js +1 -1
  11. package/lib/grid/src/grid.js +2 -1
  12. package/lib/grid/src/grid.min.js +1 -1
  13. package/lib/index.umd.js +51 -37
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/input/src/input.js +20 -15
  16. package/lib/input/src/input.min.js +1 -1
  17. package/lib/table/src/body.js +5 -2
  18. package/lib/table/src/body.min.js +1 -1
  19. package/lib/table/src/methods.js +9 -9
  20. package/lib/table/src/methods.min.js +1 -1
  21. package/lib/tools/log.js +1 -1
  22. package/lib/tools/log.min.js +1 -1
  23. package/lib/v-x-e-table/index.js +1 -1
  24. package/lib/v-x-e-table/index.min.js +1 -1
  25. package/lib/v-x-e-table/src/conf.js +2 -2
  26. package/lib/v-x-e-table/src/conf.min.js +1 -1
  27. package/package.json +1 -1
  28. package/packages/edit/src/mixin.js +2 -2
  29. package/packages/export/src/mixin.js +2 -2
  30. package/packages/filter/src/panel.js +13 -6
  31. package/packages/form/src/form-config-item.js +17 -9
  32. package/packages/form/src/form-item.js +15 -7
  33. package/packages/grid/src/grid.js +1 -2
  34. package/packages/input/src/input.js +17 -13
  35. package/packages/table/src/body.js +38 -23
  36. package/packages/table/src/methods.js +7 -7
  37. package/packages/v-x-e-table/src/conf.js +2 -2
  38. package/types/v-x-e-table/renderer.d.ts +13 -1
@@ -30,6 +30,7 @@ const VxeFormConfigItem = {
30
30
  const { rules, data, collapseAll, validOpts, titleAlign: allTitleAlign, titleWidth: allTitleWidth, titleColon: allTitleColon, titleAsterisk: allTitleAsterisk, titleOverflow: allTitleOverflow } = $xeform
31
31
  const { slots, title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow, children } = item
32
32
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
33
+ const itemClassName = compConf ? compConf.itemClassName : ''
33
34
  const span = item.span || $xeform.span
34
35
  const align = item.align || $xeform.align
35
36
  const titleAlign = XEUtils.eqNull(item.titleAlign) ? allTitleAlign : item.titleAlign
@@ -88,15 +89,22 @@ const VxeFormConfigItem = {
88
89
  mouseleave: $xeform.handleTitleTipLeaveEvent
89
90
  } : {}
90
91
  return h('div', {
91
- class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
92
- 'is--title': title,
93
- 'is--colon': titleColon,
94
- 'is--asterisk': titleAsterisk,
95
- 'is--required': isRequired,
96
- 'is--hidden': folding && collapseAll,
97
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
98
- 'is--error': showError
99
- }],
92
+ class: [
93
+ 'vxe-form--item',
94
+ item.id,
95
+ span ? `vxe-col--${span} is--span` : null,
96
+ className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
97
+ itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : className) : '',
98
+ {
99
+ 'is--title': title,
100
+ 'is--colon': titleColon,
101
+ 'is--asterisk': titleAsterisk,
102
+ 'is--required': isRequired,
103
+ 'is--hidden': folding && collapseAll,
104
+ 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
105
+ 'is--error': showError
106
+ }
107
+ ],
100
108
  props: {
101
109
  itemConfig: item
102
110
  },
@@ -44,6 +44,7 @@ const renderItem = (h, _vm, item, slots) => {
44
44
  const { rules, data, collapseAll, validOpts, titleOverflow: allTitleOverflow } = _vm
45
45
  const { title, folding, visible, visibleMethod, field, collapseNode, itemRender, showError, errRule, className, titleOverflow } = item
46
46
  const compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null
47
+ const itemClassName = compConf ? compConf.itemClassName : ''
47
48
  const span = item.span || _vm.span
48
49
  const align = item.align || _vm.align
49
50
  const titleAlign = item.titleAlign || _vm.titleAlign
@@ -82,13 +83,20 @@ const renderItem = (h, _vm, item, slots) => {
82
83
  mouseleave: _vm.handleTitleTipLeaveEvent
83
84
  } : {}
84
85
  return h('div', {
85
- class: ['vxe-form--item', item.id, span ? `vxe-col--${span} is--span` : null, className ? (XEUtils.isFunction(className) ? className(params) : className) : '', {
86
- 'is--title': title,
87
- 'is--required': isRequired,
88
- 'is--hidden': visible === false || (folding && collapseAll),
89
- 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
90
- 'is--error': showError
91
- }]
86
+ class: [
87
+ 'vxe-form--item',
88
+ item.id,
89
+ span ? `vxe-col--${span} is--span` : '',
90
+ className ? (XEUtils.isFunction(className) ? className(params) : className) : '',
91
+ itemClassName ? (XEUtils.isFunction(itemClassName) ? itemClassName(params) : className) : '',
92
+ {
93
+ 'is--title': title,
94
+ 'is--required': isRequired,
95
+ 'is--hidden': visible === false || (folding && collapseAll),
96
+ 'is--active': !itemVisibleMethod || itemVisibleMethod(params),
97
+ 'is--error': showError
98
+ }
99
+ ]
92
100
  }, [
93
101
  h('div', {
94
102
  class: 'vxe-form--item-inner'
@@ -266,7 +266,7 @@ export default {
266
266
  warnLog('vxe.error.errProp', [`grid.toolbar-config=${this.toolbarConfig}`, 'grid.toolbar-config={}'])
267
267
  }
268
268
  }
269
-
269
+ this.initPages()
270
270
  GlobalEvent.on(this, 'keydown', this.handleGlobalKeydownEvent)
271
271
  },
272
272
  mounted () {
@@ -274,7 +274,6 @@ export default {
274
274
  this.loadColumn(this.columns)
275
275
  }
276
276
  this.initToolbar()
277
- this.initPages()
278
277
  this.initProxy()
279
278
  },
280
279
  destroyed () {
@@ -647,8 +647,10 @@ export default {
647
647
 
648
648
  // date、week、month、year
649
649
  dateConfig: Object,
650
- minDate: { type: [String, Number, Date], default: () => GlobalConfig.input.minDate },
651
- maxDate: { type: [String, Number, Date], default: () => GlobalConfig.input.maxDate },
650
+ startDate: { type: [String, Number, Date], default: () => GlobalConfig.input.startDate },
651
+ endDate: { type: [String, Number, Date], default: () => GlobalConfig.input.endDate },
652
+ minDate: [String, Number, Date],
653
+ maxDate: [String, Number, Date],
652
654
  // 已废弃 startWeek,被 startDay 替换
653
655
  startWeek: Number,
654
656
  startDay: { type: [String, Number], default: () => GlobalConfig.input.startDay },
@@ -725,24 +727,24 @@ export default {
725
727
  return this.clearable && (this.isPawdType || this.isNumType || this.isDatePickerType || this.type === 'text' || this.type === 'search')
726
728
  },
727
729
  isDisabledPrevDateBtn () {
728
- const { selectMonth, dateMinTime } = this
730
+ const { selectMonth, dateStartTime } = this
729
731
  if (selectMonth) {
730
- return selectMonth <= dateMinTime
732
+ return selectMonth <= dateStartTime
731
733
  }
732
734
  return false
733
735
  },
734
736
  isDisabledNextDateBtn () {
735
- const { selectMonth, dateMaxTime } = this
737
+ const { selectMonth, dateEndTime } = this
736
738
  if (selectMonth) {
737
- return selectMonth >= dateMaxTime
739
+ return selectMonth >= dateEndTime
738
740
  }
739
741
  return false
740
742
  },
741
- dateMinTime () {
742
- return this.minDate ? XEUtils.toStringDate(this.minDate) : null
743
+ dateStartTime () {
744
+ return this.startDate ? XEUtils.toStringDate(this.startDate) : null
743
745
  },
744
- dateMaxTime () {
745
- return this.maxDate ? XEUtils.toStringDate(this.maxDate) : null
746
+ dateEndTime () {
747
+ return this.endDate ? XEUtils.toStringDate(this.endDate) : null
746
748
  },
747
749
  supportMultiples () {
748
750
  return ['date', 'week', 'month', 'quarter', 'year'].includes(this.type)
@@ -948,9 +950,9 @@ export default {
948
950
  const selMonth = selectMonth.getMonth()
949
951
  const selDay = selectMonth.getDay()
950
952
  const prevOffsetDate = -weekDatas.indexOf(selDay)
951
- const startDate = new Date(XEUtils.getWhatDay(selectMonth, prevOffsetDate).getTime() + hmsTime)
953
+ const startDayDate = new Date(XEUtils.getWhatDay(selectMonth, prevOffsetDate).getTime() + hmsTime)
952
954
  for (let index = 0; index < 42; index++) {
953
- const date = XEUtils.getWhatDay(startDate, index)
955
+ const date = XEUtils.getWhatDay(startDayDate, index)
954
956
  const itemFullYear = date.getFullYear()
955
957
  const itemMonth = date.getMonth()
956
958
  const itemDate = date.getDate()
@@ -1652,7 +1654,9 @@ export default {
1652
1654
  this.dateTimeChangeEvent(evnt)
1653
1655
  },
1654
1656
  dateConfirmEvent () {
1655
- this.dateChange(this.dateValue || this.currentDate)
1657
+ if (this.isDateTimeType || this.multiple) {
1658
+ this.dateChange(this.dateValue || this.currentDate)
1659
+ }
1656
1660
  this.hidePanel()
1657
1661
  },
1658
1662
  dateMinuteEvent (evnt, item) {
@@ -66,7 +66,7 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
66
66
  isAllOverflow,
67
67
  align: allAlign,
68
68
  currentColumn,
69
- cellClassName,
69
+ cellClassName: allCellClassName,
70
70
  cellStyle,
71
71
  mergeList,
72
72
  spanMethod,
@@ -90,6 +90,9 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
90
90
  const { actived } = editStore
91
91
  const { rHeight: scrollYRHeight } = sYOpts
92
92
  const { height: rowHeight } = rowOpts
93
+ const renderOpts = editRender || cellRender
94
+ const compConf = renderOpts ? VXETable.renderer.get(renderOpts.name) : null
95
+ const cellClassName = compConf ? compConf.cellClassName : ''
93
96
  const showAllTip = tooltipOpts.showAll || tooltipOpts.enabled
94
97
  const columnIndex = $xetable.getColumnIndex(column)
95
98
  const _columnIndex = $xetable.getVTColumnIndex(column)
@@ -255,19 +258,26 @@ function renderColumn (h, _vm, $xetable, seq, rowid, fixedType, rowLevel, row, r
255
258
  }
256
259
  }
257
260
  return h('td', {
258
- class: ['vxe-body--column', column.id, {
259
- [`col--${cellAlign}`]: cellAlign,
260
- [`col--${type}`]: type,
261
- 'col--last': $columnIndex === columns.length - 1,
262
- 'col--tree-node': treeNode,
263
- 'col--edit': isEdit,
264
- 'col--ellipsis': hasEllipsis,
265
- 'fixed--hidden': fixedHiddenColumn,
266
- 'col--dirty': isDirty,
267
- 'col--actived': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
268
- 'col--valid-error': hasValidError,
269
- 'col--current': currentColumn === column
270
- }, UtilTools.getClass(className, params), UtilTools.getClass(cellClassName, params)],
261
+ class: [
262
+ 'vxe-body--column',
263
+ column.id,
264
+ {
265
+ [`col--${cellAlign}`]: cellAlign,
266
+ [`col--${type}`]: type,
267
+ 'col--last': $columnIndex === columns.length - 1,
268
+ 'col--tree-node': treeNode,
269
+ 'col--edit': isEdit,
270
+ 'col--ellipsis': hasEllipsis,
271
+ 'fixed--hidden': fixedHiddenColumn,
272
+ 'col--dirty': isDirty,
273
+ 'col--actived': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
274
+ 'col--valid-error': hasValidError,
275
+ 'col--current': currentColumn === column
276
+ },
277
+ UtilTools.getClass(cellClassName, params),
278
+ UtilTools.getClass(className, params),
279
+ UtilTools.getClass(allCellClassName, params)
280
+ ],
271
281
  key: columnKey || columnOpts.useKey ? column.id : $columnIndex,
272
282
  attrs,
273
283
  style: Object.assign({
@@ -343,15 +353,20 @@ function renderRows (h, _vm, $xetable, fixedType, tableData, tableColumn) {
343
353
  }
344
354
  rows.push(
345
355
  h('tr', {
346
- class: ['vxe-body--row', treeConfig ? `row--level-${rowLevel}` : '', {
347
- 'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
348
- 'is--new': isNewRow,
349
- 'is--expand-row': isExpandRow,
350
- 'is--expand-tree': isExpandTree,
351
- 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
352
- 'row--radio': radioOpts.highlight && $xetable.selectRow === row,
353
- 'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
354
- }, rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''],
356
+ class: [
357
+ 'vxe-body--row',
358
+ treeConfig ? `row--level-${rowLevel}` : '',
359
+ {
360
+ 'row--stripe': stripe && ($xetable.getVTRowIndex(row) + 1) % 2 === 0,
361
+ 'is--new': isNewRow,
362
+ 'is--expand-row': isExpandRow,
363
+ 'is--expand-tree': isExpandTree,
364
+ 'row--new': isNewRow && (editOpts.showStatus || editOpts.showInsertStatus),
365
+ 'row--radio': radioOpts.highlight && $xetable.selectRow === row,
366
+ 'row--checked': checkboxOpts.highlight && $xetable.isCheckedByCheckboxRow(row)
367
+ },
368
+ rowClassName ? (XEUtils.isFunction(rowClassName) ? rowClassName(params) : rowClassName) : ''
369
+ ],
355
370
  attrs: {
356
371
  rowid: rowid
357
372
  },
@@ -138,12 +138,12 @@ function calculateMergerOffserIndex (list, offsetItem, type) {
138
138
  function setMerges (_vm, merges, mList, rowList) {
139
139
  if (merges) {
140
140
  const { treeConfig, visibleColumn } = _vm
141
- if (treeConfig) {
142
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-footer-items']))
143
- }
144
141
  if (!XEUtils.isArray(merges)) {
145
142
  merges = [merges]
146
143
  }
144
+ if (treeConfig && merges.length) {
145
+ errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
146
+ }
147
147
  merges.forEach(item => {
148
148
  let { row, col, rowspan, colspan } = item
149
149
  if (rowList && XEUtils.isNumber(row)) {
@@ -187,12 +187,12 @@ function removeMerges (_vm, merges, mList, rowList) {
187
187
  const rest = []
188
188
  if (merges) {
189
189
  const { treeConfig, visibleColumn } = _vm
190
- if (treeConfig) {
191
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['merge-cells']))
192
- }
193
190
  if (!XEUtils.isArray(merges)) {
194
191
  merges = [merges]
195
192
  }
193
+ if (treeConfig && merges.length) {
194
+ errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
195
+ }
196
196
  merges.forEach(item => {
197
197
  let { row, col } = item
198
198
  if (rowList && XEUtils.isNumber(row)) {
@@ -963,7 +963,7 @@ const Methods = {
963
963
  if (!this.isInsertByRow(row)) {
964
964
  const rowIndex = this.getRowIndex(row)
965
965
  if (treeConfig && rowIndex === -1) {
966
- throw new Error(UtilTools.getLog('vxe.error.noTree', ['revertData']))
966
+ errLog('vxe.error.noTree', ['revertData'])
967
967
  }
968
968
  const oRow = tableSourceData[rowIndex]
969
969
  if (oRow && row) {
@@ -264,8 +264,8 @@ export default {
264
264
  // parseFormat: 'yyyy-MM-dd HH:mm:ss.SSS',
265
265
  // labelFormat: '',
266
266
  // valueFormat: '',
267
- minDate: new Date(1900, 0, 1),
268
- maxDate: new Date(2100, 0, 1),
267
+ startDate: new Date(1900, 0, 1),
268
+ endDate: new Date(2100, 0, 1),
269
269
  startDay: 1,
270
270
  selectDay: 1,
271
271
  digits: 2,
@@ -21,9 +21,19 @@ export interface VxeGlobalRenderer {
21
21
  }
22
22
 
23
23
  export interface RendererMapOptions {
24
- // 筛选渲染
24
+ /**
25
+ * 请使用 filterClassName
26
+ * @deprecated
27
+ */
25
28
  className?: string;
29
+ /**
30
+ * 请使用 showFilterFooter
31
+ * @deprecated
32
+ */
26
33
  isFooter?: boolean;
34
+ // 筛选渲染
35
+ filterClassName?: string | ((params: ColumnFilterRenderParams) => string | { [key: string]: boolean })
36
+ showFilterFooter?: boolean;
27
37
  renderFilter?(h: CreateElement, renderOpts: ColumnFilterRenderOptions, params: ColumnFilterRenderParams): VNode[] | string[];
28
38
  filterMethod?(params: ColumnFilterMethodParams): boolean;
29
39
  filterResetMethod?(params: ColumnFilterResetParams): void;
@@ -31,6 +41,7 @@ export interface RendererMapOptions {
31
41
  defaultFilterMethod?(params: ColumnFilterMethodParams): boolean;
32
42
 
33
43
  // 单元格渲染
44
+ cellClassName?: string | ((params: ColumnCellRenderParams | ColumnEditRenderParams) => string | { [key: string]: boolean })
34
45
  renderHeader?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): VNode[] | string[];
35
46
  renderDefault?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnCellRenderParams | ColumnEditRenderParams): VNode[] | string[];
36
47
  renderFooter?(h: CreateElement, renderOpts: ColumnCellRenderOptions | ColumnEditRenderOptions, params: ColumnFooterRenderParams): VNode[] | string[];
@@ -50,6 +61,7 @@ export interface RendererMapOptions {
50
61
  renderToolbarTool?(h: CreateElement, renderOpts: ToolbarToolRenderOptions, params: ToolbarToolRenderParams): VNode[] | string[];
51
62
 
52
63
  // 表单-项渲染
64
+ itemClassName?: string | ((params: FormItemRenderParams) => string | { [key: string]: boolean })
53
65
  renderItemTitle?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): VNode[] | string[];
54
66
  renderItemContent?(h: CreateElement, renderOpts: FormItemRenderOptions, params: FormItemRenderParams): VNode[] | string[];
55
67
  itemVisibleMethod?(params: FormItemVisibleParams): boolean;