naive-ui 2.21.2 → 2.22.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/_internal/close/src/styles/index.cssr.js +6 -5
- package/es/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/es/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/es/_internal/selection/src/Selection.js +11 -9
- package/es/_internal/selection/src/styles/index.cssr.js +6 -2
- package/es/alert/src/Alert.d.ts +20 -20
- package/es/alert/src/Alert.js +22 -22
- package/es/alert/src/styles/index.cssr.js +45 -45
- package/es/anchor/src/AnchorAdapter.js +12 -12
- package/es/anchor/src/styles/index.cssr.js +41 -41
- package/es/avatar/src/Avatar.d.ts +5 -3
- package/es/avatar/src/Avatar.js +7 -5
- package/es/avatar/src/styles/index.cssr.js +3 -5
- package/es/button/src/Button.d.ts +60 -60
- package/es/button/src/Button.js +107 -106
- package/es/button/src/styles/button.cssr.js +83 -80
- package/es/button/styles/dark.js +3 -3
- package/es/button/styles/light.d.ts +3 -3
- package/es/button/styles/light.js +1 -1
- package/es/calendar/src/Calendar.d.ts +37 -30
- package/es/calendar/styles/light.d.ts +3 -3
- package/es/cascader/src/Cascader.d.ts +135 -0
- package/es/cascader/src/Cascader.js +2 -4
- package/es/cascader/src/CascaderMenu.d.ts +345 -0
- package/es/cascader/src/CascaderMenu.js +6 -5
- package/es/cascader/src/CascaderOption.d.ts +18 -0
- package/es/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/es/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/es/cascader/styles/dark.js +3 -1
- package/es/cascader/styles/light.d.ts +13 -0
- package/es/cascader/styles/light.js +3 -1
- package/es/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/es/color-picker/src/ColorPicker.d.ts +27 -27
- package/es/color-picker/styles/light.d.ts +3 -3
- package/es/config-provider/src/ConfigProvider.d.ts +21 -0
- package/es/data-table/src/DataTable.d.ts +30 -30
- package/es/data-table/src/DataTable.js +7 -14
- package/es/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/es/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/es/data-table/src/MainTable.js +2 -3
- package/es/data-table/src/TableParts/Body.d.ts +18 -7
- package/es/data-table/src/TableParts/Body.js +80 -28
- package/es/data-table/src/TableParts/Cell.d.ts +6 -6
- package/es/data-table/src/TableParts/Header.d.ts +3 -3
- package/es/data-table/src/TableParts/Header.js +1 -1
- package/es/data-table/src/interface.d.ts +4 -1
- package/es/data-table/src/styles/index.cssr.js +9 -12
- package/es/data-table/src/use-check.js +6 -2
- package/es/data-table/src/use-scroll.d.ts +2 -0
- package/es/data-table/src/use-scroll.js +34 -4
- package/es/data-table/src/use-table-data.js +4 -1
- package/es/data-table/styles/_common.js +1 -1
- package/es/data-table/styles/light.d.ts +3 -3
- package/es/date-picker/src/DatePicker.d.ts +94 -69
- package/es/date-picker/src/DatePicker.js +47 -20
- package/es/date-picker/src/config.d.ts +1 -9
- package/es/date-picker/src/config.js +0 -8
- package/es/date-picker/src/interface.d.ts +2 -1
- package/es/date-picker/src/panel/date.d.ts +23 -10
- package/es/date-picker/src/panel/date.js +2 -2
- package/es/date-picker/src/panel/daterange.d.ts +21 -9
- package/es/date-picker/src/panel/daterange.js +2 -2
- package/es/date-picker/src/panel/datetime.d.ts +23 -16
- package/es/date-picker/src/panel/datetime.js +2 -2
- package/es/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/es/date-picker/src/panel/datetimerange.js +2 -2
- package/es/date-picker/src/panel/month.d.ts +27 -20
- package/es/date-picker/src/panel/month.js +23 -12
- package/es/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/es/date-picker/src/panel/use-calendar.js +35 -18
- package/es/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/es/date-picker/src/panel/use-dual-calendar.js +23 -8
- package/es/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/es/date-picker/src/panel/use-panel-common.js +2 -2
- package/es/date-picker/src/utils.d.ts +19 -3
- package/es/date-picker/src/utils.js +40 -5
- package/es/date-picker/styles/_common.d.ts +2 -0
- package/es/date-picker/styles/_common.js +3 -1
- package/es/date-picker/styles/light.d.ts +10 -6
- package/es/dialog/src/Dialog.d.ts +21 -21
- package/es/dialog/src/styles/index.cssr.js +1 -0
- package/es/dialog/styles/light.d.ts +3 -3
- package/es/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/es/dynamic-input/src/InputPreset.d.ts +3 -3
- package/es/dynamic-input/src/PairPreset.d.ts +3 -3
- package/es/dynamic-input/styles/light.d.ts +3 -3
- package/es/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/es/dynamic-tags/styles/light.d.ts +3 -3
- package/es/element/index.d.ts +1 -0
- package/es/element/index.js +1 -0
- package/es/form/src/interface.d.ts +5 -4
- package/es/image/src/Image.d.ts +25 -16
- package/es/image/src/Image.js +35 -11
- package/es/image/src/ImageGroup.js +2 -2
- package/es/image/src/styles/index.cssr.js +4 -3
- package/es/input/src/Input.js +2 -0
- package/es/input/src/styles/input.cssr.js +2 -1
- package/es/input-number/src/InputNumber.d.ts +30 -30
- package/es/input-number/src/InputNumber.js +10 -5
- package/es/input-number/src/utils.d.ts +1 -0
- package/es/input-number/src/utils.js +4 -0
- package/es/input-number/styles/light.d.ts +3 -3
- package/es/locales/common/deDE.js +8 -0
- package/es/locales/common/enUS.d.ts +7 -0
- package/es/locales/common/enUS.js +8 -1
- package/es/locales/common/frFR.d.ts +3 -0
- package/es/locales/common/frFR.js +101 -0
- package/es/locales/common/idID.d.ts +2 -93
- package/es/locales/common/idID.js +8 -0
- package/es/locales/common/jaJP.js +8 -0
- package/es/locales/common/nbNO.js +8 -0
- package/es/locales/common/ruRU.js +8 -0
- package/es/locales/common/ukUA.js +8 -0
- package/es/locales/common/zhCN.js +7 -0
- package/es/locales/common/zhTW.d.ts +3 -0
- package/es/locales/common/zhTW.js +100 -0
- package/es/locales/date/frFR.d.ts +3 -0
- package/es/locales/date/frFR.js +6 -0
- package/es/locales/date/idID.d.ts +1 -6
- package/es/locales/date/zhTW.d.ts +3 -0
- package/es/locales/date/zhTW.js +6 -0
- package/es/locales/index.d.ts +4 -0
- package/es/locales/index.js +4 -0
- package/es/modal/src/BodyWrapper.d.ts +6 -6
- package/es/modal/src/Modal.d.ts +36 -36
- package/es/modal/styles/light.d.ts +3 -3
- package/es/page-header/src/PageHeader.js +3 -3
- package/es/page-header/src/styles/index.cssr.js +2 -4
- package/es/popconfirm/src/Popconfirm.d.ts +30 -30
- package/es/popconfirm/styles/light.d.ts +3 -3
- package/es/popover/src/Popover.js +4 -1
- package/es/popover/src/PopoverBody.js +3 -3
- package/es/popselect/src/Popselect.d.ts +2 -11
- package/es/popselect/src/Popselect.js +2 -2
- package/es/popselect/src/PopselectPanel.d.ts +3 -11
- package/es/popselect/src/PopselectPanel.js +17 -11
- package/es/radio/src/Radio.js +3 -3
- package/es/radio/src/RadioButton.js +4 -5
- package/es/radio/src/styles/radio-group.cssr.js +8 -4
- package/es/radio/src/styles/radio.cssr.js +8 -4
- package/es/radio/src/use-radio.d.ts +0 -3
- package/es/radio/src/use-radio.js +1 -26
- package/es/switch/src/Switch.d.ts +16 -1
- package/es/switch/src/Switch.js +17 -4
- package/es/switch/src/styles/index.cssr.js +1 -1
- package/es/tabs/src/styles/index.cssr.js +1 -0
- package/es/tag/src/styles/index.cssr.js +1 -1
- package/es/theme-editor/src/ThemeEditor.js +9 -2
- package/es/time-picker/src/Panel.d.ts +3 -3
- package/es/time-picker/src/TimePicker.d.ts +30 -30
- package/es/time-picker/styles/light.d.ts +3 -3
- package/es/transfer/src/Transfer.d.ts +30 -30
- package/es/transfer/src/TransferFilter.d.ts +3 -3
- package/es/transfer/src/TransferList.d.ts +3 -3
- package/es/transfer/src/TransferListItem.d.ts +3 -3
- package/es/transfer/styles/light.d.ts +3 -3
- package/es/tree/src/Tree.d.ts +8 -4
- package/es/tree/src/Tree.js +32 -6
- package/es/tree-select/src/TreeSelect.d.ts +38 -1
- package/es/tree-select/src/TreeSelect.js +25 -10
- package/es/tree-select/src/styles/index.cssr.js +11 -2
- package/es/tree-select/styles/light.d.ts +6 -0
- package/es/tree-select/styles/light.js +5 -2
- package/es/upload/src/Upload.d.ts +41 -30
- package/es/upload/src/Upload.js +33 -23
- package/es/upload/src/UploadFile.d.ts +4 -4
- package/es/upload/src/UploadFileList.js +4 -2
- package/es/upload/src/UploadProgress.d.ts +3 -3
- package/es/upload/src/interface.d.ts +1 -0
- package/es/upload/src/styles/index.cssr.js +2 -3
- package/es/upload/styles/light.d.ts +3 -3
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/close/src/styles/index.cssr.js +6 -5
- package/lib/_internal/scrollbar/src/ScrollBar.d.ts +15 -0
- package/lib/_internal/scrollbar/src/ScrollBar.js +13 -7
- package/lib/_internal/selection/src/Selection.js +11 -9
- package/lib/_internal/selection/src/styles/index.cssr.js +6 -2
- package/lib/alert/src/Alert.d.ts +20 -20
- package/lib/alert/src/Alert.js +22 -22
- package/lib/alert/src/styles/index.cssr.js +45 -45
- package/lib/anchor/src/AnchorAdapter.js +12 -12
- package/lib/anchor/src/styles/index.cssr.js +41 -41
- package/lib/avatar/src/Avatar.d.ts +5 -3
- package/lib/avatar/src/Avatar.js +7 -5
- package/lib/avatar/src/styles/index.cssr.js +3 -5
- package/lib/button/src/Button.d.ts +60 -60
- package/lib/button/src/Button.js +107 -106
- package/lib/button/src/styles/button.cssr.js +83 -80
- package/lib/button/styles/dark.js +3 -3
- package/lib/button/styles/light.d.ts +3 -3
- package/lib/button/styles/light.js +1 -1
- package/lib/calendar/src/Calendar.d.ts +37 -30
- package/lib/calendar/styles/light.d.ts +3 -3
- package/lib/cascader/src/Cascader.d.ts +135 -0
- package/lib/cascader/src/Cascader.js +2 -4
- package/lib/cascader/src/CascaderMenu.d.ts +345 -0
- package/lib/cascader/src/CascaderMenu.js +6 -5
- package/lib/cascader/src/CascaderOption.d.ts +18 -0
- package/lib/cascader/src/CascaderSelectMenu.d.ts +18 -0
- package/lib/cascader/src/CascaderSubmenu.d.ts +18 -0
- package/lib/cascader/styles/dark.js +3 -1
- package/lib/cascader/styles/light.d.ts +13 -0
- package/lib/cascader/styles/light.js +3 -1
- package/lib/color-picker/src/ColorInputUnit.d.ts +3 -3
- package/lib/color-picker/src/ColorPicker.d.ts +27 -27
- package/lib/color-picker/styles/light.d.ts +3 -3
- package/lib/config-provider/src/ConfigProvider.d.ts +21 -0
- package/lib/data-table/src/DataTable.d.ts +30 -30
- package/lib/data-table/src/DataTable.js +6 -13
- package/lib/data-table/src/HeaderButton/FilterButton.d.ts +3 -3
- package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +3 -3
- package/lib/data-table/src/MainTable.js +1 -2
- package/lib/data-table/src/TableParts/Body.d.ts +18 -7
- package/lib/data-table/src/TableParts/Body.js +78 -26
- package/lib/data-table/src/TableParts/Cell.d.ts +6 -6
- package/lib/data-table/src/TableParts/Header.d.ts +3 -3
- package/lib/data-table/src/TableParts/Header.js +1 -1
- package/lib/data-table/src/interface.d.ts +4 -1
- package/lib/data-table/src/styles/index.cssr.js +9 -12
- package/lib/data-table/src/use-check.js +6 -2
- package/lib/data-table/src/use-scroll.d.ts +2 -0
- package/lib/data-table/src/use-scroll.js +34 -4
- package/lib/data-table/src/use-table-data.js +4 -1
- package/lib/data-table/styles/_common.js +1 -1
- package/lib/data-table/styles/light.d.ts +3 -3
- package/lib/date-picker/src/DatePicker.d.ts +94 -69
- package/lib/date-picker/src/DatePicker.js +46 -19
- package/lib/date-picker/src/config.d.ts +1 -9
- package/lib/date-picker/src/config.js +1 -9
- package/lib/date-picker/src/interface.d.ts +2 -1
- package/lib/date-picker/src/panel/date.d.ts +23 -10
- package/lib/date-picker/src/panel/date.js +1 -1
- package/lib/date-picker/src/panel/daterange.d.ts +21 -9
- package/lib/date-picker/src/panel/daterange.js +1 -1
- package/lib/date-picker/src/panel/datetime.d.ts +23 -16
- package/lib/date-picker/src/panel/datetime.js +1 -1
- package/lib/date-picker/src/panel/datetimerange.d.ts +21 -9
- package/lib/date-picker/src/panel/datetimerange.js +2 -2
- package/lib/date-picker/src/panel/month.d.ts +27 -20
- package/lib/date-picker/src/panel/month.js +23 -12
- package/lib/date-picker/src/panel/use-calendar.d.ts +25 -43
- package/lib/date-picker/src/panel/use-calendar.js +34 -16
- package/lib/date-picker/src/panel/use-dual-calendar.d.ts +21 -40
- package/lib/date-picker/src/panel/use-dual-calendar.js +22 -6
- package/lib/date-picker/src/panel/use-panel-common.d.ts +21 -36
- package/lib/date-picker/src/panel/use-panel-common.js +3 -2
- package/lib/date-picker/src/utils.d.ts +19 -3
- package/lib/date-picker/src/utils.js +41 -4
- package/lib/date-picker/styles/_common.d.ts +2 -0
- package/lib/date-picker/styles/_common.js +3 -1
- package/lib/date-picker/styles/light.d.ts +10 -6
- package/lib/dialog/src/Dialog.d.ts +21 -21
- package/lib/dialog/src/styles/index.cssr.js +1 -0
- package/lib/dialog/styles/light.d.ts +3 -3
- package/lib/dynamic-input/src/DynamicInput.d.ts +30 -30
- package/lib/dynamic-input/src/InputPreset.d.ts +3 -3
- package/lib/dynamic-input/src/PairPreset.d.ts +3 -3
- package/lib/dynamic-input/styles/light.d.ts +3 -3
- package/lib/dynamic-tags/src/DynamicTags.d.ts +30 -30
- package/lib/dynamic-tags/styles/light.d.ts +3 -3
- package/lib/element/index.d.ts +1 -0
- package/lib/element/index.js +3 -1
- package/lib/form/src/interface.d.ts +5 -4
- package/lib/image/src/Image.d.ts +25 -16
- package/lib/image/src/Image.js +34 -10
- package/lib/image/src/ImageGroup.js +2 -2
- package/lib/image/src/styles/index.cssr.js +3 -2
- package/lib/input/src/Input.js +2 -0
- package/lib/input/src/styles/input.cssr.js +2 -1
- package/lib/input-number/src/InputNumber.d.ts +30 -30
- package/lib/input-number/src/InputNumber.js +9 -4
- package/lib/input-number/src/utils.d.ts +1 -0
- package/lib/input-number/src/utils.js +6 -1
- package/lib/input-number/styles/light.d.ts +3 -3
- package/lib/locales/common/deDE.js +8 -0
- package/lib/locales/common/enUS.d.ts +7 -0
- package/lib/locales/common/enUS.js +8 -1
- package/lib/locales/common/frFR.d.ts +3 -0
- package/lib/locales/common/frFR.js +103 -0
- package/lib/locales/common/idID.d.ts +2 -93
- package/lib/locales/common/idID.js +8 -0
- package/lib/locales/common/jaJP.js +8 -0
- package/lib/locales/common/nbNO.js +8 -0
- package/lib/locales/common/ruRU.js +8 -0
- package/lib/locales/common/ukUA.js +8 -0
- package/lib/locales/common/zhCN.js +7 -0
- package/lib/locales/common/zhTW.d.ts +3 -0
- package/lib/locales/common/zhTW.js +102 -0
- package/lib/locales/date/frFR.d.ts +3 -0
- package/lib/locales/date/frFR.js +11 -0
- package/lib/locales/date/idID.d.ts +1 -6
- package/lib/locales/date/zhTW.d.ts +3 -0
- package/lib/locales/date/zhTW.js +11 -0
- package/lib/locales/index.d.ts +4 -0
- package/lib/locales/index.js +9 -1
- package/lib/modal/src/BodyWrapper.d.ts +6 -6
- package/lib/modal/src/Modal.d.ts +36 -36
- package/lib/modal/styles/light.d.ts +3 -3
- package/lib/page-header/src/PageHeader.js +3 -3
- package/lib/page-header/src/styles/index.cssr.js +2 -4
- package/lib/popconfirm/src/Popconfirm.d.ts +30 -30
- package/lib/popconfirm/styles/light.d.ts +3 -3
- package/lib/popover/src/Popover.js +4 -1
- package/lib/popover/src/PopoverBody.js +3 -3
- package/lib/popselect/src/Popselect.d.ts +2 -11
- package/lib/popselect/src/Popselect.js +2 -2
- package/lib/popselect/src/PopselectPanel.d.ts +3 -11
- package/lib/popselect/src/PopselectPanel.js +16 -10
- package/lib/radio/src/Radio.js +3 -3
- package/lib/radio/src/RadioButton.js +4 -5
- package/lib/radio/src/styles/radio-group.cssr.js +8 -4
- package/lib/radio/src/styles/radio.cssr.js +8 -4
- package/lib/radio/src/use-radio.d.ts +0 -3
- package/lib/radio/src/use-radio.js +1 -26
- package/lib/switch/src/Switch.d.ts +16 -1
- package/lib/switch/src/Switch.js +17 -4
- package/lib/switch/src/styles/index.cssr.js +1 -1
- package/lib/tabs/src/styles/index.cssr.js +1 -0
- package/lib/tag/src/styles/index.cssr.js +1 -1
- package/lib/theme-editor/src/ThemeEditor.js +9 -2
- package/lib/time-picker/src/Panel.d.ts +3 -3
- package/lib/time-picker/src/TimePicker.d.ts +30 -30
- package/lib/time-picker/styles/light.d.ts +3 -3
- package/lib/transfer/src/Transfer.d.ts +30 -30
- package/lib/transfer/src/TransferFilter.d.ts +3 -3
- package/lib/transfer/src/TransferList.d.ts +3 -3
- package/lib/transfer/src/TransferListItem.d.ts +3 -3
- package/lib/transfer/styles/light.d.ts +3 -3
- package/lib/tree/src/Tree.d.ts +8 -4
- package/lib/tree/src/Tree.js +32 -6
- package/lib/tree-select/src/TreeSelect.d.ts +38 -1
- package/lib/tree-select/src/TreeSelect.js +24 -9
- package/lib/tree-select/src/styles/index.cssr.js +11 -2
- package/lib/tree-select/styles/light.d.ts +6 -0
- package/lib/tree-select/styles/light.js +5 -2
- package/lib/upload/src/Upload.d.ts +41 -30
- package/lib/upload/src/Upload.js +33 -23
- package/lib/upload/src/UploadFile.d.ts +4 -4
- package/lib/upload/src/UploadFileList.js +4 -2
- package/lib/upload/src/UploadProgress.d.ts +3 -3
- package/lib/upload/src/interface.d.ts +1 -0
- package/lib/upload/src/styles/index.cssr.js +2 -3
- package/lib/upload/styles/light.d.ts +3 -3
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +5 -4
- package/web-types.json +99 -7
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { h, ref, defineComponent, inject, watchEffect, onUnmounted, computed } from 'vue';
|
|
2
|
+
import { h, ref, defineComponent, inject, watchEffect, onUnmounted, computed, renderSlot, Fragment } from 'vue';
|
|
3
3
|
import { pxfy, repeat } from 'seemly';
|
|
4
|
-
import { VirtualList } from 'vueuc';
|
|
4
|
+
import { VirtualList, VResizeObserver } from 'vueuc';
|
|
5
5
|
import { c } from '../../../_utils/cssr';
|
|
6
6
|
import { NScrollbar } from '../../../_internal';
|
|
7
7
|
import { formatLength } from '../../../_utils';
|
|
8
|
+
import { NEmpty } from '../../../empty';
|
|
8
9
|
import { dataTableInjectionKey } from '../interface';
|
|
9
10
|
import { createRowClassName, getColKey, isColumnSorting } from '../utils';
|
|
10
11
|
import Cell from './Cell';
|
|
11
12
|
import ExpandTrigger from './ExpandTrigger';
|
|
12
13
|
import RenderSafeCheckbox from './BodyCheckbox';
|
|
13
14
|
import TableHeader from './Header';
|
|
15
|
+
import { useMemo } from 'vooks';
|
|
14
16
|
function flatten(rowInfos, expandedRowKeys) {
|
|
15
17
|
const fRows = [];
|
|
16
18
|
function traverse(rs) {
|
|
@@ -70,14 +72,24 @@ export default defineComponent({
|
|
|
70
72
|
props: {
|
|
71
73
|
onResize: Function,
|
|
72
74
|
showHeader: Boolean,
|
|
73
|
-
flexHeight: Boolean
|
|
75
|
+
flexHeight: Boolean,
|
|
76
|
+
bodyStyle: Object
|
|
74
77
|
},
|
|
75
78
|
setup(props) {
|
|
76
|
-
const { mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, rightActiveFixedColKeyRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, scrollPartRef, mergedTableLayoutRef, hasChildrenRef, firstContentfulColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck
|
|
79
|
+
const { slots: dataTableSlots, mergedExpandedRowKeysRef, mergedClsPrefixRef, mergedThemeRef, scrollXRef, colsRef, paginatedDataRef, rawPaginatedDataRef, fixedColumnLeftMapRef, fixedColumnRightMapRef, mergedCurrentPageRef, rowClassNameRef, leftActiveFixedColKeyRef, leftActiveFixedChildrenColKeysRef, rightActiveFixedColKeyRef, rightActiveFixedChildrenColKeysRef, renderExpandRef, hoverKeyRef, summaryRef, mergedSortStateRef, virtualScrollRef, componentId, scrollPartRef, mergedTableLayoutRef, hasChildrenRef, firstContentfulColIndexRef, indentRef, rowPropsRef, maxHeightRef, stripedRef, loadingRef, setHeaderScrollLeft, doUpdateExpandedRowKeys, handleTableBodyScroll, doCheck, doUncheck
|
|
77
80
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
78
81
|
} = inject(dataTableInjectionKey);
|
|
79
82
|
const scrollbarInstRef = ref(null);
|
|
80
83
|
const virtualListRef = ref(null);
|
|
84
|
+
const emptyElRef = ref(null);
|
|
85
|
+
const emptyRef = useMemo(() => paginatedDataRef.value.length === 0);
|
|
86
|
+
// If header is not inside & empty is displayed, no table part would be
|
|
87
|
+
// shown. So to collect a body width, we need to put a ref on empty element
|
|
88
|
+
const shouldDisplaySomeTablePartRef = useMemo(() => props.showHeader || !emptyRef.value);
|
|
89
|
+
// If no body is shown, we shouldn't show scrollbar
|
|
90
|
+
const bodyShowHeaderOnlyRef = useMemo(() => {
|
|
91
|
+
return props.showHeader || emptyRef.value;
|
|
92
|
+
});
|
|
81
93
|
let lastSelectedKey = '';
|
|
82
94
|
const mergedExpandedRowKeySetRef = computed(() => {
|
|
83
95
|
return new Set(mergedExpandedRowKeysRef.value);
|
|
@@ -114,6 +126,15 @@ export default defineComponent({
|
|
|
114
126
|
lastSelectedKey = tmNode.key;
|
|
115
127
|
}
|
|
116
128
|
function getScrollContainer() {
|
|
129
|
+
if (!shouldDisplaySomeTablePartRef.value) {
|
|
130
|
+
const { value: emptyEl } = emptyElRef;
|
|
131
|
+
if (emptyEl) {
|
|
132
|
+
return emptyEl;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
117
138
|
if (virtualScrollRef.value) {
|
|
118
139
|
return virtualListContainer();
|
|
119
140
|
}
|
|
@@ -165,36 +186,47 @@ export default defineComponent({
|
|
|
165
186
|
};
|
|
166
187
|
// manually control shadow style to avoid rerender
|
|
167
188
|
const style = c([
|
|
168
|
-
({ props: cProps }) =>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
189
|
+
({ props: cProps }) => {
|
|
190
|
+
const createActiveLeftFixedStyle = (leftActiveFixedColKey) => {
|
|
191
|
+
if (leftActiveFixedColKey === null)
|
|
192
|
+
return null;
|
|
193
|
+
return c(`[data-n-id="${cProps.componentId}"] [data-col-key="${leftActiveFixedColKey}"]::after`, { boxShadow: 'var(--box-shadow-after)' });
|
|
194
|
+
};
|
|
195
|
+
const createActiveRightFixedStyle = (rightActiveFixedColKey) => {
|
|
196
|
+
if (rightActiveFixedColKey === null)
|
|
197
|
+
return null;
|
|
198
|
+
return c(`[data-n-id="${cProps.componentId}"] [data-col-key="${rightActiveFixedColKey}"]::before`, { boxShadow: 'var(--box-shadow-before)' });
|
|
199
|
+
};
|
|
200
|
+
return c([
|
|
201
|
+
createActiveLeftFixedStyle(cProps.leftActiveFixedColKey),
|
|
202
|
+
createActiveRightFixedStyle(cProps.rightActiveFixedColKey),
|
|
203
|
+
cProps.leftActiveFixedChildrenColKeys.map((leftActiveFixedColKey) => createActiveLeftFixedStyle(leftActiveFixedColKey)),
|
|
204
|
+
cProps.rightActiveFixedChildrenColKeys.map((rightActiveFixedColKey) => createActiveRightFixedStyle(rightActiveFixedColKey))
|
|
205
|
+
]);
|
|
206
|
+
}
|
|
180
207
|
]);
|
|
181
208
|
let fixedStyleMounted = false;
|
|
182
209
|
watchEffect(() => {
|
|
183
210
|
const { value: leftActiveFixedColKey } = leftActiveFixedColKeyRef;
|
|
211
|
+
const { value: leftActiveFixedChildrenColKeys } = leftActiveFixedChildrenColKeysRef;
|
|
184
212
|
const { value: rightActiveFixedColKey } = rightActiveFixedColKeyRef;
|
|
213
|
+
const { value: rightActiveFixedChildrenColKeys } = rightActiveFixedChildrenColKeysRef;
|
|
185
214
|
if (!fixedStyleMounted &&
|
|
186
215
|
leftActiveFixedColKey === null &&
|
|
187
216
|
rightActiveFixedColKey === null) {
|
|
188
217
|
return;
|
|
189
218
|
}
|
|
219
|
+
const cProps = {
|
|
220
|
+
leftActiveFixedColKey,
|
|
221
|
+
leftActiveFixedChildrenColKeys,
|
|
222
|
+
rightActiveFixedColKey,
|
|
223
|
+
rightActiveFixedChildrenColKeys,
|
|
224
|
+
componentId
|
|
225
|
+
};
|
|
190
226
|
style.mount({
|
|
191
227
|
id: `n-${componentId}`,
|
|
192
228
|
force: true,
|
|
193
|
-
props:
|
|
194
|
-
leftActiveFixedColKey,
|
|
195
|
-
rightActiveFixedColKey,
|
|
196
|
-
componentId
|
|
197
|
-
}
|
|
229
|
+
props: cProps
|
|
198
230
|
});
|
|
199
231
|
fixedStyleMounted = true;
|
|
200
232
|
});
|
|
@@ -203,9 +235,11 @@ export default defineComponent({
|
|
|
203
235
|
id: `n-${componentId}`
|
|
204
236
|
});
|
|
205
237
|
});
|
|
206
|
-
return Object.assign({
|
|
238
|
+
return Object.assign({ dataTableSlots,
|
|
239
|
+
componentId,
|
|
207
240
|
scrollbarInstRef,
|
|
208
|
-
virtualListRef,
|
|
241
|
+
virtualListRef,
|
|
242
|
+
emptyElRef, summary: summaryRef, mergedClsPrefix: mergedClsPrefixRef, mergedTheme: mergedThemeRef, scrollX: scrollXRef, cols: colsRef, loading: loadingRef, bodyShowHeaderOnly: bodyShowHeaderOnlyRef, shouldDisplaySomeTablePart: shouldDisplaySomeTablePartRef, empty: emptyRef, paginatedData: computed(() => {
|
|
209
243
|
const { value: striped } = stripedRef;
|
|
210
244
|
return paginatedDataRef.value.map(striped
|
|
211
245
|
? (tmNode, index) => {
|
|
@@ -247,13 +281,13 @@ export default defineComponent({
|
|
|
247
281
|
};
|
|
248
282
|
if (scrollX)
|
|
249
283
|
contentStyle.width = '100%';
|
|
250
|
-
|
|
284
|
+
const tableNode = (h(NScrollbar, { ref: "scrollbarInstRef", scrollable: scrollable || isBasicAutoLayout, showScrollbar: !this.bodyShowHeaderOnly, class: `${mergedClsPrefix}-data-table-base-table-body`, style: this.bodyStyle, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, contentStyle: contentStyle, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, horizontalRailStyle: { zIndex: 3 }, verticalRailStyle: { zIndex: 3 }, xScrollable: xScrollable, onScroll: virtualScroll ? undefined : this.handleTableBodyScroll, internalOnUpdateScrollLeft: setHeaderScrollLeft, onResize: onResize }, {
|
|
251
285
|
default: () => {
|
|
252
286
|
// coordinate to pass if there are cells that cross row & col
|
|
253
287
|
const cordToPass = {};
|
|
254
288
|
// coordinate to related hover keys
|
|
255
289
|
const cordKey = {};
|
|
256
|
-
const { cols, paginatedData, mergedTheme, fixedColumnLeftMap, fixedColumnRightMap, currentPage, rowClassName, mergedSortState, mergedExpandedRowKeySet, componentId,
|
|
290
|
+
const { cols, paginatedData, mergedTheme, fixedColumnLeftMap, fixedColumnRightMap, currentPage, rowClassName, mergedSortState, mergedExpandedRowKeySet, componentId, hasChildren, firstContentfulColIndex, rowProps, handleMouseenterTable, handleMouseleaveTable, renderExpand, summary, handleCheckboxUpdateChecked, handleUpdateExpanded } = this;
|
|
257
291
|
const { length: colCount } = cols;
|
|
258
292
|
let mergedData;
|
|
259
293
|
// if there is children in data, we should expand mergedData first
|
|
@@ -338,6 +372,7 @@ export default defineComponent({
|
|
|
338
372
|
this.hoverKey = rowKey;
|
|
339
373
|
}, key: rowKey, class: [
|
|
340
374
|
`${mergedClsPrefix}-data-table-tr`,
|
|
375
|
+
isSummary && `${mergedClsPrefix}-data-table-tr--summary`,
|
|
341
376
|
striped && `${mergedClsPrefix}-data-table-tr--striped`,
|
|
342
377
|
mergedRowClassName
|
|
343
378
|
] }, props), cols.map((col, colIndex) => {
|
|
@@ -436,10 +471,10 @@ export default defineComponent({
|
|
|
436
471
|
tableLayout: this.mergedTableLayout
|
|
437
472
|
} },
|
|
438
473
|
h("colgroup", null, cols.map((col) => (h("col", { key: col.key, style: col.style })))),
|
|
439
|
-
showHeader ? h(TableHeader, { discrete: false }) : null,
|
|
440
|
-
h("tbody", { "data-n-id": componentId, class: `${mergedClsPrefix}-data-table-tbody` }, displayedData.map((rowInfo, rowIndex) => {
|
|
474
|
+
this.showHeader ? h(TableHeader, { discrete: false }) : null,
|
|
475
|
+
!this.empty ? (h("tbody", { "data-n-id": componentId, class: `${mergedClsPrefix}-data-table-tbody` }, displayedData.map((rowInfo, rowIndex) => {
|
|
441
476
|
return renderRow(rowInfo, rowIndex, false);
|
|
442
|
-
}))));
|
|
477
|
+
}))) : null));
|
|
443
478
|
}
|
|
444
479
|
else {
|
|
445
480
|
return (h(VirtualList, { ref: "virtualListRef", items: displayedData, itemSize: 28, visibleItemsTag: VirtualListItemWrapper, visibleItemsProps: {
|
|
@@ -454,5 +489,22 @@ export default defineComponent({
|
|
|
454
489
|
}
|
|
455
490
|
}
|
|
456
491
|
}));
|
|
492
|
+
if (this.empty) {
|
|
493
|
+
const createEmptyNode = () => (h("div", { class: [
|
|
494
|
+
`${mergedClsPrefix}-data-table-empty`,
|
|
495
|
+
this.loading && `${mergedClsPrefix}-data-table-empty--hide`
|
|
496
|
+
], style: this.bodyStyle, ref: "emptyElRef" }, renderSlot(this.dataTableSlots, 'empty', undefined, () => [
|
|
497
|
+
h(NEmpty, { theme: this.mergedTheme.peers.Empty, themeOverrides: this.mergedTheme.peerOverrides.Empty })
|
|
498
|
+
])));
|
|
499
|
+
if (this.shouldDisplaySomeTablePart) {
|
|
500
|
+
return (h(Fragment, null,
|
|
501
|
+
tableNode,
|
|
502
|
+
createEmptyNode()));
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
return (h(VResizeObserver, { onResize: this.onResize }, { default: createEmptyNode }));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
return tableNode;
|
|
457
509
|
}
|
|
458
510
|
});
|
|
@@ -183,9 +183,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
183
183
|
fontSizeMedium: string;
|
|
184
184
|
fontSizeLarge: string;
|
|
185
185
|
opacityDisabled: string;
|
|
186
|
-
colorOpacitySecondary:
|
|
187
|
-
colorOpacitySecondaryHover:
|
|
188
|
-
colorOpacitySecondaryPressed:
|
|
186
|
+
colorOpacitySecondary: string;
|
|
187
|
+
colorOpacitySecondaryHover: string;
|
|
188
|
+
colorOpacitySecondaryPressed: string;
|
|
189
189
|
colorSecondary: string;
|
|
190
190
|
colorSecondaryHover: string;
|
|
191
191
|
colorSecondaryPressed: string;
|
|
@@ -1147,9 +1147,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1147
1147
|
fontSizeMedium: string;
|
|
1148
1148
|
fontSizeLarge: string;
|
|
1149
1149
|
opacityDisabled: string;
|
|
1150
|
-
colorOpacitySecondary:
|
|
1151
|
-
colorOpacitySecondaryHover:
|
|
1152
|
-
colorOpacitySecondaryPressed:
|
|
1150
|
+
colorOpacitySecondary: string;
|
|
1151
|
+
colorOpacitySecondaryHover: string;
|
|
1152
|
+
colorOpacitySecondaryPressed: string;
|
|
1153
1153
|
colorSecondary: string;
|
|
1154
1154
|
colorSecondaryHover: string;
|
|
1155
1155
|
colorSecondaryPressed: string;
|
|
@@ -190,9 +190,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
190
190
|
fontSizeMedium: string;
|
|
191
191
|
fontSizeLarge: string;
|
|
192
192
|
opacityDisabled: string;
|
|
193
|
-
colorOpacitySecondary:
|
|
194
|
-
colorOpacitySecondaryHover:
|
|
195
|
-
colorOpacitySecondaryPressed:
|
|
193
|
+
colorOpacitySecondary: string;
|
|
194
|
+
colorOpacitySecondaryHover: string;
|
|
195
|
+
colorOpacitySecondaryPressed: string;
|
|
196
196
|
colorSecondary: string;
|
|
197
197
|
colorSecondaryHover: string;
|
|
198
198
|
colorSecondaryPressed: string;
|
|
@@ -26,7 +26,7 @@ export default defineComponent({
|
|
|
26
26
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
27
27
|
} = inject(dataTableInjectionKey);
|
|
28
28
|
function handleCheckboxUpdateChecked() {
|
|
29
|
-
if (
|
|
29
|
+
if (allRowsCheckedRef.value) {
|
|
30
30
|
doUncheckAll();
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TreeNode } from 'treemate';
|
|
2
|
-
import { CSSProperties, InjectionKey, Ref, VNodeChild, HTMLAttributes } from 'vue';
|
|
2
|
+
import { CSSProperties, InjectionKey, Ref, VNodeChild, HTMLAttributes, Slots } from 'vue';
|
|
3
3
|
import { EllipsisProps } from '../../ellipsis/src/Ellipsis';
|
|
4
4
|
import { NLocale } from '../../locales';
|
|
5
5
|
import { MergedTheme } from '../../_mixins';
|
|
@@ -100,6 +100,7 @@ export declare type DataTableSelectionOptions = Array<DataTableSelectionOption |
|
|
|
100
100
|
onSelect: () => void;
|
|
101
101
|
}>;
|
|
102
102
|
export interface DataTableInjection {
|
|
103
|
+
slots: Slots;
|
|
103
104
|
indentRef: Ref<number>;
|
|
104
105
|
hasChildrenRef: Ref<boolean>;
|
|
105
106
|
firstContentfulColIndexRef: Ref<number>;
|
|
@@ -115,7 +116,9 @@ export interface DataTableInjection {
|
|
|
115
116
|
leftFixedColumnsRef: Ref<TableColumns>;
|
|
116
117
|
rightFixedColumnsRef: Ref<TableColumns>;
|
|
117
118
|
leftActiveFixedColKeyRef: Ref<ColumnKey | null>;
|
|
119
|
+
leftActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
|
|
118
120
|
rightActiveFixedColKeyRef: Ref<ColumnKey | null>;
|
|
121
|
+
rightActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
|
|
119
122
|
fixedColumnLeftMapRef: Ref<Record<ColumnKey, {
|
|
120
123
|
start: number;
|
|
121
124
|
end: number;
|
|
@@ -53,11 +53,11 @@ export default c([cB('data-table', `
|
|
|
53
53
|
--merged-th-color-hover: var(--th-color-hover);
|
|
54
54
|
--merged-td-color-hover: var(--td-color-hover);
|
|
55
55
|
--merged-td-color-striped: var(--td-color-striped);
|
|
56
|
-
`, [
|
|
56
|
+
`, [cB('data-table-wrapper', `
|
|
57
57
|
flex-grow: 1;
|
|
58
58
|
display: flex;
|
|
59
59
|
flex-direction: column;
|
|
60
|
-
|
|
60
|
+
`), cM('flex-height', [c('>', [cB('data-table-wrapper', [c('>', [cB('data-table-base-table', `
|
|
61
61
|
display: flex;
|
|
62
62
|
flex-direction: column;
|
|
63
63
|
flex-grow: 1;
|
|
@@ -93,7 +93,7 @@ c('&:last-child', 'flex-grow: 1;')])])])])])])]), c('>', [cB('base-loading', `
|
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
background-clip: padding-box;
|
|
95
95
|
transition: background-color .3s var(--bezier);
|
|
96
|
-
`, [cM('striped', 'background-color: var(--merged-td-color-striped);', [cB('data-table-td', 'background-color: var(--merged-td-color-striped);')]), c('&:hover', 'background-color: var(--merged-td-color-hover);', [cB('data-table-td', 'background-color: var(--merged-td-color-hover);')])]), cB('data-table-th', `
|
|
96
|
+
`, [cM('striped', 'background-color: var(--merged-td-color-striped);', [cB('data-table-td', 'background-color: var(--merged-td-color-striped);')]), cNotM('summary', [c('&:hover', 'background-color: var(--merged-td-color-hover);', [cB('data-table-td', 'background-color: var(--merged-td-color-hover);')])])]), cB('data-table-th', `
|
|
97
97
|
padding: var(--th-padding);
|
|
98
98
|
position: relative;
|
|
99
99
|
text-align: start;
|
|
@@ -203,6 +203,7 @@ c('&::after', {
|
|
|
203
203
|
padding: 0;
|
|
204
204
|
line-height: 0;
|
|
205
205
|
`), fixedColumnStyle]), cB('data-table-empty', `
|
|
206
|
+
box-sizing: border-box;
|
|
206
207
|
padding: var(--empty-padding);
|
|
207
208
|
flex-grow: 1;
|
|
208
209
|
flex-shrink: 0;
|
|
@@ -236,15 +237,11 @@ c('&::after', {
|
|
|
236
237
|
borderRight: '1px solid var(--merged-border-color)'
|
|
237
238
|
}, [cM('last-col', {
|
|
238
239
|
borderRight: '0 solid var(--merged-border-color)'
|
|
239
|
-
})])]), cM('bordered', [cB('data-table-wrapper',
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
borderBottom: '0 solid var(--merged-border-color)'
|
|
245
|
-
})]), cB('data-table-base-table-body', `
|
|
246
|
-
border-bottom-left-radius: calc(var(--border-radius) - 1px);
|
|
247
|
-
border-bottom-right-radius: calc(var(--border-radius) - 1px);
|
|
240
|
+
})])]), cM('bordered', [cB('data-table-wrapper', `
|
|
241
|
+
border: 1px solid var(--merged-border-color);
|
|
242
|
+
border-bottom-left-radius: var(--border-radius);
|
|
243
|
+
border-bottom-right-radius: var(--border-radius);
|
|
244
|
+
overflow: hidden;
|
|
248
245
|
`)]), cB('data-table-base-table', [cM('transition-disabled', [cB('data-table-th', [c('&::after, &::before', {
|
|
249
246
|
transition: 'none'
|
|
250
247
|
})]), cB('data-table-td', [c('&::after, &::before', {
|
|
@@ -58,18 +58,22 @@ export function useCheck(props, data) {
|
|
|
58
58
|
uncontrolledCheckedRowKeysRef.value = keys;
|
|
59
59
|
}
|
|
60
60
|
function doCheck(rowKey) {
|
|
61
|
+
if (props.loading)
|
|
62
|
+
return;
|
|
61
63
|
doUpdateCheckedRowKeys(treeMateRef.value.check(rowKey, mergedCheckedRowKeysRef.value, {
|
|
62
64
|
cascade: props.cascade
|
|
63
65
|
}).checkedKeys);
|
|
64
66
|
}
|
|
65
67
|
function doUncheck(rowKey) {
|
|
68
|
+
if (props.loading)
|
|
69
|
+
return;
|
|
66
70
|
doUpdateCheckedRowKeys(treeMateRef.value.uncheck(rowKey, mergedCheckedRowKeysRef.value, {
|
|
67
71
|
cascade: props.cascade
|
|
68
72
|
}).checkedKeys);
|
|
69
73
|
}
|
|
70
74
|
function doCheckAll(checkWholeTable = false) {
|
|
71
75
|
const { value: column } = selectionColumnRef;
|
|
72
|
-
if (!column)
|
|
76
|
+
if (!column || props.loading)
|
|
73
77
|
return;
|
|
74
78
|
const rowKeysToCheck = [];
|
|
75
79
|
(checkWholeTable
|
|
@@ -86,7 +90,7 @@ export function useCheck(props, data) {
|
|
|
86
90
|
}
|
|
87
91
|
function doUncheckAll(checkWholeTable = false) {
|
|
88
92
|
const { value: column } = selectionColumnRef;
|
|
89
|
-
if (!column)
|
|
93
|
+
if (!column || props.loading)
|
|
90
94
|
return;
|
|
91
95
|
const rowKeysToUncheck = [];
|
|
92
96
|
(checkWholeTable
|
|
@@ -19,7 +19,9 @@ export declare function useScroll(props: DataTableSetupProps, { mainTableInstRef
|
|
|
19
19
|
leftFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
|
|
20
20
|
rightFixedColumnsRef: ComputedRef<TableColumn<any>[]>;
|
|
21
21
|
leftActiveFixedColKeyRef: Ref<ColumnKey | null>;
|
|
22
|
+
leftActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
|
|
22
23
|
rightActiveFixedColKeyRef: Ref<ColumnKey | null>;
|
|
24
|
+
rightActiveFixedChildrenColKeysRef: Ref<ColumnKey[]>;
|
|
23
25
|
syncScrollState: () => void;
|
|
24
26
|
handleTableBodyScroll: () => void;
|
|
25
27
|
handleTableHeaderScroll: () => void;
|
|
@@ -6,7 +6,9 @@ import { getColWidth, getColKey } from './utils';
|
|
|
6
6
|
export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyWidthRef, scrollPartRef }) {
|
|
7
7
|
let scrollLeft = 0;
|
|
8
8
|
const leftActiveFixedColKeyRef = ref(null);
|
|
9
|
+
const leftActiveFixedChildrenColKeysRef = ref([]);
|
|
9
10
|
const rightActiveFixedColKeyRef = ref(null);
|
|
11
|
+
const rightActiveFixedChildrenColKeysRef = ref([]);
|
|
10
12
|
const styleScrollXRef = computed(() => {
|
|
11
13
|
return formatLength(props.scrollX);
|
|
12
14
|
});
|
|
@@ -40,7 +42,8 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
40
42
|
const columns = {};
|
|
41
43
|
let right = 0;
|
|
42
44
|
function traverse(cols) {
|
|
43
|
-
cols.
|
|
45
|
+
for (let i = cols.length - 1; i >= 0; --i) {
|
|
46
|
+
const col = cols[i];
|
|
44
47
|
const positionInfo = { start: right, end: 0 };
|
|
45
48
|
columns[getColKey(col)] = positionInfo;
|
|
46
49
|
if ('children' in col) {
|
|
@@ -51,9 +54,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
51
54
|
right += getColWidth(col) || 0;
|
|
52
55
|
positionInfo.end = right;
|
|
53
56
|
}
|
|
54
|
-
}
|
|
57
|
+
}
|
|
55
58
|
}
|
|
56
|
-
traverse(rightFixedColumnsRef.value
|
|
59
|
+
traverse(rightFixedColumnsRef.value);
|
|
57
60
|
return columns;
|
|
58
61
|
});
|
|
59
62
|
function deriveActiveLeftFixedColumn() {
|
|
@@ -75,6 +78,18 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
75
78
|
}
|
|
76
79
|
leftActiveFixedColKeyRef.value = leftActiveFixedColKey;
|
|
77
80
|
}
|
|
81
|
+
function deriveActiveLeftFixedChildrenColumns() {
|
|
82
|
+
leftActiveFixedChildrenColKeysRef.value = [];
|
|
83
|
+
let activeLeftFixedColumn = props.columns.find((col) => getColKey(col) === leftActiveFixedColKeyRef.value);
|
|
84
|
+
while (activeLeftFixedColumn && 'children' in activeLeftFixedColumn) {
|
|
85
|
+
const length = activeLeftFixedColumn.children.length;
|
|
86
|
+
if (length === 0)
|
|
87
|
+
break;
|
|
88
|
+
const nextActiveLeftFixedColumn = activeLeftFixedColumn.children[length - 1];
|
|
89
|
+
leftActiveFixedChildrenColKeysRef.value.push(getColKey(nextActiveLeftFixedColumn));
|
|
90
|
+
activeLeftFixedColumn = nextActiveLeftFixedColumn;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
78
93
|
function deriveActiveRightFixedColumn() {
|
|
79
94
|
var _a, _b;
|
|
80
95
|
// target is header element
|
|
@@ -86,7 +101,7 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
86
101
|
let rightWidth = 0;
|
|
87
102
|
let rightActiveFixedColKey = null;
|
|
88
103
|
const { value: fixedColumnRightMap } = fixedColumnRightMapRef;
|
|
89
|
-
for (let i =
|
|
104
|
+
for (let i = rightFixedColumns.length - 1; i >= 0; --i) {
|
|
90
105
|
const key = getColKey(rightFixedColumns[i]);
|
|
91
106
|
if (Math.round(scrollLeft +
|
|
92
107
|
(((_a = fixedColumnRightMap[key]) === null || _a === void 0 ? void 0 : _a.start) || 0) +
|
|
@@ -101,6 +116,17 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
101
116
|
}
|
|
102
117
|
rightActiveFixedColKeyRef.value = rightActiveFixedColKey;
|
|
103
118
|
}
|
|
119
|
+
function deriveActiveRightFixedChildrenColumns() {
|
|
120
|
+
rightActiveFixedChildrenColKeysRef.value = [];
|
|
121
|
+
let activeRightFixedColumn = props.columns.find((col) => getColKey(col) === rightActiveFixedColKeyRef.value);
|
|
122
|
+
while (activeRightFixedColumn &&
|
|
123
|
+
'children' in activeRightFixedColumn &&
|
|
124
|
+
activeRightFixedColumn.children.length) {
|
|
125
|
+
const nextActiveRightFixedColumn = activeRightFixedColumn.children[0];
|
|
126
|
+
rightActiveFixedChildrenColKeysRef.value.push(getColKey(nextActiveRightFixedColumn));
|
|
127
|
+
activeRightFixedColumn = nextActiveRightFixedColumn;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
104
130
|
function getScrollElements() {
|
|
105
131
|
const header = mainTableInstRef.value
|
|
106
132
|
? mainTableInstRef.value.getHeaderElement()
|
|
@@ -157,7 +183,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
157
183
|
scrollLeft = body.scrollLeft;
|
|
158
184
|
}
|
|
159
185
|
deriveActiveLeftFixedColumn();
|
|
186
|
+
deriveActiveLeftFixedChildrenColumns();
|
|
160
187
|
deriveActiveRightFixedColumn();
|
|
188
|
+
deriveActiveRightFixedChildrenColumns();
|
|
161
189
|
}
|
|
162
190
|
function setHeaderScrollLeft(left) {
|
|
163
191
|
const { header } = getScrollElements();
|
|
@@ -176,7 +204,9 @@ export function useScroll(props, { mainTableInstRef, mergedCurrentPageRef, bodyW
|
|
|
176
204
|
leftFixedColumnsRef,
|
|
177
205
|
rightFixedColumnsRef,
|
|
178
206
|
leftActiveFixedColKeyRef,
|
|
207
|
+
leftActiveFixedChildrenColKeysRef,
|
|
179
208
|
rightActiveFixedColKeyRef,
|
|
209
|
+
rightActiveFixedChildrenColKeysRef,
|
|
180
210
|
syncScrollState,
|
|
181
211
|
handleTableBodyScroll,
|
|
182
212
|
handleTableHeaderScroll,
|
|
@@ -18,6 +18,7 @@ export function useTableData(props, { dataRelatedColsRef }) {
|
|
|
18
18
|
const treeMateRef = computed(() => {
|
|
19
19
|
const { childrenKey } = props;
|
|
20
20
|
return createTreeMate(props.data, {
|
|
21
|
+
ignoreEmptyChildren: true,
|
|
21
22
|
getKey: props.rowKey,
|
|
22
23
|
getChildren: (rowData) => rowData[childrenKey],
|
|
23
24
|
getDisabled: (rowData) => {
|
|
@@ -185,11 +186,13 @@ export function useTableData(props, { dataRelatedColsRef }) {
|
|
|
185
186
|
function mergedOnUpdatePageSize(pageSize) {
|
|
186
187
|
const { pagination } = props;
|
|
187
188
|
if (pagination) {
|
|
188
|
-
const { onPageSizeChange, 'onUpdate:pageSize': onUpdatePageSize } = pagination;
|
|
189
|
+
const { onPageSizeChange, 'onUpdate:pageSize': _onUpdatePageSize, onUpdatePageSize } = pagination;
|
|
189
190
|
if (onPageSizeChange)
|
|
190
191
|
call(onPageSizeChange, pageSize);
|
|
191
192
|
if (onUpdatePageSize)
|
|
192
193
|
call(onUpdatePageSize, pageSize);
|
|
194
|
+
if (_onUpdatePageSize)
|
|
195
|
+
call(_onUpdatePageSize, pageSize);
|
|
193
196
|
doUpdatePageSize(pageSize);
|
|
194
197
|
}
|
|
195
198
|
}
|
|
@@ -112,9 +112,9 @@ declare const dataTableLight: import("../../_mixins").Theme<"DataTable", {
|
|
|
112
112
|
fontSizeMedium: string;
|
|
113
113
|
fontSizeLarge: string;
|
|
114
114
|
opacityDisabled: string;
|
|
115
|
-
colorOpacitySecondary:
|
|
116
|
-
colorOpacitySecondaryHover:
|
|
117
|
-
colorOpacitySecondaryPressed:
|
|
115
|
+
colorOpacitySecondary: string;
|
|
116
|
+
colorOpacitySecondaryHover: string;
|
|
117
|
+
colorOpacitySecondaryPressed: string;
|
|
118
118
|
colorSecondary: string;
|
|
119
119
|
colorSecondaryHover: string;
|
|
120
120
|
colorSecondaryPressed: string;
|