vxe-table 4.2.2 → 4.2.3-beta.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/filter/src/hook.js +2 -1
- package/es/footer/src/footer.js +5 -5
- package/es/header/src/header.js +6 -6
- package/es/header/style.css +1 -5
- package/es/input/src/input.js +125 -27
- 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 +59 -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/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/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 +329 -114
- package/lib/index.umd.min.js +1 -1
- package/lib/input/src/input.js +166 -29
- 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 +66 -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/filter/src/hook.ts +3 -2
- package/packages/footer/src/footer.ts +5 -5
- package/packages/header/src/header.ts +6 -6
- package/packages/input/src/input.ts +128 -27
- package/packages/keyboard/src/hook.ts +6 -2
- package/packages/table/src/body.ts +15 -11
- package/packages/table/src/table.ts +58 -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 +2 -0
- package/types/table.d.ts +3 -1
|
@@ -12,8 +12,10 @@ import { VNodeStyle, VxeInputConstructor, VxeInputEmits, InputReactData, InputMe
|
|
|
12
12
|
|
|
13
13
|
interface DateYearItem {
|
|
14
14
|
date: Date;
|
|
15
|
+
isPrev: boolean;
|
|
15
16
|
isCurrent: boolean;
|
|
16
17
|
isNow: boolean;
|
|
18
|
+
isNext: boolean;
|
|
17
19
|
year: number;
|
|
18
20
|
}
|
|
19
21
|
|
|
@@ -50,7 +52,7 @@ interface DateHourMinuteSecondItem {
|
|
|
50
52
|
label: string;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
const yearSize =
|
|
55
|
+
const yearSize = 12
|
|
54
56
|
const monthSize = 20
|
|
55
57
|
const quarterSize = 8
|
|
56
58
|
|
|
@@ -71,6 +73,7 @@ export default defineComponent({
|
|
|
71
73
|
form: String as PropType<VxeInputPropTypes.Form>,
|
|
72
74
|
className: String as PropType<VxeInputPropTypes.ClassName>,
|
|
73
75
|
size: { type: String as PropType<VxeInputPropTypes.Size>, default: () => GlobalConfig.input.size || GlobalConfig.size },
|
|
76
|
+
multiple: Boolean as PropType<VxeInputPropTypes.Multiple>,
|
|
74
77
|
|
|
75
78
|
// number、integer、float
|
|
76
79
|
min: { type: [String, Number] as PropType<VxeInputPropTypes.Min>, default: null },
|
|
@@ -232,6 +235,38 @@ export default defineComponent({
|
|
|
232
235
|
return props.maxDate ? XEUtils.toStringDate(props.maxDate) : null
|
|
233
236
|
})
|
|
234
237
|
|
|
238
|
+
const computeSupportMultiples = computed(() => {
|
|
239
|
+
return ['date', 'week', 'month', 'quarter', 'year'].includes(props.type)
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
const computeDateListValue = computed(() => {
|
|
243
|
+
const { modelValue, multiple } = props
|
|
244
|
+
const isDatePickerType = computeIsDatePickerType.value
|
|
245
|
+
const dateValueFormat = computeDateValueFormat.value
|
|
246
|
+
if (multiple && modelValue && isDatePickerType) {
|
|
247
|
+
return XEUtils.toValueString(modelValue).split(',').map(item => {
|
|
248
|
+
const date = parseDate(item, dateValueFormat)
|
|
249
|
+
if (XEUtils.isValidDate(date)) {
|
|
250
|
+
return date
|
|
251
|
+
}
|
|
252
|
+
return null
|
|
253
|
+
})
|
|
254
|
+
}
|
|
255
|
+
return []
|
|
256
|
+
})
|
|
257
|
+
|
|
258
|
+
const computeDateMultipleValue = computed(() => {
|
|
259
|
+
const dateListValue = computeDateListValue.value
|
|
260
|
+
const dateValueFormat = computeDateValueFormat.value
|
|
261
|
+
return dateListValue.map(date => XEUtils.toDateString(date, dateValueFormat))
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
const computeDateMultipleLabel = computed(() => {
|
|
265
|
+
const dateListValue = computeDateListValue.value
|
|
266
|
+
const dateLabelFormat = computeDateLabelFormat.value
|
|
267
|
+
return dateListValue.map(date => XEUtils.toDateString(date, dateLabelFormat)).join(', ')
|
|
268
|
+
})
|
|
269
|
+
|
|
235
270
|
const computeDateValueFormat = computed(() => {
|
|
236
271
|
const { type } = props
|
|
237
272
|
return type === 'time' ? 'HH:mm:ss' : (props.valueFormat || (type === 'datetime' ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd'))
|
|
@@ -296,14 +331,17 @@ export default defineComponent({
|
|
|
296
331
|
const years: DateYearItem[] = []
|
|
297
332
|
if (selectMonth && currentDate) {
|
|
298
333
|
const currFullYear = currentDate.getFullYear()
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
334
|
+
const selectFullYear = selectMonth.getFullYear()
|
|
335
|
+
const startYearDate = new Date(selectFullYear - selectFullYear % yearSize, 0, 1)
|
|
336
|
+
for (let index = -4; index < yearSize + 4; index++) {
|
|
337
|
+
const date = XEUtils.getWhatYear(startYearDate, index, 'first')
|
|
302
338
|
const itemFullYear = date.getFullYear()
|
|
303
339
|
years.push({
|
|
304
340
|
date,
|
|
305
341
|
isCurrent: true,
|
|
342
|
+
isPrev: index < 0,
|
|
306
343
|
isNow: currFullYear === itemFullYear,
|
|
344
|
+
isNext: index >= yearSize,
|
|
307
345
|
year: itemFullYear
|
|
308
346
|
})
|
|
309
347
|
}
|
|
@@ -536,8 +574,8 @@ export default defineComponent({
|
|
|
536
574
|
})
|
|
537
575
|
|
|
538
576
|
const computeInpReadonly = computed(() => {
|
|
539
|
-
const { type, readonly, editable } = props
|
|
540
|
-
return readonly || !editable || type === 'week' || type === 'quarter'
|
|
577
|
+
const { type, readonly, editable, multiple } = props
|
|
578
|
+
return readonly || multiple || !editable || type === 'week' || type === 'quarter'
|
|
541
579
|
})
|
|
542
580
|
|
|
543
581
|
const computeInputType = computed(() => {
|
|
@@ -711,7 +749,7 @@ export default defineComponent({
|
|
|
711
749
|
const { inputValue } = reactData
|
|
712
750
|
if (isDatePickerType) {
|
|
713
751
|
dateParseValue(inputValue)
|
|
714
|
-
reactData.inputValue = reactData.datePanelLabel
|
|
752
|
+
reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel
|
|
715
753
|
}
|
|
716
754
|
}
|
|
717
755
|
|
|
@@ -744,7 +782,7 @@ export default defineComponent({
|
|
|
744
782
|
}
|
|
745
783
|
|
|
746
784
|
const dateRevert = () => {
|
|
747
|
-
reactData.inputValue = reactData.datePanelLabel
|
|
785
|
+
reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel
|
|
748
786
|
}
|
|
749
787
|
|
|
750
788
|
const dateCheckMonth = (date: Date) => {
|
|
@@ -755,7 +793,7 @@ export default defineComponent({
|
|
|
755
793
|
}
|
|
756
794
|
|
|
757
795
|
const dateChange = (date: Date) => {
|
|
758
|
-
const { modelValue } = props
|
|
796
|
+
const { modelValue, multiple } = props
|
|
759
797
|
const { datetimePanelValue } = reactData
|
|
760
798
|
const isDateTimeType = computeIsDateTimeType.value
|
|
761
799
|
const dateValueFormat = computeDateValueFormat.value
|
|
@@ -770,8 +808,36 @@ export default defineComponent({
|
|
|
770
808
|
}
|
|
771
809
|
const inpVal = XEUtils.toDateString(date, dateValueFormat, { firstDay: firstDayOfWeek })
|
|
772
810
|
dateCheckMonth(date)
|
|
773
|
-
if (
|
|
774
|
-
|
|
811
|
+
if (multiple) {
|
|
812
|
+
// 如果为多选
|
|
813
|
+
const dateMultipleValue = computeDateMultipleValue.value
|
|
814
|
+
if (isDateTimeType) {
|
|
815
|
+
// 如果是datetime特殊类型
|
|
816
|
+
const dateListValue = computeDateListValue.value
|
|
817
|
+
const datetimeRest = []
|
|
818
|
+
dateListValue.forEach(item => {
|
|
819
|
+
if (item && !XEUtils.isDateSame(date, item, 'yyyyMMdd')) {
|
|
820
|
+
item.setHours(datetimePanelValue.getHours())
|
|
821
|
+
item.setMinutes(datetimePanelValue.getMinutes())
|
|
822
|
+
item.setSeconds(datetimePanelValue.getSeconds())
|
|
823
|
+
datetimeRest.push(item)
|
|
824
|
+
}
|
|
825
|
+
})
|
|
826
|
+
datetimeRest.push(date)
|
|
827
|
+
emitModel(datetimeRest.map(date => XEUtils.toDateString(date, dateValueFormat)).join(','), { type: 'update' })
|
|
828
|
+
} else {
|
|
829
|
+
// 如果是日期类型
|
|
830
|
+
if (dateMultipleValue.some(val => XEUtils.isEqual(val, inpVal))) {
|
|
831
|
+
emitModel(dateMultipleValue.filter(val => !XEUtils.isEqual(val, inpVal)).join(','), { type: 'update' })
|
|
832
|
+
} else {
|
|
833
|
+
emitModel(dateMultipleValue.concat([inpVal]).join(','), { type: 'update' })
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
} else {
|
|
837
|
+
// 如果为单选
|
|
838
|
+
if (!XEUtils.isEqual(modelValue, inpVal)) {
|
|
839
|
+
emitModel(inpVal, { type: 'update' })
|
|
840
|
+
}
|
|
775
841
|
}
|
|
776
842
|
}
|
|
777
843
|
|
|
@@ -1048,8 +1114,10 @@ export default defineComponent({
|
|
|
1048
1114
|
|
|
1049
1115
|
const dateTodayMonthEvent = (evnt: Event) => {
|
|
1050
1116
|
dateNowHandle()
|
|
1051
|
-
|
|
1052
|
-
|
|
1117
|
+
if (!props.multiple) {
|
|
1118
|
+
dateChange(reactData.currentDate)
|
|
1119
|
+
hidePanel()
|
|
1120
|
+
}
|
|
1053
1121
|
inputMethods.dispatchEvent('date-today', { type: props.type }, evnt)
|
|
1054
1122
|
}
|
|
1055
1123
|
|
|
@@ -1086,7 +1154,7 @@ export default defineComponent({
|
|
|
1086
1154
|
}
|
|
1087
1155
|
|
|
1088
1156
|
const dateSelectItem = (date: Date) => {
|
|
1089
|
-
const { type } = props
|
|
1157
|
+
const { type, multiple } = props
|
|
1090
1158
|
const { datePanelType } = reactData
|
|
1091
1159
|
if (type === 'month') {
|
|
1092
1160
|
if (datePanelType === 'year') {
|
|
@@ -1094,18 +1162,24 @@ export default defineComponent({
|
|
|
1094
1162
|
dateCheckMonth(date)
|
|
1095
1163
|
} else {
|
|
1096
1164
|
dateChange(date)
|
|
1097
|
-
|
|
1165
|
+
if (!multiple) {
|
|
1166
|
+
hidePanel()
|
|
1167
|
+
}
|
|
1098
1168
|
}
|
|
1099
1169
|
} else if (type === 'year') {
|
|
1100
1170
|
dateChange(date)
|
|
1101
|
-
|
|
1171
|
+
if (!multiple) {
|
|
1172
|
+
hidePanel()
|
|
1173
|
+
}
|
|
1102
1174
|
} else if (type === 'quarter') {
|
|
1103
1175
|
if (datePanelType === 'year') {
|
|
1104
1176
|
reactData.datePanelType = 'quarter'
|
|
1105
1177
|
dateCheckMonth(date)
|
|
1106
1178
|
} else {
|
|
1107
1179
|
dateChange(date)
|
|
1108
|
-
|
|
1180
|
+
if (!multiple) {
|
|
1181
|
+
hidePanel()
|
|
1182
|
+
}
|
|
1109
1183
|
}
|
|
1110
1184
|
} else {
|
|
1111
1185
|
if (datePanelType === 'month') {
|
|
@@ -1116,7 +1190,9 @@ export default defineComponent({
|
|
|
1116
1190
|
dateCheckMonth(date)
|
|
1117
1191
|
} else {
|
|
1118
1192
|
dateChange(date)
|
|
1119
|
-
|
|
1193
|
+
if (!multiple) {
|
|
1194
|
+
hidePanel()
|
|
1195
|
+
}
|
|
1120
1196
|
}
|
|
1121
1197
|
}
|
|
1122
1198
|
}
|
|
@@ -1201,8 +1277,11 @@ export default defineComponent({
|
|
|
1201
1277
|
}
|
|
1202
1278
|
|
|
1203
1279
|
const dateConfirmEvent = () => {
|
|
1280
|
+
const { type } = props
|
|
1204
1281
|
const dateValue = computeDateValue.value
|
|
1205
|
-
|
|
1282
|
+
if (type === 'datetime') {
|
|
1283
|
+
dateChange(dateValue || reactData.currentDate)
|
|
1284
|
+
}
|
|
1206
1285
|
hidePanel()
|
|
1207
1286
|
}
|
|
1208
1287
|
|
|
@@ -1590,10 +1669,12 @@ export default defineComponent({
|
|
|
1590
1669
|
}
|
|
1591
1670
|
|
|
1592
1671
|
const renderDateDayTable = () => {
|
|
1672
|
+
const { multiple } = props
|
|
1593
1673
|
const { datePanelType, datePanelValue } = reactData
|
|
1594
1674
|
const dateValue = computeDateValue.value
|
|
1595
1675
|
const dateHeaders = computeDateHeaders.value
|
|
1596
1676
|
const dayDatas = computeDayDatas.value
|
|
1677
|
+
const dateListValue = computeDateListValue.value
|
|
1597
1678
|
const matchFormat = 'yyyyMMdd'
|
|
1598
1679
|
return [
|
|
1599
1680
|
h('table', {
|
|
@@ -1616,7 +1697,7 @@ export default defineComponent({
|
|
|
1616
1697
|
'is--now': item.isNow,
|
|
1617
1698
|
'is--next': item.isNext,
|
|
1618
1699
|
'is--disabled': isDateDisabled(item),
|
|
1619
|
-
'is--selected': XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1700
|
+
'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1620
1701
|
'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
|
|
1621
1702
|
},
|
|
1622
1703
|
onClick: () => dateSelectEvent(item),
|
|
@@ -1629,10 +1710,12 @@ export default defineComponent({
|
|
|
1629
1710
|
}
|
|
1630
1711
|
|
|
1631
1712
|
const renderDateWeekTable = () => {
|
|
1713
|
+
const { multiple } = props
|
|
1632
1714
|
const { datePanelType, datePanelValue } = reactData
|
|
1633
1715
|
const dateValue = computeDateValue.value
|
|
1634
1716
|
const weekHeaders = computeWeekHeaders.value
|
|
1635
1717
|
const weekDates = computeWeekDates.value
|
|
1718
|
+
const dateListValue = computeDateListValue.value
|
|
1636
1719
|
const matchFormat = 'yyyyMMdd'
|
|
1637
1720
|
return [
|
|
1638
1721
|
h('table', {
|
|
@@ -1647,7 +1730,7 @@ export default defineComponent({
|
|
|
1647
1730
|
}))
|
|
1648
1731
|
]),
|
|
1649
1732
|
h('tbody', weekDates.map((rows) => {
|
|
1650
|
-
const isSelected = rows.some((item) => XEUtils.isDateSame(dateValue, item.date, matchFormat))
|
|
1733
|
+
const isSelected = multiple ? rows.some((item) => dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat))) : rows.some((item) => XEUtils.isDateSame(dateValue, item.date, matchFormat))
|
|
1651
1734
|
const isHover = rows.some((item) => XEUtils.isDateSame(datePanelValue, item.date, matchFormat))
|
|
1652
1735
|
return h('tr', rows.map((item) => {
|
|
1653
1736
|
return h('td', {
|
|
@@ -1671,9 +1754,11 @@ export default defineComponent({
|
|
|
1671
1754
|
}
|
|
1672
1755
|
|
|
1673
1756
|
const renderDateMonthTable = () => {
|
|
1757
|
+
const { multiple } = props
|
|
1674
1758
|
const { datePanelType, datePanelValue } = reactData
|
|
1675
1759
|
const dateValue = computeDateValue.value
|
|
1676
1760
|
const monthDatas = computeMonthDatas.value
|
|
1761
|
+
const dateListValue = computeDateListValue.value
|
|
1677
1762
|
const matchFormat = 'yyyyMM'
|
|
1678
1763
|
return [
|
|
1679
1764
|
h('table', {
|
|
@@ -1691,7 +1776,7 @@ export default defineComponent({
|
|
|
1691
1776
|
'is--now': item.isNow,
|
|
1692
1777
|
'is--next': item.isNext,
|
|
1693
1778
|
'is--disabled': isDateDisabled(item),
|
|
1694
|
-
'is--selected': XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1779
|
+
'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1695
1780
|
'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
|
|
1696
1781
|
},
|
|
1697
1782
|
onClick: () => dateSelectEvent(item),
|
|
@@ -1704,9 +1789,11 @@ export default defineComponent({
|
|
|
1704
1789
|
}
|
|
1705
1790
|
|
|
1706
1791
|
const renderDateQuarterTable = () => {
|
|
1792
|
+
const { multiple } = props
|
|
1707
1793
|
const { datePanelType, datePanelValue } = reactData
|
|
1708
1794
|
const dateValue = computeDateValue.value
|
|
1709
1795
|
const quarterDatas = computeQuarterDatas.value
|
|
1796
|
+
const dateListValue = computeDateListValue.value
|
|
1710
1797
|
const matchFormat = 'yyyyq'
|
|
1711
1798
|
return [
|
|
1712
1799
|
h('table', {
|
|
@@ -1724,7 +1811,7 @@ export default defineComponent({
|
|
|
1724
1811
|
'is--now': item.isNow,
|
|
1725
1812
|
'is--next': item.isNext,
|
|
1726
1813
|
'is--disabled': isDateDisabled(item),
|
|
1727
|
-
'is--selected': XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1814
|
+
'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1728
1815
|
'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
|
|
1729
1816
|
},
|
|
1730
1817
|
onClick: () => dateSelectEvent(item),
|
|
@@ -1737,9 +1824,11 @@ export default defineComponent({
|
|
|
1737
1824
|
}
|
|
1738
1825
|
|
|
1739
1826
|
const renderDateYearTable = () => {
|
|
1827
|
+
const { multiple } = props
|
|
1740
1828
|
const { datePanelType, datePanelValue } = reactData
|
|
1741
1829
|
const dateValue = computeDateValue.value
|
|
1742
1830
|
const yearDatas = computeYearDatas.value
|
|
1831
|
+
const dateListValue = computeDateListValue.value
|
|
1743
1832
|
const matchFormat = 'yyyy'
|
|
1744
1833
|
return [
|
|
1745
1834
|
h('table', {
|
|
@@ -1752,10 +1841,12 @@ export default defineComponent({
|
|
|
1752
1841
|
return h('tr', rows.map((item) => {
|
|
1753
1842
|
return h('td', {
|
|
1754
1843
|
class: {
|
|
1755
|
-
'is--
|
|
1844
|
+
'is--prev': item.isPrev,
|
|
1756
1845
|
'is--current': item.isCurrent,
|
|
1757
1846
|
'is--now': item.isNow,
|
|
1758
|
-
'is--
|
|
1847
|
+
'is--next': item.isNext,
|
|
1848
|
+
'is--disabled': isDateDisabled(item),
|
|
1849
|
+
'is--selected': multiple ? dateListValue.some(val => XEUtils.isDateSame(val, item.date, matchFormat)) : XEUtils.isDateSame(dateValue, item.date, matchFormat),
|
|
1759
1850
|
'is--hover': XEUtils.isDateSame(datePanelValue, item.date, matchFormat)
|
|
1760
1851
|
},
|
|
1761
1852
|
onClick: () => dateSelectEvent(item),
|
|
@@ -1783,6 +1874,7 @@ export default defineComponent({
|
|
|
1783
1874
|
}
|
|
1784
1875
|
|
|
1785
1876
|
const renderDatePanel = () => {
|
|
1877
|
+
const { multiple } = props
|
|
1786
1878
|
const { datePanelType } = reactData
|
|
1787
1879
|
const isDisabledPrevDateBtn = computeIsDisabledPrevDateBtn.value
|
|
1788
1880
|
const isDisabledNextDateBtn = computeIsDisabledNextDateBtn.value
|
|
@@ -1831,7 +1923,16 @@ export default defineComponent({
|
|
|
1831
1923
|
h('i', {
|
|
1832
1924
|
class: 'vxe-icon--caret-right'
|
|
1833
1925
|
})
|
|
1834
|
-
])
|
|
1926
|
+
]),
|
|
1927
|
+
multiple && computeSupportMultiples.value ? h('span', {
|
|
1928
|
+
class: 'vxe-input--date-picker-btn vxe-input--date-picker-confirm-btn'
|
|
1929
|
+
}, [
|
|
1930
|
+
h('button', {
|
|
1931
|
+
class: 'vxe-input--date-picker-confirm',
|
|
1932
|
+
type: 'button',
|
|
1933
|
+
onClick: dateConfirmEvent
|
|
1934
|
+
}, GlobalConfig.i18n('vxe.button.confirm'))
|
|
1935
|
+
]) : null
|
|
1835
1936
|
])
|
|
1836
1937
|
]),
|
|
1837
1938
|
h('div', {
|
|
@@ -2138,7 +2239,7 @@ export default defineComponent({
|
|
|
2138
2239
|
const isDatePickerType = computeIsDatePickerType.value
|
|
2139
2240
|
if (isDatePickerType) {
|
|
2140
2241
|
dateParseValue(reactData.datePanelValue)
|
|
2141
|
-
reactData.inputValue = reactData.datePanelLabel
|
|
2242
|
+
reactData.inputValue = props.multiple ? computeDateMultipleLabel.value : reactData.datePanelLabel
|
|
2142
2243
|
}
|
|
2143
2244
|
})
|
|
2144
2245
|
|
|
@@ -66,8 +66,12 @@ const tableKeyboardHook: VxeGlobalHooksHandles.HookOptions = {
|
|
|
66
66
|
const { elemStore } = internalData
|
|
67
67
|
const disX = evnt.clientX
|
|
68
68
|
const disY = evnt.clientY
|
|
69
|
-
const
|
|
70
|
-
const
|
|
69
|
+
const bodyWrapperRef = elemStore[`${column.fixed || 'main'}-body-wrapper`] || elemStore['main-body-wrapper']
|
|
70
|
+
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null
|
|
71
|
+
if (!bodyWrapperElem) {
|
|
72
|
+
return
|
|
73
|
+
}
|
|
74
|
+
const checkboxRangeElem = bodyWrapperElem.querySelector('.vxe-table--checkbox-range') as HTMLElement
|
|
71
75
|
const domMousemove = document.onmousemove
|
|
72
76
|
const domMouseup = document.onmouseup
|
|
73
77
|
const trElem = cell.parentNode
|
|
@@ -480,8 +480,10 @@ export default defineComponent({
|
|
|
480
480
|
const bodyElem = tableBody.$el as XEBodyScrollElement
|
|
481
481
|
const leftElem = leftBody ? leftBody.$el as XEBodyScrollElement : null
|
|
482
482
|
const rightElem = rightBody ? rightBody.$el as XEBodyScrollElement : null
|
|
483
|
-
const
|
|
484
|
-
const
|
|
483
|
+
const bodyYRef = elemStore['main-body-ySpace']
|
|
484
|
+
const bodyYElem = bodyYRef ? bodyYRef.value : null
|
|
485
|
+
const bodyXRef = elemStore['main-body-xSpace']
|
|
486
|
+
const bodyXElem = bodyXRef ? bodyXRef.value : null
|
|
485
487
|
const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight
|
|
486
488
|
const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth
|
|
487
489
|
let scrollTop = scrollBodyElem.scrollTop
|
|
@@ -554,8 +556,10 @@ export default defineComponent({
|
|
|
554
556
|
const leftElem = leftBody ? leftBody.$el as HTMLDivElement : null
|
|
555
557
|
const rightElem = rightBody ? rightBody.$el as HTMLDivElement : null
|
|
556
558
|
const bodyElem = tableBody.$el as HTMLDivElement
|
|
557
|
-
const
|
|
558
|
-
const
|
|
559
|
+
const bodyYRef = elemStore['main-body-ySpace']
|
|
560
|
+
const bodyYElem = bodyYRef ? bodyYRef.value : null
|
|
561
|
+
const bodyXRef = elemStore['main-body-xSpace']
|
|
562
|
+
const bodyXElem = bodyXRef ? bodyXRef.value : null
|
|
559
563
|
const bodyHeight = scrollYLoad && bodyYElem ? bodyYElem.clientHeight : bodyElem.clientHeight
|
|
560
564
|
const bodyWidth = scrollXLoad && bodyXElem ? bodyXElem.clientWidth : bodyElem.clientWidth
|
|
561
565
|
const remainSize = isPrevWheelTop === isTopWheel ? Math.max(0, wheelYSize - wheelYTotal) : 0
|
|
@@ -649,13 +653,13 @@ export default defineComponent({
|
|
|
649
653
|
const { elemStore } = tableInternalData
|
|
650
654
|
const prefix = `${fixedType || 'main'}-body-`
|
|
651
655
|
const el = refElem.value
|
|
652
|
-
elemStore[`${prefix}wrapper`] = refElem
|
|
653
|
-
elemStore[`${prefix}table`] = refBodyTable
|
|
654
|
-
elemStore[`${prefix}colgroup`] = refBodyColgroup
|
|
655
|
-
elemStore[`${prefix}list`] = refBodyTBody
|
|
656
|
-
elemStore[`${prefix}xSpace`] = refBodyXSpace
|
|
657
|
-
elemStore[`${prefix}ySpace`] = refBodyYSpace
|
|
658
|
-
elemStore[`${prefix}emptyBlock`] = refBodyEmptyBlock
|
|
656
|
+
elemStore[`${prefix}wrapper`] = refElem
|
|
657
|
+
elemStore[`${prefix}table`] = refBodyTable
|
|
658
|
+
elemStore[`${prefix}colgroup`] = refBodyColgroup
|
|
659
|
+
elemStore[`${prefix}list`] = refBodyTBody
|
|
660
|
+
elemStore[`${prefix}xSpace`] = refBodyXSpace
|
|
661
|
+
elemStore[`${prefix}ySpace`] = refBodyYSpace
|
|
662
|
+
elemStore[`${prefix}emptyBlock`] = refBodyEmptyBlock
|
|
659
663
|
el.onscroll = scrollEvent
|
|
660
664
|
el._onscroll = scrollEvent
|
|
661
665
|
})
|
|
@@ -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
|
|
@@ -1086,6 +1091,7 @@ export default defineComponent({
|
|
|
1086
1091
|
}
|
|
1087
1092
|
})
|
|
1088
1093
|
}
|
|
1094
|
+
console.log(headerHeight)
|
|
1089
1095
|
internalData.headerHeight = headerHeight
|
|
1090
1096
|
|
|
1091
1097
|
let overflowX = false
|
|
@@ -1331,7 +1337,8 @@ export default defineComponent({
|
|
|
1331
1337
|
const cellOffsetWidth = computeCellOffsetWidth.value
|
|
1332
1338
|
const mouseOpts = computeMouseOpts.value
|
|
1333
1339
|
const keyboardOpts = computeKeyboardOpts.value
|
|
1334
|
-
const
|
|
1340
|
+
const bodyWrapperRef = elemStore['main-body-wrapper']
|
|
1341
|
+
const bodyWrapperElem = bodyWrapperRef ? bodyWrapperRef.value : null
|
|
1335
1342
|
if (emptyPlaceholderElem) {
|
|
1336
1343
|
emptyPlaceholderElem.style.top = `${headerHeight}px`
|
|
1337
1344
|
emptyPlaceholderElem.style.height = bodyWrapperElem ? `${bodyWrapperElem.offsetHeight - scrollbarHeight}px` : ''
|
|
@@ -1352,8 +1359,10 @@ export default defineComponent({
|
|
|
1352
1359
|
fixedWrapperElem = isFixedLeft ? refLeftContainer.value : refRightContainer.value
|
|
1353
1360
|
}
|
|
1354
1361
|
layoutList.forEach(layout => {
|
|
1355
|
-
const
|
|
1356
|
-
const
|
|
1362
|
+
const wrapperRef = elemStore[`${name}-${layout}-wrapper`]
|
|
1363
|
+
const wrapperElem = wrapperRef ? wrapperRef.value : null
|
|
1364
|
+
const tableRef = elemStore[`${name}-${layout}-table`]
|
|
1365
|
+
const tableElem = tableRef ? tableRef.value : null
|
|
1357
1366
|
if (layout === 'header') {
|
|
1358
1367
|
// 表头体样式处理
|
|
1359
1368
|
// 横向滚动渲染
|
|
@@ -1383,12 +1392,14 @@ export default defineComponent({
|
|
|
1383
1392
|
}
|
|
1384
1393
|
}
|
|
1385
1394
|
|
|
1386
|
-
const
|
|
1395
|
+
const repairRef = elemStore[`${name}-${layout}-repair`]
|
|
1396
|
+
const repairElem = repairRef ? repairRef.value : null
|
|
1387
1397
|
if (repairElem) {
|
|
1388
1398
|
repairElem.style.width = `${tableWidth}px`
|
|
1389
1399
|
}
|
|
1390
1400
|
|
|
1391
|
-
const
|
|
1401
|
+
const listRef = elemStore[`${name}-${layout}-list`]
|
|
1402
|
+
const listElem = listRef ? listRef.value : null
|
|
1392
1403
|
if (isGroup && listElem) {
|
|
1393
1404
|
XEUtils.arrayEach(listElem.querySelectorAll('.col--group'), (thElem: any) => {
|
|
1394
1405
|
const colNode = tableMethods.getColumnNode(thElem)
|
|
@@ -1415,7 +1426,8 @@ export default defineComponent({
|
|
|
1415
1426
|
})
|
|
1416
1427
|
}
|
|
1417
1428
|
} else if (layout === 'body') {
|
|
1418
|
-
const
|
|
1429
|
+
const emptyBlockRef = elemStore[`${name}-${layout}-emptyBlock`]
|
|
1430
|
+
const emptyBlockElem = emptyBlockRef ? emptyBlockRef.value : null
|
|
1419
1431
|
if (isNodeElement(wrapperElem)) {
|
|
1420
1432
|
if (customMaxHeight) {
|
|
1421
1433
|
wrapperElem.style.maxHeight = `${fixedType ? customMaxHeight - headerHeight - (showFooter ? 0 : scrollbarHeight) : customMaxHeight - headerHeight}px`
|
|
@@ -1489,7 +1501,8 @@ export default defineComponent({
|
|
|
1489
1501
|
tableElem.style.width = tWidth ? `${tWidth + scrollbarWidth}px` : ''
|
|
1490
1502
|
}
|
|
1491
1503
|
}
|
|
1492
|
-
const
|
|
1504
|
+
const colgroupRef = elemStore[`${name}-${layout}-colgroup`]
|
|
1505
|
+
const colgroupElem = colgroupRef ? colgroupRef.value : null
|
|
1493
1506
|
if (colgroupElem) {
|
|
1494
1507
|
XEUtils.arrayEach(colgroupElem.children, (colElem: any) => {
|
|
1495
1508
|
const colid = colElem.getAttribute('name')
|
|
@@ -1512,7 +1525,8 @@ export default defineComponent({
|
|
|
1512
1525
|
const showTitle = cellOverflow === 'title'
|
|
1513
1526
|
const showTooltip = cellOverflow === true || cellOverflow === 'tooltip'
|
|
1514
1527
|
let hasEllipsis = showTitle || showTooltip || showEllipsis
|
|
1515
|
-
const
|
|
1528
|
+
const listRef = elemStore[`${name}-${layout}-list`]
|
|
1529
|
+
const listElem = listRef ? listRef.value : null
|
|
1516
1530
|
// 纵向虚拟滚动不支持动态行高
|
|
1517
1531
|
if (scrollYLoad && !hasEllipsis) {
|
|
1518
1532
|
hasEllipsis = true
|
|
@@ -1771,7 +1785,7 @@ export default defineComponent({
|
|
|
1771
1785
|
childRecords = []
|
|
1772
1786
|
}
|
|
1773
1787
|
if (childRecords) {
|
|
1774
|
-
tableMethods.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1788
|
+
return tableMethods.loadTreeChildren(row, childRecords).then(childRows => {
|
|
1775
1789
|
if (childRows.length && $xetable.findRowIndexOf(treeExpandeds, row) === -1) {
|
|
1776
1790
|
treeExpandeds.push(row)
|
|
1777
1791
|
}
|
|
@@ -1779,17 +1793,18 @@ export default defineComponent({
|
|
|
1779
1793
|
if (!checkStrictly && tableMethods.isCheckedByCheckboxRow(row)) {
|
|
1780
1794
|
tableMethods.setCheckboxRow(childRows, true)
|
|
1781
1795
|
}
|
|
1782
|
-
nextTick().then(() => {
|
|
1796
|
+
return nextTick().then(() => {
|
|
1783
1797
|
if (transform) {
|
|
1784
1798
|
return tablePrivateMethods.handleTableData()
|
|
1785
1799
|
}
|
|
1786
|
-
})
|
|
1787
|
-
return tableMethods.recalculate()
|
|
1788
|
-
}).then(() => resolve())
|
|
1800
|
+
})
|
|
1789
1801
|
})
|
|
1790
|
-
} else {
|
|
1791
|
-
nextTick().then(() => tableMethods.recalculate()).then(() => resolve())
|
|
1792
1802
|
}
|
|
1803
|
+
}).catch(() => {
|
|
1804
|
+
rest.treeLoaded = false
|
|
1805
|
+
XEUtils.remove(treeLazyLoadeds, item => $xetable.eqRow(item, row))
|
|
1806
|
+
}).finally(() => {
|
|
1807
|
+
nextTick().then(() => tableMethods.recalculate()).then(() => resolve())
|
|
1793
1808
|
})
|
|
1794
1809
|
} else {
|
|
1795
1810
|
resolve()
|
|
@@ -1811,18 +1826,20 @@ export default defineComponent({
|
|
|
1811
1826
|
}
|
|
1812
1827
|
|
|
1813
1828
|
const handleAsyncRowExpand = (row: any): Promise<void> => {
|
|
1814
|
-
const { rowExpandeds, expandLazyLoadeds } = reactData
|
|
1815
1829
|
const { fullAllDataRowIdData } = internalData
|
|
1816
|
-
const rest = fullAllDataRowIdData[getRowid($xetable, row)]
|
|
1817
1830
|
return new Promise(resolve => {
|
|
1818
1831
|
const expandOpts = computeExpandOpts.value
|
|
1819
1832
|
const { loadMethod } = expandOpts
|
|
1820
1833
|
if (loadMethod) {
|
|
1821
|
-
|
|
1822
|
-
|
|
1834
|
+
const rest = fullAllDataRowIdData[getRowid($xetable, row)]
|
|
1835
|
+
reactData.expandLazyLoadeds.push(row)
|
|
1836
|
+
loadMethod({ $table: $xetable, row, rowIndex: tableMethods.getRowIndex(row), $rowIndex: tableMethods.getVMRowIndex(row) }).then(() => {
|
|
1823
1837
|
rest.expandLoaded = true
|
|
1824
|
-
|
|
1825
|
-
|
|
1838
|
+
reactData.rowExpandeds.push(row)
|
|
1839
|
+
}).catch(() => {
|
|
1840
|
+
rest.expandLoaded = false
|
|
1841
|
+
}).finally(() => {
|
|
1842
|
+
XEUtils.remove(reactData.expandLazyLoadeds, item => $xetable.eqRow(item, row))
|
|
1826
1843
|
resolve(nextTick().then(() => tableMethods.recalculate()))
|
|
1827
1844
|
})
|
|
1828
1845
|
} else {
|
|
@@ -2945,21 +2962,13 @@ export default defineComponent({
|
|
|
2945
2962
|
* 支持 width=? width=?px width=?% min-width=? min-width=?px min-width=?%
|
|
2946
2963
|
*/
|
|
2947
2964
|
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
|
-
}
|
|
2965
|
+
autoCellWidth()
|
|
2966
|
+
if (refull === true) {
|
|
2967
|
+
// 初始化时需要在列计算之后再执行优化运算,达到最优显示效果
|
|
2968
|
+
return computeScrollLoad().then(() => {
|
|
2969
|
+
autoCellWidth()
|
|
2970
|
+
return computeScrollLoad()
|
|
2971
|
+
})
|
|
2963
2972
|
}
|
|
2964
2973
|
return computeScrollLoad()
|
|
2965
2974
|
},
|
|
@@ -5338,7 +5347,8 @@ export default defineComponent({
|
|
|
5338
5347
|
containerList.forEach(name => {
|
|
5339
5348
|
const layoutList = ['header', 'body', 'footer']
|
|
5340
5349
|
layoutList.forEach(layout => {
|
|
5341
|
-
const
|
|
5350
|
+
const xSpaceRef = elemStore[`${name}-${layout}-xSpace`]
|
|
5351
|
+
const xSpaceElem = xSpaceRef ? xSpaceRef.value : null
|
|
5342
5352
|
if (xSpaceElem) {
|
|
5343
5353
|
xSpaceElem.style.width = scrollXLoad ? `${tableWidth + (layout === 'header' ? scrollbarWidth : 0)}px` : ''
|
|
5344
5354
|
}
|
|
@@ -5363,12 +5373,14 @@ export default defineComponent({
|
|
|
5363
5373
|
}
|
|
5364
5374
|
containerList.forEach(name => {
|
|
5365
5375
|
const layoutList = ['header', 'body', 'footer']
|
|
5366
|
-
const
|
|
5376
|
+
const tableRef = elemStore[`${name}-body-table`]
|
|
5377
|
+
const tableElem = tableRef ? tableRef.value : null
|
|
5367
5378
|
if (tableElem) {
|
|
5368
5379
|
tableElem.style.marginTop = marginTop
|
|
5369
5380
|
}
|
|
5370
5381
|
layoutList.forEach(layout => {
|
|
5371
|
-
const
|
|
5382
|
+
const ySpaceRef = elemStore[`${name}-${layout}-ySpace`]
|
|
5383
|
+
const ySpaceElem = ySpaceRef ? ySpaceRef.value : null
|
|
5372
5384
|
if (ySpaceElem) {
|
|
5373
5385
|
ySpaceElem.style.height = ySpaceHeight
|
|
5374
5386
|
}
|
|
@@ -5377,14 +5389,14 @@ export default defineComponent({
|
|
|
5377
5389
|
nextTick(updateStyle)
|
|
5378
5390
|
},
|
|
5379
5391
|
updateScrollXData () {
|
|
5380
|
-
reactData.tableColumn = []
|
|
5392
|
+
// reactData.tableColumn = []
|
|
5381
5393
|
nextTick(() => {
|
|
5382
5394
|
handleTableColumn()
|
|
5383
5395
|
tablePrivateMethods.updateScrollXSpace()
|
|
5384
5396
|
})
|
|
5385
5397
|
},
|
|
5386
5398
|
updateScrollYData () {
|
|
5387
|
-
reactData.tableData = []
|
|
5399
|
+
// reactData.tableData = []
|
|
5388
5400
|
nextTick(() => {
|
|
5389
5401
|
tablePrivateMethods.handleTableData()
|
|
5390
5402
|
tablePrivateMethods.updateScrollYSpace()
|