@pinnacle0/web-ui 0.6.46 → 0.7.0-beta.2
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 +1 -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 +5 -33
- package/core/NumberInput/index.js +44 -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 +6 -34
- package/core/Table/index.js +64 -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.js.map +1 -0
- package/core/VirtualTable/index.d.ts +24 -23
- package/core/VirtualTable/index.js +36 -50
- package/core/VirtualTable/index.js.map +1 -1
- package/core/VirtualTable/index.less +28 -140
- 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/css/global.less +0 -9
- 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 +6 -6
- 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/type.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
- /package/core/VirtualTable/{type.d.ts → OldVirtualTable/type.d.ts} +0 -0
- /package/core/VirtualTable/{type.js → OldVirtualTable/type.js} +0 -0
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { VirtualTableColumn, VirtualTableRowSelection } from "./type";
|
|
2
|
+
import type { TableColumn, TableProps } from "../Table";
|
|
4
3
|
import "./index.less";
|
|
5
|
-
export type {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
export type { TableRowSelection as VirtualTableRowSelection } from "../Table";
|
|
5
|
+
/**
|
|
6
|
+
* Antd Table's scrollX behaviour is different from scrollY
|
|
7
|
+
*
|
|
8
|
+
* scrollY:
|
|
9
|
+
* the height of the scrollable container (ignoring the container height) which will cause overflow
|
|
10
|
+
* We cannot use overflow: hidden since it will cause the last few rows to be hidden
|
|
11
|
+
*
|
|
12
|
+
* scrollX:
|
|
13
|
+
* It is the total scroll width of the table
|
|
14
|
+
* If scrollX > all columns width, all columns will be expanded and lose the width property
|
|
15
|
+
* In order to calculate the scrollX, we need to sum up the width of all columns
|
|
16
|
+
*
|
|
17
|
+
* For future refactor:
|
|
18
|
+
* If want to use column without width, must refactor to either pass column width or pass scrollX props
|
|
19
|
+
*/
|
|
20
|
+
export interface VirtualTableColumn<RowType extends object> extends Omit<TableColumn<RowType>, "width"> {
|
|
21
|
+
width: number;
|
|
22
|
+
}
|
|
23
|
+
export type VirtualTableColumns<RowType extends object> = VirtualTableColumn<RowType>[];
|
|
24
|
+
export interface VirtualTableProps<RowType extends object> extends Omit<TableProps<RowType, undefined>, "columns" | "scrollX" | "scrollY"> {
|
|
8
25
|
columns: VirtualTableColumn<RowType>[];
|
|
9
|
-
|
|
10
|
-
className?: string;
|
|
11
|
-
rowClassName?: string;
|
|
12
|
-
/**
|
|
13
|
-
* if scrollX and scrollY is not provided, height: 100% and width: 100% will be used and please wrap the table with a container
|
|
14
|
-
*/
|
|
26
|
+
width?: number | string;
|
|
15
27
|
scrollY?: number;
|
|
16
|
-
scrollX?: number;
|
|
17
|
-
overscan?: number;
|
|
18
|
-
loading?: boolean;
|
|
19
|
-
emptyPlaceholder?: React.ReactElement | string | number;
|
|
20
|
-
onRowClick?: (record: RowType, rowIndex: number) => void;
|
|
21
|
-
/**
|
|
22
|
-
* Default: index
|
|
23
|
-
*/
|
|
24
|
-
rowKey?: StringKey<RowType> | "index";
|
|
25
|
-
headerHeight?: number;
|
|
26
|
-
rowSelection?: VirtualTableRowSelection<RowType>;
|
|
27
28
|
}
|
|
28
|
-
export declare const VirtualTable: <RowType extends object>(
|
|
29
|
+
export declare const VirtualTable: <RowType extends object>(props: VirtualTableProps<RowType>) => React.JSX.Element;
|
|
@@ -1,58 +1,44 @@
|
|
|
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
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
6
|
+
import { useResizeObserver } from "../../hooks/useResizeObserver";
|
|
7
|
+
export const VirtualTable = ReactUtil.memo("VirtualTable", function (props) {
|
|
8
|
+
const { dataSource, columns, className, width = "100%", scrollY: propScrollY, emptyPlaceholder, ...restProps } = props;
|
|
9
|
+
const [scrollY, setScrollY] = React.useState(propScrollY ?? 300);
|
|
10
|
+
const [headerHeight, setHeaderHeight] = React.useState(0);
|
|
11
|
+
const containerRef = useResizeObserver(({ height }) => {
|
|
12
|
+
let newScrollY = Math.max(0, height - headerHeight);
|
|
13
|
+
if (propScrollY)
|
|
14
|
+
newScrollY = Math.min(newScrollY, propScrollY);
|
|
15
|
+
setScrollY(newScrollY);
|
|
16
|
+
});
|
|
17
|
+
// Need to listen to header change onMount so we can calculate the scrollY correctly
|
|
18
|
+
const headerRef = useResizeObserver(({ height }) => {
|
|
19
|
+
setHeaderHeight(height);
|
|
25
20
|
});
|
|
26
|
-
const { headerRef, getHeaderRef, columnWidths, calcColumnWidths } = useColumnWidths();
|
|
27
|
-
const scrollBarSize = useScrollBarSize();
|
|
28
|
-
const syncScroll = useSyncScroll(scrollContentRef, headerRef);
|
|
29
|
-
const checkIsScrollToEdge = useScrollToEdge(scrollContentRef);
|
|
30
|
-
const { scrollable, checkScrollable } = useScrollable(scrollContentRef);
|
|
31
|
-
const columnsStickyPosition = useColumnsStickyPosition(transformedColumns, columnWidths);
|
|
32
|
-
const onScroll = React.useCallback(() => {
|
|
33
|
-
syncScroll();
|
|
34
|
-
checkIsScrollToEdge();
|
|
35
|
-
}, [syncScroll, checkIsScrollToEdge]);
|
|
36
|
-
React.useEffect(() => {
|
|
37
|
-
checkIsScrollToEdge();
|
|
38
|
-
}, [columnWidths, checkIsScrollToEdge]);
|
|
39
|
-
React.useEffect(() => {
|
|
40
|
-
checkScrollable();
|
|
41
|
-
}, [totalSize, columnWidths, checkScrollable]);
|
|
42
21
|
React.useEffect(() => {
|
|
43
|
-
|
|
44
|
-
}, [
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
22
|
+
headerRef.current = containerRef.current?.querySelector(".ant-table-header") ?? null;
|
|
23
|
+
}, [containerRef, headerRef]);
|
|
24
|
+
const containerStyle = React.useMemo(() => {
|
|
25
|
+
return {
|
|
26
|
+
width,
|
|
27
|
+
height: "100%",
|
|
28
|
+
};
|
|
29
|
+
}, [width]);
|
|
30
|
+
const scrollX = React.useMemo(() => {
|
|
31
|
+
return columns.reduce((acc, column) => acc + (column.hidden ? 0 : column.width), 0);
|
|
32
|
+
}, [columns]);
|
|
33
|
+
return (React.createElement("div", { ref: containerRef, className: classNames("g-virtual-table", className), style: containerStyle },
|
|
34
|
+
React.createElement(Table
|
|
35
|
+
// @ts-ignore: using our Table component with virtual props from antd
|
|
36
|
+
, {
|
|
37
|
+
// @ts-ignore: using our Table component with virtual props from antd
|
|
38
|
+
virtual: true, dataSource: dataSource, columns: columns,
|
|
39
|
+
/**
|
|
40
|
+
* Antd <Table virtual /> must use number scrollX or number scrollY to work
|
|
41
|
+
*/
|
|
42
|
+
scrollY: scrollY, scrollX: scrollX, emptyPlaceholder: emptyPlaceholder || "暂无数据", ...restProps })));
|
|
57
43
|
});
|
|
58
44
|
//# 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":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC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a,CAAC,mBAAmB,CAAC,IAAI,IAAI,CAAC;IACzF,CAAC,EAAE,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;IAE9B,MAAM,cAAc,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACtC,OAAO;YACH,KAAK;YACL,MAAM,EAAE,MAAM;SACjB,CAAC;IACN,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC/B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAEd,OAAO,CACH,6BAAK,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,cAAc;QAC9F,oBAAC,KAAK;QACF,qEAAqE;;YAArE,qEAAqE;YACrE,OAAO,QACP,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO;YAChB;;eAEG;YACH,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,gBAAgB,IAAI,MAAM,KACxC,SAAS,GACf,CACA,CACT,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -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,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;
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { Tooltip } from "../Tooltip";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const label = children ? (children) : list[0] === "-" ? ("-") : typeof list[0].content === "string" || typeof list[0].content === "number" ? (list[0].label + ": " + list[0].content) : (React.createElement(React.Fragment, null,
|
|
3
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
4
|
+
const labelStyle = { display: "inline-block", width: 90 };
|
|
5
|
+
const wrapperStyle = { display: "inline-block" };
|
|
6
|
+
export const WithTooltipList = ReactUtil.memo("WithTooltipList", ({ list, children, onClick, onOpenChange }) => {
|
|
7
|
+
if (list.length === 0)
|
|
8
|
+
return children || "-";
|
|
9
|
+
let label;
|
|
10
|
+
if (children)
|
|
11
|
+
label = children;
|
|
12
|
+
else if (list[0] === "-")
|
|
13
|
+
label = "-";
|
|
14
|
+
else if (typeof list[0].content === "string" || typeof list[0].content === "number") {
|
|
15
|
+
label = list[0].label + ": " + list[0].content;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
label = (React.createElement(React.Fragment, null,
|
|
20
19
|
list[0].label,
|
|
21
20
|
": ",
|
|
22
21
|
list[0].content));
|
|
23
|
-
/**
|
|
24
|
-
* - Must wrap with a <div> since the child node of <Tooltip> must accept certain methods, since <a>'s onClick is used already.
|
|
25
|
-
* - Wrapper must be inline-block, to make the tooltip arrow centered.
|
|
26
|
-
*
|
|
27
|
-
* Ref: https://ant.design/components/tooltip/#Note
|
|
28
|
-
*/
|
|
29
|
-
return (React.createElement(Tooltip, { placement: "bottom", title: this.renderTooltip(), onOpenChange: onOpenChange, childContainerProps: this.childContainerProps },
|
|
30
|
-
React.createElement("a", { onClick: onClick || this.dummyClick, style: this.wrapperStyle, className: "g-with-tooltip-list-anchor" }, label)));
|
|
31
22
|
}
|
|
32
|
-
|
|
33
|
-
}
|
|
23
|
+
const tooltipTitle = (React.createElement("div", null, list.map((item, index) => item === "-" ? (React.createElement("hr", { key: index })) : (React.createElement("p", { key: item.label },
|
|
24
|
+
React.createElement("span", { style: labelStyle }, item.label),
|
|
25
|
+
React.createElement("em", null, item.content))))));
|
|
26
|
+
/**
|
|
27
|
+
* - Must wrap with a <div> since the child node of <Tooltip> must accept certain methods, since <a>'s onClick is used already.
|
|
28
|
+
* - Wrapper must be inline-block, to make the tooltip arrow centered.
|
|
29
|
+
*
|
|
30
|
+
* Ref: https://ant.design/components/tooltip/#Note
|
|
31
|
+
*/
|
|
32
|
+
return (React.createElement(Tooltip, { placement: "bottom", title: tooltipTitle, onOpenChange: onOpenChange, childContainerProps: { style: wrapperStyle } },
|
|
33
|
+
React.createElement("a", { onClick: onClick || (() => { }), style: wrapperStyle, className: "g-with-tooltip-list-anchor" }, label)));
|
|
34
|
+
});
|
|
34
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/WithTooltipList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/WithTooltipList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAkB/C,MAAM,UAAU,GAAwB,EAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,EAAC,CAAC;AAC7E,MAAM,YAAY,GAAwB,EAAC,OAAO,EAAE,cAAc,EAAC,CAAC;AAEpE,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAQ,EAAE,EAAE;IAChH,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,IAAI,GAAG,CAAC;IAE9C,IAAI,KAAsB,CAAC;IAC3B,IAAI,QAAQ;QAAE,KAAK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b,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { Dayjs } from "dayjs";
|
|
3
2
|
import type { ControlledFormValue } from "../../internal/type";
|
|
4
3
|
export interface Props<T extends boolean> extends ControlledFormValue<T extends false ? [number, number] : [number, number] | null> {
|
|
5
4
|
allowNull: T;
|
|
@@ -7,9 +6,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
7
6
|
disabled?: boolean;
|
|
8
7
|
className?: string;
|
|
9
8
|
}
|
|
10
|
-
export declare
|
|
11
|
-
static displayName: string;
|
|
12
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
13
|
-
onChange: (date: Dayjs | null, dateString: string | string[]) => void;
|
|
14
|
-
render(): React.JSX.Element;
|
|
15
|
-
}
|
|
9
|
+
export declare const YearMonthSelector: <T extends boolean>({ value, allowNull, disabled, className, disabledRange, onChange }: Props<T>) => React.JSX.Element;
|
|
@@ -2,35 +2,29 @@ import React from "react";
|
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import DatePicker from "antd/es/date-picker";
|
|
4
4
|
import arraySupport from "dayjs/plugin/arraySupport";
|
|
5
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
5
6
|
// load plugin when component is imported
|
|
6
7
|
dayjs.extend(arraySupport);
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!current) {
|
|
8
|
+
export const YearMonthSelector = ReactUtil.memo("YearMonthSelector", ({ value, allowNull, disabled, className, disabledRange, onChange }) => {
|
|
9
|
+
const isDateDisabled = (current) => {
|
|
10
|
+
if (!current)
|
|
11
11
|
return false;
|
|
12
|
-
}
|
|
13
12
|
/**
|
|
14
13
|
* This is for compatibility of MySQL.
|
|
15
14
|
* MySQL TIMESTAMP data type is used for values that contain both date and time parts.
|
|
16
15
|
* TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
|
|
17
16
|
*/
|
|
18
|
-
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
17
|
+
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
19
18
|
return true;
|
|
20
|
-
}
|
|
21
19
|
const diffMonthToThisMonth = Math.floor(current.diff(dayjs().startOf("month"), "month", true));
|
|
22
|
-
return
|
|
20
|
+
return disabledRange?.(diffMonthToThisMonth, current.toDate()) || false;
|
|
23
21
|
};
|
|
24
|
-
|
|
25
|
-
const { onChange, allowNull } = this.props;
|
|
22
|
+
const onAntChange = (date, dateString) => {
|
|
26
23
|
if (dateString || allowNull) {
|
|
27
24
|
const typedOnChange = onChange;
|
|
28
25
|
typedOnChange(date && [date.year(), date.month() + 1]);
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return (React.createElement(DatePicker, { picker: "month", className: className, disabledDate: this.isDateDisabled, value: value ? dayjs([value[0], value[1] - 1]) : null, onChange: this.onChange, allowClear: allowNull, disabled: disabled }));
|
|
34
|
-
}
|
|
35
|
-
}
|
|
28
|
+
return (React.createElement(DatePicker, { picker: "month", className: className, disabledDate: isDateDisabled, value: value ? dayjs([value[0], value[1] - 1]) : null, onChange: onAntChange, allowClear: allowNull, disabled: disabled }));
|
|
29
|
+
});
|
|
36
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/YearMonthSelector/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAG7C,OAAO,YAAY,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/YearMonthSelector/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,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