@canlooks/can-ui 0.0.85 → 0.0.87
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/boundary/errorBoundary.js +1 -3
- package/dist/cjs/components/calendar/calendar.style.js +124 -124
- package/dist/cjs/components/clickAway/clickAway.d.ts +1 -1
- package/dist/cjs/components/dialog/dialog.js +42 -9
- package/dist/cjs/components/dialog/dialog.style.d.ts +1 -0
- package/dist/cjs/components/dialog/dialog.style.js +21 -17
- package/dist/cjs/components/form/form.d.ts +3 -2
- package/dist/cjs/components/modal/modal.js +1 -1
- package/dist/cjs/components/modal/modal.style.d.ts +0 -1
- package/dist/cjs/components/modal/modal.style.js +5 -1
- package/dist/cjs/components/overlayBase/overlayBase.js +7 -7
- package/dist/cjs/components/overlayBase/overlayBase.style.d.ts +0 -1
- package/dist/cjs/components/overlayBase/overlayBase.style.js +0 -6
- package/dist/cjs/components/scrollbar/scrollbar.style.js +0 -1
- package/dist/cjs/components/status/status.d.ts +6 -6
- package/dist/esm/components/boundary/errorBoundary.js +1 -3
- package/dist/esm/components/calendar/calendar.style.js +124 -124
- package/dist/esm/components/clickAway/clickAway.d.ts +1 -1
- package/dist/esm/components/dialog/dialog.js +42 -9
- package/dist/esm/components/dialog/dialog.style.d.ts +1 -0
- package/dist/esm/components/dialog/dialog.style.js +21 -17
- package/dist/esm/components/form/form.d.ts +3 -2
- package/dist/esm/components/modal/modal.js +1 -1
- package/dist/esm/components/modal/modal.style.d.ts +0 -1
- package/dist/esm/components/modal/modal.style.js +5 -1
- package/dist/esm/components/overlayBase/overlayBase.js +8 -8
- package/dist/esm/components/overlayBase/overlayBase.style.d.ts +0 -1
- package/dist/esm/components/overlayBase/overlayBase.style.js +0 -6
- package/dist/esm/components/scrollbar/scrollbar.style.js +0 -1
- package/dist/esm/components/status/status.d.ts +6 -6
- package/documentation/dist/assets/index-DvrKS6Tv.js +7747 -0
- package/documentation/dist/atom-one-dark.min.css +1 -0
- package/documentation/dist/components/accordion.md +38 -0
- package/documentation/dist/components/actionSheet.md +49 -0
- package/documentation/dist/components/alert.md +38 -0
- package/documentation/dist/components/anchorList.md +36 -0
- package/documentation/dist/components/autocomplete.md +68 -0
- package/documentation/dist/components/avatar.md +79 -0
- package/documentation/dist/components/badge.md +33 -0
- package/documentation/dist/components/bottomNavigation.md +39 -0
- package/documentation/dist/components/breadcrumb.md +28 -0
- package/documentation/dist/components/bubbleConfirm.md +34 -0
- package/documentation/dist/components/button.md +62 -0
- package/documentation/dist/components/card.md +30 -0
- package/documentation/dist/components/cascade.md +48 -0
- package/documentation/dist/components/checkbox.md +36 -0
- package/documentation/dist/components/colorPicker.md +27 -0
- package/documentation/dist/components/contextMenu.md +27 -0
- package/documentation/dist/components/counter.md +29 -0
- package/documentation/dist/components/dataGrid.md +112 -0
- package/documentation/dist/components/dateTimePicker.md +35 -0
- package/documentation/dist/components/dateTimeRangePicker.md +36 -0
- package/documentation/dist/components/descriptions.md +35 -0
- package/documentation/dist/components/dialog.md +56 -0
- package/documentation/dist/components/divider.md +26 -0
- package/documentation/dist/components/drawer.md +40 -0
- package/documentation/dist/components/flex.md +20 -0
- package/documentation/dist/components/form.md +131 -0
- package/documentation/dist/components/formDialog.md +36 -0
- package/documentation/dist/components/grid.md +34 -0
- package/documentation/dist/components/highlight.md +26 -0
- package/documentation/dist/components/image.md +90 -0
- package/documentation/dist/components/input.md +39 -0
- package/documentation/dist/components/loading.md +46 -0
- package/documentation/dist/components/menu.md +85 -0
- package/documentation/dist/components/pagination.md +38 -0
- package/documentation/dist/components/pickerDialog.md +56 -0
- package/documentation/dist/components/placeholder.md +30 -0
- package/documentation/dist/components/progress.md +43 -0
- package/documentation/dist/components/radio.md +37 -0
- package/documentation/dist/components/rating.md +35 -0
- package/documentation/dist/components/resizable.md +41 -0
- package/documentation/dist/components/scrollbar.md +31 -0
- package/documentation/dist/components/segmented.md +57 -0
- package/documentation/dist/components/select.md +30 -0
- package/documentation/dist/components/skeleton.md +26 -0
- package/documentation/dist/components/slidableActions.md +53 -0
- package/documentation/dist/guide/appComponent.md +30 -0
- package/documentation/dist/guide/globalMethods.md +238 -0
- package/documentation/dist/guide/icon.md +57 -0
- package/documentation/dist/guide/introduction.md +2 -0
- package/documentation/dist/guide/overrideProps.md +0 -0
- package/documentation/dist/guide/startup.md +23 -0
- package/documentation/dist/guide/theme.md +249 -0
- package/documentation/dist/index.html +13 -0
- package/documentation/dist/logo.png +0 -0
- package/extensions/curd.cjs +5 -5
- package/extensions/documentViewer.cjs +5 -5
- package/extensions/textFormatter.cjs +5 -5
- package/package.json +1 -1
|
@@ -18,9 +18,7 @@ exports.ErrorBoundary = (0, react_1.memo)(({ error, reload, reloadable, ...props
|
|
|
18
18
|
return error.stack;
|
|
19
19
|
}
|
|
20
20
|
const errorType = typeof error;
|
|
21
|
-
if (
|
|
22
|
-
|| errorType === 'number'
|
|
23
|
-
|| errorType === 'boolean') {
|
|
21
|
+
if (['string', 'number', 'boolean'].includes(errorType)) {
|
|
24
22
|
return error.toString();
|
|
25
23
|
}
|
|
26
24
|
};
|
|
@@ -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
|
`);
|
|
@@ -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";
|
|
64
64
|
popoverTargetAction: "toggle" | "hide" | "show";
|
|
65
65
|
popoverTarget: string;
|
|
66
66
|
inert: boolean;
|
|
@@ -20,8 +20,12 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
|
|
|
20
20
|
};
|
|
21
21
|
// 绑定ESC键
|
|
22
22
|
const overlayRef = (0, utils_1.useEscapeClosable)({ escapeClosable, close }, onCancel);
|
|
23
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
23
24
|
// 点击遮罩层
|
|
24
25
|
const onMaskClick = (e) => {
|
|
26
|
+
if (e.target !== containerRef.current) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
25
29
|
props.onMaskClick?.(e);
|
|
26
30
|
if (maskClosable) {
|
|
27
31
|
onCancel?.(e);
|
|
@@ -48,7 +52,7 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
|
|
|
48
52
|
}, confirmLoading);
|
|
49
53
|
/**
|
|
50
54
|
* ---------------------------------------------------------------------
|
|
51
|
-
* 长内容滚动
|
|
55
|
+
* 长内容滚动 - card模式
|
|
52
56
|
*/
|
|
53
57
|
const bodyRef = (0, react_1.useRef)(null);
|
|
54
58
|
const bodyWrapRef = (0, react_1.useRef)(null);
|
|
@@ -60,6 +64,17 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
|
|
|
60
64
|
}
|
|
61
65
|
};
|
|
62
66
|
(0, react_1.useEffect)(() => {
|
|
67
|
+
if (scrollBehavior === 'card') {
|
|
68
|
+
bodyRef.current.addEventListener('scroll', onScroll);
|
|
69
|
+
return () => {
|
|
70
|
+
bodyRef.current.removeEventListener('scroll', onScroll);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}, [scrollBehavior]);
|
|
74
|
+
(0, react_1.useEffect)(() => {
|
|
75
|
+
if (scrollBehavior !== 'card') {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
63
78
|
if (innerOpen.current) {
|
|
64
79
|
const resizeObserver = new ResizeObserver(onScroll);
|
|
65
80
|
resizeObserver.observe(bodyRef.current);
|
|
@@ -68,7 +83,25 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
|
|
|
68
83
|
resizeObserver.disconnect();
|
|
69
84
|
};
|
|
70
85
|
}
|
|
71
|
-
}, [innerOpen.current]);
|
|
86
|
+
}, [innerOpen.current, scrollBehavior]);
|
|
87
|
+
/**
|
|
88
|
+
* ---------------------------------------------------------------------
|
|
89
|
+
* 长内容滚动 - card模式
|
|
90
|
+
*/
|
|
91
|
+
const cardRef = (0, react_1.useRef)(null);
|
|
92
|
+
(0, react_1.useEffect)(() => {
|
|
93
|
+
if (scrollBehavior === 'body' && innerOpen.current) {
|
|
94
|
+
const containerEl = containerRef.current;
|
|
95
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
96
|
+
containerEl.dataset.scrollable = (containerEl.scrollHeight > containerEl.clientHeight).toString();
|
|
97
|
+
});
|
|
98
|
+
resizeObserver.observe(containerEl);
|
|
99
|
+
resizeObserver.observe(cardRef.current);
|
|
100
|
+
return () => {
|
|
101
|
+
resizeObserver.disconnect();
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}, [innerOpen.current, scrollBehavior]);
|
|
72
105
|
/**
|
|
73
106
|
* ---------------------------------------------------------------------
|
|
74
107
|
* 渲染
|
|
@@ -81,11 +114,11 @@ function Dialog({ icon, title, footer, prefix, suffix, width = 420, minWidth, ma
|
|
|
81
114
|
}
|
|
82
115
|
return footer;
|
|
83
116
|
};
|
|
84
|
-
return ((0, jsx_runtime_1.jsx)(modal_1.Modal, { ...props, ref: (0, utils_1.cloneRef)(overlayRef, props.ref), css: dialog_style_1.style, className: (0, utils_1.clsx)(dialog_style_1.classes.root, props.className), open: innerOpen.current,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
117
|
+
return ((0, jsx_runtime_1.jsx)(modal_1.Modal, { ...props, ref: (0, utils_1.cloneRef)(overlayRef, props.ref), css: dialog_style_1.style, className: (0, utils_1.clsx)(dialog_style_1.classes.root, props.className), open: innerOpen.current, "data-scroll-behavior": scrollBehavior, "data-draggable": draggable, children: (0, jsx_runtime_1.jsx)("div", { ref: containerRef, className: dialog_style_1.classes.container, onClick: onMaskClick, children: (0, jsx_runtime_1.jsx)(draggable_1.Draggable, { container: () => overlayRef.current, children: (targetProps, handleProps) => (0, jsx_runtime_1.jsxs)("div", { ref: cardRef, className: dialog_style_1.classes.card, ...targetProps, style: { width, minWidth, maxWidth, ...targetProps.style }, children: [!!icon &&
|
|
118
|
+
(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.icon, children: icon }), (0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.content, children: [!!(title || showClose) &&
|
|
119
|
+
(0, jsx_runtime_1.jsxs)("div", { className: dialog_style_1.classes.titleRow, ...handleProps, children: [(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.title, children: title }), showClose &&
|
|
120
|
+
(0, jsx_runtime_1.jsx)(button_1.Button, { shape: "circular", variant: "text", color: "text.secondary", ...closeProps, className: (0, utils_1.clsx)(dialog_style_1.classes.close, closeProps?.className), onClick: closeHandler, children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { icon: faXmark_1.faXmark }) })] }), (0, jsx_runtime_1.jsxs)("div", { ref: bodyRef, className: dialog_style_1.classes.body, onScroll: scrollBehavior === 'card' ? onScroll : void 0, children: [!!prefix &&
|
|
121
|
+
(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.prefix, children: prefix }), (0, jsx_runtime_1.jsx)("div", { ref: bodyWrapRef, className: dialog_style_1.classes.bodyWrap, children: props.children }), !!suffix &&
|
|
122
|
+
(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.suffix, children: suffix })] }), (typeof footer === 'undefined' || !!footer) &&
|
|
123
|
+
(0, jsx_runtime_1.jsx)("div", { className: dialog_style_1.classes.footer, children: renderFooter() })] })] }) }) }) }));
|
|
91
124
|
}
|
|
@@ -3,9 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.style = exports.classes = void 0;
|
|
4
4
|
const react_1 = require("@emotion/react");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const modal_style_1 = require("../modal/modal.style");
|
|
7
|
-
const overlayBase_style_1 = require("../overlayBase/overlayBase.style");
|
|
8
6
|
exports.classes = (0, utils_1.defineInnerClasses)('dialog', [
|
|
7
|
+
'container',
|
|
9
8
|
'card',
|
|
10
9
|
'icon',
|
|
11
10
|
'content',
|
|
@@ -19,6 +18,16 @@ exports.classes = (0, utils_1.defineInnerClasses)('dialog', [
|
|
|
19
18
|
'footer'
|
|
20
19
|
]);
|
|
21
20
|
exports.style = (0, utils_1.defineCss)(({ background, borderRadius, boxShadow, spacing, colors, divider }) => (0, react_1.css) `
|
|
21
|
+
.${exports.classes.container} {
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
justify-content: center;
|
|
27
|
+
padding: 40px;
|
|
28
|
+
overflow: hidden;
|
|
29
|
+
}
|
|
30
|
+
|
|
22
31
|
.${exports.classes.card} {
|
|
23
32
|
display: flex;
|
|
24
33
|
background-color: ${background.content};
|
|
@@ -26,29 +35,24 @@ exports.style = (0, utils_1.defineCss)(({ background, borderRadius, boxShadow, s
|
|
|
26
35
|
box-shadow: ${boxShadow[0]};
|
|
27
36
|
}
|
|
28
37
|
|
|
29
|
-
.${modal_style_1.classes.childrenWrap} {
|
|
30
|
-
max-width: 100%;
|
|
31
|
-
padding: 40px;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
38
|
&[data-scroll-behavior=card] {
|
|
35
|
-
.${modal_style_1.classes.childrenWrap} {
|
|
36
|
-
height: 100%;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
39
|
.${exports.classes.card} {
|
|
40
40
|
max-height: 100%;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
&[data-scroll-behavior=body] {
|
|
45
|
-
.${
|
|
46
|
-
height: auto;
|
|
47
|
-
min-height: 100%;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.enter-done .${overlayBase_style_1.classes.childrenWrap} {
|
|
45
|
+
.${exports.classes.container} {
|
|
51
46
|
overflow: hidden auto;
|
|
47
|
+
scrollbar-width: none;
|
|
48
|
+
|
|
49
|
+
&[data-scrollable=true] {
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.enter-done .${exports.classes.container} {
|
|
55
|
+
scrollbar-width: auto;
|
|
52
56
|
}
|
|
53
57
|
}
|
|
54
58
|
|
|
@@ -31,11 +31,12 @@ type FormContext<V extends FormValue> = {
|
|
|
31
31
|
};
|
|
32
32
|
declare const FormContext: React.Context<FormContext<any>>;
|
|
33
33
|
export declare function useFormContext<V extends FormValue>(): FormContext<V>;
|
|
34
|
-
type
|
|
34
|
+
type FormValueContext<V extends FormValue> = {
|
|
35
35
|
formValue?: V;
|
|
36
36
|
setFieldValue?(field: FieldPath, value: any, silent?: boolean): void;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
declare const FormValueContext: React.Context<FormValueContext<any>>;
|
|
39
|
+
export declare function useFormValueContext<V extends FormValue>(): FormValueContext<V>;
|
|
39
40
|
export declare function useFormStyleContext(): FormSharedProps;
|
|
40
41
|
export type FormRef<V extends FormValue = FormValue> = {
|
|
41
42
|
/** 存在校验不通过的字段时会得到`null` */
|
|
@@ -22,5 +22,5 @@ function Modal({ modalProps, ...props }) {
|
|
|
22
22
|
return ((0, jsx_runtime_1.jsx)(overlayBase_1.OverlayBase, { ...props, css: modal_style_1.style, className: (0, utils_1.clsx)(modal_style_1.classes.root, props.className), children: (0, jsx_runtime_1.jsx)(transitionBase_1.Grow, { timeout: overlayBase_1.overlayBaseTransitionDuration, ...modalProps, in: props.open, className: (0, utils_1.clsx)(modal_style_1.classes.modal, modalProps?.className), style: {
|
|
23
23
|
transformOrigin: transformOrigin.current,
|
|
24
24
|
...modalProps?.style
|
|
25
|
-
}, children:
|
|
25
|
+
}, children: props.children }) }));
|
|
26
26
|
}
|
|
@@ -5,7 +5,6 @@ const react_1 = require("@emotion/react");
|
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
6
|
exports.classes = (0, utils_1.defineInnerClasses)('modal', [
|
|
7
7
|
'modal',
|
|
8
|
-
'childrenWrap'
|
|
9
8
|
]);
|
|
10
9
|
exports.style = (0, react_1.css) `
|
|
11
10
|
.${exports.classes.modal} {
|
|
@@ -14,5 +13,10 @@ exports.style = (0, react_1.css) `
|
|
|
14
13
|
display: flex;
|
|
15
14
|
align-items: center;
|
|
16
15
|
justify-content: center;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
|
|
18
|
+
> * {
|
|
19
|
+
pointer-events: all;
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
`;
|
|
@@ -37,11 +37,11 @@ function OverlayBase({ container, effectContainer, forceRender, open, onMaskClic
|
|
|
37
37
|
onClosed?.();
|
|
38
38
|
forceRender === false && setShouldRender(false);
|
|
39
39
|
};
|
|
40
|
-
return shouldRender.current && (0, react_dom_1.createPortal)((0, jsx_runtime_1.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
return shouldRender.current && (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsxs)("div", { ...props, css: overlayBase_style_1.style, className: (0, utils_1.clsx)(overlayBase_style_1.classes.root, props.className), "data-open": open, "data-custom-container": containerEl.current !== document.body, children: [(0, jsx_runtime_1.jsx)(transitionBase_1.Fade, { timeout: exports.overlayBaseTransitionDuration, ...(0, utils_1.mergeComponentProps)(maskProps, {
|
|
41
|
+
in: open,
|
|
42
|
+
className: overlayBase_style_1.classes.mask,
|
|
43
|
+
onClick,
|
|
44
|
+
onEntered,
|
|
45
|
+
onExited
|
|
46
|
+
}) }), props.children] }), containerEl.current);
|
|
47
47
|
}
|
|
@@ -7,7 +7,6 @@ const app_style_1 = require("../app/app.style");
|
|
|
7
7
|
const theme_1 = require("../theme");
|
|
8
8
|
exports.classes = (0, utils_1.defineInnerClasses)('overlay-base', [
|
|
9
9
|
'mask',
|
|
10
|
-
'childrenWrap'
|
|
11
10
|
]);
|
|
12
11
|
exports.style = (0, utils_1.defineCss)(theme => {
|
|
13
12
|
return [
|
|
@@ -30,11 +29,6 @@ exports.style = (0, utils_1.defineCss)(theme => {
|
|
|
30
29
|
&:not([data-open=true]) {
|
|
31
30
|
pointer-events: none;
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
.${exports.classes.childrenWrap} {
|
|
35
|
-
height: 100%;
|
|
36
|
-
position: relative;
|
|
37
|
-
}
|
|
38
32
|
`
|
|
39
33
|
];
|
|
40
34
|
});
|
|
@@ -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/fontawesome-common-types").IconDefinition;
|
|
7
|
+
success: import("@fortawesome/fontawesome-common-types").IconDefinition;
|
|
8
|
+
warning: import("@fortawesome/fontawesome-common-types").IconDefinition;
|
|
9
|
+
error: import("@fortawesome/fontawesome-common-types").IconDefinition;
|
|
10
|
+
confirm: import("@fortawesome/fontawesome-common-types").IconDefinition;
|
|
11
|
+
unknown: import("@fortawesome/fontawesome-common-types").IconDefinition;
|
|
12
12
|
};
|
|
13
13
|
export interface StatusIconProps extends Partial<FontAwesomeIconProps> {
|
|
14
14
|
status?: StatusType;
|
|
@@ -15,9 +15,7 @@ export const ErrorBoundary = memo(({ error, reload, reloadable, ...props }) => {
|
|
|
15
15
|
return error.stack;
|
|
16
16
|
}
|
|
17
17
|
const errorType = typeof error;
|
|
18
|
-
if (
|
|
19
|
-
|| errorType === 'number'
|
|
20
|
-
|| errorType === 'boolean') {
|
|
18
|
+
if (['string', 'number', 'boolean'].includes(errorType)) {
|
|
21
19
|
return error.toString();
|
|
22
20
|
}
|
|
23
21
|
};
|