@arcblock/ux 2.1.9 → 2.1.13

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.
@@ -120,7 +120,7 @@ function CustomToolbar(props) {
120
120
 
121
121
  if (!(options.download === false || options.download === 'false')) {
122
122
  defaultButtons.push({
123
- Icon: _CloudDownload.default,
123
+ icon: /*#__PURE__*/_react.default.createElement(_CloudDownload.default, null),
124
124
  title: downloadCsv,
125
125
  onClick: () => {
126
126
  (0, _utils.handleCSVDownload)(props);
@@ -130,7 +130,7 @@ function CustomToolbar(props) {
130
130
 
131
131
  if (!(options.viewColumns === false || options.viewColumns === 'false')) {
132
132
  defaultButtons.push({
133
- Icon: _ViewColumn.default,
133
+ icon: /*#__PURE__*/_react.default.createElement(_ViewColumn.default, null),
134
134
  title: viewColumns,
135
135
 
136
136
  popRender() {
@@ -149,7 +149,7 @@ function CustomToolbar(props) {
149
149
 
150
150
  if (!(options.filter === false || options.filter === 'false')) {
151
151
  defaultButtons.push({
152
- Icon: _FilterList.default,
152
+ icon: /*#__PURE__*/_react.default.createElement(_FilterList.default, null),
153
153
  title: filterTable,
154
154
 
155
155
  popRender() {
@@ -181,10 +181,10 @@ function CustomToolbar(props) {
181
181
 
182
182
  const popId = getPopId(index);
183
183
 
184
- if (e.Icon) {
184
+ if (e.icon) {
185
185
  const {
186
- Icon,
187
- popRender
186
+ popRender,
187
+ icon
188
188
  } = e; // When popRender is present, clicking the button will bubble up the content returned by the popRender
189
189
 
190
190
  if (popRender) {
@@ -221,7 +221,9 @@ function CustomToolbar(props) {
221
221
  });
222
222
  }
223
223
  }
224
- }, /*#__PURE__*/_react.default.createElement(Icon, null)));
224
+ }, /*#__PURE__*/_react.default.createElement("div", {
225
+ className: "custom-toolbar-icon"
226
+ }, icon)));
225
227
  }
226
228
 
227
229
  return e;
@@ -233,13 +235,11 @@ function CustomToolbar(props) {
233
235
 
234
236
  if ( /*#__PURE__*/(0, _react.isValidElement)(e)) {
235
237
  content = e;
236
- } else if (e.Icon) {
238
+ } else if (e.icon) {
237
239
  const {
238
- Icon
240
+ icon
239
241
  } = e;
240
- content = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, /*#__PURE__*/_react.default.createElement(Icon, {
241
- fontSize: "small"
242
- })), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, e.title));
242
+ content = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ListItemIcon.default, null, icon), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, e.title));
243
243
  }
244
244
 
245
245
  return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
@@ -314,7 +314,9 @@ function CustomToolbar(props) {
314
314
  })), /*#__PURE__*/_react.default.createElement(_ListItemText.default, null, print));
315
315
  }), menuItems), allPops.map((e, index) => /*#__PURE__*/_react.default.createElement("div", {
316
316
  key: getPopId(index)
317
- }, e)), loading && /*#__PURE__*/_react.default.createElement(_LinearProgress.default, null));
317
+ }, e)), /*#__PURE__*/_react.default.createElement(ProgressContainer, null, loading && /*#__PURE__*/_react.default.createElement(_LinearProgress.default, {
318
+ className: "toolbar-progress"
319
+ })));
318
320
  }
319
321
 
320
322
  CustomToolbar.propTypes = {
@@ -347,4 +349,9 @@ CustomToolbar.defaultProps = {
347
349
  const Container = _styledComponents.default.div.withConfig({
348
350
  displayName: "CustomToolbar__Container",
349
351
  componentId: "sc-cvz3dp-0"
350
- })(["display:flex;align-items:center;height:56px;.custom-toobar-title{position:relative;flex:1;font-size:18px;font-weight:800;height:56px;transition:all ease 0.3s;&-inner{line-height:56px;width:100%;height:56px;position:absolute;left:0;top:0;span{display:inline-block;max-width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}}}.custom-toobar-btns{display:flex;justify-content:center;align-items:center;&.toobar-btns-disabled{position:relative;opacity:0.5;&:after{position:absolute;display:block;z-index:2;width:100%;height:100%;left:0;top:0;content:'';cursor:not-allowed;}}}.toobar-title-hidden{opacity:0;cursor:none;}"]);
352
+ })(["display:flex;align-items:center;height:56px;.custom-toobar-title{position:relative;flex:1;font-size:18px;font-weight:800;height:56px;transition:all ease 0.3s;&-inner{line-height:56px;width:100%;height:56px;position:absolute;left:0;top:0;span{display:inline-block;max-width:100%;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}}}.custom-toobar-btns{display:flex;justify-content:center;align-items:center;&.toobar-btns-disabled{position:relative;opacity:0.5;&:after{position:absolute;display:block;z-index:2;width:100%;height:100%;left:0;top:0;content:'';cursor:not-allowed;}}.custom-toolbar-icon{display:flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:20px;overflow:hidden;}}.toobar-title-hidden{opacity:0;cursor:none;}"]);
353
+
354
+ const ProgressContainer = _styledComponents.default.div.withConfig({
355
+ displayName: "CustomToolbar__ProgressContainer",
356
+ componentId: "sc-cvz3dp-1"
357
+ })(["width:100%;height:2px;.toolbar-progress{height:2px;}"]);
@@ -21,7 +21,7 @@ var _CustomToolbar = _interopRequireDefault(require("./CustomToolbar"));
21
21
 
22
22
  var _DatatableContext = require("./DatatableContext");
23
23
 
24
- const _excluded = ["data", "columns", "locale", "options", "style", "customButtons", "onChange", "loading", "disabled"];
24
+ const _excluded = ["data", "columns", "locale", "options", "style", "customButtons", "onChange", "loading", "disabled", "stripped"];
25
25
 
26
26
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
27
 
@@ -62,7 +62,8 @@ function ReDatatable(_ref2) {
62
62
  customButtons,
63
63
  onChange,
64
64
  loading,
65
- disabled
65
+ disabled,
66
+ stripped
66
67
  } = _ref2,
67
68
  rest = _objectWithoutProperties(_ref2, _excluded);
68
69
 
@@ -268,7 +269,8 @@ function ReDatatable(_ref2) {
268
269
  loading: _propTypes.default.bool,
269
270
  disabled: _propTypes.default.bool,
270
271
  customButtons: _propTypes.default.array,
271
- onChange: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string])
272
+ onChange: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.string]),
273
+ stripped: _propTypes.default.bool
272
274
  };
273
275
  ReDatatable.defaultProps = {
274
276
  options: {},
@@ -277,10 +279,12 @@ function ReDatatable(_ref2) {
277
279
  loading: false,
278
280
  disabled: false,
279
281
  customButtons: [],
280
- onChange: ''
282
+ onChange: '',
283
+ stripped: false
281
284
  };
282
285
  return /*#__PURE__*/_react.default.createElement(TableContainer, {
283
286
  ref: container,
287
+ className: stripped ? 'datatable-stripped' : '',
284
288
  style: style
285
289
  }, /*#__PURE__*/_react.default.createElement(_muiDatatables.default, Object.assign({
286
290
  data: data,
@@ -291,7 +295,7 @@ function ReDatatable(_ref2) {
291
295
  const TableContainer = _styledComponents.default.div.withConfig({
292
296
  displayName: "Datatable__TableContainer",
293
297
  componentId: "sc-1ju12vq-0"
294
- })(["height:100%;> .MuiPaper-root{display:flex;flex-direction:column;height:100%;box-shadow:none;}", "{[class*='MUIDataTableBody-emptyTitle']{padding-left:16px;width:200%;margin-left:-100%;text-align:center;}}"], props => props.theme.breakpoints.down('md'));
298
+ })(["height:100%;> .MuiPaper-root{display:flex;flex-direction:column;height:100%;box-shadow:none;}", "{[class*='MUIDataTableBody-emptyTitle']{padding-left:16px;width:200%;margin-left:-100%;text-align:center;}}&.datatable-stripped{.MuiTableBody-root{tr:nth-of-type(odd){background-color:", ";}}}"], props => props.theme.breakpoints.down('md'), props => props.theme.palette.action.hover);
295
299
 
296
300
  const FilterLine = _styledComponents.default.div.withConfig({
297
301
  displayName: "Datatable__FilterLine",
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ErrorFallback = ErrorFallback;
7
+ exports.ErrorFallbackRetry = ErrorFallbackRetry;
8
+
9
+ var _react = _interopRequireDefault(require("react"));
10
+
11
+ var _propTypes = _interopRequireDefault(require("prop-types"));
12
+
13
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
14
+
15
+ var _useTheme = _interopRequireDefault(require("@mui/styles/useTheme"));
16
+
17
+ var _colors = require("@mui/material/colors");
18
+
19
+ var _Button = _interopRequireDefault(require("../Button"));
20
+
21
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
+
23
+ function InternalErrorFallback(_ref) {
24
+ let {
25
+ title,
26
+ desc,
27
+ retryFunc
28
+ } = _ref;
29
+ const theme = (0, _useTheme.default)();
30
+ return /*#__PURE__*/_react.default.createElement(Root, {
31
+ role: "alert",
32
+ $theme: theme
33
+ }, /*#__PURE__*/_react.default.createElement("h3", null, title), /*#__PURE__*/_react.default.createElement("pre", null, desc), retryFunc && /*#__PURE__*/_react.default.createElement(_Button.default, {
34
+ variant: "contained",
35
+ color: "error",
36
+ size: "small",
37
+ onClick: retryFunc
38
+ }, "Try again"));
39
+ }
40
+
41
+ InternalErrorFallback.propTypes = {
42
+ title: _propTypes.default.string,
43
+ desc: _propTypes.default.string.isRequired,
44
+ retryFunc: _propTypes.default.func
45
+ };
46
+ InternalErrorFallback.defaultProps = {
47
+ title: 'Something went wrong...',
48
+ retryFunc: null
49
+ };
50
+
51
+ function ErrorFallback(_ref2) {
52
+ let {
53
+ error
54
+ } = _ref2;
55
+ return /*#__PURE__*/_react.default.createElement(InternalErrorFallback, {
56
+ desc: error.message
57
+ });
58
+ }
59
+
60
+ ErrorFallback.propTypes = {
61
+ error: _propTypes.default.instanceOf(Error).isRequired
62
+ };
63
+
64
+ function ErrorFallbackRetry(_ref3) {
65
+ let {
66
+ error,
67
+ resetErrorBoundary
68
+ } = _ref3;
69
+ return /*#__PURE__*/_react.default.createElement(InternalErrorFallback, {
70
+ desc: error.message,
71
+ retryFunc: resetErrorBoundary
72
+ });
73
+ }
74
+
75
+ ErrorFallbackRetry.propTypes = {
76
+ error: _propTypes.default.instanceOf(Error).isRequired,
77
+ resetErrorBoundary: _propTypes.default.func.isRequired
78
+ };
79
+
80
+ const Root = _styledComponents.default.div.withConfig({
81
+ displayName: "fallback__Root",
82
+ componentId: "sc-1ajge2q-0"
83
+ })(["padding:16px;border:2px solid ", ";border-radius:4px;color:", ";background-color:", ";font-size:14px;h3{margin:0;font-size:16px;}pre{white-space:normal;}"], props => props.$theme.palette.error.main, props => props.$theme.palette.error.main, _colors.red[50]);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _fallback = require("./fallback");
8
+
9
+ Object.keys(_fallback).forEach(function (key) {
10
+ if (key === "default" || key === "__esModule") return;
11
+ if (key in exports && exports[key] === _fallback[key]) return;
12
+ Object.defineProperty(exports, key, {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _fallback[key];
16
+ }
17
+ });
18
+ });
@@ -43,7 +43,7 @@ function Footer(props) {
43
43
  className: "footer-item"
44
44
  }, /*#__PURE__*/_react.default.createElement("span", {
45
45
  className: "footer-copy"
46
- }, "\xA9 Copyright ", copyYear, " "), /*#__PURE__*/_react.default.createElement("span", {
46
+ }, "Copyright \xA9 ", copyYear, " "), /*#__PURE__*/_react.default.createElement("span", {
47
47
  className: "footer-brand"
48
48
  }, brand)), /*#__PURE__*/_react.default.createElement(_Typography.default, {
49
49
  component: "p",
@@ -68,7 +68,7 @@ Footer.propTypes = {
68
68
  };
69
69
  Footer.defaultProps = {
70
70
  dark: false,
71
- brand: 'ArcBlock Inc.',
71
+ brand: 'ArcBlock, Inc.',
72
72
  copyStart: '2017',
73
73
  className: '',
74
74
  style: {}
@@ -17,7 +17,7 @@ var _Container = _interopRequireDefault(require("@mui/material/Container"));
17
17
 
18
18
  var _useTheme = _interopRequireDefault(require("@mui/styles/useTheme"));
19
19
 
20
- const _excluded = ["logo", "brand", "brandAddon", "description", "children", "addons", "prepend", "containerComponent"];
20
+ const _excluded = ["logo", "brand", "brandAddon", "description", "children", "addons", "prepend"];
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
@@ -37,15 +37,14 @@ function Header(_ref) {
37
37
  description,
38
38
  children,
39
39
  addons,
40
- prepend,
41
- containerComponent: ContainerComponent
40
+ prepend
42
41
  } = _ref,
43
42
  rest = _objectWithoutProperties(_ref, _excluded);
44
43
 
45
44
  const theme = (0, _useTheme.default)();
46
45
  return /*#__PURE__*/_react.default.createElement(Root, Object.assign({}, rest, {
47
46
  $theme: theme
48
- }), /*#__PURE__*/_react.default.createElement(ContainerComponent, {
47
+ }), /*#__PURE__*/_react.default.createElement(_Container.default, {
49
48
  className: "header-container"
50
49
  }, prepend, logo && /*#__PURE__*/_react.default.createElement("div", {
51
50
  className: "header-logo"
@@ -76,9 +75,7 @@ Header.propTypes = {
76
75
  // 右侧区域, 可以放置 icons/actions/login 等
77
76
  addons: _propTypes.default.node,
78
77
  // logo 左侧内容
79
- prepend: _propTypes.default.node,
80
- // 默认使用 mui 的 Container, 如果不想限制 header 内容区域的宽度, 可以设置为 div
81
- containerComponent: _propTypes.default.elementType
78
+ prepend: _propTypes.default.node
82
79
  };
83
80
  Header.defaultProps = {
84
81
  logo: null,
@@ -87,14 +84,13 @@ Header.defaultProps = {
87
84
  description: null,
88
85
  children: null,
89
86
  addons: null,
90
- prepend: null,
91
- containerComponent: _Container.default
87
+ prepend: null
92
88
  };
93
89
 
94
90
  const Root = _styledComponents.default.div.withConfig({
95
91
  displayName: "header__Root",
96
92
  componentId: "sc-15qnwg1-0"
97
- })(["position:relative;z-index:", ";font-size:14px;background:", ";.header-container{display:flex;align-items:center;height:64px;padding:0 16px;", "{padding:0;}}.header-logo{display:inline-flex;justify-content:center;position:relative;height:40px;margin-right:16px;img,svg{width:auto;height:100%;}> a{height:100%;line-height:1;}> a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.header-brand{display:flex;flex-direction:column;flex-shrink:0;margin-right:16px;.header-brand-title{display:flex;align-items:center;h2{font-size:16px;}.header-brand-addon{margin-left:8px;}}.header-brand-desc{color:#9397a1;}}.header-addons{display:flex;align-items:center;}", "{.header-brand{margin-right:12px;.header-brand-title{h2{font-size:14px;}}}}", "{.header-container{height:56px;}.header-menu{display:inline-block;}.header-logo{height:32px;}.header-brand{display:none;}}"], props => props.$theme.zIndex.drawer + 1, props => props.$theme.palette.common.white, props => props.$theme.breakpoints.up('lg'), props => props.$theme.breakpoints.down('lg'), props => props.$theme.breakpoints.down('md'));
93
+ })(["position:relative;z-index:", ";font-size:14px;background:", ";.header-container{display:flex;align-items:center;height:64px;}.header-logo{display:inline-flex;justify-content:center;position:relative;height:40px;margin-right:16px;img,svg{width:auto;height:100%;}> a{height:100%;line-height:1;}> a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.header-brand{display:flex;flex-direction:column;flex-shrink:0;margin-right:16px;.header-brand-title{display:flex;align-items:center;h2{font-size:16px;}.header-brand-addon{margin-left:8px;}}.header-brand-desc{color:#9397a1;}}.header-addons{display:flex;align-items:center;}", "{.header-brand{margin-right:12px;.header-brand-title{h2{font-size:14px;}}}}", "{.header-container{height:56px;}.header-menu{display:inline-block;}.header-logo{height:32px;}.header-brand{display:none;}}"], props => props.$theme.zIndex.drawer + 1, props => props.$theme.palette.common.white, props => props.$theme.breakpoints.down('lg'), props => props.$theme.breakpoints.down('md'));
98
94
 
99
95
  var _default = Header;
100
96
  exports.default = _default;
@@ -12,7 +12,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  const NavMenuBase = _styledComponents.default.nav.withConfig({
13
13
  displayName: "style__NavMenuBase",
14
14
  componentId: "sc-2g7isz-0"
15
- })(["--text-color:", ";--active-text-color:", ";--bg-color:", ";background-color:var(--bg-color);font-size:14px;ul{list-style:none;margin:0;padding:0;}.navmenu-item,.navmenu-sub{display:flex;align-items:center;}.navmenu-item,.navmenu-item a,.navmenu-sub{color:var(--text-color);}.navmenu-item--active,.navmenu-item:hover,.navmenu-item:hover a,.navmenu-item--active a,.navmenu-sub--opened{color:var(--active-text-color);}.navmenu-item{position:relative;cursor:pointer;a{text-decoration:none;white-space:nowrap;}a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.navmenu-sub{position:relative;cursor:pointer;}.navmenu-item-icon,.navmenu-sub-icon,.navmenu-sub-expand-icon{display:flex;line-height:1;}.navmenu-item-icon,.navmenu-sub-icon{margin-right:4px;}.navmenu-item-icon > *,.navmenu-sub-icon > *{font-size:1.5em;}.navmenu-sub-expand-icon{margin-left:8px;> *{width:0.8em;height:0.8em;transition:transform 0.2s ease-in-out;}}"], props => props.$textColor, props => props.$activeTextColor, props => props.$bgColor);
15
+ })(["background-color:", ";font-size:14px;ul{list-style:none;margin:0;padding:0;}.navmenu-item,.navmenu-sub{display:flex;align-items:center;}a{color:inherit;}.navmenu-item,.navmenu-sub{color:", ";}.navmenu-item--active,.navmenu-item:hover,.navmenu-sub--opened{color:", ";}.navmenu-item{position:relative;cursor:pointer;transition:color 0.2s ease-in-out;a{text-decoration:none;white-space:nowrap;}a::before{position:absolute;top:0;right:0;bottom:0;left:0;background-color:transparent;content:'';}}.navmenu-sub{position:relative;cursor:pointer;}.navmenu-item-icon,.navmenu-sub-icon,.navmenu-sub-expand-icon{display:flex;line-height:1;}.navmenu-item-icon,.navmenu-sub-icon{margin-right:4px;}.navmenu-item-icon > *,.navmenu-sub-icon > *{font-size:1.5em;}.navmenu-sub-expand-icon{margin-left:8px;> *{width:0.8em;height:0.8em;transition:transform 0.2s ease-in-out;}}"], props => props.$bgColor, props => props.$textColor, props => props.$activeTextColor);
16
16
 
17
17
  const HorizontalStyle = (0, _styledComponents.default)(NavMenuBase).withConfig({
18
18
  displayName: "style__HorizontalStyle",
@@ -24,5 +24,5 @@ exports.HorizontalStyle = HorizontalStyle;
24
24
  const InlineStyle = (0, _styledComponents.default)(NavMenuBase).withConfig({
25
25
  displayName: "style__InlineStyle",
26
26
  componentId: "sc-2g7isz-2"
27
- })([".navmenu-root{display:flex;flex-direction:column;align-items:stretch;}.navmenu-item,.navmenu-sub{padding:0 16px;}.navmenu-root > .navmenu-item,.navmenu-root > .navmenu-sub{height:48px;line-height:48px;border-bottom:1px solid #eee;}.navmenu-item-icon,.navmenu-sub-icon{width:32px;margin:0;}.navmenu-sub-expand-icon{margin-left:auto;}.navmenu-sub-container{display:none;position:absolute;top:100%;left:0;right:0;.navmenu-item,.navmenu-sub{line-height:24px;}}.navmenu-sub-list{padding-left:16px;.navmenu-item,.navmenu-sub{padding-left:32px;margin-top:8px;font-size:13px;}}.navmenu-root > .navmenu-sub{&.navmenu-sub--opened{background:#eee;}}.navmenu-sub--opened > .navmenu-sub-container{display:block;}"]);
27
+ })([".navmenu-root{display:flex;flex-direction:column;align-items:stretch;}.navmenu-item,.navmenu-sub{padding:0 16px;}& .navmenu-sub{flex-wrap:wrap;}.navmenu-root > .navmenu-item,.navmenu-root > .navmenu-sub{line-height:48px;border-bottom:1px solid #eee;}.navmenu-item-icon,.navmenu-sub-icon{width:32px;margin:0;}.navmenu-sub-expand-icon{margin-left:auto;}.navmenu-sub-container{display:none;flex:1 0 100%;margin:0 -16px;padding-bottom:8px;.navmenu-item,.navmenu-sub{line-height:32px;}}.navmenu-sub-list{padding-left:16px;.navmenu-item,.navmenu-sub{padding-left:32px;font-size:13px;}}.navmenu-root > .navmenu-sub{&.navmenu-sub--opened{background:#eee;}}.navmenu-sub--opened > .navmenu-sub-container{display:block;}"]);
28
28
  exports.InlineStyle = InlineStyle;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.1.9",
3
+ "version": "2.1.13",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -52,10 +52,10 @@
52
52
  "react": ">=18.1.0",
53
53
  "react-ga": "^2.7.0"
54
54
  },
55
- "gitHead": "7a3efb456e1dbe3318ab8757feb9e58a88c08d8e",
55
+ "gitHead": "ab9ffbc57b99ede75ed0ddd8f090e3d8e8fb97d1",
56
56
  "dependencies": {
57
- "@arcblock/icons": "^2.1.9",
58
- "@arcblock/react-hooks": "^2.1.9",
57
+ "@arcblock/icons": "^2.1.13",
58
+ "@arcblock/react-hooks": "^2.1.13",
59
59
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
60
60
  "@emotion/react": "^11.9.0",
61
61
  "@emotion/styled": "^11.8.1",
@@ -78,6 +78,7 @@
78
78
  "mui-datatables": "^4.2.2",
79
79
  "notistack": "^2.0.5",
80
80
  "react-cookie-consent": "^6.4.1",
81
+ "react-error-boundary": "^3.1.4",
81
82
  "react-helmet": "^6.1.0",
82
83
  "react-intersection-observer": "^8.31.1",
83
84
  "react-lottie-player": "^1.4.2",
@@ -84,7 +84,7 @@ export default function CustomToolbar(props) {
84
84
  // download/viewColumns/filter button behaviours, rendered using custom button logic
85
85
  if (!(options.download === false || options.download === 'false')) {
86
86
  defaultButtons.push({
87
- Icon: DownloadIcon,
87
+ icon: <DownloadIcon />,
88
88
  title: downloadCsv,
89
89
  onClick: () => {
90
90
  handleCSVDownload(props);
@@ -94,7 +94,7 @@ export default function CustomToolbar(props) {
94
94
 
95
95
  if (!(options.viewColumns === false || options.viewColumns === 'false')) {
96
96
  defaultButtons.push({
97
- Icon: ViewColumnIcon,
97
+ icon: <ViewColumnIcon />,
98
98
  title: viewColumns,
99
99
  popRender() {
100
100
  return (
@@ -113,7 +113,7 @@ export default function CustomToolbar(props) {
113
113
 
114
114
  if (!(options.filter === false || options.filter === 'false')) {
115
115
  defaultButtons.push({
116
- Icon: FilterIcon,
116
+ icon: <FilterIcon />,
117
117
  title: filterTable,
118
118
  popRender() {
119
119
  return (
@@ -148,8 +148,8 @@ export default function CustomToolbar(props) {
148
148
 
149
149
  const popId = getPopId(index);
150
150
 
151
- if (e.Icon) {
152
- const { Icon, popRender } = e;
151
+ if (e.icon) {
152
+ const { popRender, icon } = e;
153
153
  // When popRender is present, clicking the button will bubble up the content returned by the popRender
154
154
  if (popRender) {
155
155
  allPops.push(
@@ -187,7 +187,7 @@ export default function CustomToolbar(props) {
187
187
  });
188
188
  }
189
189
  }}>
190
- <Icon />
190
+ <div className="custom-toolbar-icon">{icon}</div>
191
191
  </IconButton>
192
192
  </Tooltip>
193
193
  );
@@ -204,14 +204,12 @@ export default function CustomToolbar(props) {
204
204
 
205
205
  if (isValidElement(e)) {
206
206
  content = e;
207
- } else if (e.Icon) {
208
- const { Icon } = e;
207
+ } else if (e.icon) {
208
+ const { icon } = e;
209
209
 
210
210
  content = (
211
211
  <>
212
- <ListItemIcon>
213
- <Icon fontSize="small" />
214
- </ListItemIcon>
212
+ <ListItemIcon>{icon}</ListItemIcon>
215
213
  <ListItemText>{e.title}</ListItemText>
216
214
  </>
217
215
  );
@@ -319,7 +317,9 @@ export default function CustomToolbar(props) {
319
317
  {allPops.map((e, index) => (
320
318
  <div key={getPopId(index)}>{e}</div>
321
319
  ))}
322
- {loading && <LinearProgress />}
320
+ <ProgressContainer>
321
+ {loading && <LinearProgress className="toolbar-progress" />}
322
+ </ProgressContainer>
323
323
  </div>
324
324
  );
325
325
  }
@@ -398,9 +398,26 @@ const Container = styled.div`
398
398
  cursor: not-allowed;
399
399
  }
400
400
  }
401
+ .custom-toolbar-icon {
402
+ display: flex;
403
+ justify-content: center;
404
+ align-items: center;
405
+ width: 24px;
406
+ height: 24px;
407
+ font-size: 20px;
408
+ overflow: hidden;
409
+ }
401
410
  }
402
411
  .toobar-title-hidden {
403
412
  opacity: 0;
404
413
  cursor: none;
405
414
  }
406
415
  `;
416
+
417
+ const ProgressContainer = styled.div`
418
+ width: 100%;
419
+ height: 2px;
420
+ .toolbar-progress {
421
+ height: 2px;
422
+ }
423
+ `;
@@ -32,6 +32,7 @@ function ReDatatable({
32
32
  onChange,
33
33
  loading,
34
34
  disabled,
35
+ stripped,
35
36
  ...rest
36
37
  }) {
37
38
  const container = useRef(null);
@@ -202,6 +203,7 @@ function ReDatatable({
202
203
  disabled: PropTypes.bool,
203
204
  customButtons: PropTypes.array,
204
205
  onChange: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
206
+ stripped: PropTypes.bool,
205
207
  };
206
208
 
207
209
  ReDatatable.defaultProps = {
@@ -212,10 +214,11 @@ function ReDatatable({
212
214
  disabled: false,
213
215
  customButtons: [],
214
216
  onChange: '',
217
+ stripped: false,
215
218
  };
216
219
 
217
220
  return (
218
- <TableContainer ref={container} style={style}>
221
+ <TableContainer ref={container} className={stripped ? 'datatable-stripped' : ''} style={style}>
219
222
  <MUIDataTable data={data} columns={columns} {...props} />
220
223
  </TableContainer>
221
224
  );
@@ -237,6 +240,13 @@ const TableContainer = styled.div`
237
240
  text-align: center;
238
241
  }
239
242
  }
243
+ &.datatable-stripped {
244
+ .MuiTableBody-root {
245
+ tr:nth-of-type(odd) {
246
+ background-color: ${props => props.theme.palette.action.hover};
247
+ }
248
+ }
249
+ }
240
250
  `;
241
251
 
242
252
  const FilterLine = styled.div`
@@ -0,0 +1,64 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import useTheme from '@mui/styles/useTheme';
5
+ import { red } from '@mui/material/colors';
6
+ import Button from '../Button';
7
+
8
+ function InternalErrorFallback({ title, desc, retryFunc }) {
9
+ const theme = useTheme();
10
+ return (
11
+ <Root role="alert" $theme={theme}>
12
+ <h3>{title}</h3>
13
+ <pre>{desc}</pre>
14
+ {retryFunc && (
15
+ <Button variant="contained" color="error" size="small" onClick={retryFunc}>
16
+ Try again
17
+ </Button>
18
+ )}
19
+ </Root>
20
+ );
21
+ }
22
+
23
+ InternalErrorFallback.propTypes = {
24
+ title: PropTypes.string,
25
+ desc: PropTypes.string.isRequired,
26
+ retryFunc: PropTypes.func,
27
+ };
28
+ InternalErrorFallback.defaultProps = {
29
+ title: 'Something went wrong...',
30
+ retryFunc: null,
31
+ };
32
+
33
+ export function ErrorFallback({ error }) {
34
+ return <InternalErrorFallback desc={error.message} />;
35
+ }
36
+
37
+ ErrorFallback.propTypes = {
38
+ error: PropTypes.instanceOf(Error).isRequired,
39
+ };
40
+
41
+ export function ErrorFallbackRetry({ error, resetErrorBoundary }) {
42
+ return <InternalErrorFallback desc={error.message} retryFunc={resetErrorBoundary} />;
43
+ }
44
+
45
+ ErrorFallbackRetry.propTypes = {
46
+ error: PropTypes.instanceOf(Error).isRequired,
47
+ resetErrorBoundary: PropTypes.func.isRequired,
48
+ };
49
+
50
+ const Root = styled.div`
51
+ padding: 16px;
52
+ border: 2px solid ${props => props.$theme.palette.error.main};
53
+ border-radius: 4px;
54
+ color: ${props => props.$theme.palette.error.main};
55
+ background-color: ${red[50]};
56
+ font-size: 14px;
57
+ h3 {
58
+ margin: 0;
59
+ font-size: 16px;
60
+ }
61
+ pre {
62
+ white-space: normal;
63
+ }
64
+ `;
@@ -0,0 +1 @@
1
+ export * from './fallback';
@@ -18,7 +18,7 @@ export default function Footer(props) {
18
18
  <Container className={className} style={style} dark={dark}>
19
19
  <Typography component="div" className="footer">
20
20
  <Typography component="p" className="footer-item">
21
- <span className="footer-copy">&copy; Copyright {copyYear} </span>
21
+ <span className="footer-copy">Copyright &copy; {copyYear} </span>
22
22
  <span className="footer-brand">{brand}</span>
23
23
  </Typography>
24
24
  <Typography
@@ -43,7 +43,7 @@ Footer.propTypes = {
43
43
 
44
44
  Footer.defaultProps = {
45
45
  dark: false,
46
- brand: 'ArcBlock Inc.',
46
+ brand: 'ArcBlock, Inc.',
47
47
  copyStart: '2017',
48
48
  className: '',
49
49
  style: {},
@@ -9,21 +9,11 @@ import useTheme from '@mui/styles/useTheme';
9
9
  * Header 组件
10
10
  * TODO: Layout/dashboard 可以复用此处的 header
11
11
  */
12
- function Header({
13
- logo,
14
- brand,
15
- brandAddon,
16
- description,
17
- children,
18
- addons,
19
- prepend,
20
- containerComponent: ContainerComponent,
21
- ...rest
22
- }) {
12
+ function Header({ logo, brand, brandAddon, description, children, addons, prepend, ...rest }) {
23
13
  const theme = useTheme();
24
14
  return (
25
15
  <Root {...rest} $theme={theme}>
26
- <ContainerComponent className="header-container">
16
+ <Container className="header-container">
27
17
  {prepend}
28
18
  {logo && <div className="header-logo">{logo}</div>}
29
19
  <div className="header-brand">
@@ -36,7 +26,7 @@ function Header({
36
26
  {children}
37
27
  <Box flexGrow={1} />
38
28
  <div className="header-addons">{addons}</div>
39
- </ContainerComponent>
29
+ </Container>
40
30
  </Root>
41
31
  );
42
32
  }
@@ -54,8 +44,6 @@ Header.propTypes = {
54
44
  addons: PropTypes.node,
55
45
  // logo 左侧内容
56
46
  prepend: PropTypes.node,
57
- // 默认使用 mui 的 Container, 如果不想限制 header 内容区域的宽度, 可以设置为 div
58
- containerComponent: PropTypes.elementType,
59
47
  };
60
48
 
61
49
  Header.defaultProps = {
@@ -66,7 +54,6 @@ Header.defaultProps = {
66
54
  children: null,
67
55
  addons: null,
68
56
  prepend: null,
69
- containerComponent: Container,
70
57
  };
71
58
 
72
59
  const Root = styled.div`
@@ -78,11 +65,6 @@ const Root = styled.div`
78
65
  display: flex;
79
66
  align-items: center;
80
67
  height: 64px;
81
- /* mui container 左右 padding 控制, 宽屏下不需要 padding (与 content 对齐), 窄屏下设置 16px padding */
82
- padding: 0 16px;
83
- ${props => props.$theme.breakpoints.up('lg')} {
84
- padding: 0;
85
- }
86
68
  }
87
69
  .header-logo {
88
70
  display: inline-flex;
@@ -1,11 +1,7 @@
1
1
  import styled from 'styled-components';
2
2
 
3
3
  const NavMenuBase = styled.nav`
4
- --text-color: ${props => props.$textColor};
5
- --active-text-color: ${props => props.$activeTextColor};
6
- --bg-color: ${props => props.$bgColor};
7
-
8
- background-color: var(--bg-color);
4
+ background-color: ${props => props.$bgColor};
9
5
  font-size: 14px;
10
6
  ul {
11
7
  list-style: none;
@@ -17,23 +13,24 @@ const NavMenuBase = styled.nav`
17
13
  display: flex;
18
14
  align-items: center;
19
15
  }
20
- // active/hover
16
+ a {
17
+ color: inherit;
18
+ }
19
+ /* active/hover */
21
20
  .navmenu-item,
22
- .navmenu-item a,
23
21
  .navmenu-sub {
24
- color: var(--text-color);
22
+ color: ${props => props.$textColor};
25
23
  }
26
24
  .navmenu-item--active,
27
25
  .navmenu-item:hover,
28
- .navmenu-item:hover a,
29
- .navmenu-item--active a,
30
26
  .navmenu-sub--opened {
31
- color: var(--active-text-color);
27
+ color: ${props => props.$activeTextColor};
32
28
  }
33
29
 
34
30
  .navmenu-item {
35
31
  position: relative;
36
32
  cursor: pointer;
33
+ transition: color 0.2s ease-in-out;
37
34
  a {
38
35
  text-decoration: none;
39
36
  white-space: nowrap;
@@ -53,7 +50,7 @@ const NavMenuBase = styled.nav`
53
50
  position: relative;
54
51
  cursor: pointer;
55
52
  }
56
- // icon & expand icon
53
+ /* icon & expand icon */
57
54
  .navmenu-item-icon,
58
55
  .navmenu-sub-icon,
59
56
  .navmenu-sub-expand-icon {
@@ -84,7 +81,7 @@ export const HorizontalStyle = styled(NavMenuBase)`
84
81
  display: flex;
85
82
  align-items: center;
86
83
  }
87
- // 顶级菜单间隔
84
+ /* 顶级菜单间隔 */
88
85
  .navmenu-root > .navmenu-item,
89
86
  .navmenu-root > .navmenu-sub {
90
87
  margin-left: 24px;
@@ -109,7 +106,7 @@ export const HorizontalStyle = styled(NavMenuBase)`
109
106
  margin-top: 8px;
110
107
  }
111
108
  }
112
- // 二级 sub menu
109
+ /* 二级 sub menu */
113
110
  .navmenu-root > .navmenu-sub {
114
111
  > .navmenu-sub-container {
115
112
  left: 50%;
@@ -133,14 +130,16 @@ export const InlineStyle = styled(NavMenuBase)`
133
130
  .navmenu-sub {
134
131
  padding: 0 16px;
135
132
  }
136
- // 顶级
133
+ & .navmenu-sub {
134
+ flex-wrap: wrap;
135
+ }
136
+ /* 顶级 */
137
137
  .navmenu-root > .navmenu-item,
138
138
  .navmenu-root > .navmenu-sub {
139
- height: 48px;
140
139
  line-height: 48px;
141
140
  border-bottom: 1px solid #eee;
142
141
  }
143
- // icon
142
+ /* icon */
144
143
  .navmenu-item-icon,
145
144
  .navmenu-sub-icon {
146
145
  width: 32px;
@@ -152,13 +151,12 @@ export const InlineStyle = styled(NavMenuBase)`
152
151
  /* 子级列表 */
153
152
  .navmenu-sub-container {
154
153
  display: none;
155
- position: absolute;
156
- top: 100%;
157
- left: 0;
158
- right: 0;
154
+ flex: 1 0 100%;
155
+ margin: 0 -16px;
156
+ padding-bottom: 8px;
159
157
  .navmenu-item,
160
158
  .navmenu-sub {
161
- line-height: 24px;
159
+ line-height: 32px;
162
160
  }
163
161
  }
164
162
  .navmenu-sub-list {
@@ -166,11 +164,10 @@ export const InlineStyle = styled(NavMenuBase)`
166
164
  .navmenu-item,
167
165
  .navmenu-sub {
168
166
  padding-left: 32px;
169
- margin-top: 8px;
170
167
  font-size: 13px;
171
168
  }
172
169
  }
173
- // 二级 menu
170
+ /* 二级 menu */
174
171
  .navmenu-root > .navmenu-sub {
175
172
  &.navmenu-sub--opened {
176
173
  background: #eee;