@pinnacle0/web-ui 0.6.46 → 0.7.0-beta.10
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/admin/AdminApp/Default/NavigatorSide/index.js +1 -1
- package/admin/AdminApp/Default/NavigatorSide/index.js.map +1 -1
- package/core/Amount/AmountPercentage.d.ts +1 -4
- package/core/Amount/AmountPercentage.js +5 -8
- package/core/Amount/AmountPercentage.js.map +1 -1
- package/core/Amount/index.d.ts +3 -8
- package/core/Amount/index.js +27 -35
- package/core/Amount/index.js.map +1 -1
- package/core/AuthenticationCodeInput/index.less +5 -1
- package/core/AutoCompleteInput/index.d.ts +2 -5
- package/core/AutoCompleteInput/index.js +5 -7
- package/core/AutoCompleteInput/index.js.map +1 -1
- package/core/BoolSwitch/index.d.ts +5 -7
- package/core/BoolSwitch/index.js +11 -13
- package/core/BoolSwitch/index.js.map +1 -1
- package/core/Breadcrumb/index.d.ts +1 -5
- package/core/Breadcrumb/index.js +8 -16
- package/core/Breadcrumb/index.js.map +1 -1
- package/core/Button/index.d.ts +2 -2
- package/core/Button/index.js +3 -2
- package/core/Button/index.js.map +1 -1
- package/core/Card/index.d.ts +3 -6
- package/core/Card/index.js +4 -7
- package/core/Card/index.js.map +1 -1
- package/core/Carousel/index.d.ts +1 -4
- package/core/Carousel/index.js +4 -7
- package/core/Carousel/index.js.map +1 -1
- package/core/Carousel3D/index.d.ts +1 -21
- package/core/Carousel3D/index.js +76 -83
- package/core/Carousel3D/index.js.map +1 -1
- package/core/Cascader/InitialNullable.d.ts +1 -4
- package/core/Cascader/InitialNullable.js +5 -8
- package/core/Cascader/InitialNullable.js.map +1 -1
- package/core/Cascader/Nullable.d.ts +2 -7
- package/core/Cascader/Nullable.js +10 -12
- package/core/Cascader/Nullable.js.map +1 -1
- package/core/Cascader/index.d.ts +4 -13
- package/core/Cascader/index.js +18 -20
- package/core/Cascader/index.js.map +1 -1
- package/core/Checkbox/index.d.ts +4 -7
- package/core/Checkbox/index.js +4 -9
- package/core/Checkbox/index.js.map +1 -1
- package/core/Collapse/index.d.ts +2 -7
- package/core/Collapse/index.js +4 -6
- package/core/Collapse/index.js.map +1 -1
- package/core/Countdown/SlidingDigit.d.ts +1 -10
- package/core/Countdown/SlidingDigit.js +16 -21
- package/core/Countdown/SlidingDigit.js.map +1 -1
- package/core/Countdown/index.d.ts +1 -18
- package/core/Countdown/index.js +53 -74
- package/core/Countdown/index.js.map +1 -1
- package/core/DarkOverlay/index.d.ts +1 -4
- package/core/DarkOverlay/index.js +4 -7
- package/core/DarkOverlay/index.js.map +1 -1
- package/core/DateCalendar/index.d.ts +2 -13
- package/core/DateCalendar/index.js +12 -14
- package/core/DateCalendar/index.js.map +1 -1
- package/core/DatePicker/index.d.ts +1 -7
- package/core/DatePicker/index.js +9 -16
- package/core/DatePicker/index.js.map +1 -1
- package/core/DateRangePicker/index.d.ts +1 -14
- package/core/DateRangePicker/index.js +25 -34
- package/core/DateRangePicker/index.js.map +1 -1
- package/core/DateTimePicker/index.d.ts +1 -7
- package/core/DateTimePicker/index.js +12 -21
- package/core/DateTimePicker/index.js.map +1 -1
- package/core/DateTimeRangePicker/index.d.ts +1 -17
- package/core/DateTimeRangePicker/index.js +21 -31
- package/core/DateTimeRangePicker/index.js.map +1 -1
- package/core/Descriptions/index.d.ts +3 -8
- package/core/Descriptions/index.js +7 -13
- package/core/Descriptions/index.js.map +1 -1
- package/core/Descriptions/index.less +0 -8
- package/core/DocumentTitle/index.d.ts +4 -13
- package/core/DocumentTitle/index.js +18 -31
- package/core/DocumentTitle/index.js.map +1 -1
- package/core/Drawer/index.d.ts +1 -3
- package/core/Drawer/index.js +4 -5
- package/core/Drawer/index.js.map +1 -1
- package/core/Dropdown/index.d.ts +3 -4
- package/core/Dropdown/index.js +4 -3
- package/core/Dropdown/index.js.map +1 -1
- package/core/EnumCheckboxGroup/Map.d.ts +1 -4
- package/core/EnumCheckboxGroup/Map.js +5 -9
- package/core/EnumCheckboxGroup/Map.js.map +1 -1
- package/core/EnumCheckboxGroup/index.d.ts +3 -4
- package/core/EnumCheckboxGroup/index.js +11 -12
- package/core/EnumCheckboxGroup/index.js.map +1 -1
- package/core/EnumRadio/InitialNullable.d.ts +1 -5
- package/core/EnumRadio/InitialNullable.js +6 -9
- package/core/EnumRadio/InitialNullable.js.map +1 -1
- package/core/EnumRadio/Map.d.ts +1 -4
- package/core/EnumRadio/Map.js +6 -9
- package/core/EnumRadio/Map.js.map +1 -1
- package/core/EnumRadio/Nullable.d.ts +1 -5
- package/core/EnumRadio/Nullable.js +12 -14
- package/core/EnumRadio/Nullable.js.map +1 -1
- package/core/EnumRadio/index.d.ts +5 -12
- package/core/EnumRadio/index.js +9 -17
- package/core/EnumRadio/index.js.map +1 -1
- package/core/EnumSelect/InitialNullable.d.ts +1 -4
- package/core/EnumSelect/InitialNullable.js +4 -8
- package/core/EnumSelect/InitialNullable.js.map +1 -1
- package/core/EnumSelect/Map.d.ts +1 -4
- package/core/EnumSelect/Map.js +6 -9
- package/core/EnumSelect/Map.js.map +1 -1
- package/core/EnumSelect/Nullable.d.ts +1 -5
- package/core/EnumSelect/Nullable.js +12 -14
- package/core/EnumSelect/Nullable.js.map +1 -1
- package/core/EnumSelect/index.d.ts +5 -15
- package/core/EnumSelect/index.js +19 -27
- package/core/EnumSelect/index.js.map +1 -1
- package/core/EnumSelect/index.less +1 -1
- package/core/FlatList/Content/Footer/index.js +3 -2
- package/core/FlatList/Content/Footer/index.js.map +1 -1
- package/core/FlatList/Content/index.d.ts +1 -1
- package/core/FlatList/Content/index.js +10 -8
- package/core/FlatList/Content/index.js.map +1 -1
- package/core/FlatList/FloatingLoader/index.js +3 -2
- package/core/FlatList/FloatingLoader/index.js.map +1 -1
- package/core/FlatList/Refresh/index.js +3 -2
- package/core/FlatList/Refresh/index.js.map +1 -1
- package/core/FlatList/index.d.ts +1 -1
- package/core/FlatList/index.js +10 -9
- package/core/FlatList/index.js.map +1 -1
- package/core/FlatList/shared/Loader/index.js +3 -2
- package/core/FlatList/shared/Loader/index.js.map +1 -1
- package/core/Form/Item.d.ts +1 -16
- package/core/Form/Item.js +28 -40
- package/core/Form/Item.js.map +1 -1
- package/core/Form/index.d.ts +6 -17
- package/core/Form/index.js +29 -46
- package/core/Form/index.js.map +1 -1
- package/core/Form/index.less +1 -1
- package/core/Grid/index.d.ts +2 -2
- package/core/Grid/index.js +2 -1
- package/core/Grid/index.js.map +1 -1
- package/core/HTMLContent/index.d.ts +1 -4
- package/core/HTMLContent/index.js +4 -7
- package/core/HTMLContent/index.js.map +1 -1
- package/core/Image/index.d.ts +3 -6
- package/core/Image/index.js +6 -7
- package/core/Image/index.js.map +1 -1
- package/core/ImageUploader/index.d.ts +2 -11
- package/core/ImageUploader/index.js +17 -25
- package/core/ImageUploader/index.js.map +1 -1
- package/core/Input/index.d.ts +12 -18
- package/core/Input/index.js +37 -41
- package/core/Input/index.js.map +1 -1
- package/core/LabelledSelect/index.d.ts +3 -5
- package/core/LabelledSelect/index.js +4 -7
- package/core/LabelledSelect/index.js.map +1 -1
- package/core/Link/index.d.ts +1 -4
- package/core/Link/index.js +16 -19
- package/core/Link/index.js.map +1 -1
- package/core/LocalImporter/index.d.ts +1 -10
- package/core/LocalImporter/index.js +11 -18
- package/core/LocalImporter/index.js.map +1 -1
- package/core/LocaleSelect/index.d.ts +1 -10
- package/core/LocaleSelect/index.js +16 -18
- package/core/LocaleSelect/index.js.map +1 -1
- package/core/Markdown/index.d.ts +1 -7
- package/core/Markdown/index.js +13 -16
- package/core/Markdown/index.js.map +1 -1
- package/core/Modal/index.less +1 -1
- package/core/MultipleCascader/index.d.ts +1 -9
- package/core/MultipleCascader/index.js +15 -19
- package/core/MultipleCascader/index.js.map +1 -1
- package/core/MultipleEnumSelect/index.d.ts +1 -8
- package/core/MultipleEnumSelect/index.js +9 -15
- package/core/MultipleEnumSelect/index.js.map +1 -1
- package/core/MultipleSelector/TablePopover.d.ts +1 -7
- package/core/MultipleSelector/TablePopover.js +23 -26
- package/core/MultipleSelector/TablePopover.js.map +1 -1
- package/core/MultipleSelector/index.d.ts +1 -9
- package/core/MultipleSelector/index.js +18 -26
- package/core/MultipleSelector/index.js.map +1 -1
- package/core/MutableTable/index.d.ts +1 -13
- package/core/MutableTable/index.js +25 -35
- package/core/MutableTable/index.js.map +1 -1
- package/core/NumberInput/NumberInputPercentage.d.ts +1 -8
- package/core/NumberInput/NumberInputPercentage.js +8 -25
- package/core/NumberInput/NumberInputPercentage.js.map +1 -1
- package/core/NumberInput/index.d.ts +6 -33
- package/core/NumberInput/index.js +45 -72
- package/core/NumberInput/index.js.map +1 -1
- package/core/OverflowableText/index.d.ts +1 -12
- package/core/OverflowableText/index.js +11 -28
- package/core/OverflowableText/index.js.map +1 -1
- package/core/Pagination/index.d.ts +1 -7
- package/core/Pagination/index.js +17 -19
- package/core/Pagination/index.js.map +1 -1
- package/core/Popover/index.d.ts +0 -1
- package/core/Popover/index.js +2 -5
- package/core/Popover/index.js.map +1 -1
- package/core/Progress/index.d.ts +1 -4
- package/core/Progress/index.js +4 -6
- package/core/Progress/index.js.map +1 -1
- package/core/Radio/index.d.ts +5 -7
- package/core/Radio/index.js +2 -8
- package/core/Radio/index.js.map +1 -1
- package/core/RelativeTime/index.d.ts +1 -15
- package/core/RelativeTime/index.js +17 -31
- package/core/RelativeTime/index.js.map +1 -1
- package/core/Resizable/index.js +3 -2
- package/core/Resizable/index.js.map +1 -1
- package/core/SearchableSelect/index.d.ts +3 -5
- package/core/SearchableSelect/index.js +4 -7
- package/core/SearchableSelect/index.js.map +1 -1
- package/core/Select/index.d.ts +8 -7
- package/core/Select/index.js +8 -8
- package/core/Select/index.js.map +1 -1
- package/core/SignedAmountInput/index.d.ts +1 -8
- package/core/SignedAmountInput/index.js +16 -24
- package/core/SignedAmountInput/index.js.map +1 -1
- package/core/Skeleton/index.d.ts +1 -4
- package/core/Skeleton/index.js +4 -7
- package/core/Skeleton/index.js.map +1 -1
- package/core/Slider/RangeSlider.d.ts +2 -6
- package/core/Slider/RangeSlider.js +4 -7
- package/core/Slider/RangeSlider.js.map +1 -1
- package/core/Slider/index.d.ts +3 -7
- package/core/Slider/index.js +15 -20
- package/core/Slider/index.js.map +1 -1
- package/core/Space/index.d.ts +3 -5
- package/core/Space/index.js +4 -7
- package/core/Space/index.js.map +1 -1
- package/core/Spin/index.d.ts +3 -6
- package/core/Spin/index.js +4 -7
- package/core/Spin/index.js.map +1 -1
- package/core/StepFormContainer/index.d.ts +2 -7
- package/core/StepFormContainer/index.js +13 -17
- package/core/StepFormContainer/index.js.map +1 -1
- package/core/Steps/index.d.ts +3 -6
- package/core/Steps/index.js +4 -6
- package/core/Steps/index.js.map +1 -1
- package/core/Table/index.d.ts +10 -34
- package/core/Table/index.js +73 -80
- package/core/Table/index.js.map +1 -1
- package/core/Tabs/Single.d.ts +1 -4
- package/core/Tabs/Single.js +4 -7
- package/core/Tabs/Single.js.map +1 -1
- package/core/Tabs/index.d.ts +3 -13
- package/core/Tabs/index.js +27 -35
- package/core/Tabs/index.js.map +1 -1
- package/core/Tag/index.d.ts +2 -5
- package/core/Tag/index.js +4 -6
- package/core/Tag/index.js.map +1 -1
- package/core/TagInput/index.d.ts +2 -15
- package/core/TagInput/index.js +25 -41
- package/core/TagInput/index.js.map +1 -1
- package/core/Tags/index.d.ts +1 -6
- package/core/Tags/index.js +9 -13
- package/core/Tags/index.js.map +1 -1
- package/core/TimePicker/index.d.ts +1 -7
- package/core/TimePicker/index.js +8 -11
- package/core/TimePicker/index.js.map +1 -1
- package/core/TimeRangePicker/index.d.ts +1 -14
- package/core/TimeRangePicker/index.js +21 -27
- package/core/TimeRangePicker/index.js.map +1 -1
- package/core/Tooltip/index.d.ts +3 -4
- package/core/Tooltip/index.js +2 -5
- package/core/Tooltip/index.js.map +1 -1
- package/core/TypedTabs/index.d.ts +1 -4
- package/core/TypedTabs/index.js +16 -18
- package/core/TypedTabs/index.js.map +1 -1
- package/core/Uploader/index.d.ts +1 -17
- package/core/Uploader/index.js +25 -31
- package/core/Uploader/index.js.map +1 -1
- package/core/VirtualList/index.d.ts +1 -1
- package/core/VirtualList/index.js +3 -2
- package/core/VirtualList/index.js.map +1 -1
- package/core/VirtualTable/{TableHeader.js → OldVirtualTable/TableHeader.js} +2 -2
- package/core/VirtualTable/OldVirtualTable/TableHeader.js.map +1 -0
- package/core/VirtualTable/{TableRow.js → OldVirtualTable/TableRow.js} +2 -2
- package/core/VirtualTable/OldVirtualTable/TableRow.js.map +1 -0
- package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnWidths.js +1 -1
- package/core/VirtualTable/OldVirtualTable/hooks/useColumnWidths.js.map +1 -0
- package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnsStickyPosition.js +1 -1
- package/core/VirtualTable/OldVirtualTable/hooks/useColumnsStickyPosition.js.map +1 -0
- package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useRowSelection.d.ts +1 -1
- package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useRowSelection.js +2 -2
- package/core/VirtualTable/OldVirtualTable/hooks/useRowSelection.js.map +1 -0
- package/core/VirtualTable/OldVirtualTable/hooks/useScroll.js.map +1 -0
- package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScrollBarSize.js +1 -1
- package/core/VirtualTable/OldVirtualTable/hooks/useScrollBarSize.js.map +1 -0
- package/core/VirtualTable/OldVirtualTable/index.d.ts +28 -0
- package/core/VirtualTable/OldVirtualTable/index.js +58 -0
- package/core/VirtualTable/OldVirtualTable/index.js.map +1 -0
- package/core/VirtualTable/OldVirtualTable/index.old.less +160 -0
- package/core/VirtualTable/OldVirtualTable/type.d.ts +45 -0
- package/core/VirtualTable/OldVirtualTable/type.js +2 -0
- package/core/VirtualTable/OldVirtualTable/type.js.map +1 -0
- package/core/VirtualTable/index.d.ts +19 -26
- package/core/VirtualTable/index.js +68 -50
- package/core/VirtualTable/index.js.map +1 -1
- package/core/VirtualTable/index.less +28 -140
- package/core/VirtualTable/type.d.ts +17 -43
- package/core/WithExplanation/index.d.ts +1 -6
- package/core/WithExplanation/index.js +11 -20
- package/core/WithExplanation/index.js.map +1 -1
- package/core/WithTooltipList/index.d.ts +1 -9
- package/core/WithTooltipList/index.js +28 -27
- package/core/WithTooltipList/index.js.map +1 -1
- package/core/YearMonthSelector/index.d.ts +1 -7
- package/core/YearMonthSelector/index.js +9 -15
- package/core/YearMonthSelector/index.js.map +1 -1
- package/hooks/useParentResizeObserver/index.d.ts +2 -0
- package/hooks/useParentResizeObserver/index.js +17 -0
- package/hooks/useParentResizeObserver/index.js.map +1 -0
- package/hooks/useResizeObserver/index.d.ts +1 -1
- package/hooks/useResizeObserver/index.js +6 -10
- package/hooks/useResizeObserver/index.js.map +1 -1
- package/package.json +5 -5
- package/util/ModalUtil/index.less +1 -1
- package/util/OrientationUtil/index.js +22 -37
- package/util/OrientationUtil/index.js.map +1 -1
- package/util/PromptUtil/PromptBody.d.ts +4 -13
- package/util/PromptUtil/PromptBody.js +19 -28
- package/util/PromptUtil/PromptBody.js.map +1 -1
- package/util/PromptUtil/index.js +1 -1
- package/util/PromptUtil/index.js.map +1 -1
- package/util/ReactUtil/index.d.ts +20 -0
- package/util/ReactUtil/index.js +35 -0
- package/util/ReactUtil/index.js.map +1 -1
- package/core/VirtualTable/TableHeader.js.map +0 -1
- package/core/VirtualTable/TableRow.js.map +0 -1
- package/core/VirtualTable/hooks/useColumnWidths.js.map +0 -1
- package/core/VirtualTable/hooks/useColumnsStickyPosition.js.map +0 -1
- package/core/VirtualTable/hooks/useRowSelection.js.map +0 -1
- package/core/VirtualTable/hooks/useScroll.js.map +0 -1
- package/core/VirtualTable/hooks/useScrollBarSize.js.map +0 -1
- /package/core/VirtualTable/{TableHeader.d.ts → OldVirtualTable/TableHeader.d.ts} +0 -0
- /package/core/VirtualTable/{TableRow.d.ts → OldVirtualTable/TableRow.d.ts} +0 -0
- /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnWidths.d.ts +0 -0
- /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useColumnsStickyPosition.d.ts +0 -0
- /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScroll.d.ts +0 -0
- /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScroll.js +0 -0
- /package/core/VirtualTable/{hooks → OldVirtualTable/hooks}/useScrollBarSize.d.ts +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
type ColumnIndex = number;
|
|
2
|
+
export type ColumnFixedPosition = "left" | "right";
|
|
3
|
+
export interface StickyPosition {
|
|
4
|
+
value: number;
|
|
5
|
+
isLast: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type ColumnsStickyPosition = Record<ColumnIndex, StickyPosition>;
|
|
8
|
+
/**
|
|
9
|
+
* Similar usage of Antd Table but only support partial features: fixed columns, row selection, on row click
|
|
10
|
+
*/
|
|
11
|
+
export type VirtualTableRowSelection<RowType extends object> = {
|
|
12
|
+
width: number;
|
|
13
|
+
selectedRowKeys: React.Key[];
|
|
14
|
+
onChange: (selectedRowKeys: React.Key[], selectedRows: RowType[]) => void;
|
|
15
|
+
/**
|
|
16
|
+
* Can only sticky in left
|
|
17
|
+
*/
|
|
18
|
+
fixed?: boolean;
|
|
19
|
+
isDisabled?: (data: RowType, rowIndex: number) => boolean;
|
|
20
|
+
isSelectAllDisabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Attention:
|
|
23
|
+
* If title is provided, the select all checkbox wil be overridden
|
|
24
|
+
*/
|
|
25
|
+
title?: React.ReactElement | string | number | null;
|
|
26
|
+
};
|
|
27
|
+
export type VirtualTableColumn<RowType extends object> = {
|
|
28
|
+
title: React.ReactElement | string | number;
|
|
29
|
+
width: number;
|
|
30
|
+
/**
|
|
31
|
+
* Attention:
|
|
32
|
+
* If renderData return null, the corresponding table cell will not render
|
|
33
|
+
*/
|
|
34
|
+
renderData: (record: RowType, rowIndex: number) => React.ReactNode | undefined;
|
|
35
|
+
align?: "left" | "right" | "center";
|
|
36
|
+
display?: "default" | "hidden";
|
|
37
|
+
fixed?: "left" | "right";
|
|
38
|
+
/**
|
|
39
|
+
* Attention:
|
|
40
|
+
* The overridden cell should return null in renderData props:
|
|
41
|
+
* e.g. [{colSpan: 3, renderData: () => <div />}, {renderData: () => null}], {renderData: () => null}
|
|
42
|
+
*/
|
|
43
|
+
colSpan?: (record: RowType, rowIndex: number, colIndex: number) => number;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../src/core/VirtualTable/OldVirtualTable/type.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +1,21 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { StringKey } from "../../internal/type";
|
|
3
|
-
import type { VirtualTableColumn, VirtualTableRowSelection } from "./type";
|
|
4
2
|
import "./index.less";
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rowKey?: StringKey<RowType> | "index";
|
|
25
|
-
headerHeight?: number;
|
|
26
|
-
rowSelection?: VirtualTableRowSelection<RowType>;
|
|
27
|
-
}
|
|
28
|
-
export declare const VirtualTable: <RowType extends object>({ columns, rowHeight, dataSource, className, rowClassName, loading, emptyPlaceholder, onRowClick, scrollY, scrollX, overscan, rowSelection, headerHeight, rowKey }: VirtualTableProps<RowType>) => React.JSX.Element;
|
|
3
|
+
import type { VirtualTableProps } from "./type";
|
|
4
|
+
export type { TableRowSelection as VirtualTableRowSelection, TableHandler as VirtualTableHandler } from "../Table";
|
|
5
|
+
export type { VirtualTableProps, VirtualTableColumns } from "./type";
|
|
6
|
+
/**
|
|
7
|
+
* Antd Table's scrollX behaviour is different from scrollY
|
|
8
|
+
*
|
|
9
|
+
* scrollY:
|
|
10
|
+
* the height of the scrollable (visible/rendered) container
|
|
11
|
+
* If scrollY > container height, it will overflow the container
|
|
12
|
+
* We cannot use overflow: hidden on container since it will cause the last few rows to be hidden
|
|
13
|
+
*
|
|
14
|
+
* scrollX:
|
|
15
|
+
* It is the total of column width of all columns that are not hidden
|
|
16
|
+
* If scrollX > all columns width, all columns will be expanded and lose the width property
|
|
17
|
+
* In order to calculate the scrollX, we need to sum up the width of all columns
|
|
18
|
+
*
|
|
19
|
+
* If scrollX is not provided, all column must provide width, ref: ./type.ts
|
|
20
|
+
*/
|
|
21
|
+
export declare const VirtualTable: <RowType extends object>(props: VirtualTableProps<RowType>) => React.JSX.Element;
|
|
@@ -1,58 +1,76 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
3
2
|
import { classNames } from "../../util/ClassNames";
|
|
4
|
-
import { Spin } from "../Spin";
|
|
5
|
-
import { TableRow } from "./TableRow";
|
|
6
|
-
import { TableHeader } from "./TableHeader";
|
|
7
|
-
import { useRowSelection } from "./hooks/useRowSelection";
|
|
8
|
-
import { useColumnWidths } from "./hooks/useColumnWidths";
|
|
9
|
-
import { useScrollBarSize } from "./hooks/useScrollBarSize";
|
|
10
|
-
import { useScrollToEdge, useSyncScroll, useScrollable } from "./hooks/useScroll";
|
|
11
|
-
import { useColumnsStickyPosition } from "./hooks/useColumnsStickyPosition";
|
|
12
3
|
import { ReactUtil } from "../../util/ReactUtil";
|
|
4
|
+
import { Table } from "../Table";
|
|
13
5
|
import "./index.less";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
6
|
+
import { useResizeObserver } from "../../hooks/useResizeObserver";
|
|
7
|
+
import { useDebounce } from "../../hooks/useDebounce";
|
|
8
|
+
/**
|
|
9
|
+
* Antd Table's scrollX behaviour is different from scrollY
|
|
10
|
+
*
|
|
11
|
+
* scrollY:
|
|
12
|
+
* the height of the scrollable (visible/rendered) container
|
|
13
|
+
* If scrollY > container height, it will overflow the container
|
|
14
|
+
* We cannot use overflow: hidden on container since it will cause the last few rows to be hidden
|
|
15
|
+
*
|
|
16
|
+
* scrollX:
|
|
17
|
+
* It is the total of column width of all columns that are not hidden
|
|
18
|
+
* If scrollX > all columns width, all columns will be expanded and lose the width property
|
|
19
|
+
* In order to calculate the scrollX, we need to sum up the width of all columns
|
|
20
|
+
*
|
|
21
|
+
* If scrollX is not provided, all column must provide width, ref: ./type.ts
|
|
22
|
+
*/
|
|
23
|
+
export const VirtualTable = ReactUtil.memo("VirtualTable", function (props) {
|
|
24
|
+
const { dataSource, className, width = "100%", scrollY: propScrollY, emptyPlaceholder, debounceDelay = 0, ...restProps } = props;
|
|
25
|
+
const [scrollY, setScrollY] = React.useState(propScrollY ?? 300);
|
|
26
|
+
const [headerHeight, setHeaderHeight] = React.useState(0);
|
|
27
|
+
const containerRef = React.useRef(null);
|
|
28
|
+
const updateScrollY = useDebounce((entries) => {
|
|
29
|
+
const parentHeight = entries[0].contentRect.height;
|
|
30
|
+
let newScrollY = Math.max(0, parentHeight - headerHeight);
|
|
31
|
+
if (propScrollY)
|
|
32
|
+
newScrollY = Math.min(newScrollY, propScrollY);
|
|
33
|
+
setScrollY(newScrollY);
|
|
34
|
+
}, debounceDelay);
|
|
39
35
|
React.useEffect(() => {
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const parent = containerRef.current?.parentElement;
|
|
37
|
+
if (!parent)
|
|
38
|
+
return;
|
|
39
|
+
const observer = new ResizeObserver(updateScrollY);
|
|
40
|
+
observer.observe(parent);
|
|
41
|
+
return () => {
|
|
42
|
+
observer.unobserve(parent);
|
|
43
|
+
observer.disconnect();
|
|
44
|
+
};
|
|
45
|
+
}, [headerHeight, updateScrollY]);
|
|
46
|
+
// Need to listen to header change onMount so we can calculate the scrollY correctly
|
|
47
|
+
const headerRef = useResizeObserver(({ height }) => {
|
|
48
|
+
setHeaderHeight(height);
|
|
49
|
+
});
|
|
42
50
|
React.useEffect(() => {
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
headerRef.current = containerRef.current?.querySelector(".ant-table-header") ?? null;
|
|
52
|
+
}, [containerRef, headerRef]);
|
|
53
|
+
const containerStyle = React.useMemo(() => {
|
|
54
|
+
return {
|
|
55
|
+
width,
|
|
56
|
+
height: "100%",
|
|
57
|
+
};
|
|
58
|
+
}, [width]);
|
|
59
|
+
const scrollX = React.useMemo(() => {
|
|
60
|
+
if ("scrollX" in restProps)
|
|
61
|
+
return restProps.scrollX;
|
|
62
|
+
return restProps.columns.reduce((acc, column) => acc + (column.hidden ? 0 : column.width), 0);
|
|
63
|
+
}, [restProps]);
|
|
64
|
+
const emptyElement = React.createElement("div", { style: { height: scrollY } }, emptyPlaceholder || "暂无数据");
|
|
65
|
+
return (React.createElement("div", { ref: containerRef, className: classNames("g-virtual-table", className), style: containerStyle },
|
|
66
|
+
React.createElement(Table
|
|
67
|
+
// @ts-ignore: using our Table component with virtual props from antd
|
|
68
|
+
, {
|
|
69
|
+
// @ts-ignore: using our Table component with virtual props from antd
|
|
70
|
+
virtual: true, dataSource: dataSource,
|
|
71
|
+
/**
|
|
72
|
+
* Antd <Table virtual /> must use number scrollX or number scrollY to work
|
|
73
|
+
*/
|
|
74
|
+
scrollY: scrollY, scrollX: scrollX, emptyPlaceholder: emptyElement, ...restProps })));
|
|
57
75
|
});
|
|
58
76
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualTable/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualTable/index.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,157 +1,45 @@
|
|
|
1
|
-
.fixed-column-shadow(@position) {
|
|
2
|
-
content: "";
|
|
3
|
-
position: absolute;
|
|
4
|
-
width: 30px;
|
|
5
|
-
height: 100%;
|
|
6
|
-
pointer-events: none;
|
|
7
|
-
background-color: transparent;
|
|
8
|
-
top: 0;
|
|
9
|
-
bottom: -1px;
|
|
10
|
-
transition: box-shadow 0.3s;
|
|
11
|
-
|
|
12
|
-
& when (@position = "right") {
|
|
13
|
-
left: 0;
|
|
14
|
-
transform: translate(-100%);
|
|
15
|
-
box-shadow: inset -10px 0 8px -8px #00000026;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
& when (@position = "left") {
|
|
19
|
-
right: 0;
|
|
20
|
-
transform: translate(100%);
|
|
21
|
-
box-shadow: inset 10px 0 8px -8px #00000026;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
1
|
.g-virtual-table {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.mask {
|
|
30
|
-
position: absolute;
|
|
31
|
-
top: 0;
|
|
32
|
-
left: 0;
|
|
33
|
-
width: 100%;
|
|
34
|
-
height: 100%;
|
|
35
|
-
display: flex;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
align-items: center;
|
|
38
|
-
background: rgb(255 255 255 / 70%);
|
|
39
|
-
z-index: 15;
|
|
40
|
-
}
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
max-height: 100%;
|
|
41
4
|
|
|
42
|
-
.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
5
|
+
.ant-table {
|
|
6
|
+
.ant-table-tbody {
|
|
7
|
+
.ant-table-cell {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
46
10
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.table-cell.fixed {
|
|
50
|
-
&.last.left::after {
|
|
51
|
-
box-shadow: none !important;
|
|
11
|
+
&.ant-table-selection-column {
|
|
12
|
+
justify-content: center;
|
|
52
13
|
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
14
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.table-cell.fixed {
|
|
59
|
-
&.last.right::after {
|
|
60
|
-
box-shadow: none !important;
|
|
15
|
+
&[style*="text-align: right"] {
|
|
16
|
+
justify-content: flex-end;
|
|
61
17
|
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.table {
|
|
66
|
-
min-height: 100%;
|
|
67
18
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
position: fixed;
|
|
72
|
-
top: 0;
|
|
73
|
-
z-index: 10;
|
|
74
|
-
min-width: 100%;
|
|
75
|
-
overflow-x: hidden;
|
|
76
|
-
|
|
77
|
-
.table-header {
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
background-color: #f2f2f2;
|
|
81
|
-
height: 100%;
|
|
82
|
-
position: relative;
|
|
83
|
-
|
|
84
|
-
&:not(:last-of-type)::before {
|
|
85
|
-
background-color: rgb(0 0 0 / 6%);
|
|
86
|
-
content: "";
|
|
87
|
-
height: 60%;
|
|
88
|
-
position: absolute;
|
|
89
|
-
right: 0;
|
|
90
|
-
top: 50%;
|
|
91
|
-
transform: translateY(-50%);
|
|
92
|
-
transition: background-color 0.3s;
|
|
93
|
-
width: 1px;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&.fixed {
|
|
97
|
-
position: sticky;
|
|
98
|
-
z-index: 5;
|
|
99
|
-
|
|
100
|
-
&.last {
|
|
101
|
-
&.left {
|
|
102
|
-
&::after {
|
|
103
|
-
.fixed-column-shadow("left");
|
|
104
|
-
}
|
|
105
|
-
}
|
|
19
|
+
&[style*="text-align: center"] {
|
|
20
|
+
justify-content: center;
|
|
21
|
+
}
|
|
106
22
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
.fixed-column-shadow("right");
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
23
|
+
&[style*="text-align: left"] {
|
|
24
|
+
justify-content: flex-start;
|
|
114
25
|
}
|
|
115
26
|
}
|
|
27
|
+
}
|
|
116
28
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
justify-content: center;
|
|
120
|
-
align-items: center;
|
|
121
|
-
position: relative;
|
|
122
|
-
height: 100%;
|
|
123
|
-
|
|
124
|
-
.table-row {
|
|
125
|
-
width: max-content;
|
|
126
|
-
position: absolute;
|
|
127
|
-
top: 0;
|
|
128
|
-
left: 0;
|
|
129
|
-
|
|
130
|
-
.table-cell {
|
|
131
|
-
display: inline-flex;
|
|
132
|
-
align-items: center;
|
|
133
|
-
background-color: #fff;
|
|
134
|
-
overflow-wrap: anywhere;
|
|
135
|
-
vertical-align: bottom;
|
|
29
|
+
&.ant-table-empty .ant-table-container .ant-table-body {
|
|
30
|
+
overflow: hidden !important;
|
|
136
31
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
z-index: 5;
|
|
32
|
+
.ant-table-cell {
|
|
33
|
+
padding: 0;
|
|
140
34
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
.fixed-column-shadow("left");
|
|
145
|
-
}
|
|
146
|
-
}
|
|
35
|
+
.ant-table-expanded-row-fixed {
|
|
36
|
+
margin: 0;
|
|
37
|
+
padding: 0;
|
|
147
38
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
39
|
+
.empty-text-node {
|
|
40
|
+
display: flex;
|
|
41
|
+
justify-content: center;
|
|
42
|
+
align-items: center;
|
|
155
43
|
}
|
|
156
44
|
}
|
|
157
45
|
}
|
|
@@ -1,45 +1,19 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
export interface StickyPosition {
|
|
4
|
-
value: number;
|
|
5
|
-
isLast: boolean;
|
|
6
|
-
}
|
|
7
|
-
export type ColumnsStickyPosition = Record<ColumnIndex, StickyPosition>;
|
|
8
|
-
/**
|
|
9
|
-
* Similar usage of Antd Table but only support partial features: fixed columns, row selection, on row click
|
|
10
|
-
*/
|
|
11
|
-
export type VirtualTableRowSelection<RowType extends object> = {
|
|
12
|
-
width: number;
|
|
13
|
-
selectedRowKeys: React.Key[];
|
|
14
|
-
onChange: (selectedRowKeys: React.Key[], selectedRows: RowType[]) => void;
|
|
15
|
-
/**
|
|
16
|
-
* Can only sticky in left
|
|
17
|
-
*/
|
|
18
|
-
fixed?: boolean;
|
|
19
|
-
isDisabled?: (data: RowType, rowIndex: number) => boolean;
|
|
20
|
-
isSelectAllDisabled?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Attention:
|
|
23
|
-
* If title is provided, the select all checkbox wil be overridden
|
|
24
|
-
*/
|
|
25
|
-
title?: React.ReactElement | string | number | null;
|
|
26
|
-
};
|
|
27
|
-
export type VirtualTableColumn<RowType extends object> = {
|
|
28
|
-
title: React.ReactElement | string | number;
|
|
1
|
+
import type { TableColumn, TableProps } from "../Table";
|
|
2
|
+
interface TableColumnWithWidth<RowType extends object> extends Omit<TableColumn<RowType>, "width"> {
|
|
29
3
|
width: number;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
4
|
+
}
|
|
5
|
+
export type VirtualTableColumns<RowType extends object, UseScrollX = false> = UseScrollX extends true ? TableColumn<RowType>[] : TableColumnWithWidth<RowType>[];
|
|
6
|
+
interface VirtualTableBaseProps<RowType extends object> extends Omit<TableProps<RowType, undefined>, "columns" | "scrollX" | "scrollY"> {
|
|
7
|
+
width?: number | string;
|
|
8
|
+
scrollY?: number;
|
|
9
|
+
debounceDelay?: number;
|
|
10
|
+
}
|
|
11
|
+
interface VirtualTablePropsWithScrollX<RowType extends object> extends VirtualTableBaseProps<RowType> {
|
|
12
|
+
columns: VirtualTableColumns<RowType, true>;
|
|
13
|
+
scrollX: number;
|
|
14
|
+
}
|
|
15
|
+
interface VirtualTablePropsWithColumnWidth<RowType extends object> extends VirtualTableBaseProps<RowType> {
|
|
16
|
+
columns: VirtualTableColumns<RowType, false>;
|
|
17
|
+
}
|
|
18
|
+
export type VirtualTableProps<RowType extends object> = VirtualTablePropsWithScrollX<RowType> | VirtualTablePropsWithColumnWidth<RowType>;
|
|
45
19
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { PickOptional } from "../../internal/type";
|
|
3
2
|
import type { TooltipPlacement } from "../Tooltip";
|
|
4
3
|
import "./index.less";
|
|
5
4
|
export interface Props {
|
|
@@ -14,8 +13,4 @@ export interface Props {
|
|
|
14
13
|
placement?: TooltipPlacement;
|
|
15
14
|
iconPosition?: "left" | "right";
|
|
16
15
|
}
|
|
17
|
-
export declare
|
|
18
|
-
static displayName: string;
|
|
19
|
-
static defaultProps: PickOptional<Props>;
|
|
20
|
-
render(): string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element;
|
|
21
|
-
}
|
|
16
|
+
export declare const WithExplanation: ({ children, explanation, iconPosition }: Props) => string | number | bigint | true | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element;
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { classNames } from "../../util/ClassNames";
|
|
3
3
|
import { Tooltip } from "../Tooltip";
|
|
4
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
4
5
|
import "./index.less";
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
React.createElement(Tooltip, { className: "g-with-explanation-tooltip", title: Array.isArray(explanation) ? explanation.map((_, index) => React.createElement("p", { key: index }, _)) : explanation, childContainerProps: { className: "icon-container" } },
|
|
16
|
-
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 26 24" },
|
|
17
|
-
React.createElement("circle", { cx: "8", cy: "8", r: "8", style: { strokeMiterlimit: 10 }, transform: "translate(3.5 4)" }),
|
|
18
|
-
React.createElement("path", { d: "M2.338 9.9a.972.972 0 0 1-.294-.715.929.929 0 0 1 .294-.714.991.991 0 0 1 .728-.28 1 1 0 0 1 .742.28.929.929 0 0 1 .294.714.994.994 0 0 1-.308.728 1.049 1.049 0 0 1-.728.28 1 1 0 0 1-.728-.293zm-.014-2.466V7.2a2.794 2.794 0 0 1 .28-1.33 6.938 6.938 0 0 1 1.582-1.74l.239-.266a1.638 1.638 0 0 0 .391-1.022 1.593 1.593 0 0 0-.406-1.148 1.624 1.624 0 0 0-1.19-.419 1.549 1.549 0 0 0-1.373.6A2.345 2.345 0 0 0 1.47 3.3H0A3.247 3.247 0 0 1 .882.9 3.245 3.245 0 0 1 3.318 0 3.131 3.131 0 0 1 5.5.742a2.53 2.53 0 0 1 .841 2 2.71 2.71 0 0 1-.531 1.71 14.388 14.388 0 0 1-1.176 1.092 2.319 2.319 0 0 0-.588.728 1.871 1.871 0 0 0-.224.924v.238z", transform: "translate(8.336 6.808)" })))));
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
return children || "";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
6
|
+
export const WithExplanation = ReactUtil.memo("WithExplanation", ({ children, explanation, iconPosition = "right" }) => {
|
|
7
|
+
if (!explanation)
|
|
8
|
+
return children || "";
|
|
9
|
+
return (React.createElement("div", { className: classNames("g-with-explanation", `with-icon-${iconPosition}`) },
|
|
10
|
+
children,
|
|
11
|
+
React.createElement(Tooltip, { className: "g-with-explanation-tooltip", title: Array.isArray(explanation) ? explanation.map((_, index) => React.createElement("p", { key: index }, _)) : explanation, childContainerProps: { className: "icon-container" } },
|
|
12
|
+
React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 26 24" },
|
|
13
|
+
React.createElement("circle", { cx: "8", cy: "8", r: "8", style: { strokeMiterlimit: 10 }, transform: "translate(3.5 4)" }),
|
|
14
|
+
React.createElement("path", { d: "M2.338 9.9a.972.972 0 0 1-.294-.715.929.929 0 0 1 .294-.714.991.991 0 0 1 .728-.28 1 1 0 0 1 .742.28.929.929 0 0 1 .294.714.994.994 0 0 1-.308.728 1.049 1.049 0 0 1-.728.28 1 1 0 0 1-.728-.293zm-.014-2.466V7.2a2.794 2.794 0 0 1 .28-1.33 6.938 6.938 0 0 1 1.582-1.74l.239-.266a1.638 1.638 0 0 0 .391-1.022 1.593 1.593 0 0 0-.406-1.148 1.624 1.624 0 0 0-1.19-.419 1.549 1.549 0 0 0-1.373.6A2.345 2.345 0 0 0 1.47 3.3H0A3.247 3.247 0 0 1 .882.9 3.245 3.245 0 0 1 3.318 0 3.131 3.131 0 0 1 5.5.742a2.53 2.53 0 0 1 .841 2 2.71 2.71 0 0 1-.531 1.71 14.388 14.388 0 0 1-1.176 1.092 2.319 2.319 0 0 0-.588.728 1.871 1.871 0 0 0-.224.924v.238z", transform: "translate(8.336 6.808)" })))));
|
|
15
|
+
});
|
|
25
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/WithExplanation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/WithExplanation/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,cAAc,CAAC;AAetB,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAC,QAAQ,EAAE,WAAW,EAAE,YAAY,GAAG,OAAO,EAAQ,EAAE,EAAE;IACxH,IAAI,CAAC,WAAW;QAAE,OAAO,QAAQ,IAAI,EAAE,CAAC;IACxC,OAAO,CACH,6BAAK,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,aAAa,YAAY,EAAE,CAAC;QACxE,QAAQ;QACT,oBAAC,OAAO,IACJ,SAAS,EAAC,4BAA4B,EACtC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,2BAAG,GAAG,EAAE,KAAK,IAAG,CAAC,CAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EACvG,mBAAmB,EAAE,EAAC,SAAS,EAAE,gBAAgB,EAAC;YAElD,6BAAK,KAAK,EAAC,4BAA4B,EAAC,OAAO,EAAC,WAAW;gBACvD,gCAAQ,EAAE,EAAC,GAAG,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,EAAC,GAAG,EAAC,KAAK,EAAE,EAAC,gBAAgB,EAAE,EAAE,EAAC,EAAE,SAAS,EAAC,kBAAkB,GAAG;gBAC1F,8BACI,CAAC,EAAC,4nBAA4nB,EAC9nB,SAAS,EAAC,wBAAwB,GACpC,CACA,CACA,CACR,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -13,12 +13,4 @@ export interface Props {
|
|
|
13
13
|
onClick?: () => void;
|
|
14
14
|
onOpenChange?: (open: boolean) => void;
|
|
15
15
|
}
|
|
16
|
-
export declare
|
|
17
|
-
static displayName: string;
|
|
18
|
-
private readonly labelStyle;
|
|
19
|
-
private readonly wrapperStyle;
|
|
20
|
-
private readonly childContainerProps;
|
|
21
|
-
renderTooltip: () => React.JSX.Element;
|
|
22
|
-
render(): string | React.JSX.Element;
|
|
23
|
-
private readonly dummyClick;
|
|
24
|
-
}
|
|
16
|
+
export declare const WithTooltipList: ({ list, children, onClick, onOpenChange }: Props) => string | React.JSX.Element;
|