vxe-table 4.2.2-beta.1 → 4.2.3
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.
- package/es/edit/src/hook.js +4 -2
- package/es/filter/src/hook.js +2 -1
- package/es/footer/src/footer.js +5 -5
- package/es/grid/src/grid.js +1 -1
- package/es/header/src/header.js +6 -6
- package/es/header/style.css +1 -5
- package/es/input/src/input.js +138 -33
- package/es/input/style.css +42 -13
- package/es/keyboard/src/hook.js +5 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/table/src/body.js +15 -11
- package/es/table/src/table.js +58 -48
- package/es/tools/log.js +1 -1
- package/es/v-x-e-table/index.js +1 -1
- package/helper/vetur/attributes.json +31 -19
- package/helper/vetur/tags.json +3 -0
- package/lib/edit/src/hook.js +6 -4
- package/lib/edit/src/hook.min.js +1 -1
- package/lib/filter/src/hook.js +2 -1
- package/lib/filter/src/hook.min.js +1 -1
- package/lib/footer/src/footer.js +5 -5
- package/lib/footer/src/footer.min.js +1 -1
- package/lib/grid/src/grid.js +1 -1
- package/lib/grid/src/grid.min.js +1 -1
- package/lib/header/src/header.js +6 -6
- package/lib/header/src/header.min.js +1 -1
- package/lib/header/style/style.css +1 -5
- package/lib/header/style/style.min.css +1 -1
- package/lib/index.umd.js +351 -125
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +180 -35
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/style/style.css +42 -13
- package/lib/input/style/style.min.css +1 -1
- package/lib/keyboard/src/hook.js +7 -1
- package/lib/keyboard/src/hook.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +15 -11
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/table.js +65 -56
- package/lib/table/src/table.min.js +1 -1
- package/lib/tools/log.js +1 -1
- package/lib/tools/log.min.js +1 -1
- package/lib/v-x-e-table/index.js +1 -1
- package/lib/v-x-e-table/index.min.js +1 -1
- package/package.json +1 -1
- package/packages/edit/src/hook.ts +4 -2
- package/packages/filter/src/hook.ts +3 -2
- package/packages/footer/src/footer.ts +5 -5
- package/packages/grid/src/grid.ts +1 -1
- package/packages/header/src/header.ts +6 -6
- package/packages/input/src/input.ts +142 -34
- package/packages/keyboard/src/hook.ts +6 -2
- package/packages/table/src/body.ts +15 -11
- package/packages/table/src/table.ts +57 -46
- package/packages/tools/dom.ts +1 -1
- package/styles/header.scss +1 -1
- package/styles/input.scss +16 -4
- package/types/input.d.ts +11 -0
- package/types/table.d.ts +3 -1
|
@@ -986,12 +986,17 @@ export default defineComponent({
|
|
|
986
986
|
* 支持 px、%、固定 混合分配
|
|
987
987
|
* 支持动态列表调整分配
|
|
988
988
|
* 支持自动分配偏移量
|
|
989
|
-
* @param {Element} headerElem
|
|
990
|
-
* @param {Element} bodyElem
|
|
991
|
-
* @param {Element} footerElem
|
|
992
|
-
* @param {Number} bodyWidth
|
|
993
989
|
*/
|
|
994
|
-
const autoCellWidth = (
|
|
990
|
+
const autoCellWidth = () => {
|
|
991
|
+
const tableHeader = refTableHeader.value
|
|
992
|
+
const tableBody = refTableBody.value
|
|
993
|
+
const tableFooter = refTableFooter.value
|
|
994
|
+
const bodyElem = tableBody ? tableBody.$el as HTMLDivElement : null
|
|
995
|
+
const headerElem = tableHeader ? tableHeader.$el as HTMLDivElement : null
|
|
996
|
+
const footerElem = tableFooter ? tableFooter.$el as HTMLDivElement : null
|
|
997
|
+
if (!bodyElem) {
|
|
998
|
+
return
|
|
999
|
+
}
|
|
995
1000
|
let tableWidth = 0
|
|
996
1001
|
const minCellWidth = 40 // 列宽最少限制 40px
|
|
997
1002
|
const bodyWidth = bodyElem.clientWidth - 1
|
|
@@ -1331,7 +1336,8 @@ export default defineComponent({
|
|
|
1331
1336
|
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
1332
1337
|
const mouseOpts = computeMouseOpts.value
|
|
1333
1338
|
const keyboardOpts = computeKeyboardOpts.value
|
|
1334
|
-
const
|
|
1339
|
+
const bodyWrapperRef = elemStore['main-body-wrapper']
|
|
1340
|
+
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null
|
|
1335
1341
|
if (emptyPlaceholderElem) {
|
|
1336
1342
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
1337
1343
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : ''
|
|
@@ -1352,8 +1358,10 @@ export default defineComponent({
|
|
|
1352
1358
|
fixedWrapperElem = isFixedLeft ? refLeftContainer.value : refRightContainer.value
|
|
1353
1359
|
}
|
|
1354
1360
|
layoutList.forEach(layout => {
|
|
1355
|
-
const
|
|
1356
|
-
const
|
|
1361
|
+
const wrapperRef = elemStore[`${name}-${layout}-wrapper`]
|
|
1362
|
+
const wrapperElem = wrapperRef ? wrapperRef.value : null
|
|
1363
|
+
const tableRef = elemStore[`${name}-${layout}-table`]
|
|
1364
|
+
const tableElem = tableRef ? tableRef.value : null
|
|
1357
1365
|
if (layout === 'header') {
|
|
1358
1366
|
// 表头体样式处理
|
|
1359
1367
|
// 横向滚动渲染
|
|
@@ -1383,12 +1391,14 @@ export default defineComponent({
|
|
|
1383
1391
|
}
|
|
1384
1392
|
}
|
|
1385
1393
|
|
|
1386
|
-
const
|
|
1394
|
+
const repairRef = elemStore[`${name}-${layout}-repair`]
|
|
1395
|
+
const repairElem = repairRef ? repairRef.value : null
|
|
1387
1396
|
if (repairElem) {
|
|
1388
1397
|
repairElem.style.width = `${tableWidth}px`
|
|
1389
1398
|
}
|
|
1390
1399
|
|
|
1391
|
-
const
|
|
1400
|
+
const listRef = elemStore[`${name}-${layout}-list`]
|
|
1401
|
+
const listElem = listRef ? listRef.value : null
|
|
1392
1402
|
if (isGroup && listElem) {
|
|
1393
1403
|
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem: any) => {
|
|
1394
1404
|
const colNode = tableMethods.getColumnNode(thElem)
|
|
@@ -1415,7 +1425,8 @@ export default defineComponent({
|
|
|
1415
1425
|
})
|
|
1416
1426
|
}
|
|
1417
1427
|
} else if (layout === 'body') {
|
|
1418
|
-
const
|
|
1428
|
+
const emptyBlockRef = elemStore[`${name}-${layout}-emptyBlock`]
|
|
1429
|
+
const emptyBlockElem = emptyBlockRef ? emptyBlockRef.value : null
|
|
1419
1430
|
if (isNodeElement(wrapperElem)) {
|
|
1420
1431
|
if (customMaxHeight) {
|
|
1421
1432
|
wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight}px`
|
|
@@ -1489,7 +1500,8 @@ export default defineComponent({
|
|
|
1489
1500
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
|
|
1490
1501
|
}
|
|
1491
1502
|
}
|
|
1492
|
-
const
|
|
1503
|
+
const colgroupRef = elemStore[`${name}-${layout}-colgroup`]
|
|
1504
|
+
const colgroupElem = colgroupRef ? colgroupRef.value : null
|
|
1493
1505
|
if (colgroupElem) {
|
|
1494
1506
|
XEUtils.arrayEach(colgroupElem.children, (colElem: any) => {
|
|
1495
1507
|
const colid = colElem.getAttribute('name')
|
|
@@ -1512,7 +1524,8 @@ export default defineComponent({
|
|
|
1512
1524
|
const showTitle = cellOverflow === 'title'
|
|
1513
1525
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
|
|
1514
1526
|
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
1515
|
-
const
|
|
1527
|
+
const listRef = elemStore[`${name}-${layout}-list`]
|
|
1528
|
+
const listElem = listRef ? listRef.value : null
|
|
1516
1529
|
// 纵向虚拟滚动不支持动态行高
|
|
1517
1530
|
if (scrollYLoad && !hasEllipsis) {
|
|
1518
1531
|
hasEllipsis = true
|
|
@@ -1771,7 +1784,7 @@ export default defineComponent({
|
|
|
1771
1784
|
childRecords = []
|
|
1772
1785
|
}
|
|
1773
1786
|
if (childRecords) {
|
|
1774
|
-
tableMethods.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1787
|
+
return tableMethods.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1775
1788
|
if (childRows.length && $xetable.findRowIndexOf(treeExpandeds, row) === -1) {
|
|
1776
1789
|
treeExpandeds.push(row)
|
|
1777
1790
|
}
|
|
@@ -1779,17 +1792,18 @@ export default defineComponent({
|
|
|
1779
1792
|
if (!checkStrictly && tableMethods.isCheckedByCheckboxRow(row)) {
|
|
1780
1793
|
tableMethods.setCheckboxRow(childRows, true)
|
|
1781
1794
|
}
|
|
1782
|
-
nextTick().then(() => {
|
|
1795
|
+
return nextTick().then(() => {
|
|
1783
1796
|
if (transform) {
|
|
1784
1797
|
return tablePrivateMethods.handleTableData()
|
|
1785
1798
|
}
|
|
1786
|
-
})
|
|
1787
|
-
return tableMethods.recalculate()
|
|
1788
|
-
}).then(() => resolve())
|
|
1799
|
+
})
|
|
1789
1800
|
})
|
|
1790
|
-
} else {
|
|
1791
|
-
nextTick().then(() => tableMethods.recalculate()).then(() => resolve())
|
|
1792
1801
|
}
|
|
1802
|
+
}).catch(() => {
|
|
1803
|
+
rest.treeLoaded = false
|
|
1804
|
+
XEUtils.remove(treeLazyLoadeds, item => $xetable.eqRow(item, row))
|
|
1805
|
+
}).finally(() => {
|
|
1806
|
+
nextTick().then(() => tableMethods.recalculate()).then(() => resolve())
|
|
1793
1807
|
})
|
|
1794
1808
|
} else {
|
|
1795
1809
|
resolve()
|
|
@@ -1811,18 +1825,20 @@ export default defineComponent({
|
|
|
1811
1825
|
}
|
|
1812
1826
|
|
|
1813
1827
|
const handleAsyncRowExpand = (row: any): Promise<void> => {
|
|
1814
|
-
const { rowExpandeds, expandLazyLoadeds } = reactData
|
|
1815
1828
|
const { fullAllDataRowIdData } = internalData
|
|
1816
|
-
const rest = fullAllDataRowIdData[getRowid($xetable, row)]
|
|
1817
1829
|
return new Promise(resolve => {
|
|
1818
1830
|
const expandOpts = computeExpandOpts.value
|
|
1819
1831
|
const { loadMethod } = expandOpts
|
|
1820
1832
|
if (loadMethod) {
|
|
1821
|
-
|
|
1822
|
-
|
|
1833
|
+
const rest = fullAllDataRowIdData[getRowid($xetable, row)]
|
|
1834
|
+
reactData.expandLazyLoadeds.push(row)
|
|
1835
|
+
loadMethod({ $table: $xetable, row, rowIndex: tableMethods.getRowIndex(row), $rowIndex: tableMethods.getVMRowIndex(row) }).then(() => {
|
|
1823
1836
|
rest.expandLoaded = true
|
|
1824
|
-
|
|
1825
|
-
|
|
1837
|
+
reactData.rowExpandeds.push(row)
|
|
1838
|
+
}).catch(() => {
|
|
1839
|
+
rest.expandLoaded = false
|
|
1840
|
+
}).finally(() => {
|
|
1841
|
+
XEUtils.remove(reactData.expandLazyLoadeds, item => $xetable.eqRow(item, row))
|
|
1826
1842
|
resolve(nextTick().then(() => tableMethods.recalculate()))
|
|
1827
1843
|
})
|
|
1828
1844
|
} else {
|
|
@@ -2945,21 +2961,13 @@ export default defineComponent({
|
|
|
2945
2961
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2946
2962
|
*/
|
|
2947
2963
|
recalculate (refull?: boolean) {
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
autoCellWidth(headerElem, bodyElem, footerElem)
|
|
2956
|
-
if (refull === true) {
|
|
2957
|
-
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2958
|
-
return computeScrollLoad().then(() => {
|
|
2959
|
-
autoCellWidth(headerElem, bodyElem, footerElem)
|
|
2960
|
-
return computeScrollLoad()
|
|
2961
|
-
})
|
|
2962
|
-
}
|
|
2964
|
+
autoCellWidth()
|
|
2965
|
+
if (refull === true) {
|
|
2966
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2967
|
+
return computeScrollLoad().then(() => {
|
|
2968
|
+
autoCellWidth()
|
|
2969
|
+
return computeScrollLoad()
|
|
2970
|
+
})
|
|
2963
2971
|
}
|
|
2964
2972
|
return computeScrollLoad()
|
|
2965
2973
|
},
|
|
@@ -5338,7 +5346,8 @@ export default defineComponent({
|
|
|
5338
5346
|
containerList.forEach(name => {
|
|
5339
5347
|
const layoutList = ['header', 'body', 'footer']
|
|
5340
5348
|
layoutList.forEach(layout => {
|
|
5341
|
-
const
|
|
5349
|
+
const xSpaceRef = elemStore[`${name}-${layout}-xSpace`]
|
|
5350
|
+
const xSpaceElem = xSpaceRef ? xSpaceRef.value : null
|
|
5342
5351
|
if (xSpaceElem) {
|
|
5343
5352
|
xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : ''
|
|
5344
5353
|
}
|
|
@@ -5363,12 +5372,14 @@ export default defineComponent({
|
|
|
5363
5372
|
}
|
|
5364
5373
|
containerList.forEach(name => {
|
|
5365
5374
|
const layoutList = ['header', 'body', 'footer']
|
|
5366
|
-
const
|
|
5375
|
+
const tableRef = elemStore[`${name}-body-table`]
|
|
5376
|
+
const tableElem = tableRef ? tableRef.value : null
|
|
5367
5377
|
if (tableElem) {
|
|
5368
5378
|
tableElem.style.marginTop = marginTop
|
|
5369
5379
|
}
|
|
5370
5380
|
layoutList.forEach(layout => {
|
|
5371
|
-
const
|
|
5381
|
+
const ySpaceRef = elemStore[`${name}-${layout}-ySpace`]
|
|
5382
|
+
const ySpaceElem = ySpaceRef ? ySpaceRef.value : null
|
|
5372
5383
|
if (ySpaceElem) {
|
|
5373
5384
|
ySpaceElem.style.height = ySpaceHeight
|
|
5374
5385
|
}
|
|
@@ -5377,14 +5388,14 @@ export default defineComponent({
|
|
|
5377
5388
|
nextTick(updateStyle)
|
|
5378
5389
|
},
|
|
5379
5390
|
updateScrollXData () {
|
|
5380
|
-
reactData.tableColumn = []
|
|
5391
|
+
// reactData.tableColumn = []
|
|
5381
5392
|
nextTick(() => {
|
|
5382
5393
|
handleTableColumn()
|
|
5383
5394
|
tablePrivateMethods.updateScrollXSpace()
|
|
5384
5395
|
})
|
|
5385
5396
|
},
|
|
5386
5397
|
updateScrollYData () {
|
|
5387
|
-
reactData.tableData = []
|
|
5398
|
+
// reactData.tableData = []
|
|
5388
5399
|
nextTick(() => {
|
|
5389
5400
|
tablePrivateMethods.handleTableData()
|
|
5390
5401
|
tablePrivateMethods.updateScrollYSpace()
|
package/packages/tools/dom.ts
CHANGED
package/styles/header.scss
CHANGED
package/styles/input.scss
CHANGED
|
@@ -380,6 +380,9 @@ $iconWidth: 1.6em;
|
|
|
380
380
|
position: absolute;
|
|
381
381
|
right: 0;
|
|
382
382
|
top: 0;
|
|
383
|
+
}
|
|
384
|
+
.vxe-input--time-picker-confirm,
|
|
385
|
+
.vxe-input--date-picker-confirm {
|
|
383
386
|
outline: 0;
|
|
384
387
|
border: 1px solid $vxe-input-border-color;
|
|
385
388
|
border-radius: $vxe-border-radius;
|
|
@@ -429,8 +432,6 @@ $iconWidth: 1.6em;
|
|
|
429
432
|
.vxe-input--date-picker-btn {
|
|
430
433
|
display: inline-block;
|
|
431
434
|
display: flex;
|
|
432
|
-
border-radius: $vxe-border-radius;
|
|
433
|
-
border: 1px solid $vxe-input-border-color;
|
|
434
435
|
align-items: center;
|
|
435
436
|
justify-content: center;
|
|
436
437
|
background-color: $vxe-button-default-background-color;
|
|
@@ -496,6 +497,10 @@ $iconWidth: 1.6em;
|
|
|
496
497
|
&.is--selected {
|
|
497
498
|
color: $vxe-input-date-picker-selected-color;
|
|
498
499
|
background-color: $vxe-primary-color;
|
|
500
|
+
&.is--prev,
|
|
501
|
+
&.is--next {
|
|
502
|
+
background-color: lighten($vxe-primary-color, 10%);
|
|
503
|
+
}
|
|
499
504
|
.vxe-input--date-label,
|
|
500
505
|
.vxe-input--date-festival {
|
|
501
506
|
color: $vxe-input-date-picker-festival-selected-color;
|
|
@@ -779,9 +784,15 @@ $iconWidth: 1.6em;
|
|
|
779
784
|
}
|
|
780
785
|
.vxe-input--date-picker-btn-wrapper {
|
|
781
786
|
.vxe-input--date-picker-btn {
|
|
782
|
-
width: 31px - $sizeIndex;
|
|
783
787
|
margin-left: 9px - $sizeIndex;
|
|
784
788
|
}
|
|
789
|
+
.vxe-input--date-picker-prev-btn,
|
|
790
|
+
.vxe-input--date-picker-current-btn,
|
|
791
|
+
.vxe-input--date-picker-next-btn {
|
|
792
|
+
width: 31px - $sizeIndex;
|
|
793
|
+
border-radius: $vxe-border-radius;
|
|
794
|
+
border: 1px solid $vxe-input-border-color;
|
|
795
|
+
}
|
|
785
796
|
}
|
|
786
797
|
.vxe-input--date-picker-type-wrapper {
|
|
787
798
|
.vxe-input--date-picker-label,
|
|
@@ -841,7 +852,8 @@ $iconWidth: 1.6em;
|
|
|
841
852
|
height: nth($titleRowHeightList, $sizeIndex);
|
|
842
853
|
}
|
|
843
854
|
}
|
|
844
|
-
.vxe-input--time-picker-confirm
|
|
855
|
+
.vxe-input--time-picker-confirm,
|
|
856
|
+
.vxe-input--date-picker-confirm {
|
|
845
857
|
height: 31px - $sizeIndex;
|
|
846
858
|
padding: 0 10px - $sizeIndex;
|
|
847
859
|
}
|
package/types/input.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export namespace VxeInputPropTypes {
|
|
|
55
55
|
export type Disabled = boolean
|
|
56
56
|
export type Placeholder = string
|
|
57
57
|
export type Maxlength = string | number
|
|
58
|
+
export type Multiple = boolean
|
|
58
59
|
export type Autocomplete = string
|
|
59
60
|
export type Align = string
|
|
60
61
|
export type Form = string
|
|
@@ -91,6 +92,7 @@ export type VxeInputProps = {
|
|
|
91
92
|
disabled?: VxeInputPropTypes.Disabled
|
|
92
93
|
placeholder?: VxeInputPropTypes.Placeholder
|
|
93
94
|
maxlength?: VxeInputPropTypes.Maxlength
|
|
95
|
+
multiple?: VxeInputPropTypes.Multiple
|
|
94
96
|
autocomplete?: VxeInputPropTypes.Autocomplete
|
|
95
97
|
align?: VxeInputPropTypes.Align
|
|
96
98
|
form?: VxeInputPropTypes.Form
|
|
@@ -140,6 +142,15 @@ export interface InputMethods {
|
|
|
140
142
|
* 失去焦点
|
|
141
143
|
*/
|
|
142
144
|
blur(): Promise<any>
|
|
145
|
+
/**
|
|
146
|
+
* 弹出面板,用于带下拉面板的功能,
|
|
147
|
+
*/
|
|
148
|
+
showPanel(): Promise<any>
|
|
149
|
+
/**
|
|
150
|
+
* 关闭面板,用于带下拉面板的功能,
|
|
151
|
+
*/
|
|
152
|
+
hidePanel(): Promise<any>
|
|
153
|
+
updatePlacement(): Promise<any>
|
|
143
154
|
}
|
|
144
155
|
export interface VxeInputMethods extends InputMethods { }
|
|
145
156
|
|
package/types/table.d.ts
CHANGED
|
@@ -927,7 +927,9 @@ export interface TableReactData {
|
|
|
927
927
|
|
|
928
928
|
export interface TableInternalData {
|
|
929
929
|
tZindex: number
|
|
930
|
-
elemStore:
|
|
930
|
+
elemStore: {
|
|
931
|
+
[key: string]: Ref<HTMLElement> | null
|
|
932
|
+
}
|
|
931
933
|
// 存放横向 X 虚拟滚动相关的信息
|
|
932
934
|
scrollXStore: {
|
|
933
935
|
offsetSize: number
|