vxe-table 4.7.80 → 4.7.82

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 (53) hide show
  1. package/es/grid/src/grid.js +32 -25
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/table/render/index.js +11 -13
  5. package/es/table/src/body.js +1 -0
  6. package/es/table/src/props.js +5 -0
  7. package/es/table/src/table.js +16 -4
  8. package/es/table/style.css +35 -21
  9. package/es/table/style.min.css +1 -1
  10. package/es/toolbar/src/toolbar.js +14 -0
  11. package/es/ui/index.js +3 -2
  12. package/es/ui/src/log.js +1 -1
  13. package/es/vxe-table/style.css +35 -21
  14. package/es/vxe-table/style.min.css +1 -1
  15. package/lib/grid/src/grid.js +33 -26
  16. package/lib/grid/src/grid.min.js +1 -1
  17. package/lib/index.umd.js +86 -45
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/style.css +1 -1
  20. package/lib/style.min.css +1 -1
  21. package/lib/table/render/index.js +14 -12
  22. package/lib/table/render/index.min.js +1 -1
  23. package/lib/table/src/body.js +1 -0
  24. package/lib/table/src/body.min.js +1 -1
  25. package/lib/table/src/props.js +5 -0
  26. package/lib/table/src/props.min.js +1 -1
  27. package/lib/table/src/table.js +15 -4
  28. package/lib/table/src/table.min.js +1 -1
  29. package/lib/table/style/style.css +35 -21
  30. package/lib/table/style/style.min.css +1 -1
  31. package/lib/toolbar/src/toolbar.js +14 -0
  32. package/lib/toolbar/src/toolbar.min.js +1 -1
  33. package/lib/ui/index.js +3 -2
  34. package/lib/ui/index.min.js +1 -1
  35. package/lib/ui/src/log.js +1 -1
  36. package/lib/ui/src/log.min.js +1 -1
  37. package/lib/vxe-table/style/style.css +35 -21
  38. package/lib/vxe-table/style/style.min.css +1 -1
  39. package/package.json +3 -3
  40. package/packages/grid/src/grid.ts +32 -26
  41. package/packages/table/render/index.ts +11 -13
  42. package/packages/table/src/body.ts +1 -0
  43. package/packages/table/src/props.ts +5 -0
  44. package/packages/table/src/table.ts +15 -4
  45. package/packages/toolbar/src/toolbar.ts +14 -0
  46. package/packages/ui/index.ts +1 -0
  47. package/styles/components/table.scss +76 -15
  48. /package/es/{iconfont.1726735367913.ttf → iconfont.1727228895510.ttf} +0 -0
  49. /package/es/{iconfont.1726735367913.woff → iconfont.1727228895510.woff} +0 -0
  50. /package/es/{iconfont.1726735367913.woff2 → iconfont.1727228895510.woff2} +0 -0
  51. /package/lib/{iconfont.1726735367913.ttf → iconfont.1727228895510.ttf} +0 -0
  52. /package/lib/{iconfont.1726735367913.woff → iconfont.1727228895510.woff} +0 -0
  53. /package/lib/{iconfont.1726735367913.woff2 → iconfont.1727228895510.woff2} +0 -0
@@ -832,9 +832,12 @@ export default defineComponent({
832
832
  }
833
833
  }
834
834
  if (isInited) {
835
- const { computeSortOpts } = $xeTable.getComputeMaps()
836
- const sortOpts = computeSortOpts.value
837
- let defaultSort = sortOpts.defaultSort
835
+ let defaultSort = null
836
+ if ($xeTable) {
837
+ const { computeSortOpts } = $xeTable.getComputeMaps()
838
+ const sortOpts = computeSortOpts.value
839
+ defaultSort = sortOpts.defaultSort
840
+ }
838
841
  // 如果使用默认排序
839
842
  if (defaultSort) {
840
843
  if (!XEUtils.isArray(defaultSort)) {
@@ -848,14 +851,18 @@ export default defineComponent({
848
851
  }
849
852
  })
850
853
  }
851
- filterList = $xeTable.getCheckedFilters()
852
- } else {
853
- if (isReload) {
854
- $xeTable.clearAll()
855
- } else {
856
- sortList = $xeTable.getSortColumns()
854
+ if ($xeTable) {
857
855
  filterList = $xeTable.getCheckedFilters()
858
856
  }
857
+ } else {
858
+ if ($xeTable) {
859
+ if (isReload) {
860
+ $xeTable.clearAll()
861
+ } else {
862
+ sortList = $xeTable.getSortColumns()
863
+ filterList = $xeTable.getCheckedFilters()
864
+ }
865
+ }
859
866
  }
860
867
  const commitParams = {
861
868
  code,
@@ -1250,6 +1257,21 @@ export default defineComponent({
1250
1257
  initPages()
1251
1258
 
1252
1259
  onMounted(() => {
1260
+ if (process.env.VUE_APP_VXE_ENV === 'development') {
1261
+ nextTick(() => {
1262
+ if (props.formConfig) {
1263
+ if (!VxeUIFormComponent) {
1264
+ errLog('vxe.error.reqComp', ['vxe-form'])
1265
+ }
1266
+ }
1267
+ if (props.pagerConfig) {
1268
+ if (!VxeUIPagerComponent) {
1269
+ errLog('vxe.error.reqComp', ['vxe-pager'])
1270
+ }
1271
+ }
1272
+ })
1273
+ }
1274
+
1253
1275
  nextTick(() => {
1254
1276
  const { columns } = props
1255
1277
  // const { data, columns, proxyConfig } = props
@@ -1269,6 +1291,7 @@ export default defineComponent({
1269
1291
  $xeGrid.loadColumn(columns)
1270
1292
  }
1271
1293
  initToolbar()
1294
+ initProxy()
1272
1295
  })
1273
1296
  globalEvents.on($xeGrid, 'keydown', handleGlobalKeydownEvent)
1274
1297
  })
@@ -1277,23 +1300,6 @@ export default defineComponent({
1277
1300
  globalEvents.off($xeGrid, 'keydown')
1278
1301
  })
1279
1302
 
1280
- nextTick(() => {
1281
- if (process.env.VUE_APP_VXE_ENV === 'development') {
1282
- if (props.formConfig) {
1283
- if (!VxeUIFormComponent) {
1284
- errLog('vxe.error.reqComp', ['vxe-form'])
1285
- }
1286
- }
1287
- if (props.pagerConfig) {
1288
- if (!VxeUIPagerComponent) {
1289
- errLog('vxe.error.reqComp', ['vxe-pager'])
1290
- }
1291
- }
1292
- }
1293
-
1294
- initProxy()
1295
- })
1296
-
1297
1303
  const renderVN = () => {
1298
1304
  const vSize = computeSize.value
1299
1305
  const styles = computeStyles.value
@@ -25,7 +25,7 @@ function getFormatDate (value: any, props: any, defaultFormat: string) {
25
25
  }
26
26
 
27
27
  function getLabelFormatDate (value: any, props: any) {
28
- return getFormatDate(value, props, getI18n(`vxe.input.date.labelFormat.${props.type}`))
28
+ return getFormatDate(value, props, getI18n(`vxe.input.date.labelFormat.${props.type || 'date'}`))
29
29
  }
30
30
 
31
31
  /**
@@ -89,10 +89,10 @@ function isImmediateCell (renderOpts: VxeColumnPropTypes.EditRender, params: any
89
89
  }
90
90
 
91
91
  function getCellLabelVNs (renderOpts: any, params: any, cellLabel: any) {
92
- const { placeholder } = renderOpts
92
+ const { name, placeholder } = renderOpts
93
93
  return [
94
94
  h('span', {
95
- class: 'vxe-cell--label'
95
+ class: ['vxe-cell--label', ['VxeTextarea', 'textarea'].includes(name) ? 'is--textarea' : '']
96
96
  }, placeholder && isEmptyValue(cellLabel)
97
97
  ? [
98
98
  h('span', {
@@ -629,15 +629,7 @@ renderer.mixin({
629
629
  const { row, column } = params
630
630
  let cellValue = XEUtils.get(row, column.field)
631
631
  if (cellValue) {
632
- switch (props.type) {
633
- case 'date':
634
- case 'week':
635
- case 'month':
636
- case 'quarter':
637
- case 'year':
638
- cellValue = getLabelFormatDate(cellValue, props)
639
- break
640
- }
632
+ cellValue = getLabelFormatDate(cellValue, props)
641
633
  }
642
634
  return getCellLabelVNs(renderOpts, params, cellValue)
643
635
  },
@@ -646,7 +638,13 @@ renderer.mixin({
646
638
  tableFilterDefaultMethod: handleFilterMethod
647
639
  },
648
640
  VxeTextarea: {
649
- tableAutoFocus: 'VxeTextarea'
641
+ tableAutoFocus: 'textarea',
642
+ renderTableEdit: defaultEditRender,
643
+ renderTableCell (renderOpts, params) {
644
+ const { row, column } = params
645
+ const cellValue = XEUtils.get(row, column.field)
646
+ return getCellLabelVNs(renderOpts, params, cellValue)
647
+ }
650
648
  },
651
649
  VxeButton: {
652
650
  renderTableDefault: buttonCellRender
@@ -334,6 +334,7 @@ export default defineComponent({
334
334
  'col--tree-node': treeNode,
335
335
  'col--edit': isEdit,
336
336
  'col--ellipsis': hasEllipsis,
337
+ 'col--height': !!rowOpts.height,
337
338
  'fixed--hidden': fixedHiddenColumn,
338
339
  'col--dirty': isDirty,
339
340
  'col--active': editConfig && isEdit && (actived.row === row && (actived.column === column || editOpts.mode === 'row')),
@@ -34,6 +34,11 @@ export default {
34
34
  type: [Boolean, String] as PropType<VxeTablePropTypes.Border>,
35
35
  default: () => getConfig().table.border
36
36
  },
37
+ // 单元格是否有边距
38
+ padding: {
39
+ type: Boolean as PropType<VxeTablePropTypes.Padding>,
40
+ default: () => getConfig().table.padding
41
+ },
37
42
  // 是否圆角边框
38
43
  round: {
39
44
  type: Boolean as PropType<VxeTablePropTypes.Round>,
@@ -1132,10 +1132,20 @@ export default defineComponent({
1132
1132
  paddingSize = Math.floor(XEUtils.toNumber(cellStyle.paddingLeft) + XEUtils.toNumber(cellStyle.paddingRight)) + 2
1133
1133
  }
1134
1134
  let colWidth = column.renderAutoWidth - paddingSize
1135
- XEUtils.arrayEach(cellElList, (cellEl) => {
1136
- const labelEl = cellEl.firstChild as HTMLElement
1137
- if (labelEl) {
1138
- colWidth = Math.max(colWidth, Math.ceil(labelEl.offsetWidth) + 4)
1135
+ XEUtils.arrayEach(cellElList, (itemEl) => {
1136
+ const cellEl = itemEl as HTMLElement
1137
+ const thElem = cellEl.parentNode as HTMLElement
1138
+ let titleWidth = 0
1139
+ if (`${thElem.tagName}`.toLowerCase() === 'th') {
1140
+ XEUtils.arrayEach(cellEl.children, (btnEl) => {
1141
+ titleWidth += (btnEl as HTMLElement).offsetWidth + 1
1142
+ })
1143
+ } else {
1144
+ const labelEl = cellEl.firstChild as HTMLElement
1145
+ titleWidth = labelEl.offsetWidth
1146
+ }
1147
+ if (titleWidth) {
1148
+ colWidth = Math.max(colWidth, Math.ceil(titleWidth) + 4)
1139
1149
  }
1140
1150
  })
1141
1151
  column.renderAutoWidth = colWidth + paddingSize
@@ -7035,6 +7045,7 @@ export default defineComponent({
7035
7045
  'is--fixed-left': leftList.length,
7036
7046
  'is--fixed-right': rightList.length,
7037
7047
  'is--animat': !!props.animat,
7048
+ 'is--padding': props.padding,
7038
7049
  'is--round': props.round,
7039
7050
  'is--stripe': !treeConfig && stripe,
7040
7051
  'is--loading': currLoading,
@@ -310,6 +310,11 @@ export default defineComponent({
310
310
  round: child.round,
311
311
  status: child.status,
312
312
  content: child.name,
313
+ title: child.title,
314
+ routerLink: child.routerLink,
315
+ permissionCode: child.permissionCode,
316
+ prefixTooltip: child.prefixTooltip,
317
+ suffixTooltip: child.suffixTooltip,
313
318
  onClick: ({ $event }) => isBtn ? btnEvent($event, child) : tolEvent($event, child)
314
319
  })
315
320
  : createCommentVNode()
@@ -352,7 +357,11 @@ export default defineComponent({
352
357
  round: item.round,
353
358
  status: item.status,
354
359
  content: item.name,
360
+ title: item.title,
361
+ routerLink: item.routerLink,
355
362
  permissionCode: item.permissionCode,
363
+ prefixTooltip: item.prefixTooltip,
364
+ suffixTooltip: item.suffixTooltip,
356
365
  destroyOnClose: item.destroyOnClose,
357
366
  placement: item.placement,
358
367
  transfer: item.transfer,
@@ -408,6 +417,11 @@ export default defineComponent({
408
417
  round: item.round,
409
418
  status: item.status,
410
419
  content: item.name,
420
+ title: item.title,
421
+ routerLink: item.routerLink,
422
+ permissionCode: item.permissionCode,
423
+ prefixTooltip: item.prefixTooltip,
424
+ suffixTooltip: item.suffixTooltip,
411
425
  destroyOnClose: item.destroyOnClose,
412
426
  placement: item.placement,
413
427
  transfer: item.transfer,
@@ -17,6 +17,7 @@ VxeUI.setConfig({
17
17
  animat: true,
18
18
  delayHover: 250,
19
19
  autoResize: true,
20
+ padding: true,
20
21
  minHeight: 144,
21
22
  // keepSource: false,
22
23
  // showOverflow: null,
@@ -130,6 +130,22 @@
130
130
  }
131
131
  }
132
132
  }
133
+ .vxe-body--column {
134
+ &.col--height {
135
+ & > .vxe-cell {
136
+ height: 100%;
137
+ & > .vxe-textarea,
138
+ & > .vxe-default-textarea {
139
+ height: 100%;
140
+ }
141
+ }
142
+ }
143
+ .vxe-cell--label {
144
+ &.is--textarea {
145
+ white-space: pre-line;
146
+ }
147
+ }
148
+ }
133
149
 
134
150
  .vxe-table--checkbox-range,
135
151
  .vxe-table--cell-main-area,
@@ -456,12 +472,12 @@
456
472
  // vertical-align: middle;
457
473
  // }
458
474
  .vxe-cell--required-icon {
459
- margin-right: 0.1em;
475
+ padding-right: 0.1em;
460
476
  }
461
477
  .vxe-cell--edit-icon,
462
478
  .vxe-cell-title-prefix-icon,
463
479
  .vxe-cell-title-suffix-icon {
464
- margin-right: 0.2em;
480
+ padding: 0.2em;
465
481
  }
466
482
  .vxe-cell-title-prefix-icon,
467
483
  .vxe-cell-title-suffix-icon {
@@ -678,15 +694,25 @@
678
694
  }
679
695
  }
680
696
  }
697
+ &.is--padding {
698
+ .vxe-body--column {
699
+ &:not(.col--ellipsis) {
700
+ padding: var(--vxe-ui-table-column-padding-default);
701
+ }
702
+ }
703
+ }
704
+ .vxe-header--column,
705
+ .vxe-footer--column {
706
+ &:not(.col--ellipsis) {
707
+ padding: var(--vxe-ui-table-column-padding-default);
708
+ }
709
+ }
681
710
  .vxe-header--column,
682
711
  .vxe-body--column,
683
712
  .vxe-footer--column {
684
713
  position: relative;
685
714
  line-height: var(--vxe-ui-table-row-line-height);
686
715
  text-align: left;
687
- &:not(.col--ellipsis) {
688
- padding: var(--vxe-ui-table-column-padding-default);
689
- }
690
716
  &.col--current {
691
717
  background-color: var(--vxe-ui-table-column-current-background-color);
692
718
  // .vxe-tree--btn-wrapper {
@@ -731,6 +757,27 @@
731
757
  .vxe-table--footer-wrapper {
732
758
  border-top: var(--vxe-ui-table-border-width) solid var(--vxe-ui-table-border-color);
733
759
  }
760
+ // &.border--default,
761
+ // &.border--full,
762
+ // &.border--inner,
763
+ // &.border--outer {
764
+ // .vxe-body--row {
765
+ // &:last-child {
766
+ // & > .vxe-body--column {
767
+ // & > .vxe-cell {
768
+ // border-bottom: 1px solid transparent;
769
+ // }
770
+ // }
771
+ // }
772
+ // }
773
+ // .vxe-body--column {
774
+ // &:first-child {
775
+ // & > .vxe-cell {
776
+ // border-left: 1px solid transparent;
777
+ // }
778
+ // }
779
+ // }
780
+ // }
734
781
  &.border--default,
735
782
  &.border--full,
736
783
  &.border--outer {
@@ -883,11 +930,16 @@
883
930
  }
884
931
  }
885
932
  }
933
+
934
+ &.is--padding {
935
+ .vxe-cell {
936
+ padding-left: var(--vxe-ui-table-cell-padding-left);
937
+ padding-right: var(--vxe-ui-table-cell-padding-right);
938
+ }
939
+ }
886
940
  .vxe-cell {
887
941
  white-space: pre-line;
888
942
  word-break: break-all;
889
- padding-left: var(--vxe-ui-table-cell-padding-left);
890
- padding-right: var(--vxe-ui-table-cell-padding-right);
891
943
  }
892
944
 
893
945
  // 单元格占位符
@@ -1146,6 +1198,7 @@
1146
1198
  }
1147
1199
  }
1148
1200
 
1201
+
1149
1202
  /*溢出列*/
1150
1203
  .vxe-header--column,
1151
1204
  .vxe-body--column,
@@ -1159,8 +1212,10 @@
1159
1212
  white-space: nowrap;
1160
1213
  }
1161
1214
  }
1162
- & > .vxe-cell {
1163
- max-height: var(--vxe-ui-table-row-height-default);
1215
+ &:not(.col--height) {
1216
+ & > .vxe-cell {
1217
+ max-height: var(--vxe-ui-table-row-height-default);
1218
+ }
1164
1219
  }
1165
1220
  }
1166
1221
  }
@@ -1170,8 +1225,10 @@
1170
1225
  .vxe-footer--column {
1171
1226
  &.col--ellipsis {
1172
1227
  @extend %MediumColumnHeight;
1173
- & > .vxe-cell {
1174
- max-height: var(--vxe-ui-table-row-height-medium);
1228
+ &:not(.col--height) {
1229
+ & > .vxe-cell {
1230
+ max-height: var(--vxe-ui-table-row-height-medium);
1231
+ }
1175
1232
  }
1176
1233
  }
1177
1234
  }
@@ -1188,8 +1245,10 @@
1188
1245
  .vxe-footer--column {
1189
1246
  &.col--ellipsis {
1190
1247
  @extend %SmallColumnHeight;
1191
- & > .vxe-cell {
1192
- max-height: var(--vxe-ui-table-row-height-small);
1248
+ &:not(.col--height) {
1249
+ & > .vxe-cell {
1250
+ max-height: var(--vxe-ui-table-row-height-small);
1251
+ }
1193
1252
  }
1194
1253
  }
1195
1254
  }
@@ -1206,8 +1265,10 @@
1206
1265
  .vxe-footer--column {
1207
1266
  &.col--ellipsis {
1208
1267
  @extend %MiniColumnHeight;
1209
- & > .vxe-cell {
1210
- max-height: var(--vxe-ui-table-row-height-mini);
1268
+ &:not(.col--height) {
1269
+ & > .vxe-cell {
1270
+ max-height: var(--vxe-ui-table-row-height-mini);
1271
+ }
1211
1272
  }
1212
1273
  }
1213
1274
  }