@arcblock/ux 2.5.40 → 2.5.42
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/index.js
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.default =
|
6
|
+
exports.default = DataTable;
|
7
7
|
exports.getDurableData = void 0;
|
8
8
|
|
9
9
|
var _react = require("react");
|
@@ -56,10 +56,61 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
56
56
|
|
57
57
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
58
58
|
|
59
|
-
|
60
|
-
|
59
|
+
/**
|
60
|
+
* @typedef {{
|
61
|
+
* icon: import('react').ReactElement,
|
62
|
+
* title: string,
|
63
|
+
* }} DataTableCustomButton
|
64
|
+
*/
|
65
|
+
|
66
|
+
/**
|
67
|
+
* @typedef {{
|
68
|
+
* name: string,
|
69
|
+
* label: string,
|
70
|
+
* width?: number,
|
71
|
+
* options?: {
|
72
|
+
* filter?: boolean,
|
73
|
+
* sort?: boolean,
|
74
|
+
* customBodyRender?: (value: any) => import('react').ReactElement,
|
75
|
+
* customBodyRenderLite?: (index: number) => import('react').ReactElement
|
76
|
+
* } & import('mui-datatables').MUIDataTableColumnOptions
|
77
|
+
* } & import('mui-datatables').MUIDataTableColumnDef} DataTableColumn
|
78
|
+
*/
|
79
|
+
|
80
|
+
/**
|
81
|
+
* @typedef {Pick<import('mui-datatables').MUIDataTableState, 'count' | 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder' | 'filterList'>} DataTableState
|
82
|
+
*/
|
83
|
+
|
84
|
+
/**
|
85
|
+
* @typedef {{
|
86
|
+
* data: Array<object | number[] | string[]>,
|
87
|
+
* columns: Array<DataTableColumn>,
|
88
|
+
* locale?: string,
|
89
|
+
* options?: import('mui-datatables').MUIDataTableOptions,
|
90
|
+
* style?: import('react').CSSProperties,
|
91
|
+
* customButtons?: Array<DataTableCustomButton>,
|
92
|
+
* onChange?: (state: DataTableState, action: string) => void | Promise<void>,
|
93
|
+
* loading?: boolean,
|
94
|
+
* disabled?: boolean,
|
95
|
+
* stripped?: boolean,
|
96
|
+
* verticalKeyWidth?: number | string,
|
97
|
+
* hideTableHeader?: boolean,
|
98
|
+
* components?: import('react').ReactElement,
|
99
|
+
* emptyNode?: import('react').ReactElement,
|
100
|
+
* durable?: string,
|
101
|
+
* durableKeys?: 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder'
|
102
|
+
* } & import('mui-datatables').MUIDataTableProps} DataTableProps
|
103
|
+
*/
|
104
|
+
|
105
|
+
/**
|
106
|
+
* @description
|
107
|
+
* @export
|
108
|
+
* @param {DataTableProps} props
|
109
|
+
* @return {import('react').ReactComponentElement}
|
110
|
+
*/
|
111
|
+
function DataTable(props) {
|
61
112
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatatableContext.DatatableProvider, {
|
62
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
113
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ReDataTable, _objectSpread({}, props))
|
63
114
|
});
|
64
115
|
}
|
65
116
|
|
@@ -89,7 +140,7 @@ const fixCellProp = (tempObj, cellProps) => {
|
|
89
140
|
*/
|
90
141
|
|
91
142
|
|
92
|
-
function
|
143
|
+
function ReDataTable(_ref) {
|
93
144
|
let {
|
94
145
|
data: originData,
|
95
146
|
columns: originColumns,
|
@@ -108,8 +159,8 @@ function ReDatatable(_ref2) {
|
|
108
159
|
emptyNode,
|
109
160
|
durable,
|
110
161
|
durableKeys
|
111
|
-
} =
|
112
|
-
rest = _objectWithoutProperties(
|
162
|
+
} = _ref,
|
163
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
113
164
|
|
114
165
|
const oldState = (0, _react.useRef)(null);
|
115
166
|
const {
|
@@ -372,7 +423,7 @@ function ReDatatable(_ref2) {
|
|
372
423
|
});
|
373
424
|
}
|
374
425
|
|
375
|
-
|
426
|
+
ReDataTable.propTypes = {
|
376
427
|
data: _propTypes.default.array.isRequired,
|
377
428
|
columns: _propTypes.default.array.isRequired,
|
378
429
|
options: _propTypes.default.object,
|
@@ -390,7 +441,7 @@ ReDatatable.propTypes = {
|
|
390
441
|
durable: _propTypes.default.string,
|
391
442
|
durableKeys: _propTypes.default.array
|
392
443
|
};
|
393
|
-
|
444
|
+
ReDataTable.defaultProps = {
|
394
445
|
options: {},
|
395
446
|
style: {},
|
396
447
|
locale: 'en',
|
@@ -522,7 +522,7 @@ SessionManager.defaultProps = {
|
|
522
522
|
dark: false,
|
523
523
|
size: 24
|
524
524
|
};
|
525
|
-
const StyledPopper = (0, _Theme.styled)(_material.Popper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: ", ";\n .MuiList-root {\n width: 280px;\n }\n .session-manager-user {\n font-size: 12px;\n flex-direction: column;\n align-items: flex-start;\n padding: 24px 24px 10px;\n }\n .session-manager-user-name {\n font-size: 20px;\n color: ", ";\n font-weight: bold;\n margin-bottom: 10px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .session-manager-id-item {\n position: relative;\n padding-left: 8px;\n /* HACK: \u5F53\u524D\u5143\u7D20\u65E2\u662F\u7B2C\u4E00\u4E2A\uFF0C\u4E5F\u662F\u6700\u540E\u4E00\u4E2A\uFF0C\u5373\u53EA\u6709\u4E00\u4E2A\u540C\u7EA7\u5143\u7D20 */\n &:
|
525
|
+
const StyledPopper = (0, _Theme.styled)(_material.Popper)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: ", ";\n .MuiList-root {\n width: 280px;\n }\n .session-manager-user {\n font-size: 12px;\n flex-direction: column;\n align-items: flex-start;\n padding: 24px 24px 10px;\n }\n .session-manager-user-name {\n font-size: 20px;\n color: ", ";\n font-weight: bold;\n margin-bottom: 10px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n }\n .session-manager-id-item {\n position: relative;\n padding-left: 8px;\n /* HACK: \u5F53\u524D\u5143\u7D20\u65E2\u662F\u7B2C\u4E00\u4E2A\uFF0C\u4E5F\u662F\u6700\u540E\u4E00\u4E2A\uFF0C\u5373\u53EA\u6709\u4E00\u4E2A\u540C\u7EA7\u5143\u7D20 */\n &:first-of-type:last-of-type {\n padding-left: 0;\n &:before,\n &:after {\n content: unset;\n }\n }\n &:before {\n position: absolute;\n content: '';\n left: 0px;\n top: 50%;\n width: 6px;\n height: 1px;\n background-color: #aeaeae;\n }\n &:not(:last-of-type):after {\n position: absolute;\n content: '';\n left: 0px;\n top: 50%;\n height: 100%;\n width: 1px;\n background-color: #aeaeae;\n }\n }\n .session-manager-menu-item {\n padding: 18.5px 24px;\n color: #777;\n font-size: 16px;\n &:hover {\n background-color: #fbfbfb;\n }\n }\n .session-manager-menu-icon {\n color: #999;\n margin-right: 16px;\n }\n"])), _ref3 => {
|
526
526
|
let {
|
527
527
|
theme
|
528
528
|
} = _ref3;
|
package/lib/SplitButton/index.js
CHANGED
@@ -144,5 +144,5 @@ SplitButton.defaultProps = {
|
|
144
144
|
menuButtonProps: {}
|
145
145
|
};
|
146
146
|
SplitButton.Item = _MenuItem.default;
|
147
|
-
const StyledButtonGroup = (0, _Theme.styled)(_ButtonGroup.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n > .MuiButtonBase-root:last-
|
147
|
+
const StyledButtonGroup = (0, _Theme.styled)(_ButtonGroup.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n > .MuiButtonBase-root:last-of-type {\n min-width: 2em;\n padding-left: 0;\n padding-right: 0;\n }\n"])));
|
148
148
|
const StyledPopper = (0, _Theme.styled)(_Popper.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: ", ";\n .MuiList-root {\n padding: 4px 0;\n }\n .MuiListItem-root {\n padding-top: 4px;\n padding-bottom: 4px;\n }\n"])), props => props.theme.zIndex.tooltip);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.5.
|
3
|
+
"version": "2.5.42",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -45,11 +45,11 @@
|
|
45
45
|
"peerDependencies": {
|
46
46
|
"react": ">=18.1.0"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "2644a25c631bdd648701fa3aa365a35edebfac34",
|
49
49
|
"dependencies": {
|
50
50
|
"@arcblock/did-motif": "^1.1.10",
|
51
|
-
"@arcblock/icons": "^2.5.
|
52
|
-
"@arcblock/react-hooks": "^2.5.
|
51
|
+
"@arcblock/icons": "^2.5.42",
|
52
|
+
"@arcblock/react-hooks": "^2.5.42",
|
53
53
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
54
54
|
"@emotion/react": "^11.10.4",
|
55
55
|
"@emotion/styled": "^11.10.4",
|
package/src/Datatable/index.js
CHANGED
@@ -10,14 +10,66 @@ import clsx from 'clsx';
|
|
10
10
|
import CircularProgress from '@mui/material/CircularProgress';
|
11
11
|
import Empty from '../Empty';
|
12
12
|
import CustomToolbar from './CustomToolbar';
|
13
|
-
import { DatatableProvider, useDatatableContext } from './DatatableContext';
|
13
|
+
import { DatatableProvider as DataTableProvider, useDatatableContext } from './DatatableContext';
|
14
14
|
import { styled } from '../Theme';
|
15
15
|
|
16
|
-
|
16
|
+
/**
|
17
|
+
* @typedef {{
|
18
|
+
* icon: import('react').ReactElement,
|
19
|
+
* title: string,
|
20
|
+
* }} DataTableCustomButton
|
21
|
+
*/
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @typedef {{
|
25
|
+
* name: string,
|
26
|
+
* label: string,
|
27
|
+
* width?: number,
|
28
|
+
* options?: {
|
29
|
+
* filter?: boolean,
|
30
|
+
* sort?: boolean,
|
31
|
+
* customBodyRender?: (value: any) => import('react').ReactElement,
|
32
|
+
* customBodyRenderLite?: (index: number) => import('react').ReactElement
|
33
|
+
* } & import('mui-datatables').MUIDataTableColumnOptions
|
34
|
+
* } & import('mui-datatables').MUIDataTableColumnDef} DataTableColumn
|
35
|
+
*/
|
36
|
+
|
37
|
+
/**
|
38
|
+
* @typedef {Pick<import('mui-datatables').MUIDataTableState, 'count' | 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder' | 'filterList'>} DataTableState
|
39
|
+
*/
|
40
|
+
|
41
|
+
/**
|
42
|
+
* @typedef {{
|
43
|
+
* data: Array<object | number[] | string[]>,
|
44
|
+
* columns: Array<DataTableColumn>,
|
45
|
+
* locale?: string,
|
46
|
+
* options?: import('mui-datatables').MUIDataTableOptions,
|
47
|
+
* style?: import('react').CSSProperties,
|
48
|
+
* customButtons?: Array<DataTableCustomButton>,
|
49
|
+
* onChange?: (state: DataTableState, action: string) => void | Promise<void>,
|
50
|
+
* loading?: boolean,
|
51
|
+
* disabled?: boolean,
|
52
|
+
* stripped?: boolean,
|
53
|
+
* verticalKeyWidth?: number | string,
|
54
|
+
* hideTableHeader?: boolean,
|
55
|
+
* components?: import('react').ReactElement,
|
56
|
+
* emptyNode?: import('react').ReactElement,
|
57
|
+
* durable?: string,
|
58
|
+
* durableKeys?: 'page' | 'rowsPerPage' | 'searchText' | 'sortOrder'
|
59
|
+
* } & import('mui-datatables').MUIDataTableProps} DataTableProps
|
60
|
+
*/
|
61
|
+
|
62
|
+
/**
|
63
|
+
* @description
|
64
|
+
* @export
|
65
|
+
* @param {DataTableProps} props
|
66
|
+
* @return {import('react').ReactComponentElement}
|
67
|
+
*/
|
68
|
+
export default function DataTable(props) {
|
17
69
|
return (
|
18
|
-
<
|
19
|
-
<
|
20
|
-
</
|
70
|
+
<DataTableProvider>
|
71
|
+
<ReDataTable {...props} />
|
72
|
+
</DataTableProvider>
|
21
73
|
);
|
22
74
|
}
|
23
75
|
|
@@ -46,7 +98,7 @@ const fixCellProp = (tempObj, cellProps) => {
|
|
46
98
|
* @param {Boolean} props.loading For dynamic data, usually used with onChange
|
47
99
|
* @returns
|
48
100
|
*/
|
49
|
-
function
|
101
|
+
function ReDataTable({
|
50
102
|
data: originData,
|
51
103
|
columns: originColumns,
|
52
104
|
locale,
|
@@ -298,7 +350,7 @@ function ReDatatable({
|
|
298
350
|
);
|
299
351
|
}
|
300
352
|
|
301
|
-
|
353
|
+
ReDataTable.propTypes = {
|
302
354
|
data: PropTypes.array.isRequired,
|
303
355
|
columns: PropTypes.array.isRequired,
|
304
356
|
options: PropTypes.object,
|
@@ -317,7 +369,7 @@ ReDatatable.propTypes = {
|
|
317
369
|
durableKeys: PropTypes.array,
|
318
370
|
};
|
319
371
|
|
320
|
-
|
372
|
+
ReDataTable.defaultProps = {
|
321
373
|
options: {},
|
322
374
|
style: {},
|
323
375
|
locale: 'en',
|
@@ -457,7 +457,7 @@ const StyledPopper = styled(Popper)`
|
|
457
457
|
position: relative;
|
458
458
|
padding-left: 8px;
|
459
459
|
/* HACK: 当前元素既是第一个,也是最后一个,即只有一个同级元素 */
|
460
|
-
&:
|
460
|
+
&:first-of-type:last-of-type {
|
461
461
|
padding-left: 0;
|
462
462
|
&:before,
|
463
463
|
&:after {
|
@@ -473,7 +473,7 @@ const StyledPopper = styled(Popper)`
|
|
473
473
|
height: 1px;
|
474
474
|
background-color: #aeaeae;
|
475
475
|
}
|
476
|
-
&:not(:last-
|
476
|
+
&:not(:last-of-type):after {
|
477
477
|
position: absolute;
|
478
478
|
content: '';
|
479
479
|
left: 0px;
|
package/src/SplitButton/index.js
CHANGED