@canlooks/can-ui 0.0.88 → 0.0.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/calendar/calendar.d.ts +5 -2
- package/dist/cjs/components/calendar/calendar.js +3 -1
- package/dist/cjs/components/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/calendar/panelDates.d.ts +1 -1
- package/dist/cjs/components/calendar/panelDates.js +5 -2
- package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
- package/dist/cjs/components/curd/curd.js +14 -14
- package/dist/cjs/components/curd/curd.style.js +1 -1
- package/dist/cjs/components/dataGrid/dataGrid.style.js +1 -0
- package/dist/cjs/components/dateTimePicker/dateTimePicker.js +2 -2
- package/dist/cjs/components/dateTimePicker/timer.d.ts +1 -1
- package/dist/cjs/components/dateTimePicker/timer.js +16 -8
- package/dist/cjs/components/popper/popperContext.d.ts +1 -1
- package/dist/cjs/components/popper/popperContext.js +11 -9
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/cjs/extensions/reactiveForm/reactiveFormItem.js +1 -0
- package/dist/esm/components/calendar/calendar.d.ts +5 -2
- package/dist/esm/components/calendar/calendar.js +3 -1
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/calendar/panelDates.d.ts +1 -1
- package/dist/esm/components/calendar/panelDates.js +5 -2
- package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
- package/dist/esm/components/curd/curd.js +14 -14
- package/dist/esm/components/curd/curd.style.js +1 -1
- package/dist/esm/components/dataGrid/dataGrid.style.js +1 -0
- package/dist/esm/components/dateTimePicker/dateTimePicker.js +2 -2
- package/dist/esm/components/dateTimePicker/timer.d.ts +1 -1
- package/dist/esm/components/dateTimePicker/timer.js +15 -8
- package/dist/esm/components/popper/popperContext.d.ts +1 -1
- package/dist/esm/components/popper/popperContext.js +12 -10
- package/dist/esm/components/status/status.d.ts +6 -6
- package/dist/esm/extensions/reactiveForm/reactiveFormItem.js +1 -0
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +1 -1
- package/documentation/dist/assets/index-DvrKS6Tv.js +0 -7747
- package/documentation/dist/atom-one-dark.min.css +0 -1
- package/documentation/dist/components/accordion.md +0 -38
- package/documentation/dist/components/actionSheet.md +0 -49
- package/documentation/dist/components/alert.md +0 -38
- package/documentation/dist/components/anchorList.md +0 -36
- package/documentation/dist/components/autocomplete.md +0 -68
- package/documentation/dist/components/avatar.md +0 -79
- package/documentation/dist/components/badge.md +0 -33
- package/documentation/dist/components/bottomNavigation.md +0 -39
- package/documentation/dist/components/breadcrumb.md +0 -28
- package/documentation/dist/components/bubbleConfirm.md +0 -34
- package/documentation/dist/components/button.md +0 -62
- package/documentation/dist/components/card.md +0 -30
- package/documentation/dist/components/cascade.md +0 -48
- package/documentation/dist/components/checkbox.md +0 -36
- package/documentation/dist/components/colorPicker.md +0 -27
- package/documentation/dist/components/contextMenu.md +0 -27
- package/documentation/dist/components/counter.md +0 -29
- package/documentation/dist/components/dataGrid.md +0 -112
- package/documentation/dist/components/dateTimePicker.md +0 -35
- package/documentation/dist/components/dateTimeRangePicker.md +0 -36
- package/documentation/dist/components/descriptions.md +0 -35
- package/documentation/dist/components/dialog.md +0 -56
- package/documentation/dist/components/divider.md +0 -26
- package/documentation/dist/components/drawer.md +0 -40
- package/documentation/dist/components/flex.md +0 -20
- package/documentation/dist/components/form.md +0 -131
- package/documentation/dist/components/formDialog.md +0 -36
- package/documentation/dist/components/grid.md +0 -34
- package/documentation/dist/components/highlight.md +0 -26
- package/documentation/dist/components/image.md +0 -90
- package/documentation/dist/components/input.md +0 -39
- package/documentation/dist/components/loading.md +0 -46
- package/documentation/dist/components/menu.md +0 -85
- package/documentation/dist/components/pagination.md +0 -38
- package/documentation/dist/components/pickerDialog.md +0 -56
- package/documentation/dist/components/placeholder.md +0 -30
- package/documentation/dist/components/progress.md +0 -43
- package/documentation/dist/components/radio.md +0 -37
- package/documentation/dist/components/rating.md +0 -35
- package/documentation/dist/components/resizable.md +0 -41
- package/documentation/dist/components/scrollbar.md +0 -31
- package/documentation/dist/components/segmented.md +0 -57
- package/documentation/dist/components/select.md +0 -30
- package/documentation/dist/components/skeleton.md +0 -26
- package/documentation/dist/components/slidableActions.md +0 -53
- package/documentation/dist/guide/appComponent.md +0 -30
- package/documentation/dist/guide/globalMethods.md +0 -238
- package/documentation/dist/guide/icon.md +0 -57
- package/documentation/dist/guide/introduction.md +0 -2
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +0 -23
- package/documentation/dist/guide/theme.md +0 -249
- package/documentation/dist/index.html +0 -13
- package/documentation/dist/logo.png +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Size } from '../../types';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
4
4
|
import { FlexProps } from '../flex';
|
|
5
|
+
import { ButtonProps } from '../button';
|
|
5
6
|
export type ViewLevel = 'date' | 'month' | 'year';
|
|
6
7
|
type SharedProps = {
|
|
7
8
|
min?: Dayjs;
|
|
@@ -9,6 +10,8 @@ type SharedProps = {
|
|
|
9
10
|
disabledDates?: (date: Dayjs) => boolean;
|
|
10
11
|
/** 是否显示`回今天`按钮,默认为`true` */
|
|
11
12
|
showToday?: boolean;
|
|
13
|
+
todayButtonText?: ReactNode;
|
|
14
|
+
todayButtonProps?: ButtonProps;
|
|
12
15
|
/** @private */
|
|
13
16
|
_defaultNull?: boolean;
|
|
14
17
|
};
|
|
@@ -28,5 +31,5 @@ export interface PanelProps extends SharedProps {
|
|
|
28
31
|
setViewType: Dispatch<SetStateAction<'date' | 'month' | 'year'>>;
|
|
29
32
|
onSelected(newValue: Dayjs): void;
|
|
30
33
|
}
|
|
31
|
-
export declare const Calendar: ({ viewLevel, showToday, size, defaultValue, min, max, disabledDates, value, onChange, _defaultNull, ...props }: CalendarProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const Calendar: ({ viewLevel, showToday, todayButtonText, todayButtonProps, size, defaultValue, min, max, disabledDates, value, onChange, _defaultNull, ...props }: CalendarProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
32
35
|
export {};
|
|
@@ -11,7 +11,7 @@ const calendar_style_1 = require("./calendar.style");
|
|
|
11
11
|
const flex_1 = require("../flex");
|
|
12
12
|
const panelYear_1 = require("./panelYear");
|
|
13
13
|
const panelMonth_1 = require("./panelMonth");
|
|
14
|
-
const Calendar = ({ viewLevel = 'date', showToday = true, size = 'medium', defaultValue = null, min, max, disabledDates, value, onChange, _defaultNull, ...props }) => {
|
|
14
|
+
const Calendar = ({ viewLevel = 'date', showToday = true, todayButtonText = '回今天', todayButtonProps, size = 'medium', defaultValue = null, min, max, disabledDates, value, onChange, _defaultNull, ...props }) => {
|
|
15
15
|
const [innerValue, setInnerValue] = (0, utils_1.useControlled)(defaultValue, value, onChange);
|
|
16
16
|
const [viewType, setViewType] = (0, react_1.useState)(viewLevel);
|
|
17
17
|
const [innerD, setInnerD] = (0, react_1.useState)(() => innerValue.current ?? (0, dayjs_1.default)().startOf('date'));
|
|
@@ -34,6 +34,8 @@ const Calendar = ({ viewLevel = 'date', showToday = true, size = 'medium', defau
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
showToday,
|
|
37
|
+
todayButtonText,
|
|
38
|
+
todayButtonProps,
|
|
37
39
|
_defaultNull
|
|
38
40
|
};
|
|
39
41
|
const renderPanel = () => {
|
|
@@ -16,128 +16,128 @@ exports.classes = (0, utils_1.defineInnerClasses)('calendar', [
|
|
|
16
16
|
'yearItem',
|
|
17
17
|
'foot'
|
|
18
18
|
]);
|
|
19
|
-
exports.style = (0, utils_1.defineCss)(({ divider, text, spacing }) => (0, react_1.css) `
|
|
20
|
-
.${exports.classes.head} {
|
|
21
|
-
height: 40px;
|
|
22
|
-
display: flex;
|
|
23
|
-
align-items: center;
|
|
24
|
-
justify-content: space-between;
|
|
25
|
-
border-bottom: 1px solid ${divider};
|
|
26
|
-
padding: 0 ${menuItem_style_1.menuListPadding}px;
|
|
27
|
-
position: relative;
|
|
28
|
-
|
|
29
|
-
.${exports.classes.headSide} {
|
|
30
|
-
z-index: 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.${exports.classes.headControl} {
|
|
34
|
-
color: ${text.placeholder};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.${exports.classes.headCenter} {
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
position: absolute;
|
|
42
|
-
inset: 0;
|
|
43
|
-
|
|
44
|
-
.${exports.classes.headButton} {
|
|
45
|
-
font-weight: bold;
|
|
46
|
-
color: ${text.primary};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.${exports.classes.body} {
|
|
52
|
-
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
53
|
-
display: grid;
|
|
54
|
-
place-items: center;
|
|
55
|
-
|
|
56
|
-
&[data-view-type=date] {
|
|
57
|
-
font-size: ${13 / 14}em;
|
|
58
|
-
grid-template-columns: repeat(7, 36px);
|
|
59
|
-
grid-template-rows: repeat(7, 36px);
|
|
60
|
-
|
|
61
|
-
.${exports.classes.dateItem} {
|
|
62
|
-
width: 24px;
|
|
63
|
-
height: 24px;
|
|
64
|
-
|
|
65
|
-
&:not([data-variant=filled]) {
|
|
66
|
-
color: ${text.primary};
|
|
67
|
-
border-color: ${text.disabled};
|
|
68
|
-
|
|
69
|
-
&[data-other-month=true] {
|
|
70
|
-
color: ${text.placeholder};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
&:disabled {
|
|
75
|
-
width: 100%;
|
|
76
|
-
border-radius: 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
82
|
-
grid-template-columns: repeat(3, 84px);
|
|
83
|
-
grid-template-rows: repeat(4, 63px);
|
|
84
|
-
|
|
85
|
-
.${exports.classes.monthItem},
|
|
86
|
-
.${exports.classes.yearItem} {
|
|
87
|
-
width: 72px;
|
|
88
|
-
padding-inline: 0;
|
|
89
|
-
|
|
90
|
-
&:not([data-variant=filled]) {
|
|
91
|
-
color: ${text.primary};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
&[data-size=small] {
|
|
98
|
-
.${exports.classes.body} {
|
|
99
|
-
&[data-view-type=date] {
|
|
100
|
-
grid-template-columns: repeat(7, 30px);
|
|
101
|
-
grid-template-rows: repeat(7, 30px);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
105
|
-
grid-template-columns: repeat(3, 70px);
|
|
106
|
-
grid-template-rows: repeat(4, 52.5px);
|
|
107
|
-
|
|
108
|
-
.${exports.classes.monthItem},
|
|
109
|
-
.${exports.classes.yearItem} {
|
|
110
|
-
width: 60px;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
&[data-size=large] {
|
|
117
|
-
.${exports.classes.body} {
|
|
118
|
-
&[data-view-type=date] {
|
|
119
|
-
font-size: 1em;
|
|
120
|
-
grid-template-columns: repeat(7, 42px);
|
|
121
|
-
grid-template-rows: repeat(7, 42px);
|
|
122
|
-
|
|
123
|
-
.${exports.classes.dateItem} {
|
|
124
|
-
width: 32px;
|
|
125
|
-
height: 32px;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
&[data-view-type=month], &[data-view-type=year] {
|
|
130
|
-
grid-template-columns: repeat(3, 98px);
|
|
131
|
-
grid-template-rows: repeat(4, 73.5px);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.${exports.classes.foot} {
|
|
137
|
-
height: 41px;
|
|
138
|
-
display: flex;
|
|
139
|
-
align-items: center;
|
|
140
|
-
justify-content: center;
|
|
141
|
-
border-top: 1px solid ${divider};
|
|
142
|
-
}
|
|
19
|
+
exports.style = (0, utils_1.defineCss)(({ divider, text, spacing }) => (0, react_1.css) `
|
|
20
|
+
.${exports.classes.head} {
|
|
21
|
+
height: 40px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
border-bottom: 1px solid ${divider};
|
|
26
|
+
padding: 0 ${menuItem_style_1.menuListPadding}px;
|
|
27
|
+
position: relative;
|
|
28
|
+
|
|
29
|
+
.${exports.classes.headSide} {
|
|
30
|
+
z-index: 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.${exports.classes.headControl} {
|
|
34
|
+
color: ${text.placeholder};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.${exports.classes.headCenter} {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset: 0;
|
|
43
|
+
|
|
44
|
+
.${exports.classes.headButton} {
|
|
45
|
+
font-weight: bold;
|
|
46
|
+
color: ${text.primary};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.${exports.classes.body} {
|
|
52
|
+
padding: ${spacing[3]}px ${spacing[4]}px;
|
|
53
|
+
display: grid;
|
|
54
|
+
place-items: center;
|
|
55
|
+
|
|
56
|
+
&[data-view-type=date] {
|
|
57
|
+
font-size: ${13 / 14}em;
|
|
58
|
+
grid-template-columns: repeat(7, 36px);
|
|
59
|
+
grid-template-rows: repeat(7, 36px);
|
|
60
|
+
|
|
61
|
+
.${exports.classes.dateItem} {
|
|
62
|
+
width: 24px;
|
|
63
|
+
height: 24px;
|
|
64
|
+
|
|
65
|
+
&:not([data-variant=filled]) {
|
|
66
|
+
color: ${text.primary};
|
|
67
|
+
border-color: ${text.disabled};
|
|
68
|
+
|
|
69
|
+
&[data-other-month=true] {
|
|
70
|
+
color: ${text.placeholder};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&:disabled {
|
|
75
|
+
width: 100%;
|
|
76
|
+
border-radius: 0;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
82
|
+
grid-template-columns: repeat(3, 84px);
|
|
83
|
+
grid-template-rows: repeat(4, 63px);
|
|
84
|
+
|
|
85
|
+
.${exports.classes.monthItem},
|
|
86
|
+
.${exports.classes.yearItem} {
|
|
87
|
+
width: 72px;
|
|
88
|
+
padding-inline: 0;
|
|
89
|
+
|
|
90
|
+
&:not([data-variant=filled]) {
|
|
91
|
+
color: ${text.primary};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
&[data-size=small] {
|
|
98
|
+
.${exports.classes.body} {
|
|
99
|
+
&[data-view-type=date] {
|
|
100
|
+
grid-template-columns: repeat(7, 30px);
|
|
101
|
+
grid-template-rows: repeat(7, 30px);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
105
|
+
grid-template-columns: repeat(3, 70px);
|
|
106
|
+
grid-template-rows: repeat(4, 52.5px);
|
|
107
|
+
|
|
108
|
+
.${exports.classes.monthItem},
|
|
109
|
+
.${exports.classes.yearItem} {
|
|
110
|
+
width: 60px;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&[data-size=large] {
|
|
117
|
+
.${exports.classes.body} {
|
|
118
|
+
&[data-view-type=date] {
|
|
119
|
+
font-size: 1em;
|
|
120
|
+
grid-template-columns: repeat(7, 42px);
|
|
121
|
+
grid-template-rows: repeat(7, 42px);
|
|
122
|
+
|
|
123
|
+
.${exports.classes.dateItem} {
|
|
124
|
+
width: 32px;
|
|
125
|
+
height: 32px;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&[data-view-type=month], &[data-view-type=year] {
|
|
130
|
+
grid-template-columns: repeat(3, 98px);
|
|
131
|
+
grid-template-rows: repeat(4, 73.5px);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.${exports.classes.foot} {
|
|
137
|
+
height: 41px;
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: center;
|
|
141
|
+
border-top: 1px solid ${divider};
|
|
142
|
+
}
|
|
143
143
|
`);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PanelProps } from './calendar';
|
|
2
|
-
export declare const PanelDates: import("react").MemoExoticComponent<({ value, setValue, innerD, setInnerD, setViewType, min, max, disabledDates, showToday, _defaultNull }: PanelProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
2
|
+
export declare const PanelDates: import("react").MemoExoticComponent<({ value, setValue, innerD, setInnerD, setViewType, min, max, disabledDates, showToday, todayButtonText, todayButtonProps, _defaultNull }: PanelProps) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
@@ -26,7 +26,7 @@ const commonButtonProps = {
|
|
|
26
26
|
size: 'small',
|
|
27
27
|
color: 'text'
|
|
28
28
|
};
|
|
29
|
-
exports.PanelDates = (0, react_1.memo)(({ value, setValue, innerD, setInnerD, setViewType, min, max, disabledDates, showToday, _defaultNull }) => {
|
|
29
|
+
exports.PanelDates = (0, react_1.memo)(({ value, setValue, innerD, setInnerD, setViewType, min, max, disabledDates, showToday, todayButtonText = '回今天', todayButtonProps, _defaultNull }) => {
|
|
30
30
|
const today = (0, dayjs_1.default)();
|
|
31
31
|
const prevMonth = () => {
|
|
32
32
|
setInnerD(d => d.subtract(1, 'month'));
|
|
@@ -70,5 +70,8 @@ exports.PanelDates = (0, react_1.memo)(({ value, setValue, innerD, setInnerD, se
|
|
|
70
70
|
return ret;
|
|
71
71
|
};
|
|
72
72
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { className: calendar_style_1.classes.head, children: [(0, jsx_runtime_1.jsxs)("div", { className: calendar_style_1.classes.headSide, children: [renderHeadControl((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faAnglesLeft_1.faAnglesLeft }), '上一年', prevYear), renderHeadControl((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faAngleLeft_1.faAngleLeft }), '上一月', prevMonth)] }), (0, jsx_runtime_1.jsxs)("div", { className: calendar_style_1.classes.headSide, children: [renderHeadControl((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faAngleRight_1.faAngleRight }), '下一月', nextMonth), renderHeadControl((0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faAnglesRight_1.faAnglesRight }), '下一年', nextYear)] }), (0, jsx_runtime_1.jsxs)("div", { className: calendar_style_1.classes.headCenter, children: [(0, jsx_runtime_1.jsxs)(button_1.Button, { ...commonButtonProps, className: calendar_style_1.classes.headButton, onClick: () => setViewType('year'), children: [innerD.year(), "\u5E74"] }), (0, jsx_runtime_1.jsxs)(button_1.Button, { ...commonButtonProps, className: calendar_style_1.classes.headButton, onClick: () => setViewType('month'), children: [(innerD.month() + 1).toString().padStart(2, '0'), "\u6708"] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: calendar_style_1.classes.body, "data-view-type": "date", children: [renderedDaysList, renderDates()] }), showToday &&
|
|
73
|
-
(0, jsx_runtime_1.jsx)("div", { className: calendar_style_1.classes.foot, children: (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "text", onClick:
|
|
73
|
+
(0, jsx_runtime_1.jsx)("div", { className: calendar_style_1.classes.foot, children: (0, jsx_runtime_1.jsx)(button_1.Button, { variant: "text", ...todayButtonProps, onClick: e => {
|
|
74
|
+
todayButtonProps?.onClick?.(e);
|
|
75
|
+
setValue((0, dayjs_1.default)());
|
|
76
|
+
}, children: todayButtonText }) })] }));
|
|
74
77
|
});
|
|
@@ -60,7 +60,7 @@ export declare function ClickAway({ ref, container, eventType, onClickAway, disa
|
|
|
60
60
|
results: number;
|
|
61
61
|
security: string;
|
|
62
62
|
unselectable: "off" | "on";
|
|
63
|
-
popover: "" | "auto" | "manual";
|
|
63
|
+
popover: "" | "auto" | "manual" | "hint";
|
|
64
64
|
popoverTargetAction: "toggle" | "hide" | "show";
|
|
65
65
|
popoverTarget: string;
|
|
66
66
|
inert: boolean;
|
|
@@ -123,7 +123,7 @@ exports.Curd = (0, react_1.memo)((props) => {
|
|
|
123
123
|
const res = await loadRows(props.paginatable !== false
|
|
124
124
|
? {
|
|
125
125
|
page: innerPage.current,
|
|
126
|
-
pageSize: innerPageSize.current
|
|
126
|
+
pageSize: innerPageSize.current
|
|
127
127
|
}
|
|
128
128
|
: void 0, innerFilterRef.current.getFormValue(), innerOrderColumn.current
|
|
129
129
|
? {
|
|
@@ -187,24 +187,24 @@ exports.Curd = (0, react_1.memo)((props) => {
|
|
|
187
187
|
innerLoadRows().then();
|
|
188
188
|
message.success(deleteName + '成功').then();
|
|
189
189
|
};
|
|
190
|
-
return ((0, jsx_runtime_1.jsxs)("div", { ...wrapperProps, css: curd_style_1.style, className: (0, utils_1.clsx)(curd_style_1.classes.root, wrapperProps?.className), "data-variant": variant, children: [(0, jsx_runtime_1.
|
|
190
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ...wrapperProps, css: curd_style_1.style, className: (0, utils_1.clsx)(curd_style_1.classes.root, wrapperProps?.className), "data-variant": variant, children: [(0, jsx_runtime_1.jsx)(form_1.Form, { ...(0, utils_1.mergeComponentProps)({
|
|
191
191
|
variant: 'plain',
|
|
192
192
|
initialValue: initialFilterValue
|
|
193
193
|
}, filterProps, {
|
|
194
194
|
ref: innerFilterRef,
|
|
195
195
|
onFinish: filterHandler
|
|
196
|
-
}), children:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
196
|
+
}), children: renderFilterableFn() }), (creatable || toolbarLeft || toolbarRight || reloadable || resizable || columnConfigurable) &&
|
|
197
|
+
(0, jsx_runtime_1.jsxs)("div", { className: curd_style_1.classes.toolbar, children: [(0, jsx_runtime_1.jsxs)("div", { className: curd_style_1.classes.toolbarLeft, children: [creatable &&
|
|
198
|
+
(0, jsx_runtime_1.jsxs)(button_1.Button, { prefix: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faPlus_1.faPlus }), ...createButtonProps, onClick: createHandler, children: [createName, dataName] }), toolbarLeft] }), (0, jsx_runtime_1.jsxs)("div", { className: curd_style_1.classes.toolbarRight, children: [!!toolbarRight &&
|
|
199
|
+
(0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [toolbarRight, (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: curd_style_1.classes.divider, orientation: "vertical" })] }), reloadable &&
|
|
200
|
+
(0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { title: "\u5237\u65B0", children: (0, jsx_runtime_1.jsx)(button_1.Button, { shape: "circular", variant: "text", color: "text.secondary", prefix: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faRotateRight_1.faRotateRight }), loading: innerLoading.current, onClick: reloadHandler }) }), resizable &&
|
|
201
|
+
(0, jsx_runtime_1.jsx)(curdResizable_1.CurdResizable, { innerSize: innerSize.current, setInnerSize: setInnerSize }), columnConfigurable &&
|
|
202
|
+
(0, jsx_runtime_1.jsx)(curdColumnConfig_1.CurdColumnConfig, { columns: orderedColumns, innerVisible: innerVisible.current, setInnerVisible: setInnerVisible, setInnerOrder: setInnerOrder })] })] }), (0, jsx_runtime_1.jsx)("div", { className: curd_style_1.classes.card, children: (0, jsx_runtime_1.jsx)(dataGrid_1.DataGrid, { ...dataGridProps, columns: actualColumns, tableProps: {
|
|
203
|
+
...props.tableProps,
|
|
204
|
+
...resizable && { size: innerSize.current }
|
|
205
|
+
}, loading: innerLoading.current, rows: innerRows.current, paginatable: !loadRows && props.paginatable, renderPagination: loadRows && props.paginatable !== false
|
|
206
|
+
? () => (0, jsx_runtime_1.jsx)(pagination_1.Pagination, { ...props.paginationProps, total: innerTotal.current, page: innerPage.current, onPageChange: setInnerPage, pageSize: innerPageSize.current, onPageSizeChange: setInnerPageSize })
|
|
207
|
+
: props.renderPagination, orderColumn: innerOrderColumn.current, orderType: innerOrderType.current, onOrderChange: orderChangeHandler }) }), (creatable || updatable) &&
|
|
208
208
|
(0, jsx_runtime_1.jsx)(curdDialog_1.CurdDialog, { ...dialogProps, ref: curdDialogRef, onFinish: finishHandler, curdProps: props })] }));
|
|
209
209
|
});
|
|
210
210
|
exports.Curd.Filter = curdFilterable_1.CurdFilterable;
|
|
@@ -49,8 +49,8 @@ exports.DateTimePicker = (0, react_1.memo)(({ inputProps, popperProps, min, max,
|
|
|
49
49
|
content: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [showCalendar &&
|
|
50
50
|
(0, jsx_runtime_1.jsx)(calendar_1.Calendar, { viewLevel: format.includes('D') ? 'date'
|
|
51
51
|
: format.includes('M') ? 'month'
|
|
52
|
-
: 'year', _defaultNull: !dateValue.current, value: innerValue, onChange: setDateValue, min: min, max: max, disabledDates: disabledDates }), showTimer &&
|
|
53
|
-
(0, jsx_runtime_1.jsx)(DateTimePickerContext, { value: contextValue, children: (0, jsx_runtime_1.jsx)(timer_1.Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value:
|
|
52
|
+
: 'year', _defaultNull: !dateValue.current, value: innerValue, onChange: setDateValue, min: min, max: max, disabledDates: disabledDates, todayButtonText: showTimer ? '现在' : void 0 }), showTimer &&
|
|
53
|
+
(0, jsx_runtime_1.jsx)(DateTimePickerContext, { value: contextValue, children: (0, jsx_runtime_1.jsx)(timer_1.Timer, { showHours: format.includes('H'), showMinutes: format.includes('m'), showSeconds: format.includes('s'), value: dateValue.current, onChange: setDateValue }) })] }))
|
|
54
54
|
}, popperProps, {
|
|
55
55
|
onOpenChange: setInnerOpen,
|
|
56
56
|
onPointerDown: e => e.preventDefault()
|
|
@@ -3,6 +3,6 @@ export declare const Timer: import("react").MemoExoticComponent<({ showHours, sh
|
|
|
3
3
|
showHours: boolean;
|
|
4
4
|
showMinutes: boolean;
|
|
5
5
|
showSeconds: boolean;
|
|
6
|
-
value: Dayjs;
|
|
6
|
+
value: Dayjs | null;
|
|
7
7
|
onChange(value: Dayjs): void;
|
|
8
8
|
}) => import("@emotion/react/jsx-runtime").JSX.Element>;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Timer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const jsx_runtime_1 = require("@emotion/react/jsx-runtime");
|
|
5
6
|
const react_1 = require("react");
|
|
6
7
|
const timer_style_1 = require("./timer.style");
|
|
7
8
|
const menuItem_1 = require("../menuItem");
|
|
9
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
8
10
|
const dateTimePicker_1 = require("./dateTimePicker");
|
|
9
11
|
const popper_1 = require("../popper");
|
|
10
12
|
exports.Timer = (0, react_1.memo)(({ showHours, showMinutes, showSeconds, value, onChange }) => {
|
|
@@ -12,10 +14,14 @@ exports.Timer = (0, react_1.memo)(({ showHours, showMinutes, showSeconds, value,
|
|
|
12
14
|
});
|
|
13
15
|
function TimerItem({ type, value, onChange }) {
|
|
14
16
|
const { min, max, disabledHours, disabledMinutes, disabledSeconds } = (0, dateTimePicker_1.useDateTimePickerContext)();
|
|
15
|
-
const currentNum =
|
|
16
|
-
: type === '
|
|
17
|
-
: value.
|
|
17
|
+
const currentNum = !value ? -1
|
|
18
|
+
: type === 'hour' ? value.hour()
|
|
19
|
+
: type === 'minute' ? value.minute()
|
|
20
|
+
: value.second();
|
|
18
21
|
const isDisabled = (num) => {
|
|
22
|
+
if (!value) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
19
25
|
if (type === 'hour') {
|
|
20
26
|
if (disabledHours && !disabledHours(value, num)) {
|
|
21
27
|
return true;
|
|
@@ -34,17 +40,19 @@ function TimerItem({ type, value, onChange }) {
|
|
|
34
40
|
if (min && min.isSame(value, 'date') && min.get(type) > num) {
|
|
35
41
|
return true;
|
|
36
42
|
}
|
|
37
|
-
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
43
|
+
return !!(max && max.isSame(value, 'date') && max.get(type) < num);
|
|
41
44
|
};
|
|
42
45
|
const scrollerRef = (0, react_1.useRef)(null);
|
|
43
46
|
const selectedItemRef = (0, popper_1.useScrollToTarget)(scrollerRef);
|
|
44
47
|
const renderItems = (count) => {
|
|
45
48
|
const ret = [];
|
|
46
49
|
for (let i = 0; i < count; i++) {
|
|
47
|
-
ret.push((0, jsx_runtime_1.jsx)(menuItem_1.MenuItem, { ref: i === currentNum ? selectedItemRef : void 0, className: timer_style_1.classes.timerItem, label: i.toString().padStart(2, '0'), selected: i === currentNum, onClick: () =>
|
|
50
|
+
ret.push((0, jsx_runtime_1.jsx)(menuItem_1.MenuItem, { ref: i === currentNum ? selectedItemRef : void 0, className: timer_style_1.classes.timerItem, label: i.toString().padStart(2, '0'), selected: i === currentNum, onClick: () => {
|
|
51
|
+
if (i !== currentNum) {
|
|
52
|
+
value ||= (0, dayjs_1.default)();
|
|
53
|
+
onChange(value.set(type, i));
|
|
54
|
+
}
|
|
55
|
+
}, disabled: isDisabled(i) }, i));
|
|
48
56
|
}
|
|
49
57
|
return ret;
|
|
50
58
|
};
|
|
@@ -17,4 +17,4 @@ export declare function usePopperContext(): {
|
|
|
17
17
|
* 当弹框打开时,滚动至已选项
|
|
18
18
|
* @returns {RefObject} ref
|
|
19
19
|
*/
|
|
20
|
-
export declare function useScrollToTarget<T extends HTMLElement>(scrollerRef: RefObject<
|
|
20
|
+
export declare function useScrollToTarget<T extends HTMLElement>(scrollerRef: RefObject<HTMLElement | null>): RefObject<T | null>;
|
|
@@ -23,16 +23,18 @@ function usePopperContext() {
|
|
|
23
23
|
function useScrollToTarget(scrollerRef) {
|
|
24
24
|
const ref = (0, react_1.useRef)(null);
|
|
25
25
|
const { beforeOpenCallbacks } = usePopperContext();
|
|
26
|
-
(0, react_1.
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
26
|
+
const beforeOpen = (0, react_1.useCallback)(() => {
|
|
27
|
+
const targetEl = ref.current;
|
|
28
|
+
const scrollerEl = scrollerRef.current;
|
|
29
|
+
if (targetEl && scrollerEl && scrollerEl.scrollHeight > scrollerEl.clientHeight) {
|
|
30
|
+
scrollerEl.scrollTop = targetEl.offsetTop + targetEl.clientHeight / 2 - scrollerEl.clientHeight / 2;
|
|
31
|
+
}
|
|
32
|
+
}, []);
|
|
33
|
+
(0, react_1.useMemo)(() => {
|
|
32
34
|
beforeOpenCallbacks.add(beforeOpen);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
}, []);
|
|
36
|
+
(0, react_1.useEffect)(() => () => {
|
|
37
|
+
beforeOpenCallbacks.delete(beforeOpen);
|
|
36
38
|
}, []);
|
|
37
39
|
return ref;
|
|
38
40
|
}
|
|
@@ -3,12 +3,12 @@ import { DivProps, Status as IStatus } from '../../types';
|
|
|
3
3
|
import { FontAwesomeIconProps } from '@fortawesome/react-fontawesome';
|
|
4
4
|
export type StatusType = IStatus | 'confirm' | 'unknown';
|
|
5
5
|
export declare const statusMapToIconDefinition: {
|
|
6
|
-
info: import("@fortawesome/
|
|
7
|
-
success: import("@fortawesome/
|
|
8
|
-
warning: import("@fortawesome/
|
|
9
|
-
error: import("@fortawesome/
|
|
10
|
-
confirm: import("@fortawesome/
|
|
11
|
-
unknown: import("@fortawesome/
|
|
6
|
+
info: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
7
|
+
success: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
8
|
+
warning: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
9
|
+
error: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
10
|
+
confirm: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
11
|
+
unknown: import("@fortawesome/free-solid-svg-icons").IconDefinition;
|
|
12
12
|
};
|
|
13
13
|
export interface StatusIconProps extends Partial<FontAwesomeIconProps> {
|
|
14
14
|
status?: StatusType;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Size } from '../../types';
|
|
2
2
|
import { Dayjs } from 'dayjs';
|
|
3
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
4
4
|
import { FlexProps } from '../flex';
|
|
5
|
+
import { ButtonProps } from '../button';
|
|
5
6
|
export type ViewLevel = 'date' | 'month' | 'year';
|
|
6
7
|
type SharedProps = {
|
|
7
8
|
min?: Dayjs;
|
|
@@ -9,6 +10,8 @@ type SharedProps = {
|
|
|
9
10
|
disabledDates?: (date: Dayjs) => boolean;
|
|
10
11
|
/** 是否显示`回今天`按钮,默认为`true` */
|
|
11
12
|
showToday?: boolean;
|
|
13
|
+
todayButtonText?: ReactNode;
|
|
14
|
+
todayButtonProps?: ButtonProps;
|
|
12
15
|
/** @private */
|
|
13
16
|
_defaultNull?: boolean;
|
|
14
17
|
};
|
|
@@ -28,5 +31,5 @@ export interface PanelProps extends SharedProps {
|
|
|
28
31
|
setViewType: Dispatch<SetStateAction<'date' | 'month' | 'year'>>;
|
|
29
32
|
onSelected(newValue: Dayjs): void;
|
|
30
33
|
}
|
|
31
|
-
export declare const Calendar: ({ viewLevel, showToday, size, defaultValue, min, max, disabledDates, value, onChange, _defaultNull, ...props }: CalendarProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const Calendar: ({ viewLevel, showToday, todayButtonText, todayButtonProps, size, defaultValue, min, max, disabledDates, value, onChange, _defaultNull, ...props }: CalendarProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
32
35
|
export {};
|
|
@@ -7,7 +7,7 @@ import { classes, style } from './calendar.style';
|
|
|
7
7
|
import { Flex } from '../flex';
|
|
8
8
|
import { PanelYear } from './panelYear';
|
|
9
9
|
import { PanelMonth } from './panelMonth';
|
|
10
|
-
export const Calendar = ({ viewLevel = 'date', showToday = true, size = 'medium', defaultValue = null, min, max, disabledDates, value, onChange, _defaultNull, ...props }) => {
|
|
10
|
+
export const Calendar = ({ viewLevel = 'date', showToday = true, todayButtonText = '回今天', todayButtonProps, size = 'medium', defaultValue = null, min, max, disabledDates, value, onChange, _defaultNull, ...props }) => {
|
|
11
11
|
const [innerValue, setInnerValue] = useControlled(defaultValue, value, onChange);
|
|
12
12
|
const [viewType, setViewType] = useState(viewLevel);
|
|
13
13
|
const [innerD, setInnerD] = useState(() => innerValue.current ?? dayjs().startOf('date'));
|
|
@@ -30,6 +30,8 @@ export const Calendar = ({ viewLevel = 'date', showToday = true, size = 'medium'
|
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
32
|
showToday,
|
|
33
|
+
todayButtonText,
|
|
34
|
+
todayButtonProps,
|
|
33
35
|
_defaultNull
|
|
34
36
|
};
|
|
35
37
|
const renderPanel = () => {
|