vxe-table 3.19.39 → 3.20.0-beta.1

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 (109) hide show
  1. package/es/index.css +1 -1
  2. package/es/index.esm.js +2 -1
  3. package/es/index.min.css +1 -1
  4. package/es/style.css +1 -1
  5. package/es/style.min.css +1 -1
  6. package/es/table/module/custom/mixin.js +6 -4
  7. package/es/table/module/custom/panel.js +806 -799
  8. package/es/table/module/edit/mixin.js +43 -31
  9. package/es/table/module/export/export-panel.js +511 -458
  10. package/es/table/module/export/import-panel.js +224 -192
  11. package/es/table/module/keyboard/mixin.js +2 -2
  12. package/es/table/module/menu/panel.js +165 -161
  13. package/es/table/module/validator/mixin.js +255 -236
  14. package/es/table/src/body.js +2 -1
  15. package/es/table/src/cell.js +2 -2
  16. package/es/table/src/methods.js +33 -43
  17. package/es/table/src/table.js +13 -249
  18. package/es/table/src/util.js +242 -0
  19. package/es/table/style.css +23 -50
  20. package/es/table/style.min.css +1 -1
  21. package/es/ui/index.js +2 -2
  22. package/es/ui/src/dom.js +22 -0
  23. package/es/ui/src/log.js +1 -1
  24. package/es/vxe-table/style.css +23 -50
  25. package/es/vxe-table/style.min.css +1 -1
  26. package/lib/index.common.js +2 -1
  27. package/lib/index.css +1 -1
  28. package/lib/index.min.css +1 -1
  29. package/lib/index.umd.js +3640 -4790
  30. package/lib/index.umd.min.js +1 -1
  31. package/lib/style.css +1 -1
  32. package/lib/style.min.css +1 -1
  33. package/lib/table/module/custom/mixin.js +6 -4
  34. package/lib/table/module/custom/mixin.min.js +1 -1
  35. package/lib/table/module/custom/panel.js +693 -685
  36. package/lib/table/module/custom/panel.min.js +1 -1
  37. package/lib/table/module/edit/mixin.js +47 -31
  38. package/lib/table/module/edit/mixin.min.js +1 -1
  39. package/lib/table/module/export/export-panel.js +450 -384
  40. package/lib/table/module/export/export-panel.min.js +1 -1
  41. package/lib/table/module/export/import-panel.js +200 -159
  42. package/lib/table/module/export/import-panel.min.js +1 -1
  43. package/lib/table/module/keyboard/mixin.js +2 -2
  44. package/lib/table/module/keyboard/mixin.min.js +1 -1
  45. package/lib/table/module/menu/panel.js +119 -114
  46. package/lib/table/module/menu/panel.min.js +1 -1
  47. package/lib/table/module/validator/mixin.js +271 -259
  48. package/lib/table/module/validator/mixin.min.js +1 -1
  49. package/lib/table/src/body.js +2 -1
  50. package/lib/table/src/body.min.js +1 -1
  51. package/lib/table/src/cell.js +2 -2
  52. package/lib/table/src/cell.min.js +1 -1
  53. package/lib/table/src/methods.js +33 -45
  54. package/lib/table/src/methods.min.js +1 -1
  55. package/lib/table/src/table.js +12 -248
  56. package/lib/table/src/table.min.js +1 -1
  57. package/lib/table/src/util.js +243 -0
  58. package/lib/table/src/util.min.js +1 -1
  59. package/lib/table/style/style.css +23 -50
  60. package/lib/table/style/style.min.css +1 -1
  61. package/lib/ui/index.js +2 -2
  62. package/lib/ui/index.min.js +1 -1
  63. package/lib/ui/src/dom.js +22 -0
  64. package/lib/ui/src/dom.min.js +1 -1
  65. package/lib/ui/src/log.js +1 -1
  66. package/lib/ui/src/log.min.js +1 -1
  67. package/lib/v-x-e-table/index.js +2 -1
  68. package/lib/v-x-e-table/index.min.js +1 -1
  69. package/lib/vxe-colgroup/index.js +2 -1
  70. package/lib/vxe-colgroup/index.min.js +1 -1
  71. package/lib/vxe-column/index.js +2 -1
  72. package/lib/vxe-column/index.min.js +1 -1
  73. package/lib/vxe-grid/index.js +2 -1
  74. package/lib/vxe-grid/index.min.js +1 -1
  75. package/lib/vxe-table/index.js +2 -1
  76. package/lib/vxe-table/index.min.js +1 -1
  77. package/lib/vxe-table/style/style.css +23 -50
  78. package/lib/vxe-table/style/style.min.css +1 -1
  79. package/lib/vxe-toolbar/index.js +2 -1
  80. package/lib/vxe-toolbar/index.min.js +1 -1
  81. package/lib/vxe-ui/index.js +2 -1
  82. package/lib/vxe-ui/index.min.js +1 -1
  83. package/lib/vxe-v-x-e-table/index.js +2 -1
  84. package/lib/vxe-v-x-e-table/index.min.js +1 -1
  85. package/package.json +1 -1
  86. package/packages/table/module/custom/mixin.ts +7 -4
  87. package/packages/table/module/custom/panel.ts +846 -839
  88. package/packages/table/module/edit/mixin.ts +55 -35
  89. package/packages/table/module/export/export-panel.ts +545 -469
  90. package/packages/table/module/export/import-panel.ts +245 -202
  91. package/packages/table/module/filter/panel.ts +4 -18
  92. package/packages/table/module/keyboard/mixin.ts +2 -2
  93. package/packages/table/module/menu/panel.ts +171 -163
  94. package/packages/table/module/validator/mixin.ts +279 -240
  95. package/packages/table/src/body.ts +2 -1
  96. package/packages/table/src/cell.ts +2 -2
  97. package/packages/table/src/methods.ts +43 -45
  98. package/packages/table/src/table.ts +14 -260
  99. package/packages/table/src/util.ts +254 -0
  100. package/packages/ui/index.ts +1 -1
  101. package/packages/ui/src/dom.ts +22 -0
  102. package/styles/components/table.scss +5 -2
  103. package/styles/theme/base.scss +2 -1
  104. /package/es/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
  105. /package/es/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
  106. /package/es/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
  107. /package/lib/{iconfont.1767145426781.ttf → iconfont.1767492234857.ttf} +0 -0
  108. /package/lib/{iconfont.1767145426781.woff → iconfont.1767492234857.woff} +0 -0
  109. /package/lib/{iconfont.1767145426781.woff2 → iconfont.1767492234857.woff2} +0 -0
@@ -1,3 +1,4 @@
1
+ import { defineVxeComponent } from '../../../ui/src/comp';
1
2
  import { VxeUI } from '../../../ui';
2
3
  import XEUtils from 'xe-utils';
3
4
  import { parseFile } from '../../../ui/src/utils';
@@ -9,12 +10,14 @@ export default {
9
10
  globalMixins.sizeMixin
10
11
  ],
11
12
  props: {
12
- defaultOptions: Object,
13
- storeData: Object
14
- },
15
- components: {
16
- // VxeModal,
17
- // VxeRadio
13
+ defaultOptions: {
14
+ type: Object,
15
+ default: () => ({})
16
+ },
17
+ storeData: {
18
+ type: Object,
19
+ default: () => ({})
20
+ }
18
21
  },
19
22
  inject: {
20
23
  $xeTable: {
@@ -22,27 +25,36 @@ export default {
22
25
  }
23
26
  },
24
27
  data() {
25
- return {
28
+ const reactData = {
26
29
  loading: false
27
30
  };
31
+ return {
32
+ reactData
33
+ };
28
34
  },
29
- computed: {
30
- selectName() {
31
- return `${this.storeData.filename}.${this.storeData.type}`;
35
+ computed: Object.assign(Object.assign({}, {}), { computeSelectName() {
36
+ const $xeImportPanel = this;
37
+ const props = $xeImportPanel;
38
+ const { storeData } = props;
39
+ return `${storeData.filename}.${storeData.type}`;
32
40
  },
33
- hasFile() {
34
- return this.storeData.file && this.storeData.type;
41
+ computeHasFile() {
42
+ const $xeImportPanel = this;
43
+ const props = $xeImportPanel;
44
+ const { storeData } = props;
45
+ return storeData.file && storeData.type;
35
46
  },
36
- parseTypeLabel() {
37
- const { storeData } = this;
47
+ computeParseTypeLabel() {
48
+ const $xeImportPanel = this;
49
+ const props = $xeImportPanel;
50
+ const { storeData } = props;
38
51
  const { type, typeList } = storeData;
39
52
  if (type) {
40
53
  const selectItem = XEUtils.find(typeList, item => type === item.value);
41
- return selectItem ? selectItem.label : '*.*';
54
+ return `${selectItem ? selectItem.label : '*.*'}`;
42
55
  }
43
56
  return `*.${typeList.map((item) => item.value).join(', *.')}`;
44
- }
45
- },
57
+ } }),
46
58
  created() {
47
59
  const $xeTableImportPanel = this;
48
60
  const VxeUIModalComponent = VxeUI.getComponent('VxeModal');
@@ -60,167 +72,6 @@ export default {
60
72
  }
61
73
  });
62
74
  },
63
- render(h) {
64
- const $xeTable = this.$parent;
65
- const $xeGrid = $xeTable.$xeGrid;
66
- const $xeGantt = $xeTable.$xeGantt;
67
- const { hasFile, loading, parseTypeLabel, defaultOptions, storeData, selectName } = this;
68
- const slots = defaultOptions.slots || {};
69
- const topSlot = slots.top;
70
- const bottomSlot = slots.bottom;
71
- const defaultSlot = slots.default;
72
- const footerSlot = slots.footer;
73
- return h('vxe-modal', {
74
- ref: 'modal',
75
- props: {
76
- id: 'VXE_IMPORT_MODAL',
77
- value: storeData.visible,
78
- title: getI18n('vxe.import.impTitle'),
79
- width: 540,
80
- minWidth: 360,
81
- minHeight: 240,
82
- mask: true,
83
- lockView: true,
84
- showFooter: true,
85
- escClosable: true,
86
- maskClosable: true,
87
- showMaximize: true,
88
- resize: true,
89
- loading
90
- },
91
- on: {
92
- input(value) {
93
- storeData.visible = value;
94
- },
95
- show: this.showEvent
96
- },
97
- scopedSlots: {
98
- default: () => {
99
- const params = {
100
- $table: $xeTable,
101
- $grid: $xeGrid,
102
- $gantt: $xeGantt,
103
- options: defaultOptions,
104
- params: defaultOptions.params
105
- };
106
- return h('div', {
107
- class: 'vxe-table-export--panel'
108
- }, [
109
- topSlot
110
- ? h('div', {
111
- class: 'vxe-table-export--panel-top'
112
- }, $xeTable.callSlot(topSlot, params, h))
113
- : renderEmptyElement(this),
114
- h('div', {
115
- class: 'vxe-table-export--panel-body'
116
- }, defaultSlot
117
- ? $xeTable.callSlot(defaultSlot, params, h)
118
- : [
119
- h('table', {
120
- class: 'vxe-table-export--panel-table',
121
- attrs: {
122
- cellspacing: 0,
123
- cellpadding: 0,
124
- border: 0
125
- }
126
- }, [
127
- h('tbody', [
128
- h('tr', [
129
- h('td', getI18n('vxe.import.impFile')),
130
- h('td', [
131
- hasFile
132
- ? h('div', {
133
- class: 'vxe-table-export--selected--file',
134
- attrs: {
135
- title: selectName
136
- }
137
- }, [
138
- h('span', selectName),
139
- h('i', {
140
- class: getIcon().INPUT_CLEAR,
141
- on: {
142
- click: this.clearFileEvent
143
- }
144
- })
145
- ])
146
- : h('button', {
147
- ref: 'fileBtn',
148
- class: 'vxe-table-export--select--file',
149
- attrs: {
150
- type: 'button'
151
- },
152
- on: {
153
- click: this.selectFileEvent
154
- }
155
- }, getI18n('vxe.import.impSelect'))
156
- ])
157
- ]),
158
- h('tr', [
159
- h('td', getI18n('vxe.import.impType')),
160
- h('td', parseTypeLabel)
161
- ]),
162
- h('tr', [
163
- h('td', getI18n('vxe.import.impMode')),
164
- h('td', [
165
- h('vxe-select', {
166
- props: {
167
- value: defaultOptions.mode,
168
- options: storeData.modeList
169
- },
170
- on: {
171
- modelValue(value) {
172
- defaultOptions.mode = value;
173
- }
174
- }
175
- })
176
- ])
177
- ])
178
- ])
179
- ])
180
- ]),
181
- bottomSlot
182
- ? h('div', {
183
- class: 'vxe-table-export--panel-bottom'
184
- }, $xeTable.callSlot(bottomSlot, params, h))
185
- : renderEmptyElement(this)
186
- ]);
187
- },
188
- footer: () => {
189
- const params = {
190
- $table: $xeTable,
191
- $grid: $xeGrid,
192
- $gantt: $xeGantt,
193
- options: defaultOptions,
194
- params: defaultOptions.params
195
- };
196
- return h('div', {
197
- class: 'vxe-table-export--panel-footer'
198
- }, footerSlot
199
- ? $xeTable.callSlot(footerSlot, params, h)
200
- : [
201
- h('div', {
202
- class: 'vxe-table-export--panel-btns'
203
- }, [
204
- h('vxe-button', {
205
- on: {
206
- click: this.cancelEvent
207
- }
208
- }, getI18n('vxe.import.impCancel')),
209
- h('vxe-button', {
210
- props: {
211
- status: 'primary',
212
- disabled: !hasFile || loading
213
- },
214
- on: {
215
- click: this.importEvent
216
- }
217
- }, getI18n('vxe.import.impConfirm'))
218
- ])
219
- ]);
220
- }
221
- }
222
- });
223
- },
224
75
  methods: {
225
76
  clearFileEvent() {
226
77
  Object.assign(this.storeData, {
@@ -230,33 +81,214 @@ export default {
230
81
  });
231
82
  },
232
83
  selectFileEvent() {
233
- const $xeTable = this.$parent;
234
- $xeTable.readFile(this.defaultOptions).then((params) => {
84
+ const $xeImportPanel = this;
85
+ const props = $xeImportPanel;
86
+ const $xeTable = $xeImportPanel.$xeTable;
87
+ const { storeData, defaultOptions } = props;
88
+ $xeTable.readFile(defaultOptions).then((params) => {
235
89
  const { file } = params;
236
- Object.assign(this.storeData, parseFile(file), { file });
237
- }).catch((e) => e);
90
+ Object.assign(storeData, parseFile(file), { file });
91
+ }).catch(() => { });
238
92
  },
239
93
  showEvent() {
240
- this.$nextTick(() => {
241
- const { $refs } = this;
242
- const targetElem = $refs.fileBtn;
94
+ const $xeImportPanel = this;
95
+ $xeImportPanel.$nextTick(() => {
96
+ const targetElem = $xeImportPanel.$refs.fileBtn;
243
97
  if (targetElem) {
244
98
  targetElem.focus();
245
99
  }
246
100
  });
247
101
  },
248
102
  cancelEvent() {
249
- this.storeData.visible = false;
103
+ const $xeImportPanel = this;
104
+ const props = $xeImportPanel;
105
+ const { storeData } = props;
106
+ storeData.visible = false;
250
107
  },
251
108
  importEvent() {
252
- const $xeTable = this.$parent;
253
- this.loading = true;
254
- $xeTable.importByFile(this.storeData.file, Object.assign({}, $xeTable.importOpts, this.defaultOptions)).then(() => {
255
- this.loading = false;
256
- this.storeData.visible = false;
109
+ const $xeImportPanel = this;
110
+ const props = $xeImportPanel;
111
+ const reactData = $xeImportPanel.reactData;
112
+ const $xeTable = $xeImportPanel.$xeTable;
113
+ const { storeData, defaultOptions } = props;
114
+ const importOpts = $xeTable.computeImportOpts;
115
+ reactData.loading = true;
116
+ $xeTable.importByFile(storeData.file, Object.assign({}, importOpts, defaultOptions)).then(() => {
117
+ reactData.loading = false;
118
+ storeData.visible = false;
257
119
  }).catch(() => {
258
- this.loading = false;
120
+ reactData.loading = false;
121
+ });
122
+ },
123
+ renderVN(h) {
124
+ const $xeImportPanel = this;
125
+ const props = $xeImportPanel;
126
+ const reactData = $xeImportPanel.reactData;
127
+ const $xeTable = $xeImportPanel.$xeTable;
128
+ const $xeGrid = $xeTable.$xeGrid;
129
+ const $xeGantt = $xeTable.$xeGantt;
130
+ const { defaultOptions, storeData } = props;
131
+ const selectName = $xeImportPanel.computeSelectName;
132
+ const hasFile = $xeImportPanel.computeHasFile;
133
+ const parseTypeLabel = $xeImportPanel.computeParseTypeLabel;
134
+ const slots = defaultOptions.slots || {};
135
+ const topSlot = slots.top;
136
+ const bottomSlot = slots.bottom;
137
+ const defaultSlot = slots.default;
138
+ const footerSlot = slots.footer;
139
+ return h('vxe-modal', {
140
+ ref: 'modal',
141
+ props: {
142
+ id: 'VXE_IMPORT_MODAL',
143
+ value: storeData.visible,
144
+ title: getI18n('vxe.import.impTitle'),
145
+ width: 540,
146
+ minWidth: 360,
147
+ minHeight: 240,
148
+ mask: true,
149
+ lockView: true,
150
+ showFooter: true,
151
+ escClosable: true,
152
+ maskClosable: true,
153
+ showMaximize: true,
154
+ resize: true,
155
+ loading: reactData.loading
156
+ },
157
+ on: {
158
+ input(value) {
159
+ storeData.visible = value;
160
+ },
161
+ show: $xeImportPanel.showEvent
162
+ },
163
+ scopedSlots: {
164
+ default: () => {
165
+ const params = {
166
+ $table: $xeTable,
167
+ $grid: $xeGrid,
168
+ $gantt: $xeGantt,
169
+ options: defaultOptions,
170
+ params: defaultOptions.params
171
+ };
172
+ return h('div', {
173
+ class: 'vxe-table-export--panel'
174
+ }, [
175
+ topSlot
176
+ ? h('div', {
177
+ class: 'vxe-table-export--panel-top'
178
+ }, $xeTable.callSlot(topSlot, params, h))
179
+ : renderEmptyElement($xeTable),
180
+ h('div', {
181
+ class: 'vxe-table-export--panel-body'
182
+ }, defaultSlot
183
+ ? $xeTable.callSlot(defaultSlot, params, h)
184
+ : [
185
+ h('table', {
186
+ class: 'vxe-table-export--panel-table',
187
+ attrs: {
188
+ cellspacing: 0,
189
+ cellpadding: 0,
190
+ border: 0
191
+ }
192
+ }, [
193
+ h('tbody', [
194
+ h('tr', [
195
+ h('td', getI18n('vxe.import.impFile')),
196
+ h('td', [
197
+ hasFile
198
+ ? h('div', {
199
+ class: 'vxe-table-export--selected--file',
200
+ attrs: {
201
+ title: selectName
202
+ }
203
+ }, [
204
+ h('span', selectName),
205
+ h('i', {
206
+ class: getIcon().INPUT_CLEAR,
207
+ on: {
208
+ click: $xeImportPanel.clearFileEvent
209
+ }
210
+ })
211
+ ])
212
+ : h('button', {
213
+ ref: 'fileBtn',
214
+ class: 'vxe-table-export--select--file',
215
+ attrs: {
216
+ type: 'button'
217
+ },
218
+ on: {
219
+ click: $xeImportPanel.selectFileEvent
220
+ }
221
+ }, getI18n('vxe.import.impSelect'))
222
+ ])
223
+ ]),
224
+ h('tr', [
225
+ h('td', getI18n('vxe.import.impType')),
226
+ h('td', parseTypeLabel)
227
+ ]),
228
+ h('tr', [
229
+ h('td', getI18n('vxe.import.impMode')),
230
+ h('td', [
231
+ h('vxe-select', {
232
+ props: {
233
+ value: defaultOptions.mode,
234
+ options: storeData.modeList
235
+ },
236
+ on: {
237
+ modelValue(value) {
238
+ defaultOptions.mode = value;
239
+ }
240
+ }
241
+ })
242
+ ])
243
+ ])
244
+ ])
245
+ ])
246
+ ]),
247
+ bottomSlot
248
+ ? h('div', {
249
+ class: 'vxe-table-export--panel-bottom'
250
+ }, $xeTable.callSlot(bottomSlot, params, h))
251
+ : renderEmptyElement($xeTable)
252
+ ]);
253
+ },
254
+ footer: () => {
255
+ const params = {
256
+ $table: $xeTable,
257
+ $grid: $xeGrid,
258
+ $gantt: $xeGantt,
259
+ options: defaultOptions,
260
+ params: defaultOptions.params
261
+ };
262
+ return h('div', {
263
+ class: 'vxe-table-export--panel-footer'
264
+ }, footerSlot
265
+ ? $xeTable.callSlot(footerSlot, params, h)
266
+ : [
267
+ h('div', {
268
+ class: 'vxe-table-export--panel-btns'
269
+ }, [
270
+ h('vxe-button', {
271
+ on: {
272
+ click: $xeImportPanel.cancelEvent
273
+ }
274
+ }, getI18n('vxe.import.impCancel')),
275
+ h('vxe-button', {
276
+ props: {
277
+ status: 'primary',
278
+ disabled: !hasFile || reactData.loading
279
+ },
280
+ on: {
281
+ click: $xeImportPanel.importEvent
282
+ }
283
+ }, getI18n('vxe.import.impConfirm'))
284
+ ])
285
+ ]);
286
+ }
287
+ }
259
288
  });
260
289
  }
290
+ },
291
+ render(h) {
292
+ return this.renderVN(h);
261
293
  }
262
294
  };
@@ -502,8 +502,8 @@ export default {
502
502
  const checkboxOpts = $xeTable.computeCheckboxOpts;
503
503
  const mouseOpts = $xeTable.computeMouseOpts;
504
504
  const editOpts = $xeTable.computeEditOpts;
505
- if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
506
- return $xeTable.triggerCellAreaModnEvent(evnt, params);
505
+ if (mouseConfig && mouseOpts.area && $xeTable.triggerClAreaModnEvent) {
506
+ return $xeTable.triggerClAreaModnEvent(evnt, params);
507
507
  }
508
508
  else {
509
509
  if (checkboxConfig && checkboxOpts.range) {