vxe-table 3.4.14-beta.0 → 3.4.14
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/lib/export/style/style.css +2 -0
- package/lib/export/style/style.min.css +1 -1
- package/lib/filter/src/mixin.js +24 -13
- package/lib/filter/src/mixin.min.js +1 -1
- package/lib/filter/style/style.css +2 -0
- package/lib/filter/style/style.min.css +1 -1
- package/lib/index.css +1 -1
- package/lib/index.umd.js +483 -348
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/date.js +54 -0
- package/lib/input/src/date.min.js +1 -0
- package/lib/input/src/input.js +12 -59
- package/lib/input/src/input.min.js +1 -1
- package/lib/input/src/number.js +23 -0
- package/lib/input/src/number.min.js +1 -0
- package/lib/pager/src/pager.js +15 -1
- package/lib/pager/src/pager.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/table/src/body.js +36 -10
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/cell.js +5 -6
- package/lib/table/src/cell.min.js +1 -1
- package/lib/table/src/methods.js +364 -300
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/style/style.css +2 -0
- package/lib/table/style/style.min.css +1 -1
- package/lib/toolbar/style/style.css +2 -0
- package/lib/toolbar/style/style.min.css +1 -1
- package/lib/tools/src/dom.js +14 -1
- package/lib/tools/src/dom.min.js +1 -1
- package/package.json +1 -1
- package/packages/filter/src/mixin.js +17 -10
- package/packages/input/src/date.js +38 -0
- package/packages/input/src/input.js +4 -46
- package/packages/input/src/number.js +12 -0
- package/packages/pager/src/pager.js +15 -1
- package/packages/table/src/body.js +32 -11
- package/packages/table/src/cell.js +4 -6
- package/packages/table/src/methods.js +70 -19
- package/packages/tools/src/dom.js +13 -1
- package/styles/base/checked.scss +5 -0
|
@@ -352,25 +352,23 @@ export const Cell = {
|
|
|
352
352
|
*/
|
|
353
353
|
renderCheckboxHeader (h, params) {
|
|
354
354
|
const { $table, column, isHidden } = params
|
|
355
|
-
const { isIndeterminate: isAllCheckboxIndeterminate, isAllCheckboxDisabled } = $table
|
|
355
|
+
const { isAllSelected: isAllCheckboxSelected, isIndeterminate: isAllCheckboxIndeterminate, isAllCheckboxDisabled } = $table
|
|
356
356
|
const { slots } = column
|
|
357
357
|
const headerSlot = slots ? slots.header : null
|
|
358
358
|
const titleSlot = slots ? slots.title : null
|
|
359
359
|
const checkboxOpts = $table.checkboxOpts
|
|
360
360
|
const headerTitle = column.getTitle()
|
|
361
|
-
let isChecked = false
|
|
362
361
|
let on
|
|
363
362
|
if (!isHidden) {
|
|
364
|
-
isChecked = isAllCheckboxDisabled ? false : $table.isAllSelected
|
|
365
363
|
on = {
|
|
366
364
|
click (evnt) {
|
|
367
365
|
if (!isAllCheckboxDisabled) {
|
|
368
|
-
$table.triggerCheckAllEvent(evnt, !
|
|
366
|
+
$table.triggerCheckAllEvent(evnt, !isAllCheckboxSelected)
|
|
369
367
|
}
|
|
370
368
|
}
|
|
371
369
|
}
|
|
372
370
|
}
|
|
373
|
-
const checkboxParams = { ...params, checked:
|
|
371
|
+
const checkboxParams = { ...params, checked: isAllCheckboxSelected, disabled: isAllCheckboxDisabled, indeterminate: isAllCheckboxIndeterminate }
|
|
374
372
|
if (headerSlot) {
|
|
375
373
|
return renderTitleContent(h, checkboxParams, $table.callSlot(headerSlot, checkboxParams, h))
|
|
376
374
|
}
|
|
@@ -384,7 +382,7 @@ export const Cell = {
|
|
|
384
382
|
return renderTitleContent(h, checkboxParams, [
|
|
385
383
|
h('span', {
|
|
386
384
|
class: ['vxe-cell--checkbox', {
|
|
387
|
-
'is--checked':
|
|
385
|
+
'is--checked': isAllCheckboxSelected,
|
|
388
386
|
'is--disabled': isAllCheckboxDisabled,
|
|
389
387
|
'is--indeterminate': isAllCheckboxIndeterminate
|
|
390
388
|
}],
|
|
@@ -9,7 +9,7 @@ import { browse, getPaddingTopBottomSize, setScrollTop, setScrollLeft } from '..
|
|
|
9
9
|
import { formats } from '../../v-x-e-table/src/formats'
|
|
10
10
|
|
|
11
11
|
const { getRowid, getRowkey, setCellValue, hasChildrenList, getColumnList } = UtilTools
|
|
12
|
-
const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode } = DomTools
|
|
12
|
+
const { calcHeight, hasClass, addClass, removeClass, getEventTargetNode, isNodeElement } = DomTools
|
|
13
13
|
|
|
14
14
|
const isWebkit = browse['-webkit'] && !browse.edge
|
|
15
15
|
const debounceScrollYDuration = browse.msie ? 80 : 20
|
|
@@ -294,11 +294,30 @@ const Methods = {
|
|
|
294
294
|
})
|
|
295
295
|
},
|
|
296
296
|
/**
|
|
297
|
-
*
|
|
297
|
+
* 手动处理数据,用于手动排序与筛选
|
|
298
298
|
* 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
|
|
299
299
|
*/
|
|
300
300
|
updateData () {
|
|
301
|
-
|
|
301
|
+
const { scrollXLoad, scrollYLoad } = this
|
|
302
|
+
return this.handleTableData(true).then(() => {
|
|
303
|
+
this.updateFooter()
|
|
304
|
+
this.checkSelectionStatus()
|
|
305
|
+
if (scrollXLoad || scrollYLoad) {
|
|
306
|
+
if (scrollXLoad) {
|
|
307
|
+
this.updateScrollXSpace()
|
|
308
|
+
}
|
|
309
|
+
if (scrollYLoad) {
|
|
310
|
+
this.updateScrollYSpace()
|
|
311
|
+
}
|
|
312
|
+
return this.refreshScroll()
|
|
313
|
+
}
|
|
314
|
+
}).then(() => {
|
|
315
|
+
this.updateCellAreas()
|
|
316
|
+
return this.recalculate(true)
|
|
317
|
+
}).then(() => {
|
|
318
|
+
// 存在滚动行为未结束情况
|
|
319
|
+
setTimeout(() => this.recalculate(), 50)
|
|
320
|
+
})
|
|
302
321
|
},
|
|
303
322
|
handleTableData (force) {
|
|
304
323
|
const { scrollYLoad, scrollYStore, fullDataRowIdData, afterFullData } = this
|
|
@@ -1688,15 +1707,22 @@ const Methods = {
|
|
|
1688
1707
|
const leftBodyElem = leftBody ? leftBody.$el : null
|
|
1689
1708
|
const rightBodyElem = rightBody ? rightBody.$el : null
|
|
1690
1709
|
const tableFooterElem = tableFooter ? tableFooter.$el : null
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1710
|
+
return new Promise(resolve => {
|
|
1711
|
+
// 还原滚动条位置
|
|
1712
|
+
if (lastScrollLeft || lastScrollTop) {
|
|
1713
|
+
return restoreScrollLocation(this, lastScrollLeft, lastScrollTop).then(() => {
|
|
1714
|
+
// 存在滚动行为未结束情况
|
|
1715
|
+
setTimeout(resolve, 30)
|
|
1716
|
+
})
|
|
1717
|
+
}
|
|
1718
|
+
// 重置
|
|
1719
|
+
setScrollTop(tableBodyElem, lastScrollTop)
|
|
1720
|
+
setScrollTop(leftBodyElem, lastScrollTop)
|
|
1721
|
+
setScrollTop(rightBodyElem, lastScrollTop)
|
|
1722
|
+
setScrollLeft(tableFooterElem, lastScrollLeft)
|
|
1723
|
+
// 存在滚动行为未结束情况
|
|
1724
|
+
setTimeout(resolve, 30)
|
|
1725
|
+
})
|
|
1700
1726
|
},
|
|
1701
1727
|
/**
|
|
1702
1728
|
* 计算单元格列宽,动态分配可用剩余空间
|
|
@@ -1965,7 +1991,7 @@ const Methods = {
|
|
|
1965
1991
|
}
|
|
1966
1992
|
} else if (layout === 'body') {
|
|
1967
1993
|
const emptyBlockElem = elemStore[`${name}-${layout}-emptyBlock`]
|
|
1968
|
-
if (wrapperElem) {
|
|
1994
|
+
if (isNodeElement(wrapperElem)) {
|
|
1969
1995
|
if (customMaxHeight) {
|
|
1970
1996
|
wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight}px`
|
|
1971
1997
|
} else {
|
|
@@ -1981,7 +2007,7 @@ const Methods = {
|
|
|
1981
2007
|
if (fixedWrapperElem) {
|
|
1982
2008
|
const isRightFixed = fixedType === 'right'
|
|
1983
2009
|
const fixedColumn = columnStore[`${fixedType}List`]
|
|
1984
|
-
if (wrapperElem) {
|
|
2010
|
+
if (isNodeElement(wrapperElem)) {
|
|
1985
2011
|
wrapperElem.style.top = `${headerHeight}px`
|
|
1986
2012
|
}
|
|
1987
2013
|
fixedWrapperElem.style.height = `${(customHeight > 0 ? customHeight - headerHeight - footerHeight : tableHeight) + headerHeight + footerHeight - scrollbarHeight * (showFooter ? 2 : 1)}px`
|
|
@@ -2045,7 +2071,7 @@ const Methods = {
|
|
|
2045
2071
|
}
|
|
2046
2072
|
tWidth = tableColumn.reduce((previous, column) => previous + column.renderWidth, 0)
|
|
2047
2073
|
|
|
2048
|
-
if (wrapperElem) {
|
|
2074
|
+
if (isNodeElement(wrapperElem)) {
|
|
2049
2075
|
// 如果是固定列
|
|
2050
2076
|
if (fixedWrapperElem) {
|
|
2051
2077
|
wrapperElem.style.top = `${customHeight > 0 ? customHeight - footerHeight : tableHeight + headerHeight}px`
|
|
@@ -2964,14 +2990,28 @@ const Methods = {
|
|
|
2964
2990
|
const { afterFullData, selection, treeIndeterminates, checkboxOpts, treeConfig } = this
|
|
2965
2991
|
const { checkField, halfField, checkStrictly, checkMethod } = checkboxOpts
|
|
2966
2992
|
if (!checkStrictly) {
|
|
2993
|
+
const disableRows = []
|
|
2994
|
+
const checkRows = []
|
|
2995
|
+
let isAllResolve = false
|
|
2967
2996
|
let isAllSelected = false
|
|
2968
2997
|
let isIndeterminate = false
|
|
2969
2998
|
if (checkField) {
|
|
2970
|
-
|
|
2999
|
+
isAllResolve = afterFullData.every(
|
|
2971
3000
|
checkMethod
|
|
2972
|
-
? (row) =>
|
|
3001
|
+
? (row) => {
|
|
3002
|
+
if (!checkMethod({ row })) {
|
|
3003
|
+
disableRows.push(row)
|
|
3004
|
+
return true
|
|
3005
|
+
}
|
|
3006
|
+
if (XEUtils.get(row, checkField)) {
|
|
3007
|
+
checkRows.push(row)
|
|
3008
|
+
return true
|
|
3009
|
+
}
|
|
3010
|
+
return false
|
|
3011
|
+
}
|
|
2973
3012
|
: row => XEUtils.get(row, checkField)
|
|
2974
3013
|
)
|
|
3014
|
+
isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
|
|
2975
3015
|
if (treeConfig) {
|
|
2976
3016
|
if (halfField) {
|
|
2977
3017
|
isIndeterminate = !isAllSelected && afterFullData.some(row => XEUtils.get(row, checkField) || XEUtils.get(row, halfField) || treeIndeterminates.indexOf(row) > -1)
|
|
@@ -2986,11 +3026,22 @@ const Methods = {
|
|
|
2986
3026
|
}
|
|
2987
3027
|
}
|
|
2988
3028
|
} else {
|
|
2989
|
-
|
|
3029
|
+
isAllResolve = afterFullData.every(
|
|
2990
3030
|
checkMethod
|
|
2991
|
-
? (row) =>
|
|
3031
|
+
? (row) => {
|
|
3032
|
+
if (!checkMethod({ row })) {
|
|
3033
|
+
disableRows.push(row)
|
|
3034
|
+
return true
|
|
3035
|
+
}
|
|
3036
|
+
if (selection.indexOf(row) > -1) {
|
|
3037
|
+
checkRows.push(row)
|
|
3038
|
+
return true
|
|
3039
|
+
}
|
|
3040
|
+
return false
|
|
3041
|
+
}
|
|
2992
3042
|
: row => selection.indexOf(row) > -1
|
|
2993
3043
|
)
|
|
3044
|
+
isAllSelected = isAllResolve && afterFullData.length !== disableRows.length
|
|
2994
3045
|
if (treeConfig) {
|
|
2995
3046
|
isIndeterminate = !isAllSelected && afterFullData.some(row => treeIndeterminates.indexOf(row) > -1 || selection.indexOf(row) > -1)
|
|
2996
3047
|
} else {
|
|
@@ -80,6 +80,17 @@ export function setScrollLeft (elem, scrollLeft) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
+
export function setScrollLeftAndTop (elem, scrollLeft, scrollTop) {
|
|
84
|
+
if (elem) {
|
|
85
|
+
elem.scrollLeft = scrollLeft
|
|
86
|
+
elem.scrollTop = scrollTop
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isNodeElement (elem) {
|
|
91
|
+
return elem && elem.nodeType === 1
|
|
92
|
+
}
|
|
93
|
+
|
|
83
94
|
export const DomTools = {
|
|
84
95
|
browse,
|
|
85
96
|
isPx (val) {
|
|
@@ -225,7 +236,8 @@ export const DomTools = {
|
|
|
225
236
|
}
|
|
226
237
|
}
|
|
227
238
|
return num
|
|
228
|
-
}
|
|
239
|
+
},
|
|
240
|
+
isNodeElement
|
|
229
241
|
}
|
|
230
242
|
|
|
231
243
|
export default DomTools
|