@tidbcloud/uikit 2.0.0-beta.45 → 2.0.0-beta.46
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/CHANGELOG.md +6 -0
- package/dist/biz/DateTimePicker/constant.cjs +11 -0
- package/dist/biz/DateTimePicker/constant.d.cts +7 -0
- package/dist/biz/DateTimePicker/constant.d.ts +7 -0
- package/dist/biz/DateTimePicker/constant.js +11 -0
- package/dist/biz/DateTimePicker/index.cjs +219 -0
- package/dist/biz/DateTimePicker/index.d.cts +18 -0
- package/dist/biz/DateTimePicker/index.d.ts +18 -0
- package/dist/biz/DateTimePicker/index.js +219 -0
- package/dist/biz/DateTimePicker/usePickerScroll.cjs +255 -0
- package/dist/biz/DateTimePicker/usePickerScroll.d.cts +30 -0
- package/dist/biz/DateTimePicker/usePickerScroll.d.ts +30 -0
- package/dist/biz/DateTimePicker/usePickerScroll.js +255 -0
- package/dist/biz/index.cjs +2 -0
- package/dist/biz/index.d.cts +1 -0
- package/dist/biz/index.d.ts +1 -0
- package/dist/biz/index.js +2 -0
- package/dist/theme/theme.cjs +48 -0
- package/dist/theme/theme.js +48 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const CellHeight = 32;
|
|
4
|
+
const CellStyle = {
|
|
5
|
+
height: CellHeight,
|
|
6
|
+
width: CellHeight,
|
|
7
|
+
lineHeight: `${CellHeight}px`,
|
|
8
|
+
borderRadius: 8
|
|
9
|
+
};
|
|
10
|
+
exports.CellHeight = CellHeight;
|
|
11
|
+
exports.CellStyle = CellStyle;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const ahooks = require("ahooks");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const index = require("../../icons/index.cjs");
|
|
7
|
+
const index$1 = require("../../primitive/Typography/index.cjs");
|
|
8
|
+
const dayjs = require("dayjs");
|
|
9
|
+
const helpers = require("../TimeRangePicker/helpers.cjs");
|
|
10
|
+
const usePickerScroll = require("./usePickerScroll.cjs");
|
|
11
|
+
const useDisclosure = require("../../node_modules/.pnpm/@mantine_hooks@5.10.4_react@18.3.1/node_modules/@mantine/hooks/esm/use-disclosure/use-disclosure.cjs");
|
|
12
|
+
const Popover = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Popover/Popover.cjs");
|
|
13
|
+
const TextInput = require("../../primitive/TextInput/TextInput.cjs");
|
|
14
|
+
const Calendar = require("../../node_modules/.pnpm/@mantine_dates@5.10.4_@mantine_core@5.10.4_@mantine_hooks@5.10.4_dayjs@1.11.12_react@18.3.1/node_modules/@mantine/dates/esm/components/Calendar/Calendar.cjs");
|
|
15
|
+
const TimeInput = require("../../node_modules/.pnpm/@mantine_dates@5.10.4_@mantine_core@5.10.4_@mantine_hooks@5.10.4_dayjs@1.11.12_react@18.3.1/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.cjs");
|
|
16
|
+
const Loader = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Loader/Loader.cjs");
|
|
17
|
+
const Box = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Box/Box.cjs");
|
|
18
|
+
const Stack = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Stack/Stack.cjs");
|
|
19
|
+
const Group = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Group/Group.cjs");
|
|
20
|
+
const Divider = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Divider/Divider.cjs");
|
|
21
|
+
const Flex = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Flex/Flex.cjs");
|
|
22
|
+
const DateTimePicker = ({
|
|
23
|
+
placeholder = "Select time",
|
|
24
|
+
format = helpers.DEFAULT_TIME_FORMAT,
|
|
25
|
+
defaultValue,
|
|
26
|
+
value,
|
|
27
|
+
startDate = dayjs().subtract(10, "year").toDate(),
|
|
28
|
+
endDate = dayjs().add(10, "year").toDate(),
|
|
29
|
+
onChange,
|
|
30
|
+
disable = false,
|
|
31
|
+
utcOffset = dayjs().utcOffset(),
|
|
32
|
+
withinPortal = true,
|
|
33
|
+
sx,
|
|
34
|
+
loading = false,
|
|
35
|
+
size
|
|
36
|
+
}) => {
|
|
37
|
+
const [opened, { close, open }] = useDisclosure.useDisclosure(false);
|
|
38
|
+
const [currentValue, setCurrentValue] = React.useState(
|
|
39
|
+
defaultValue ? dayjs(defaultValue) : value ? dayjs(value) : dayjs()
|
|
40
|
+
);
|
|
41
|
+
const updateCurrentValue = ahooks.useMemoizedFn((val) => {
|
|
42
|
+
setCurrentValue(val);
|
|
43
|
+
onChange == null ? void 0 : onChange(val.toDate());
|
|
44
|
+
});
|
|
45
|
+
const inputStr = currentValue.format(format);
|
|
46
|
+
const utcStr = React.useMemo(() => {
|
|
47
|
+
const h = Math.floor(utcOffset / 60);
|
|
48
|
+
const m = utcOffset % 60;
|
|
49
|
+
return `UTC${h >= 0 ? "+" : "-"}${Math.abs(h)}:${m < 10 ? "0" : ""}${m}`;
|
|
50
|
+
}, [utcOffset]);
|
|
51
|
+
const scroll = usePickerScroll.useTimePickerScroll(currentValue, opened, startDate, endDate, utcOffset);
|
|
52
|
+
const calendarChange = ahooks.useMemoizedFn((v) => {
|
|
53
|
+
let next = currentValue;
|
|
54
|
+
next = next.utcOffset(utcOffset).year(v.getFullYear()).month(v.getMonth()).date(v.getDate());
|
|
55
|
+
if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
56
|
+
updateCurrentValue(next);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
const timeInputChange = ahooks.useMemoizedFn((v) => {
|
|
60
|
+
let next = currentValue;
|
|
61
|
+
next = next.utcOffset(utcOffset).hour(v.getHours()).minute(v.getMinutes()).second(v.getSeconds());
|
|
62
|
+
if (startDate && next.valueOf() < startDate.valueOf()) {
|
|
63
|
+
updateCurrentValue(dayjs(startDate));
|
|
64
|
+
} else if (endDate && next.valueOf() > endDate.valueOf()) {
|
|
65
|
+
updateCurrentValue(dayjs(endDate));
|
|
66
|
+
} else if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
67
|
+
updateCurrentValue(next);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
ahooks.useUpdateEffect(() => {
|
|
71
|
+
let next = currentValue;
|
|
72
|
+
const [h, m, s] = scroll.value;
|
|
73
|
+
next = next.utcOffset(utcOffset).hour(h).minute(m).second(s);
|
|
74
|
+
if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
75
|
+
updateCurrentValue(next);
|
|
76
|
+
}
|
|
77
|
+
}, [scroll.value]);
|
|
78
|
+
ahooks.useUpdateEffect(() => {
|
|
79
|
+
if (value && dayjs(value).unix() !== currentValue.unix()) {
|
|
80
|
+
updateCurrentValue(dayjs(value));
|
|
81
|
+
}
|
|
82
|
+
}, [value]);
|
|
83
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Popover.Popover, { position: "bottom-end", opened, withinPortal, shadow: "md", onClose: close, children: [
|
|
84
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Popover.Popover.Target, { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
85
|
+
TextInput.TextInput,
|
|
86
|
+
{
|
|
87
|
+
readOnly: true,
|
|
88
|
+
disabled: disable,
|
|
89
|
+
placeholder,
|
|
90
|
+
value: inputStr,
|
|
91
|
+
rightSection: loading ? /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Loader.Loader, { size: "xs" }) : /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { component: index.IconClock, size: 18, c: "carbon.6" }),
|
|
92
|
+
onClick: open,
|
|
93
|
+
sx,
|
|
94
|
+
size
|
|
95
|
+
}
|
|
96
|
+
) }),
|
|
97
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Popover.Popover.Dropdown, { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Stack.Stack, { children: [
|
|
98
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Group.Group, { align: "flex-start", children: [
|
|
99
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
100
|
+
Calendar.Calendar,
|
|
101
|
+
{
|
|
102
|
+
minDate: startDate,
|
|
103
|
+
maxDate: endDate,
|
|
104
|
+
value: currentValue.toDate(),
|
|
105
|
+
onChange: calendarChange,
|
|
106
|
+
size: "sm",
|
|
107
|
+
styles: () => ({
|
|
108
|
+
calendarHeaderLevel: {
|
|
109
|
+
height: 32
|
|
110
|
+
},
|
|
111
|
+
calendarHeaderControl: {
|
|
112
|
+
height: 32,
|
|
113
|
+
width: 32
|
|
114
|
+
},
|
|
115
|
+
weekdayCell: {
|
|
116
|
+
height: 32,
|
|
117
|
+
width: 32,
|
|
118
|
+
lineHeight: "32px"
|
|
119
|
+
},
|
|
120
|
+
month: {
|
|
121
|
+
"& thead tr": {
|
|
122
|
+
display: "flex",
|
|
123
|
+
gap: 8
|
|
124
|
+
},
|
|
125
|
+
"& tbody tr": {
|
|
126
|
+
display: "flex",
|
|
127
|
+
gap: 8
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
day: {
|
|
131
|
+
height: 32,
|
|
132
|
+
width: 32,
|
|
133
|
+
lineHeight: "32px"
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Divider.Divider, { orientation: "vertical", mt: -12, mb: -16 }),
|
|
139
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Stack.Stack, { justify: "flex-start", children: [
|
|
140
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
141
|
+
TimeInput.TimeInput,
|
|
142
|
+
{
|
|
143
|
+
w: 112,
|
|
144
|
+
withSeconds: true,
|
|
145
|
+
value: currentValue.toDate(),
|
|
146
|
+
onChange: timeInputChange,
|
|
147
|
+
size: "sm",
|
|
148
|
+
styles: {
|
|
149
|
+
controls: {
|
|
150
|
+
height: 30
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
156
|
+
Box.Box,
|
|
157
|
+
{
|
|
158
|
+
pos: "relative",
|
|
159
|
+
fz: 14,
|
|
160
|
+
fw: 400,
|
|
161
|
+
h: 224,
|
|
162
|
+
sx: (theme) => ({ color: theme.colors.carbon[8], overflow: "hidden", zIndex: 9999 }),
|
|
163
|
+
children: [
|
|
164
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Flex.Flex, { mah: "100%", gap: 8, children: [
|
|
165
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
166
|
+
Box.Box,
|
|
167
|
+
{
|
|
168
|
+
bg: "carbon.3",
|
|
169
|
+
pos: "absolute",
|
|
170
|
+
top: 0,
|
|
171
|
+
left: 0,
|
|
172
|
+
h: 32,
|
|
173
|
+
w: 32,
|
|
174
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
178
|
+
Box.Box,
|
|
179
|
+
{
|
|
180
|
+
bg: "carbon.3",
|
|
181
|
+
pos: "absolute",
|
|
182
|
+
top: 0,
|
|
183
|
+
left: 40,
|
|
184
|
+
h: 32,
|
|
185
|
+
w: 32,
|
|
186
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
187
|
+
}
|
|
188
|
+
),
|
|
189
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
190
|
+
Box.Box,
|
|
191
|
+
{
|
|
192
|
+
bg: "carbon.3",
|
|
193
|
+
pos: "absolute",
|
|
194
|
+
top: 0,
|
|
195
|
+
left: 80,
|
|
196
|
+
h: 32,
|
|
197
|
+
w: 32,
|
|
198
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
] }),
|
|
202
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Flex.Flex, { mah: "100%", gap: 8, children: scroll.content })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] })
|
|
207
|
+
] }),
|
|
208
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Divider.Divider, { mx: -16 }),
|
|
209
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Group.Group, { children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(index$1.Typography, { size: "sm", children: [
|
|
210
|
+
"Use",
|
|
211
|
+
" ",
|
|
212
|
+
/* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(index$1.Typography, { fw: 600, component: "span", children: utcStr }),
|
|
213
|
+
" ",
|
|
214
|
+
"from your local time zone"
|
|
215
|
+
] }) })
|
|
216
|
+
] }) })
|
|
217
|
+
] });
|
|
218
|
+
};
|
|
219
|
+
exports.DateTimePicker = DateTimePicker;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Sx, MantineSize } from '../../primitive/index.js';
|
|
2
|
+
|
|
3
|
+
export interface DateTimePickerProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
format?: string;
|
|
6
|
+
utcOffset?: number;
|
|
7
|
+
defaultValue?: Date;
|
|
8
|
+
value?: Date;
|
|
9
|
+
startDate?: Date;
|
|
10
|
+
endDate?: Date;
|
|
11
|
+
onChange?: (val: Date) => void;
|
|
12
|
+
disable?: boolean;
|
|
13
|
+
withinPortal?: boolean;
|
|
14
|
+
sx?: Sx;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
size?: MantineSize;
|
|
17
|
+
}
|
|
18
|
+
export declare const DateTimePicker: React.FC<React.PropsWithChildren<DateTimePickerProps>>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Sx, MantineSize } from '../../primitive/index.js';
|
|
2
|
+
|
|
3
|
+
export interface DateTimePickerProps {
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
format?: string;
|
|
6
|
+
utcOffset?: number;
|
|
7
|
+
defaultValue?: Date;
|
|
8
|
+
value?: Date;
|
|
9
|
+
startDate?: Date;
|
|
10
|
+
endDate?: Date;
|
|
11
|
+
onChange?: (val: Date) => void;
|
|
12
|
+
disable?: boolean;
|
|
13
|
+
withinPortal?: boolean;
|
|
14
|
+
sx?: Sx;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
size?: MantineSize;
|
|
17
|
+
}
|
|
18
|
+
export declare const DateTimePicker: React.FC<React.PropsWithChildren<DateTimePickerProps>>;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { useMemoizedFn, useUpdateEffect } from "ahooks";
|
|
3
|
+
import { useState, useMemo } from "react";
|
|
4
|
+
import { IconClock } from "../../icons/index.js";
|
|
5
|
+
import { Typography } from "../../primitive/Typography/index.js";
|
|
6
|
+
import dayjs from "dayjs";
|
|
7
|
+
import { DEFAULT_TIME_FORMAT } from "../TimeRangePicker/helpers.js";
|
|
8
|
+
import { useTimePickerScroll } from "./usePickerScroll.js";
|
|
9
|
+
import { useDisclosure } from "../../node_modules/.pnpm/@mantine_hooks@5.10.4_react@18.3.1/node_modules/@mantine/hooks/esm/use-disclosure/use-disclosure.js";
|
|
10
|
+
import { Popover } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Popover/Popover.js";
|
|
11
|
+
import { TextInput } from "../../primitive/TextInput/TextInput.js";
|
|
12
|
+
import { Calendar } from "../../node_modules/.pnpm/@mantine_dates@5.10.4_@mantine_core@5.10.4_@mantine_hooks@5.10.4_dayjs@1.11.12_react@18.3.1/node_modules/@mantine/dates/esm/components/Calendar/Calendar.js";
|
|
13
|
+
import { TimeInput } from "../../node_modules/.pnpm/@mantine_dates@5.10.4_@mantine_core@5.10.4_@mantine_hooks@5.10.4_dayjs@1.11.12_react@18.3.1/node_modules/@mantine/dates/esm/components/TimeInput/TimeInput.js";
|
|
14
|
+
import { Loader } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Loader/Loader.js";
|
|
15
|
+
import { Box } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Box/Box.js";
|
|
16
|
+
import { Stack } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Stack/Stack.js";
|
|
17
|
+
import { Group } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Group/Group.js";
|
|
18
|
+
import { Divider } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Divider/Divider.js";
|
|
19
|
+
import { Flex } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Flex/Flex.js";
|
|
20
|
+
const DateTimePicker = ({
|
|
21
|
+
placeholder = "Select time",
|
|
22
|
+
format = DEFAULT_TIME_FORMAT,
|
|
23
|
+
defaultValue,
|
|
24
|
+
value,
|
|
25
|
+
startDate = dayjs().subtract(10, "year").toDate(),
|
|
26
|
+
endDate = dayjs().add(10, "year").toDate(),
|
|
27
|
+
onChange,
|
|
28
|
+
disable = false,
|
|
29
|
+
utcOffset = dayjs().utcOffset(),
|
|
30
|
+
withinPortal = true,
|
|
31
|
+
sx,
|
|
32
|
+
loading = false,
|
|
33
|
+
size
|
|
34
|
+
}) => {
|
|
35
|
+
const [opened, { close, open }] = useDisclosure(false);
|
|
36
|
+
const [currentValue, setCurrentValue] = useState(
|
|
37
|
+
defaultValue ? dayjs(defaultValue) : value ? dayjs(value) : dayjs()
|
|
38
|
+
);
|
|
39
|
+
const updateCurrentValue = useMemoizedFn((val) => {
|
|
40
|
+
setCurrentValue(val);
|
|
41
|
+
onChange == null ? void 0 : onChange(val.toDate());
|
|
42
|
+
});
|
|
43
|
+
const inputStr = currentValue.format(format);
|
|
44
|
+
const utcStr = useMemo(() => {
|
|
45
|
+
const h = Math.floor(utcOffset / 60);
|
|
46
|
+
const m = utcOffset % 60;
|
|
47
|
+
return `UTC${h >= 0 ? "+" : "-"}${Math.abs(h)}:${m < 10 ? "0" : ""}${m}`;
|
|
48
|
+
}, [utcOffset]);
|
|
49
|
+
const scroll = useTimePickerScroll(currentValue, opened, startDate, endDate, utcOffset);
|
|
50
|
+
const calendarChange = useMemoizedFn((v) => {
|
|
51
|
+
let next = currentValue;
|
|
52
|
+
next = next.utcOffset(utcOffset).year(v.getFullYear()).month(v.getMonth()).date(v.getDate());
|
|
53
|
+
if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
54
|
+
updateCurrentValue(next);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const timeInputChange = useMemoizedFn((v) => {
|
|
58
|
+
let next = currentValue;
|
|
59
|
+
next = next.utcOffset(utcOffset).hour(v.getHours()).minute(v.getMinutes()).second(v.getSeconds());
|
|
60
|
+
if (startDate && next.valueOf() < startDate.valueOf()) {
|
|
61
|
+
updateCurrentValue(dayjs(startDate));
|
|
62
|
+
} else if (endDate && next.valueOf() > endDate.valueOf()) {
|
|
63
|
+
updateCurrentValue(dayjs(endDate));
|
|
64
|
+
} else if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
65
|
+
updateCurrentValue(next);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
useUpdateEffect(() => {
|
|
69
|
+
let next = currentValue;
|
|
70
|
+
const [h, m, s] = scroll.value;
|
|
71
|
+
next = next.utcOffset(utcOffset).hour(h).minute(m).second(s);
|
|
72
|
+
if ((currentValue == null ? void 0 : currentValue.unix()) !== next.unix()) {
|
|
73
|
+
updateCurrentValue(next);
|
|
74
|
+
}
|
|
75
|
+
}, [scroll.value]);
|
|
76
|
+
useUpdateEffect(() => {
|
|
77
|
+
if (value && dayjs(value).unix() !== currentValue.unix()) {
|
|
78
|
+
updateCurrentValue(dayjs(value));
|
|
79
|
+
}
|
|
80
|
+
}, [value]);
|
|
81
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { position: "bottom-end", opened, withinPortal, shadow: "md", onClose: close, children: [
|
|
82
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Popover.Target, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
83
|
+
TextInput,
|
|
84
|
+
{
|
|
85
|
+
readOnly: true,
|
|
86
|
+
disabled: disable,
|
|
87
|
+
placeholder,
|
|
88
|
+
value: inputStr,
|
|
89
|
+
rightSection: loading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loader, { size: "xs" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { component: IconClock, size: 18, c: "carbon.6" }),
|
|
90
|
+
onClick: open,
|
|
91
|
+
sx,
|
|
92
|
+
size
|
|
93
|
+
}
|
|
94
|
+
) }),
|
|
95
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { children: [
|
|
96
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Group, { align: "flex-start", children: [
|
|
97
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
98
|
+
Calendar,
|
|
99
|
+
{
|
|
100
|
+
minDate: startDate,
|
|
101
|
+
maxDate: endDate,
|
|
102
|
+
value: currentValue.toDate(),
|
|
103
|
+
onChange: calendarChange,
|
|
104
|
+
size: "sm",
|
|
105
|
+
styles: () => ({
|
|
106
|
+
calendarHeaderLevel: {
|
|
107
|
+
height: 32
|
|
108
|
+
},
|
|
109
|
+
calendarHeaderControl: {
|
|
110
|
+
height: 32,
|
|
111
|
+
width: 32
|
|
112
|
+
},
|
|
113
|
+
weekdayCell: {
|
|
114
|
+
height: 32,
|
|
115
|
+
width: 32,
|
|
116
|
+
lineHeight: "32px"
|
|
117
|
+
},
|
|
118
|
+
month: {
|
|
119
|
+
"& thead tr": {
|
|
120
|
+
display: "flex",
|
|
121
|
+
gap: 8
|
|
122
|
+
},
|
|
123
|
+
"& tbody tr": {
|
|
124
|
+
display: "flex",
|
|
125
|
+
gap: 8
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
day: {
|
|
129
|
+
height: 32,
|
|
130
|
+
width: 32,
|
|
131
|
+
lineHeight: "32px"
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { orientation: "vertical", mt: -12, mb: -16 }),
|
|
137
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Stack, { justify: "flex-start", children: [
|
|
138
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
139
|
+
TimeInput,
|
|
140
|
+
{
|
|
141
|
+
w: 112,
|
|
142
|
+
withSeconds: true,
|
|
143
|
+
value: currentValue.toDate(),
|
|
144
|
+
onChange: timeInputChange,
|
|
145
|
+
size: "sm",
|
|
146
|
+
styles: {
|
|
147
|
+
controls: {
|
|
148
|
+
height: 30
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
154
|
+
Box,
|
|
155
|
+
{
|
|
156
|
+
pos: "relative",
|
|
157
|
+
fz: 14,
|
|
158
|
+
fw: 400,
|
|
159
|
+
h: 224,
|
|
160
|
+
sx: (theme) => ({ color: theme.colors.carbon[8], overflow: "hidden", zIndex: 9999 }),
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(Flex, { mah: "100%", gap: 8, children: [
|
|
163
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
164
|
+
Box,
|
|
165
|
+
{
|
|
166
|
+
bg: "carbon.3",
|
|
167
|
+
pos: "absolute",
|
|
168
|
+
top: 0,
|
|
169
|
+
left: 0,
|
|
170
|
+
h: 32,
|
|
171
|
+
w: 32,
|
|
172
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
176
|
+
Box,
|
|
177
|
+
{
|
|
178
|
+
bg: "carbon.3",
|
|
179
|
+
pos: "absolute",
|
|
180
|
+
top: 0,
|
|
181
|
+
left: 40,
|
|
182
|
+
h: 32,
|
|
183
|
+
w: 32,
|
|
184
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
188
|
+
Box,
|
|
189
|
+
{
|
|
190
|
+
bg: "carbon.3",
|
|
191
|
+
pos: "absolute",
|
|
192
|
+
top: 0,
|
|
193
|
+
left: 80,
|
|
194
|
+
h: 32,
|
|
195
|
+
w: 32,
|
|
196
|
+
sx: (theme) => ({ zIndex: -1, borderRadius: theme.defaultRadius, pointerEvents: "none" })
|
|
197
|
+
}
|
|
198
|
+
)
|
|
199
|
+
] }),
|
|
200
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { mah: "100%", gap: 8, children: scroll.content })
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] })
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, { mx: -16 }),
|
|
207
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Group, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Typography, { size: "sm", children: [
|
|
208
|
+
"Use",
|
|
209
|
+
" ",
|
|
210
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Typography, { fw: 600, component: "span", children: utcStr }),
|
|
211
|
+
" ",
|
|
212
|
+
"from your local time zone"
|
|
213
|
+
] }) })
|
|
214
|
+
] }) })
|
|
215
|
+
] });
|
|
216
|
+
};
|
|
217
|
+
export {
|
|
218
|
+
DateTimePicker
|
|
219
|
+
};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
const ahooks = require("ahooks");
|
|
5
|
+
const lodashEs = require("lodash-es");
|
|
6
|
+
const React = require("react");
|
|
7
|
+
const dayjs = require("dayjs");
|
|
8
|
+
const constant = require("./constant.cjs");
|
|
9
|
+
const ScrollArea = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/ScrollArea/ScrollArea.cjs");
|
|
10
|
+
const clsx_m = require("../../node_modules/.pnpm/clsx@1.1.1/node_modules/clsx/dist/clsx.m.cjs");
|
|
11
|
+
const Box = require("../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Box/Box.cjs");
|
|
12
|
+
const createStyles = require("../../node_modules/.pnpm/@mantine_styles@5.10.4_patch_hash_gj5o633amdkv7b52vinsxkrrr4_@emotion_react@11.13.0_react-dom@18.3.1_react@18.3.1/node_modules/@mantine/styles/esm/tss/create-styles.cjs");
|
|
13
|
+
const useStyles = createStyles.createStyles(() => ({
|
|
14
|
+
bold: {
|
|
15
|
+
fontWeight: 600
|
|
16
|
+
},
|
|
17
|
+
cell: {
|
|
18
|
+
textAlign: "center",
|
|
19
|
+
cursor: "pointer",
|
|
20
|
+
scrollSnapAlign: "start",
|
|
21
|
+
userSelect: "none"
|
|
22
|
+
},
|
|
23
|
+
cellPlaceholder: {
|
|
24
|
+
visibility: "hidden"
|
|
25
|
+
}
|
|
26
|
+
}));
|
|
27
|
+
const getTimeRange = ({
|
|
28
|
+
curr,
|
|
29
|
+
type,
|
|
30
|
+
start,
|
|
31
|
+
end,
|
|
32
|
+
utcOffset = dayjs().utcOffset()
|
|
33
|
+
}) => {
|
|
34
|
+
const map = {
|
|
35
|
+
year: {
|
|
36
|
+
min: dayjs().year(),
|
|
37
|
+
max: dayjs().year() + 100
|
|
38
|
+
},
|
|
39
|
+
month: {
|
|
40
|
+
min: 1,
|
|
41
|
+
max: 12
|
|
42
|
+
},
|
|
43
|
+
day: {
|
|
44
|
+
min: 1,
|
|
45
|
+
max: curr.daysInMonth()
|
|
46
|
+
},
|
|
47
|
+
hour: {
|
|
48
|
+
min: 0,
|
|
49
|
+
max: 23
|
|
50
|
+
},
|
|
51
|
+
minute: {
|
|
52
|
+
min: 0,
|
|
53
|
+
max: 59
|
|
54
|
+
},
|
|
55
|
+
second: {
|
|
56
|
+
min: 0,
|
|
57
|
+
max: 59
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
let { min, max } = map[type];
|
|
61
|
+
const s1 = start ? dayjs(start).utcOffset(utcOffset) : null;
|
|
62
|
+
const s2 = end ? dayjs(end).utcOffset(utcOffset) : null;
|
|
63
|
+
switch (type) {
|
|
64
|
+
case "year": {
|
|
65
|
+
if (s1) {
|
|
66
|
+
min = s1.year();
|
|
67
|
+
}
|
|
68
|
+
if (s2) {
|
|
69
|
+
max = s2.year();
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
case "month": {
|
|
74
|
+
if (s1 && curr.isSame(s1, "year")) {
|
|
75
|
+
min = s1.month() + 1;
|
|
76
|
+
}
|
|
77
|
+
if (s2 && curr.isSame(s2, "year")) {
|
|
78
|
+
max = s2.month() + 1;
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
case "day": {
|
|
83
|
+
if (s1 && curr.isSame(s1, "month")) {
|
|
84
|
+
min = s1.date();
|
|
85
|
+
}
|
|
86
|
+
if (s2 && curr.isSame(s2, "month")) {
|
|
87
|
+
max = s2.date();
|
|
88
|
+
}
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "hour": {
|
|
92
|
+
if (s1 && curr.isSame(s1, "day")) {
|
|
93
|
+
min = s1.hour();
|
|
94
|
+
}
|
|
95
|
+
if (s2 && curr.isSame(s2, "day")) {
|
|
96
|
+
max = s2.hour();
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
case "minute": {
|
|
101
|
+
if (s1 && curr.isSame(s1, "hour")) {
|
|
102
|
+
min = s1.minute();
|
|
103
|
+
}
|
|
104
|
+
if (s2 && curr.isSame(s2, "hour")) {
|
|
105
|
+
max = s2.minute();
|
|
106
|
+
}
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case "second": {
|
|
110
|
+
if (s1 && curr.isSame(s1, "minute")) {
|
|
111
|
+
min = s1.second();
|
|
112
|
+
}
|
|
113
|
+
if (s2 && curr.isSame(s2, "minute")) {
|
|
114
|
+
max = s2.second();
|
|
115
|
+
}
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
default: {
|
|
119
|
+
const exhaustiveCheck = "should not reach here";
|
|
120
|
+
throw new Error(exhaustiveCheck);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return { min, max };
|
|
124
|
+
};
|
|
125
|
+
const usePickerScrollColumn = ({ min, max, curr, open, render }) => {
|
|
126
|
+
const { classes } = useStyles();
|
|
127
|
+
const ref = React.useRef(null);
|
|
128
|
+
const timeoutRef = React.useRef();
|
|
129
|
+
const [val, setVal] = React.useState(curr);
|
|
130
|
+
const handleClickCell = ahooks.useMemoizedFn((e, i) => {
|
|
131
|
+
var _a;
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
(_a = ref.current) == null ? void 0 : _a.scrollTo({ top: i * constant.CellHeight, behavior: "smooth" });
|
|
135
|
+
});
|
|
136
|
+
const onScroll = ahooks.useMemoizedFn((position) => {
|
|
137
|
+
clearTimeout(timeoutRef.current);
|
|
138
|
+
const i = position.y / constant.CellHeight;
|
|
139
|
+
if (i === Math.floor(i)) {
|
|
140
|
+
const val2 = i >= numbers.length ? numbers.at(-1) : numbers[i];
|
|
141
|
+
if (typeof val2 !== "undefined") {
|
|
142
|
+
setVal(val2);
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
146
|
+
const k = Math.round(i);
|
|
147
|
+
const val2 = k >= numbers.length ? numbers.at(-1) : numbers[k];
|
|
148
|
+
if (typeof val2 !== "undefined") {
|
|
149
|
+
setVal(val2);
|
|
150
|
+
}
|
|
151
|
+
}, 300);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
const numbers = React.useMemo(() => lodashEs.range(min, max + 1), [min, max]);
|
|
155
|
+
const content = React.useMemo(() => {
|
|
156
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(
|
|
157
|
+
ScrollArea.ScrollArea,
|
|
158
|
+
{
|
|
159
|
+
viewportRef: ref,
|
|
160
|
+
type: "never",
|
|
161
|
+
styles: {
|
|
162
|
+
viewport: {
|
|
163
|
+
scrollSnapPointsY: `repeat(${constant.CellHeight}px)`,
|
|
164
|
+
scrollSnapType: "y mandatory"
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
onScrollPositionChange: onScroll,
|
|
168
|
+
children: [
|
|
169
|
+
numbers.map((i, index) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
className: clsx_m(classes.cell, i === curr && classes.bold),
|
|
173
|
+
onClick: (e) => handleClickCell(e, index),
|
|
174
|
+
style: constant.CellStyle,
|
|
175
|
+
children: render ? render(i) : i
|
|
176
|
+
},
|
|
177
|
+
i
|
|
178
|
+
)),
|
|
179
|
+
lodashEs.range(6).map((i) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Box.Box, { className: clsx_m(classes.cell, classes.cellPlaceholder), style: constant.CellStyle }, i))
|
|
180
|
+
]
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}, [numbers, handleClickCell, onScroll, curr, render, classes]);
|
|
184
|
+
const adjustScrollTop = ahooks.useMemoizedFn(() => {
|
|
185
|
+
const i = numbers.findIndex((i2) => i2 === val);
|
|
186
|
+
if (i !== -1 && open && ref.current) {
|
|
187
|
+
const s = i * constant.CellHeight;
|
|
188
|
+
ref.current.scrollTo({ top: s, behavior: "auto" });
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
React.useEffect(() => {
|
|
192
|
+
requestAnimationFrame(() => {
|
|
193
|
+
adjustScrollTop();
|
|
194
|
+
});
|
|
195
|
+
}, [open, val, adjustScrollTop]);
|
|
196
|
+
React.useEffect(() => {
|
|
197
|
+
if (numbers.findIndex((i) => i === curr) > -1) {
|
|
198
|
+
setVal(curr);
|
|
199
|
+
}
|
|
200
|
+
}, [curr, numbers]);
|
|
201
|
+
return {
|
|
202
|
+
value: val,
|
|
203
|
+
content
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
const default2DigitRender = (val) => lodashEs.padStart(String(val), 2, "0");
|
|
207
|
+
const useTimePickerScroll = (currentValue, open, start, end, utcOffset) => {
|
|
208
|
+
const options = React.useMemo(
|
|
209
|
+
() => ({
|
|
210
|
+
hour: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "hour" }),
|
|
211
|
+
minute: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "minute" }),
|
|
212
|
+
second: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "second" })
|
|
213
|
+
}),
|
|
214
|
+
[currentValue, start, end, utcOffset]
|
|
215
|
+
);
|
|
216
|
+
const hour = usePickerScrollColumn({
|
|
217
|
+
...options.hour,
|
|
218
|
+
curr: typeof utcOffset !== "undefined" ? currentValue.utcOffset(utcOffset ?? currentValue.utcOffset()).hour() : currentValue.hour(),
|
|
219
|
+
open,
|
|
220
|
+
render: default2DigitRender,
|
|
221
|
+
title: "hour"
|
|
222
|
+
});
|
|
223
|
+
const minute = usePickerScrollColumn({
|
|
224
|
+
...options.minute,
|
|
225
|
+
curr: currentValue.minute(),
|
|
226
|
+
open,
|
|
227
|
+
render: default2DigitRender,
|
|
228
|
+
title: "minute"
|
|
229
|
+
});
|
|
230
|
+
const second = usePickerScrollColumn({
|
|
231
|
+
...options.second,
|
|
232
|
+
curr: currentValue.second(),
|
|
233
|
+
open,
|
|
234
|
+
render: default2DigitRender,
|
|
235
|
+
title: "second"
|
|
236
|
+
});
|
|
237
|
+
const content = React.useMemo(
|
|
238
|
+
() => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment, { children: [
|
|
239
|
+
hour.content,
|
|
240
|
+
minute.content,
|
|
241
|
+
second.content
|
|
242
|
+
] }),
|
|
243
|
+
[hour.content, minute.content, second.content]
|
|
244
|
+
);
|
|
245
|
+
const value = React.useMemo(
|
|
246
|
+
() => [hour.value, minute.value, second.value],
|
|
247
|
+
[hour.value, minute.value, second.value]
|
|
248
|
+
);
|
|
249
|
+
return {
|
|
250
|
+
content,
|
|
251
|
+
value
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
exports.getTimeRange = getTimeRange;
|
|
255
|
+
exports.useTimePickerScroll = useTimePickerScroll;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
|
|
3
|
+
export declare const getTimeRange: ({ curr, type, start, end, utcOffset }: {
|
|
4
|
+
curr: Dayjs;
|
|
5
|
+
type: "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
6
|
+
start?: Date;
|
|
7
|
+
end?: Date;
|
|
8
|
+
utcOffset?: number;
|
|
9
|
+
}) => Range;
|
|
10
|
+
interface Options {
|
|
11
|
+
max: number;
|
|
12
|
+
min: number;
|
|
13
|
+
/**
|
|
14
|
+
* always use real value, not 0-indexed value
|
|
15
|
+
*/
|
|
16
|
+
curr: number;
|
|
17
|
+
open: boolean;
|
|
18
|
+
render?: (val: number) => any;
|
|
19
|
+
title?: string;
|
|
20
|
+
}
|
|
21
|
+
type Range = Pick<Options, 'max' | 'min'>;
|
|
22
|
+
export declare const useDatePickerScroll: (currentValue: Dayjs, open: boolean, start?: Date, end?: Date, utcOffset?: number) => {
|
|
23
|
+
content: import("react/jsx-runtime.js").JSX.Element;
|
|
24
|
+
value: readonly [number, number, number];
|
|
25
|
+
};
|
|
26
|
+
export declare const useTimePickerScroll: (currentValue: Dayjs, open: boolean, start?: Date, end?: Date, utcOffset?: number) => {
|
|
27
|
+
content: import("react/jsx-runtime.js").JSX.Element;
|
|
28
|
+
value: readonly [number, number, number];
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
|
|
3
|
+
export declare const getTimeRange: ({ curr, type, start, end, utcOffset }: {
|
|
4
|
+
curr: Dayjs;
|
|
5
|
+
type: "year" | "month" | "day" | "hour" | "minute" | "second";
|
|
6
|
+
start?: Date;
|
|
7
|
+
end?: Date;
|
|
8
|
+
utcOffset?: number;
|
|
9
|
+
}) => Range;
|
|
10
|
+
interface Options {
|
|
11
|
+
max: number;
|
|
12
|
+
min: number;
|
|
13
|
+
/**
|
|
14
|
+
* always use real value, not 0-indexed value
|
|
15
|
+
*/
|
|
16
|
+
curr: number;
|
|
17
|
+
open: boolean;
|
|
18
|
+
render?: (val: number) => any;
|
|
19
|
+
title?: string;
|
|
20
|
+
}
|
|
21
|
+
type Range = Pick<Options, 'max' | 'min'>;
|
|
22
|
+
export declare const useDatePickerScroll: (currentValue: Dayjs, open: boolean, start?: Date, end?: Date, utcOffset?: number) => {
|
|
23
|
+
content: import("react/jsx-runtime.js").JSX.Element;
|
|
24
|
+
value: readonly [number, number, number];
|
|
25
|
+
};
|
|
26
|
+
export declare const useTimePickerScroll: (currentValue: Dayjs, open: boolean, start?: Date, end?: Date, utcOffset?: number) => {
|
|
27
|
+
content: import("react/jsx-runtime.js").JSX.Element;
|
|
28
|
+
value: readonly [number, number, number];
|
|
29
|
+
};
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.3.1/node_modules/react/jsx-runtime.js";
|
|
2
|
+
import { useMemoizedFn } from "ahooks";
|
|
3
|
+
import { range, padStart } from "lodash-es";
|
|
4
|
+
import { useMemo, useRef, useState, useEffect } from "react";
|
|
5
|
+
import dayjs from "dayjs";
|
|
6
|
+
import { CellHeight, CellStyle } from "./constant.js";
|
|
7
|
+
import { ScrollArea } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/ScrollArea/ScrollArea.js";
|
|
8
|
+
import clsx from "../../node_modules/.pnpm/clsx@1.1.1/node_modules/clsx/dist/clsx.m.js";
|
|
9
|
+
import { Box } from "../../node_modules/.pnpm/@mantine_core@5.10.4_patch_hash_k3wzpm5n4esvq7igbvcsgyfoja_@emotion_react@11.13.0_@mantine_ho_u2jurujayhgo5kjqawpkatsdsi/node_modules/@mantine/core/esm/Box/Box.js";
|
|
10
|
+
import { createStyles } from "../../node_modules/.pnpm/@mantine_styles@5.10.4_patch_hash_gj5o633amdkv7b52vinsxkrrr4_@emotion_react@11.13.0_react-dom@18.3.1_react@18.3.1/node_modules/@mantine/styles/esm/tss/create-styles.js";
|
|
11
|
+
const useStyles = createStyles(() => ({
|
|
12
|
+
bold: {
|
|
13
|
+
fontWeight: 600
|
|
14
|
+
},
|
|
15
|
+
cell: {
|
|
16
|
+
textAlign: "center",
|
|
17
|
+
cursor: "pointer",
|
|
18
|
+
scrollSnapAlign: "start",
|
|
19
|
+
userSelect: "none"
|
|
20
|
+
},
|
|
21
|
+
cellPlaceholder: {
|
|
22
|
+
visibility: "hidden"
|
|
23
|
+
}
|
|
24
|
+
}));
|
|
25
|
+
const getTimeRange = ({
|
|
26
|
+
curr,
|
|
27
|
+
type,
|
|
28
|
+
start,
|
|
29
|
+
end,
|
|
30
|
+
utcOffset = dayjs().utcOffset()
|
|
31
|
+
}) => {
|
|
32
|
+
const map = {
|
|
33
|
+
year: {
|
|
34
|
+
min: dayjs().year(),
|
|
35
|
+
max: dayjs().year() + 100
|
|
36
|
+
},
|
|
37
|
+
month: {
|
|
38
|
+
min: 1,
|
|
39
|
+
max: 12
|
|
40
|
+
},
|
|
41
|
+
day: {
|
|
42
|
+
min: 1,
|
|
43
|
+
max: curr.daysInMonth()
|
|
44
|
+
},
|
|
45
|
+
hour: {
|
|
46
|
+
min: 0,
|
|
47
|
+
max: 23
|
|
48
|
+
},
|
|
49
|
+
minute: {
|
|
50
|
+
min: 0,
|
|
51
|
+
max: 59
|
|
52
|
+
},
|
|
53
|
+
second: {
|
|
54
|
+
min: 0,
|
|
55
|
+
max: 59
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
let { min, max } = map[type];
|
|
59
|
+
const s1 = start ? dayjs(start).utcOffset(utcOffset) : null;
|
|
60
|
+
const s2 = end ? dayjs(end).utcOffset(utcOffset) : null;
|
|
61
|
+
switch (type) {
|
|
62
|
+
case "year": {
|
|
63
|
+
if (s1) {
|
|
64
|
+
min = s1.year();
|
|
65
|
+
}
|
|
66
|
+
if (s2) {
|
|
67
|
+
max = s2.year();
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "month": {
|
|
72
|
+
if (s1 && curr.isSame(s1, "year")) {
|
|
73
|
+
min = s1.month() + 1;
|
|
74
|
+
}
|
|
75
|
+
if (s2 && curr.isSame(s2, "year")) {
|
|
76
|
+
max = s2.month() + 1;
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case "day": {
|
|
81
|
+
if (s1 && curr.isSame(s1, "month")) {
|
|
82
|
+
min = s1.date();
|
|
83
|
+
}
|
|
84
|
+
if (s2 && curr.isSame(s2, "month")) {
|
|
85
|
+
max = s2.date();
|
|
86
|
+
}
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case "hour": {
|
|
90
|
+
if (s1 && curr.isSame(s1, "day")) {
|
|
91
|
+
min = s1.hour();
|
|
92
|
+
}
|
|
93
|
+
if (s2 && curr.isSame(s2, "day")) {
|
|
94
|
+
max = s2.hour();
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case "minute": {
|
|
99
|
+
if (s1 && curr.isSame(s1, "hour")) {
|
|
100
|
+
min = s1.minute();
|
|
101
|
+
}
|
|
102
|
+
if (s2 && curr.isSame(s2, "hour")) {
|
|
103
|
+
max = s2.minute();
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
case "second": {
|
|
108
|
+
if (s1 && curr.isSame(s1, "minute")) {
|
|
109
|
+
min = s1.second();
|
|
110
|
+
}
|
|
111
|
+
if (s2 && curr.isSame(s2, "minute")) {
|
|
112
|
+
max = s2.second();
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
default: {
|
|
117
|
+
const exhaustiveCheck = "should not reach here";
|
|
118
|
+
throw new Error(exhaustiveCheck);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return { min, max };
|
|
122
|
+
};
|
|
123
|
+
const usePickerScrollColumn = ({ min, max, curr, open, render }) => {
|
|
124
|
+
const { classes } = useStyles();
|
|
125
|
+
const ref = useRef(null);
|
|
126
|
+
const timeoutRef = useRef();
|
|
127
|
+
const [val, setVal] = useState(curr);
|
|
128
|
+
const handleClickCell = useMemoizedFn((e, i) => {
|
|
129
|
+
var _a;
|
|
130
|
+
e.stopPropagation();
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
(_a = ref.current) == null ? void 0 : _a.scrollTo({ top: i * CellHeight, behavior: "smooth" });
|
|
133
|
+
});
|
|
134
|
+
const onScroll = useMemoizedFn((position) => {
|
|
135
|
+
clearTimeout(timeoutRef.current);
|
|
136
|
+
const i = position.y / CellHeight;
|
|
137
|
+
if (i === Math.floor(i)) {
|
|
138
|
+
const val2 = i >= numbers.length ? numbers.at(-1) : numbers[i];
|
|
139
|
+
if (typeof val2 !== "undefined") {
|
|
140
|
+
setVal(val2);
|
|
141
|
+
}
|
|
142
|
+
} else {
|
|
143
|
+
timeoutRef.current = window.setTimeout(() => {
|
|
144
|
+
const k = Math.round(i);
|
|
145
|
+
const val2 = k >= numbers.length ? numbers.at(-1) : numbers[k];
|
|
146
|
+
if (typeof val2 !== "undefined") {
|
|
147
|
+
setVal(val2);
|
|
148
|
+
}
|
|
149
|
+
}, 300);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
const numbers = useMemo(() => range(min, max + 1), [min, max]);
|
|
153
|
+
const content = useMemo(() => {
|
|
154
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
155
|
+
ScrollArea,
|
|
156
|
+
{
|
|
157
|
+
viewportRef: ref,
|
|
158
|
+
type: "never",
|
|
159
|
+
styles: {
|
|
160
|
+
viewport: {
|
|
161
|
+
scrollSnapPointsY: `repeat(${CellHeight}px)`,
|
|
162
|
+
scrollSnapType: "y mandatory"
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
onScrollPositionChange: onScroll,
|
|
166
|
+
children: [
|
|
167
|
+
numbers.map((i, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: clsx(classes.cell, i === curr && classes.bold),
|
|
171
|
+
onClick: (e) => handleClickCell(e, index),
|
|
172
|
+
style: CellStyle,
|
|
173
|
+
children: render ? render(i) : i
|
|
174
|
+
},
|
|
175
|
+
i
|
|
176
|
+
)),
|
|
177
|
+
range(6).map((i) => /* @__PURE__ */ jsxRuntimeExports.jsx(Box, { className: clsx(classes.cell, classes.cellPlaceholder), style: CellStyle }, i))
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}, [numbers, handleClickCell, onScroll, curr, render, classes]);
|
|
182
|
+
const adjustScrollTop = useMemoizedFn(() => {
|
|
183
|
+
const i = numbers.findIndex((i2) => i2 === val);
|
|
184
|
+
if (i !== -1 && open && ref.current) {
|
|
185
|
+
const s = i * CellHeight;
|
|
186
|
+
ref.current.scrollTo({ top: s, behavior: "auto" });
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
useEffect(() => {
|
|
190
|
+
requestAnimationFrame(() => {
|
|
191
|
+
adjustScrollTop();
|
|
192
|
+
});
|
|
193
|
+
}, [open, val, adjustScrollTop]);
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
if (numbers.findIndex((i) => i === curr) > -1) {
|
|
196
|
+
setVal(curr);
|
|
197
|
+
}
|
|
198
|
+
}, [curr, numbers]);
|
|
199
|
+
return {
|
|
200
|
+
value: val,
|
|
201
|
+
content
|
|
202
|
+
};
|
|
203
|
+
};
|
|
204
|
+
const default2DigitRender = (val) => padStart(String(val), 2, "0");
|
|
205
|
+
const useTimePickerScroll = (currentValue, open, start, end, utcOffset) => {
|
|
206
|
+
const options = useMemo(
|
|
207
|
+
() => ({
|
|
208
|
+
hour: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "hour" }),
|
|
209
|
+
minute: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "minute" }),
|
|
210
|
+
second: getTimeRange({ curr: currentValue, start, end, utcOffset, type: "second" })
|
|
211
|
+
}),
|
|
212
|
+
[currentValue, start, end, utcOffset]
|
|
213
|
+
);
|
|
214
|
+
const hour = usePickerScrollColumn({
|
|
215
|
+
...options.hour,
|
|
216
|
+
curr: typeof utcOffset !== "undefined" ? currentValue.utcOffset(utcOffset ?? currentValue.utcOffset()).hour() : currentValue.hour(),
|
|
217
|
+
open,
|
|
218
|
+
render: default2DigitRender,
|
|
219
|
+
title: "hour"
|
|
220
|
+
});
|
|
221
|
+
const minute = usePickerScrollColumn({
|
|
222
|
+
...options.minute,
|
|
223
|
+
curr: currentValue.minute(),
|
|
224
|
+
open,
|
|
225
|
+
render: default2DigitRender,
|
|
226
|
+
title: "minute"
|
|
227
|
+
});
|
|
228
|
+
const second = usePickerScrollColumn({
|
|
229
|
+
...options.second,
|
|
230
|
+
curr: currentValue.second(),
|
|
231
|
+
open,
|
|
232
|
+
render: default2DigitRender,
|
|
233
|
+
title: "second"
|
|
234
|
+
});
|
|
235
|
+
const content = useMemo(
|
|
236
|
+
() => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
237
|
+
hour.content,
|
|
238
|
+
minute.content,
|
|
239
|
+
second.content
|
|
240
|
+
] }),
|
|
241
|
+
[hour.content, minute.content, second.content]
|
|
242
|
+
);
|
|
243
|
+
const value = useMemo(
|
|
244
|
+
() => [hour.value, minute.value, second.value],
|
|
245
|
+
[hour.value, minute.value, second.value]
|
|
246
|
+
);
|
|
247
|
+
return {
|
|
248
|
+
content,
|
|
249
|
+
value
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
export {
|
|
253
|
+
getTimeRange,
|
|
254
|
+
useTimePickerScroll
|
|
255
|
+
};
|
package/dist/biz/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const index$8 = require("./TransferTree/index.cjs");
|
|
|
11
11
|
const index$9 = require("./PropertyCard/index.cjs");
|
|
12
12
|
const index$a = require("./PageShell/index.cjs");
|
|
13
13
|
const index$b = require("./TimeRangePicker/index.cjs");
|
|
14
|
+
const index$c = require("./DateTimePicker/index.cjs");
|
|
14
15
|
const helper = require("./PhoneInput/helper.cjs");
|
|
15
16
|
const BasicTable = require("./Table/BasicTable/BasicTable.cjs");
|
|
16
17
|
const mantineReactTable_esm = require("../node_modules/.pnpm/mantine-react-table@0.9.5_@emotion_react@11.13.0_@mantine_core@5.10.4_@mantine_dates@5.10.4_@_yfjqnbb4mknmwrezmpabys5oru/node_modules/mantine-react-table/dist/esm/mantine-react-table.esm.cjs");
|
|
@@ -47,6 +48,7 @@ exports.PropertyCard = index$9.PropertyCard;
|
|
|
47
48
|
exports.PageHeader = index$a.PageHeader;
|
|
48
49
|
exports.PageShell = index$a.PageShell;
|
|
49
50
|
exports.TimeRangePicker = index$b.TimeRangePicker;
|
|
51
|
+
exports.DateTimePicker = index$c.DateTimePicker;
|
|
50
52
|
exports.validPhoneNumber = helper.validPhoneNumber;
|
|
51
53
|
exports.BasicTable = BasicTable.BasicTable;
|
|
52
54
|
exports.TableNoticeRow = BasicTable.TableNoticeRow;
|
package/dist/biz/index.d.cts
CHANGED
package/dist/biz/index.d.ts
CHANGED
package/dist/biz/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { TransferTree } from "./TransferTree/index.js";
|
|
|
9
9
|
import { PropertyCard } from "./PropertyCard/index.js";
|
|
10
10
|
import { PageHeader, PageShell } from "./PageShell/index.js";
|
|
11
11
|
import { TimeRangePicker } from "./TimeRangePicker/index.js";
|
|
12
|
+
import { DateTimePicker } from "./DateTimePicker/index.js";
|
|
12
13
|
import { validPhoneNumber } from "./PhoneInput/helper.js";
|
|
13
14
|
import { BasicTable, TableNoticeRow } from "./Table/BasicTable/BasicTable.js";
|
|
14
15
|
import { MRT_AggregationFns, MRT_BottomToolbar, MRT_CopyButton, MRT_FilterFns, MRT_FilterOptionMenu, MRT_GlobalFilterTextInput, MRT_ProgressBar, MRT_ShowHideColumnsButton, MRT_SortingFns, MRT_TablePagination, MRT_ToggleDensePaddingButton, MRT_ToggleFiltersButton, MRT_ToggleFullScreenButton, MRT_ToggleGlobalFilterButton, MRT_ToggleRowActionMenuButton, MRT_ToolbarAlertBanner, MRT_ToolbarDropZone, MRT_ToolbarInternalButtons, MRT_TopToolbar, MantineReactTable } from "../node_modules/.pnpm/mantine-react-table@0.9.5_@emotion_react@11.13.0_@mantine_core@5.10.4_@mantine_dates@5.10.4_@_yfjqnbb4mknmwrezmpabys5oru/node_modules/mantine-react-table/dist/esm/mantine-react-table.esm.js";
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
DEFAULT_TIME_FORMAT,
|
|
41
42
|
DEFAULT_TIME_FORMAT_WITH_TIMEZONE,
|
|
42
43
|
DEFAULT_TIME_RANGE,
|
|
44
|
+
DateTimePicker,
|
|
43
45
|
Dot,
|
|
44
46
|
DotBadge,
|
|
45
47
|
Form,
|
package/dist/theme/theme.cjs
CHANGED
|
@@ -1036,6 +1036,54 @@ const theme = {
|
|
|
1036
1036
|
}
|
|
1037
1037
|
};
|
|
1038
1038
|
}
|
|
1039
|
+
},
|
|
1040
|
+
Calendar: {
|
|
1041
|
+
styles: (theme2) => {
|
|
1042
|
+
const color = theme2.primaryColor;
|
|
1043
|
+
return {
|
|
1044
|
+
calendarHeaderLevel: {
|
|
1045
|
+
color: theme2.fn.themeColor(color, 7)
|
|
1046
|
+
},
|
|
1047
|
+
calendarHeaderLevelIcon: {
|
|
1048
|
+
color: `${theme2.fn.themeColor(color, 7)} !important`
|
|
1049
|
+
},
|
|
1050
|
+
calendarHeaderControl: {
|
|
1051
|
+
color: `${theme2.fn.themeColor(color, 7)} !important`
|
|
1052
|
+
},
|
|
1053
|
+
yearPickerControlActive: {
|
|
1054
|
+
backgroundColor: theme2.fn.themeColor(color, 9)
|
|
1055
|
+
},
|
|
1056
|
+
monthPickerControlActive: {
|
|
1057
|
+
backgroundColor: theme2.fn.themeColor(color, 9)
|
|
1058
|
+
},
|
|
1059
|
+
weekday: {
|
|
1060
|
+
color: theme2.fn.themeColor(color, 7)
|
|
1061
|
+
},
|
|
1062
|
+
day: {
|
|
1063
|
+
color: theme2.fn.themeColor(color, 8),
|
|
1064
|
+
borderRadius: 8,
|
|
1065
|
+
"&[data-selected]": {
|
|
1066
|
+
backgroundColor: theme2.fn.themeColor(color, 9),
|
|
1067
|
+
color: theme2.white
|
|
1068
|
+
},
|
|
1069
|
+
"&[data-weekend]": {
|
|
1070
|
+
color: theme2.fn.themeColor(color, 8),
|
|
1071
|
+
"&[data-selected]": {
|
|
1072
|
+
color: theme2.white
|
|
1073
|
+
},
|
|
1074
|
+
"&[data-disabled], &:disabled": {
|
|
1075
|
+
color: `${theme2.fn.themeColor(color, 5)} !important`
|
|
1076
|
+
}
|
|
1077
|
+
},
|
|
1078
|
+
"&[data-disabled], &:disabled": {
|
|
1079
|
+
color: `${theme2.fn.themeColor(color, 5)} !important`
|
|
1080
|
+
},
|
|
1081
|
+
"&[data-outside]": {
|
|
1082
|
+
color: theme2.fn.themeColor(color, 6)
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1039
1087
|
}
|
|
1040
1088
|
}
|
|
1041
1089
|
};
|
package/dist/theme/theme.js
CHANGED
|
@@ -1034,6 +1034,54 @@ const theme = {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
};
|
|
1036
1036
|
}
|
|
1037
|
+
},
|
|
1038
|
+
Calendar: {
|
|
1039
|
+
styles: (theme2) => {
|
|
1040
|
+
const color = theme2.primaryColor;
|
|
1041
|
+
return {
|
|
1042
|
+
calendarHeaderLevel: {
|
|
1043
|
+
color: theme2.fn.themeColor(color, 7)
|
|
1044
|
+
},
|
|
1045
|
+
calendarHeaderLevelIcon: {
|
|
1046
|
+
color: `${theme2.fn.themeColor(color, 7)} !important`
|
|
1047
|
+
},
|
|
1048
|
+
calendarHeaderControl: {
|
|
1049
|
+
color: `${theme2.fn.themeColor(color, 7)} !important`
|
|
1050
|
+
},
|
|
1051
|
+
yearPickerControlActive: {
|
|
1052
|
+
backgroundColor: theme2.fn.themeColor(color, 9)
|
|
1053
|
+
},
|
|
1054
|
+
monthPickerControlActive: {
|
|
1055
|
+
backgroundColor: theme2.fn.themeColor(color, 9)
|
|
1056
|
+
},
|
|
1057
|
+
weekday: {
|
|
1058
|
+
color: theme2.fn.themeColor(color, 7)
|
|
1059
|
+
},
|
|
1060
|
+
day: {
|
|
1061
|
+
color: theme2.fn.themeColor(color, 8),
|
|
1062
|
+
borderRadius: 8,
|
|
1063
|
+
"&[data-selected]": {
|
|
1064
|
+
backgroundColor: theme2.fn.themeColor(color, 9),
|
|
1065
|
+
color: theme2.white
|
|
1066
|
+
},
|
|
1067
|
+
"&[data-weekend]": {
|
|
1068
|
+
color: theme2.fn.themeColor(color, 8),
|
|
1069
|
+
"&[data-selected]": {
|
|
1070
|
+
color: theme2.white
|
|
1071
|
+
},
|
|
1072
|
+
"&[data-disabled], &:disabled": {
|
|
1073
|
+
color: `${theme2.fn.themeColor(color, 5)} !important`
|
|
1074
|
+
}
|
|
1075
|
+
},
|
|
1076
|
+
"&[data-disabled], &:disabled": {
|
|
1077
|
+
color: `${theme2.fn.themeColor(color, 5)} !important`
|
|
1078
|
+
},
|
|
1079
|
+
"&[data-outside]": {
|
|
1080
|
+
color: theme2.fn.themeColor(color, 6)
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
}
|
|
1037
1085
|
}
|
|
1038
1086
|
}
|
|
1039
1087
|
};
|