@arcblock/ux 2.13.12 → 2.13.14
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/lib/ActivityIndicator/index.js +9 -5
- package/lib/Address/did-address.js +14 -7
- package/lib/Address/responsive-did-address.js +3 -1
- package/lib/BlockletV2/blocklet.js +1 -1
- package/lib/CloseButton/index.js +1 -2
- package/lib/Colors/index.d.ts +1 -3
- package/lib/Colors/index.js +2 -4
- package/lib/Colors/themes/default.d.ts +3 -66
- package/lib/Colors/themes/default.js +4 -74
- package/lib/Colors/themes/did-connect.d.ts +11 -6
- package/lib/Colors/themes/did-connect.js +17 -12
- package/lib/Colors/themes/temp.d.ts +3 -0
- package/lib/Colors/themes/temp.js +3 -0
- package/lib/Config/config-provider.d.ts +4 -5
- package/lib/Config/config-provider.js +7 -26
- package/lib/Config/theme-mode-toggle.js +0 -1
- package/lib/DID/index.js +3 -4
- package/lib/DIDConnect/app-icon.d.ts +8 -0
- package/lib/DIDConnect/app-icon.js +31 -0
- package/lib/DIDConnect/app-info-item.d.ts +7 -0
- package/lib/DIDConnect/app-info-item.js +73 -0
- package/lib/DIDConnect/did-connect-footer.d.ts +4 -0
- package/lib/DIDConnect/did-connect-footer.js +54 -0
- package/lib/DIDConnect/did-connect-logo.d.ts +1 -0
- package/lib/DIDConnect/did-connect-logo.js +11 -0
- package/lib/DIDConnect/index.d.ts +7 -0
- package/lib/DIDConnect/index.js +7 -0
- package/lib/DIDConnect/powered-by.d.ts +3 -0
- package/lib/DIDConnect/powered-by.js +46 -0
- package/lib/DIDConnect/with-container.d.ts +11 -0
- package/lib/DIDConnect/with-container.js +273 -0
- package/lib/DIDConnect/with-ux-theme.d.ts +1 -0
- package/lib/DIDConnect/with-ux-theme.js +23 -0
- package/lib/Datatable/CustomToolbar.js +3 -0
- package/lib/Datatable/index.js +105 -71
- package/lib/Dialog/confirm.d.ts +6 -1
- package/lib/Dialog/confirm.js +7 -3
- package/lib/Dialog/use-confirm.js +6 -0
- package/lib/Footer/index.js +2 -5
- package/lib/Header/header.js +3 -1
- package/lib/Header/responsive-header.js +3 -1
- package/lib/Layout/dashboard/index.js +14 -2
- package/lib/Layout/dashboard/sidebar.js +1 -2
- package/lib/LoadingMask/index.js +4 -3
- package/lib/Locale/selector.js +3 -3
- package/lib/Locale/util.d.ts +3 -3
- package/lib/Locale/util.js +6 -1
- package/lib/LoginButton/index.d.ts +12 -0
- package/lib/LoginButton/index.js +74 -0
- package/lib/NavMenu/nav-menu.js +14 -9
- package/lib/NavMenu/products.js +3 -1
- package/lib/NavMenu/style.js +7 -3
- package/lib/NavMenu/sub-item-group.js +1 -1
- package/lib/PhoneInput/country-select.js +2 -3
- package/lib/SessionBlocklet/index.js +3 -3
- package/lib/SessionUser/components/did-space.js +14 -28
- package/lib/SessionUser/components/logged-in.js +2 -2
- package/lib/SessionUser/components/quick-login-item.js +13 -11
- package/lib/SessionUser/components/session-user-item.js +5 -6
- package/lib/SessionUser/components/session-user-switch.js +15 -13
- package/lib/SessionUser/components/un-login.js +51 -38
- package/lib/SessionUser/components/user-info.js +9 -8
- package/lib/SessionUser/images/did-spaces.svg +7 -13
- package/lib/SharedBridge/index.d.ts +16 -0
- package/lib/SharedBridge/index.js +109 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.d.ts +7 -0
- package/lib/SharedBridge/need-storage-access-api-dialog.js +212 -0
- package/lib/Success/index.js +8 -4
- package/lib/Switch/index.js +3 -3
- package/lib/Tabs/index.js +8 -9
- package/lib/Theme/index.d.ts +2 -2
- package/lib/Theme/index.js +1 -1
- package/lib/Theme/theme-provider.d.ts +5 -1
- package/lib/Theme/theme-provider.js +60 -5
- package/lib/Theme/theme.d.ts +6 -3
- package/lib/Theme/theme.js +55 -19
- package/lib/UserCard/Container/card.js +1 -1
- package/lib/UserCard/Container/dialog.js +1 -1
- package/lib/Util/iframe.d.ts +5 -0
- package/lib/Util/iframe.js +24 -0
- package/lib/Util/index.d.ts +18 -1
- package/lib/Util/index.js +90 -5
- package/lib/type.d.ts +5 -1
- package/package.json +8 -6
- package/src/ActivityIndicator/index.jsx +4 -4
- package/src/Address/did-address.tsx +5 -5
- package/src/Address/responsive-did-address.tsx +11 -1
- package/src/BlockletV2/blocklet.tsx +1 -1
- package/src/CloseButton/index.tsx +1 -2
- package/src/Colors/index.ts +2 -7
- package/src/Colors/themes/default.ts +4 -50
- package/src/Colors/themes/did-connect.ts +13 -6
- package/src/Colors/themes/temp.ts +3 -0
- package/src/Config/config-provider.tsx +17 -30
- package/src/Config/theme-mode-toggle.tsx +1 -1
- package/src/DID/index.tsx +3 -4
- package/src/DIDConnect/app-icon.tsx +36 -0
- package/src/DIDConnect/app-info-item.tsx +82 -0
- package/src/DIDConnect/did-connect-footer.tsx +51 -0
- package/src/DIDConnect/did-connect-logo.tsx +8 -0
- package/src/DIDConnect/index.ts +7 -0
- package/src/DIDConnect/powered-by.tsx +48 -0
- package/src/DIDConnect/with-container.tsx +307 -0
- package/src/DIDConnect/with-ux-theme.tsx +22 -0
- package/src/Datatable/CustomToolbar.jsx +1 -0
- package/src/Datatable/index.jsx +107 -70
- package/src/Dialog/confirm.jsx +31 -23
- package/src/Dialog/use-confirm.jsx +6 -0
- package/src/Footer/index.tsx +2 -2
- package/src/Header/header.tsx +1 -1
- package/src/Header/responsive-header.tsx +2 -0
- package/src/Layout/dashboard/index.tsx +8 -4
- package/src/Layout/dashboard/sidebar.tsx +1 -2
- package/src/LoadingMask/index.tsx +3 -4
- package/src/Locale/selector.tsx +3 -4
- package/src/Locale/util.ts +7 -2
- package/src/LoginButton/index.tsx +73 -0
- package/src/NavMenu/nav-menu.tsx +15 -10
- package/src/NavMenu/products.tsx +1 -1
- package/src/NavMenu/style.ts +5 -2
- package/src/NavMenu/sub-item-group.tsx +1 -1
- package/src/PhoneInput/country-select.tsx +2 -3
- package/src/SessionBlocklet/index.tsx +3 -3
- package/src/SessionUser/components/did-space.tsx +14 -10
- package/src/SessionUser/components/logged-in.tsx +2 -2
- package/src/SessionUser/components/quick-login-item.tsx +11 -12
- package/src/SessionUser/components/session-user-item.tsx +3 -6
- package/src/SessionUser/components/session-user-switch.tsx +13 -12
- package/src/SessionUser/components/un-login.tsx +41 -33
- package/src/SessionUser/components/user-info.tsx +7 -8
- package/src/SessionUser/images/did-spaces.svg +7 -13
- package/src/SharedBridge/index.tsx +123 -0
- package/src/SharedBridge/need-storage-access-api-dialog.tsx +171 -0
- package/src/Success/index.tsx +6 -4
- package/src/Switch/index.jsx +3 -3
- package/src/Tabs/index.tsx +8 -9
- package/src/Theme/index.ts +2 -2
- package/src/Theme/theme-provider.tsx +73 -2
- package/src/Theme/theme.ts +73 -22
- package/src/UserCard/Container/card.tsx +1 -1
- package/src/UserCard/Container/dialog.tsx +1 -1
- package/src/Util/iframe.ts +19 -0
- package/src/Util/index.ts +102 -4
- package/src/type.d.ts +5 -1
@@ -0,0 +1,307 @@
|
|
1
|
+
import { forwardRef, memo, useRef, useState } from 'react';
|
2
|
+
import { Dialog, DialogContent, useMediaQuery, Box, Backdrop, SwipeableDrawer, Drawer } from '@mui/material';
|
3
|
+
import { useDebounce, useMemoizedFn } from 'ahooks';
|
4
|
+
import { useBrowser } from '@arcblock/react-hooks';
|
5
|
+
import colorConvert from 'color-convert';
|
6
|
+
|
7
|
+
import { useTheme } from '../Theme';
|
8
|
+
import { mergeSx } from '../Util/style';
|
9
|
+
import { hexToRgba } from '../Util';
|
10
|
+
import { Locale } from '../type';
|
11
|
+
|
12
|
+
const BackdropWrap = memo(
|
13
|
+
forwardRef((backdropProps, ref) => {
|
14
|
+
return (
|
15
|
+
<Backdrop
|
16
|
+
open
|
17
|
+
ref={ref}
|
18
|
+
style={{
|
19
|
+
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
20
|
+
backdropFilter: 'blur(3px)',
|
21
|
+
touchAction: 'none',
|
22
|
+
}}
|
23
|
+
{...backdropProps}
|
24
|
+
key="background"
|
25
|
+
/>
|
26
|
+
);
|
27
|
+
})
|
28
|
+
);
|
29
|
+
|
30
|
+
export default function withContainer(Component: React.ComponentType<any>) {
|
31
|
+
function WithContainerComponent({
|
32
|
+
popup = false,
|
33
|
+
open = false,
|
34
|
+
hideCloseButton = false,
|
35
|
+
...rest
|
36
|
+
}: {
|
37
|
+
// 是否弹出显示, true 表示在 Dialog 中渲染, 并可以通过 open/onClose 控制 dialog 的显示/隐藏, false 表示直接渲染原内容
|
38
|
+
popup?: boolean;
|
39
|
+
open?: boolean;
|
40
|
+
hideCloseButton?: boolean;
|
41
|
+
onClose: () => void;
|
42
|
+
blocklet?: any;
|
43
|
+
origin?: string;
|
44
|
+
host?: string;
|
45
|
+
locale?: Locale;
|
46
|
+
}) {
|
47
|
+
const [color, setColor] = useState('#fff');
|
48
|
+
|
49
|
+
const drawerDragger = useRef(null);
|
50
|
+
const browser = useBrowser();
|
51
|
+
// 屏宽小于 sm 且在 mobile 设备中全屏显示 dialog (PC 端屏宽小于 sm 的情况正常弹窗, 不全屏显示)
|
52
|
+
const matchSm = useMediaQuery('(max-width:640px)');
|
53
|
+
let openVariant = 'page';
|
54
|
+
if (popup) {
|
55
|
+
openVariant = 'dialog';
|
56
|
+
if (matchSm && browser.mobile.any) {
|
57
|
+
openVariant = 'drawer';
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
const theme = useTheme();
|
62
|
+
|
63
|
+
// 兼容 did-react 版本中存在的 responsive prop, responsive=true 则让 dialog 始终保持 open 状态, 否则遵循外部传入的 open prop
|
64
|
+
const isOpen = open;
|
65
|
+
|
66
|
+
const leavingScreenDelay = theme?.transitions?.duration?.leavingScreen || 500; // 默认值是 195
|
67
|
+
const debouncedShow = useDebounce(isOpen, {
|
68
|
+
wait: leavingScreenDelay,
|
69
|
+
});
|
70
|
+
|
71
|
+
const removeMagicToken = useMemoizedFn(() => {
|
72
|
+
const searchParams = new URLSearchParams(window.location.search);
|
73
|
+
if (searchParams.get('magicToken')) {
|
74
|
+
searchParams.delete('magicToken');
|
75
|
+
}
|
76
|
+
window.history.replaceState({}, '', `${window.location.pathname}?${searchParams.toString()}`);
|
77
|
+
});
|
78
|
+
|
79
|
+
// eslint-disable-next-line no-unused-vars
|
80
|
+
const handleOnClose = (e: React.MouseEvent<HTMLElement>, reason: string) => {
|
81
|
+
if (['backdropClick', 'escapeKeyDown'].includes(reason)) return;
|
82
|
+
removeMagicToken();
|
83
|
+
rest?.onClose();
|
84
|
+
};
|
85
|
+
|
86
|
+
const showModal = debouncedShow || isOpen;
|
87
|
+
|
88
|
+
const DrawerComponent = hideCloseButton ? Drawer : SwipeableDrawer;
|
89
|
+
|
90
|
+
const hslColor = colorConvert.hex.hsl(color);
|
91
|
+
|
92
|
+
const [h, s, l] = hslColor;
|
93
|
+
const percentageList = [0, 30, 60, 30, 0, 30, 60, 30];
|
94
|
+
const maxPercentage = Math.max(...percentageList);
|
95
|
+
const minPercentage = Math.min(...percentageList);
|
96
|
+
let useAlpha = false;
|
97
|
+
if ((l * (100 + maxPercentage)) / 100 > 100 || (l * (100 + minPercentage)) / 100 < 0) {
|
98
|
+
// 超出范围,使用 alpha 通道变化
|
99
|
+
useAlpha = true;
|
100
|
+
}
|
101
|
+
const colorList = percentageList.map((percentageItem) => {
|
102
|
+
let finalL = (l * (100 + percentageItem)) / 100;
|
103
|
+
let finalAlpha = 0.6;
|
104
|
+
if (useAlpha) {
|
105
|
+
finalAlpha = (0.5 * (100 + percentageItem)) / 100;
|
106
|
+
} else {
|
107
|
+
finalL = (l * (100 + percentageItem)) / 100;
|
108
|
+
}
|
109
|
+
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
110
|
+
});
|
111
|
+
const background = `linear-gradient(45deg, ${colorList.join(', ')})`;
|
112
|
+
const colorListGlow = percentageList.map((percentageItem) => {
|
113
|
+
let finalL = (l * (100 + percentageItem)) / 100;
|
114
|
+
let finalAlpha = 0.2;
|
115
|
+
if (useAlpha) {
|
116
|
+
finalAlpha = (0.3 * (100 + percentageItem)) / 100;
|
117
|
+
} else {
|
118
|
+
finalL = (l * (100 + percentageItem)) / 100;
|
119
|
+
}
|
120
|
+
return `hsla(${h}, ${s}%, ${finalL}%, ${finalAlpha})`;
|
121
|
+
});
|
122
|
+
|
123
|
+
const backgroundGlow = `linear-gradient(45deg, ${colorListGlow.join(', ')})`;
|
124
|
+
|
125
|
+
const glowStyle = {
|
126
|
+
overflow: 'visible',
|
127
|
+
'&::before, &::after': {
|
128
|
+
content: '""',
|
129
|
+
position: 'absolute',
|
130
|
+
top: '-3px',
|
131
|
+
right: '-3px',
|
132
|
+
bottom: '-3px',
|
133
|
+
left: '-3px',
|
134
|
+
background,
|
135
|
+
backgroundSize: '300% 300%',
|
136
|
+
backgroundRepeat: 'no-repeat',
|
137
|
+
animation: 'glowRotate 10s linear infinite',
|
138
|
+
borderRadius: '14px !important',
|
139
|
+
zIndex: 0,
|
140
|
+
},
|
141
|
+
'&::after': {
|
142
|
+
background: backgroundGlow,
|
143
|
+
filter: 'blur(15px)',
|
144
|
+
},
|
145
|
+
|
146
|
+
'@keyframes glowRotate': {
|
147
|
+
'0%': {
|
148
|
+
backgroundPosition: '0 0',
|
149
|
+
},
|
150
|
+
'50%': {
|
151
|
+
backgroundPosition: '100% 0',
|
152
|
+
},
|
153
|
+
'100%': {
|
154
|
+
backgroundPosition: '0 0',
|
155
|
+
},
|
156
|
+
},
|
157
|
+
};
|
158
|
+
|
159
|
+
const wrapOnClose = useMemoizedFn(() => {
|
160
|
+
removeMagicToken();
|
161
|
+
rest?.onClose();
|
162
|
+
});
|
163
|
+
|
164
|
+
if (openVariant === 'page') {
|
165
|
+
return (
|
166
|
+
<Box
|
167
|
+
className="did-connect__container-page"
|
168
|
+
sx={mergeSx(glowStyle, {
|
169
|
+
borderRadius: 1,
|
170
|
+
position: 'relative',
|
171
|
+
zIndex: 1,
|
172
|
+
})}>
|
173
|
+
<Box
|
174
|
+
sx={{
|
175
|
+
border: `1px solid ${hexToRgba(color, 0.1)}`,
|
176
|
+
m: '-1px',
|
177
|
+
position: 'relative',
|
178
|
+
borderRadius: '12px',
|
179
|
+
zIndex: 2,
|
180
|
+
overflow: 'hidden',
|
181
|
+
}}>
|
182
|
+
<Component {...rest} onClose={wrapOnClose} setColor={setColor} hideCloseButton mode={openVariant} />
|
183
|
+
</Box>
|
184
|
+
</Box>
|
185
|
+
);
|
186
|
+
}
|
187
|
+
|
188
|
+
if (openVariant === 'drawer') {
|
189
|
+
return (
|
190
|
+
<DrawerComponent
|
191
|
+
className="did-connect__container-drawer"
|
192
|
+
disableSwipeToOpen
|
193
|
+
open={isOpen}
|
194
|
+
anchor="bottom"
|
195
|
+
drawerDragger={drawerDragger.current}
|
196
|
+
// @ts-ignore
|
197
|
+
onClose={handleOnClose}
|
198
|
+
slots={{
|
199
|
+
backdrop: BackdropWrap,
|
200
|
+
}}
|
201
|
+
PaperProps={{
|
202
|
+
sx: {
|
203
|
+
borderRadius: 3, // 保持跟 DID Wallet 一致
|
204
|
+
borderBottomLeftRadius: 0,
|
205
|
+
borderBottomRightRadius: 0,
|
206
|
+
p: '2px',
|
207
|
+
animation: 'glowBreathe 7s linear infinite',
|
208
|
+
'.did-connect__root': {
|
209
|
+
backgroundColor: 'transparent',
|
210
|
+
},
|
211
|
+
overflow: 'hidden',
|
212
|
+
'@keyframes glowBreathe': {
|
213
|
+
'0%, 100%': {
|
214
|
+
boxShadow: `
|
215
|
+
inset 0 0 7px ${hexToRgba(color, 0.3)},
|
216
|
+
inset 0 0 12px ${hexToRgba(color, 0.3)}`,
|
217
|
+
},
|
218
|
+
'50%': {
|
219
|
+
boxShadow: `
|
220
|
+
inset 0 0 18px ${hexToRgba(color, 0.7)},
|
221
|
+
inset 0 0 24px ${hexToRgba(color, 0.5)}`,
|
222
|
+
},
|
223
|
+
},
|
224
|
+
},
|
225
|
+
}}>
|
226
|
+
{hideCloseButton ? null : (
|
227
|
+
<Box
|
228
|
+
ref={drawerDragger}
|
229
|
+
sx={{
|
230
|
+
px: 1,
|
231
|
+
pt: 2,
|
232
|
+
m: 'auto',
|
233
|
+
mt: -1,
|
234
|
+
mb: -2,
|
235
|
+
zIndex: 2,
|
236
|
+
}}>
|
237
|
+
<Box
|
238
|
+
sx={{
|
239
|
+
width: '48px',
|
240
|
+
height: '4px',
|
241
|
+
borderRadius: '100vw',
|
242
|
+
backgroundColor: 'rgba(0, 0, 0, 0.2)',
|
243
|
+
}}
|
244
|
+
/>
|
245
|
+
</Box>
|
246
|
+
)}
|
247
|
+
<Box
|
248
|
+
sx={{
|
249
|
+
touchAction: 'none',
|
250
|
+
maxWidth: '100%',
|
251
|
+
width: 500,
|
252
|
+
height: 'auto',
|
253
|
+
}}>
|
254
|
+
{/* HACK: 由于 MUI 文档中描述 使用 keepMounted: false 可能会造成问题,所以采用下面的方案进行 HACK */}
|
255
|
+
{/* https://mui.com/material-ui/react-drawer/#keep-mounted */}
|
256
|
+
{showModal ? (
|
257
|
+
<Component {...rest} onClose={wrapOnClose} setColor={setColor} hideCloseButton mode={openVariant} />
|
258
|
+
) : null}
|
259
|
+
</Box>
|
260
|
+
</DrawerComponent>
|
261
|
+
);
|
262
|
+
}
|
263
|
+
|
264
|
+
return (
|
265
|
+
<Dialog
|
266
|
+
open={isOpen}
|
267
|
+
slots={{
|
268
|
+
backdrop: BackdropWrap,
|
269
|
+
}}
|
270
|
+
className="did-connect__container-dialog"
|
271
|
+
onClose={handleOnClose}
|
272
|
+
PaperProps={{
|
273
|
+
sx: {
|
274
|
+
// 避免样式被 server 中的定义覆盖
|
275
|
+
'&.MuiPaper-rounded': {
|
276
|
+
borderRadius: '12px !important',
|
277
|
+
},
|
278
|
+
position: 'relative',
|
279
|
+
...glowStyle,
|
280
|
+
},
|
281
|
+
}}>
|
282
|
+
<DialogContent
|
283
|
+
sx={{
|
284
|
+
maxWidth: 'calc(100vw - 18px)',
|
285
|
+
maxHeight: 'calc(100vh - 18px)',
|
286
|
+
p: '0px !important',
|
287
|
+
height: 'auto',
|
288
|
+
backgroundColor: 'background.default',
|
289
|
+
borderRadius: '12px !important',
|
290
|
+
zIndex: 1,
|
291
|
+
}}>
|
292
|
+
{showModal ? (
|
293
|
+
<Component
|
294
|
+
{...rest}
|
295
|
+
onClose={wrapOnClose}
|
296
|
+
setColor={setColor}
|
297
|
+
hideCloseButton={hideCloseButton}
|
298
|
+
mode={openVariant}
|
299
|
+
/>
|
300
|
+
) : null}
|
301
|
+
</DialogContent>
|
302
|
+
</Dialog>
|
303
|
+
);
|
304
|
+
}
|
305
|
+
|
306
|
+
return WithContainerComponent;
|
307
|
+
}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { createTheme, useTheme } from '@mui/material';
|
2
|
+
import { DID_CONNECT_THEME_LIGHT, DID_CONNECT_THEME_DARK } from '@blocklet/theme';
|
3
|
+
import { ThemeProvider } from '../Theme';
|
4
|
+
|
5
|
+
// DID Connect 使用自己的 Theme 配置,不受 Blocklet theme 影响
|
6
|
+
const themeLight = createTheme(DID_CONNECT_THEME_LIGHT);
|
7
|
+
const themeDark = createTheme(DID_CONNECT_THEME_DARK);
|
8
|
+
|
9
|
+
export default function withUxTheme(Component: React.ComponentType<any>) {
|
10
|
+
function WithUxThemeComponent(props: any) {
|
11
|
+
const { palette } = useTheme();
|
12
|
+
const theme = palette.mode === 'dark' ? themeDark : themeLight;
|
13
|
+
|
14
|
+
return (
|
15
|
+
<ThemeProvider theme={theme}>
|
16
|
+
<Component {...props} />
|
17
|
+
</ThemeProvider>
|
18
|
+
);
|
19
|
+
}
|
20
|
+
|
21
|
+
return WithUxThemeComponent;
|
22
|
+
}
|
package/src/Datatable/index.jsx
CHANGED
@@ -488,101 +488,138 @@ const alignCss = css`
|
|
488
488
|
}
|
489
489
|
`;
|
490
490
|
|
491
|
-
const TableContainer = styled('div', { shouldForwardProp: (prop) => prop !== 'verticalKeyWidth' })
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
491
|
+
const TableContainer = styled('div', { shouldForwardProp: (prop) => prop !== 'verticalKeyWidth' })(({
|
492
|
+
theme,
|
493
|
+
verticalKeyWidth,
|
494
|
+
}) => {
|
495
|
+
const primaryTextColor = theme.palette.text.primary;
|
496
|
+
const defaultBgColor = theme.palette.background.default;
|
497
|
+
const hoverBgColor = theme.palette.action.hover;
|
498
|
+
const oddRowBgColor = theme.palette.grey[50];
|
499
|
+
|
500
|
+
const verticalKeyWidthStyle = verticalKeyWidth
|
501
|
+
? `
|
502
|
+
${theme.breakpoints.down('md')} {
|
503
|
+
[class*='MUIDataTable-responsiveBase'] {
|
504
|
+
tr:not([class*='responsiveSimple']) {
|
505
|
+
td.MuiTableCell-body {
|
506
|
+
> div {
|
507
|
+
&:first-of-type {
|
508
|
+
width: ${verticalKeyWidth + (!/\D/.test(verticalKeyWidth) ? 'px' : '')};
|
509
|
+
}
|
510
|
+
}
|
511
|
+
}
|
512
|
+
}
|
513
|
+
}
|
514
|
+
}
|
515
|
+
`
|
516
|
+
: '';
|
497
517
|
|
498
|
-
|
499
|
-
&.
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
align-items: center;
|
518
|
+
return css`
|
519
|
+
&.datatable-hide-header {
|
520
|
+
thead.MuiTableHead-root {
|
521
|
+
display: none;
|
522
|
+
}
|
504
523
|
}
|
505
|
-
|
506
|
-
|
524
|
+
|
525
|
+
td {
|
526
|
+
&.vertical-align-top {
|
527
|
+
align-items: flex-start;
|
528
|
+
}
|
529
|
+
&.vertical-align-center {
|
530
|
+
align-items: center;
|
531
|
+
}
|
532
|
+
&.vertical-align-bottom {
|
533
|
+
align-items: flex-end;
|
534
|
+
}
|
507
535
|
}
|
508
|
-
}
|
509
536
|
|
510
|
-
height: 100%;
|
511
|
-
> .MuiPaper-root {
|
512
|
-
display: flex;
|
513
|
-
flex-direction: column;
|
514
537
|
height: 100%;
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
538
|
+
> .MuiPaper-root {
|
539
|
+
display: flex;
|
540
|
+
flex-direction: column;
|
541
|
+
height: 100%;
|
542
|
+
box-shadow: none;
|
543
|
+
background: none;
|
544
|
+
background-color: ${defaultBgColor};
|
520
545
|
}
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
font-size: 14px;
|
546
|
+
${theme.breakpoints.down('md')} {
|
547
|
+
td.MuiTableCell-body {
|
548
|
+
padding-right: 0;
|
549
|
+
}
|
550
|
+
[class*='MUIDataTable-responsiveBase'] {
|
551
|
+
tr:not([class*='responsiveSimple']) {
|
552
|
+
td.MuiTableCell-body {
|
553
|
+
display: flex;
|
554
|
+
> div {
|
531
555
|
width: auto;
|
532
|
-
flex:
|
533
|
-
|
534
|
-
|
535
|
-
|
556
|
+
flex: 1;
|
557
|
+
&:first-of-type {
|
558
|
+
font-weight: bold;
|
559
|
+
font-size: 14px;
|
560
|
+
width: auto;
|
561
|
+
flex: 0 0 auto;
|
562
|
+
padding-right: 16px;
|
563
|
+
&:empty {
|
564
|
+
padding-right: 0;
|
565
|
+
}
|
536
566
|
}
|
537
567
|
}
|
538
568
|
}
|
539
569
|
}
|
540
570
|
}
|
541
571
|
}
|
542
|
-
|
543
|
-
${(props) => props.theme.breakpoints.up('md')} {
|
544
|
-
${alignCss}
|
545
|
-
}
|
546
|
-
${(props) => props.theme.breakpoints.up('sm')} {
|
547
|
-
[class*='responsiveSimple'] {
|
572
|
+
${theme.breakpoints.up('md')} {
|
548
573
|
${alignCss}
|
549
574
|
}
|
550
|
-
|
575
|
+
${theme.breakpoints.up('sm')} {
|
576
|
+
[class*='responsiveSimple'] {
|
577
|
+
${alignCss}
|
578
|
+
}
|
579
|
+
}
|
551
580
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
tr:not([class*='responsiveSimple']) {
|
558
|
-
td.MuiTableCell-body {
|
559
|
-
> div {
|
560
|
-
&:first-of-type {
|
561
|
-
width: ${inProps.verticalKeyWidth + (!/\D/.test(inProps.verticalKeyWidth) ? 'px' : '')};
|
562
|
-
}
|
563
|
-
}
|
564
|
-
}
|
565
|
-
}
|
566
|
-
}
|
567
|
-
}
|
568
|
-
`;
|
581
|
+
${verticalKeyWidthStyle}
|
582
|
+
|
583
|
+
.MuiTableCell-head {
|
584
|
+
color: ${primaryTextColor};
|
585
|
+
background-color: ${defaultBgColor};
|
569
586
|
}
|
570
587
|
|
571
|
-
|
572
|
-
|
588
|
+
.MuiTableCell-root {
|
589
|
+
color: ${primaryTextColor};
|
590
|
+
}
|
573
591
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
background-color: ${
|
592
|
+
.MuiTableRow-root {
|
593
|
+
background-color: ${defaultBgColor};
|
594
|
+
&:nth-of-type(even) {
|
595
|
+
background-color: ${defaultBgColor};
|
596
|
+
}
|
597
|
+
&:hover {
|
598
|
+
background-color: ${hoverBgColor};
|
599
|
+
}
|
600
|
+
&.MuiTableRow-footer {
|
601
|
+
background-color: ${defaultBgColor};
|
578
602
|
}
|
579
603
|
}
|
580
|
-
|
581
|
-
|
604
|
+
|
605
|
+
&.datatable-stripped {
|
606
|
+
.MuiTableRow-root:nth-of-type(odd) {
|
607
|
+
background-color: ${oddRowBgColor};
|
608
|
+
&:hover {
|
609
|
+
background-color: ${hoverBgColor};
|
610
|
+
}
|
611
|
+
&.MuiTableRow-footer {
|
612
|
+
background-color: ${defaultBgColor};
|
613
|
+
}
|
614
|
+
}
|
615
|
+
}
|
616
|
+
`;
|
617
|
+
});
|
582
618
|
|
583
619
|
const FooterContainer = styled('div')`
|
584
620
|
display: flex;
|
585
621
|
align-items: center;
|
622
|
+
background-color: ${(props) => props.theme.palette.background.default};
|
586
623
|
.datatable-footer {
|
587
624
|
position: relative;
|
588
625
|
margin-left: auto;
|
package/src/Dialog/confirm.jsx
CHANGED
@@ -15,6 +15,7 @@ import Dialog from './dialog';
|
|
15
15
|
* children?: React.ReactNode,
|
16
16
|
* showCancelButton?: true | false,
|
17
17
|
* showCloseButton?: true | false,
|
18
|
+
* showConfirmButton?: true | false,
|
18
19
|
* fullScreen?: false | true,
|
19
20
|
* confirmButton?: {text: React.ReactNode, props?: ButtonProps}
|
20
21
|
* cancelButton?: {text: React.ReactNode, props?: ButtonProps}
|
@@ -35,6 +36,7 @@ export default function Confirm({
|
|
35
36
|
onCancel,
|
36
37
|
showCloseButton,
|
37
38
|
showCancelButton,
|
39
|
+
showConfirmButton,
|
38
40
|
fullScreen,
|
39
41
|
confirmButton,
|
40
42
|
cancelButton,
|
@@ -81,29 +83,33 @@ export default function Confirm({
|
|
81
83
|
},
|
82
84
|
}}
|
83
85
|
actions={
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
e
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
86
|
+
showCancelButton || showConfirmButton ? (
|
87
|
+
<>
|
88
|
+
{showCancelButton && (
|
89
|
+
<Button
|
90
|
+
onClick={(e) => {
|
91
|
+
e.stopPropagation();
|
92
|
+
onCancel(e, 'closeButton');
|
93
|
+
}}
|
94
|
+
color="primary"
|
95
|
+
{...cancelButton.props}>
|
96
|
+
{cancelButton.text}
|
97
|
+
</Button>
|
98
|
+
)}
|
99
|
+
{showConfirmButton && (
|
100
|
+
<Button
|
101
|
+
onClick={(e) => {
|
102
|
+
e.stopPropagation();
|
103
|
+
onConfirm(e);
|
104
|
+
}}
|
105
|
+
color="primary"
|
106
|
+
autoFocus
|
107
|
+
{...confirmButton.props}>
|
108
|
+
{confirmButton.text}
|
109
|
+
</Button>
|
110
|
+
)}
|
111
|
+
</>
|
112
|
+
) : null
|
107
113
|
}>
|
108
114
|
{children}
|
109
115
|
</Dialog>
|
@@ -117,6 +123,7 @@ Confirm.propTypes = {
|
|
117
123
|
onCancel: PropTypes.func.isRequired,
|
118
124
|
children: PropTypes.node,
|
119
125
|
showCancelButton: PropTypes.bool,
|
126
|
+
showConfirmButton: PropTypes.bool,
|
120
127
|
showCloseButton: PropTypes.bool,
|
121
128
|
fullScreen: PropTypes.bool,
|
122
129
|
// 可以传入 {text: ..., props: ...}
|
@@ -133,6 +140,7 @@ Confirm.propTypes = {
|
|
133
140
|
|
134
141
|
Confirm.defaultProps = {
|
135
142
|
showCancelButton: true,
|
143
|
+
showConfirmButton: true,
|
136
144
|
showCloseButton: true,
|
137
145
|
fullScreen: false,
|
138
146
|
confirmButton: {
|
@@ -19,6 +19,7 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
19
19
|
loading: false,
|
20
20
|
showCancelButton: true,
|
21
21
|
showCloseButton: true,
|
22
|
+
showConfirmButton: true,
|
22
23
|
confirmButtonText: 'Confirm',
|
23
24
|
confirmButtonProps: {},
|
24
25
|
cancelButtonText: 'Cancel',
|
@@ -43,6 +44,7 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
43
44
|
state.onCancel = params.onCancel || noop;
|
44
45
|
state.showCloseButton = params.showCloseButton ?? true;
|
45
46
|
state.showCancelButton = params.showCancelButton ?? true;
|
47
|
+
state.showConfirmButton = params.showConfirmButton ?? true;
|
46
48
|
if (params.confirmButtonText) state.confirmButtonText = params.confirmButtonText;
|
47
49
|
if (params.confirmButtonProps) state.confirmButtonProps = params.confirmButtonProps;
|
48
50
|
if (params.cancelButtonText) state.cancelButtonText = params.cancelButtonText;
|
@@ -62,6 +64,9 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
62
64
|
state.confirmButtonProps = {};
|
63
65
|
state.cancelButtonText = 'Cancel';
|
64
66
|
state.cancelButtonProps = {};
|
67
|
+
state.showConfirmButton = true;
|
68
|
+
state.showCancelButton = true;
|
69
|
+
state.showCloseButton = true;
|
65
70
|
});
|
66
71
|
const close = useMemoizedFn(() => {
|
67
72
|
state.show = false;
|
@@ -130,6 +135,7 @@ const ConfirmHolder = forwardRef((props, ref) => {
|
|
130
135
|
}}
|
131
136
|
showCloseButton={state.showCloseButton}
|
132
137
|
showCancelButton={state.showCancelButton}
|
138
|
+
showConfirmButton={state.showConfirmButton}
|
133
139
|
cancelButton={{
|
134
140
|
text: state.cancelButtonText,
|
135
141
|
props: {
|
package/src/Footer/index.tsx
CHANGED
@@ -77,7 +77,7 @@ const Container = styled('div', {
|
|
77
77
|
position: relative;
|
78
78
|
margin-top: 64px;
|
79
79
|
padding: 24px 0 32px;
|
80
|
-
border-top: 1px solid ${(props) =>
|
80
|
+
border-top: 1px solid ${(props) => props.theme.palette.divider};
|
81
81
|
box-sizing: border-box;
|
82
82
|
width: 100%;
|
83
83
|
|
@@ -92,7 +92,7 @@ const Container = styled('div', {
|
|
92
92
|
flex-wrap: wrap;
|
93
93
|
|
94
94
|
.footer-item {
|
95
|
-
color: ${(
|
95
|
+
color: ${(props) => props.theme.palette.text.hint};
|
96
96
|
display: flex;
|
97
97
|
align-items: center;
|
98
98
|
flex-wrap: wrap;
|