vxe-table 3.5.9-beta.13 → 3.5.9-beta.16

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/lib/form/src/form-config-item.js +5 -3
  2. package/lib/form/src/form-config-item.min.js +1 -1
  3. package/lib/form/src/form-item.js +4 -2
  4. package/lib/form/src/form-item.min.js +1 -1
  5. package/lib/form/src/form.js +4 -1
  6. package/lib/form/src/form.min.js +1 -1
  7. package/lib/grid/src/grid.js +3 -1
  8. package/lib/grid/src/grid.min.js +1 -1
  9. package/lib/grid/style/style.css +1 -1
  10. package/lib/grid/style/style.min.css +1 -1
  11. package/lib/header/style/style.css +0 -100
  12. package/lib/header/style/style.min.css +0 -1
  13. package/lib/index.css +1 -1
  14. package/lib/index.umd.js +48 -26
  15. package/lib/index.umd.min.js +1 -1
  16. package/lib/modal/src/modal.js +9 -7
  17. package/lib/modal/src/modal.min.js +1 -1
  18. package/lib/modal/style/style.css +2 -2
  19. package/lib/modal/style/style.min.css +1 -1
  20. package/lib/pager/style/style.css +1 -1
  21. package/lib/pager/style/style.min.css +1 -1
  22. package/lib/select/src/select.js +3 -1
  23. package/lib/select/src/select.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/style.min.css +1 -1
  26. package/lib/table/src/cell.js +14 -8
  27. package/lib/table/src/cell.min.js +1 -1
  28. package/lib/table/src/methods.js +3 -1
  29. package/lib/table/src/methods.min.js +1 -1
  30. package/lib/table/style/style.css +101 -0
  31. package/lib/table/style/style.min.css +1 -1
  32. package/lib/toolbar/style/style.css +1 -1
  33. package/lib/toolbar/style/style.min.css +1 -1
  34. package/lib/tools/log.js +1 -1
  35. package/lib/tools/log.min.js +1 -1
  36. package/lib/tools/vn.js +18 -0
  37. package/lib/tools/vn.min.js +1 -0
  38. package/lib/v-x-e-table/index.js +1 -1
  39. package/lib/v-x-e-table/index.min.js +1 -1
  40. package/lib/v-x-e-table/style/style.css +1 -1
  41. package/lib/v-x-e-table/style/style.min.css +1 -1
  42. package/package.json +2 -2
  43. package/packages/form/src/form-config-item.js +4 -3
  44. package/packages/form/src/form-item.js +3 -2
  45. package/packages/form/src/form.js +3 -1
  46. package/packages/grid/src/grid.js +2 -1
  47. package/packages/modal/src/modal.js +5 -4
  48. package/packages/select/src/select.js +2 -1
  49. package/packages/table/src/cell.js +9 -5
  50. package/packages/table/src/methods.js +2 -1
  51. package/packages/tools/vn.js +8 -0
  52. package/styles/header.scss +0 -134
  53. package/styles/table.scss +134 -0
  54. package/styles/variable.scss +1 -1
  55. package/types/column.d.ts +8 -8
  56. package/types/component.d.ts +3 -1
@@ -5,6 +5,7 @@ import UtilTools, { getFuncText } from '../../tools/utils'
5
5
  import DomTools from '../../tools/dom'
6
6
  import { GlobalEvent } from '../../tools/event'
7
7
  import { errLog } from '../../tools/log'
8
+ import { getSlotVNs } from '../../tools/vn'
8
9
  import VxeLoading from '../../loading/index'
9
10
 
10
11
  export const allActivedModals = []
@@ -168,8 +169,8 @@ export default {
168
169
  'is--ellipsis': !isMsg && showTitleOverflow
169
170
  }],
170
171
  on: headerOns
171
- }, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : headerSlot.call(this, { $modal: this }, h)) : [
172
- titleSlot ? titleSlot.call(this, { $modal: this }, h) : h('span', {
172
+ }, headerSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(headerSlot.call(this, { $modal: this }, h))) : [
173
+ titleSlot ? getSlotVNs(titleSlot.call(this, { $modal: this }, h)) : h('span', {
173
174
  class: 'vxe-modal--title'
174
175
  }, title ? getFuncText(title) : GlobalConfig.i18n('vxe.alert.title')),
175
176
  showZoom ? h('i', {
@@ -203,7 +204,7 @@ export default {
203
204
  ]) : null,
204
205
  h('div', {
205
206
  class: 'vxe-modal--content'
206
- }, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : defaultSlot.call(this, { $modal: this }, h)) : getFuncText(content)),
207
+ }, defaultSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(defaultSlot.call(this, { $modal: this }, h))) : getFuncText(content)),
207
208
  /**
208
209
  * 加载中
209
210
  */
@@ -216,7 +217,7 @@ export default {
216
217
  ]),
217
218
  showFooter ? h('div', {
218
219
  class: 'vxe-modal--footer'
219
- }, footerSlot ? (!inited || (destroyOnClose && !visible) ? [] : footerSlot.call(this, { $modal: this }, h)) : [
220
+ }, footerSlot ? (!inited || (destroyOnClose && !visible) ? [] : getSlotVNs(footerSlot.call(this, { $modal: this }, h))) : [
220
221
  type === 'confirm' ? h('vxe-button', {
221
222
  ref: 'cancelBtn',
222
223
  on: {
@@ -5,6 +5,7 @@ import vSize from '../../mixins/size'
5
5
  import UtilTools, { getFuncText } from '../../tools/utils'
6
6
  import DomTools from '../../tools/dom'
7
7
  import { GlobalEvent, hasEventKey, EVENT_KEYS } from '../../tools/event'
8
+ import { getSlotVNs } from '../../tools/vn'
8
9
 
9
10
  function isOptionVisible (option) {
10
11
  return option.visible !== false
@@ -474,7 +475,7 @@ export default {
474
475
  slotFunc = $scopedSlots[slotFunc] || null
475
476
  }
476
477
  if (XEUtils.isFunction(slotFunc)) {
477
- return slotFunc.call(this, params, h)
478
+ return getSlotVNs(slotFunc.call(this, params, h))
478
479
  }
479
480
  }
480
481
  return []
@@ -4,6 +4,7 @@ import VXETable from '../../v-x-e-table'
4
4
  import DomTools from '../../tools/dom'
5
5
  import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/utils'
6
6
  import { getColumnConfig } from './util'
7
+ import { getSlotVNs } from '../../tools/vn'
7
8
 
8
9
  function renderHelpIcon (h, params) {
9
10
  const { $table, column } = params
@@ -78,7 +79,7 @@ function getFooterContent (h, params) {
78
79
  if (renderOpts) {
79
80
  const compConf = VXETable.renderer.get(renderOpts.name)
80
81
  if (compConf && compConf.renderFooter) {
81
- return compConf.renderFooter.call($table, h, renderOpts, params)
82
+ return getSlotVNs(compConf.renderFooter.call($table, h, renderOpts, params))
82
83
  }
83
84
  }
84
85
  return [UtilTools.formatText(items[_columnIndex], 1)]
@@ -152,7 +153,7 @@ export const Cell = {
152
153
  if (renderOpts) {
153
154
  const compConf = VXETable.renderer.get(renderOpts.name)
154
155
  if (compConf && compConf.renderHeader) {
155
- return renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params))
156
+ return getSlotVNs(renderTitleContent(h, params, compConf.renderHeader.call($table, h, renderOpts, params)))
156
157
  }
157
158
  }
158
159
  return renderTitleContent(h, params, UtilTools.formatText(column.getTitle(), 1))
@@ -171,7 +172,7 @@ export const Cell = {
171
172
  const funName = editRender ? 'renderCell' : 'renderDefault'
172
173
  const compConf = VXETable.renderer.get(renderOpts.name)
173
174
  if (compConf && compConf[funName]) {
174
- return compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params))
175
+ return getSlotVNs(compConf[funName].call($table, h, renderOpts, Object.assign({ $type: editRender ? 'edit' : 'cell' }, params)))
175
176
  }
176
177
  }
177
178
  const cellValue = $table.getCellLabel(row, column)
@@ -592,7 +593,7 @@ export const Cell = {
592
593
  if (contentRender) {
593
594
  const compConf = VXETable.renderer.get(contentRender.name)
594
595
  if (compConf && compConf.renderExpand) {
595
- return compConf.renderExpand.call($table, h, contentRender, params)
596
+ return getSlotVNs(compConf.renderExpand.call($table, h, contentRender, params))
596
597
  }
597
598
  }
598
599
  return []
@@ -756,7 +757,10 @@ export const Cell = {
756
757
  if (slots && slots.edit) {
757
758
  return $table.callSlot(slots.edit, params, h)
758
759
  }
759
- return compConf && compConf.renderEdit ? compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params)) : []
760
+ if (compConf && compConf.renderEdit) {
761
+ return getSlotVNs(compConf.renderEdit.call($table, h, editRender, Object.assign({ $type: 'edit' }, params)))
762
+ }
763
+ return []
760
764
  }
761
765
  if (slots && slots.default) {
762
766
  return $table.callSlot(slots.default, params, h)
@@ -7,6 +7,7 @@ import UtilTools, { eqEmptyValue, isEnableConf, getFuncText } from '../../tools/
7
7
  import DomTools, { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '../../tools/dom'
8
8
  import { formats } from '../../v-x-e-table/src/formats'
9
9
  import { warnLog, errLog } from '../../tools/log'
10
+ import { getSlotVNs } from '../../tools/vn'
10
11
 
11
12
  const { setCellValue, hasChildrenList, getColumnList } = UtilTools
12
13
  const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
@@ -245,7 +246,7 @@ const Methods = {
245
246
  return $xegrid.callSlot(slotFunc, params, h, vNodes)
246
247
  }
247
248
  if (XEUtils.isFunction(slotFunc)) {
248
- return slotFunc.call(this, params, h, vNodes)
249
+ return getSlotVNs(slotFunc.call(this, params, h, vNodes))
249
250
  }
250
251
  }
251
252
  return []
@@ -0,0 +1,8 @@
1
+ import XEUtils from 'xe-utils'
2
+
3
+ export function getSlotVNs (vns) {
4
+ if (XEUtils.isArray(vns)) {
5
+ return vns
6
+ }
7
+ return [vns]
8
+ }
@@ -1,135 +1 @@
1
1
  /**Variable**/
2
-
3
- .vxe-table {
4
- .vxe-table--header-wrapper {
5
- color: $vxe-table-header-font-color;
6
- .vxe-table--header-border-line {
7
- position: absolute;
8
- left: 0;
9
- bottom: 0;
10
- height: 0;
11
- border-bottom: $vxe-table-border-width solid $vxe-table-border-color;
12
- }
13
- }
14
- /*排序*/
15
- .vxe-cell--sort {
16
- width: 1.5em;
17
- height: 1.35em;
18
- vertical-align: middle;
19
- text-align: center;
20
- display: inline-block;
21
- position: relative;
22
- }
23
- .vxe-sort--asc-btn,
24
- .vxe-sort--desc-btn {
25
- position: absolute;
26
- left: 0.35em;
27
- color: $vxe-table-column-icon-border-color;
28
- width: 1em;
29
- text-align: center;
30
- cursor: pointer;
31
- &:hover {
32
- color: $vxe-table-font-color;
33
- }
34
- &.sort--active {
35
- color: $vxe-primary-color;
36
- }
37
- }
38
- .vxe-sort--asc-btn {
39
- top: -0.15em;
40
- }
41
- .vxe-sort--desc-btn {
42
- bottom: -0.15em;
43
- }
44
- }
45
-
46
- .vxe-header--column {
47
- position: relative;
48
- font-weight: $vxe-table-header-font-weight;
49
- // user-select: none;
50
- &.col--ellipsis {
51
- & > .vxe-cell {
52
- display: flex;
53
- align-items: center;
54
- .vxe-cell--title {
55
- overflow: hidden;
56
- text-overflow: ellipsis;
57
- white-space: nowrap;
58
- }
59
- & > i,
60
- & > span {
61
- &:not(.vxe-cell--title) {
62
- flex-shrink: 0;
63
- }
64
- }
65
- }
66
- }
67
- .vxe-cell--required-icon {
68
- display: inline-block;
69
- color: $vxe-table-validate-error-color;
70
- width: 0.8em;
71
- height: 1em;
72
- line-height: 1em;
73
- font-family: $vxe-icon-font-family;
74
- font-weight: normal;
75
- position: relative;
76
- &:before {
77
- content: "*";
78
- position: absolute;
79
- left: 0;
80
- top: 0.2em;
81
- }
82
- }
83
- // .vxe-cell--required-icon,
84
- // .vxe-cell--edit-icon,
85
- // .vxe-cell-help-icon,
86
- // .vxe-cell--title {
87
- // vertical-align: middle;
88
- // }
89
- .vxe-cell--required-icon {
90
- margin-right: 0.1em;
91
- }
92
- .vxe-cell--edit-icon,
93
- .vxe-cell-help-icon {
94
- margin-right: 0.2em;
95
- }
96
- .vxe-cell-help-icon {
97
- cursor: help;
98
- }
99
- .vxe-resizable {
100
- position: absolute;
101
- right: -7px;
102
- bottom: 0;
103
- width: 14px;
104
- height: 100%;
105
- text-align: center;
106
- z-index: 1;
107
- cursor: col-resize;
108
- &.is--line {
109
- &:before,
110
- &:after {
111
- content: "";
112
- display: inline-block;
113
- vertical-align: middle;
114
- }
115
- &:before {
116
- width: 1px;
117
- height: 50%;
118
- background-color: $vxe-table-resizable-line-color;
119
- }
120
- &:after {
121
- width: 0;
122
- height: 100%;
123
- }
124
- }
125
- }
126
- }
127
-
128
- .vxe-table--fixed-right-wrapper {
129
- .vxe-header--column {
130
- .vxe-resizable {
131
- right: auto;
132
- left: -7px;
133
- }
134
- }
135
- }
package/styles/table.scss CHANGED
@@ -311,6 +311,140 @@
311
311
  }
312
312
  }
313
313
 
314
+ /*header*/
315
+ .vxe-table {
316
+ .vxe-table--header-wrapper {
317
+ color: $vxe-table-header-font-color;
318
+ .vxe-table--header-border-line {
319
+ position: absolute;
320
+ left: 0;
321
+ bottom: 0;
322
+ height: 0;
323
+ border-bottom: $vxe-table-border-width solid $vxe-table-border-color;
324
+ }
325
+ }
326
+ /*排序*/
327
+ .vxe-cell--sort {
328
+ width: 1.5em;
329
+ height: 1.35em;
330
+ vertical-align: middle;
331
+ text-align: center;
332
+ display: inline-block;
333
+ position: relative;
334
+ }
335
+ .vxe-sort--asc-btn,
336
+ .vxe-sort--desc-btn {
337
+ position: absolute;
338
+ left: 0.35em;
339
+ color: $vxe-table-column-icon-border-color;
340
+ width: 1em;
341
+ text-align: center;
342
+ cursor: pointer;
343
+ &:hover {
344
+ color: $vxe-table-font-color;
345
+ }
346
+ &.sort--active {
347
+ color: $vxe-primary-color;
348
+ }
349
+ }
350
+ .vxe-sort--asc-btn {
351
+ top: -0.15em;
352
+ }
353
+ .vxe-sort--desc-btn {
354
+ bottom: -0.15em;
355
+ }
356
+ }
357
+
358
+ .vxe-header--column {
359
+ position: relative;
360
+ font-weight: $vxe-table-header-font-weight;
361
+ // user-select: none;
362
+ &.col--ellipsis {
363
+ & > .vxe-cell {
364
+ display: flex;
365
+ align-items: center;
366
+ .vxe-cell--title {
367
+ overflow: hidden;
368
+ text-overflow: ellipsis;
369
+ white-space: nowrap;
370
+ }
371
+ & > i,
372
+ & > span {
373
+ &:not(.vxe-cell--title) {
374
+ flex-shrink: 0;
375
+ }
376
+ }
377
+ }
378
+ }
379
+ .vxe-cell--required-icon {
380
+ display: inline-block;
381
+ color: $vxe-table-validate-error-color;
382
+ width: 0.8em;
383
+ height: 1em;
384
+ line-height: 1em;
385
+ font-family: $vxe-icon-font-family;
386
+ font-weight: normal;
387
+ position: relative;
388
+ &:before {
389
+ content: "*";
390
+ position: absolute;
391
+ left: 0;
392
+ top: 0.2em;
393
+ }
394
+ }
395
+ // .vxe-cell--required-icon,
396
+ // .vxe-cell--edit-icon,
397
+ // .vxe-cell-help-icon,
398
+ // .vxe-cell--title {
399
+ // vertical-align: middle;
400
+ // }
401
+ .vxe-cell--required-icon {
402
+ margin-right: 0.1em;
403
+ }
404
+ .vxe-cell--edit-icon,
405
+ .vxe-cell-help-icon {
406
+ margin-right: 0.2em;
407
+ }
408
+ .vxe-cell-help-icon {
409
+ cursor: help;
410
+ }
411
+ .vxe-resizable {
412
+ position: absolute;
413
+ right: -7px;
414
+ bottom: 0;
415
+ width: 14px;
416
+ height: 100%;
417
+ text-align: center;
418
+ z-index: 1;
419
+ cursor: col-resize;
420
+ &.is--line {
421
+ &:before,
422
+ &:after {
423
+ content: "";
424
+ display: inline-block;
425
+ vertical-align: middle;
426
+ }
427
+ &:before {
428
+ width: 1px;
429
+ height: 50%;
430
+ background-color: $vxe-table-resizable-line-color;
431
+ }
432
+ &:after {
433
+ width: 0;
434
+ height: 100%;
435
+ }
436
+ }
437
+ }
438
+ }
439
+ .vxe-table--fixed-right-wrapper {
440
+ .vxe-header--column {
441
+ .vxe-resizable {
442
+ right: auto;
443
+ left: -7px;
444
+ }
445
+ }
446
+ }
447
+
314
448
  /*table*/
315
449
  .vxe-table--render-default {
316
450
  position: relative;
@@ -108,7 +108,7 @@ $vxe-table-menu-item-width: 178px !default;
108
108
  $vxe-table-menu-background-color: #fff !default;
109
109
 
110
110
  /*loading*/
111
- $vxe-loading-background-color: rgba(0, 0, 0, 0.2) !default;
111
+ $vxe-loading-background-color: rgba(0, 0, 0, 0.3) !default;
112
112
  $vxe-loading-z-index: 999 !default;
113
113
 
114
114
  /*validate*/
package/types/column.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CreateElement, VNode } from 'vue'
2
- import { VXETableComponent } from './component'
2
+ import { VXETableComponent, SlotVNodeType } from './component'
3
3
  import { ColumnFilterOption, ColumnFilterParams, ColumnFilterRenderOptions, ColumnFilterSlotParams, ColumnFilterMethodParams } from './filter'
4
4
  import { ColumnCellRenderParams, ColumnDefaultSlotParams, ColumnIconSlotParams, ColumnContentSlotParams, RenderOptions, OptionProps, OptionGroupProps } from './v-x-e-table'
5
5
  import { ColumnHeaderSlotParams, ColumnHeaderRenderParams } from './header'
@@ -292,13 +292,13 @@ export interface ColumnOptions {
292
292
  params?: any;
293
293
 
294
294
  slots?: {
295
- default?(params: ColumnDefaultSlotParams, h: CreateElement): VNode[] | string[];
296
- header?(params: ColumnHeaderSlotParams, h: CreateElement): VNode[] | string[];
297
- footer?(params: ColumnFooterSlotParams, h: CreateElement): VNode[] | string[];
298
- content?(params: ColumnContentSlotParams, h: CreateElement): VNode[] | string[];
299
- filter?(params: ColumnFilterSlotParams, h: CreateElement): VNode[] | string[];
300
- edit?(params: ColumnEditSlotParams, h: CreateElement): VNode[] | string[];
301
- icon?(params: ColumnIconSlotParams, h: CreateElement): VNode[] | string[];
295
+ default?(params: ColumnDefaultSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
296
+ header?(params: ColumnHeaderSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
297
+ footer?(params: ColumnFooterSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
298
+ content?(params: ColumnContentSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
299
+ filter?(params: ColumnFilterSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
300
+ edit?(params: ColumnEditSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
301
+ icon?(params: ColumnIconSlotParams, h: CreateElement): SlotVNodeType | SlotVNodeType[]
302
302
  };
303
303
  }
304
304
 
@@ -1,4 +1,4 @@
1
- import Vue from 'vue'
1
+ import Vue, { VNode } from 'vue'
2
2
 
3
3
  declare type SizeType = null | '' | 'medium' | 'small' | 'mini'
4
4
 
@@ -22,3 +22,5 @@ export interface RecordInfo {
22
22
  export interface RowInfo {
23
23
  [key: string]: any;
24
24
  }
25
+
26
+ export type SlotVNodeType = VNode | string | number