vxe-table 4.11.4 → 4.11.6

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 (56) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.min.css +1 -1
  3. package/es/locale/lang/zh-CHT.js +1 -1
  4. package/es/locale/lang/zh-CN.js +1 -1
  5. package/es/style.css +1 -1
  6. package/es/style.min.css +1 -1
  7. package/es/table/render/index.js +29 -6
  8. package/es/table/src/header.js +2 -4
  9. package/es/table/src/table.js +30 -32
  10. package/es/table/style.css +19 -0
  11. package/es/table/style.min.css +1 -1
  12. package/es/ui/index.js +1 -1
  13. package/es/ui/src/log.js +1 -1
  14. package/es/vxe-table/style.css +19 -0
  15. package/es/vxe-table/style.min.css +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.min.css +1 -1
  18. package/lib/index.umd.js +61 -46
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/locale/lang/zh-CHT.js +1 -1
  21. package/lib/locale/lang/zh-CHT.min.js +1 -1
  22. package/lib/locale/lang/zh-CN.js +1 -1
  23. package/lib/locale/lang/zh-CN.min.js +1 -1
  24. package/lib/locale/lang/zh-CN.umd.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/table/render/index.js +27 -6
  28. package/lib/table/render/index.min.js +1 -1
  29. package/lib/table/src/header.js +1 -4
  30. package/lib/table/src/header.min.js +1 -1
  31. package/lib/table/src/table.js +28 -31
  32. package/lib/table/src/table.min.js +1 -1
  33. package/lib/table/style/style.css +19 -0
  34. package/lib/table/style/style.min.css +1 -1
  35. package/lib/ui/index.js +1 -1
  36. package/lib/ui/index.min.js +1 -1
  37. package/lib/ui/src/log.js +1 -1
  38. package/lib/ui/src/log.min.js +1 -1
  39. package/lib/vxe-table/style/style.css +19 -0
  40. package/lib/vxe-table/style/style.min.css +1 -1
  41. package/package.json +2 -2
  42. package/packages/locale/lang/zh-CHT.ts +1 -1
  43. package/packages/locale/lang/zh-CN.ts +1 -1
  44. package/packages/table/render/index.ts +30 -6
  45. package/packages/table/src/header.ts +2 -4
  46. package/packages/table/src/table.ts +29 -32
  47. package/styles/components/table.scss +29 -0
  48. package/styles/index.scss +1 -1
  49. package/styles/theme/base.scss +2 -1
  50. package/styles/variable.scss +1 -0
  51. /package/es/{iconfont.1739938274682.ttf → iconfont.1740038200666.ttf} +0 -0
  52. /package/es/{iconfont.1739938274682.woff → iconfont.1740038200666.woff} +0 -0
  53. /package/es/{iconfont.1739938274682.woff2 → iconfont.1740038200666.woff2} +0 -0
  54. /package/lib/{iconfont.1739938274682.ttf → iconfont.1740038200666.ttf} +0 -0
  55. /package/lib/{iconfont.1739938274682.woff → iconfont.1740038200666.woff} +0 -0
  56. /package/lib/{iconfont.1739938274682.woff2 → iconfont.1740038200666.woff2} +0 -0
@@ -92,11 +92,13 @@ function isImmediateCell (renderOpts: VxeColumnPropTypes.EditRender, params: any
92
92
  return params.$type === 'cell' || getInputImmediateModel(renderOpts)
93
93
  }
94
94
 
95
- function getCellLabelVNs (renderOpts: any, params: any, cellLabel: any) {
95
+ function getCellLabelVNs (renderOpts: any, params: any, cellLabel: any, opts?: {
96
+ class?: string
97
+ }) {
96
98
  const { placeholder } = renderOpts
97
99
  return [
98
100
  h('span', {
99
- class: 'vxe-cell--label'
101
+ class: ['vxe-cell--label', opts ? opts.class : '']
100
102
  }, placeholder && isEmptyValue(cellLabel)
101
103
  ? [
102
104
  h('span', {
@@ -678,11 +680,12 @@ renderer.mixin({
678
680
  tableAutoFocus: 'input',
679
681
  renderTableEdit: defaultEditRender,
680
682
  renderTableCell (renderOpts, params) {
681
- const { props = {} } = renderOpts
683
+ const { props = {}, showNegativeStatus } = renderOpts
682
684
  const { row, column } = params
683
685
  const { type } = props
684
686
  let cellValue = XEUtils.get(row, column.field)
685
- if (cellValue) {
687
+ let isNegative = false
688
+ if (!isEmptyValue(cellValue)) {
686
689
  const numberInputConfig = getConfig().numberInput || {}
687
690
  if (type === 'float') {
688
691
  const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
@@ -691,11 +694,22 @@ renderer.mixin({
691
694
  if (!autoFill) {
692
695
  cellValue = XEUtils.toNumber(cellValue)
693
696
  }
697
+ if (showNegativeStatus) {
698
+ if (cellValue < 0) {
699
+ isNegative = true
700
+ }
701
+ }
694
702
  } else if (type === 'amount') {
695
703
  const autoFill = handleDefaultValue(props.autoFill, numberInputConfig.autoFill, true)
696
704
  const digits = handleDefaultValue(props.digits, numberInputConfig.digits, 2)
697
705
  const showCurrency = handleDefaultValue(props.showCurrency, numberInputConfig.showCurrency, false)
698
- cellValue = XEUtils.commafy(XEUtils.toNumber(cellValue), { digits })
706
+ cellValue = XEUtils.toNumber(cellValue)
707
+ if (showNegativeStatus) {
708
+ if (cellValue < 0) {
709
+ isNegative = true
710
+ }
711
+ }
712
+ cellValue = XEUtils.commafy(cellValue, { digits })
699
713
  if (!autoFill) {
700
714
  const [iStr, dStr] = cellValue.split('.')
701
715
  if (dStr) {
@@ -706,9 +720,19 @@ renderer.mixin({
706
720
  if (showCurrency) {
707
721
  cellValue = `${props.currencySymbol || numberInputConfig.currencySymbol || getI18n('vxe.numberInput.currencySymbol') || ''}${cellValue}`
708
722
  }
723
+ } else {
724
+ if (showNegativeStatus) {
725
+ if (XEUtils.toNumber(cellValue) < 0) {
726
+ isNegative = true
727
+ }
728
+ }
709
729
  }
710
730
  }
711
- return getCellLabelVNs(renderOpts, params, cellValue)
731
+ return getCellLabelVNs(renderOpts, params, cellValue, isNegative
732
+ ? {
733
+ class: 'is--negative'
734
+ }
735
+ : {})
712
736
  },
713
737
  renderTableFooter (renderOpts, params) {
714
738
  const { props = {} } = renderOpts
@@ -44,7 +44,7 @@ export default defineComponent({
44
44
 
45
45
  const renderRows = (isGroup: boolean, isOptimizeMode: boolean, cols: VxeTableDefines.ColumnInfo[], $rowIndex: number) => {
46
46
  const { fixedType } = props
47
- const { resizable: allResizable, border, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
47
+ const { resizable: allResizable, columnKey, headerCellClassName, headerCellStyle, showHeaderOverflow: allColumnHeaderOverflow, headerAlign: allHeaderAlign, align: allAlign, mouseConfig } = tableProps
48
48
  const { currentColumn, scrollXLoad, scrollYLoad, overflowX } = tableReactData
49
49
  const { scrollXStore } = tableInternalData
50
50
  const columnOpts = computeColumnOpts.value
@@ -174,9 +174,7 @@ export default defineComponent({
174
174
  */
175
175
  !fixedHiddenColumn && showResizable
176
176
  ? h('div', {
177
- class: ['vxe-cell--col-resizable', {
178
- 'is--line': !border || border === 'none'
179
- }],
177
+ class: 'vxe-cell--col-resizable',
180
178
  onMousedown: (evnt: MouseEvent) => $xeTable.handleColResizeMousedownEvent(evnt, fixedType, cellParams),
181
179
  onDblclick: (evnt: MouseEvent) => $xeTable.handleColResizeDblclickEvent(evnt, cellParams)
182
180
  })
@@ -2789,15 +2789,11 @@ export default defineComponent({
2789
2789
  internalData.tableFullData = fullData
2790
2790
  internalData.tableFullTreeData = treeData
2791
2791
  // 缓存数据
2792
- $xeTable.cacheRowMap(true, isReset)
2792
+ $xeTable.cacheRowMap(true)
2793
2793
  // 原始数据
2794
2794
  internalData.tableSynchData = datas
2795
2795
  if (isReset) {
2796
2796
  internalData.isResizeCellHeight = false
2797
- reactData.rowExpandedMaps = {}
2798
- reactData.rowExpandLazyLoadedMaps = {}
2799
- reactData.treeExpandedMaps = {}
2800
- reactData.treeExpandLazyLoadedMaps = {}
2801
2797
  }
2802
2798
  // 克隆原数据,用于显示编辑状态,与编辑值做对比
2803
2799
  if (keepSource) {
@@ -4124,7 +4120,7 @@ export default defineComponent({
4124
4120
  */
4125
4121
  getTreeRowChildren (rowOrRowid) {
4126
4122
  const { treeConfig } = props
4127
- const { fullDataRowIdData } = internalData
4123
+ const { fullAllDataRowIdData } = internalData
4128
4124
  const treeOpts = computeTreeOpts.value
4129
4125
  const { transform, mapChildrenField } = treeOpts
4130
4126
  const childrenField = treeOpts.children || treeOpts.childrenField
@@ -4136,7 +4132,7 @@ export default defineComponent({
4136
4132
  rowid = getRowid($xeTable, rowOrRowid)
4137
4133
  }
4138
4134
  if (rowid) {
4139
- const rest = fullDataRowIdData[rowid]
4135
+ const rest = fullAllDataRowIdData[rowid]
4140
4136
  const row = rest ? rest.row : null
4141
4137
  if (row) {
4142
4138
  return row[transform ? mapChildrenField : childrenField] || []
@@ -4150,7 +4146,7 @@ export default defineComponent({
4150
4146
  */
4151
4147
  getTreeParentRow (rowOrRowid) {
4152
4148
  const { treeConfig } = props
4153
- const { fullDataRowIdData } = internalData
4149
+ const { fullAllDataRowIdData } = internalData
4154
4150
  if (rowOrRowid && treeConfig) {
4155
4151
  let rowid
4156
4152
  if (XEUtils.isString(rowOrRowid)) {
@@ -4159,7 +4155,7 @@ export default defineComponent({
4159
4155
  rowid = getRowid($xeTable, rowOrRowid)
4160
4156
  }
4161
4157
  if (rowid) {
4162
- const rest = fullDataRowIdData[rowid]
4158
+ const rest = fullAllDataRowIdData[rowid]
4163
4159
  return rest ? rest.parent : null
4164
4160
  }
4165
4161
  }
@@ -4174,9 +4170,9 @@ export default defineComponent({
4174
4170
  * @param {String/Number} rowid 行主键
4175
4171
  */
4176
4172
  getRowById (cellValue) {
4177
- const { fullDataRowIdData } = internalData
4173
+ const { fullAllDataRowIdData } = internalData
4178
4174
  const rowid = XEUtils.eqNull(cellValue) ? '' : encodeURIComponent(cellValue || '')
4179
- return fullDataRowIdData[rowid] ? fullDataRowIdData[rowid].row : null
4175
+ return fullAllDataRowIdData[rowid] ? fullAllDataRowIdData[rowid].row : null
4180
4176
  },
4181
4177
  /**
4182
4178
  * 根据行获取行的唯一主键
@@ -5353,11 +5349,12 @@ export default defineComponent({
5353
5349
  return rowRest && !!rowRest.treeLoaded
5354
5350
  },
5355
5351
  clearTreeExpandLoaded (rows: any) {
5356
- const tExpandedMaps = { ...reactData.treeExpandedMaps }
5357
5352
  const { fullAllDataRowIdData } = internalData
5358
5353
  const treeOpts = computeTreeOpts.value
5359
5354
  const { transform } = treeOpts
5355
+ let tExpandedMaps: Record<string, any> = {}
5360
5356
  if (rows) {
5357
+ tExpandedMaps = { ...reactData.treeExpandedMaps }
5361
5358
  if (!XEUtils.isArray(rows)) {
5362
5359
  rows = [rows]
5363
5360
  }
@@ -5371,11 +5368,15 @@ export default defineComponent({
5371
5368
  }
5372
5369
  }
5373
5370
  })
5371
+ } else {
5372
+ XEUtils.each(fullAllDataRowIdData, (rowRest) => {
5373
+ rowRest.treeLoaded = false
5374
+ })
5374
5375
  }
5375
- reactData.treeExpandedMaps = tExpandedMaps
5376
+ reactData.treeExpandedMaps = {}
5376
5377
  if (transform) {
5377
5378
  handleVirtualTreeToList()
5378
- return tablePrivateMethods.handleTableData()
5379
+ return $xeTable.handleTableData()
5379
5380
  }
5380
5381
  return nextTick()
5381
5382
  },
@@ -6754,7 +6755,7 @@ export default defineComponent({
6754
6755
  /**
6755
6756
  * 更新数据行的 Map
6756
6757
  */
6757
- cacheRowMap (isReset, isSource) {
6758
+ cacheRowMap () {
6758
6759
  const { treeConfig } = props
6759
6760
  const treeOpts = computeTreeOpts.value
6760
6761
  const { fullAllDataRowIdData, tableFullData, tableFullTreeData } = internalData
@@ -6764,7 +6765,7 @@ export default defineComponent({
6764
6765
  const isLazy = treeConfig && treeOpts.lazy
6765
6766
  const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
6766
6767
  const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
6767
- const handleRow = (row: any, index: any, items: any, path?: any[], parentRow?: any, nodes?: any[]) => {
6768
+ const handleRow = (row: any, index: number, items: any, path?: any[], parentRow?: any, nodes?: any[]) => {
6768
6769
  let rowid = getRowid($xeTable, row)
6769
6770
  const seq = treeConfig && path ? toTreePathSeq(path) : index + 1
6770
6771
  const level = nodes ? nodes.length - 1 : 0
@@ -6775,23 +6776,19 @@ export default defineComponent({
6775
6776
  if (isLazy && row[hasChildField] && XEUtils.isUndefined(row[childrenField])) {
6776
6777
  row[childrenField] = null
6777
6778
  }
6778
- let cacheItem = fullAllDataRowIdData[rowid]
6779
- if (isReset || !cacheItem) {
6780
- cacheItem = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
6781
- }
6782
- cacheItem.row = row
6783
- cacheItem.items = items
6784
- cacheItem.parent = parentRow
6785
- cacheItem.level = level
6786
- cacheItem.index = treeConfig && parentRow ? -1 : index
6787
- if (isSource) {
6788
- fullDataRowIdMaps[rowid] = cacheItem
6779
+ let rowRest = fullAllDataRowIdData[rowid]
6780
+ if (!rowRest) {
6781
+ rowRest = { row, rowid, seq, index: -1, _index: -1, $index: -1, treeIndex: index, items, parent: parentRow, level, height: 0, resizeHeight: 0, oTop: 0, expandHeight: 0 }
6789
6782
  }
6790
- fullAllDataRowIdMaps[rowid] = cacheItem
6791
- }
6792
- if (isSource) {
6793
- internalData.fullDataRowIdData = fullDataRowIdMaps
6783
+ rowRest.row = row
6784
+ rowRest.items = items
6785
+ rowRest.parent = parentRow
6786
+ rowRest.level = level
6787
+ rowRest.index = treeConfig && parentRow ? -1 : index
6788
+ fullDataRowIdMaps[rowid] = rowRest
6789
+ fullAllDataRowIdMaps[rowid] = rowRest
6794
6790
  }
6791
+ internalData.fullDataRowIdData = fullDataRowIdMaps
6795
6792
  internalData.fullAllDataRowIdData = fullAllDataRowIdMaps
6796
6793
  if (treeConfig) {
6797
6794
  XEUtils.eachTree(tableFullTreeData, handleRow, { children: childrenField })
@@ -9935,7 +9932,7 @@ export default defineComponent({
9935
9932
  if (value && value.length >= 50000) {
9936
9933
  warnLog('vxe.error.errLargeData', ['loadData(data), reloadData(data)'])
9937
9934
  }
9938
- loadTableData(value, true).then(() => {
9935
+ loadTableData(value, false).then(() => {
9939
9936
  const { scrollXLoad, scrollYLoad, expandColumn } = reactData
9940
9937
  const expandOpts = computeExpandOpts.value
9941
9938
  internalData.inited = true
@@ -263,6 +263,13 @@
263
263
  }
264
264
  }
265
265
 
266
+ /*负数显示红色*/
267
+ .vxe-cell--label {
268
+ &.is--negative {
269
+ color: var(--vxe-ui-table-cell-negative-color);
270
+ }
271
+ }
272
+
266
273
  .vxe-table--checkbox-range,
267
274
  .vxe-table--cell-main-area,
268
275
  .vxe-table--cell-extend-area,
@@ -1119,6 +1126,28 @@
1119
1126
  }
1120
1127
  }
1121
1128
  &.border--default,
1129
+ &.border--none,
1130
+ &.border--outer,
1131
+ &.border--inner {
1132
+ .vxe-cell--col-resizable {
1133
+ &:before,
1134
+ &:after {
1135
+ content: "";
1136
+ display: inline-block;
1137
+ vertical-align: middle;
1138
+ }
1139
+ &:before {
1140
+ width: 1px;
1141
+ height: 50%;
1142
+ background-color: var(--vxe-ui-table-resizable-line-color);
1143
+ }
1144
+ &:after {
1145
+ width: 0;
1146
+ height: 100%;
1147
+ }
1148
+ }
1149
+ }
1150
+ &.border--default,
1122
1151
  &.border--full,
1123
1152
  &.border--outer {
1124
1153
  .vxe-table--header-wrapper {
package/styles/index.scss CHANGED
@@ -1,4 +1,4 @@
1
1
  // 该文件已废弃,请使用 vxe-table/style/all.scss
2
2
 
3
3
  @use './variable.scss';
4
- @use './default.scss';
4
+ @use './default.scss';
@@ -22,7 +22,7 @@
22
22
  --vxe-ui-table-header-font-color: var(--vxe-ui-font-color);
23
23
  --vxe-ui-table-footer-font-color: var(--vxe-ui-font-color);
24
24
  --vxe-ui-table-border-radius: var(--vxe-ui-border-radius);
25
- --vxe-ui-table-border-width: 1px;
25
+ --vxe-ui-table-border-width: 1.05px;
26
26
  --vxe-ui-table-resizable-line-color: #D9DDDF;
27
27
  --vxe-ui-table-resizable-drag-line-color: var(--vxe-ui-font-primary-color);
28
28
  --vxe-ui-table-footer-background-color: var(--vxe-ui-layout-background-color);
@@ -46,6 +46,7 @@
46
46
  --vxe-ui-table-cell-padding-small: 6px;
47
47
  --vxe-ui-table-cell-padding-mini: 4px;
48
48
  --vxe-ui-table-cell-placeholder-color: #C0C4CC;
49
+ --vxe-ui-table-cell-negative-color: #f56c6c;
49
50
  --vxe-ui-table-cell-input-height-default: var(--vxe-ui-table-row-height-default) - 6;
50
51
  --vxe-ui-table-cell-input-height-medium: var(--vxe-ui-table-row-height-medium) - 6;
51
52
  --vxe-ui-table-cell-input-height-small: var(--vxe-ui-table-row-height-small) - 6;
@@ -38,3 +38,4 @@ $vxe-ui-table-row-current-background-color: #e6f7ff !default;
38
38
  $vxe-ui-table-row-hover-current-background-color: #d7effb !default;
39
39
  $vxe-ui-table-fixed-scrolling-box-shadow-color: rgba(0, 0, 0, 0.12) !default;
40
40
  $vxe-ui-table-drag-over-background-color:rgba(255,255,200,0.3) !default;
41
+