react-kui 3.1.1 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.zh-CN.md +3 -1
- package/ai/kui-components.json +912 -318
- package/es/_virtual/_rolldown/runtime.js +1 -1
- package/es/affix/index.js +1 -1
- package/es/alert/index.js +11 -4
- package/es/anchor/anchor-context.js +1 -1
- package/es/anchor/anchor-link.js +1 -1
- package/es/anchor/anchor.js +1 -1
- package/es/auto-complete/index.js +371 -347
- package/es/avatar/avatar-group-context.js +1 -1
- package/es/avatar/avatar-group.js +1 -1
- package/es/avatar/avatar.js +1 -1
- package/es/back-top/index.js +1 -1
- package/es/badge/index.js +10 -8
- package/es/base/teleport.js +1 -1
- package/es/base/transition-props.js +1 -1
- package/es/base/transition.js +1 -1
- package/es/breadcrumb/breadcrumb-context.js +1 -1
- package/es/breadcrumb/breadcrumb-item.js +1 -1
- package/es/breadcrumb/breadcrumb.js +1 -1
- package/es/button/button-group-context.js +1 -1
- package/es/button/button-group.js +1 -1
- package/es/button/button.js +13 -6
- package/es/calendar/index.js +20 -6
- package/es/card/index.js +11 -4
- package/es/carousel/carousel-context.js +1 -1
- package/es/carousel/carousel-item.js +1 -1
- package/es/carousel/carousel.js +1 -1
- package/es/carousel/drag.js +1 -1
- package/es/cascader/index.js +13 -10
- package/es/check-card/check-card-group.js +3 -3
- package/es/check-card/check-card.js +155 -141
- package/es/check-card/context.js +1 -1
- package/es/checkbox/checkbox-group-context.js +1 -1
- package/es/checkbox/checkbox-group.js +3 -3
- package/es/checkbox/checkbox.js +64 -244
- package/es/checkbox/index.js +1 -1
- package/es/collapse/collapse-panel.js +1 -1
- package/es/collapse/collapse.js +96 -82
- package/es/color-picker/alpha.js +1 -1
- package/es/color-picker/hue.js +1 -1
- package/es/color-picker/index.js +7 -7
- package/es/color-picker/mode.js +2 -2
- package/es/color-picker/paint.js +1 -1
- package/es/color-picker/presets.js +1 -1
- package/es/components.js +4 -4
- package/es/config/config-context.js +16 -3
- package/es/config/context.js +29 -2
- package/es/config/index.js +31 -12
- package/es/config/popup-host.js +106 -0
- package/es/config/size-context.js +1 -1
- package/es/config/use-config-appearance.js +62 -2
- package/es/const/var.js +6 -2
- package/es/date-picker/index.js +404 -885
- package/es/descriptions/descriptions-item.js +1 -1
- package/es/descriptions/descriptions.js +1 -1
- package/es/divider/index.js +1 -1
- package/es/drawer/index.js +328 -240
- package/es/dropdown/dropdown-button.js +69 -51
- package/es/dropdown/dropdown-context.js +1 -1
- package/es/dropdown/dropdown.js +137 -93
- package/es/dropdown/trigger.js +85 -33
- package/es/empty/index.js +3 -4
- package/es/feature-card/index.js +15 -4
- package/es/feedback-panel/index.js +95 -81
- package/es/flame-wrap/index.js +116 -109
- package/es/flame-wrap/types.js +54 -6
- package/es/flex/index.js +1 -1
- package/es/form/field-context.js +16 -2
- package/es/form/form-context.js +1 -1
- package/es/form/form-item.js +7 -6
- package/es/form/form.js +1 -1
- package/es/form/utils.js +1 -1
- package/es/grid/grid-item.js +1 -1
- package/es/grid/grid.js +1 -1
- package/es/grid/useBreakpoint.js +1 -1
- package/es/icon/index.js +1 -1
- package/es/image/group.js +1 -1
- package/es/image/image-group-context.js +1 -1
- package/es/image/image.js +137 -123
- package/es/image/instance.js +1 -1
- package/es/image/preview.js +1 -1
- package/es/image/utils.js +1 -1
- package/es/index.js +3 -3
- package/es/input/index.js +3 -3
- package/es/input/input-base.js +7 -7
- package/es/input/input-box.js +2 -2
- package/es/input/input-group.js +43 -127
- package/es/input/input.js +1 -1
- package/es/input/textarea.js +28 -114
- package/es/input-number/index.js +7 -5
- package/es/input-otp/index.js +5 -5
- package/es/input-tag/index.js +5 -5
- package/es/kanban/index.js +79 -63
- package/es/layout/index.js +1 -1
- package/es/layout/layout-context.js +1 -1
- package/es/list-panel/index.js +96 -83
- package/es/loading/index.js +1 -1
- package/es/loading/loading-bar.js +1 -1
- package/es/locale/de.js +10 -2
- package/es/locale/el.js +10 -2
- package/es/locale/en.js +10 -2
- package/es/locale/fr.js +10 -2
- package/es/locale/it.js +10 -2
- package/es/locale/ja.js +10 -2
- package/es/locale/ko.js +10 -2
- package/es/locale/ru.js +10 -2
- package/es/locale/th.js +10 -2
- package/es/locale/uk.js +10 -2
- package/es/locale/vi.js +10 -2
- package/es/locale/zh-CN.js +10 -2
- package/es/locale/zh-TW.js +10 -2
- package/es/mentions/index.js +291 -286
- package/es/menu/menu-context.js +1 -1
- package/es/menu/menu-divider.js +1 -1
- package/es/menu/menu-group.js +1 -1
- package/es/menu/menu-item.js +1 -1
- package/es/menu/menu-keyboard.js +41 -2
- package/es/menu/menu.js +268 -222
- package/es/menu/recursive-menu.js +1 -1
- package/es/menu/sub-menu.js +81 -23
- package/es/message/index.js +1 -1
- package/es/modal/api.js +46 -12
- package/es/modal/modal.js +441 -345
- package/es/modal/toast.js +177 -64
- package/es/node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js +1 -1
- package/es/notice/container.js +1 -1
- package/es/notice/content.js +1 -1
- package/es/notice/index.js +1 -1
- package/es/notice/instance.js +1 -1
- package/es/page/index.js +13 -8
- package/es/page/responsive.js +1 -1
- package/es/page-header/index.js +1 -1
- package/es/popconfirm/index.js +36 -35
- package/es/poptip/index.js +47 -45
- package/es/popup/index.js +5 -2
- package/es/popup/layers.js +11 -2
- package/es/progress/index.js +1 -1
- package/es/qrcode/index.js +13 -7
- package/es/radio/radio-button.js +51 -44
- package/es/radio/radio-group-context.js +1 -1
- package/es/radio/radio-group.js +49 -52
- package/es/radio/radio.js +46 -197
- package/es/rate/index.js +1 -1
- package/es/rate/star.js +1 -1
- package/es/result/index.js +1 -1
- package/es/ripple/index.js +104 -97
- package/es/ripple/types.js +71 -18
- package/es/row-col/col.js +1 -1
- package/es/row-col/row.js +1 -1
- package/es/segmented/index.js +3 -3
- package/es/select/option.js +1 -1
- package/es/select/select.js +33 -36
- package/es/skeleton/skeleton-avatar.js +1 -1
- package/es/skeleton/skeleton-button.js +1 -1
- package/es/skeleton/skeleton-image.js +1 -1
- package/es/skeleton/skeleton-text.js +1 -1
- package/es/skeleton/skeleton.js +1 -1
- package/es/skeleton/use-skeleton-loading.js +1 -1
- package/es/slider/index.js +1 -1
- package/es/slider/thumb.js +1 -1
- package/es/space/index.js +1 -1
- package/es/spin/index.js +1 -1
- package/es/splitter/splitter-panel.js +1 -1
- package/es/splitter/splitter.js +1 -1
- package/es/stat-card/countup.js +2 -2
- package/es/stat-card/rollup.js +1 -1
- package/es/stat-card/stat-card.js +16 -7
- package/es/stat-card/stat-number.js +4 -3
- package/es/stat-card/utils/countup.js +1 -1
- package/es/stat-card/utils/odometer.js +1 -1
- package/es/stat-card/utils/stat-item-key.js +22 -0
- package/es/steps/index.js +1 -1
- package/es/switch/index.js +3 -3
- package/es/table/column-setting.js +104 -115
- package/es/table/index.js +544 -206
- package/es/table/utils.js +141 -3
- package/es/tabs/tab-panel.js +1 -1
- package/es/tabs/tabs.js +1 -1
- package/es/tag/index.js +12 -5
- package/es/time-line/timeline-item.js +1 -1
- package/es/time-line/timeline.js +1 -1
- package/es/tooltip/index.js +114 -94
- package/es/tour/index.js +1 -1
- package/es/transfer/index.js +190 -172
- package/es/tree/index.js +55 -44
- package/es/tree/utils.js +1 -1
- package/es/tree-select/index.js +259 -781
- package/es/typography/index.js +1 -1
- package/es/upload/file-list.js +1 -1
- package/es/upload/index.js +5 -6
- package/es/upload/picture-sort.js +1 -1
- package/es/upload/selector.js +1 -1
- package/es/utils/checked.js +1 -1
- package/es/utils/color.js +25 -2
- package/es/utils/css.js +19 -0
- package/es/utils/focus.js +63 -0
- package/es/utils/number.js +1 -1
- package/es/utils/overlay-order.js +18 -0
- package/es/utils/overlay-stack.js +33 -0
- package/es/utils/placement.js +1 -1
- package/es/utils/popup.js +1 -1
- package/es/utils/promise.js +18 -0
- package/es/utils/react-node.js +55 -30
- package/es/utils/selection-tags.js +6 -4
- package/es/utils/share.js +5 -2
- package/es/utils/theme.js +1 -1
- package/es/utils/transition.js +1 -1
- package/es/utils/use-value.js +1 -1
- package/es/virtual-list/index.js +1 -1
- package/es/virtual-list/range.js +3 -2
- package/es/watermark/index.js +1 -1
- package/lib/index.cjs +2 -2
- package/lib/locale/de.cjs +2 -2
- package/lib/locale/el.cjs +2 -2
- package/lib/locale/en.cjs +2 -2
- package/lib/locale/fr.cjs +2 -2
- package/lib/locale/it.cjs +2 -2
- package/lib/locale/ja.cjs +2 -2
- package/lib/locale/ko.cjs +2 -2
- package/lib/locale/ru.cjs +2 -2
- package/lib/locale/th.cjs +2 -2
- package/lib/locale/uk.cjs +2 -2
- package/lib/locale/vi.cjs +2 -2
- package/lib/locale/zh-CN.cjs +2 -2
- package/lib/locale/zh-TW.cjs +2 -2
- package/package.json +4 -3
- package/readme.md +3 -1
- package/style/base.css +2 -2
- package/style/components.css +2 -2
- package/style/index.css +2 -2
- package/style/theme.css +2 -2
- package/types/alert/index.d.cts +2 -2
- package/types/alert/index.d.ts +2 -2
- package/types/auto-complete/index.d.cts +7 -1
- package/types/auto-complete/index.d.ts +7 -1
- package/types/badge/index.d.cts +2 -1
- package/types/badge/index.d.ts +2 -1
- package/types/button/button.d.cts +2 -2
- package/types/button/button.d.ts +2 -2
- package/types/card/index.d.cts +3 -3
- package/types/card/index.d.ts +3 -3
- package/types/cascader/index.d.cts +1 -1
- package/types/cascader/index.d.ts +1 -1
- package/types/cascader/types.d.cts +2 -0
- package/types/cascader/types.d.ts +2 -0
- package/types/check-card/context.d.cts +4 -3
- package/types/check-card/context.d.ts +4 -3
- package/types/check-card/index.d.cts +1 -1
- package/types/check-card/index.d.ts +1 -1
- package/types/check-card/types.d.cts +3 -4
- package/types/check-card/types.d.ts +3 -4
- package/types/checkbox/checkbox-group.d.cts +2 -2
- package/types/checkbox/checkbox-group.d.ts +2 -2
- package/types/checkbox/checkbox.d.cts +2 -2
- package/types/checkbox/checkbox.d.ts +2 -2
- package/types/collapse/collapse.d.cts +3 -3
- package/types/collapse/collapse.d.ts +3 -3
- package/types/color-picker/index.d.cts +3 -1
- package/types/color-picker/index.d.ts +3 -1
- package/types/components.d.cts +2 -2
- package/types/components.d.ts +2 -2
- package/types/config/config-context.d.cts +15 -2
- package/types/config/config-context.d.ts +15 -2
- package/types/config/context.d.cts +6 -0
- package/types/config/context.d.ts +6 -0
- package/types/config/popup-host.d.cts +16 -0
- package/types/config/popup-host.d.ts +16 -0
- package/types/config/use-config-appearance.d.cts +41 -2
- package/types/config/use-config-appearance.d.ts +41 -2
- package/types/const/types.d.cts +30 -1
- package/types/const/types.d.ts +30 -1
- package/types/const/var.d.cts +6 -1
- package/types/const/var.d.ts +6 -1
- package/types/date-picker/index.d.cts +3 -1
- package/types/date-picker/index.d.ts +3 -1
- package/types/descriptions/descriptions.d.cts +2 -2
- package/types/descriptions/descriptions.d.ts +2 -2
- package/types/drawer/index.d.cts +1 -0
- package/types/drawer/index.d.ts +1 -0
- package/types/dropdown/dropdown-button.d.cts +5 -2
- package/types/dropdown/dropdown-button.d.ts +5 -2
- package/types/dropdown/dropdown-context.d.cts +6 -0
- package/types/dropdown/dropdown-context.d.ts +6 -0
- package/types/dropdown/dropdown.d.cts +2 -0
- package/types/dropdown/dropdown.d.ts +2 -0
- package/types/feature-card/index.d.cts +3 -3
- package/types/feature-card/index.d.ts +3 -3
- package/types/feedback-panel/index.d.cts +3 -3
- package/types/feedback-panel/index.d.ts +3 -3
- package/types/flame-wrap/types.d.cts +18 -0
- package/types/flame-wrap/types.d.ts +18 -0
- package/types/form/field-context.d.cts +2 -0
- package/types/form/field-context.d.ts +2 -0
- package/types/image/image.d.cts +2 -2
- package/types/image/image.d.ts +2 -2
- package/types/input/input-group.d.cts +2 -2
- package/types/input/input-group.d.ts +2 -2
- package/types/input-number/index.d.cts +2 -0
- package/types/input-number/index.d.ts +2 -0
- package/types/kanban/index.d.cts +3 -2
- package/types/kanban/index.d.ts +3 -2
- package/types/list-panel/index.d.cts +3 -3
- package/types/list-panel/index.d.ts +3 -3
- package/types/locale/de.d.cts +6 -0
- package/types/locale/de.d.ts +6 -0
- package/types/locale/el.d.cts +6 -0
- package/types/locale/el.d.ts +6 -0
- package/types/locale/en.d.cts +6 -0
- package/types/locale/en.d.ts +6 -0
- package/types/locale/fr.d.cts +6 -0
- package/types/locale/fr.d.ts +6 -0
- package/types/locale/it.d.cts +6 -0
- package/types/locale/it.d.ts +6 -0
- package/types/locale/ja.d.cts +6 -0
- package/types/locale/ja.d.ts +6 -0
- package/types/locale/ko.d.cts +6 -0
- package/types/locale/ko.d.ts +6 -0
- package/types/locale/ru.d.cts +6 -0
- package/types/locale/ru.d.ts +6 -0
- package/types/locale/th.d.cts +6 -0
- package/types/locale/th.d.ts +6 -0
- package/types/locale/uk.d.cts +6 -0
- package/types/locale/uk.d.ts +6 -0
- package/types/locale/vi.d.cts +6 -0
- package/types/locale/vi.d.ts +6 -0
- package/types/locale/zh-CN.d.cts +6 -0
- package/types/locale/zh-CN.d.ts +6 -0
- package/types/locale/zh-TW.d.cts +6 -0
- package/types/locale/zh-TW.d.ts +6 -0
- package/types/mentions/index.d.cts +2 -0
- package/types/mentions/index.d.ts +2 -0
- package/types/menu/menu-keyboard.d.cts +23 -0
- package/types/menu/menu-keyboard.d.ts +23 -0
- package/types/modal/api.d.cts +6 -1
- package/types/modal/api.d.ts +6 -1
- package/types/modal/modal.d.cts +1 -0
- package/types/modal/modal.d.ts +1 -0
- package/types/modal/toast.d.cts +8 -2
- package/types/modal/toast.d.ts +8 -2
- package/types/page/index.d.cts +2 -2
- package/types/page/index.d.ts +2 -2
- package/types/popconfirm/index.d.cts +2 -0
- package/types/popconfirm/index.d.ts +2 -0
- package/types/poptip/index.d.cts +2 -0
- package/types/poptip/index.d.ts +2 -0
- package/types/popup/layers.d.cts +2 -0
- package/types/popup/layers.d.ts +2 -0
- package/types/qrcode/index.d.cts +2 -2
- package/types/qrcode/index.d.ts +2 -2
- package/types/radio/radio-button.d.cts +2 -2
- package/types/radio/radio-button.d.ts +2 -2
- package/types/radio/radio-group.d.cts +2 -2
- package/types/radio/radio-group.d.ts +2 -2
- package/types/radio/radio.d.cts +2 -2
- package/types/radio/radio.d.ts +2 -2
- package/types/ripple/types.d.cts +18 -0
- package/types/ripple/types.d.ts +18 -0
- package/types/select/select.d.cts +2 -0
- package/types/select/select.d.ts +2 -0
- package/types/stat-card/stat-card.d.cts +3 -3
- package/types/stat-card/stat-card.d.ts +3 -3
- package/types/stat-card/utils/stat-item-key.d.cts +11 -0
- package/types/stat-card/utils/stat-item-key.d.ts +11 -0
- package/types/table/column-setting.d.cts +4 -4
- package/types/table/column-setting.d.ts +4 -4
- package/types/table/index.d.cts +2 -2
- package/types/table/index.d.ts +2 -2
- package/types/table/types.d.cts +21 -2
- package/types/table/types.d.ts +21 -2
- package/types/table/utils.d.cts +75 -0
- package/types/table/utils.d.ts +75 -0
- package/types/tag/index.d.cts +2 -2
- package/types/tag/index.d.ts +2 -2
- package/types/tooltip/index.d.cts +2 -0
- package/types/tooltip/index.d.ts +2 -0
- package/types/transfer/index.d.cts +3 -2
- package/types/transfer/index.d.ts +3 -2
- package/types/tree-select/index.d.cts +3 -1
- package/types/tree-select/index.d.ts +3 -1
- package/types/utils/checked.d.cts +1 -1
- package/types/utils/checked.d.ts +1 -1
- package/types/utils/color.d.cts +13 -0
- package/types/utils/color.d.ts +13 -0
- package/types/utils/css.d.cts +2 -0
- package/types/utils/css.d.ts +2 -0
- package/types/utils/focus.d.cts +5 -0
- package/types/utils/focus.d.ts +5 -0
- package/types/utils/overlay-order.d.cts +6 -0
- package/types/utils/overlay-order.d.ts +6 -0
- package/types/utils/overlay-stack.d.cts +13 -0
- package/types/utils/overlay-stack.d.ts +13 -0
- package/types/utils/promise.d.cts +5 -0
- package/types/utils/promise.d.ts +5 -0
- package/types/utils/react-node.d.cts +10 -0
- package/types/utils/react-node.d.ts +10 -0
package/es/date-picker/index.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* react-kui v3.
|
|
2
|
+
* react-kui v3.2.0
|
|
3
3
|
* Copyright 2017-present, kui-react.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Homepage: https://react.k-ui.cn
|
|
6
6
|
* Author: Qiu / https://chuchur.com
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import
|
|
10
|
-
import { ConfigContext } from "../config/config-context.js";
|
|
9
|
+
import { ConfigContext, DEFAULT_LOCALE } from "../config/config-context.js";
|
|
11
10
|
import Popup from "../popup/index.js";
|
|
12
|
-
import {
|
|
11
|
+
import { resolveTheme, useFormAppearance } from "../config/use-config-appearance.js";
|
|
13
12
|
import { ArrowRight, CalendarDays, ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight, CircleX, Clock } from "../node_modules/.pnpm/kui-icons@5.0.0/node_modules/kui-icons/dist/kui-icons.esm.js";
|
|
14
13
|
import Icon from "../icon/index.js";
|
|
15
14
|
import { useValue } from "../utils/use-value.js";
|
|
@@ -17,7 +16,7 @@ import Button from "../button/button.js";
|
|
|
17
16
|
import { createFormFieldComponent } from "../form/field-context.js";
|
|
18
17
|
import { c } from "react/compiler-runtime";
|
|
19
18
|
import clsx from "clsx";
|
|
20
|
-
import { useContext, useEffect, useRef, useState } from "react";
|
|
19
|
+
import { useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
21
20
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
22
21
|
import dayjs from "dayjs";
|
|
23
22
|
import customParseFormat from "dayjs/plugin/customParseFormat.js";
|
|
@@ -50,352 +49,114 @@ var parse = (value, format, valueType) => {
|
|
|
50
49
|
const result = valueType === "unix" ? dayjs.unix(Number(value)) : typeof value === "string" ? dayjs(value, format, true) : dayjs(value);
|
|
51
50
|
return result.isValid() ? result : null;
|
|
52
51
|
};
|
|
53
|
-
function DatePicker(
|
|
54
|
-
const
|
|
55
|
-
let className;
|
|
56
|
-
let disabled;
|
|
57
|
-
let endDate;
|
|
58
|
-
let footer;
|
|
59
|
-
let format;
|
|
60
|
-
let header;
|
|
61
|
-
let onChange;
|
|
62
|
-
let onClear;
|
|
63
|
-
let onEndDateChange;
|
|
64
|
-
let onOpenChange;
|
|
65
|
-
let onStartDateChange;
|
|
66
|
-
let open;
|
|
67
|
-
let presets;
|
|
68
|
-
let readOnly;
|
|
69
|
-
let rest;
|
|
70
|
-
let shapeProp;
|
|
71
|
-
let sizeProp;
|
|
72
|
-
let startDate;
|
|
73
|
-
let style;
|
|
74
|
-
let t1;
|
|
75
|
-
let t10;
|
|
76
|
-
let t11;
|
|
77
|
-
let t2;
|
|
78
|
-
let t3;
|
|
79
|
-
let t4;
|
|
80
|
-
let t5;
|
|
81
|
-
let t6;
|
|
82
|
-
let t7;
|
|
83
|
-
let t8;
|
|
84
|
-
let t9;
|
|
85
|
-
let themeProp;
|
|
86
|
-
let value;
|
|
87
|
-
if ($[0] !== t0) {
|
|
88
|
-
({value, startDate, endDate, valueType: t1, mode: t2, presets, disabled, readOnly, open, clearable: t3, editable: t4, placeholder: t5, format, disabledDate: t6, disabledTime: t7, size: sizeProp, dateIcon: t8, theme: themeProp, shape: shapeProp, bordered: t9, placement: t10, header, footer, onChange, onStartDateChange, onEndDateChange, onOpenChange, onClear, panelOnly: t11, className, style, ...rest} = t0);
|
|
89
|
-
$[0] = t0;
|
|
90
|
-
$[1] = className;
|
|
91
|
-
$[2] = disabled;
|
|
92
|
-
$[3] = endDate;
|
|
93
|
-
$[4] = footer;
|
|
94
|
-
$[5] = format;
|
|
95
|
-
$[6] = header;
|
|
96
|
-
$[7] = onChange;
|
|
97
|
-
$[8] = onClear;
|
|
98
|
-
$[9] = onEndDateChange;
|
|
99
|
-
$[10] = onOpenChange;
|
|
100
|
-
$[11] = onStartDateChange;
|
|
101
|
-
$[12] = open;
|
|
102
|
-
$[13] = presets;
|
|
103
|
-
$[14] = readOnly;
|
|
104
|
-
$[15] = rest;
|
|
105
|
-
$[16] = shapeProp;
|
|
106
|
-
$[17] = sizeProp;
|
|
107
|
-
$[18] = startDate;
|
|
108
|
-
$[19] = style;
|
|
109
|
-
$[20] = t1;
|
|
110
|
-
$[21] = t10;
|
|
111
|
-
$[22] = t11;
|
|
112
|
-
$[23] = t2;
|
|
113
|
-
$[24] = t3;
|
|
114
|
-
$[25] = t4;
|
|
115
|
-
$[26] = t5;
|
|
116
|
-
$[27] = t6;
|
|
117
|
-
$[28] = t7;
|
|
118
|
-
$[29] = t8;
|
|
119
|
-
$[30] = t9;
|
|
120
|
-
$[31] = themeProp;
|
|
121
|
-
$[32] = value;
|
|
122
|
-
} else {
|
|
123
|
-
className = $[1];
|
|
124
|
-
disabled = $[2];
|
|
125
|
-
endDate = $[3];
|
|
126
|
-
footer = $[4];
|
|
127
|
-
format = $[5];
|
|
128
|
-
header = $[6];
|
|
129
|
-
onChange = $[7];
|
|
130
|
-
onClear = $[8];
|
|
131
|
-
onEndDateChange = $[9];
|
|
132
|
-
onOpenChange = $[10];
|
|
133
|
-
onStartDateChange = $[11];
|
|
134
|
-
open = $[12];
|
|
135
|
-
presets = $[13];
|
|
136
|
-
readOnly = $[14];
|
|
137
|
-
rest = $[15];
|
|
138
|
-
shapeProp = $[16];
|
|
139
|
-
sizeProp = $[17];
|
|
140
|
-
startDate = $[18];
|
|
141
|
-
style = $[19];
|
|
142
|
-
t1 = $[20];
|
|
143
|
-
t10 = $[21];
|
|
144
|
-
t11 = $[22];
|
|
145
|
-
t2 = $[23];
|
|
146
|
-
t3 = $[24];
|
|
147
|
-
t4 = $[25];
|
|
148
|
-
t5 = $[26];
|
|
149
|
-
t6 = $[27];
|
|
150
|
-
t7 = $[28];
|
|
151
|
-
t8 = $[29];
|
|
152
|
-
t9 = $[30];
|
|
153
|
-
themeProp = $[31];
|
|
154
|
-
value = $[32];
|
|
155
|
-
}
|
|
156
|
-
const valueType = t1 === void 0 ? "string" : t1;
|
|
157
|
-
const mode = t2 === void 0 ? "date" : t2;
|
|
158
|
-
const clearable = t3 === void 0 ? true : t3;
|
|
159
|
-
const editable = t4 === void 0 ? true : t4;
|
|
160
|
-
const placeholder = t5 === void 0 ? "" : t5;
|
|
161
|
-
const disabledDate = t6 === void 0 ? _temp : t6;
|
|
162
|
-
const disabledTime = t7 === void 0 ? _temp2 : t7;
|
|
163
|
-
const dateIcon = t8 === void 0 ? CalendarDays : t8;
|
|
164
|
-
const bordered = t9 === void 0 ? true : t9;
|
|
165
|
-
const placement = t10 === void 0 ? "bottom-left" : t10;
|
|
166
|
-
const panelOnly = t11 === void 0 ? false : t11;
|
|
167
|
-
const inheritedAppearance = useConfigAppearance();
|
|
52
|
+
function DatePicker({ value, startDate, endDate, valueType = "string", mode = "date", presets, disabled, readOnly, open, clearable = true, editable = true, placeholder = "", format, disabledDate = () => false, disabledTime = () => false, size: sizeProp, dateIcon = CalendarDays, theme: themeProp, shape: shapeProp, bordered = true, placement = "bottom-left", destroyOnClose = true, header, footer, onChange, onStartDateChange, onEndDateChange, onOpenChange, onClear, panelOnly = false, className, style, ...rest }) {
|
|
53
|
+
const inheritedAppearance = useFormAppearance();
|
|
168
54
|
const size = sizeProp ?? inheritedAppearance.size;
|
|
169
|
-
const theme = themeProp ?? inheritedAppearance.theme
|
|
55
|
+
const theme = resolveTheme(themeProp ?? inheritedAppearance.theme, "fill");
|
|
170
56
|
const shape = shapeProp ?? inheritedAppearance.shape;
|
|
171
|
-
const locale = useContext(ConfigContext)?.locale ||
|
|
172
|
-
const localeName = locale?.name || "
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
t12 = format || defaultFormat(mode);
|
|
176
|
-
$[33] = format;
|
|
177
|
-
$[34] = mode;
|
|
178
|
-
$[35] = t12;
|
|
179
|
-
} else t12 = $[35];
|
|
180
|
-
const fmt = t12;
|
|
181
|
-
let t13;
|
|
182
|
-
if ($[36] !== mode) {
|
|
183
|
-
t13 = mode.endsWith("Range");
|
|
184
|
-
$[36] = mode;
|
|
185
|
-
$[37] = t13;
|
|
186
|
-
} else t13 = $[37];
|
|
187
|
-
const isRange = t13;
|
|
57
|
+
const locale = useContext(ConfigContext)?.locale || DEFAULT_LOCALE;
|
|
58
|
+
const localeName = locale?.name || "en";
|
|
59
|
+
const fmt = format || defaultFormat(mode);
|
|
60
|
+
const isRange = mode.endsWith("Range");
|
|
188
61
|
const hasTime = mode === "time" || mode.includes("Time");
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
$[43] = source;
|
|
203
|
-
$[44] = t15;
|
|
204
|
-
} else t15 = $[44];
|
|
205
|
-
let t16;
|
|
206
|
-
if ($[45] !== fmt || $[46] !== t15 || $[47] !== valueType) {
|
|
207
|
-
let t17;
|
|
208
|
-
if ($[49] !== fmt || $[50] !== valueType) {
|
|
209
|
-
t17 = (item) => parse(item, fmt, valueType);
|
|
210
|
-
$[49] = fmt;
|
|
211
|
-
$[50] = valueType;
|
|
212
|
-
$[51] = t17;
|
|
213
|
-
} else t17 = $[51];
|
|
214
|
-
t16 = t15.map(t17);
|
|
215
|
-
$[45] = fmt;
|
|
216
|
-
$[46] = t15;
|
|
217
|
-
$[47] = valueType;
|
|
218
|
-
$[48] = t16;
|
|
219
|
-
} else t16 = $[48];
|
|
220
|
-
const parsedSource = t16;
|
|
221
|
-
let t17;
|
|
222
|
-
if ($[52] !== isRange || $[53] !== parsedSource) {
|
|
223
|
-
t17 = isRange && parsedSource.some(_temp3) ? [] : parsedSource.filter(_temp4);
|
|
224
|
-
$[52] = isRange;
|
|
225
|
-
$[53] = parsedSource;
|
|
226
|
-
$[54] = t17;
|
|
227
|
-
} else t17 = $[54];
|
|
228
|
-
const initial = t17;
|
|
229
|
-
const [inner, setInner] = useValue(initial, _temp5);
|
|
62
|
+
const parsedSource = useMemo(() => {
|
|
63
|
+
const source = value !== void 0 ? value : isRange ? [startDate, endDate] : null;
|
|
64
|
+
return (Array.isArray(source) ? source : source == null ? [] : [source]).map((item) => parse(item, fmt, valueType));
|
|
65
|
+
}, [
|
|
66
|
+
value,
|
|
67
|
+
startDate,
|
|
68
|
+
endDate,
|
|
69
|
+
isRange,
|
|
70
|
+
fmt,
|
|
71
|
+
valueType
|
|
72
|
+
]);
|
|
73
|
+
const initial = useMemo(() => isRange ? [parsedSource[0] ?? null, parsedSource[1] ?? null] : parsedSource.filter((item_0) => !!item_0), [isRange, parsedSource]);
|
|
74
|
+
const [inner, setInner] = useValue(initial, (next) => next);
|
|
230
75
|
const rangeControlled = value === void 0 && (startDate !== void 0 || endDate !== void 0);
|
|
231
76
|
const values = rangeControlled ? initial : inner;
|
|
232
|
-
const [visibleState, setVisibleState] = useValue(open,
|
|
77
|
+
const [visibleState, setVisibleState] = useValue(open, (next_0) => next_0 ?? false);
|
|
233
78
|
const visible = panelOnly || visibleState;
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
} else t18 = $[56];
|
|
240
|
-
const syncSignature = `${fmt}:${t18}`;
|
|
241
|
-
let t19;
|
|
242
|
-
if ($[57] !== initial[0]) {
|
|
243
|
-
t19 = initial[0] ?? dayjs();
|
|
244
|
-
$[57] = initial[0];
|
|
245
|
-
$[58] = t19;
|
|
246
|
-
} else t19 = $[58];
|
|
247
|
-
let t20;
|
|
248
|
-
if ($[59] !== syncSignature || $[60] !== t19) {
|
|
249
|
-
t20 = {
|
|
250
|
-
signature: syncSignature,
|
|
251
|
-
value: t19
|
|
252
|
-
};
|
|
253
|
-
$[59] = syncSignature;
|
|
254
|
-
$[60] = t19;
|
|
255
|
-
$[61] = t20;
|
|
256
|
-
} else t20 = $[61];
|
|
257
|
-
const [panelState, setPanelState] = useState(t20);
|
|
79
|
+
const syncSignature = `${fmt}:${parsedSource.map((item_1) => item_1?.valueOf() ?? "null").join(",")}`;
|
|
80
|
+
const [panelState, setPanelState] = useState({
|
|
81
|
+
signature: syncSignature,
|
|
82
|
+
value: initial[0] ?? dayjs()
|
|
83
|
+
});
|
|
258
84
|
const panelDate = panelState.signature === syncSignature ? panelState.value : values[0] ?? panelState.value;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
$[62] = syncSignature;
|
|
271
|
-
$[63] = values;
|
|
272
|
-
$[64] = t21;
|
|
273
|
-
} else t21 = $[64];
|
|
274
|
-
const setPanelDate = t21;
|
|
85
|
+
const setPanelDate = (action) => {
|
|
86
|
+
setPanelState((previous) => {
|
|
87
|
+
const current = previous.signature === syncSignature ? previous.value : values[0] ?? previous.value;
|
|
88
|
+
return {
|
|
89
|
+
signature: syncSignature,
|
|
90
|
+
value: typeof action === "function" ? action(current) : action
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
};
|
|
275
94
|
const [view, setView] = useState(mode === "year" ? "year" : mode === "month" ? "month" : mode === "time" ? "time" : "date");
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
value: initial
|
|
281
|
-
};
|
|
282
|
-
$[65] = initial;
|
|
283
|
-
$[66] = syncSignature;
|
|
284
|
-
$[67] = t22;
|
|
285
|
-
} else t22 = $[67];
|
|
286
|
-
const [draftState, setDraftState] = useState(t22);
|
|
95
|
+
const [draftState, setDraftState] = useState({
|
|
96
|
+
signature: syncSignature,
|
|
97
|
+
value: initial
|
|
98
|
+
});
|
|
287
99
|
const draft = draftState.signature === syncSignature ? draftState.value : values;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
value: next_1
|
|
293
|
-
});
|
|
294
|
-
$[68] = syncSignature;
|
|
295
|
-
$[69] = t23;
|
|
296
|
-
} else t23 = $[69];
|
|
297
|
-
const setDraft = t23;
|
|
100
|
+
const setDraft = useCallback((next_1) => setDraftState({
|
|
101
|
+
signature: syncSignature,
|
|
102
|
+
value: next_1
|
|
103
|
+
}), [syncSignature]);
|
|
298
104
|
const [hoverDate, setHoverDate] = useState(null);
|
|
299
105
|
const [timeEditSide, setTimeEditSide] = useState("start");
|
|
300
|
-
|
|
301
|
-
if ($[70] !== fmt) {
|
|
302
|
-
t24 = (item_3) => item_3?.format(fmt) ?? "";
|
|
303
|
-
$[70] = fmt;
|
|
304
|
-
$[71] = t24;
|
|
305
|
-
} else t24 = $[71];
|
|
306
|
-
const formattedValues = (isRange ? parsedSource : values).map(t24);
|
|
106
|
+
const formattedValues = values.map((item_2) => item_2?.format(fmt) ?? "");
|
|
307
107
|
const [textState, setTextState] = useState({
|
|
308
108
|
signature: syncSignature,
|
|
309
109
|
value: formattedValues
|
|
310
110
|
});
|
|
311
111
|
const texts = textState.signature === syncSignature ? textState.value : formattedValues;
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
value: next_2
|
|
317
|
-
});
|
|
318
|
-
$[72] = syncSignature;
|
|
319
|
-
$[73] = t25;
|
|
320
|
-
} else t25 = $[73];
|
|
321
|
-
const setTexts = t25;
|
|
112
|
+
const setTexts = useCallback((next_2) => setTextState({
|
|
113
|
+
signature: syncSignature,
|
|
114
|
+
value: next_2
|
|
115
|
+
}), [syncSignature]);
|
|
322
116
|
const rootRef = useRef(null);
|
|
323
117
|
const overlayRef = useRef(null);
|
|
324
118
|
const timeColRefs = useRef({});
|
|
325
119
|
const draftRef = useRef(draft);
|
|
326
120
|
const panelDateRef = useRef(panelDate);
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
};
|
|
351
|
-
$[78] = onOpenChange;
|
|
352
|
-
$[79] = panelOnly;
|
|
353
|
-
$[80] = setVisibleState;
|
|
354
|
-
$[81] = t28;
|
|
355
|
-
} else t28 = $[81];
|
|
356
|
-
const setOpen = t28;
|
|
357
|
-
let t29;
|
|
358
|
-
if ($[82] !== draft || $[83] !== fmt || $[84] !== isRange || $[85] !== setDraft || $[86] !== setOpen || $[87] !== setTexts || $[88] !== values) {
|
|
359
|
-
t29 = () => {
|
|
360
|
-
if (isRange && draft.length === 1) {
|
|
361
|
-
setDraft(values);
|
|
362
|
-
setTexts(values.map((item_4) => item_4.format(fmt)));
|
|
363
|
-
}
|
|
364
|
-
setOpen(false);
|
|
365
|
-
};
|
|
366
|
-
$[82] = draft;
|
|
367
|
-
$[83] = fmt;
|
|
368
|
-
$[84] = isRange;
|
|
369
|
-
$[85] = setDraft;
|
|
370
|
-
$[86] = setOpen;
|
|
371
|
-
$[87] = setTexts;
|
|
372
|
-
$[88] = values;
|
|
373
|
-
$[89] = t29;
|
|
374
|
-
} else t29 = $[89];
|
|
375
|
-
const closePopup = t29;
|
|
376
|
-
let t30;
|
|
377
|
-
if ($[90] !== fmt || $[91] !== valueType) {
|
|
378
|
-
t30 = (item_5) => valueType === "date" ? item_5.toDate() : valueType === "timestamp" ? item_5.valueOf() : valueType === "unix" ? item_5.unix() : item_5.format(fmt);
|
|
379
|
-
$[90] = fmt;
|
|
380
|
-
$[91] = valueType;
|
|
381
|
-
$[92] = t30;
|
|
382
|
-
} else t30 = $[92];
|
|
383
|
-
const output = t30;
|
|
384
|
-
const isValueDisabled = (item_6) => disabledDate(item_6.toDate()) || hasTime && disabledTime(item_6.toDate());
|
|
385
|
-
const commit = (next_4, t31) => {
|
|
386
|
-
const closePanel = t31 === void 0 ? false : t31;
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
draftRef.current = draft;
|
|
123
|
+
panelDateRef.current = panelDate;
|
|
124
|
+
}, [draft, panelDate]);
|
|
125
|
+
const setOpen = useCallback((next_3) => {
|
|
126
|
+
if (panelOnly) return;
|
|
127
|
+
setVisibleState(next_3);
|
|
128
|
+
onOpenChange?.(next_3);
|
|
129
|
+
}, [
|
|
130
|
+
onOpenChange,
|
|
131
|
+
setVisibleState,
|
|
132
|
+
panelOnly
|
|
133
|
+
]);
|
|
134
|
+
const closePopup = () => {
|
|
135
|
+
if (isRange && !(draft[0] && draft[1])) {
|
|
136
|
+
setDraft(values);
|
|
137
|
+
setTexts(formattedValues);
|
|
138
|
+
}
|
|
139
|
+
setOpen(false);
|
|
140
|
+
};
|
|
141
|
+
const output = (item_3) => valueType === "date" ? item_3.toDate() : valueType === "timestamp" ? item_3.valueOf() : valueType === "unix" ? item_3.unix() : item_3.format(fmt);
|
|
142
|
+
const isValueDisabled = (item_4) => disabledDate(item_4.toDate()) || hasTime && disabledTime(item_4.toDate());
|
|
143
|
+
const commit = (next_4, closePanel = false) => {
|
|
387
144
|
if (disabled || readOnly) return;
|
|
388
145
|
if (next_4.some(isValueDisabled)) return;
|
|
389
146
|
if (isRange && next_4.length === 2 && next_4[1].isBefore(next_4[0])) next_4 = [next_4[1], next_4[0]];
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
147
|
+
const pair = isRange ? [next_4[0] ?? null, next_4[1] ?? null] : next_4;
|
|
148
|
+
const unchanged = next_4.map((item_5) => item_5.format(fmt)).join("\0") === values.map((item_6) => item_6?.format(fmt) ?? "").join("\0");
|
|
149
|
+
if (!rangeControlled) setInner(pair);
|
|
150
|
+
setDraft(rangeControlled ? values : pair);
|
|
151
|
+
setTexts(rangeControlled ? formattedValues : pair.map((item_7) => item_7?.format(fmt) ?? ""));
|
|
152
|
+
if (!unchanged) {
|
|
153
|
+
const result = next_4.map(output);
|
|
154
|
+
const strings = next_4.map((item_8) => item_8.format(fmt));
|
|
155
|
+
onChange?.(isRange ? result : result[0] ?? null, isRange ? strings : strings[0] ?? "");
|
|
156
|
+
if (isRange) {
|
|
157
|
+
onStartDateChange?.(result[0] ?? null);
|
|
158
|
+
onEndDateChange?.(result[1] ?? null);
|
|
159
|
+
}
|
|
399
160
|
}
|
|
400
161
|
if (closePanel) setOpen(false);
|
|
401
162
|
};
|
|
@@ -403,22 +164,25 @@ function DatePicker(t0) {
|
|
|
403
164
|
if (disabled || readOnly) return;
|
|
404
165
|
if (disabledDate(date.toDate()) || hasTime && disabledTime(date.toDate())) return;
|
|
405
166
|
if (isRange) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
commit([start_0, end], mode !== "dateTimeRange");
|
|
167
|
+
const [start, end] = draft;
|
|
168
|
+
const fill = start && !end ? "end" : !start && end ? "start" : null;
|
|
169
|
+
if (!fill) {
|
|
170
|
+
const s = date.startOf("day");
|
|
171
|
+
setDraft([s, null]);
|
|
172
|
+
setTexts([s.format(fmt), ""]);
|
|
173
|
+
return;
|
|
414
174
|
}
|
|
175
|
+
const kept = fill === "end" ? start : end;
|
|
176
|
+
const before = date.isBefore(kept);
|
|
177
|
+
const pair_0 = fill === "end" ? before ? [date.startOf("day"), kept.endOf("day")] : [kept, date.endOf("day")] : before ? [date.startOf("day"), kept] : [kept.startOf("day"), date.endOf("day")];
|
|
178
|
+
commit(pair_0, mode !== "dateTimeRange");
|
|
415
179
|
} else if (mode === "dateTime") {
|
|
416
180
|
const old = draft[0] ?? dayjs();
|
|
417
181
|
commit([date.hour(old.hour()).minute(old.minute()).second(old.second())]);
|
|
418
182
|
} else commit([date], true);
|
|
419
183
|
};
|
|
420
184
|
const emitExternal = (next_5) => {
|
|
421
|
-
const list = (Array.isArray(next_5) ? next_5 : [next_5]).map((item_9) => parse(item_9, fmt, valueType)).filter(
|
|
185
|
+
const list = (Array.isArray(next_5) ? next_5 : [next_5]).map((item_9) => parse(item_9, fmt, valueType)).filter((item_10) => !!item_10);
|
|
422
186
|
if (list.length) commit(list, true);
|
|
423
187
|
};
|
|
424
188
|
const clear = (event) => {
|
|
@@ -453,235 +217,191 @@ function DatePicker(t0) {
|
|
|
453
217
|
const next_7 = texts.map((text_0, position) => position === index_0 ? parsed_0 : parse(text_0, fmt, valueType));
|
|
454
218
|
if (next_7[0] && next_7[1]) commit(next_7);
|
|
455
219
|
};
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
let t33;
|
|
464
|
-
if ($[95] !== localeInfo) {
|
|
465
|
-
t33 = localeInfo.monthsShort();
|
|
466
|
-
$[95] = localeInfo;
|
|
467
|
-
$[96] = t33;
|
|
468
|
-
} else t33 = $[96];
|
|
469
|
-
const months = t33;
|
|
470
|
-
let t34;
|
|
471
|
-
if ($[97] !== localeName) {
|
|
472
|
-
t34 = [
|
|
473
|
-
"zh",
|
|
474
|
-
"ja",
|
|
475
|
-
"ko"
|
|
476
|
-
].some((name) => localeName.toLowerCase().includes(name));
|
|
477
|
-
$[97] = localeName;
|
|
478
|
-
$[98] = t34;
|
|
479
|
-
} else t34 = $[98];
|
|
480
|
-
const isYearFirst = t34;
|
|
220
|
+
const localeInfo = useMemo(() => dayjs().locale(localeName).localeData(), [localeName]);
|
|
221
|
+
const months = useMemo(() => localeInfo.monthsShort(), [localeInfo]);
|
|
222
|
+
const isYearFirst = [
|
|
223
|
+
"zh",
|
|
224
|
+
"ja",
|
|
225
|
+
"ko"
|
|
226
|
+
].some((name) => localeName.toLowerCase().includes(name));
|
|
481
227
|
const yearStart = Math.floor(panelDate.year() / 10) * 10 - 1;
|
|
482
|
-
const
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
});
|
|
543
|
-
$[114] = isYearFirst;
|
|
544
|
-
$[115] = locale.k.datePicker.year;
|
|
545
|
-
$[116] = panelDate;
|
|
546
|
-
$[117] = t40;
|
|
547
|
-
} else t40 = $[117];
|
|
548
|
-
let t41;
|
|
549
|
-
if ($[118] !== t38 || $[119] !== t39 || $[120] !== t40) {
|
|
550
|
-
t41 = /* @__PURE__ */ jsxs("span", {
|
|
551
|
-
className: "k-picker-header-label",
|
|
552
|
-
children: [
|
|
553
|
-
t38,
|
|
554
|
-
t39,
|
|
555
|
-
t40
|
|
556
|
-
]
|
|
557
|
-
});
|
|
558
|
-
$[118] = t38;
|
|
559
|
-
$[119] = t39;
|
|
560
|
-
$[120] = t40;
|
|
561
|
-
$[121] = t41;
|
|
562
|
-
} else t41 = $[121];
|
|
563
|
-
let t42;
|
|
564
|
-
if ($[122] !== mode || $[123] !== nav) {
|
|
565
|
-
t42 = mode !== "year" && /* @__PURE__ */ jsx(Button, {
|
|
566
|
-
icon: ChevronRight,
|
|
567
|
-
type: "text",
|
|
568
|
-
onClick: () => nav(1, "month")
|
|
569
|
-
});
|
|
570
|
-
$[122] = mode;
|
|
571
|
-
$[123] = nav;
|
|
572
|
-
$[124] = t42;
|
|
573
|
-
} else t42 = $[124];
|
|
574
|
-
let t43;
|
|
575
|
-
if ($[125] !== nav) {
|
|
576
|
-
t43 = /* @__PURE__ */ jsx(Button, {
|
|
577
|
-
icon: ChevronsRight,
|
|
578
|
-
type: "text",
|
|
579
|
-
onClick: () => nav(10, "year")
|
|
580
|
-
});
|
|
581
|
-
$[125] = nav;
|
|
582
|
-
$[126] = t43;
|
|
583
|
-
} else t43 = $[126];
|
|
584
|
-
let t44;
|
|
585
|
-
if ($[127] !== t36 || $[128] !== t37 || $[129] !== t41 || $[130] !== t42 || $[131] !== t43) {
|
|
586
|
-
t44 = /* @__PURE__ */ jsxs("div", {
|
|
587
|
-
className: "k-picker-header",
|
|
588
|
-
children: [
|
|
589
|
-
t36,
|
|
590
|
-
t37,
|
|
591
|
-
t41,
|
|
592
|
-
t42,
|
|
593
|
-
t43
|
|
594
|
-
]
|
|
595
|
-
});
|
|
596
|
-
$[127] = t36;
|
|
597
|
-
$[128] = t37;
|
|
598
|
-
$[129] = t41;
|
|
599
|
-
$[130] = t42;
|
|
600
|
-
$[131] = t43;
|
|
601
|
-
$[132] = t44;
|
|
602
|
-
} else t44 = $[132];
|
|
603
|
-
const headerNode = t44;
|
|
228
|
+
const calendar = useMemo(() => {
|
|
229
|
+
const startOfMonth = panelDate.startOf("month");
|
|
230
|
+
const diff = (startOfMonth.day() - localeInfo.firstDayOfWeek() + 7) % 7;
|
|
231
|
+
const start_0 = startOfMonth.subtract(diff, "day");
|
|
232
|
+
return Array.from({ length: 42 }, (_, index_1) => start_0.add(index_1, "day"));
|
|
233
|
+
}, [panelDate, localeInfo]);
|
|
234
|
+
const nav = (amount, unit) => setPanelDate((current_0) => current_0.add(amount, unit));
|
|
235
|
+
const switchLabel = (target, label, className_0) => /* @__PURE__ */ jsx("span", {
|
|
236
|
+
className: className_0,
|
|
237
|
+
role: "button",
|
|
238
|
+
tabIndex: 0,
|
|
239
|
+
onClick: () => setView(target),
|
|
240
|
+
onKeyDown: (event_0) => {
|
|
241
|
+
if (event_0.key === "Enter" || event_0.key === " ") {
|
|
242
|
+
event_0.preventDefault();
|
|
243
|
+
setView(target);
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
children: label
|
|
247
|
+
});
|
|
248
|
+
const headerNode = /* @__PURE__ */ jsxs("div", {
|
|
249
|
+
className: "k-picker-header",
|
|
250
|
+
children: [
|
|
251
|
+
/* @__PURE__ */ jsx(Button, {
|
|
252
|
+
icon: ChevronsLeft,
|
|
253
|
+
type: "text",
|
|
254
|
+
onClick: () => nav(-10, "year")
|
|
255
|
+
}),
|
|
256
|
+
mode !== "year" && /* @__PURE__ */ jsx(Button, {
|
|
257
|
+
icon: ChevronLeft,
|
|
258
|
+
type: "text",
|
|
259
|
+
onClick: () => nav(-1, "month")
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsxs("span", {
|
|
262
|
+
className: "k-picker-header-label",
|
|
263
|
+
children: [
|
|
264
|
+
isYearFirst && switchLabel("year", /* @__PURE__ */ jsxs(Fragment$1, { children: [panelDate.year(), locale?.k?.datePicker?.year] })),
|
|
265
|
+
mode !== "year" && switchLabel("month", panelDate.locale(localeName).format("MMM"), "k-picker-header-month-btn"),
|
|
266
|
+
!isYearFirst && switchLabel("year", /* @__PURE__ */ jsxs(Fragment$1, { children: [panelDate.year(), locale?.k?.datePicker?.year] }))
|
|
267
|
+
]
|
|
268
|
+
}),
|
|
269
|
+
mode !== "year" && /* @__PURE__ */ jsx(Button, {
|
|
270
|
+
icon: ChevronRight,
|
|
271
|
+
type: "text",
|
|
272
|
+
onClick: () => nav(1, "month")
|
|
273
|
+
}),
|
|
274
|
+
/* @__PURE__ */ jsx(Button, {
|
|
275
|
+
icon: ChevronsRight,
|
|
276
|
+
type: "text",
|
|
277
|
+
onClick: () => nav(10, "year")
|
|
278
|
+
})
|
|
279
|
+
]
|
|
280
|
+
});
|
|
281
|
+
const unitPick = (base, unit_0) => {
|
|
282
|
+
if (!disabledDate(base.toDate())) return base;
|
|
283
|
+
const first = base.startOf(unit_0).hour(base.hour()).minute(base.minute()).second(base.second());
|
|
284
|
+
const end_0 = base.endOf(unit_0);
|
|
285
|
+
for (let day = first; day.isBefore(end_0); day = day.add(1, "day")) if (!disabledDate(day.toDate())) return day;
|
|
286
|
+
return null;
|
|
287
|
+
};
|
|
604
288
|
const yearPanel = /* @__PURE__ */ jsx("div", {
|
|
605
289
|
className: "k-picker-body",
|
|
606
290
|
children: /* @__PURE__ */ jsx("div", {
|
|
607
291
|
className: "k-picker-year-body",
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
292
|
+
role: "grid",
|
|
293
|
+
children: Array.from({ length: 12 }, (__0, index_2) => yearStart + index_2).map((year) => {
|
|
294
|
+
const browsing = panelDate.year(year);
|
|
295
|
+
const selects = mode === "year";
|
|
296
|
+
const candidate = selects ? unitPick(browsing, "year") : browsing;
|
|
297
|
+
const off = selects && !candidate;
|
|
298
|
+
const selected = draft.some((item_11) => !!item_11 && item_11.year() === year);
|
|
299
|
+
const pick = () => {
|
|
300
|
+
if (off || !candidate) return;
|
|
301
|
+
setPanelDate(browsing);
|
|
302
|
+
if (selects) choose(candidate);
|
|
614
303
|
else setView("month");
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
|
|
304
|
+
};
|
|
305
|
+
return /* @__PURE__ */ jsx("div", {
|
|
306
|
+
className: clsx("k-picker-year-item", {
|
|
307
|
+
"k-picker-year-selected": selected,
|
|
308
|
+
"k-picker-year-disabled": off
|
|
309
|
+
}),
|
|
310
|
+
role: "gridcell",
|
|
311
|
+
tabIndex: off ? -1 : 0,
|
|
312
|
+
"aria-selected": selected || void 0,
|
|
313
|
+
"aria-disabled": off || void 0,
|
|
314
|
+
onClick: pick,
|
|
315
|
+
onKeyDown: (event_1) => {
|
|
316
|
+
if (!off && (event_1.key === "Enter" || event_1.key === " ")) {
|
|
317
|
+
event_1.preventDefault();
|
|
318
|
+
pick();
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
children: year
|
|
322
|
+
}, year);
|
|
323
|
+
})
|
|
618
324
|
})
|
|
619
325
|
});
|
|
620
326
|
const monthPanel = /* @__PURE__ */ jsx("div", {
|
|
621
327
|
className: "k-picker-body",
|
|
622
328
|
children: /* @__PURE__ */ jsx("div", {
|
|
623
329
|
className: "k-picker-month-body",
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
330
|
+
role: "grid",
|
|
331
|
+
children: months.map((label_0, month) => {
|
|
332
|
+
const browsing_0 = panelDate.month(month);
|
|
333
|
+
const selects_0 = mode === "month";
|
|
334
|
+
const candidate_0 = selects_0 ? unitPick(browsing_0, "month") : browsing_0;
|
|
335
|
+
const off_0 = selects_0 && !candidate_0;
|
|
336
|
+
const selected_0 = draft.some((item_12) => !!item_12 && item_12.year() === panelDate.year() && item_12.month() === month);
|
|
337
|
+
const pick_0 = () => {
|
|
338
|
+
if (off_0 || !candidate_0) return;
|
|
339
|
+
setPanelDate(browsing_0);
|
|
340
|
+
if (selects_0) choose(candidate_0);
|
|
630
341
|
else setView("date");
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
342
|
+
};
|
|
343
|
+
return /* @__PURE__ */ jsx("div", {
|
|
344
|
+
className: clsx("k-picker-month-item", {
|
|
345
|
+
"k-picker-month-selected": selected_0,
|
|
346
|
+
"k-picker-month-disabled": off_0
|
|
347
|
+
}),
|
|
348
|
+
role: "gridcell",
|
|
349
|
+
tabIndex: off_0 ? -1 : 0,
|
|
350
|
+
"aria-selected": selected_0 || void 0,
|
|
351
|
+
"aria-disabled": off_0 || void 0,
|
|
352
|
+
onClick: pick_0,
|
|
353
|
+
onKeyDown: (event_2) => {
|
|
354
|
+
if (!off_0 && (event_2.key === "Enter" || event_2.key === " ")) {
|
|
355
|
+
event_2.preventDefault();
|
|
356
|
+
pick_0();
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
children: label_0
|
|
360
|
+
}, label_0);
|
|
361
|
+
})
|
|
634
362
|
})
|
|
635
363
|
});
|
|
636
|
-
let t45;
|
|
637
|
-
if ($[133] !== localeInfo) {
|
|
638
|
-
t45 = /* @__PURE__ */ jsx("div", {
|
|
639
|
-
className: "k-picker-weekdays",
|
|
640
|
-
children: [...localeInfo.weekdaysMin().slice(localeInfo.firstDayOfWeek()), ...localeInfo.weekdaysMin().slice(0, localeInfo.firstDayOfWeek())].map(_temp9)
|
|
641
|
-
});
|
|
642
|
-
$[133] = localeInfo;
|
|
643
|
-
$[134] = t45;
|
|
644
|
-
} else t45 = $[134];
|
|
645
|
-
let t46;
|
|
646
|
-
if ($[135] === Symbol.for("react.memo_cache_sentinel")) {
|
|
647
|
-
t46 = () => setHoverDate(null);
|
|
648
|
-
$[135] = t46;
|
|
649
|
-
} else t46 = $[135];
|
|
650
364
|
const datePanel = /* @__PURE__ */ jsxs("div", {
|
|
651
365
|
className: "k-picker-body",
|
|
652
|
-
children: [
|
|
366
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
367
|
+
className: "k-picker-weekdays",
|
|
368
|
+
children: [...localeInfo.weekdaysMin().slice(localeInfo.firstDayOfWeek()), ...localeInfo.weekdaysMin().slice(0, localeInfo.firstDayOfWeek())].map((day_0) => /* @__PURE__ */ jsx("span", {
|
|
369
|
+
className: "k-picker-weekday",
|
|
370
|
+
children: day_0
|
|
371
|
+
}, day_0))
|
|
372
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
653
373
|
className: "k-picker-date-grid",
|
|
654
374
|
role: "grid",
|
|
655
|
-
onMouseLeave:
|
|
656
|
-
children: calendar.map((
|
|
657
|
-
const
|
|
375
|
+
onMouseLeave: () => setHoverDate(null),
|
|
376
|
+
children: calendar.map((date_0) => {
|
|
377
|
+
const selected_1 = draft.some((item_13) => !!item_13 && item_13.isSame(date_0, "day"));
|
|
658
378
|
const rangeEnd = draft[1] ?? hoverDate;
|
|
659
|
-
const inRange = !!(isRange && draft[0] && rangeEnd &&
|
|
660
|
-
const
|
|
379
|
+
const inRange = !!(isRange && draft[0] && rangeEnd && date_0.isBetween(draft[0].isBefore(rangeEnd) ? draft[0] : rangeEnd, draft[0].isBefore(rangeEnd) ? rangeEnd : draft[0], "day", "[]"));
|
|
380
|
+
const off_1 = disabledDate(date_0.toDate());
|
|
661
381
|
return /* @__PURE__ */ jsx("div", {
|
|
662
382
|
className: clsx("k-picker-day", {
|
|
663
|
-
"k-picker-day-out": !
|
|
664
|
-
"k-picker-is-today":
|
|
665
|
-
"k-picker-day-selected":
|
|
666
|
-
"k-picker-day-in": inRange && !
|
|
667
|
-
"k-picker-range-start": draft[0]?.isSame(
|
|
668
|
-
"k-picker-range-end": draft[1]?.isSame(
|
|
669
|
-
"k-picker-day-disabled":
|
|
383
|
+
"k-picker-day-out": !date_0.isSame(panelDate, "month"),
|
|
384
|
+
"k-picker-is-today": date_0.isSame(dayjs(), "day"),
|
|
385
|
+
"k-picker-day-selected": selected_1,
|
|
386
|
+
"k-picker-day-in": inRange && !selected_1,
|
|
387
|
+
"k-picker-range-start": draft[0]?.isSame(date_0, "day"),
|
|
388
|
+
"k-picker-range-end": draft[1]?.isSame(date_0, "day"),
|
|
389
|
+
"k-picker-day-disabled": off_1
|
|
670
390
|
}),
|
|
671
391
|
role: "gridcell",
|
|
672
|
-
tabIndex:
|
|
673
|
-
"aria-selected":
|
|
674
|
-
"aria-disabled":
|
|
675
|
-
onClick: () => choose(
|
|
676
|
-
onKeyDown: (
|
|
677
|
-
if (!
|
|
678
|
-
|
|
679
|
-
choose(
|
|
392
|
+
tabIndex: off_1 ? -1 : 0,
|
|
393
|
+
"aria-selected": selected_1 || void 0,
|
|
394
|
+
"aria-disabled": off_1 || void 0,
|
|
395
|
+
onClick: () => choose(date_0.hour(panelDate.hour()).minute(panelDate.minute()).second(panelDate.second())),
|
|
396
|
+
onKeyDown: (event_3) => {
|
|
397
|
+
if (!off_1 && (event_3.key === "Enter" || event_3.key === " ")) {
|
|
398
|
+
event_3.preventDefault();
|
|
399
|
+
choose(date_0.hour(panelDate.hour()).minute(panelDate.minute()).second(panelDate.second()));
|
|
680
400
|
}
|
|
681
401
|
},
|
|
682
|
-
onMouseEnter: () => isRange && setHoverDate(
|
|
683
|
-
children:
|
|
684
|
-
},
|
|
402
|
+
onMouseEnter: () => isRange && setHoverDate(date_0),
|
|
403
|
+
children: date_0.date()
|
|
404
|
+
}, date_0.format("YYYY-MM-DD"));
|
|
685
405
|
})
|
|
686
406
|
})]
|
|
687
407
|
});
|
|
@@ -691,52 +411,41 @@ function DatePicker(t0) {
|
|
|
691
411
|
"hour",
|
|
692
412
|
"minute",
|
|
693
413
|
"second"
|
|
694
|
-
].map((
|
|
695
|
-
const max =
|
|
414
|
+
].map((unit_1) => {
|
|
415
|
+
const max = unit_1 === "hour" ? 24 : 60;
|
|
696
416
|
const rangeIndex = timeEditSide === "start" ? 0 : 1;
|
|
697
417
|
const active = (mode === "dateTimeRange" ? draft[rangeIndex] : draft[0]) ?? panelDate;
|
|
698
|
-
const
|
|
418
|
+
const selected_2 = active[unit_1]();
|
|
699
419
|
return /* @__PURE__ */ jsx("ul", {
|
|
700
420
|
className: "k-picker-time-col",
|
|
701
421
|
ref: (node) => {
|
|
702
|
-
timeColRefs.current[
|
|
422
|
+
timeColRefs.current[unit_1] = node;
|
|
703
423
|
},
|
|
704
424
|
children: Array.from({ length: max }, (__1, number) => {
|
|
705
|
-
const
|
|
425
|
+
const candidate_1 = active.set(unit_1, number);
|
|
706
426
|
return /* @__PURE__ */ jsx("li", {
|
|
707
427
|
className: clsx("k-picker-time-item", {
|
|
708
|
-
active: number ===
|
|
709
|
-
"k-picker-time-disabled": disabledTime(
|
|
428
|
+
active: number === selected_2,
|
|
429
|
+
"k-picker-time-disabled": disabledTime(candidate_1.toDate())
|
|
710
430
|
}),
|
|
711
431
|
onClick: () => {
|
|
712
|
-
if (readOnly || disabledTime(
|
|
432
|
+
if (readOnly || disabledTime(candidate_1.toDate())) return;
|
|
713
433
|
const next_8 = draft.slice();
|
|
714
|
-
if (mode === "dateTimeRange") next_8[rangeIndex] =
|
|
715
|
-
else next_8[0] =
|
|
716
|
-
setPanelDate(
|
|
717
|
-
|
|
718
|
-
|
|
434
|
+
if (mode === "dateTimeRange") next_8[rangeIndex] = candidate_1;
|
|
435
|
+
else next_8[0] = candidate_1;
|
|
436
|
+
setPanelDate(candidate_1);
|
|
437
|
+
if (isRange && !(next_8[0] && next_8[1])) {
|
|
438
|
+
setDraft(next_8);
|
|
439
|
+
setTexts(next_8.map((item_14) => item_14?.format(fmt) ?? ""));
|
|
440
|
+
} else commit(next_8);
|
|
441
|
+
centerTimeItem(timeColRefs.current[unit_1], number, "smooth");
|
|
719
442
|
},
|
|
720
443
|
children: String(number).padStart(2, "0")
|
|
721
444
|
}, number);
|
|
722
445
|
})
|
|
723
|
-
},
|
|
446
|
+
}, unit_1);
|
|
724
447
|
})
|
|
725
448
|
});
|
|
726
|
-
let t47;
|
|
727
|
-
if ($[136] !== mode || $[137] !== timeEditSide || $[138] !== view || $[139] !== visible) {
|
|
728
|
-
t47 = [
|
|
729
|
-
visible,
|
|
730
|
-
view,
|
|
731
|
-
timeEditSide,
|
|
732
|
-
mode
|
|
733
|
-
];
|
|
734
|
-
$[136] = mode;
|
|
735
|
-
$[137] = timeEditSide;
|
|
736
|
-
$[138] = view;
|
|
737
|
-
$[139] = visible;
|
|
738
|
-
$[140] = t47;
|
|
739
|
-
} else t47 = $[140];
|
|
740
449
|
useEffect(() => {
|
|
741
450
|
if (!visible || view !== "time") return;
|
|
742
451
|
const index_3 = mode === "dateTimeRange" && timeEditSide === "end" ? 1 : 0;
|
|
@@ -746,50 +455,19 @@ function DatePicker(t0) {
|
|
|
746
455
|
"hour",
|
|
747
456
|
"minute",
|
|
748
457
|
"second"
|
|
749
|
-
].forEach((
|
|
750
|
-
centerTimeItem(timeColRefs.current[
|
|
458
|
+
].forEach((unit_2) => {
|
|
459
|
+
centerTimeItem(timeColRefs.current[unit_2], active_0[unit_2]());
|
|
751
460
|
});
|
|
752
461
|
});
|
|
753
462
|
return () => cancelAnimationFrame(frame);
|
|
754
|
-
},
|
|
463
|
+
}, [
|
|
464
|
+
visible,
|
|
465
|
+
view,
|
|
466
|
+
timeEditSide,
|
|
467
|
+
mode
|
|
468
|
+
]);
|
|
755
469
|
const panel = view === "year" ? yearPanel : view === "month" ? monthPanel : view === "time" ? timePanel : datePanel;
|
|
756
470
|
const extra = (content) => typeof content === "function" ? content({ emit: emitExternal }) : content;
|
|
757
|
-
let t48;
|
|
758
|
-
if ($[141] !== mode || $[142] !== placement) {
|
|
759
|
-
t48 = {
|
|
760
|
-
mode,
|
|
761
|
-
"k-placement": placement
|
|
762
|
-
};
|
|
763
|
-
$[141] = mode;
|
|
764
|
-
$[142] = placement;
|
|
765
|
-
$[143] = t48;
|
|
766
|
-
} else t48 = $[143];
|
|
767
|
-
let t49;
|
|
768
|
-
let t50;
|
|
769
|
-
if ($[144] !== disabled) {
|
|
770
|
-
t49 = (event_1) => {
|
|
771
|
-
if (!disabled) return;
|
|
772
|
-
event_1.preventDefault();
|
|
773
|
-
event_1.stopPropagation();
|
|
774
|
-
};
|
|
775
|
-
t50 = (event_2) => {
|
|
776
|
-
if (!disabled) return;
|
|
777
|
-
event_2.preventDefault();
|
|
778
|
-
event_2.stopPropagation();
|
|
779
|
-
};
|
|
780
|
-
$[144] = disabled;
|
|
781
|
-
$[145] = t49;
|
|
782
|
-
$[146] = t50;
|
|
783
|
-
} else {
|
|
784
|
-
t49 = $[145];
|
|
785
|
-
t50 = $[146];
|
|
786
|
-
}
|
|
787
|
-
let t51;
|
|
788
|
-
if ($[147] !== panelOnly) {
|
|
789
|
-
t51 = panelOnly ? void 0 : { zIndex: 1050 };
|
|
790
|
-
$[147] = panelOnly;
|
|
791
|
-
$[148] = t51;
|
|
792
|
-
} else t51 = $[148];
|
|
793
471
|
const overlayContent = /* @__PURE__ */ jsxs("div", {
|
|
794
472
|
ref: overlayRef,
|
|
795
473
|
className: clsx("k-datepicker-overlay", {
|
|
@@ -798,12 +476,21 @@ function DatePicker(t0) {
|
|
|
798
476
|
"k-datepicker-panel": panelOnly,
|
|
799
477
|
"k-datepicker-disabled": disabled
|
|
800
478
|
}),
|
|
801
|
-
|
|
479
|
+
mode,
|
|
480
|
+
"k-placement": placement,
|
|
802
481
|
role: "dialog",
|
|
803
482
|
"aria-disabled": disabled || void 0,
|
|
804
|
-
onClickCapture:
|
|
805
|
-
|
|
806
|
-
|
|
483
|
+
onClickCapture: (event_4) => {
|
|
484
|
+
if (!disabled) return;
|
|
485
|
+
event_4.preventDefault();
|
|
486
|
+
event_4.stopPropagation();
|
|
487
|
+
},
|
|
488
|
+
onKeyDownCapture: (event_5) => {
|
|
489
|
+
if (!disabled) return;
|
|
490
|
+
event_5.preventDefault();
|
|
491
|
+
event_5.stopPropagation();
|
|
492
|
+
},
|
|
493
|
+
style: panelOnly ? void 0 : { zIndex: 1050 },
|
|
807
494
|
children: [presets?.length ? /* @__PURE__ */ jsx("div", {
|
|
808
495
|
className: "k-picker-presets",
|
|
809
496
|
children: presets.map((preset) => /* @__PURE__ */ jsx(Button, {
|
|
@@ -864,293 +551,125 @@ function DatePicker(t0) {
|
|
|
864
551
|
placement,
|
|
865
552
|
prefixCls: "k-datepicker-overlay",
|
|
866
553
|
transitionName: "k-date-picker",
|
|
867
|
-
destroyOnClose
|
|
554
|
+
destroyOnClose,
|
|
868
555
|
outsideEvent: "mousedown",
|
|
869
556
|
onOpenChange: (next_9) => {
|
|
870
557
|
if (!next_9) closePopup();
|
|
871
558
|
},
|
|
872
559
|
overlay: overlayContent
|
|
873
560
|
});
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
$[149] = locale.k.datePicker.selectDate;
|
|
886
|
-
$[150] = locale.k.datePicker.selectMonth;
|
|
887
|
-
$[151] = locale.k.datePicker.selectTime;
|
|
888
|
-
$[152] = locale.k.datePicker.selectYear;
|
|
889
|
-
$[153] = t52;
|
|
890
|
-
} else t52 = $[153];
|
|
891
|
-
const datePickerPlaceholders = t52;
|
|
892
|
-
let t53;
|
|
893
|
-
if ($[154] !== placeholder) {
|
|
894
|
-
t53 = Array.isArray(placeholder) ? placeholder : [placeholder, placeholder];
|
|
895
|
-
$[154] = placeholder;
|
|
896
|
-
$[155] = t53;
|
|
897
|
-
} else t53 = $[155];
|
|
898
|
-
const customPlaceholders = t53;
|
|
899
|
-
let t54;
|
|
900
|
-
if ($[156] !== customPlaceholders[0] || $[157] !== customPlaceholders[1] || $[158] !== datePickerPlaceholders || $[159] !== isRange || $[160] !== locale.k.datePicker.endDate || $[161] !== locale.k.datePicker.startDate || $[162] !== mode) {
|
|
901
|
-
t54 = isRange ? [customPlaceholders[0] || locale.k.datePicker.startDate, customPlaceholders[1] || locale.k.datePicker.endDate] : [customPlaceholders[0] || datePickerPlaceholders[mode]];
|
|
902
|
-
$[156] = customPlaceholders[0];
|
|
903
|
-
$[157] = customPlaceholders[1];
|
|
904
|
-
$[158] = datePickerPlaceholders;
|
|
905
|
-
$[159] = isRange;
|
|
906
|
-
$[160] = locale.k.datePicker.endDate;
|
|
907
|
-
$[161] = locale.k.datePicker.startDate;
|
|
908
|
-
$[162] = mode;
|
|
909
|
-
$[163] = t54;
|
|
910
|
-
} else t54 = $[163];
|
|
911
|
-
const placeholders = t54;
|
|
561
|
+
const datePickerPlaceholders = {
|
|
562
|
+
year: locale.k.datePicker.selectYear,
|
|
563
|
+
month: locale.k.datePicker.selectMonth,
|
|
564
|
+
date: locale.k.datePicker.selectDate,
|
|
565
|
+
dateTime: locale.k.datePicker.selectDate,
|
|
566
|
+
time: locale.k.datePicker.selectTime,
|
|
567
|
+
dateRange: locale.k.datePicker.selectDate,
|
|
568
|
+
dateTimeRange: locale.k.datePicker.selectDate
|
|
569
|
+
};
|
|
570
|
+
const customPlaceholders = Array.isArray(placeholder) ? placeholder : [placeholder, placeholder];
|
|
571
|
+
const placeholders = isRange ? [customPlaceholders[0] || locale.k.datePicker.startDate, customPlaceholders[1] || locale.k.datePicker.endDate] : [customPlaceholders[0] || datePickerPlaceholders[mode]];
|
|
912
572
|
const inputSize = Math.max(10, fmt.length);
|
|
913
|
-
const
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
"k-datepicker-sm": t56,
|
|
925
|
-
"k-datepicker-lg": t57,
|
|
926
|
-
"k-datepicker-disabled": disabled,
|
|
927
|
-
"k-datepicker-readonly": readOnly,
|
|
928
|
-
"k-datepicker-fill": t58,
|
|
929
|
-
"k-datepicker-circle": t59,
|
|
930
|
-
"k-datepicker-square": t60
|
|
931
|
-
}, className);
|
|
932
|
-
$[164] = className;
|
|
933
|
-
$[165] = disabled;
|
|
934
|
-
$[166] = readOnly;
|
|
935
|
-
$[167] = t55;
|
|
936
|
-
$[168] = t56;
|
|
937
|
-
$[169] = t57;
|
|
938
|
-
$[170] = t58;
|
|
939
|
-
$[171] = t59;
|
|
940
|
-
$[172] = t60;
|
|
941
|
-
$[173] = visible;
|
|
942
|
-
$[174] = t61;
|
|
943
|
-
} else t61 = $[174];
|
|
944
|
-
const classes = t61;
|
|
573
|
+
const classes = clsx("k-datepicker", {
|
|
574
|
+
"k-datepicker-opened": visible,
|
|
575
|
+
"k-datepicker-borderless": !bordered,
|
|
576
|
+
[`k-datepicker-${theme}`]: true,
|
|
577
|
+
"k-datepicker-sm": size === "small",
|
|
578
|
+
"k-datepicker-lg": size === "large",
|
|
579
|
+
"k-datepicker-disabled": disabled,
|
|
580
|
+
"k-datepicker-readonly": readOnly,
|
|
581
|
+
"k-datepicker-circle": shape === "circle",
|
|
582
|
+
"k-datepicker-square": shape === "square"
|
|
583
|
+
}, className);
|
|
945
584
|
if (panelOnly) return overlay;
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
585
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
586
|
+
...rest,
|
|
587
|
+
ref: rootRef,
|
|
588
|
+
className: classes,
|
|
589
|
+
style,
|
|
590
|
+
tabIndex: disabled ? -1 : 0,
|
|
591
|
+
"aria-readonly": readOnly || void 0,
|
|
592
|
+
"aria-expanded": visible,
|
|
593
|
+
onKeyDown: (event_6) => {
|
|
594
|
+
if (event_6.key === "Escape" && visible) {
|
|
595
|
+
event_6.stopPropagation();
|
|
596
|
+
closePopup();
|
|
597
|
+
} else if ((event_6.key === "Enter" || event_6.key === " ") && !visible) {
|
|
598
|
+
event_6.preventDefault();
|
|
956
599
|
setOpen(true);
|
|
957
600
|
}
|
|
958
|
-
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
} else t64 = $[177];
|
|
963
|
-
const t65 = clsx("k-datepicker-selection", { "k-datepicker-has-clear": clearable && texts.some(Boolean) });
|
|
964
|
-
let t66;
|
|
965
|
-
if ($[178] !== disabled || $[179] !== readOnly || $[180] !== setOpen || $[181] !== visible) {
|
|
966
|
-
t66 = () => !disabled && !readOnly && setOpen(!visible);
|
|
967
|
-
$[178] = disabled;
|
|
968
|
-
$[179] = readOnly;
|
|
969
|
-
$[180] = setOpen;
|
|
970
|
-
$[181] = visible;
|
|
971
|
-
$[182] = t66;
|
|
972
|
-
} else t66 = $[182];
|
|
973
|
-
let t67;
|
|
974
|
-
if ($[183] !== acceptInput || $[184] !== disabled || $[185] !== edit || $[186] !== editable || $[187] !== inputSize || $[188] !== isRange || $[189] !== placeholders[0] || $[190] !== placeholders[1] || $[191] !== readOnly || $[192] !== setOpen || $[193] !== setTimeEditSide || $[194] !== texts[0] || $[195] !== texts[1]) {
|
|
975
|
-
t67 = isRange ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
976
|
-
/* @__PURE__ */ jsx("input", {
|
|
977
|
-
className: "k-datepicker-input",
|
|
978
|
-
size: inputSize,
|
|
979
|
-
value: texts[0] ?? "",
|
|
980
|
-
placeholder: placeholders[0],
|
|
981
|
-
disabled,
|
|
982
|
-
readOnly: readOnly || !editable,
|
|
983
|
-
onClick: (event_4) => {
|
|
984
|
-
event_4.stopPropagation();
|
|
985
|
-
setTimeEditSide("start");
|
|
986
|
-
},
|
|
987
|
-
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
988
|
-
onChange: (event_5) => edit(event_5.target.value, 0),
|
|
989
|
-
onBlur: () => acceptInput(0)
|
|
990
|
-
}),
|
|
991
|
-
/* @__PURE__ */ jsx("span", {
|
|
992
|
-
className: "k-datepicker-separator",
|
|
993
|
-
children: /* @__PURE__ */ jsx(Icon, { type: ArrowRight })
|
|
994
|
-
}),
|
|
995
|
-
/* @__PURE__ */ jsx("input", {
|
|
996
|
-
className: "k-datepicker-input",
|
|
997
|
-
size: inputSize,
|
|
998
|
-
value: texts[1] ?? "",
|
|
999
|
-
placeholder: placeholders[1],
|
|
1000
|
-
disabled,
|
|
1001
|
-
readOnly: readOnly || !editable,
|
|
1002
|
-
onClick: (event_6) => {
|
|
1003
|
-
event_6.stopPropagation();
|
|
1004
|
-
setTimeEditSide("end");
|
|
1005
|
-
},
|
|
1006
|
-
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
1007
|
-
onChange: (event_7) => edit(event_7.target.value, 1),
|
|
1008
|
-
onBlur: () => acceptInput(1)
|
|
1009
|
-
})
|
|
1010
|
-
] }) : /* @__PURE__ */ jsx("input", {
|
|
1011
|
-
className: "k-datepicker-input",
|
|
1012
|
-
size: inputSize,
|
|
1013
|
-
value: texts[0] ?? "",
|
|
1014
|
-
placeholder: placeholders[0],
|
|
1015
|
-
disabled,
|
|
1016
|
-
readOnly: readOnly || !editable,
|
|
1017
|
-
onClick: _temp0,
|
|
1018
|
-
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
1019
|
-
onChange: (event_9) => edit(event_9.target.value, 0),
|
|
1020
|
-
onBlur: () => acceptInput(0)
|
|
1021
|
-
});
|
|
1022
|
-
$[183] = acceptInput;
|
|
1023
|
-
$[184] = disabled;
|
|
1024
|
-
$[185] = edit;
|
|
1025
|
-
$[186] = editable;
|
|
1026
|
-
$[187] = inputSize;
|
|
1027
|
-
$[188] = isRange;
|
|
1028
|
-
$[189] = placeholders[0];
|
|
1029
|
-
$[190] = placeholders[1];
|
|
1030
|
-
$[191] = readOnly;
|
|
1031
|
-
$[192] = setOpen;
|
|
1032
|
-
$[193] = setTimeEditSide;
|
|
1033
|
-
$[194] = texts[0];
|
|
1034
|
-
$[195] = texts[1];
|
|
1035
|
-
$[196] = t67;
|
|
1036
|
-
} else t67 = $[196];
|
|
1037
|
-
const t68 = mode === "time" ? Clock : dateIcon;
|
|
1038
|
-
let t69;
|
|
1039
|
-
if ($[197] !== t68) {
|
|
1040
|
-
t69 = /* @__PURE__ */ jsx(Icon, {
|
|
1041
|
-
type: t68,
|
|
1042
|
-
className: "k-icon-calendar",
|
|
1043
|
-
strokeWidth: 1.5
|
|
1044
|
-
});
|
|
1045
|
-
$[197] = t68;
|
|
1046
|
-
$[198] = t69;
|
|
1047
|
-
} else t69 = $[198];
|
|
1048
|
-
let t70;
|
|
1049
|
-
if ($[199] !== clear || $[200] !== clearable || $[201] !== disabled || $[202] !== readOnly || $[203] !== texts) {
|
|
1050
|
-
t70 = clearable && !disabled && !readOnly && texts.some(Boolean) && /* @__PURE__ */ jsx(Icon, {
|
|
1051
|
-
type: CircleX,
|
|
1052
|
-
className: "k-icon-clean",
|
|
1053
|
-
role: "button",
|
|
1054
|
-
tabIndex: 0,
|
|
1055
|
-
"aria-label": "Clear",
|
|
1056
|
-
onPointerDown: _temp1,
|
|
1057
|
-
onClick: clear,
|
|
1058
|
-
onKeyDown: (event_11) => {
|
|
1059
|
-
if (event_11.key === "Enter" || event_11.key === " ") clear(event_11);
|
|
1060
|
-
}
|
|
1061
|
-
});
|
|
1062
|
-
$[199] = clear;
|
|
1063
|
-
$[200] = clearable;
|
|
1064
|
-
$[201] = disabled;
|
|
1065
|
-
$[202] = readOnly;
|
|
1066
|
-
$[203] = texts;
|
|
1067
|
-
$[204] = t70;
|
|
1068
|
-
} else t70 = $[204];
|
|
1069
|
-
let t71;
|
|
1070
|
-
if ($[205] !== t65 || $[206] !== t66 || $[207] !== t67 || $[208] !== t69 || $[209] !== t70) {
|
|
1071
|
-
t71 = /* @__PURE__ */ jsxs("div", {
|
|
1072
|
-
className: t65,
|
|
1073
|
-
onClick: t66,
|
|
601
|
+
},
|
|
602
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
603
|
+
className: clsx("k-datepicker-selection", { "k-datepicker-has-clear": clearable && texts.some(Boolean) }),
|
|
604
|
+
onClick: () => !disabled && !readOnly && setOpen(!visible),
|
|
1074
605
|
children: [
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
606
|
+
isRange ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
607
|
+
/* @__PURE__ */ jsx("input", {
|
|
608
|
+
className: "k-datepicker-input",
|
|
609
|
+
size: inputSize,
|
|
610
|
+
value: texts[0] ?? "",
|
|
611
|
+
placeholder: placeholders[0],
|
|
612
|
+
disabled,
|
|
613
|
+
readOnly: readOnly || !editable,
|
|
614
|
+
onClick: (event_7) => {
|
|
615
|
+
event_7.stopPropagation();
|
|
616
|
+
setTimeEditSide("start");
|
|
617
|
+
},
|
|
618
|
+
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
619
|
+
onChange: (event_8) => edit(event_8.target.value, 0),
|
|
620
|
+
onBlur: () => acceptInput(0)
|
|
621
|
+
}),
|
|
622
|
+
/* @__PURE__ */ jsx("span", {
|
|
623
|
+
className: "k-datepicker-separator",
|
|
624
|
+
children: /* @__PURE__ */ jsx(Icon, { type: ArrowRight })
|
|
625
|
+
}),
|
|
626
|
+
/* @__PURE__ */ jsx("input", {
|
|
627
|
+
className: "k-datepicker-input",
|
|
628
|
+
size: inputSize,
|
|
629
|
+
value: texts[1] ?? "",
|
|
630
|
+
placeholder: placeholders[1],
|
|
631
|
+
disabled,
|
|
632
|
+
readOnly: readOnly || !editable,
|
|
633
|
+
onClick: (event_9) => {
|
|
634
|
+
event_9.stopPropagation();
|
|
635
|
+
setTimeEditSide("end");
|
|
636
|
+
},
|
|
637
|
+
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
638
|
+
onChange: (event_10) => edit(event_10.target.value, 1),
|
|
639
|
+
onBlur: () => acceptInput(1)
|
|
640
|
+
})
|
|
641
|
+
] }) : /* @__PURE__ */ jsx("input", {
|
|
642
|
+
className: "k-datepicker-input",
|
|
643
|
+
size: inputSize,
|
|
644
|
+
value: texts[0] ?? "",
|
|
645
|
+
placeholder: placeholders[0],
|
|
646
|
+
disabled,
|
|
647
|
+
readOnly: readOnly || !editable,
|
|
648
|
+
onClick: (event_11) => event_11.stopPropagation(),
|
|
649
|
+
onFocus: () => !disabled && !readOnly && setOpen(true),
|
|
650
|
+
onChange: (event_12) => edit(event_12.target.value, 0),
|
|
651
|
+
onBlur: () => acceptInput(0)
|
|
652
|
+
}),
|
|
653
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
654
|
+
type: mode === "time" ? Clock : dateIcon,
|
|
655
|
+
className: "k-icon-calendar",
|
|
656
|
+
strokeWidth: 1.5
|
|
657
|
+
}),
|
|
658
|
+
clearable && !disabled && !readOnly && texts.some(Boolean) && /* @__PURE__ */ jsx(Icon, {
|
|
659
|
+
type: CircleX,
|
|
660
|
+
className: "k-icon-clean",
|
|
661
|
+
role: "button",
|
|
662
|
+
tabIndex: 0,
|
|
663
|
+
"aria-label": "Clear",
|
|
664
|
+
onPointerDown: (event_13) => event_13.preventDefault(),
|
|
665
|
+
onClick: clear,
|
|
666
|
+
onKeyDown: (event_14) => {
|
|
667
|
+
if (event_14.key === "Enter" || event_14.key === " ") clear(event_14);
|
|
668
|
+
}
|
|
669
|
+
})
|
|
1078
670
|
]
|
|
1079
|
-
})
|
|
1080
|
-
|
|
1081
|
-
$[206] = t66;
|
|
1082
|
-
$[207] = t67;
|
|
1083
|
-
$[208] = t69;
|
|
1084
|
-
$[209] = t70;
|
|
1085
|
-
$[210] = t71;
|
|
1086
|
-
} else t71 = $[210];
|
|
1087
|
-
let t72;
|
|
1088
|
-
if ($[211] !== classes || $[212] !== rest || $[213] !== style || $[214] !== t62 || $[215] !== t63 || $[216] !== t64 || $[217] !== t71 || $[218] !== visible) {
|
|
1089
|
-
t72 = /* @__PURE__ */ jsx("div", {
|
|
1090
|
-
...rest,
|
|
1091
|
-
ref: rootRef,
|
|
1092
|
-
className: classes,
|
|
1093
|
-
style,
|
|
1094
|
-
tabIndex: t62,
|
|
1095
|
-
"aria-readonly": t63,
|
|
1096
|
-
"aria-expanded": visible,
|
|
1097
|
-
onKeyDown: t64,
|
|
1098
|
-
children: t71
|
|
1099
|
-
});
|
|
1100
|
-
$[211] = classes;
|
|
1101
|
-
$[212] = rest;
|
|
1102
|
-
$[213] = style;
|
|
1103
|
-
$[214] = t62;
|
|
1104
|
-
$[215] = t63;
|
|
1105
|
-
$[216] = t64;
|
|
1106
|
-
$[217] = t71;
|
|
1107
|
-
$[218] = visible;
|
|
1108
|
-
$[219] = t72;
|
|
1109
|
-
} else t72 = $[219];
|
|
1110
|
-
let t73;
|
|
1111
|
-
if ($[220] !== overlay || $[221] !== t72) {
|
|
1112
|
-
t73 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t72, overlay] });
|
|
1113
|
-
$[220] = overlay;
|
|
1114
|
-
$[221] = t72;
|
|
1115
|
-
$[222] = t73;
|
|
1116
|
-
} else t73 = $[222];
|
|
1117
|
-
return t73;
|
|
1118
|
-
}
|
|
1119
|
-
function _temp1(event_10) {
|
|
1120
|
-
return event_10.preventDefault();
|
|
1121
|
-
}
|
|
1122
|
-
function _temp0(event_8) {
|
|
1123
|
-
return event_8.stopPropagation();
|
|
1124
|
-
}
|
|
1125
|
-
function _temp9(day) {
|
|
1126
|
-
return /* @__PURE__ */ jsx("span", {
|
|
1127
|
-
className: "k-picker-weekday",
|
|
1128
|
-
children: day
|
|
1129
|
-
}, day);
|
|
1130
|
-
}
|
|
1131
|
-
function _temp8(item_10) {
|
|
1132
|
-
return !!item_10;
|
|
1133
|
-
}
|
|
1134
|
-
function _temp7(item_2) {
|
|
1135
|
-
return item_2?.valueOf() ?? "null";
|
|
1136
|
-
}
|
|
1137
|
-
function _temp6(next_0) {
|
|
1138
|
-
return next_0 ?? false;
|
|
1139
|
-
}
|
|
1140
|
-
function _temp5(next) {
|
|
1141
|
-
return next;
|
|
1142
|
-
}
|
|
1143
|
-
function _temp4(item_0) {
|
|
1144
|
-
return !!item_0;
|
|
1145
|
-
}
|
|
1146
|
-
function _temp3(item_1) {
|
|
1147
|
-
return !item_1;
|
|
1148
|
-
}
|
|
1149
|
-
function _temp2() {
|
|
1150
|
-
return false;
|
|
1151
|
-
}
|
|
1152
|
-
function _temp() {
|
|
1153
|
-
return false;
|
|
671
|
+
})
|
|
672
|
+
}), overlay] });
|
|
1154
673
|
}
|
|
1155
674
|
function DatePickerPanel(props) {
|
|
1156
675
|
const $ = c(2);
|