@arcblock/ux 2.12.55 → 2.12.57
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/Datatable/CustomToolbar.js +4 -3
- package/lib/Datatable/DatatableContext.js +3 -0
- package/lib/Datatable/index.d.ts +1 -0
- package/lib/Datatable/index.js +6 -0
- package/lib/PoweredByArcBlock/index.d.ts +2 -1
- package/lib/PoweredByArcBlock/index.js +2 -1
- package/package.json +5 -5
- package/src/Datatable/CustomToolbar.jsx +5 -4
- package/src/Datatable/DatatableContext.jsx +3 -0
- package/src/Datatable/index.jsx +6 -1
- package/src/PoweredByArcBlock/index.tsx +3 -2
@@ -32,6 +32,7 @@ export default function CustomToolbar(props) {
|
|
32
32
|
const toolbarId = useRef(Math.random().toString(32).slice(2));
|
33
33
|
const [searchOpened, setSearchOpened] = useState(false);
|
34
34
|
const {
|
35
|
+
customPreButtons,
|
35
36
|
customButtons,
|
36
37
|
loading,
|
37
38
|
disabled
|
@@ -129,12 +130,12 @@ export default function CustomToolbar(props) {
|
|
129
130
|
}
|
130
131
|
});
|
131
132
|
}
|
132
|
-
const showMore = [!hidePrint, ...defaultButtons, ...customButtons].filter(e => !!e).length > 1 && isMobile;
|
133
|
+
const showMore = [...customPreButtons, !hidePrint, ...defaultButtons, ...customButtons].filter(e => !!e).length > 1 && isMobile;
|
133
134
|
const allPops = [];
|
134
135
|
|
135
136
|
// Large screens show the toolbar buttons directly, small screens show the drop-down menu style buttons
|
136
137
|
// The right-hand button of the form toolbar in desktop mode
|
137
|
-
const toolbarButtons = [...defaultButtons, ...customButtons].map((e, index) => {
|
138
|
+
const toolbarButtons = [...customPreButtons, ...defaultButtons, ...customButtons].map((e, index) => {
|
138
139
|
if (/*#__PURE__*/isValidElement(e)) {
|
139
140
|
return e;
|
140
141
|
}
|
@@ -189,7 +190,7 @@ export default function CustomToolbar(props) {
|
|
189
190
|
});
|
190
191
|
|
191
192
|
// The toolbar menu in the mobile to replace toolbarButtons
|
192
|
-
const menuItems = [...defaultButtons, ...customButtons].map((e, index) => {
|
193
|
+
const menuItems = [...customPreButtons, ...defaultButtons, ...customButtons].map((e, index) => {
|
193
194
|
const popId = getPopId(index);
|
194
195
|
let content;
|
195
196
|
if (/*#__PURE__*/isValidElement(e)) {
|
@@ -10,12 +10,15 @@ function DatatableProvider({
|
|
10
10
|
children
|
11
11
|
}) {
|
12
12
|
const [customButtons, setCustomButtons] = useState([]);
|
13
|
+
const [customPreButtons, setCustomPreButtons] = useState([]);
|
13
14
|
const [loading, setLoading] = useState(false);
|
14
15
|
const [disabled, setDisabled] = useState(false);
|
15
16
|
const [filterLabel, setFilterLabel] = useState('Filter');
|
16
17
|
const value = {
|
17
18
|
customButtons,
|
18
19
|
setCustomButtons,
|
20
|
+
customPreButtons,
|
21
|
+
setCustomPreButtons,
|
19
22
|
filterLabel,
|
20
23
|
setFilterLabel,
|
21
24
|
loading,
|
package/lib/Datatable/index.d.ts
CHANGED
@@ -29,6 +29,7 @@ export type DataTableProps = {
|
|
29
29
|
} & import("mui-datatables").MUIDataTableOptions;
|
30
30
|
style?: import("react").CSSProperties;
|
31
31
|
customButtons?: Array<DataTableCustomButton>;
|
32
|
+
customPreButtons?: Array<DataTableCustomButton>;
|
32
33
|
onChange?: (state: DataTableState, action: string) => void | Promise<void>;
|
33
34
|
loading?: false | true;
|
34
35
|
disabled?: false | true;
|
package/lib/Datatable/index.js
CHANGED
@@ -48,6 +48,7 @@ import { styled } from '../Theme';
|
|
48
48
|
* options?: { searchDebounceTime?: number } & import('mui-datatables').MUIDataTableOptions,
|
49
49
|
* style?: import('react').CSSProperties,
|
50
50
|
* customButtons?: Array<DataTableCustomButton>,
|
51
|
+
* customPreButtons?: Array<DataTableCustomButton>,
|
51
52
|
* onChange?: (state: DataTableState, action: string) => void | Promise<void>,
|
52
53
|
* loading?: false | true,
|
53
54
|
* disabled?: false | true,
|
@@ -166,6 +167,7 @@ function ReDataTable({
|
|
166
167
|
options,
|
167
168
|
// The options object is usually a property supported by mui-datatable
|
168
169
|
style,
|
170
|
+
customPreButtons,
|
169
171
|
customButtons,
|
170
172
|
onChange,
|
171
173
|
loading,
|
@@ -181,6 +183,7 @@ function ReDataTable({
|
|
181
183
|
}) {
|
182
184
|
const oldState = useRef(null);
|
183
185
|
const {
|
186
|
+
setCustomPreButtons,
|
184
187
|
setCustomButtons,
|
185
188
|
setFilterLabel,
|
186
189
|
setLoading,
|
@@ -271,6 +274,7 @@ function ReDataTable({
|
|
271
274
|
return e;
|
272
275
|
});
|
273
276
|
useEffect(() => setCustomButtons(customButtons || []), [customButtons]);
|
277
|
+
useEffect(() => setCustomPreButtons(customPreButtons || []), [customPreButtons]);
|
274
278
|
useEffect(() => setLoading(loading), [loading]);
|
275
279
|
useEffect(() => setDisabled(disabled), [disabled]);
|
276
280
|
let emptyEl;
|
@@ -435,6 +439,7 @@ ReDataTable.propTypes = {
|
|
435
439
|
locale: PropTypes.string,
|
436
440
|
loading: PropTypes.bool,
|
437
441
|
disabled: PropTypes.bool,
|
442
|
+
customPreButtons: PropTypes.array,
|
438
443
|
customButtons: PropTypes.array,
|
439
444
|
onChange: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
440
445
|
stripped: PropTypes.bool,
|
@@ -451,6 +456,7 @@ ReDataTable.defaultProps = {
|
|
451
456
|
locale: 'en',
|
452
457
|
loading: false,
|
453
458
|
disabled: false,
|
459
|
+
customPreButtons: [],
|
454
460
|
customButtons: [],
|
455
461
|
onChange: '',
|
456
462
|
stripped: false,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { type TypographyProps, type LinkProps } from '@mui/material';
|
2
2
|
export interface PoweredByArcBlockProps extends TypographyProps {
|
3
3
|
linkProps?: LinkProps;
|
4
|
+
showExtra?: boolean;
|
4
5
|
}
|
5
|
-
export default function PoweredByArcBlock({ linkProps, ...props }: PoweredByArcBlockProps): import("react/jsx-runtime").JSX.Element;
|
6
|
+
export default function PoweredByArcBlock({ linkProps, showExtra, ...props }: PoweredByArcBlockProps): import("react/jsx-runtime").JSX.Element;
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Link, Typography } from '@mui/material';
|
3
3
|
export default function PoweredByArcBlock({
|
4
4
|
linkProps,
|
5
|
+
showExtra,
|
5
6
|
...props
|
6
7
|
}) {
|
7
8
|
return /*#__PURE__*/_jsxs(Typography, {
|
@@ -18,6 +19,6 @@ export default function PoweredByArcBlock({
|
|
18
19
|
underline: "hover",
|
19
20
|
...linkProps,
|
20
21
|
children: "Blocklet Technology"
|
21
|
-
}),
|
22
|
+
}), showExtra ? ', the decentralized web engine.' : null]
|
22
23
|
});
|
23
24
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.12.
|
3
|
+
"version": "2.12.57",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -70,12 +70,12 @@
|
|
70
70
|
"react": ">=18.2.0",
|
71
71
|
"react-router-dom": ">=6.22.3"
|
72
72
|
},
|
73
|
-
"gitHead": "
|
73
|
+
"gitHead": "3777c011368654b134e493f4a854df15d249caa5",
|
74
74
|
"dependencies": {
|
75
75
|
"@arcblock/did-motif": "^1.1.13",
|
76
|
-
"@arcblock/icons": "^2.12.
|
77
|
-
"@arcblock/nft-display": "^2.12.
|
78
|
-
"@arcblock/react-hooks": "^2.12.
|
76
|
+
"@arcblock/icons": "^2.12.57",
|
77
|
+
"@arcblock/nft-display": "^2.12.57",
|
78
|
+
"@arcblock/react-hooks": "^2.12.57",
|
79
79
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
80
80
|
"@fontsource/roboto": "^5.2.5",
|
81
81
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
@@ -32,7 +32,7 @@ export default function CustomToolbar(props) {
|
|
32
32
|
const isMobile = useMobile();
|
33
33
|
const toolbarId = useRef(Math.random().toString(32).slice(2));
|
34
34
|
const [searchOpened, setSearchOpened] = useState(false);
|
35
|
-
const { customButtons, loading, disabled } = useDatatableContext();
|
35
|
+
const { customPreButtons, customButtons, loading, disabled } = useDatatableContext();
|
36
36
|
|
37
37
|
const {
|
38
38
|
data,
|
@@ -136,13 +136,14 @@ export default function CustomToolbar(props) {
|
|
136
136
|
});
|
137
137
|
}
|
138
138
|
|
139
|
-
const showMore =
|
139
|
+
const showMore =
|
140
|
+
[...customPreButtons, !hidePrint, ...defaultButtons, ...customButtons].filter((e) => !!e).length > 1 && isMobile;
|
140
141
|
|
141
142
|
const allPops = [];
|
142
143
|
|
143
144
|
// Large screens show the toolbar buttons directly, small screens show the drop-down menu style buttons
|
144
145
|
// The right-hand button of the form toolbar in desktop mode
|
145
|
-
const toolbarButtons = [...defaultButtons, ...customButtons].map((e, index) => {
|
146
|
+
const toolbarButtons = [...customPreButtons, ...defaultButtons, ...customButtons].map((e, index) => {
|
146
147
|
if (isValidElement(e)) {
|
147
148
|
return e;
|
148
149
|
}
|
@@ -198,7 +199,7 @@ export default function CustomToolbar(props) {
|
|
198
199
|
});
|
199
200
|
|
200
201
|
// The toolbar menu in the mobile to replace toolbarButtons
|
201
|
-
const menuItems = [...defaultButtons, ...customButtons].map((e, index) => {
|
202
|
+
const menuItems = [...customPreButtons, ...defaultButtons, ...customButtons].map((e, index) => {
|
202
203
|
const popId = getPopId(index);
|
203
204
|
|
204
205
|
let content;
|
@@ -7,6 +7,7 @@ const { Provider } = DatatableContext;
|
|
7
7
|
// eslint-disable-next-line react/prop-types
|
8
8
|
function DatatableProvider({ children }) {
|
9
9
|
const [customButtons, setCustomButtons] = useState([]);
|
10
|
+
const [customPreButtons, setCustomPreButtons] = useState([]);
|
10
11
|
const [loading, setLoading] = useState(false);
|
11
12
|
const [disabled, setDisabled] = useState(false);
|
12
13
|
const [filterLabel, setFilterLabel] = useState('Filter');
|
@@ -14,6 +15,8 @@ function DatatableProvider({ children }) {
|
|
14
15
|
const value = {
|
15
16
|
customButtons,
|
16
17
|
setCustomButtons,
|
18
|
+
customPreButtons,
|
19
|
+
setCustomPreButtons,
|
17
20
|
filterLabel,
|
18
21
|
setFilterLabel,
|
19
22
|
loading,
|
package/src/Datatable/index.jsx
CHANGED
@@ -47,6 +47,7 @@ import { styled } from '../Theme';
|
|
47
47
|
* options?: { searchDebounceTime?: number } & import('mui-datatables').MUIDataTableOptions,
|
48
48
|
* style?: import('react').CSSProperties,
|
49
49
|
* customButtons?: Array<DataTableCustomButton>,
|
50
|
+
* customPreButtons?: Array<DataTableCustomButton>,
|
50
51
|
* onChange?: (state: DataTableState, action: string) => void | Promise<void>,
|
51
52
|
* loading?: false | true,
|
52
53
|
* disabled?: false | true,
|
@@ -166,6 +167,7 @@ function ReDataTable({
|
|
166
167
|
locale,
|
167
168
|
options, // The options object is usually a property supported by mui-datatable
|
168
169
|
style,
|
170
|
+
customPreButtons,
|
169
171
|
customButtons,
|
170
172
|
onChange,
|
171
173
|
loading,
|
@@ -180,7 +182,7 @@ function ReDataTable({
|
|
180
182
|
...rest
|
181
183
|
}) {
|
182
184
|
const oldState = useRef(null);
|
183
|
-
const { setCustomButtons, setFilterLabel, setLoading, setDisabled } = useDatatableContext();
|
185
|
+
const { setCustomPreButtons, setCustomButtons, setFilterLabel, setLoading, setDisabled } = useDatatableContext();
|
184
186
|
|
185
187
|
const disabledCellStyle = {
|
186
188
|
cursor: 'not-allowed',
|
@@ -276,6 +278,7 @@ function ReDataTable({
|
|
276
278
|
});
|
277
279
|
|
278
280
|
useEffect(() => setCustomButtons(customButtons || []), [customButtons]);
|
281
|
+
useEffect(() => setCustomPreButtons(customPreButtons || []), [customPreButtons]);
|
279
282
|
useEffect(() => setLoading(loading), [loading]);
|
280
283
|
useEffect(() => setDisabled(disabled), [disabled]);
|
281
284
|
|
@@ -420,6 +423,7 @@ ReDataTable.propTypes = {
|
|
420
423
|
locale: PropTypes.string,
|
421
424
|
loading: PropTypes.bool,
|
422
425
|
disabled: PropTypes.bool,
|
426
|
+
customPreButtons: PropTypes.array,
|
423
427
|
customButtons: PropTypes.array,
|
424
428
|
onChange: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
425
429
|
stripped: PropTypes.bool,
|
@@ -437,6 +441,7 @@ ReDataTable.defaultProps = {
|
|
437
441
|
locale: 'en',
|
438
442
|
loading: false,
|
439
443
|
disabled: false,
|
444
|
+
customPreButtons: [],
|
440
445
|
customButtons: [],
|
441
446
|
onChange: '',
|
442
447
|
stripped: false,
|
@@ -2,9 +2,10 @@ import { Link, Typography, type TypographyProps, type LinkProps } from '@mui/mat
|
|
2
2
|
|
3
3
|
export interface PoweredByArcBlockProps extends TypographyProps {
|
4
4
|
linkProps?: LinkProps;
|
5
|
+
showExtra?: boolean;
|
5
6
|
}
|
6
7
|
|
7
|
-
export default function PoweredByArcBlock({ linkProps, ...props }: PoweredByArcBlockProps) {
|
8
|
+
export default function PoweredByArcBlock({ linkProps, showExtra, ...props }: PoweredByArcBlockProps) {
|
8
9
|
return (
|
9
10
|
<Typography {...props}>
|
10
11
|
Powered by{' '}
|
@@ -15,7 +16,7 @@ export default function PoweredByArcBlock({ linkProps, ...props }: PoweredByArcB
|
|
15
16
|
<Link href="https://www.blocklet.io" target="_blank" underline="hover" {...linkProps}>
|
16
17
|
Blocklet Technology
|
17
18
|
</Link>
|
18
|
-
, the decentralized web engine.
|
19
|
+
{showExtra ? ', the decentralized web engine.' : null}
|
19
20
|
</Typography>
|
20
21
|
);
|
21
22
|
}
|