vxe-table 3.18.0-beta.7 → 3.18.0
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/locale/lang/ar-EG.js +30 -0
- package/es/locale/lang/de-DE.js +30 -0
- package/es/locale/lang/en-US.js +42 -12
- package/es/locale/lang/es-ES.js +30 -0
- package/es/locale/lang/fr-FR.js +30 -0
- package/es/locale/lang/hu-HU.js +30 -0
- package/es/locale/lang/hy-AM.js +30 -0
- package/es/locale/lang/id-ID.js +30 -0
- package/es/locale/lang/it-IT.js +30 -0
- package/es/locale/lang/ja-JP.js +30 -0
- package/es/locale/lang/ko-KR.js +30 -0
- package/es/locale/lang/ms-MY.js +30 -0
- package/es/locale/lang/nb-NO.js +30 -0
- package/es/locale/lang/pt-BR.js +30 -0
- package/es/locale/lang/ru-RU.js +30 -0
- package/es/locale/lang/th-TH.js +30 -0
- package/es/locale/lang/ug-CN.js +30 -0
- package/es/locale/lang/uk-UA.js +30 -0
- package/es/locale/lang/uz-UZ.js +30 -0
- package/es/locale/lang/vi-VN.js +30 -0
- package/es/locale/lang/zh-CHT.js +30 -0
- package/es/locale/lang/zh-CN.js +32 -0
- package/es/style.css +1 -1
- package/es/table/module/keyboard/mixin.js +175 -172
- package/es/table/src/footer.js +2 -2
- package/es/table/src/header.js +2 -2
- package/es/table/src/table.js +22 -3
- package/es/table/src/util.js +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +244 -192
- package/lib/index.umd.min.js +1 -1
- package/lib/locale/lang/ar-EG.js +30 -0
- package/lib/locale/lang/ar-EG.min.js +1 -1
- package/lib/locale/lang/ar-EG.umd.js +30 -0
- package/lib/locale/lang/de-DE.js +30 -0
- package/lib/locale/lang/de-DE.min.js +1 -1
- package/lib/locale/lang/de-DE.umd.js +30 -0
- package/lib/locale/lang/en-US.js +42 -12
- package/lib/locale/lang/en-US.min.js +1 -1
- package/lib/locale/lang/en-US.umd.js +42 -12
- package/lib/locale/lang/es-ES.js +30 -0
- package/lib/locale/lang/es-ES.min.js +1 -1
- package/lib/locale/lang/es-ES.umd.js +30 -0
- package/lib/locale/lang/fr-FR.js +30 -0
- package/lib/locale/lang/fr-FR.min.js +1 -1
- package/lib/locale/lang/fr-FR.umd.js +30 -0
- package/lib/locale/lang/hu-HU.js +30 -0
- package/lib/locale/lang/hu-HU.min.js +1 -1
- package/lib/locale/lang/hu-HU.umd.js +30 -0
- package/lib/locale/lang/hy-AM.js +30 -0
- package/lib/locale/lang/hy-AM.min.js +1 -1
- package/lib/locale/lang/hy-AM.umd.js +30 -0
- package/lib/locale/lang/id-ID.js +30 -0
- package/lib/locale/lang/id-ID.min.js +1 -1
- package/lib/locale/lang/id-ID.umd.js +30 -0
- package/lib/locale/lang/it-IT.js +30 -0
- package/lib/locale/lang/it-IT.min.js +1 -1
- package/lib/locale/lang/it-IT.umd.js +30 -0
- package/lib/locale/lang/ja-JP.js +30 -0
- package/lib/locale/lang/ja-JP.min.js +1 -1
- package/lib/locale/lang/ja-JP.umd.js +30 -0
- package/lib/locale/lang/ko-KR.js +30 -0
- package/lib/locale/lang/ko-KR.min.js +1 -1
- package/lib/locale/lang/ko-KR.umd.js +30 -0
- package/lib/locale/lang/ms-MY.js +30 -0
- package/lib/locale/lang/ms-MY.min.js +1 -1
- package/lib/locale/lang/ms-MY.umd.js +30 -0
- package/lib/locale/lang/nb-NO.js +30 -0
- package/lib/locale/lang/nb-NO.min.js +1 -1
- package/lib/locale/lang/nb-NO.umd.js +30 -0
- package/lib/locale/lang/pt-BR.js +30 -0
- package/lib/locale/lang/pt-BR.min.js +1 -1
- package/lib/locale/lang/pt-BR.umd.js +30 -0
- package/lib/locale/lang/ru-RU.js +30 -0
- package/lib/locale/lang/ru-RU.min.js +1 -1
- package/lib/locale/lang/ru-RU.umd.js +30 -0
- package/lib/locale/lang/th-TH.js +30 -0
- package/lib/locale/lang/th-TH.min.js +1 -1
- package/lib/locale/lang/th-TH.umd.js +30 -0
- package/lib/locale/lang/ug-CN.js +30 -0
- package/lib/locale/lang/ug-CN.min.js +1 -1
- package/lib/locale/lang/ug-CN.umd.js +30 -0
- package/lib/locale/lang/uk-UA.js +30 -0
- package/lib/locale/lang/uk-UA.min.js +1 -1
- package/lib/locale/lang/uk-UA.umd.js +30 -0
- package/lib/locale/lang/uz-UZ.js +30 -0
- package/lib/locale/lang/uz-UZ.min.js +1 -1
- package/lib/locale/lang/uz-UZ.umd.js +30 -0
- package/lib/locale/lang/vi-VN.js +30 -0
- package/lib/locale/lang/vi-VN.min.js +1 -1
- package/lib/locale/lang/vi-VN.umd.js +30 -0
- package/lib/locale/lang/zh-CHT.js +30 -0
- package/lib/locale/lang/zh-CHT.min.js +1 -1
- package/lib/locale/lang/zh-CHT.umd.js +30 -0
- package/lib/locale/lang/zh-CN.js +32 -0
- package/lib/locale/lang/zh-CN.min.js +1 -1
- package/lib/locale/lang/zh-CN.umd.js +32 -0
- package/lib/style.css +1 -1
- package/lib/table/module/keyboard/mixin.js +184 -185
- package/lib/table/module/keyboard/mixin.min.js +1 -1
- package/lib/table/src/footer.js +1 -1
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/header.js +1 -1
- package/lib/table/src/header.min.js +1 -1
- package/lib/table/src/table.js +23 -2
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +2 -2
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/package.json +1 -1
- package/packages/locale/lang/ar-EG.ts +30 -0
- package/packages/locale/lang/de-DE.ts +30 -0
- package/packages/locale/lang/en-US.ts +42 -12
- package/packages/locale/lang/es-ES.ts +30 -0
- package/packages/locale/lang/fr-FR.ts +30 -0
- package/packages/locale/lang/hu-HU.ts +30 -0
- package/packages/locale/lang/hy-AM.ts +30 -0
- package/packages/locale/lang/id-ID.ts +30 -0
- package/packages/locale/lang/it-IT.ts +30 -0
- package/packages/locale/lang/ja-JP.ts +30 -0
- package/packages/locale/lang/ko-KR.ts +30 -0
- package/packages/locale/lang/ms-MY.ts +30 -0
- package/packages/locale/lang/nb-NO.ts +30 -0
- package/packages/locale/lang/pt-BR.ts +30 -0
- package/packages/locale/lang/ru-RU.ts +30 -0
- package/packages/locale/lang/th-TH.ts +30 -0
- package/packages/locale/lang/ug-CN.ts +30 -0
- package/packages/locale/lang/uk-UA.ts +30 -0
- package/packages/locale/lang/uz-UZ.ts +30 -0
- package/packages/locale/lang/vi-VN.ts +30 -0
- package/packages/locale/lang/zh-CHT.ts +30 -0
- package/packages/locale/lang/zh-CN.ts +32 -0
- package/packages/table/module/keyboard/mixin.ts +169 -165
- package/packages/table/src/footer.ts +2 -2
- package/packages/table/src/header.ts +2 -2
- package/packages/table/src/table.ts +23 -3
- package/packages/table/src/util.ts +1 -1
- /package/es/{iconfont.1755650997091.ttf → iconfont.1756083626568.ttf} +0 -0
- /package/es/{iconfont.1755650997091.woff → iconfont.1756083626568.woff} +0 -0
- /package/es/{iconfont.1755650997091.woff2 → iconfont.1756083626568.woff2} +0 -0
- /package/lib/{iconfont.1755650997091.ttf → iconfont.1756083626568.ttf} +0 -0
- /package/lib/{iconfont.1755650997091.woff → iconfont.1756083626568.woff} +0 -0
- /package/lib/{iconfont.1755650997091.woff2 → iconfont.1756083626568.woff2} +0 -0
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
coverProp: 'Tham số "{1}" của "{0}" được xác định nhiều lần, có thể gây ra lỗi',
|
|
45
45
|
uniField: 'Tên trường "{0}" được xác định nhiều lần, có thể gây ra lỗi',
|
|
46
46
|
repeatKey: 'Lặp lại khóa chính {0} = "{1}", có thể gây ra lỗi',
|
|
47
|
+
repeatProp: '参数重复 {0}="{1}",这可能会出现错误',
|
|
47
48
|
delFunc: 'Phương thức "{0}" không được dùng nữa, vui lòng sử dụng "{1}"',
|
|
48
49
|
delProp: 'Tham số "{0}" không được dùng, vui lòng sử dụng "{1}"',
|
|
49
50
|
delEvent: 'Sự kiện "{0}" được không dùng nữa, vui lòng sử dụng "{1}"',
|
|
@@ -536,6 +537,35 @@ export default {
|
|
|
536
537
|
ss: 'Thứ hai'
|
|
537
538
|
}
|
|
538
539
|
},
|
|
540
|
+
gantt: {
|
|
541
|
+
tFullFormat: {
|
|
542
|
+
year: '{yy}年',
|
|
543
|
+
quarter: '{yy}年第{q}季度',
|
|
544
|
+
month: '{yy}年{M}月',
|
|
545
|
+
week: '{yy}年第{W}周',
|
|
546
|
+
day: '{yy}年{M}月{d}日',
|
|
547
|
+
hour: '{yy}年 {M}月{d}日{H}时',
|
|
548
|
+
minute: '{yy}年{M}月{d}日{H}时{m}分'
|
|
549
|
+
},
|
|
550
|
+
tSimpleFormat: {
|
|
551
|
+
year: '{yy}年',
|
|
552
|
+
quarter: '{q}季度',
|
|
553
|
+
month: '{M}月',
|
|
554
|
+
week: '{W}周',
|
|
555
|
+
day: '{d}',
|
|
556
|
+
hour: '{H}时',
|
|
557
|
+
minute: '{m}分'
|
|
558
|
+
},
|
|
559
|
+
dayss: {
|
|
560
|
+
w0: '日',
|
|
561
|
+
w1: '一',
|
|
562
|
+
w2: '二',
|
|
563
|
+
w3: '三',
|
|
564
|
+
w4: '四',
|
|
565
|
+
w5: '五',
|
|
566
|
+
w6: '六'
|
|
567
|
+
}
|
|
568
|
+
},
|
|
539
569
|
plugins: {
|
|
540
570
|
extendCellArea: {
|
|
541
571
|
area: {
|
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
coverProp: '"{0}" 的參數 "{1}" 重複定義,這可能會出現錯誤',
|
|
45
45
|
uniField: '字段名 "{0}" 重複定義,這可能會出現錯誤',
|
|
46
46
|
repeatKey: '主鍵重複 {0}="{1}",這可能會出現錯誤',
|
|
47
|
+
repeatProp: '参数重复 {0}="{1}",这可能会出现错误',
|
|
47
48
|
delFunc: '方法 "{0}" 已廢棄,請使用 "{1}"',
|
|
48
49
|
delProp: '參數 "{0}" 已廢棄,請使用 "{1}"',
|
|
49
50
|
delEvent: '事件 "{0}" 已廢棄,請使用 "{1}"',
|
|
@@ -536,6 +537,35 @@ export default {
|
|
|
536
537
|
ss: '秒'
|
|
537
538
|
}
|
|
538
539
|
},
|
|
540
|
+
gantt: {
|
|
541
|
+
tFullFormat: {
|
|
542
|
+
year: '{yy}年',
|
|
543
|
+
quarter: '{yy}年第{q}季度',
|
|
544
|
+
month: '{yy}年{M}月',
|
|
545
|
+
week: '{yy}年第{W}周',
|
|
546
|
+
day: '{yy}年{M}月{d}日',
|
|
547
|
+
hour: '{yy}年 {M}月{d}日{H}时',
|
|
548
|
+
minute: '{yy}年{M}月{d}日{H}时{m}分'
|
|
549
|
+
},
|
|
550
|
+
tSimpleFormat: {
|
|
551
|
+
year: '{yy}年',
|
|
552
|
+
quarter: '{q}季度',
|
|
553
|
+
month: '{M}月',
|
|
554
|
+
week: '{W}周',
|
|
555
|
+
day: '{d}',
|
|
556
|
+
hour: '{H}时',
|
|
557
|
+
minute: '{m}分'
|
|
558
|
+
},
|
|
559
|
+
dayss: {
|
|
560
|
+
w0: '日',
|
|
561
|
+
w1: '一',
|
|
562
|
+
w2: '二',
|
|
563
|
+
w3: '三',
|
|
564
|
+
w4: '四',
|
|
565
|
+
w5: '五',
|
|
566
|
+
w6: '六'
|
|
567
|
+
}
|
|
568
|
+
},
|
|
539
569
|
plugins: {
|
|
540
570
|
extendCellArea: {
|
|
541
571
|
area: {
|
|
@@ -44,6 +44,7 @@ export default {
|
|
|
44
44
|
coverProp: '"{0}" 的参数 "{1}" 重复定义,这可能会出现错误',
|
|
45
45
|
uniField: '字段名 "{0}" 重复定义,这可能会出现错误',
|
|
46
46
|
repeatKey: '主键重复 {0}="{1}",这可能会出现错误',
|
|
47
|
+
repeatProp: '参数重复 {0}="{1}",这可能会出现错误',
|
|
47
48
|
delFunc: '方法 "{0}" 已废弃,请使用 "{1}"',
|
|
48
49
|
delProp: '参数 "{0}" 已废弃,请使用 "{1}"',
|
|
49
50
|
delEvent: '事件 "{0}" 已废弃,请使用 "{1}"',
|
|
@@ -536,6 +537,37 @@ export default {
|
|
|
536
537
|
ss: '秒'
|
|
537
538
|
}
|
|
538
539
|
},
|
|
540
|
+
gantt: {
|
|
541
|
+
tFullFormat: {
|
|
542
|
+
year: '{yy}年',
|
|
543
|
+
quarter: '{yy}年第{q}季度',
|
|
544
|
+
month: '{yy}年{M}月',
|
|
545
|
+
week: '{yy}年第{W}周',
|
|
546
|
+
day: '{yy}年{M}月{E}日',
|
|
547
|
+
date: '{yy}年{M}月{d}日',
|
|
548
|
+
hour: '{yy}年 {M}月{d}日{H}时',
|
|
549
|
+
minute: '{yy}年{M}月{d}日{H}时{m}分'
|
|
550
|
+
},
|
|
551
|
+
tSimpleFormat: {
|
|
552
|
+
year: '{yy}年',
|
|
553
|
+
quarter: '{q}季度',
|
|
554
|
+
month: '{M}月',
|
|
555
|
+
week: '{W}周',
|
|
556
|
+
day: '{d}',
|
|
557
|
+
date: '{d}',
|
|
558
|
+
hour: '{H}时',
|
|
559
|
+
minute: '{m}分'
|
|
560
|
+
},
|
|
561
|
+
dayss: {
|
|
562
|
+
w0: '日',
|
|
563
|
+
w1: '一',
|
|
564
|
+
w2: '二',
|
|
565
|
+
w3: '三',
|
|
566
|
+
w4: '四',
|
|
567
|
+
w5: '五',
|
|
568
|
+
w6: '六'
|
|
569
|
+
}
|
|
570
|
+
},
|
|
539
571
|
plugins: {
|
|
540
572
|
extendCellArea: {
|
|
541
573
|
area: {
|
|
@@ -130,6 +130,167 @@ function handleMoveSelected ($xeTable: VxeTableConstructor & VxeTablePrivateMeth
|
|
|
130
130
|
return params
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
function handleCheckboxRangeEvent ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, evnt: any, params: any) {
|
|
134
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
135
|
+
|
|
136
|
+
const { elemStore } = internalData
|
|
137
|
+
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
138
|
+
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
139
|
+
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
140
|
+
const { column, cell } = params
|
|
141
|
+
if (column.type === 'checkbox') {
|
|
142
|
+
let bodyWrapperElem = bodyScrollElem as HTMLElement
|
|
143
|
+
if (leftScrollElem && column.fixed === 'left') {
|
|
144
|
+
bodyWrapperElem = leftScrollElem
|
|
145
|
+
} else if (rightScrollElem && column.fixed === 'right') {
|
|
146
|
+
bodyWrapperElem = rightScrollElem
|
|
147
|
+
}
|
|
148
|
+
if (!bodyWrapperElem) {
|
|
149
|
+
return
|
|
150
|
+
}
|
|
151
|
+
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
152
|
+
const disX = evnt.clientX
|
|
153
|
+
const disY = evnt.clientY
|
|
154
|
+
const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range') as HTMLElement
|
|
155
|
+
const trElem = cell.parentNode
|
|
156
|
+
const selectRecords = $xeTable.getCheckboxRecords()
|
|
157
|
+
let lastRangeRows = []
|
|
158
|
+
const marginSize = 1
|
|
159
|
+
const offsetRest = getTargetOffset(evnt.target, bodyWrapperElem)
|
|
160
|
+
const startTop = offsetRest.offsetTop + evnt.offsetY
|
|
161
|
+
const startLeft = offsetRest.offsetLeft + evnt.offsetX
|
|
162
|
+
const startScrollTop = bodyWrapperElem.scrollTop
|
|
163
|
+
const rowHeight = trElem.offsetHeight
|
|
164
|
+
const trRect = trElem.getBoundingClientRect()
|
|
165
|
+
const offsetClientTop = disY - trRect.y
|
|
166
|
+
let mouseScrollTimeout: any = null
|
|
167
|
+
let isMouseScrollDown: any = false
|
|
168
|
+
let mouseScrollSpaceSize = 1
|
|
169
|
+
const triggerEvent = (type: any, evnt: any) => {
|
|
170
|
+
$xeTable.dispatchEvent(`checkbox-range-${type}` as 'checkbox-range-change' | 'checkbox-range-start' | 'checkbox-range-end', {
|
|
171
|
+
records: () => $xeTable.getCheckboxRecords(),
|
|
172
|
+
reserves: () => $xeTable.getCheckboxReserveRecords()
|
|
173
|
+
}, evnt)
|
|
174
|
+
}
|
|
175
|
+
const handleChecked = (evnt: any) => {
|
|
176
|
+
const { clientX, clientY } = evnt
|
|
177
|
+
const offsetLeft = clientX - disX
|
|
178
|
+
const offsetTop = clientY - disY + (bodyWrapperElem.scrollTop - startScrollTop)
|
|
179
|
+
let rangeHeight = Math.abs(offsetTop)
|
|
180
|
+
let rangeWidth = Math.abs(offsetLeft)
|
|
181
|
+
let rangeTop = startTop
|
|
182
|
+
let rangeLeft = startLeft
|
|
183
|
+
if (offsetTop < marginSize) {
|
|
184
|
+
// 向上
|
|
185
|
+
rangeTop += offsetTop
|
|
186
|
+
if (rangeTop < marginSize) {
|
|
187
|
+
rangeTop = marginSize
|
|
188
|
+
rangeHeight = startTop
|
|
189
|
+
}
|
|
190
|
+
} else {
|
|
191
|
+
// 向下
|
|
192
|
+
rangeHeight = Math.min(rangeHeight, bodyWrapperElem.scrollHeight - startTop - marginSize)
|
|
193
|
+
}
|
|
194
|
+
if (offsetLeft < marginSize) {
|
|
195
|
+
// 向左
|
|
196
|
+
rangeLeft += offsetLeft
|
|
197
|
+
if (rangeWidth > startLeft) {
|
|
198
|
+
rangeLeft = marginSize
|
|
199
|
+
rangeWidth = startLeft
|
|
200
|
+
}
|
|
201
|
+
} else {
|
|
202
|
+
// 向右
|
|
203
|
+
rangeWidth = Math.min(rangeWidth, bodyWrapperElem.clientWidth - startLeft - marginSize)
|
|
204
|
+
}
|
|
205
|
+
checkboxRangeElem.style.height = `${rangeHeight}px`
|
|
206
|
+
checkboxRangeElem.style.width = `${rangeWidth}px`
|
|
207
|
+
checkboxRangeElem.style.left = `${rangeLeft}px`
|
|
208
|
+
checkboxRangeElem.style.top = `${rangeTop}px`
|
|
209
|
+
checkboxRangeElem.style.display = 'block'
|
|
210
|
+
const rangeRows = getCheckboxRangeRows($xeTable, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight)
|
|
211
|
+
// 至少滑动 10px 才能有效匹配
|
|
212
|
+
if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
|
|
213
|
+
const isControlKey = hasControlKey(evnt)
|
|
214
|
+
lastRangeRows = rangeRows
|
|
215
|
+
if (isControlKey) {
|
|
216
|
+
rangeRows.forEach((row: any) => {
|
|
217
|
+
$xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1)
|
|
218
|
+
})
|
|
219
|
+
} else {
|
|
220
|
+
$xeTable.setAllCheckboxRow(false)
|
|
221
|
+
$xeTable.handleCheckedCheckboxRow(rangeRows, true, false)
|
|
222
|
+
}
|
|
223
|
+
triggerEvent('change', evnt)
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// 停止鼠标滚动
|
|
227
|
+
const stopMouseScroll = () => {
|
|
228
|
+
clearTimeout(mouseScrollTimeout)
|
|
229
|
+
mouseScrollTimeout = null
|
|
230
|
+
}
|
|
231
|
+
// 开始鼠标滚动
|
|
232
|
+
const startMouseScroll = (evnt: any) => {
|
|
233
|
+
stopMouseScroll()
|
|
234
|
+
mouseScrollTimeout = setTimeout(() => {
|
|
235
|
+
if (mouseScrollTimeout) {
|
|
236
|
+
const { scrollLeft, scrollTop, clientHeight, scrollHeight } = bodyWrapperElem
|
|
237
|
+
const topSize = Math.ceil(mouseScrollSpaceSize * 50 / rowHeight)
|
|
238
|
+
if (isMouseScrollDown) {
|
|
239
|
+
if (scrollTop + clientHeight < scrollHeight) {
|
|
240
|
+
$xeTable.scrollTo(scrollLeft, scrollTop + topSize)
|
|
241
|
+
startMouseScroll(evnt)
|
|
242
|
+
handleChecked(evnt)
|
|
243
|
+
} else {
|
|
244
|
+
stopMouseScroll()
|
|
245
|
+
}
|
|
246
|
+
} else {
|
|
247
|
+
if (scrollTop) {
|
|
248
|
+
$xeTable.scrollTo(scrollLeft, scrollTop - topSize)
|
|
249
|
+
startMouseScroll(evnt)
|
|
250
|
+
handleChecked(evnt)
|
|
251
|
+
} else {
|
|
252
|
+
stopMouseScroll()
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}, 50)
|
|
257
|
+
}
|
|
258
|
+
addClass(el, 'drag--range')
|
|
259
|
+
document.onmousemove = evnt => {
|
|
260
|
+
evnt.preventDefault()
|
|
261
|
+
evnt.stopPropagation()
|
|
262
|
+
const { clientY } = evnt
|
|
263
|
+
const { boundingTop } = getAbsolutePos(bodyWrapperElem)
|
|
264
|
+
// 如果超过可视区,触发滚动
|
|
265
|
+
if (clientY < boundingTop) {
|
|
266
|
+
isMouseScrollDown = false
|
|
267
|
+
mouseScrollSpaceSize = boundingTop - clientY
|
|
268
|
+
if (!mouseScrollTimeout) {
|
|
269
|
+
startMouseScroll(evnt)
|
|
270
|
+
}
|
|
271
|
+
} else if (clientY > boundingTop + bodyWrapperElem.clientHeight) {
|
|
272
|
+
isMouseScrollDown = true
|
|
273
|
+
mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight
|
|
274
|
+
if (!mouseScrollTimeout) {
|
|
275
|
+
startMouseScroll(evnt)
|
|
276
|
+
}
|
|
277
|
+
} else if (mouseScrollTimeout) {
|
|
278
|
+
stopMouseScroll()
|
|
279
|
+
}
|
|
280
|
+
handleChecked(evnt)
|
|
281
|
+
}
|
|
282
|
+
document.onmouseup = (evnt) => {
|
|
283
|
+
stopMouseScroll()
|
|
284
|
+
removeClass(el, 'drag--range')
|
|
285
|
+
checkboxRangeElem.removeAttribute('style')
|
|
286
|
+
document.onmousemove = null
|
|
287
|
+
document.onmouseup = null
|
|
288
|
+
triggerEvent('end', evnt)
|
|
289
|
+
}
|
|
290
|
+
triggerEvent('start', evnt)
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
133
294
|
export default {
|
|
134
295
|
methods: {
|
|
135
296
|
// 处理 Tab 键移动
|
|
@@ -344,181 +505,24 @@ export default {
|
|
|
344
505
|
},
|
|
345
506
|
handleCellMousedownEvent (evnt: any, params: any) {
|
|
346
507
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
508
|
+
const props = $xeTable
|
|
347
509
|
|
|
348
|
-
const { editConfig,
|
|
510
|
+
const { editConfig, checkboxConfig, mouseConfig } = props
|
|
511
|
+
const checkboxOpts = $xeTable.computeCheckboxOpts
|
|
512
|
+
const mouseOpts = $xeTable.computeMouseOpts
|
|
513
|
+
const editOpts = $xeTable.computeEditOpts
|
|
349
514
|
if (mouseConfig && mouseOpts.area && $xeTable.triggerCellAreaModnEvent) {
|
|
350
515
|
return $xeTable.triggerCellAreaModnEvent(evnt, params)
|
|
351
516
|
} else {
|
|
352
517
|
if (checkboxConfig && checkboxOpts.range) {
|
|
353
|
-
|
|
518
|
+
handleCheckboxRangeEvent($xeTable, evnt, params)
|
|
354
519
|
}
|
|
355
520
|
if (mouseConfig && mouseOpts.selected) {
|
|
356
521
|
if (!editConfig || editOpts.mode === 'cell') {
|
|
357
|
-
handleSelected(params, evnt)
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
},
|
|
362
|
-
handleCheckboxRangeEvent (evnt: any, params: any) {
|
|
363
|
-
const $xeTable = this
|
|
364
|
-
const internalData = $xeTable
|
|
365
|
-
|
|
366
|
-
const { elemStore } = internalData
|
|
367
|
-
const bodyScrollElem = getRefElem(elemStore['main-body-scroll'])
|
|
368
|
-
const leftScrollElem = getRefElem(elemStore['left-body-scroll'])
|
|
369
|
-
const rightScrollElem = getRefElem(elemStore['right-body-scroll'])
|
|
370
|
-
const { column, cell } = params
|
|
371
|
-
if (column.type === 'checkbox') {
|
|
372
|
-
let bodyWrapperElem = bodyScrollElem as HTMLElement
|
|
373
|
-
if (leftScrollElem && column.fixed === 'left') {
|
|
374
|
-
bodyWrapperElem = leftScrollElem
|
|
375
|
-
} else if (rightScrollElem && column.fixed === 'right') {
|
|
376
|
-
bodyWrapperElem = rightScrollElem
|
|
377
|
-
}
|
|
378
|
-
if (!bodyWrapperElem) {
|
|
379
|
-
return
|
|
380
|
-
}
|
|
381
|
-
const el = $xeTable.$refs.refElem as HTMLDivElement
|
|
382
|
-
const disX = evnt.clientX
|
|
383
|
-
const disY = evnt.clientY
|
|
384
|
-
const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range') as HTMLElement
|
|
385
|
-
const trElem = cell.parentNode
|
|
386
|
-
const selectRecords = this.getCheckboxRecords()
|
|
387
|
-
let lastRangeRows = []
|
|
388
|
-
const marginSize = 1
|
|
389
|
-
const offsetRest = getTargetOffset(evnt.target, bodyWrapperElem)
|
|
390
|
-
const startTop = offsetRest.offsetTop + evnt.offsetY
|
|
391
|
-
const startLeft = offsetRest.offsetLeft + evnt.offsetX
|
|
392
|
-
const startScrollTop = bodyWrapperElem.scrollTop
|
|
393
|
-
const rowHeight = trElem.offsetHeight
|
|
394
|
-
const trRect = trElem.getBoundingClientRect()
|
|
395
|
-
const offsetClientTop = disY - trRect.y
|
|
396
|
-
let mouseScrollTimeout: any = null
|
|
397
|
-
let isMouseScrollDown: any = false
|
|
398
|
-
let mouseScrollSpaceSize = 1
|
|
399
|
-
const triggerEvent = (type: any, evnt: any) => {
|
|
400
|
-
this.emitEvent(`checkbox-range-${type}`, {
|
|
401
|
-
records: () => this.getCheckboxRecords(),
|
|
402
|
-
reserves: () => this.getCheckboxReserveRecords()
|
|
403
|
-
}, evnt)
|
|
404
|
-
}
|
|
405
|
-
const handleChecked = (evnt: any) => {
|
|
406
|
-
const { clientX, clientY } = evnt
|
|
407
|
-
const offsetLeft = clientX - disX
|
|
408
|
-
const offsetTop = clientY - disY + (bodyWrapperElem.scrollTop - startScrollTop)
|
|
409
|
-
let rangeHeight = Math.abs(offsetTop)
|
|
410
|
-
let rangeWidth = Math.abs(offsetLeft)
|
|
411
|
-
let rangeTop = startTop
|
|
412
|
-
let rangeLeft = startLeft
|
|
413
|
-
if (offsetTop < marginSize) {
|
|
414
|
-
// 向上
|
|
415
|
-
rangeTop += offsetTop
|
|
416
|
-
if (rangeTop < marginSize) {
|
|
417
|
-
rangeTop = marginSize
|
|
418
|
-
rangeHeight = startTop
|
|
419
|
-
}
|
|
420
|
-
} else {
|
|
421
|
-
// 向下
|
|
422
|
-
rangeHeight = Math.min(rangeHeight, bodyWrapperElem.scrollHeight - startTop - marginSize)
|
|
423
|
-
}
|
|
424
|
-
if (offsetLeft < marginSize) {
|
|
425
|
-
// 向左
|
|
426
|
-
rangeLeft += offsetLeft
|
|
427
|
-
if (rangeWidth > startLeft) {
|
|
428
|
-
rangeLeft = marginSize
|
|
429
|
-
rangeWidth = startLeft
|
|
430
|
-
}
|
|
431
|
-
} else {
|
|
432
|
-
// 向右
|
|
433
|
-
rangeWidth = Math.min(rangeWidth, bodyWrapperElem.clientWidth - startLeft - marginSize)
|
|
434
|
-
}
|
|
435
|
-
checkboxRangeElem.style.height = `${rangeHeight}px`
|
|
436
|
-
checkboxRangeElem.style.width = `${rangeWidth}px`
|
|
437
|
-
checkboxRangeElem.style.left = `${rangeLeft}px`
|
|
438
|
-
checkboxRangeElem.style.top = `${rangeTop}px`
|
|
439
|
-
checkboxRangeElem.style.display = 'block'
|
|
440
|
-
const rangeRows = getCheckboxRangeRows(this, evnt, params, trElem, trRect, offsetClientTop, offsetTop < marginSize ? -rangeHeight : rangeHeight)
|
|
441
|
-
// 至少滑动 10px 才能有效匹配
|
|
442
|
-
if (rangeHeight > 10 && rangeRows.length !== lastRangeRows.length) {
|
|
443
|
-
const isControlKey = hasControlKey(evnt)
|
|
444
|
-
lastRangeRows = rangeRows
|
|
445
|
-
if (isControlKey) {
|
|
446
|
-
rangeRows.forEach((row: any) => {
|
|
447
|
-
$xeTable.handleBatchSelectRows([row], selectRecords.indexOf(row) === -1)
|
|
448
|
-
})
|
|
449
|
-
} else {
|
|
450
|
-
this.setAllCheckboxRow(false)
|
|
451
|
-
this.handleCheckedCheckboxRow(rangeRows, true, false)
|
|
452
|
-
}
|
|
453
|
-
triggerEvent('change', evnt)
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
// 停止鼠标滚动
|
|
457
|
-
const stopMouseScroll = () => {
|
|
458
|
-
clearTimeout(mouseScrollTimeout)
|
|
459
|
-
mouseScrollTimeout = null
|
|
460
|
-
}
|
|
461
|
-
// 开始鼠标滚动
|
|
462
|
-
const startMouseScroll = (evnt: any) => {
|
|
463
|
-
stopMouseScroll()
|
|
464
|
-
mouseScrollTimeout = setTimeout(() => {
|
|
465
|
-
if (mouseScrollTimeout) {
|
|
466
|
-
const { scrollLeft, scrollTop, clientHeight, scrollHeight } = bodyWrapperElem
|
|
467
|
-
const topSize = Math.ceil(mouseScrollSpaceSize * 50 / rowHeight)
|
|
468
|
-
if (isMouseScrollDown) {
|
|
469
|
-
if (scrollTop + clientHeight < scrollHeight) {
|
|
470
|
-
this.scrollTo(scrollLeft, scrollTop + topSize)
|
|
471
|
-
startMouseScroll(evnt)
|
|
472
|
-
handleChecked(evnt)
|
|
473
|
-
} else {
|
|
474
|
-
stopMouseScroll()
|
|
475
|
-
}
|
|
476
|
-
} else {
|
|
477
|
-
if (scrollTop) {
|
|
478
|
-
this.scrollTo(scrollLeft, scrollTop - topSize)
|
|
479
|
-
startMouseScroll(evnt)
|
|
480
|
-
handleChecked(evnt)
|
|
481
|
-
} else {
|
|
482
|
-
stopMouseScroll()
|
|
483
|
-
}
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
}, 50)
|
|
487
|
-
}
|
|
488
|
-
addClass(el, 'drag--range')
|
|
489
|
-
document.onmousemove = evnt => {
|
|
490
|
-
evnt.preventDefault()
|
|
491
|
-
evnt.stopPropagation()
|
|
492
|
-
const { clientY } = evnt
|
|
493
|
-
const { boundingTop } = getAbsolutePos(bodyWrapperElem)
|
|
494
|
-
// 如果超过可视区,触发滚动
|
|
495
|
-
if (clientY < boundingTop) {
|
|
496
|
-
isMouseScrollDown = false
|
|
497
|
-
mouseScrollSpaceSize = boundingTop - clientY
|
|
498
|
-
if (!mouseScrollTimeout) {
|
|
499
|
-
startMouseScroll(evnt)
|
|
500
|
-
}
|
|
501
|
-
} else if (clientY > boundingTop + bodyWrapperElem.clientHeight) {
|
|
502
|
-
isMouseScrollDown = true
|
|
503
|
-
mouseScrollSpaceSize = clientY - boundingTop - bodyWrapperElem.clientHeight
|
|
504
|
-
if (!mouseScrollTimeout) {
|
|
505
|
-
startMouseScroll(evnt)
|
|
506
|
-
}
|
|
507
|
-
} else if (mouseScrollTimeout) {
|
|
508
|
-
stopMouseScroll()
|
|
522
|
+
$xeTable.handleSelected(params, evnt)
|
|
509
523
|
}
|
|
510
|
-
handleChecked(evnt)
|
|
511
524
|
}
|
|
512
|
-
document.onmouseup = (evnt) => {
|
|
513
|
-
stopMouseScroll()
|
|
514
|
-
removeClass(el, 'drag--range')
|
|
515
|
-
checkboxRangeElem.removeAttribute('style')
|
|
516
|
-
document.onmousemove = null
|
|
517
|
-
document.onmouseup = null
|
|
518
|
-
triggerEvent('end', evnt)
|
|
519
|
-
}
|
|
520
|
-
triggerEvent('start', evnt)
|
|
521
525
|
}
|
|
522
526
|
}
|
|
523
|
-
}
|
|
527
|
+
}
|
|
524
528
|
}
|
|
@@ -3,7 +3,7 @@ import XEUtils from 'xe-utils'
|
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { getClass } from '../../ui/src/utils'
|
|
5
5
|
import { updateCellTitle } from '../../ui/src/dom'
|
|
6
|
-
import {
|
|
6
|
+
import { getCalcHeight } from './util'
|
|
7
7
|
|
|
8
8
|
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, TableReactData, TableInternalData, VxeComponentStyleType } from '../../../types'
|
|
9
9
|
|
|
@@ -32,7 +32,7 @@ function renderRows (h: CreateElement, _vm: any, isOptimizeMode: boolean, tableC
|
|
|
32
32
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
33
33
|
const cellOpts = $xeTable.computeCellOpts
|
|
34
34
|
const footerCellOpts = $xeTable.computeFooterCellOpts
|
|
35
|
-
const currCellHeight =
|
|
35
|
+
const currCellHeight = getCalcHeight(footerCellOpts.height) || defaultRowHeight
|
|
36
36
|
|
|
37
37
|
return tableColumn.map((column: any, $columnIndex: any) => {
|
|
38
38
|
const { type, showFooterOverflow, footerAlign, align, footerClassName, editRender, cellRender } = column
|
|
@@ -2,7 +2,7 @@ import { PropType, CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { VxeUI } from '../../ui'
|
|
4
4
|
import { getClass } from '../../ui/src/utils'
|
|
5
|
-
import {
|
|
5
|
+
import { getCalcHeight, convertHeaderColumnToRows } from './util'
|
|
6
6
|
|
|
7
7
|
import type { VxeTableDefines, VxeTableConstructor, VxeTablePrivateMethods, VxeColumnPropTypes, TableReactData, TableInternalData, VxeComponentStyleType } from '../../../types'
|
|
8
8
|
|
|
@@ -29,7 +29,7 @@ const renderRows = (h: CreateElement, _vm: any, isGroup: boolean, isOptimizeMode
|
|
|
29
29
|
const cellOpts = $xeTable.computeCellOpts
|
|
30
30
|
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
31
31
|
const headerCellOpts = $xeTable.computeHeaderCellOpts
|
|
32
|
-
const currCellHeight =
|
|
32
|
+
const currCellHeight = getCalcHeight(headerCellOpts.height) || defaultRowHeight
|
|
33
33
|
const { disabledMethod: dragDisabledMethod, isCrossDrag, isPeerDrag } = columnDragOpts
|
|
34
34
|
return cols.map((column: any, $columnIndex: any) => {
|
|
35
35
|
const { type, showHeaderOverflow, headerAlign, align, filters, headerClassName, editRender, cellRender } = column
|
|
@@ -2,7 +2,7 @@ import { CreateElement } from 'vue'
|
|
|
2
2
|
import XEUtils from 'xe-utils'
|
|
3
3
|
import { getFuncText, isEnableConf } from '../../ui/src/utils'
|
|
4
4
|
import { initTpImg } from '../../ui/src/dom'
|
|
5
|
-
import { createInternalData, createHandleGetRowId,
|
|
5
|
+
import { createInternalData, createHandleGetRowId, getCalcHeight, hasDeepKey } from './util'
|
|
6
6
|
import { VxeUI } from '../../ui'
|
|
7
7
|
import methods from './methods'
|
|
8
8
|
import TableBodyComponent from './body'
|
|
@@ -926,11 +926,21 @@ export default {
|
|
|
926
926
|
},
|
|
927
927
|
computeHeaderCellOpts () {
|
|
928
928
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
929
|
+
const $xeGantt = $xeTable.$xeGantt
|
|
929
930
|
const props = $xeTable
|
|
930
931
|
|
|
931
932
|
const headerCellOpts = Object.assign({}, getConfig().table.headerCellConfig, props.headerCellConfig)
|
|
933
|
+
const defaultRowHeight = $xeTable.computeDefaultRowHeight
|
|
932
934
|
const cellOpts = $xeTable.computeCellOpts
|
|
933
|
-
|
|
935
|
+
let headCellHeight = XEUtils.toNumber(getCalcHeight(headerCellOpts.height || cellOpts.height))
|
|
936
|
+
if ($xeGantt) {
|
|
937
|
+
const taskScaleConfs = $xeGantt.computeTaskScaleConfs
|
|
938
|
+
if (taskScaleConfs && taskScaleConfs.length > 2) {
|
|
939
|
+
const ganttMinHeadCellHeight = defaultRowHeight / 2 * taskScaleConfs.length
|
|
940
|
+
headCellHeight = Math.max(ganttMinHeadCellHeight, headCellHeight)
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
headerCellOpts.height = headCellHeight
|
|
934
944
|
return headerCellOpts
|
|
935
945
|
},
|
|
936
946
|
computeFooterCellOpts () {
|
|
@@ -939,7 +949,7 @@ export default {
|
|
|
939
949
|
|
|
940
950
|
const footerCellOpts = Object.assign({}, getConfig().table.footerCellConfig, props.footerCellConfig)
|
|
941
951
|
const cellOpts = $xeTable.computeCellOpts
|
|
942
|
-
footerCellOpts.height = XEUtils.toNumber(
|
|
952
|
+
footerCellOpts.height = XEUtils.toNumber(getCalcHeight(footerCellOpts.height || cellOpts.height))
|
|
943
953
|
return footerCellOpts
|
|
944
954
|
},
|
|
945
955
|
rowOpts () {
|
|
@@ -1896,6 +1906,16 @@ export default {
|
|
|
1896
1906
|
this.preventEvent(null, 'activated')
|
|
1897
1907
|
},
|
|
1898
1908
|
deactivated () {
|
|
1909
|
+
const $xeTable = this
|
|
1910
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1911
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1912
|
+
|
|
1913
|
+
const { filterStore } = reactData
|
|
1914
|
+
if (filterStore.visible) {
|
|
1915
|
+
$xeTable.clearFilter()
|
|
1916
|
+
}
|
|
1917
|
+
$xeTable.closeTooltip()
|
|
1918
|
+
internalData.isActivated = false
|
|
1899
1919
|
this.preventEvent(null, 'deactivated')
|
|
1900
1920
|
},
|
|
1901
1921
|
beforeDestroy () {
|
|
@@ -315,7 +315,7 @@ function getElementMarginAndWidth (elem: HTMLElement | null) {
|
|
|
315
315
|
return 0
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
export function
|
|
318
|
+
export function getCalcHeight (height: number | 'unset' | undefined | null) {
|
|
319
319
|
if (height === 'unset') {
|
|
320
320
|
return 0
|
|
321
321
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|