@cloudtower/eagle 0.27.55 → 0.27.56
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/dist/components.css +2259 -3151
- package/dist/esm/index.js +10233 -34
- package/dist/esm/stats1.html +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/styles/token/token.d.ts +1 -0
- package/dist/style.css +2226 -2226
- package/dist/token.css +209 -415
- package/dist/umd/index.js +10322 -0
- package/dist/{cjs → umd}/stats1.html +1 -1
- package/package.json +5 -7
- package/dist/cjs/UIKitProvider/index.js +0 -77
- package/dist/cjs/core/AccordionCard/index.js +0 -59
- package/dist/cjs/core/Alert/index.js +0 -80
- package/dist/cjs/core/Arch/index.js +0 -17
- package/dist/cjs/core/Badge/index.js +0 -51
- package/dist/cjs/core/BaseIcon/index.js +0 -76
- package/dist/cjs/core/Bit/index.js +0 -40
- package/dist/cjs/core/BitPerSecond/index.js +0 -40
- package/dist/cjs/core/Bps/index.js +0 -40
- package/dist/cjs/core/Breadcrumb/index.js +0 -58
- package/dist/cjs/core/Button/HoverableElement.js +0 -14
- package/dist/cjs/core/Button/index.js +0 -89
- package/dist/cjs/core/ButtonGroup/index.js +0 -110
- package/dist/cjs/core/Byte/index.js +0 -49
- package/dist/cjs/core/Calendar/index.js +0 -25
- package/dist/cjs/core/Card/CardBody.js +0 -12
- package/dist/cjs/core/Card/CardTitle.js +0 -12
- package/dist/cjs/core/Card/CardWrapper.js +0 -55
- package/dist/cjs/core/Card/index.js +0 -94
- package/dist/cjs/core/Cascader/cascader.style.js +0 -23
- package/dist/cjs/core/Cascader/cascader.widget.js +0 -86
- package/dist/cjs/core/Cascader/index.js +0 -74
- package/dist/cjs/core/Checkbox/checkbox.style.js +0 -5
- package/dist/cjs/core/Checkbox/index.js +0 -53
- package/dist/cjs/core/DetailCard/index.js +0 -23
- package/dist/cjs/core/DonutChart/index.js +0 -167
- package/dist/cjs/core/DropdownMenu/index.js +0 -66
- package/dist/cjs/core/Empty/index.js +0 -11
- package/dist/cjs/core/ExpandableList/ExpandIcon.js +0 -17
- package/dist/cjs/core/ExpandableList/ExpandableContainer.js +0 -17
- package/dist/cjs/core/ExpandableList/ExpandableItem.js +0 -48
- package/dist/cjs/core/ExpandableList/RoundOrder.js +0 -22
- package/dist/cjs/core/FailedLoad/index.js +0 -32
- package/dist/cjs/core/Fields/FieldsBoolean/index.js +0 -47
- package/dist/cjs/core/Fields/FieldsDateTime/index.js +0 -24
- package/dist/cjs/core/Fields/FieldsDateTimeRange/index.js +0 -50
- package/dist/cjs/core/Fields/FieldsEnum/index.js +0 -60
- package/dist/cjs/core/Fields/FieldsFloat/index.js +0 -60
- package/dist/cjs/core/Fields/FieldsInt/index.js +0 -78
- package/dist/cjs/core/Fields/FieldsInteger/index.js +0 -57
- package/dist/cjs/core/Fields/FieldsString/index.js +0 -116
- package/dist/cjs/core/Fields/FieldsTextArea/index.js +0 -64
- package/dist/cjs/core/Fields/FieldsTimePicker/index.js +0 -54
- package/dist/cjs/core/Fields/index.js +0 -28
- package/dist/cjs/core/Form/index.js +0 -10
- package/dist/cjs/core/FormItem/index.js +0 -38
- package/dist/cjs/core/Frequency/index.js +0 -40
- package/dist/cjs/core/Icon/index.js +0 -117
- package/dist/cjs/core/Input/index.js +0 -66
- package/dist/cjs/core/InputGroup/index.js +0 -14
- package/dist/cjs/core/InputInteger/formatterInteger.js +0 -15
- package/dist/cjs/core/InputInteger/index.js +0 -97
- package/dist/cjs/core/InputNumber/index.js +0 -90
- package/dist/cjs/core/InputTagItem/index.js +0 -12
- package/dist/cjs/core/KitStoreProvider/index.js +0 -23
- package/dist/cjs/core/Link/index.js +0 -56
- package/dist/cjs/core/Loading/index.js +0 -33
- package/dist/cjs/core/Loading/style.js +0 -11
- package/dist/cjs/core/Metric/metric.js +0 -21
- package/dist/cjs/core/Modal/index.js +0 -214
- package/dist/cjs/core/ModalStack/index.js +0 -47
- package/dist/cjs/core/Overflow/index.js +0 -117
- package/dist/cjs/core/Pagination/index.js +0 -120
- package/dist/cjs/core/ParrotTrans/index.js +0 -28
- package/dist/cjs/core/Percent/index.js +0 -41
- package/dist/cjs/core/Progress/index.js +0 -25
- package/dist/cjs/core/Radio/index.js +0 -142
- package/dist/cjs/core/SearchInput/index.js +0 -50
- package/dist/cjs/core/Second/index.js +0 -43
- package/dist/cjs/core/SegmentControl/index.js +0 -43
- package/dist/cjs/core/Select/index.js +0 -140
- package/dist/cjs/core/SimplePagination/index.js +0 -90
- package/dist/cjs/core/Speed/index.js +0 -40
- package/dist/cjs/core/StatusCapsule/index.js +0 -100
- package/dist/cjs/core/StepProgress/index.js +0 -44
- package/dist/cjs/core/Steps/index.js +0 -126
- package/dist/cjs/core/Steps/style.js +0 -13
- package/dist/cjs/core/Styled/index.js +0 -57
- package/dist/cjs/core/Switch/index.js +0 -61
- package/dist/cjs/core/Table/TableWidget.js +0 -47
- package/dist/cjs/core/Table/common.js +0 -46
- package/dist/cjs/core/Table/index.js +0 -112
- package/dist/cjs/core/TableForm/AddRowButton.js +0 -108
- package/dist/cjs/core/TableForm/Columns/AffixColumn.js +0 -48
- package/dist/cjs/core/TableForm/Columns/CheckboxColumn.js +0 -35
- package/dist/cjs/core/TableForm/Columns/FormItem.js +0 -20
- package/dist/cjs/core/TableForm/Columns/InputColumn.js +0 -117
- package/dist/cjs/core/TableForm/Columns/TextColumn.js +0 -44
- package/dist/cjs/core/TableForm/Columns/index.js +0 -24
- package/dist/cjs/core/TableForm/TableFormBodyCell.js +0 -165
- package/dist/cjs/core/TableForm/TableFormBodyRows.js +0 -215
- package/dist/cjs/core/TableForm/TableFormHeaderCell.js +0 -93
- package/dist/cjs/core/TableForm/index.js +0 -187
- package/dist/cjs/core/TableForm/style.js +0 -35
- package/dist/cjs/core/TableForm/types.js +0 -10
- package/dist/cjs/core/TableForm/utils.js +0 -36
- package/dist/cjs/core/Tag/SplitTag.js +0 -64
- package/dist/cjs/core/Tag/const.js +0 -12
- package/dist/cjs/core/Tag/index.js +0 -96
- package/dist/cjs/core/Tag/style.js +0 -14
- package/dist/cjs/core/TextArea/index.js +0 -72
- package/dist/cjs/core/Time/index.js +0 -31
- package/dist/cjs/core/TimePicker/index.js +0 -66
- package/dist/cjs/core/TimeZoneSelect/index.js +0 -165
- package/dist/cjs/core/Token/index.js +0 -86
- package/dist/cjs/core/Token/style.js +0 -5
- package/dist/cjs/core/Tooltip/index.js +0 -89
- package/dist/cjs/core/Truncate/index.js +0 -49
- package/dist/cjs/core/Typo/index.js +0 -130
- package/dist/cjs/core/antd.js +0 -208
- package/dist/cjs/core/message/index.js +0 -203
- package/dist/cjs/core/message-group/index.js +0 -147
- package/dist/cjs/coreX/BarChart/index.js +0 -39
- package/dist/cjs/coreX/BatchOperation/index.js +0 -149
- package/dist/cjs/coreX/ChartWithTooltip/index.js +0 -154
- package/dist/cjs/coreX/Counting/index.js +0 -22
- package/dist/cjs/coreX/CronCalendar/index.js +0 -105
- package/dist/cjs/coreX/CronPlan/index.js +0 -462
- package/dist/cjs/coreX/DateRangePicker/AbsoluteDate.js +0 -179
- package/dist/cjs/coreX/DateRangePicker/Calendar.js +0 -286
- package/dist/cjs/coreX/DateRangePicker/DateRangePicker.style.js +0 -84
- package/dist/cjs/coreX/DateRangePicker/InputTime.js +0 -151
- package/dist/cjs/coreX/DateRangePicker/RelativeTime.js +0 -53
- package/dist/cjs/coreX/DateRangePicker/common.js +0 -195
- package/dist/cjs/coreX/DateRangePicker/index.js +0 -331
- package/dist/cjs/coreX/DeprecatedDonutChart/index.js +0 -39
- package/dist/cjs/coreX/DropdownTransition/index.js +0 -73
- package/dist/cjs/coreX/GoBackButton/index.js +0 -45
- package/dist/cjs/coreX/I18nNameTag/index.js +0 -37
- package/dist/cjs/coreX/NamesTooltip/index.js +0 -34
- package/dist/cjs/coreX/OverflowTooltip/index.js +0 -92
- package/dist/cjs/coreX/SidebarSubtitle/index.js +0 -13
- package/dist/cjs/coreX/SortableList/index.js +0 -33
- package/dist/cjs/coreX/SummaryTable/index.js +0 -113
- package/dist/cjs/coreX/SwitchWithText/index.js +0 -59
- package/dist/cjs/coreX/TabMenu/index.js +0 -152
- package/dist/cjs/coreX/TruncatedTextWithTooltip/index.js +0 -69
- package/dist/cjs/coreX/UnitWithChart/index.js +0 -118
- package/dist/cjs/coreX/common/getCalendarTitle.js +0 -26
- package/dist/cjs/hooks/useElementIntersectionRatio.js +0 -30
- package/dist/cjs/hooks/useElementResize.js +0 -69
- package/dist/cjs/hooks/useElementsSize.js +0 -58
- package/dist/cjs/hooks/useMemoCompare.js +0 -17
- package/dist/cjs/hooks/useParrotTranslation.js +0 -13
- package/dist/cjs/index.js +0 -120
- package/dist/cjs/spec/type.js +0 -9
- package/dist/cjs/store/chart.js +0 -65
- package/dist/cjs/store/index.js +0 -48
- package/dist/cjs/store/modal.js +0 -67
- package/dist/cjs/styles/token/color.js +0 -273
- package/dist/cjs/utils/constants.js +0 -8
- package/dist/cjs/utils/cron-time.js +0 -450
- package/dist/cjs/utils/dom.js +0 -16
- package/dist/cjs/utils/icon.js +0 -22
- package/dist/cjs/utils/isEmpty.js +0 -12
- package/dist/cjs/utils/time.js +0 -86
- package/dist/cjs/utils/tower.js +0 -188
- package/dist/esm/UIKitProvider/index.js +0 -71
- package/dist/esm/core/AccordionCard/index.js +0 -57
- package/dist/esm/core/Alert/index.js +0 -78
- package/dist/esm/core/Arch/index.js +0 -15
- package/dist/esm/core/Badge/index.js +0 -49
- package/dist/esm/core/BaseIcon/index.js +0 -74
- package/dist/esm/core/Bit/index.js +0 -38
- package/dist/esm/core/BitPerSecond/index.js +0 -38
- package/dist/esm/core/Bps/index.js +0 -38
- package/dist/esm/core/Breadcrumb/index.js +0 -53
- package/dist/esm/core/Button/HoverableElement.js +0 -12
- package/dist/esm/core/Button/index.js +0 -87
- package/dist/esm/core/ButtonGroup/index.js +0 -105
- package/dist/esm/core/Byte/index.js +0 -47
- package/dist/esm/core/Calendar/index.js +0 -23
- package/dist/esm/core/Card/CardBody.js +0 -10
- package/dist/esm/core/Card/CardTitle.js +0 -10
- package/dist/esm/core/Card/CardWrapper.js +0 -53
- package/dist/esm/core/Card/index.js +0 -92
- package/dist/esm/core/Cascader/cascader.style.js +0 -12
- package/dist/esm/core/Cascader/cascader.widget.js +0 -79
- package/dist/esm/core/Cascader/index.js +0 -72
- package/dist/esm/core/Checkbox/checkbox.style.js +0 -3
- package/dist/esm/core/Checkbox/index.js +0 -51
- package/dist/esm/core/DetailCard/index.js +0 -21
- package/dist/esm/core/DonutChart/index.js +0 -161
- package/dist/esm/core/DropdownMenu/index.js +0 -61
- package/dist/esm/core/Empty/index.js +0 -9
- package/dist/esm/core/ExpandableList/ExpandIcon.js +0 -15
- package/dist/esm/core/ExpandableList/ExpandableContainer.js +0 -15
- package/dist/esm/core/ExpandableList/ExpandableItem.js +0 -46
- package/dist/esm/core/ExpandableList/RoundOrder.js +0 -20
- package/dist/esm/core/FailedLoad/index.js +0 -30
- package/dist/esm/core/Fields/FieldsBoolean/index.js +0 -45
- package/dist/esm/core/Fields/FieldsDateTime/index.js +0 -22
- package/dist/esm/core/Fields/FieldsDateTimeRange/index.js +0 -48
- package/dist/esm/core/Fields/FieldsEnum/index.js +0 -58
- package/dist/esm/core/Fields/FieldsFloat/index.js +0 -58
- package/dist/esm/core/Fields/FieldsInt/index.js +0 -76
- package/dist/esm/core/Fields/FieldsInteger/index.js +0 -55
- package/dist/esm/core/Fields/FieldsString/index.js +0 -114
- package/dist/esm/core/Fields/FieldsTextArea/index.js +0 -62
- package/dist/esm/core/Fields/FieldsTimePicker/index.js +0 -52
- package/dist/esm/core/Fields/index.js +0 -26
- package/dist/esm/core/Form/index.js +0 -8
- package/dist/esm/core/FormItem/index.js +0 -36
- package/dist/esm/core/Frequency/index.js +0 -38
- package/dist/esm/core/Icon/index.js +0 -115
- package/dist/esm/core/Input/index.js +0 -64
- package/dist/esm/core/InputGroup/index.js +0 -12
- package/dist/esm/core/InputInteger/formatterInteger.js +0 -13
- package/dist/esm/core/InputInteger/index.js +0 -92
- package/dist/esm/core/InputNumber/index.js +0 -85
- package/dist/esm/core/InputTagItem/index.js +0 -10
- package/dist/esm/core/KitStoreProvider/index.js +0 -17
- package/dist/esm/core/Link/index.js +0 -54
- package/dist/esm/core/Loading/index.js +0 -31
- package/dist/esm/core/Loading/style.js +0 -6
- package/dist/esm/core/Metric/metric.js +0 -19
- package/dist/esm/core/Modal/index.js +0 -212
- package/dist/esm/core/ModalStack/index.js +0 -45
- package/dist/esm/core/Overflow/index.js +0 -112
- package/dist/esm/core/Pagination/index.js +0 -115
- package/dist/esm/core/ParrotTrans/index.js +0 -26
- package/dist/esm/core/Percent/index.js +0 -39
- package/dist/esm/core/Progress/index.js +0 -23
- package/dist/esm/core/Radio/index.js +0 -136
- package/dist/esm/core/SearchInput/index.js +0 -48
- package/dist/esm/core/Second/index.js +0 -41
- package/dist/esm/core/SegmentControl/index.js +0 -41
- package/dist/esm/core/Select/index.js +0 -138
- package/dist/esm/core/SimplePagination/index.js +0 -88
- package/dist/esm/core/Speed/index.js +0 -38
- package/dist/esm/core/StatusCapsule/index.js +0 -94
- package/dist/esm/core/StepProgress/index.js +0 -42
- package/dist/esm/core/Steps/index.js +0 -124
- package/dist/esm/core/Steps/style.js +0 -7
- package/dist/esm/core/Styled/index.js +0 -45
- package/dist/esm/core/Switch/index.js +0 -59
- package/dist/esm/core/Table/TableWidget.js +0 -44
- package/dist/esm/core/Table/common.js +0 -44
- package/dist/esm/core/Table/index.js +0 -104
- package/dist/esm/core/TableForm/AddRowButton.js +0 -106
- package/dist/esm/core/TableForm/Columns/AffixColumn.js +0 -46
- package/dist/esm/core/TableForm/Columns/CheckboxColumn.js +0 -32
- package/dist/esm/core/TableForm/Columns/FormItem.js +0 -18
- package/dist/esm/core/TableForm/Columns/InputColumn.js +0 -114
- package/dist/esm/core/TableForm/Columns/TextColumn.js +0 -41
- package/dist/esm/core/TableForm/Columns/index.js +0 -21
- package/dist/esm/core/TableForm/TableFormBodyCell.js +0 -163
- package/dist/esm/core/TableForm/TableFormBodyRows.js +0 -213
- package/dist/esm/core/TableForm/TableFormHeaderCell.js +0 -91
- package/dist/esm/core/TableForm/index.js +0 -185
- package/dist/esm/core/TableForm/style.js +0 -27
- package/dist/esm/core/TableForm/types.js +0 -8
- package/dist/esm/core/TableForm/utils.js +0 -32
- package/dist/esm/core/Tag/SplitTag.js +0 -62
- package/dist/esm/core/Tag/const.js +0 -10
- package/dist/esm/core/Tag/index.js +0 -91
- package/dist/esm/core/Tag/style.js +0 -9
- package/dist/esm/core/TextArea/index.js +0 -70
- package/dist/esm/core/Time/index.js +0 -29
- package/dist/esm/core/TimePicker/index.js +0 -64
- package/dist/esm/core/TimeZoneSelect/index.js +0 -163
- package/dist/esm/core/Token/index.js +0 -81
- package/dist/esm/core/Token/style.js +0 -3
- package/dist/esm/core/Tooltip/index.js +0 -87
- package/dist/esm/core/Truncate/index.js +0 -47
- package/dist/esm/core/Typo/index.js +0 -128
- package/dist/esm/core/antd.js +0 -205
- package/dist/esm/core/message/index.js +0 -179
- package/dist/esm/core/message-group/index.js +0 -143
- package/dist/esm/coreX/BarChart/index.js +0 -34
- package/dist/esm/coreX/BatchOperation/index.js +0 -144
- package/dist/esm/coreX/ChartWithTooltip/index.js +0 -149
- package/dist/esm/coreX/Counting/index.js +0 -20
- package/dist/esm/coreX/CronCalendar/index.js +0 -103
- package/dist/esm/coreX/CronPlan/index.js +0 -457
- package/dist/esm/coreX/DateRangePicker/AbsoluteDate.js +0 -177
- package/dist/esm/coreX/DateRangePicker/Calendar.js +0 -284
- package/dist/esm/coreX/DateRangePicker/DateRangePicker.style.js +0 -77
- package/dist/esm/coreX/DateRangePicker/InputTime.js +0 -149
- package/dist/esm/coreX/DateRangePicker/RelativeTime.js +0 -51
- package/dist/esm/coreX/DateRangePicker/common.js +0 -183
- package/dist/esm/coreX/DateRangePicker/index.js +0 -325
- package/dist/esm/coreX/DeprecatedDonutChart/index.js +0 -37
- package/dist/esm/coreX/DropdownTransition/index.js +0 -71
- package/dist/esm/coreX/GoBackButton/index.js +0 -43
- package/dist/esm/coreX/I18nNameTag/index.js +0 -35
- package/dist/esm/coreX/NamesTooltip/index.js +0 -32
- package/dist/esm/coreX/OverflowTooltip/index.js +0 -90
- package/dist/esm/coreX/SidebarSubtitle/index.js +0 -11
- package/dist/esm/coreX/SortableList/index.js +0 -31
- package/dist/esm/coreX/SummaryTable/index.js +0 -108
- package/dist/esm/coreX/SwitchWithText/index.js +0 -57
- package/dist/esm/coreX/TabMenu/index.js +0 -150
- package/dist/esm/coreX/TruncatedTextWithTooltip/index.js +0 -67
- package/dist/esm/coreX/UnitWithChart/index.js +0 -113
- package/dist/esm/coreX/common/getCalendarTitle.js +0 -24
- package/dist/esm/hooks/useElementIntersectionRatio.js +0 -28
- package/dist/esm/hooks/useElementResize.js +0 -67
- package/dist/esm/hooks/useElementsSize.js +0 -56
- package/dist/esm/hooks/useMemoCompare.js +0 -15
- package/dist/esm/hooks/useParrotTranslation.js +0 -11
- package/dist/esm/spec/type.js +0 -7
- package/dist/esm/store/chart.js +0 -62
- package/dist/esm/store/index.js +0 -37
- package/dist/esm/store/modal.js +0 -63
- package/dist/esm/styles/token/color.js +0 -271
- package/dist/esm/utils/constants.js +0 -5
- package/dist/esm/utils/cron-time.js +0 -448
- package/dist/esm/utils/dom.js +0 -14
- package/dist/esm/utils/icon.js +0 -20
- package/dist/esm/utils/isEmpty.js +0 -10
- package/dist/esm/utils/time.js +0 -76
- package/dist/esm/utils/tower.js +0 -173
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
import { ClockIcon, CloseIcon } from '@cloudtower/icons-react';
|
|
2
|
-
import { ParrotLngs } from '@cloudtower/parrot';
|
|
3
|
-
import { cx } from '@linaria/core';
|
|
4
|
-
import AccordionCard from '../../core/AccordionCard/index.js';
|
|
5
|
-
import Button from '../../core/Button/index.js';
|
|
6
|
-
import fields from '../../core/Fields/index.js';
|
|
7
|
-
import Switch from '../../core/Switch/index.js';
|
|
8
|
-
import TimePicker from '../../core/TimePicker/index.js';
|
|
9
|
-
import { Typo } from '../../core/Typo/index.js';
|
|
10
|
-
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
11
|
-
import { DatePicker } from 'antd';
|
|
12
|
-
import dayjs from 'dayjs';
|
|
13
|
-
import _ from 'lodash';
|
|
14
|
-
import moment from 'moment';
|
|
15
|
-
import React__default, { useMemo, useState, useEffect } from 'react';
|
|
16
|
-
import { CronTime } from '../../utils/cron-time.js';
|
|
17
|
-
import { getMode, getTime, getDaily, getWeekly, getMonthly, toMonthlyString, toWeeklyString, toDailyString } from '../../utils/time.js';
|
|
18
|
-
|
|
19
|
-
var __defProp = Object.defineProperty;
|
|
20
|
-
var __defProps = Object.defineProperties;
|
|
21
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
22
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
23
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
24
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
25
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value
|
|
30
|
-
}) : obj[key] = value;
|
|
31
|
-
var __spreadValues = (a, b) => {
|
|
32
|
-
for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
33
|
-
if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) {
|
|
34
|
-
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]);
|
|
35
|
-
}
|
|
36
|
-
return a;
|
|
37
|
-
};
|
|
38
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
39
|
-
const CronPlanWrapper = "c1up1pdz";
|
|
40
|
-
const CronPlanHeader = "c156wh19";
|
|
41
|
-
const ModeTabs = "m126spxy";
|
|
42
|
-
const Wrapper = "wpbf4pq";
|
|
43
|
-
const stringifyPlan = (mode, daily, weekly, monthly, i18n) => {
|
|
44
|
-
const isEn = i18n.language === ParrotLngs.en;
|
|
45
|
-
const mark = isEn ? " , " : "\u3001";
|
|
46
|
-
const days_map = isEn ? EN_WEEK_DAYS_MAP(i18n.t) : WEEK_DAYS_MAP(i18n.t);
|
|
47
|
-
if (mode === "day") {
|
|
48
|
-
const time = daily.time.format("HH:mm");
|
|
49
|
-
const count = daily.step || 0;
|
|
50
|
-
return count > 1 ? i18n.t("components.every_day_with_count_and_time", {
|
|
51
|
-
count: daily.step,
|
|
52
|
-
time
|
|
53
|
-
}) : i18n.t("components.every_day_with_time", {
|
|
54
|
-
time
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
if (mode === "week") {
|
|
58
|
-
const time = weekly.time.format("HH:mm");
|
|
59
|
-
const count = weekly.step || 0;
|
|
60
|
-
const day = weekly.days.map(d => days_map[d]).join(mark);
|
|
61
|
-
const repeat_day = weekly.days.length > 0;
|
|
62
|
-
return count > 1 ? repeat_day ? i18n.t("components.every_weeks_with_count_and_day_and_time", {
|
|
63
|
-
count,
|
|
64
|
-
day,
|
|
65
|
-
time
|
|
66
|
-
}) : i18n.t("components.every_weeks_with_count_and_time", {
|
|
67
|
-
count,
|
|
68
|
-
time
|
|
69
|
-
}) : repeat_day ? i18n.t("components.every_week_with_day_and_time", {
|
|
70
|
-
time,
|
|
71
|
-
day
|
|
72
|
-
}) : i18n.t("components.every_week_with_time", {
|
|
73
|
-
time
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
if (mode === "month") {
|
|
77
|
-
const time = monthly.time.format("HH:mm");
|
|
78
|
-
const count = monthly.step || 0;
|
|
79
|
-
const day = monthly.days.join(mark);
|
|
80
|
-
const repeat_day = monthly.days.length > 0;
|
|
81
|
-
return count > 1 ? repeat_day ? i18n.t("components.every_months_with_count_and_day_and_time", {
|
|
82
|
-
count,
|
|
83
|
-
time,
|
|
84
|
-
day
|
|
85
|
-
}) : i18n.t("components.every_months_with_count_and_time", {
|
|
86
|
-
count,
|
|
87
|
-
time
|
|
88
|
-
}) : repeat_day ? i18n.t("components.every_month_with_day_and_time", {
|
|
89
|
-
day,
|
|
90
|
-
time
|
|
91
|
-
}) : i18n.t("components.every_month_with_time", {
|
|
92
|
-
time
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
const Mode = ({
|
|
97
|
-
mode,
|
|
98
|
-
setMode
|
|
99
|
-
}) => {
|
|
100
|
-
const {
|
|
101
|
-
t
|
|
102
|
-
} = useParrotTranslation();
|
|
103
|
-
return /* @__PURE__ */React__default.createElement("div", {
|
|
104
|
-
className: ModeTabs
|
|
105
|
-
}, /* @__PURE__ */React__default.createElement(Button, {
|
|
106
|
-
className: cx(mode === "day" && "active"),
|
|
107
|
-
type: "link",
|
|
108
|
-
onClick: () => setMode("day")
|
|
109
|
-
}, t("components.as_day")), /* @__PURE__ */React__default.createElement(Button, {
|
|
110
|
-
className: cx(mode === "week" && "active"),
|
|
111
|
-
type: "link",
|
|
112
|
-
onClick: () => setMode("week")
|
|
113
|
-
}, t("components.as_week")), /* @__PURE__ */React__default.createElement(Button, {
|
|
114
|
-
className: cx(mode === "month" && "active"),
|
|
115
|
-
type: "link",
|
|
116
|
-
onClick: () => setMode("month")
|
|
117
|
-
}, t("components.as_month")));
|
|
118
|
-
};
|
|
119
|
-
const Daily = ({
|
|
120
|
-
daily,
|
|
121
|
-
setDaily
|
|
122
|
-
}) => {
|
|
123
|
-
const {
|
|
124
|
-
t
|
|
125
|
-
} = useParrotTranslation();
|
|
126
|
-
return /* @__PURE__ */React__default.createElement("div", {
|
|
127
|
-
className: Wrapper
|
|
128
|
-
}, t("components.per_day_1"), /* @__PURE__ */React__default.createElement(fields.Int, {
|
|
129
|
-
meta: {},
|
|
130
|
-
input: {
|
|
131
|
-
value: daily.step,
|
|
132
|
-
onChange: value => {
|
|
133
|
-
setDaily(__spreadProps(__spreadValues({}, daily), {
|
|
134
|
-
step: value
|
|
135
|
-
}));
|
|
136
|
-
},
|
|
137
|
-
name: "daily-step",
|
|
138
|
-
onBlur() {},
|
|
139
|
-
onFocus() {},
|
|
140
|
-
maxLength: 3
|
|
141
|
-
}
|
|
142
|
-
}), t("components.per_day_2"), /* @__PURE__ */React__default.createElement(TimePicker, {
|
|
143
|
-
format: "HH:mm",
|
|
144
|
-
value: daily.time,
|
|
145
|
-
onChange: value => {
|
|
146
|
-
if (value) {
|
|
147
|
-
setDaily(__spreadProps(__spreadValues({}, daily), {
|
|
148
|
-
time: value
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
clearIcon: null,
|
|
153
|
-
suffixIcon: null
|
|
154
|
-
}), t("components.per_day_3"));
|
|
155
|
-
};
|
|
156
|
-
const WEEK_DAYS = t => [{
|
|
157
|
-
value: 1,
|
|
158
|
-
text: t("common.monday")
|
|
159
|
-
}, {
|
|
160
|
-
value: 2,
|
|
161
|
-
text: t("common.tuesday")
|
|
162
|
-
}, {
|
|
163
|
-
value: 3,
|
|
164
|
-
text: t("common.wednesday")
|
|
165
|
-
}, {
|
|
166
|
-
value: 4,
|
|
167
|
-
text: t("common.thursday")
|
|
168
|
-
}, {
|
|
169
|
-
value: 5,
|
|
170
|
-
text: t("common.friday")
|
|
171
|
-
}, {
|
|
172
|
-
value: 6,
|
|
173
|
-
text: t("common.saturday")
|
|
174
|
-
}, {
|
|
175
|
-
value: 0,
|
|
176
|
-
text: t("common.sunday")
|
|
177
|
-
}];
|
|
178
|
-
const WEEK_DAYS_MAP = t => WEEK_DAYS(t).reduce((prev, cur) => {
|
|
179
|
-
prev[cur.value] = cur.text[1];
|
|
180
|
-
return prev;
|
|
181
|
-
}, {});
|
|
182
|
-
const EN_WEEK_DAYS_MAP = t => WEEK_DAYS(t).reduce((prev, cur) => {
|
|
183
|
-
prev[cur.value] = cur.text;
|
|
184
|
-
return prev;
|
|
185
|
-
}, {});
|
|
186
|
-
const Weekly = ({
|
|
187
|
-
weekly,
|
|
188
|
-
setWeekly
|
|
189
|
-
}) => {
|
|
190
|
-
const {
|
|
191
|
-
t,
|
|
192
|
-
i18n
|
|
193
|
-
} = useParrotTranslation();
|
|
194
|
-
const week_days = useMemo(() => WEEK_DAYS(t), [t]);
|
|
195
|
-
return /* @__PURE__ */React__default.createElement("div", {
|
|
196
|
-
className: Wrapper
|
|
197
|
-
}, t("components.per_day_1"), /* @__PURE__ */React__default.createElement(fields.Int, {
|
|
198
|
-
meta: {},
|
|
199
|
-
input: {
|
|
200
|
-
value: weekly.step,
|
|
201
|
-
onChange: value => {
|
|
202
|
-
setWeekly(__spreadProps(__spreadValues({}, weekly), {
|
|
203
|
-
step: value
|
|
204
|
-
}));
|
|
205
|
-
},
|
|
206
|
-
name: "weekly-step",
|
|
207
|
-
onBlur() {},
|
|
208
|
-
onFocus() {},
|
|
209
|
-
maxLength: 3
|
|
210
|
-
}
|
|
211
|
-
}), t("components.week_with_below_date"), /* @__PURE__ */React__default.createElement("div", {
|
|
212
|
-
className: "options"
|
|
213
|
-
}, week_days.map(d => {
|
|
214
|
-
const active = weekly.days.includes(d.value);
|
|
215
|
-
return /* @__PURE__ */React__default.createElement(Button, {
|
|
216
|
-
className: cx("week-day-option", active && "active", i18n.language === ParrotLngs.en && "en-text"),
|
|
217
|
-
type: "default",
|
|
218
|
-
key: d.value,
|
|
219
|
-
onClick: () => setWeekly(__spreadProps(__spreadValues({}, weekly), {
|
|
220
|
-
days: active ? weekly.days.filter(day => day !== d.value) : weekly.days.concat(d.value).sort((a, b) => a - b)
|
|
221
|
-
}))
|
|
222
|
-
}, d.text);
|
|
223
|
-
})), t("components.execution_time"), /* @__PURE__ */React__default.createElement(TimePicker, {
|
|
224
|
-
style: {
|
|
225
|
-
marginLeft: 0
|
|
226
|
-
},
|
|
227
|
-
format: "HH:mm",
|
|
228
|
-
value: weekly.time,
|
|
229
|
-
onChange: value => {
|
|
230
|
-
if (value) {
|
|
231
|
-
setWeekly(__spreadProps(__spreadValues({}, weekly), {
|
|
232
|
-
time: value
|
|
233
|
-
}));
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
clearIcon: null,
|
|
237
|
-
suffixIcon: null
|
|
238
|
-
}));
|
|
239
|
-
};
|
|
240
|
-
const MONTH_DAYS = _.range(1, 32);
|
|
241
|
-
const Monthly = ({
|
|
242
|
-
monthly,
|
|
243
|
-
setMonthly
|
|
244
|
-
}) => {
|
|
245
|
-
const mayNotExistDays = _.intersection(monthly.days, [29, 30, 31]);
|
|
246
|
-
const {
|
|
247
|
-
t,
|
|
248
|
-
i18n
|
|
249
|
-
} = useParrotTranslation();
|
|
250
|
-
const mark = i18n.language === ParrotLngs.en ? " , " : "\u3001";
|
|
251
|
-
return /* @__PURE__ */React__default.createElement("div", {
|
|
252
|
-
className: Wrapper
|
|
253
|
-
}, t("components.per_day_1"), /* @__PURE__ */React__default.createElement(fields.Int, {
|
|
254
|
-
meta: {},
|
|
255
|
-
input: {
|
|
256
|
-
value: monthly.step,
|
|
257
|
-
onChange: value => {
|
|
258
|
-
setMonthly(__spreadProps(__spreadValues({}, monthly), {
|
|
259
|
-
step: value
|
|
260
|
-
}));
|
|
261
|
-
},
|
|
262
|
-
name: "monthly-step",
|
|
263
|
-
onBlur() {},
|
|
264
|
-
onFocus() {},
|
|
265
|
-
maxLength: 3
|
|
266
|
-
}
|
|
267
|
-
}), t("components.month_with_below_date"), /* @__PURE__ */React__default.createElement("div", {
|
|
268
|
-
className: "options"
|
|
269
|
-
}, MONTH_DAYS.map(d => {
|
|
270
|
-
const active = monthly.days.includes(d);
|
|
271
|
-
return /* @__PURE__ */React__default.createElement(Button, {
|
|
272
|
-
className: cx("month-day-option", active && "active"),
|
|
273
|
-
type: "default",
|
|
274
|
-
key: d,
|
|
275
|
-
onClick: () => setMonthly(__spreadProps(__spreadValues({}, monthly), {
|
|
276
|
-
days: active ? monthly.days.filter(day => day !== d) : monthly.days.concat(d).sort((a, b) => a - b)
|
|
277
|
-
}))
|
|
278
|
-
}, d);
|
|
279
|
-
}), mayNotExistDays.length > 0 && /* @__PURE__ */React__default.createElement("span", {
|
|
280
|
-
className: cx("help", Typo.Label.l4_regular)
|
|
281
|
-
}, t("components.will_excute_at_last_day_with_date", {
|
|
282
|
-
date: `${mayNotExistDays.join(mark)} `
|
|
283
|
-
}))), t("components.execution_time"), /* @__PURE__ */React__default.createElement(TimePicker, {
|
|
284
|
-
style: {
|
|
285
|
-
marginLeft: 0
|
|
286
|
-
},
|
|
287
|
-
format: "HH:mm",
|
|
288
|
-
value: monthly.time,
|
|
289
|
-
onChange: value => {
|
|
290
|
-
if (value) {
|
|
291
|
-
setMonthly(__spreadProps(__spreadValues({}, monthly), {
|
|
292
|
-
time: value
|
|
293
|
-
}));
|
|
294
|
-
}
|
|
295
|
-
},
|
|
296
|
-
clearIcon: null,
|
|
297
|
-
suffixIcon: null
|
|
298
|
-
}));
|
|
299
|
-
};
|
|
300
|
-
const CronPlan = props => {
|
|
301
|
-
const {
|
|
302
|
-
value,
|
|
303
|
-
onChange,
|
|
304
|
-
onRemove
|
|
305
|
-
} = props;
|
|
306
|
-
const {
|
|
307
|
-
t,
|
|
308
|
-
i18n
|
|
309
|
-
} = useParrotTranslation();
|
|
310
|
-
const cronTime = useMemo(() => {
|
|
311
|
-
return new CronTime(value.expression, value.startAt);
|
|
312
|
-
}, [value]);
|
|
313
|
-
const sendAtDate = useMemo(() => cronTime.sendAt(), [cronTime]);
|
|
314
|
-
const changeValue = newValue => {
|
|
315
|
-
onChange(__spreadValues(__spreadValues({}, value), newValue));
|
|
316
|
-
};
|
|
317
|
-
const [mode, setMode] = useState(getMode(cronTime["source"]));
|
|
318
|
-
const source = cronTime["source"];
|
|
319
|
-
const [,,, day, month] = source.split(" ");
|
|
320
|
-
const time = getTime(cronTime);
|
|
321
|
-
const [daily, setDaily] = useState(() => {
|
|
322
|
-
const rawDaily = getDaily(mode, source, time);
|
|
323
|
-
return __spreadProps(__spreadValues({}, rawDaily), {
|
|
324
|
-
time: moment(rawDaily.time.format())
|
|
325
|
-
});
|
|
326
|
-
});
|
|
327
|
-
const [weekly, setWeekly] = useState(() => {
|
|
328
|
-
const rawWeekly = getWeekly(mode, source, time);
|
|
329
|
-
return __spreadProps(__spreadValues({}, rawWeekly), {
|
|
330
|
-
time: moment(rawWeekly.time.format())
|
|
331
|
-
});
|
|
332
|
-
});
|
|
333
|
-
const [monthly, setMonthly] = useState(() => {
|
|
334
|
-
const rawMonthly = getMonthly(mode, month, day, time);
|
|
335
|
-
return __spreadProps(__spreadValues({}, rawMonthly), {
|
|
336
|
-
time: moment(rawMonthly.time.format())
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
useEffect(() => {
|
|
340
|
-
let newExpression = "";
|
|
341
|
-
let empty = false;
|
|
342
|
-
switch (mode) {
|
|
343
|
-
case "day":
|
|
344
|
-
newExpression = toDailyString(daily.step, dayjs(daily.time.format()));
|
|
345
|
-
break;
|
|
346
|
-
case "week":
|
|
347
|
-
newExpression = toWeeklyString(weekly.step, dayjs(weekly.time.format()), weekly.days);
|
|
348
|
-
if (weekly.days.length === 0) {
|
|
349
|
-
empty = true;
|
|
350
|
-
}
|
|
351
|
-
break;
|
|
352
|
-
case "month":
|
|
353
|
-
newExpression = toMonthlyString(monthly.step, dayjs(monthly.time.format()), monthly.days);
|
|
354
|
-
if (monthly.days.length === 0) {
|
|
355
|
-
empty = true;
|
|
356
|
-
}
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
if (newExpression === value.expression) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
changeValue({
|
|
363
|
-
expression: newExpression,
|
|
364
|
-
empty
|
|
365
|
-
});
|
|
366
|
-
}, [mode, daily, weekly, monthly]);
|
|
367
|
-
const title = stringifyPlan(mode, daily, weekly, monthly, i18n);
|
|
368
|
-
return /* @__PURE__ */React__default.createElement(AccordionCard, {
|
|
369
|
-
className: CronPlanWrapper,
|
|
370
|
-
header: /* @__PURE__ */React__default.createElement("div", {
|
|
371
|
-
className: CronPlanHeader
|
|
372
|
-
}, /* @__PURE__ */React__default.createElement("div", {
|
|
373
|
-
className: "left"
|
|
374
|
-
}, /* @__PURE__ */React__default.createElement(ClockIcon, null), /* @__PURE__ */React__default.createElement("span", {
|
|
375
|
-
className: cx(Typo.Label.l2_regular, "title"),
|
|
376
|
-
title
|
|
377
|
-
}, title), /* @__PURE__ */React__default.createElement("span", {
|
|
378
|
-
className: cx(Typo.Label.l4_regular, "retain")
|
|
379
|
-
}, t("components.retain_with_count", {
|
|
380
|
-
count: value.retain || 1
|
|
381
|
-
}))), /* @__PURE__ */React__default.createElement("div", {
|
|
382
|
-
className: "right",
|
|
383
|
-
onClick: e => e.stopPropagation()
|
|
384
|
-
}, /* @__PURE__ */React__default.createElement("span", {
|
|
385
|
-
className: "reverse"
|
|
386
|
-
}, /* @__PURE__ */React__default.createElement(Switch, {
|
|
387
|
-
checked: value.enabled,
|
|
388
|
-
onChange: v => changeValue({
|
|
389
|
-
enabled: v
|
|
390
|
-
})
|
|
391
|
-
}, value.enabled ? t("common.enable") : t("common.disable"))), /* @__PURE__ */React__default.createElement("span", {
|
|
392
|
-
className: "close",
|
|
393
|
-
onClick: onRemove
|
|
394
|
-
}, /* @__PURE__ */React__default.createElement(CloseIcon, null)))),
|
|
395
|
-
expand: /* @__PURE__ */React__default.createElement(React__default.Fragment, null, /* @__PURE__ */React__default.createElement(Mode, {
|
|
396
|
-
mode,
|
|
397
|
-
setMode
|
|
398
|
-
}), mode === "day" && /* @__PURE__ */React__default.createElement(Daily, {
|
|
399
|
-
daily,
|
|
400
|
-
setDaily
|
|
401
|
-
}), mode === "week" && /* @__PURE__ */React__default.createElement(Weekly, {
|
|
402
|
-
weekly,
|
|
403
|
-
setWeekly
|
|
404
|
-
}), mode === "month" && /* @__PURE__ */React__default.createElement(Monthly, {
|
|
405
|
-
monthly,
|
|
406
|
-
setMonthly
|
|
407
|
-
}), /* @__PURE__ */React__default.createElement("div", {
|
|
408
|
-
className: "field-item"
|
|
409
|
-
}, /* @__PURE__ */React__default.createElement("label", {
|
|
410
|
-
className: Typo.Label.l3_regular_title
|
|
411
|
-
}, t("components.start_date")), /* @__PURE__ */React__default.createElement("div", {
|
|
412
|
-
className: "field"
|
|
413
|
-
}, /* @__PURE__ */React__default.createElement(DatePicker, {
|
|
414
|
-
format: "YYYY/M/DD",
|
|
415
|
-
value: moment(value.startAt.toISOString()),
|
|
416
|
-
onChange: value2 => {
|
|
417
|
-
if (value2) {
|
|
418
|
-
changeValue({
|
|
419
|
-
startAt: dayjs(value2.toISOString())
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
},
|
|
423
|
-
suffixIcon: null,
|
|
424
|
-
clearIcon: null
|
|
425
|
-
}), /* @__PURE__ */React__default.createElement("div", {
|
|
426
|
-
className: cx("help", Typo.Footnote.f2_regular)
|
|
427
|
-
}, t("components.next_generate_with_date", {
|
|
428
|
-
date: sendAtDate.format("YYYY/M/DD HH:mm"),
|
|
429
|
-
interpolation: {
|
|
430
|
-
escapeValue: false
|
|
431
|
-
}
|
|
432
|
-
})))), /* @__PURE__ */React__default.createElement("div", {
|
|
433
|
-
className: "field-item"
|
|
434
|
-
}, /* @__PURE__ */React__default.createElement("label", {
|
|
435
|
-
className: Typo.Label.l3_regular_title
|
|
436
|
-
}, t("components.retain_date")), /* @__PURE__ */React__default.createElement("div", {
|
|
437
|
-
className: "field"
|
|
438
|
-
}, /* @__PURE__ */React__default.createElement(fields.Int, {
|
|
439
|
-
suffix: t("components.count"),
|
|
440
|
-
meta: {},
|
|
441
|
-
input: {
|
|
442
|
-
value: value.retain,
|
|
443
|
-
onChange: v => changeValue({
|
|
444
|
-
retain: v
|
|
445
|
-
}),
|
|
446
|
-
onBlur() {},
|
|
447
|
-
onFocus() {},
|
|
448
|
-
name: "retain",
|
|
449
|
-
maxLength: 2
|
|
450
|
-
}
|
|
451
|
-
}), /* @__PURE__ */React__default.createElement("div", {
|
|
452
|
-
className: cx("help", Typo.Footnote.f2_regular)
|
|
453
|
-
}, t("components.will_save_one_to_thirty_report")))))
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
export { CronPlan as default, stringifyPlan };
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { cx } from '@linaria/core';
|
|
2
|
-
import Button from '../../core/Button/index.js';
|
|
3
|
-
import { Typo } from '../../core/Typo/index.js';
|
|
4
|
-
import Calendar from './Calendar.js';
|
|
5
|
-
import { copyDay, time2string } from './common.js';
|
|
6
|
-
import { AbsoluteTimeStyle } from './DateRangePicker.style.js';
|
|
7
|
-
import InputTime from './InputTime.js';
|
|
8
|
-
import useMemoCompare from '../../hooks/useMemoCompare.js';
|
|
9
|
-
import useParrotTranslation from '../../hooks/useParrotTranslation.js';
|
|
10
|
-
import dayjs from 'dayjs';
|
|
11
|
-
import { isEqual } from 'lodash';
|
|
12
|
-
import React__default, { useState, useImperativeHandle, useEffect, useMemo, useRef } from 'react';
|
|
13
|
-
|
|
14
|
-
function transformTime(type, day, boundaryDate) {
|
|
15
|
-
if (day) {
|
|
16
|
-
const _boundaryDate = dayjs(boundaryDate);
|
|
17
|
-
if (type === "start" && _boundaryDate.isValid()) {
|
|
18
|
-
const start = day.isBefore(_boundaryDate) ? _boundaryDate : day;
|
|
19
|
-
return [
|
|
20
|
-
time2string(start.hour()),
|
|
21
|
-
time2string(start.minute()),
|
|
22
|
-
time2string(start.second())
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
if (type === "end" && _boundaryDate.isValid()) {
|
|
26
|
-
const end = day.isAfter(_boundaryDate) ? _boundaryDate : day;
|
|
27
|
-
return [
|
|
28
|
-
time2string(end.hour()),
|
|
29
|
-
time2string(end.minute()),
|
|
30
|
-
time2string(end.second())
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return ["", "", ""];
|
|
35
|
-
}
|
|
36
|
-
function updateDate(time, date) {
|
|
37
|
-
const [hour, minute, second] = time;
|
|
38
|
-
return copyDay(dayjs(date == null ? void 0 : date.format())).set("hour", parseInt(hour || "0")).set("minute", parseInt(minute || "0")).set("second", parseInt(second || "0"));
|
|
39
|
-
}
|
|
40
|
-
function checkMinAndMaxTimeRange(t, range, timeRange, minDate, maxDate) {
|
|
41
|
-
const [startDate, endDate] = range;
|
|
42
|
-
const [startTime, endTime] = timeRange;
|
|
43
|
-
if (!startDate && !endDate) {
|
|
44
|
-
return void 0;
|
|
45
|
-
}
|
|
46
|
-
if (!minDate && !maxDate) {
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
const _minDate = copyDay(dayjs(minDate));
|
|
50
|
-
const _maxDate = copyDay(dayjs(maxDate));
|
|
51
|
-
if (!_minDate.isValid() && !_maxDate.isValid()) {
|
|
52
|
-
return void 0;
|
|
53
|
-
}
|
|
54
|
-
if (startDate && _minDate.isValid() && startTime.filter(Boolean).length) {
|
|
55
|
-
const _startDate = copyDay(startDate).set("hour", parseInt(startTime[0] || "0")).set("minute", parseInt(startTime[1] || "")).set("second", parseInt(startTime[2] || "0"));
|
|
56
|
-
if (_startDate.isBefore(_minDate)) {
|
|
57
|
-
return t("components.set_start_time_failed", {
|
|
58
|
-
time: _minDate.format("HH:mm:ss")
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
if (endDate && _maxDate.isValid() && endTime.filter(Boolean).length) {
|
|
63
|
-
const _endDate = copyDay(endDate).set("hour", parseInt(endTime[0] || "0")).set("minute", parseInt(endTime[1] || "")).set("second", parseInt(endTime[2] || "0"));
|
|
64
|
-
if (_endDate.isAfter(_maxDate)) {
|
|
65
|
-
return t("components.set_end_time_failed", {
|
|
66
|
-
time: _maxDate.format("HH:mm:ss")
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return void 0;
|
|
71
|
-
}
|
|
72
|
-
const Time = React__default.forwardRef((props, ref) => {
|
|
73
|
-
const { range, minDate, maxDate, onOk } = props;
|
|
74
|
-
const { t } = useParrotTranslation();
|
|
75
|
-
const initRange = useMemoCompare(range, (prev, next) => {
|
|
76
|
-
const prevStringList = prev == null ? void 0 : prev.map((item) => item == null ? void 0 : item.format());
|
|
77
|
-
const nextStringList = next == null ? void 0 : next.map((item) => item == null ? void 0 : item.format());
|
|
78
|
-
return isEqual(prevStringList, nextStringList);
|
|
79
|
-
});
|
|
80
|
-
const [startTime, setStartTime] = useState(
|
|
81
|
-
transformTime("start", initRange == null ? void 0 : initRange[0], minDate)
|
|
82
|
-
);
|
|
83
|
-
const [endTime, setEndTime] = useState(
|
|
84
|
-
transformTime("end", initRange == null ? void 0 : initRange[1], maxDate)
|
|
85
|
-
);
|
|
86
|
-
const [error, setError] = useState("");
|
|
87
|
-
const [start, end] = props.range;
|
|
88
|
-
const startDate = start == null ? void 0 : start.format("YYYY-MM-DD");
|
|
89
|
-
const endDate = end == null ? void 0 : end.format("YYYY-MM-DD");
|
|
90
|
-
function reset() {
|
|
91
|
-
setError("");
|
|
92
|
-
setStartTime(transformTime("start", initRange == null ? void 0 : initRange[0], minDate));
|
|
93
|
-
setEndTime(transformTime("end", initRange == null ? void 0 : initRange[1], maxDate));
|
|
94
|
-
}
|
|
95
|
-
useImperativeHandle(ref, () => ({ reset }));
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
reset();
|
|
98
|
-
}, [initRange]);
|
|
99
|
-
const validateTimeRange = useMemo(() => {
|
|
100
|
-
if (startDate && endDate) {
|
|
101
|
-
let _startDate = copyDay(dayjs(startDate));
|
|
102
|
-
let _endDate = copyDay(dayjs(endDate));
|
|
103
|
-
_startDate = _startDate.set("hour", parseInt(startTime[0] || "0")).set("minute", parseInt(startTime[1] || "0")).set("second", parseInt(startTime[2] || "0"));
|
|
104
|
-
_endDate = _endDate.set("hour", parseInt(endTime[0] || "0")).set("minute", parseInt(endTime[1] || "0")).set("second", parseInt(endTime[2] || "0"));
|
|
105
|
-
return _startDate.valueOf() <= _endDate.valueOf();
|
|
106
|
-
}
|
|
107
|
-
return false;
|
|
108
|
-
}, [endDate, endTime, startDate, startTime]);
|
|
109
|
-
function handleOk() {
|
|
110
|
-
if (!startDate || !endDate) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
const validateResult = checkMinAndMaxTimeRange(
|
|
114
|
-
t,
|
|
115
|
-
range,
|
|
116
|
-
[startTime, endTime],
|
|
117
|
-
minDate,
|
|
118
|
-
maxDate
|
|
119
|
-
);
|
|
120
|
-
if (validateResult) {
|
|
121
|
-
setError(validateResult);
|
|
122
|
-
return;
|
|
123
|
-
} else if (!validateTimeRange && start && end) {
|
|
124
|
-
setError(t("components.end_time_cannot_be_less_than_start_time"));
|
|
125
|
-
return;
|
|
126
|
-
} else {
|
|
127
|
-
setError("");
|
|
128
|
-
}
|
|
129
|
-
onOk([startTime, endTime]);
|
|
130
|
-
}
|
|
131
|
-
return /* @__PURE__ */ React__default.createElement(AbsoluteTimeStyle.Time, null, /* @__PURE__ */ React__default.createElement("div", { className: "time-input-main" }, /* @__PURE__ */ React__default.createElement("div", { className: "time-input-container" }, /* @__PURE__ */ React__default.createElement("div", { className: "start-time" }, /* @__PURE__ */ React__default.createElement("p", { className: cx("date", Typo.Label.l4_regular) }, startDate || t("components.start_date")), /* @__PURE__ */ React__default.createElement(
|
|
132
|
-
InputTime,
|
|
133
|
-
{
|
|
134
|
-
value: startTime,
|
|
135
|
-
danger: !!error,
|
|
136
|
-
onChange: setStartTime
|
|
137
|
-
}
|
|
138
|
-
)), /* @__PURE__ */ React__default.createElement("div", { className: cx("to", Typo.Label.l3_regular) }, t("components.to")), /* @__PURE__ */ React__default.createElement("div", { className: "end-time" }, /* @__PURE__ */ React__default.createElement("p", { className: cx("date", Typo.Label.l4_regular) }, endDate || t("components.end_date")), /* @__PURE__ */ React__default.createElement(InputTime, { value: endTime, danger: !!error, onChange: setEndTime }))), /* @__PURE__ */ React__default.createElement(Button, { disabled: !start || !end, type: "primary", onClick: handleOk }, t("components.confirm"))), error ? /* @__PURE__ */ React__default.createElement("p", { className: "time-input-error" }, error) : null);
|
|
139
|
-
});
|
|
140
|
-
const AbsoluteDate = React__default.forwardRef(
|
|
141
|
-
(props, ref) => {
|
|
142
|
-
const { range, minDate, maxDate, onChange, onOk } = props;
|
|
143
|
-
const timeRef = useRef(null);
|
|
144
|
-
useImperativeHandle(ref, () => {
|
|
145
|
-
var _a;
|
|
146
|
-
return { reset: (_a = timeRef.current) == null ? void 0 : _a.reset };
|
|
147
|
-
});
|
|
148
|
-
function handleOk(timeRange) {
|
|
149
|
-
const [startTime, endTime] = timeRange;
|
|
150
|
-
const nowDate = dayjs();
|
|
151
|
-
const startDate = updateDate(startTime, range[0] || nowDate);
|
|
152
|
-
const endDate = updateDate(endTime, range[1] || nowDate);
|
|
153
|
-
onOk == null ? void 0 : onOk([startDate, endDate]);
|
|
154
|
-
}
|
|
155
|
-
return /* @__PURE__ */ React__default.createElement(AbsoluteTimeStyle.Wrapper, null, /* @__PURE__ */ React__default.createElement(
|
|
156
|
-
Calendar,
|
|
157
|
-
{
|
|
158
|
-
range,
|
|
159
|
-
minDate,
|
|
160
|
-
maxDate,
|
|
161
|
-
onChange
|
|
162
|
-
}
|
|
163
|
-
), /* @__PURE__ */ React__default.createElement(
|
|
164
|
-
Time,
|
|
165
|
-
{
|
|
166
|
-
ref: timeRef,
|
|
167
|
-
range,
|
|
168
|
-
minDate,
|
|
169
|
-
maxDate,
|
|
170
|
-
onOk: handleOk
|
|
171
|
-
}
|
|
172
|
-
));
|
|
173
|
-
}
|
|
174
|
-
);
|
|
175
|
-
var AbsoluteDate$1 = AbsoluteDate;
|
|
176
|
-
|
|
177
|
-
export { AbsoluteDate$1 as default };
|