@tidbcloud/uikit 2.4.15 → 2.4.16
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 +11 -0
- package/dist/biz/AppShell/navbar/NavItemBase.d.cts +1 -0
- package/dist/biz/AppShell/navbar/NavItemBase.d.mts +1 -0
- package/dist/biz/DateTimePicker/helpers.cjs +49 -0
- package/dist/biz/DateTimePicker/helpers.d.cts +37 -0
- package/dist/biz/DateTimePicker/helpers.d.mts +37 -0
- package/dist/biz/DateTimePicker/helpers.mjs +49 -0
- package/dist/biz/DateTimePicker/index.cjs +9 -11
- package/dist/biz/DateTimePicker/index.d.cts +5 -33
- package/dist/biz/DateTimePicker/index.d.mts +5 -33
- package/dist/biz/DateTimePicker/index.mjs +8 -10
- package/dist/biz/DateTimePicker/types.d.cts +33 -0
- package/dist/biz/DateTimePicker/types.d.mts +33 -0
- package/dist/biz/index.cjs +2 -0
- package/dist/biz/index.mjs +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @tidbcloud/uikit
|
|
2
2
|
|
|
3
|
+
## 2.4.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat(DateTimePicker): implement useDateTimePicker ([#577](https://github.com/tidbcloud/tidbcloud-uikit/pull/577))
|
|
8
|
+
- refine(AppShell): add data attribute support to NavItemBase component ([#575](https://github.com/tidbcloud/tidbcloud-uikit/pull/575))
|
|
9
|
+
- feat(DateTimePicker): add footer prop for custom content in DateTimePicker component ([#574](https://github.com/tidbcloud/tidbcloud-uikit/pull/574))
|
|
10
|
+
- feat(DateTimePicker): implement useDateTimePicker ([#577](https://github.com/tidbcloud/tidbcloud-uikit/pull/577))
|
|
11
|
+
- refine(AppShell): add data attribute support to NavItemBase component ([#575](https://github.com/tidbcloud/tidbcloud-uikit/pull/575))
|
|
12
|
+
- feat(DateTimePicker): add footer prop for custom content in DateTimePicker component ([#574](https://github.com/tidbcloud/tidbcloud-uikit/pull/574))
|
|
13
|
+
|
|
3
14
|
## 2.4.15
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const ahooks = require("ahooks");
|
|
4
|
+
const React = require("react");
|
|
5
|
+
const dayjs = require("../../utils/dayjs.cjs");
|
|
6
|
+
const useDateTimePicker = ({
|
|
7
|
+
value,
|
|
8
|
+
onChange,
|
|
9
|
+
startDate = dayjs.dayjs().subtract(10, "year").toDate(),
|
|
10
|
+
endDate = dayjs.dayjs().add(10, "year").toDate(),
|
|
11
|
+
utcOffset = dayjs.dayjs().utcOffset(),
|
|
12
|
+
format,
|
|
13
|
+
formatter
|
|
14
|
+
}) => {
|
|
15
|
+
const convertToLocal = ahooks.useMemoizedFn((date) => {
|
|
16
|
+
const targetTime = dayjs.dayjs(date).utcOffset(utcOffset);
|
|
17
|
+
const converted = targetTime.utcOffset(dayjs.dayjs().utcOffset(), true);
|
|
18
|
+
return new Date(converted.format());
|
|
19
|
+
});
|
|
20
|
+
const convertFromLocal = ahooks.useMemoizedFn((date) => {
|
|
21
|
+
const targetTime = dayjs.dayjs(date).utcOffset(utcOffset, true);
|
|
22
|
+
return new Date(targetTime.format());
|
|
23
|
+
});
|
|
24
|
+
const displayValue = React.useMemo(() => {
|
|
25
|
+
if (!value) return void 0;
|
|
26
|
+
return convertToLocal(value);
|
|
27
|
+
}, [value, convertToLocal]);
|
|
28
|
+
const displayStartDate = React.useMemo(() => {
|
|
29
|
+
return convertToLocal(startDate);
|
|
30
|
+
}, [startDate, convertToLocal]);
|
|
31
|
+
const displayEndDate = React.useMemo(() => {
|
|
32
|
+
return convertToLocal(endDate);
|
|
33
|
+
}, [endDate, convertToLocal]);
|
|
34
|
+
const handleChange = ahooks.useMemoizedFn((localTime) => {
|
|
35
|
+
const targetTime = convertFromLocal(localTime);
|
|
36
|
+
onChange == null ? void 0 : onChange(targetTime);
|
|
37
|
+
});
|
|
38
|
+
return {
|
|
39
|
+
value: displayValue,
|
|
40
|
+
onChange: handleChange,
|
|
41
|
+
startDate: displayStartDate,
|
|
42
|
+
endDate: displayEndDate,
|
|
43
|
+
formatter: (val) => {
|
|
44
|
+
const targetTime = dayjs.dayjs(val).utcOffset(utcOffset, true);
|
|
45
|
+
return formatter ? formatter(new Date(targetTime.format())) : targetTime.format(format);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
exports.useDateTimePicker = useDateTimePicker;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DateTimePickerProps } from './types.cjs';
|
|
2
|
+
export interface UseDateTimePickerProps extends Pick<DateTimePickerProps, 'value' | 'onChange' | 'startDate' | 'endDate' | 'format' | 'formatter'> {
|
|
3
|
+
/**
|
|
4
|
+
* the UTC offset in minutes.
|
|
5
|
+
* User selected time will be treated as time in that timezone
|
|
6
|
+
* If the input is less than 16 and greater than -16, it will interpret your input as hours instead.
|
|
7
|
+
* It also can be a string like '+09:00' or '-01:00'
|
|
8
|
+
* @see https://day.js.org/docs/en/manipulate/utc-offset
|
|
9
|
+
*/
|
|
10
|
+
utcOffset?: number | string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook for timezone-aware DateTimePicker
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const Component = () => {
|
|
18
|
+
* const [value, setValue] = useState<Date>()
|
|
19
|
+
*
|
|
20
|
+
* // UTC+8 timezone (480 minutes)
|
|
21
|
+
* const utcOffset = 480
|
|
22
|
+
*
|
|
23
|
+
* // Use hook to convert timezone
|
|
24
|
+
* const dateTimePickerProps = useDateTimePicker({
|
|
25
|
+
* value,
|
|
26
|
+
* onChange: setValue,
|
|
27
|
+
* startDate: dayjs().subtract(1, 'day').toDate(),
|
|
28
|
+
* endDate: dayjs().add(1, 'day').toDate(),
|
|
29
|
+
* utcOffset
|
|
30
|
+
* })
|
|
31
|
+
*
|
|
32
|
+
* // Use spread operator to pass converted props
|
|
33
|
+
* return <DateTimePicker {...dateTimePickerProps} />
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const useDateTimePicker: ({ value, onChange, startDate, endDate, utcOffset, format, formatter }: UseDateTimePickerProps) => Pick<DateTimePickerProps, "value" | "onChange" | "startDate" | "endDate" | "formatter">;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DateTimePickerProps } from './types.mjs';
|
|
2
|
+
export interface UseDateTimePickerProps extends Pick<DateTimePickerProps, 'value' | 'onChange' | 'startDate' | 'endDate' | 'format' | 'formatter'> {
|
|
3
|
+
/**
|
|
4
|
+
* the UTC offset in minutes.
|
|
5
|
+
* User selected time will be treated as time in that timezone
|
|
6
|
+
* If the input is less than 16 and greater than -16, it will interpret your input as hours instead.
|
|
7
|
+
* It also can be a string like '+09:00' or '-01:00'
|
|
8
|
+
* @see https://day.js.org/docs/en/manipulate/utc-offset
|
|
9
|
+
*/
|
|
10
|
+
utcOffset?: number | string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Hook for timezone-aware DateTimePicker
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const Component = () => {
|
|
18
|
+
* const [value, setValue] = useState<Date>()
|
|
19
|
+
*
|
|
20
|
+
* // UTC+8 timezone (480 minutes)
|
|
21
|
+
* const utcOffset = 480
|
|
22
|
+
*
|
|
23
|
+
* // Use hook to convert timezone
|
|
24
|
+
* const dateTimePickerProps = useDateTimePicker({
|
|
25
|
+
* value,
|
|
26
|
+
* onChange: setValue,
|
|
27
|
+
* startDate: dayjs().subtract(1, 'day').toDate(),
|
|
28
|
+
* endDate: dayjs().add(1, 'day').toDate(),
|
|
29
|
+
* utcOffset
|
|
30
|
+
* })
|
|
31
|
+
*
|
|
32
|
+
* // Use spread operator to pass converted props
|
|
33
|
+
* return <DateTimePicker {...dateTimePickerProps} />
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export declare const useDateTimePicker: ({ value, onChange, startDate, endDate, utcOffset, format, formatter }: UseDateTimePickerProps) => Pick<DateTimePickerProps, "value" | "onChange" | "startDate" | "endDate" | "formatter">;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useMemoizedFn } from "ahooks";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { dayjs } from "../../utils/dayjs.mjs";
|
|
4
|
+
const useDateTimePicker = ({
|
|
5
|
+
value,
|
|
6
|
+
onChange,
|
|
7
|
+
startDate = dayjs().subtract(10, "year").toDate(),
|
|
8
|
+
endDate = dayjs().add(10, "year").toDate(),
|
|
9
|
+
utcOffset = dayjs().utcOffset(),
|
|
10
|
+
format,
|
|
11
|
+
formatter
|
|
12
|
+
}) => {
|
|
13
|
+
const convertToLocal = useMemoizedFn((date) => {
|
|
14
|
+
const targetTime = dayjs(date).utcOffset(utcOffset);
|
|
15
|
+
const converted = targetTime.utcOffset(dayjs().utcOffset(), true);
|
|
16
|
+
return new Date(converted.format());
|
|
17
|
+
});
|
|
18
|
+
const convertFromLocal = useMemoizedFn((date) => {
|
|
19
|
+
const targetTime = dayjs(date).utcOffset(utcOffset, true);
|
|
20
|
+
return new Date(targetTime.format());
|
|
21
|
+
});
|
|
22
|
+
const displayValue = useMemo(() => {
|
|
23
|
+
if (!value) return void 0;
|
|
24
|
+
return convertToLocal(value);
|
|
25
|
+
}, [value, convertToLocal]);
|
|
26
|
+
const displayStartDate = useMemo(() => {
|
|
27
|
+
return convertToLocal(startDate);
|
|
28
|
+
}, [startDate, convertToLocal]);
|
|
29
|
+
const displayEndDate = useMemo(() => {
|
|
30
|
+
return convertToLocal(endDate);
|
|
31
|
+
}, [endDate, convertToLocal]);
|
|
32
|
+
const handleChange = useMemoizedFn((localTime) => {
|
|
33
|
+
const targetTime = convertFromLocal(localTime);
|
|
34
|
+
onChange == null ? void 0 : onChange(targetTime);
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
value: displayValue,
|
|
38
|
+
onChange: handleChange,
|
|
39
|
+
startDate: displayStartDate,
|
|
40
|
+
endDate: displayEndDate,
|
|
41
|
+
formatter: (val) => {
|
|
42
|
+
const targetTime = dayjs(val).utcOffset(utcOffset, true);
|
|
43
|
+
return formatter ? formatter(new Date(targetTime.format())) : targetTime.format(format);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
useDateTimePicker
|
|
49
|
+
};
|
|
@@ -9,9 +9,8 @@ const index = require("../../icons/index.cjs");
|
|
|
9
9
|
;/* empty css */
|
|
10
10
|
;/* empty css */
|
|
11
11
|
;/* empty css */
|
|
12
|
-
const index$1 = require("../../primitive/Typography/index.cjs");
|
|
13
12
|
const dayjs = require("../../utils/dayjs.cjs");
|
|
14
|
-
const helpers = require("../TimeRangePicker/helpers.cjs");
|
|
13
|
+
const helpers$1 = require("../TimeRangePicker/helpers.cjs");
|
|
15
14
|
const TimeScollerPicker = require("./TimeScollerPicker.cjs");
|
|
16
15
|
const useDisclosure = require("../../node_modules/.pnpm/@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-disclosure/use-disclosure.cjs");
|
|
17
16
|
const useUncontrolled = require("../../node_modules/.pnpm/@mantine_hooks@7.15.2_react@18.3.1/node_modules/@mantine/hooks/esm/use-uncontrolled/use-uncontrolled.cjs");
|
|
@@ -27,7 +26,7 @@ const TimeInput = require("../../node_modules/.pnpm/@mantine_dates@7.15.2_@manti
|
|
|
27
26
|
const Flex = require("../../node_modules/.pnpm/@mantine_core@7.15.2_patch_hash_jclkxeaefn6uz54h34k3r3yjsq_@mantine_hooks@7.15.2_react@18.3.1_szqfuioo5damkjdixckhzmwycq/node_modules/@mantine/core/esm/components/Flex/Flex.cjs");
|
|
28
27
|
const DateTimePicker = ({
|
|
29
28
|
placeholder = "Select time",
|
|
30
|
-
format = helpers.DEFAULT_TIME_FORMAT,
|
|
29
|
+
format = helpers$1.DEFAULT_TIME_FORMAT,
|
|
31
30
|
formatter,
|
|
32
31
|
defaultValue,
|
|
33
32
|
value,
|
|
@@ -38,7 +37,8 @@ const DateTimePicker = ({
|
|
|
38
37
|
withinPortal = true,
|
|
39
38
|
sx,
|
|
40
39
|
loading = false,
|
|
41
|
-
size
|
|
40
|
+
size,
|
|
41
|
+
footer
|
|
42
42
|
}) => {
|
|
43
43
|
const [opened, { close, open }] = useDisclosure.useDisclosure(false);
|
|
44
44
|
const [currentValue, setCurrentValue] = useUncontrolled.useUncontrolled({
|
|
@@ -69,7 +69,7 @@ const DateTimePicker = ({
|
|
|
69
69
|
}, 20);
|
|
70
70
|
});
|
|
71
71
|
const inputStr = formatter ? formatter(currentValue.toDate()) : currentValue.format(format);
|
|
72
|
-
|
|
72
|
+
React.useMemo(() => {
|
|
73
73
|
const utcOffset = currentValue.utcOffset();
|
|
74
74
|
const h = Math.floor(utcOffset / 60);
|
|
75
75
|
const m = utcOffset % 60;
|
|
@@ -214,12 +214,10 @@ const DateTimePicker = ({
|
|
|
214
214
|
)
|
|
215
215
|
] })
|
|
216
216
|
] }),
|
|
217
|
-
/* @__PURE__ */ jsxRuntime.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$1.Typography, { fw: 600, component: "span", children: utcStr })
|
|
222
|
-
] }) })
|
|
217
|
+
footer && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
218
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider.Divider, { mx: -16 }),
|
|
219
|
+
footer
|
|
220
|
+
] })
|
|
223
221
|
] }) })
|
|
224
222
|
]
|
|
225
223
|
}
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
import { MantineSize, PopoverProps,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
/**
|
|
9
|
-
* The format of the date string.
|
|
10
|
-
* @default 'YYYY-MM-DD HH:mm:ss'
|
|
11
|
-
*/
|
|
12
|
-
format?: string;
|
|
13
|
-
/**
|
|
14
|
-
* A function to format the date in the input
|
|
15
|
-
* If provided, `format` prop will be ignored.
|
|
16
|
-
*/
|
|
17
|
-
formatter?: (val: Date) => string;
|
|
18
|
-
/**
|
|
19
|
-
* This props is deprecated, use `formatter` instead to display the time in any timezone.
|
|
20
|
-
* @deprecated
|
|
21
|
-
*/
|
|
22
|
-
utcOffset?: number;
|
|
23
|
-
defaultValue?: Date;
|
|
24
|
-
value?: Date;
|
|
25
|
-
startDate?: Date;
|
|
26
|
-
endDate?: Date;
|
|
27
|
-
onChange?: (val: Date) => void;
|
|
28
|
-
disable?: boolean;
|
|
29
|
-
withinPortal?: boolean;
|
|
30
|
-
loading?: boolean;
|
|
31
|
-
size?: MantineSize;
|
|
32
|
-
}
|
|
33
|
-
export declare const DateTimePicker: ({ placeholder, format, formatter, defaultValue, value, startDate, endDate, onChange, disable, withinPortal, sx, loading, size }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
1
|
+
import { MantineSize, PopoverProps, TimeInputProps } from '../../primitive/index.cjs';
|
|
2
|
+
import { DateTimePickerProps } from './types.cjs';
|
|
3
|
+
export type { DateTimePickerProps } from './types.cjs';
|
|
4
|
+
export { useDateTimePicker } from './helpers.cjs';
|
|
5
|
+
export declare const DateTimePicker: ({ placeholder, format, formatter, defaultValue, value, startDate, endDate, onChange, disable, withinPortal, sx, loading, size, footer }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
34
6
|
export interface TimePickerProps extends Omit<TimeInputProps, 'value' | 'onChange' | 'defaultValue'>, Pick<PopoverProps, 'withinPortal' | 'withArrow' | 'position' | 'shadow'> {
|
|
35
7
|
defaultValue?: string;
|
|
36
8
|
/**
|
|
@@ -1,36 +1,8 @@
|
|
|
1
|
-
import { MantineSize, PopoverProps,
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
/**
|
|
9
|
-
* The format of the date string.
|
|
10
|
-
* @default 'YYYY-MM-DD HH:mm:ss'
|
|
11
|
-
*/
|
|
12
|
-
format?: string;
|
|
13
|
-
/**
|
|
14
|
-
* A function to format the date in the input
|
|
15
|
-
* If provided, `format` prop will be ignored.
|
|
16
|
-
*/
|
|
17
|
-
formatter?: (val: Date) => string;
|
|
18
|
-
/**
|
|
19
|
-
* This props is deprecated, use `formatter` instead to display the time in any timezone.
|
|
20
|
-
* @deprecated
|
|
21
|
-
*/
|
|
22
|
-
utcOffset?: number;
|
|
23
|
-
defaultValue?: Date;
|
|
24
|
-
value?: Date;
|
|
25
|
-
startDate?: Date;
|
|
26
|
-
endDate?: Date;
|
|
27
|
-
onChange?: (val: Date) => void;
|
|
28
|
-
disable?: boolean;
|
|
29
|
-
withinPortal?: boolean;
|
|
30
|
-
loading?: boolean;
|
|
31
|
-
size?: MantineSize;
|
|
32
|
-
}
|
|
33
|
-
export declare const DateTimePicker: ({ placeholder, format, formatter, defaultValue, value, startDate, endDate, onChange, disable, withinPortal, sx, loading, size }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
1
|
+
import { MantineSize, PopoverProps, TimeInputProps } from '../../primitive/index.mjs';
|
|
2
|
+
import { DateTimePickerProps } from './types.mjs';
|
|
3
|
+
export type { DateTimePickerProps } from './types.mjs';
|
|
4
|
+
export { useDateTimePicker } from './helpers.mjs';
|
|
5
|
+
export declare const DateTimePicker: ({ placeholder, format, formatter, defaultValue, value, startDate, endDate, onChange, disable, withinPortal, sx, loading, size, footer }: DateTimePickerProps) => import("react/jsx-runtime.js").JSX.Element;
|
|
34
6
|
export interface TimePickerProps extends Omit<TimeInputProps, 'value' | 'onChange' | 'defaultValue'>, Pick<PopoverProps, 'withinPortal' | 'withArrow' | 'position' | 'shadow'> {
|
|
35
7
|
defaultValue?: string;
|
|
36
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemoizedFn } from "ahooks";
|
|
3
3
|
import { useState, useMemo } from "react";
|
|
4
4
|
import { IconClock } from "../../icons/index.mjs";
|
|
@@ -7,7 +7,6 @@ import { IconClock } from "../../icons/index.mjs";
|
|
|
7
7
|
/* empty css */
|
|
8
8
|
/* empty css */
|
|
9
9
|
/* empty css */
|
|
10
|
-
import { Typography } from "../../primitive/Typography/index.mjs";
|
|
11
10
|
import { dayjs } from "../../utils/dayjs.mjs";
|
|
12
11
|
import { DEFAULT_TIME_FORMAT } from "../TimeRangePicker/helpers.mjs";
|
|
13
12
|
import { TimeScollerPicker } from "./TimeScollerPicker.mjs";
|
|
@@ -36,7 +35,8 @@ const DateTimePicker = ({
|
|
|
36
35
|
withinPortal = true,
|
|
37
36
|
sx,
|
|
38
37
|
loading = false,
|
|
39
|
-
size
|
|
38
|
+
size,
|
|
39
|
+
footer
|
|
40
40
|
}) => {
|
|
41
41
|
const [opened, { close, open }] = useDisclosure(false);
|
|
42
42
|
const [currentValue, setCurrentValue] = useUncontrolled({
|
|
@@ -67,7 +67,7 @@ const DateTimePicker = ({
|
|
|
67
67
|
}, 20);
|
|
68
68
|
});
|
|
69
69
|
const inputStr = formatter ? formatter(currentValue.toDate()) : currentValue.format(format);
|
|
70
|
-
|
|
70
|
+
useMemo(() => {
|
|
71
71
|
const utcOffset = currentValue.utcOffset();
|
|
72
72
|
const h = Math.floor(utcOffset / 60);
|
|
73
73
|
const m = utcOffset % 60;
|
|
@@ -212,12 +212,10 @@ const DateTimePicker = ({
|
|
|
212
212
|
)
|
|
213
213
|
] })
|
|
214
214
|
] }),
|
|
215
|
-
/* @__PURE__ */
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
/* @__PURE__ */ jsx(Typography, { fw: 600, component: "span", children: utcStr })
|
|
220
|
-
] }) })
|
|
215
|
+
footer && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
216
|
+
/* @__PURE__ */ jsx(Divider, { mx: -16 }),
|
|
217
|
+
footer
|
|
218
|
+
] })
|
|
221
219
|
] }) })
|
|
222
220
|
]
|
|
223
221
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MantineSize, TextInputProps } from '../../primitive/index.cjs';
|
|
2
|
+
export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onChange' | 'defaultValue'> {
|
|
3
|
+
/**
|
|
4
|
+
* The placeholder of the input.
|
|
5
|
+
* @default 'Select time'
|
|
6
|
+
*/
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The format of the date string.
|
|
10
|
+
* @default 'YYYY-MM-DD HH:mm:ss'
|
|
11
|
+
*/
|
|
12
|
+
format?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A function to format the date in the input
|
|
15
|
+
* If provided, `format` prop will be ignored.
|
|
16
|
+
*/
|
|
17
|
+
formatter?: (val: Date) => string;
|
|
18
|
+
/**
|
|
19
|
+
* This props is deprecated, use `formatter` instead to display the time in any timezone.
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
22
|
+
utcOffset?: number;
|
|
23
|
+
defaultValue?: Date;
|
|
24
|
+
value?: Date;
|
|
25
|
+
startDate?: Date;
|
|
26
|
+
endDate?: Date;
|
|
27
|
+
onChange?: (val: Date) => void;
|
|
28
|
+
disable?: boolean;
|
|
29
|
+
withinPortal?: boolean;
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
size?: MantineSize;
|
|
32
|
+
footer?: React.ReactNode;
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { MantineSize, TextInputProps } from '../../primitive/index.mjs';
|
|
2
|
+
export interface DateTimePickerProps extends Omit<TextInputProps, 'value' | 'onChange' | 'defaultValue'> {
|
|
3
|
+
/**
|
|
4
|
+
* The placeholder of the input.
|
|
5
|
+
* @default 'Select time'
|
|
6
|
+
*/
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The format of the date string.
|
|
10
|
+
* @default 'YYYY-MM-DD HH:mm:ss'
|
|
11
|
+
*/
|
|
12
|
+
format?: string;
|
|
13
|
+
/**
|
|
14
|
+
* A function to format the date in the input
|
|
15
|
+
* If provided, `format` prop will be ignored.
|
|
16
|
+
*/
|
|
17
|
+
formatter?: (val: Date) => string;
|
|
18
|
+
/**
|
|
19
|
+
* This props is deprecated, use `formatter` instead to display the time in any timezone.
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
22
|
+
utcOffset?: number;
|
|
23
|
+
defaultValue?: Date;
|
|
24
|
+
value?: Date;
|
|
25
|
+
startDate?: Date;
|
|
26
|
+
endDate?: Date;
|
|
27
|
+
onChange?: (val: Date) => void;
|
|
28
|
+
disable?: boolean;
|
|
29
|
+
withinPortal?: boolean;
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
size?: MantineSize;
|
|
32
|
+
footer?: React.ReactNode;
|
|
33
|
+
}
|
package/dist/biz/index.cjs
CHANGED
|
@@ -39,6 +39,7 @@ const SegmentControl = require("./Form/SegmentControl.cjs");
|
|
|
39
39
|
const ProMultiSelect = require("./Form/ProMultiSelect.cjs");
|
|
40
40
|
const LegacyPageShell = require("./PageShell/LegacyPageShell.cjs");
|
|
41
41
|
const helpers$1 = require("./TimeRangePicker/helpers.cjs");
|
|
42
|
+
const helpers$2 = require("./DateTimePicker/helpers.cjs");
|
|
42
43
|
const AppShell = require("./AppShell/AppShell.cjs");
|
|
43
44
|
const AppPageShell = require("./AppShell/AppPageShell.cjs");
|
|
44
45
|
const NavMenuPortal = require("./AppShell/navbar/context/NavMenuPortal.cjs");
|
|
@@ -212,6 +213,7 @@ exports.toTimeRangeValue = helpers$1.toTimeRangeValue;
|
|
|
212
213
|
exports.toURLTimeRange = helpers$1.toURLTimeRange;
|
|
213
214
|
exports.urlToTimeRange = helpers$1.urlToTimeRange;
|
|
214
215
|
exports.urlToTimeRangeValue = helpers$1.urlToTimeRangeValue;
|
|
216
|
+
exports.useDateTimePicker = helpers$2.useDateTimePicker;
|
|
215
217
|
exports.AppShell = AppShell.AppShell;
|
|
216
218
|
exports.AppPageShell = AppPageShell.AppPageShell;
|
|
217
219
|
exports.NavMenuPortal = NavMenuPortal.NavMenuPortal;
|
package/dist/biz/index.mjs
CHANGED
|
@@ -37,6 +37,7 @@ import { FormSegmentedControl } from "./Form/SegmentControl.mjs";
|
|
|
37
37
|
import { FormProMultiSelect } from "./Form/ProMultiSelect.mjs";
|
|
38
38
|
import { PageShell } from "./PageShell/LegacyPageShell.mjs";
|
|
39
39
|
import { DEFAULT_QUICK_RANGES, DEFAULT_TIME_FORMAT, DEFAULT_TIME_FORMAT_WITH_TIMEZONE, DEFAULT_TIME_RANGE, addOffsetUTC, formatDuration, fromTimeRangeValue, getUTCString, timeFormatter, toTimeRangeValue, toURLTimeRange, urlToTimeRange, urlToTimeRangeValue } from "./TimeRangePicker/helpers.mjs";
|
|
40
|
+
import { useDateTimePicker } from "./DateTimePicker/helpers.mjs";
|
|
40
41
|
import { AppShell } from "./AppShell/AppShell.mjs";
|
|
41
42
|
import { AppPageShell } from "./AppShell/AppPageShell.mjs";
|
|
42
43
|
import { NavMenuPortal } from "./AppShell/navbar/context/NavMenuPortal.mjs";
|
|
@@ -213,6 +214,7 @@ export {
|
|
|
213
214
|
toURLTimeRange,
|
|
214
215
|
urlToTimeRange,
|
|
215
216
|
urlToTimeRangeValue,
|
|
217
|
+
useDateTimePicker,
|
|
216
218
|
useHookFormContext,
|
|
217
219
|
useMRT_ColumnVirtualizer,
|
|
218
220
|
useMRT_Effects,
|