@pinnacle0/web-ui 0.6.45 → 0.7.0-beta.1
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 +54 -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 +9 -9
- package/util/ModalUtil/index.less +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
package/core/Countdown/index.js
CHANGED
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { SlidingDigit } from "./SlidingDigit";
|
|
3
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
3
4
|
import "./index.less";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
export const Countdown = ReactUtil.memo("Countdown", (props) => {
|
|
6
|
+
const { timeToComplete, onComplete, onTick, renderer, isHidden, className, style } = props;
|
|
7
|
+
const computeRemainingSecond = () => {
|
|
8
|
+
if (timeToComplete <= 0)
|
|
9
|
+
return 0;
|
|
10
|
+
return Math.ceil((timeToComplete - Date.now()) / 1000);
|
|
11
|
+
};
|
|
12
|
+
const [remainingSecond, setRemainingSecond] = React.useState(computeRemainingSecond());
|
|
13
|
+
const isTimerCompleted = React.useRef(false);
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
const timer = setInterval(handleTick, 1000);
|
|
16
|
+
return () => clearInterval(timer);
|
|
17
|
+
});
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
isTimerCompleted.current = false;
|
|
20
|
+
}, [timeToComplete]);
|
|
21
|
+
const handleTick = () => {
|
|
22
|
+
if (!isTimerCompleted.current && timeToComplete > 0) {
|
|
23
|
+
const newRemainingSecond = computeRemainingSecond();
|
|
24
|
+
if (newRemainingSecond <= 0) {
|
|
25
|
+
isTimerCompleted.current = true; // To avoid call onComplete more than once
|
|
26
|
+
onComplete?.();
|
|
27
|
+
}
|
|
28
|
+
else if (newRemainingSecond !== remainingSecond) {
|
|
29
|
+
setRemainingSecond(newRemainingSecond);
|
|
30
|
+
onTick?.(newRemainingSecond);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
return isHidden ? null : (React.createElement("div", { className: `g-countdown ${className || ""}`, style: style }, BodyNode(timeToComplete, remainingSecond, renderer)));
|
|
35
|
+
});
|
|
36
|
+
const BodyNode = (timeToComplete, remainingSecond, renderer) => {
|
|
37
|
+
const bodyRenderer = renderer ||
|
|
38
|
+
((hours, minutes, seconds) => (React.createElement(React.Fragment, null,
|
|
8
39
|
React.createElement(SlidingDigit, { digit: hours.charAt(0) }),
|
|
9
40
|
React.createElement(SlidingDigit, { digit: hours.charAt(1) }),
|
|
10
41
|
React.createElement("div", { className: "colon" }, ":"),
|
|
@@ -12,77 +43,25 @@ export class Countdown extends React.PureComponent {
|
|
|
12
43
|
React.createElement(SlidingDigit, { digit: minutes.charAt(1) }),
|
|
13
44
|
React.createElement("div", { className: "colon" }, ":"),
|
|
14
45
|
React.createElement(SlidingDigit, { digit: seconds.charAt(0) }),
|
|
15
|
-
React.createElement(SlidingDigit, { digit: seconds.charAt(1) })))
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
super(props);
|
|
21
|
-
this.state = { remainingSecond: this.computeRemainingSecond() };
|
|
22
|
-
}
|
|
23
|
-
componentDidMount() {
|
|
24
|
-
this.timer = window.setInterval(this.onTick, 1000);
|
|
25
|
-
}
|
|
26
|
-
componentWillUnmount() {
|
|
27
|
-
window.clearInterval(this.timer);
|
|
46
|
+
React.createElement(SlidingDigit, { digit: seconds.charAt(1) }))));
|
|
47
|
+
if (timeToComplete <= 0)
|
|
48
|
+
return bodyRenderer("--", "--", "--", null);
|
|
49
|
+
if (remainingSecond / 3600 >= 100) {
|
|
50
|
+
return bodyRenderer("99", "59", "59", remainingSecond);
|
|
28
51
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.isTimerCompleted = false;
|
|
32
|
-
}
|
|
52
|
+
else if (remainingSecond <= 0) {
|
|
53
|
+
return bodyRenderer("00", "00", "00", 0);
|
|
33
54
|
}
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const { timeToComplete, onComplete, onTick } = this.props;
|
|
45
|
-
if (!this.isTimerCompleted && timeToComplete > 0) {
|
|
46
|
-
const remainingSecond = this.computeRemainingSecond();
|
|
47
|
-
if (remainingSecond <= 0) {
|
|
48
|
-
this.isTimerCompleted = true; // To avoid call onComplete more than once
|
|
49
|
-
onComplete?.();
|
|
50
|
-
}
|
|
51
|
-
else if (remainingSecond !== this.state.remainingSecond) {
|
|
52
|
-
this.setState({ remainingSecond }, () => onTick?.(remainingSecond));
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
render() {
|
|
57
|
-
const { isHidden, renderer, timeToComplete, className, style } = this.props;
|
|
58
|
-
const { remainingSecond } = this.state;
|
|
59
|
-
if (isHidden) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
|
-
let bodyNode;
|
|
63
|
-
if (timeToComplete > 0) {
|
|
64
|
-
if (remainingSecond / 3600 >= 100) {
|
|
65
|
-
bodyNode = renderer("99", "59", "59", remainingSecond);
|
|
66
|
-
}
|
|
67
|
-
else if (remainingSecond <= 0) {
|
|
68
|
-
bodyNode = renderer("00", "00", "00", 0);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
const hours = Math.floor(remainingSecond / 3600)
|
|
72
|
-
.toString()
|
|
73
|
-
.padStart(2, "0");
|
|
74
|
-
const remainingSecondWithinHour = remainingSecond % 3600;
|
|
75
|
-
const minutes = Math.floor(remainingSecondWithinHour / 60)
|
|
76
|
-
.toString()
|
|
77
|
-
.padStart(2, "0");
|
|
78
|
-
const seconds = (remainingSecondWithinHour % 60).toString().padStart(2, "0");
|
|
79
|
-
bodyNode = renderer(hours, minutes, seconds, remainingSecond);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
bodyNode = renderer("--", "--", "--", null);
|
|
84
|
-
}
|
|
85
|
-
return (React.createElement("div", { className: `g-countdown ${className || ""}`, style: style }, bodyNode));
|
|
55
|
+
else {
|
|
56
|
+
const hours = Math.floor(remainingSecond / 3600)
|
|
57
|
+
.toString()
|
|
58
|
+
.padStart(2, "0");
|
|
59
|
+
const remainingSecondWithinHour = remainingSecond % 3600;
|
|
60
|
+
const minutes = Math.floor(remainingSecondWithinHour / 60)
|
|
61
|
+
.toString()
|
|
62
|
+
.padStart(2, "0");
|
|
63
|
+
const seconds = (remainingSecondWithinHour % 60).toString().padStart(2, "0");
|
|
64
|
+
return bodyRenderer(hours, minutes, seconds, remainingSecond);
|
|
86
65
|
}
|
|
87
|
-
}
|
|
66
|
+
};
|
|
88
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Countdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/Countdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,cAAc,CAAC;AAsBtB,MAAM,CAAC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAY,EAAE,EAAE;IAClE,MAAM,EAAC,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAC,GAAG,KAAK,CAAC;IAEzF,MAAM,sBAAsB,GAAG,GAAG,EAAE;QAChC,IA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C,EAAE,CAAC;QAC9B,OAAO,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC;SAAM,CAAC;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC;aAC3C,QAAQ,EAAE;aACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACtB,MAAM,yBAAyB,GAAG,eAAe,GAAG,IAAI,CAAC;QACzD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,EAAE,CAAC;aACrD,QAAQ,EAAE;aACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QACtB,MAAM,OAAO,GAAG,CAAC,yBAAyB,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC7E,OAAO,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -6,7 +6,4 @@ export interface Props {
|
|
|
6
6
|
style?: React.CSSProperties;
|
|
7
7
|
onClick?: () => void;
|
|
8
8
|
}
|
|
9
|
-
export declare
|
|
10
|
-
static displayName: string;
|
|
11
|
-
render(): React.ReactPortal;
|
|
12
|
-
}
|
|
9
|
+
export declare const DarkOverlay: ({ children, className, style, onClick }: Props) => React.ReactPortal;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import ReactDOM from "react-dom";
|
|
3
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
3
4
|
import "./index.less";
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const { children, className, style, onClick } = this.props;
|
|
8
|
-
return ReactDOM.createPortal(React.createElement("div", { className: `g-dark-overlay ${className || ""}`, style: style, onClick: e => e.target === e.currentTarget && onClick?.() }, children), document.body);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
5
|
+
export const DarkOverlay = ReactUtil.memo("DarkOverlay", ({ children, className, style, onClick }) => {
|
|
6
|
+
return ReactDOM.createPortal(React.createElement("div", { className: `g-dark-overlay ${className || ""}`, style: style, onClick: e => e.target === e.currentTarget && onClick?.() }, children), document.body);
|
|
7
|
+
});
|
|
11
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DarkOverlay/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DarkOverlay/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,cAAc,CAAC;AAStB,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAQ,EAAE,EAAE;IACtG,OAAO,QAAQ,CAAC,YAAY,CACxB,6BAAK,SAAS,EAAE,kBAAkB,SAAS,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,aAAa,IAAI,OAAO,EAAE,EAAE,IACvH,QAAQ,CACP,EACN,QAAQ,CAAC,IAAI,CAChB,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ControlledFormValue } from "../../internal/type";
|
|
3
|
-
|
|
4
|
-
import type { Dayjs } from "dayjs";
|
|
5
|
-
interface Props extends ControlledFormValue<string> {
|
|
3
|
+
export interface Props extends ControlledFormValue<string> {
|
|
6
4
|
}
|
|
7
|
-
export declare
|
|
8
|
-
static displayName: string;
|
|
9
|
-
private readonly headerStyle;
|
|
10
|
-
private readonly now;
|
|
11
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
12
|
-
onChange: (date: Dayjs) => void;
|
|
13
|
-
renderHeader: HeaderRender<Dayjs>;
|
|
14
|
-
render(): React.JSX.Element;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
5
|
+
export declare const DateCalendar: ({ value, onChange }: Props) => React.JSX.Element;
|
|
@@ -5,14 +5,13 @@ import dayjsGenerateConfig from "rc-picker/lib/generate/dayjs";
|
|
|
5
5
|
import localeData from "dayjs/plugin/localeData";
|
|
6
6
|
import { Select } from "../Select";
|
|
7
7
|
import { Space } from "../Space";
|
|
8
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
8
9
|
// load plugin when component is imported
|
|
9
10
|
dayjs.extend(localeData);
|
|
10
11
|
const AntCalendar = generateCalendar(dayjsGenerateConfig);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
now = dayjs();
|
|
15
|
-
isDateDisabled = (current) => {
|
|
12
|
+
const headerStyle = { padding: 8 };
|
|
13
|
+
export const DateCalendar = ReactUtil.memo("DateCalendar", ({ value, onChange }) => {
|
|
14
|
+
const isDateDisabled = (current) => {
|
|
16
15
|
if (!current) {
|
|
17
16
|
return false;
|
|
18
17
|
}
|
|
@@ -26,12 +25,13 @@ export class DateCalendar extends React.PureComponent {
|
|
|
26
25
|
}
|
|
27
26
|
return false;
|
|
28
27
|
};
|
|
29
|
-
|
|
30
|
-
renderHeader = ({ value, onChange }) => {
|
|
28
|
+
const onAntChange = (date) => onChange(dayjs(date).format("YYYY-MM-DD"));
|
|
29
|
+
const renderHeader = ({ value, onChange }) => {
|
|
31
30
|
const start = 0;
|
|
32
31
|
const end = 12;
|
|
33
32
|
const monthOptions = [];
|
|
34
|
-
const
|
|
33
|
+
const now = dayjs();
|
|
34
|
+
const localeData = now.localeData();
|
|
35
35
|
const months = [];
|
|
36
36
|
for (let i = 0; i < 12; i++) {
|
|
37
37
|
months.push(localeData.monthsShort(value.month(i)));
|
|
@@ -41,20 +41,18 @@ export class DateCalendar extends React.PureComponent {
|
|
|
41
41
|
}
|
|
42
42
|
const month = value.month();
|
|
43
43
|
const year = value.year();
|
|
44
|
-
const yearOfNow =
|
|
44
|
+
const yearOfNow = now.year();
|
|
45
45
|
const options = [];
|
|
46
46
|
for (let i = yearOfNow - 100; i <= yearOfNow; i++) {
|
|
47
47
|
options.push(React.createElement(Select.Option, { key: i, value: i }, i));
|
|
48
48
|
}
|
|
49
|
-
return (React.createElement("div", { style:
|
|
49
|
+
return (React.createElement("div", { style: headerStyle },
|
|
50
50
|
React.createElement(Space, null,
|
|
51
51
|
React.createElement("div", null,
|
|
52
52
|
React.createElement(Select, { size: "small", popupMatchSelectWidth: false, onChange: newYear => onChange(value.year(newYear)), value: year }, options)),
|
|
53
53
|
React.createElement("div", null,
|
|
54
54
|
React.createElement(Select, { size: "small", popupMatchSelectWidth: false, value: month, onChange: selectedMonth => onChange(value.month(selectedMonth)) }, monthOptions)))));
|
|
55
55
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}
|
|
56
|
+
return React.createElement(AntCalendar, { disabledDate: isDateDisabled, headerRender: renderHeader, value: dayjs(value, "YYYY-MM-DD"), fullscreen: false, onChange: onAntChange });
|
|
57
|
+
});
|
|
60
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateCalendar/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,gBA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,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,OAAO,CAAC,IAAI,CACR,oBAAC,MAAM,CAAC,MAAM,IAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,IAC1B,CAAC,CACU,CACnB,CAAC;QACN,CAAC;QAED,OAAO,CACH,6BAAK,KAAK,EAAE,WAAW;YACnB,oBAAC,KAAK;gBACF;oBACI,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,qBAAqB,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,IAC7G,OAAO,CACH,CACP;gBACN;oBACI,oBAAC,MAAM,IAAC,IAAI,EAAC,OAAO,EAAC,qBAAqB,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,IAC3H,YAAY,CACR,CACP,CACF,CACN,CACT,CAAC;IACN,CAAC,CAAC;IAEF,OAAO,oBAAC,WAAW,IAAC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,GAAI,CAAC;AAClK,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 ? string : string | null> {
|
|
5
4
|
allowNull: T;
|
|
@@ -8,9 +7,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
8
7
|
className?: string;
|
|
9
8
|
preserveInvalidOnBlur?: boolean;
|
|
10
9
|
}
|
|
11
|
-
export declare
|
|
12
|
-
static displayName: string;
|
|
13
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
14
|
-
onChange: (_: Dayjs | null, dateString: string | string[]) => void;
|
|
15
|
-
render(): React.JSX.Element;
|
|
16
|
-
}
|
|
10
|
+
export declare const DatePicker: <T extends boolean>(props: Props<T>) => React.JSX.Element;
|
package/core/DatePicker/index.js
CHANGED
|
@@ -1,32 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import AntDatePicker from "antd/es/date-picker";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
5
|
+
export const DatePicker = ReactUtil.memo("DatePicker", (props) => {
|
|
6
|
+
const { value, allowNull, placeholder, disabled, className, preserveInvalidOnBlur = true, onChange } = props;
|
|
7
|
+
const isDateDisabled = (current) => {
|
|
8
|
+
if (!current)
|
|
8
9
|
return false;
|
|
9
|
-
}
|
|
10
10
|
/**
|
|
11
11
|
* This is for compatibility of MySQL.
|
|
12
12
|
* MySQL TIMESTAMP data type is used for values that contain both date and time parts.
|
|
13
13
|
* TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
15
|
+
return current.valueOf() >= new Date(2038, 0).valueOf();
|
|
19
16
|
};
|
|
20
|
-
|
|
21
|
-
const { onChange, allowNull } = this.props;
|
|
17
|
+
const onAntChange = (_, dateString) => {
|
|
22
18
|
if (dateString || allowNull) {
|
|
23
19
|
const typedOnChange = onChange;
|
|
24
20
|
typedOnChange(dateString);
|
|
25
21
|
}
|
|
26
22
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return (React.createElement(AntDatePicker, { className: className, showTime: false, disabledDate: this.isDateDisabled, placeholder: placeholder, value: value ? dayjs(value) : null, onChange: this.onChange, allowClear: allowNull, disabled: disabled, preserveInvalidOnBlur: preserveInvalidOnBlur }));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
23
|
+
return (React.createElement(AntDatePicker, { className: className, showTime: false, disabledDate: isDateDisabled, placeholder: placeholder, value: value ? dayjs(value) : null, onChange: onAntChange, allowClear: allowNull, disabled: disabled, preserveInvalidOnBlur: preserveInvalidOnBlur }));
|
|
24
|
+
});
|
|
32
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DatePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DatePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAU/C,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAoB,KAAe,EAAE,EAAE;IAC1F,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,qBAAqB,GAAG,IAAI,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAE3G,MAAM,cAAc,GAAG,CAAC,OAAc,EAAW,EAAE;QAC/C,IAAI,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QAC3B;;;;WAIG;QACH,OAAO,OAAO,CAAC,OAAO,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;IAC5D,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,CAAC,CAAe,EAAE,UAAyB,EAAE,EAAE;QAC/D,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;YAC1B,MAAM,aAAa,GAAG,QAA0C,CAAC;YACjE,aAAa,CAAC,UAAU,CAAC,CAAC;QAC9B,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,CACH,oBAAC,aAAa,IACV,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,KAAK,EACf,YAAY,EAAE,cAAc,EAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,QAAQ,EAAE,WAAW,EACrB,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,QAAQ,EAClB,qBAAqB,EAAE,qBAAqB,GAC9C,CACL,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -12,17 +12,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
12
12
|
}>;
|
|
13
13
|
preserveInvalidOnBlur?: boolean;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
shouldCheckDateRangeValid: boolean;
|
|
17
|
-
}
|
|
18
|
-
export declare class DateRangePicker<T extends boolean> extends React.PureComponent<Props<T>, State> {
|
|
19
|
-
static displayName: string;
|
|
20
|
-
private readonly dateFormatter;
|
|
21
|
-
constructor(props: Props<T>);
|
|
22
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
23
|
-
onChange: (dates: [Dayjs | null, Dayjs | null] | null) => void;
|
|
24
|
-
onOpenChange: (open: boolean) => void;
|
|
25
|
-
componentDidUpdate(): void;
|
|
26
|
-
render(): React.JSX.Element;
|
|
27
|
-
}
|
|
28
|
-
export {};
|
|
15
|
+
export declare const DateRangePicker: <T extends boolean>(props: Props<T>) => React.JSX.Element;
|
|
@@ -1,56 +1,47 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
3
|
import DatePicker from "antd/es/date-picker";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
5
|
+
const DATE_FORMATTER = "YYYY-MM-DD";
|
|
6
|
+
export const DateRangePicker = ReactUtil.memo("DateRangePicker", (props) => {
|
|
7
|
+
const { value, allowNull, disabledRange, disabled, className, presets, preserveInvalidOnBlur = true, onChange } = props;
|
|
8
|
+
const [shouldCheckDateRangeValid, setShouldCheckDateRangeValid] = React.useState(false);
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (shouldCheckDateRangeValid && value[0] && value[1]) {
|
|
11
|
+
const typedOnChange = onChange;
|
|
12
|
+
if (dayjs(value[0]).isAfter(dayjs(value[1]))) {
|
|
13
|
+
typedOnChange([value[1], value[0]]);
|
|
14
|
+
}
|
|
15
|
+
setShouldCheckDateRangeValid(false);
|
|
14
16
|
}
|
|
17
|
+
}, [shouldCheckDateRangeValid, value, onChange]);
|
|
18
|
+
const isDateDisabled = (current) => {
|
|
19
|
+
if (!current)
|
|
20
|
+
return false;
|
|
15
21
|
/**
|
|
16
22
|
* This is for compatibility of MySQL.
|
|
17
23
|
* MySQL TIMESTAMP data type is used for values that contain both date and time parts.
|
|
18
24
|
* TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
|
|
19
25
|
*/
|
|
20
|
-
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
26
|
+
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
21
27
|
return true;
|
|
22
|
-
}
|
|
23
28
|
const diffToToday = Math.floor(current.diff(dayjs().startOf("day"), "day", true));
|
|
24
|
-
return
|
|
29
|
+
return disabledRange?.(diffToToday, current.toDate()) || false;
|
|
25
30
|
};
|
|
26
|
-
|
|
27
|
-
const typedOnChange =
|
|
31
|
+
const onAntChange = (dates) => {
|
|
32
|
+
const typedOnChange = onChange;
|
|
28
33
|
if (dates) {
|
|
29
34
|
const start = dates[0];
|
|
30
35
|
const end = dates[1];
|
|
31
|
-
typedOnChange([start ? start.format(
|
|
36
|
+
typedOnChange([start ? start.format(DATE_FORMATTER) : null, end ? end.format(DATE_FORMATTER) : null]);
|
|
32
37
|
}
|
|
33
38
|
else {
|
|
34
39
|
typedOnChange([null, null]);
|
|
35
40
|
}
|
|
36
41
|
};
|
|
37
|
-
onOpenChange = (open) => {
|
|
38
|
-
|
|
42
|
+
const onOpenChange = (open) => {
|
|
43
|
+
setShouldCheckDateRangeValid(!open);
|
|
39
44
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const dates = this.props.value;
|
|
43
|
-
const typedOnChange = this.props.onChange;
|
|
44
|
-
if (dayjs(dates[0]).isAfter(dayjs(dates[1]))) {
|
|
45
|
-
typedOnChange([dates[1], dates[0]]);
|
|
46
|
-
}
|
|
47
|
-
this.setState({ shouldCheckDateRangeValid: false });
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
render() {
|
|
51
|
-
const { value, allowNull, disabled, className, presets, preserveInvalidOnBlur = true } = this.props;
|
|
52
|
-
const parsedValue = [value[0] ? dayjs(value[0]) : null, value[1] ? dayjs(value[1]) : null];
|
|
53
|
-
return (React.createElement(DatePicker.RangePicker, { disabledDate: this.isDateDisabled, className: className, showTime: false, value: parsedValue, onCalendarChange: this.onChange, allowClear: allowNull, disabled: disabled, presets: presets, preserveInvalidOnBlur: preserveInvalidOnBlur, onOpenChange: this.onOpenChange }));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
45
|
+
return (React.createElement(DatePicker.RangePicker, { disabledDate: isDateDisabled, className: className, showTime: false, value: [value[0] ? dayjs(value[0]) : null, value[1] ? dayjs(value[1]) : null], onCalendarChange: onAntChange, allowClear: allowNull, disabled: disabled, presets: presets, preserveInvalidOnBlur: preserveInvalidOnBlur, onOpenChange: onOpenChange }));
|
|
46
|
+
});
|
|
56
47
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateRangePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateRangePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAW/C,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAoB,KAAe,EAAE,EAAE;IACpG,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,GAAG,IAAI,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IACtH,MAAM,CAAC,yBAAyB,EAAE,4BAA4B,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExF,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,yBAAyB,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACpD,MAAM,aAAa,GAAG,QAA2D,CAAC;YAClF,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,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C1G,CAAC;aAAM,CAAC;YACJ,aAAa,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAChC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAa,EAAE,EAAE;QACnC,4BAA4B,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,OAAO,CACH,oBAAC,UAAU,CAAC,WAAW,IACnB,YAAY,EAAE,cAAc,EAC5B,SAAS,EAAE,SAAS,EACpB,QAAQ,EAAE,KAAK,EACf,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAC7E,gBAAgB,EAAE,WAAW,EAC7B,UAAU,EAAE,SAAS,EACrB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,YAAY,GAC5B,CACL,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 ? Date : Date | null> {
|
|
5
4
|
allowNull: T;
|
|
@@ -11,9 +10,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
11
10
|
preserveInvalidOnBlur?: boolean;
|
|
12
11
|
showSecond?: boolean;
|
|
13
12
|
}
|
|
14
|
-
export declare
|
|
15
|
-
static displayName: string;
|
|
16
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
17
|
-
onChange: (date: Dayjs | null) => void;
|
|
18
|
-
render(): React.JSX.Element;
|
|
19
|
-
}
|
|
13
|
+
export declare const DateTimePicker: <T extends boolean>(props: Props<T>) => React.JSX.Element;
|
|
@@ -1,35 +1,26 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import DatePicker from "antd/es/date-picker";
|
|
3
3
|
import dayjs from "dayjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ReactUtil } from "../../util/ReactUtil";
|
|
5
|
+
export const DateTimePicker = ReactUtil.memo("DateTimePicker", (props) => {
|
|
6
|
+
const { value, allowNull, disabled, showNow, className, placeholder, showSecond, preserveInvalidOnBlur = true, disabledRange, onChange } = props;
|
|
7
|
+
const isDateDisabled = (current) => {
|
|
8
|
+
if (!current)
|
|
8
9
|
return false;
|
|
9
|
-
}
|
|
10
10
|
/**
|
|
11
11
|
* This is for compatibility of MySQL.
|
|
12
12
|
* MySQL TIMESTAMP data type is used for values that contain both date and time parts.
|
|
13
13
|
* TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.
|
|
14
14
|
*/
|
|
15
|
-
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
15
|
+
if (current.valueOf() >= new Date(2038, 0).valueOf())
|
|
16
16
|
return true;
|
|
17
|
-
}
|
|
18
17
|
const diffHourToToday = Math.floor(current.diff(dayjs().startOf("hour"), "hour", true));
|
|
19
|
-
return
|
|
18
|
+
return disabledRange?.(diffHourToToday, current.toDate()) || false;
|
|
20
19
|
};
|
|
21
|
-
|
|
22
|
-
const typedOnChange =
|
|
23
|
-
|
|
24
|
-
typedOnChange(date.toDate());
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
typedOnChange(null);
|
|
28
|
-
}
|
|
20
|
+
const onAntChange = (date) => {
|
|
21
|
+
const typedOnChange = onChange;
|
|
22
|
+
typedOnChange(date ? date.toDate() : null);
|
|
29
23
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return (React.createElement(DatePicker, { className: className, placeholder: placeholder, disabledDate: this.isDateDisabled, value: value ? dayjs(value) : null, onChange: this.onChange, allowClear: allowNull, disabled: disabled, showTime: true, showSecond: showSecond, showNow: showNow, preserveInvalidOnBlur: preserveInvalidOnBlur, needConfirm: false }));
|
|
33
|
-
}
|
|
34
|
-
}
|
|
24
|
+
return (React.createElement(DatePicker, { className: className, placeholder: placeholder, disabledDate: isDateDisabled, value: value ? dayjs(value) : null, onChange: onAntChange, allowClear: allowNull, disabled: disabled, showTime: true, showSecond: showSecond, showNow: showNow, preserveInvalidOnBlur: preserveInvalidOnBlur, needConfirm: false }));
|
|
25
|
+
});
|
|
35
26
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateTimePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/DateTimePicker/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAa/C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAoB,KAAe,EAAE,EAAE;IAClG,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,qBAAqB,GAAG,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;IAE/I,MAAM,cAAc,GAAG,CAAC,OA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ledFormValue } from "../../internal/type";
|
|
5
4
|
import "./index.less";
|
|
@@ -15,19 +14,4 @@ export interface Props<T extends boolean> extends ControlledFormValue<T extends
|
|
|
15
14
|
preserveInvalidOnBlur?: boolean;
|
|
16
15
|
showSecond?: boolean;
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
shouldCheckDateRangeValid: boolean;
|
|
20
|
-
}
|
|
21
|
-
export declare class DateTimeRangePicker<T extends boolean> extends React.PureComponent<Props<T>, State> {
|
|
22
|
-
static displayName: string;
|
|
23
|
-
static showTime: {
|
|
24
|
-
defaultValue: dayjs.Dayjs[];
|
|
25
|
-
};
|
|
26
|
-
constructor(props: Props<T>);
|
|
27
|
-
isDateDisabled: (current: Dayjs) => boolean;
|
|
28
|
-
onChange: (dates: [Dayjs | null, Dayjs | null] | null) => void;
|
|
29
|
-
onOpenChange: (open: boolean) => void;
|
|
30
|
-
componentDidUpdate(): void;
|
|
31
|
-
render(): React.JSX.Element;
|
|
32
|
-
}
|
|
33
|
-
export {};
|
|
17
|
+
export declare const DateTimeRangePicker: <T extends boolean>(props: Props<T>) => React.JSX.Element;
|