vxe-table 4.7.4 → 4.7.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 (44) hide show
  1. package/es/style.css +1 -1
  2. package/es/style.min.css +1 -1
  3. package/es/table/module/custom/hook.js +18 -2
  4. package/es/table/module/custom/panel.js +263 -159
  5. package/es/table/module/export/hook.js +17 -0
  6. package/es/table/src/columnInfo.js +2 -0
  7. package/es/table/src/table.js +11 -7
  8. package/es/table/style.css +79 -13
  9. package/es/table/style.min.css +1 -1
  10. package/es/toolbar/src/toolbar.js +1 -1
  11. package/es/ui/index.js +4 -2
  12. package/es/vxe-table/style.css +79 -13
  13. package/es/vxe-table/style.min.css +1 -1
  14. package/lib/index.umd.js +236 -92
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/style.css +1 -1
  17. package/lib/style.min.css +1 -1
  18. package/lib/table/module/custom/hook.js +23 -2
  19. package/lib/table/module/custom/hook.min.js +1 -1
  20. package/lib/table/module/custom/panel.js +174 -80
  21. package/lib/table/module/custom/panel.min.js +1 -1
  22. package/lib/table/module/export/hook.js +19 -0
  23. package/lib/table/module/export/hook.min.js +1 -1
  24. package/lib/table/src/columnInfo.js +2 -0
  25. package/lib/table/src/columnInfo.min.js +1 -1
  26. package/lib/table/src/table.js +14 -7
  27. package/lib/table/src/table.min.js +1 -1
  28. package/lib/table/style/style.css +79 -13
  29. package/lib/table/style/style.min.css +1 -1
  30. package/lib/toolbar/src/toolbar.js +1 -1
  31. package/lib/toolbar/src/toolbar.min.js +1 -1
  32. package/lib/ui/index.js +4 -2
  33. package/lib/ui/index.min.js +1 -1
  34. package/lib/vxe-table/style/style.css +79 -13
  35. package/lib/vxe-table/style/style.min.css +1 -1
  36. package/package.json +2 -2
  37. package/packages/table/module/custom/hook.ts +19 -3
  38. package/packages/table/module/custom/panel.ts +272 -165
  39. package/packages/table/module/export/hook.ts +17 -0
  40. package/packages/table/src/columnInfo.ts +4 -0
  41. package/packages/table/src/table.ts +11 -7
  42. package/packages/toolbar/src/toolbar.ts +1 -1
  43. package/packages/ui/index.ts +2 -0
  44. package/styles/components/table-module/custom.scss +82 -6
@@ -1255,6 +1255,23 @@ hooks.add('tableExportModule', {
1255
1255
  }
1256
1256
  })
1257
1257
  },
1258
+ getPrintHtml (options) {
1259
+ const printOpts = computePrintOpts.value
1260
+ const opts = Object.assign({
1261
+ original: false
1262
+ // beforePrintMethod
1263
+ }, printOpts, options, {
1264
+ type: 'html',
1265
+ download: false,
1266
+ remote: false,
1267
+ print: true
1268
+ })
1269
+ return exportMethods.exportData(opts).then(({ content }) => {
1270
+ return {
1271
+ html: content
1272
+ }
1273
+ })
1274
+ },
1258
1275
  openImport (options) {
1259
1276
  const { treeConfig, importConfig } = props
1260
1277
  const { initStore, importStore, importParams } = reactData
@@ -102,6 +102,7 @@ export class ColumnInfo {
102
102
  halfVisible: false,
103
103
  defaultVisible: visible,
104
104
  defaultFixed: _vm.fixed,
105
+
105
106
  checked: false,
106
107
  halfChecked: false,
107
108
  disabled: false,
@@ -120,6 +121,9 @@ export class ColumnInfo {
120
121
  sortNumber: 0, // 用于记录自定义列顺序
121
122
  renderSortNumber: 0, // 用于记录自定义列顺序
122
123
 
124
+ renderFixed: '',
125
+ renderVisible: false,
126
+
123
127
  renderWidth: 0,
124
128
  renderHeight: 0,
125
129
  resizeWidth: 0, // 手动调整
@@ -125,7 +125,10 @@ export default defineComponent({
125
125
  activeBtn: false,
126
126
  activeWrapper: false,
127
127
  visible: false,
128
- maxHeight: 0
128
+ maxHeight: 0,
129
+ oldSortMaps: {},
130
+ oldFixedMaps: {},
131
+ oldVisibleMaps: {}
129
132
  },
130
133
  customColumnList: [],
131
134
  // 当前选中的筛选列
@@ -887,13 +890,16 @@ export default defineComponent({
887
890
  const restoreCustomStorage = () => {
888
891
  const { id, customConfig } = props
889
892
  const customOpts = computeCustomOpts.value
890
- const { storage } = customOpts
893
+ const { storage, restoreStore } = customOpts
891
894
  const isAllCustom = storage === true
892
895
  const storageOpts: VxeTableDefines.VxeTableCustomStorageObj = isAllCustom ? {} : Object.assign({}, storage || {})
893
896
  const isCustomResizable = isAllCustom || storageOpts.resizable
894
897
  const isCustomVisible = isAllCustom || storageOpts.visible
895
898
  const isCustomFixed = isAllCustom || storageOpts.fixed
896
899
  const isCustomSort = isAllCustom || storageOpts.sort
900
+ if (storage && id && restoreStore) {
901
+ restoreStore({ id })
902
+ }
897
903
  if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomSort)) {
898
904
  const customMap: {
899
905
  [key: string]: {
@@ -5350,11 +5356,9 @@ export default defineComponent({
5350
5356
  columnWidthStorage = XEUtils.isPlainObject(columnSortStorageMap[id]) ? columnSortStorageMap[id] : {}
5351
5357
  // 排序只支持一级
5352
5358
  collectColumn.forEach((column) => {
5353
- if (column.sortNumber !== column.renderSortNumber) {
5354
- const colKey = column.getKey()
5355
- if (colKey) {
5356
- columnWidthStorage[colKey] = column.renderSortNumber
5357
- }
5359
+ const colKey = column.getKey()
5360
+ if (colKey) {
5361
+ columnWidthStorage[colKey] = column.renderSortNumber
5358
5362
  }
5359
5363
  })
5360
5364
  }
@@ -129,7 +129,7 @@ export default defineComponent({
129
129
  customStore.activeBtn = false
130
130
  setTimeout(() => {
131
131
  if (!customStore.activeBtn && !customStore.activeWrapper) {
132
- $xeTable.customColseEvent($event)
132
+ $xeTable.customCloseEvent($event)
133
133
  }
134
134
  }, 350)
135
135
  }
@@ -59,6 +59,7 @@ VxeUI.setConfig({
59
59
  // },
60
60
  customConfig: {
61
61
  allowFixed: true,
62
+ allowSort: true,
62
63
  showFooter: true
63
64
  // storage: false,
64
65
  // checkMethod () {}
@@ -218,6 +219,7 @@ VxeUI.setIcon({
218
219
  TABLE_CHECKBOX_INDETERMINATE: iconPrefix + 'checkbox-indeterminate-fill',
219
220
  TABLE_RADIO_CHECKED: iconPrefix + 'radio-checked-fill',
220
221
  TABLE_RADIO_UNCHECKED: iconPrefix + 'radio-unchecked',
222
+ TABLE_CUSTOM_SORT: iconPrefix + 'drag-handle',
221
223
 
222
224
  // toolbar
223
225
  TOOLBAR_TOOLS_REFRESH: iconPrefix + 'repeat',
@@ -1,14 +1,58 @@
1
1
  @import '../../helpers/mixin.scss';
2
2
 
3
3
  .vxe-table-custom--option {
4
+ position: relative;
4
5
  display: flex;
5
6
  flex-direction: row;
7
+ &.active--drag-target {
8
+ &[drag-pos="top"] {
9
+ &::after {
10
+ display: block;
11
+ top: -2px;
12
+ }
13
+ }
14
+ &[drag-pos="bottom"] {
15
+ &::after {
16
+ display: block;
17
+ bottom: -2px;
18
+ }
19
+ }
20
+ }
21
+ &:first-child {
22
+ &[drag-pos="top"] {
23
+ &::after {
24
+ top: 0;
25
+ }
26
+ }
27
+ }
28
+ &:last-child {
29
+ &[drag-pos="bottom"] {
30
+ &::after {
31
+ bottom: 0;
32
+ }
33
+ }
34
+ }
35
+ &::after {
36
+ display: none;
37
+ content: "";
38
+ position: absolute;
39
+ left: -1px;
40
+ width: calc(100% + 1px);
41
+ height: 3px;
42
+ background-color: var(--vxe-ui-font-primary-color);
43
+ z-index: 12;
44
+ }
45
+ &:last-child {
46
+ &::after {
47
+ width: 100%;
48
+ }
49
+ }
6
50
  }
7
51
 
8
52
  .vxe-table-custom-wrapper {
9
53
  display: none;
10
54
  position: absolute;
11
- top: -4px;
55
+ top: 1px;
12
56
  right: 2px;
13
57
  text-align: left;
14
58
  background-color: var(--vxe-ui-layout-background-color);
@@ -21,6 +65,10 @@
21
65
  }
22
66
  }
23
67
 
68
+ .vxe-table-custom--list-wrapper {
69
+ display: block;
70
+ }
71
+
24
72
  .vxe-table-custom--header,
25
73
  .vxe-table-custom--body {
26
74
  list-style-type: none;
@@ -28,10 +76,9 @@
28
76
  overflow-y: auto;
29
77
  margin: 0;
30
78
  padding: 0;
31
- user-select: none;
32
79
  & > li {
33
- max-width: 18em;
34
- min-width: 14em;
80
+ max-width: 26em;
81
+ min-width: 18em;
35
82
  padding: 0.2em 1em 0.2em 1em;
36
83
  @for $i from 2 through 8 {
37
84
  $interval: $i - 1 + 0.2;
@@ -49,6 +96,7 @@
49
96
  padding: 0.28em 0;
50
97
  font-weight: 700;
51
98
  border-bottom: 1px solid var(--vxe-ui-base-popup-border-color);
99
+ user-select: none;
52
100
  }
53
101
 
54
102
  .vxe-table-custom--body {
@@ -62,12 +110,14 @@
62
110
  }
63
111
 
64
112
  .vxe-table-custom--footer {
113
+ display: flex;
114
+ flex-direction: row;
65
115
  border-top: 1px solid var(--vxe-ui-base-popup-border-color);
66
116
  text-align: right;
67
117
  button {
68
118
  background-color: transparent;
69
119
  width: 50%;
70
- height: 2.5em;
120
+ height: 2.8em;
71
121
  border: 0;
72
122
  color: var(--vxe-ui-font-color);
73
123
  text-align: center;
@@ -83,10 +133,32 @@
83
133
 
84
134
  .vxe-table-custom--checkbox-option {
85
135
  @include createCheckboxIcon();
136
+ }
137
+ .vxe-table-custom--checkbox-option,
138
+ .vxe-table-custom--sort-option {
139
+ padding-right: 0.4em;
140
+ flex-shrink: 0;
141
+ user-select: none;
142
+ }
143
+ .vxe-table-custom--sort-option {
144
+ display: flex;
145
+ flex-direction: row;
146
+ align-items: center;
147
+ justify-content: center;
148
+ }
149
+ .vxe-table-custom--sort-btn {
150
+ padding-left: 0.2em;
151
+ padding-right: 0.4em;
152
+ cursor: grabbing;
153
+ &:hover {
154
+ color: var(--vxe-ui-font-primary-color);
155
+ }
156
+ }
157
+ .vxe-table-custom--checkbox-label {
158
+ flex-grow: 1;
86
159
  overflow: hidden;
87
160
  text-overflow: ellipsis;
88
161
  white-space: nowrap;
89
- flex-grow: 1;
90
162
  }
91
163
 
92
164
  .vxe-table-custom--fixed-option {
@@ -95,6 +167,7 @@
95
167
  display: flex;
96
168
  flex-direction: row;
97
169
  align-items: center;
170
+ user-select: none;
98
171
  }
99
172
 
100
173
  .vxe-table-custom--fixed-left-option,
@@ -271,6 +344,9 @@
271
344
  font-size: 1.2em;
272
345
  padding: 0.2em 0.5em;
273
346
  cursor: grab;
347
+ &:hover {
348
+ color: var(--vxe-ui-font-primary-color);
349
+ }
274
350
  &:active {
275
351
  cursor: grabbing;
276
352
  }