@abtnode/ux 1.8.56 → 1.8.58

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.
@@ -8,6 +8,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
8
8
  var _react = require("@iconify/react");
9
9
  var _material = require("@mui/material");
10
10
  var _react2 = require("react");
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
11
12
  var _jsxRuntime = require("react/jsx-runtime");
12
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14
  function NavigationActions(_ref) {
@@ -20,6 +21,9 @@ function NavigationActions(_ref) {
20
21
  data,
21
22
  section
22
23
  } = _ref;
24
+ const {
25
+ t
26
+ } = (0, _context.useLocaleContext)();
23
27
  const isDisabled = ['yaml', 'tmpl'].includes(data.from);
24
28
  const isUninstalled = /*#__PURE__*/(0, _react2.isValidElement)(data.subtitle);
25
29
  function handleClick(e) {
@@ -44,40 +48,53 @@ function NavigationActions(_ref) {
44
48
  }, [del, data]);
45
49
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
46
50
  className: className,
47
- children: [!data.parent && ['header', 'footer', 'dashboard'].includes(section) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
48
- size: "small",
49
- color: "success",
50
- onClick: handleClickAdd,
51
- disabled: isUninstalled,
52
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
53
- icon: "mdi:plus-box-outline"
51
+ children: [!data.parent && ['header', 'footer', 'dashboard'].includes(section) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
52
+ title: isUninstalled ? t('navigation.action.noAddSub') : t('navigation.action.addSub'),
53
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
54
+ size: "small",
55
+ color: "success",
56
+ onClick: handleClickAdd,
57
+ disabled: isUninstalled,
58
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
59
+ icon: "mdi:plus-box-outline"
60
+ })
54
61
  })
55
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
56
- size: "small",
57
- color: "primary",
58
- onClick: handleClickEdit,
59
- disabled: isUninstalled,
60
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
61
- icon: "mdi:pencil"
62
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
63
+ title: isUninstalled ? t('navigation.action.noEdit') : t('navigation.action.edit'),
64
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
65
+ size: "small",
66
+ color: "primary",
67
+ onClick: handleClickEdit,
68
+ disabled: isUninstalled,
69
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
70
+ icon: "mdi:pencil"
71
+ })
62
72
  })
63
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
64
- size: "small",
65
- color: "warning",
66
- onClick: handleClickToggle,
67
- disabled: isUninstalled,
68
- children: data.visible === false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
69
- icon: "mdi:eye-off-outline"
70
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
71
- icon: "mdi:eye-outline"
73
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
74
+ title:
75
+ // eslint-disable-next-line no-nested-ternary
76
+ isUninstalled ? t('navigation.action.noEdit') : data.visible ? t('navigation.action.hide') : t('navigation.action.show'),
77
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
78
+ size: "small",
79
+ color: "warning",
80
+ onClick: handleClickToggle,
81
+ disabled: isUninstalled,
82
+ children: data.visible === false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
83
+ icon: "mdi:eye-off-outline"
84
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
85
+ icon: "mdi:eye-outline"
86
+ })
72
87
  })
73
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
74
- disabled: isDisabled,
75
- size: "small",
76
- color: "error",
77
- onClick: handleClickDelete,
78
- title: isDisabled ? 'Not allowed delete built-in navigation' : 'Delete navigation',
79
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
80
- icon: "mdi:delete"
88
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
89
+ title: isDisabled && !isUninstalled ? t('navigation.action.noDel') : t('navigation.action.del'),
90
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
91
+ disabled: isDisabled && !isUninstalled,
92
+ size: "small",
93
+ color: "error",
94
+ onClick: handleClickDelete,
95
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Icon, {
96
+ icon: "mdi:delete"
97
+ })
81
98
  })
82
99
  })]
83
100
  });
@@ -6,13 +6,15 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _react = require("react");
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
- var _reactSortableTree = _interopRequireDefault(require("react-sortable-tree"));
9
+ var _reactSortableTree = require("react-sortable-tree");
10
10
  var _reactSortableTreeThemeMaterialUi = _interopRequireDefault(require("react-sortable-tree-theme-material-ui"));
11
11
  var _react2 = require("@iconify/react");
12
12
  var _isObject = _interopRequireDefault(require("lodash/isObject"));
13
13
  var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
14
14
  var _context = require("@arcblock/ux/lib/Locale/context");
15
15
  var _material = require("@mui/material");
16
+ var _reactDndHtml5Backend = require("react-dnd-html5-backend");
17
+ var _reactDnd = require("react-dnd");
16
18
  var _jsxRuntime = require("react/jsx-runtime");
17
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
20
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -90,28 +92,38 @@ function SortableTree(_ref3) {
90
92
  const expandedData = treeData.map(item => _objectSpread(_objectSpread({}, item), {}, {
91
93
  expanded: true
92
94
  }));
93
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSortableTree.default, {
94
- generateNodeProps: rowInfo => {
95
- return {
96
- buttons: renderActions({
97
- data: rowInfo.node,
98
- className: 'list-item-actions'
99
- }),
100
- icons: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
101
- icon: "ic:round-drag-indicator"
102
- }),
103
- title: /*#__PURE__*/(0, _jsxRuntime.jsx)(TreeTitle, {
104
- treeNode: rowInfo.node
105
- })
106
- };
107
- },
108
- maxDepth: 2,
109
- isVirtualized: false,
110
- treeData: expandedData,
111
- onChange: setTreeData,
112
- canDrop: checkCanDrop,
113
- theme: _reactSortableTreeThemeMaterialUi.default
114
- });
95
+
96
+ // HACK: 兼容 mui-datatables 中的 react-dnd 使用
97
+ const dndProps = {};
98
+ if (typeof window !== 'undefined') {
99
+ dndProps.context = window;
100
+ }
101
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactDnd.DndProvider, _objectSpread(_objectSpread({
102
+ backend: _reactDndHtml5Backend.HTML5Backend
103
+ }, dndProps), {}, {
104
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSortableTree.SortableTreeWithoutDndContext, {
105
+ generateNodeProps: rowInfo => {
106
+ return {
107
+ buttons: renderActions({
108
+ data: rowInfo.node,
109
+ className: 'list-item-actions'
110
+ }),
111
+ icons: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
112
+ icon: "ic:round-drag-indicator"
113
+ }),
114
+ title: /*#__PURE__*/(0, _jsxRuntime.jsx)(TreeTitle, {
115
+ treeNode: rowInfo.node
116
+ })
117
+ };
118
+ },
119
+ maxDepth: 2,
120
+ isVirtualized: false,
121
+ treeData: expandedData,
122
+ onChange: setTreeData,
123
+ canDrop: checkCanDrop,
124
+ theme: _reactSortableTreeThemeMaterialUi.default
125
+ })
126
+ }));
115
127
  }
116
128
  SortableTree.propTypes = {
117
129
  treeData: _propTypes.default.object.isRequired,
@@ -48,7 +48,6 @@ function ConfigNavigation() {
48
48
  const {
49
49
  t
50
50
  } = (0, _context.useLocaleContext)();
51
- const [showTree, setShowTree] = (0, _react.useState)(false);
52
51
  const {
53
52
  blocklet
54
53
  } = (0, _blocklet.useBlockletContext)();
@@ -65,12 +64,6 @@ function ConfigNavigation() {
65
64
  showResetConfirm: false,
66
65
  mockRole: 'owner'
67
66
  });
68
- (0, _react.useEffect)(() => {
69
- setShowTree(true);
70
- return () => {
71
- setShowTree(false);
72
- };
73
- }, []);
74
67
  const {
75
68
  state: navigationState,
76
69
  navigation,
@@ -247,7 +240,7 @@ function ConfigNavigation() {
247
240
  flex: 1,
248
241
  overflow: 'auto'
249
242
  },
250
- children: showTree && /*#__PURE__*/(0, _jsxRuntime.jsx)(_sortableTree.default, {
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_sortableTree.default, {
251
244
  treeData: getNavigation(navigationState.activeSection),
252
245
  setTreeData: updateNavigationTree,
253
246
  renderActions: _ref => {
@@ -57,15 +57,19 @@ function BlockletDiskInfo(_ref) {
57
57
  return acc;
58
58
  }, {});
59
59
  const rows = [{
60
+ key: 'appDir',
60
61
  name: t('blocklet.diskInfo.appDir'),
61
62
  value: renderDiskInfo(env.BLOCKLET_APP_DIR, blocklet.diskInfo.app)
62
63
  }, {
64
+ key: 'dataDir',
63
65
  name: t('blocklet.diskInfo.dataDir'),
64
66
  value: renderDiskInfo(env.BLOCKLET_DATA_DIR, blocklet.diskInfo.data)
65
67
  }, {
68
+ key: 'logDir',
66
69
  name: t('blocklet.diskInfo.logDir'),
67
70
  value: renderDiskInfo(env.BLOCKLET_LOG_DIR, blocklet.diskInfo.log)
68
71
  }, {
72
+ key: 'cacheDir',
69
73
  name: t('blocklet.diskInfo.cacheDir'),
70
74
  value: renderDiskInfo(env.BLOCKLET_CACHE_DIR, blocklet.diskInfo.cache)
71
75
  }];
@@ -77,7 +81,7 @@ function BlockletDiskInfo(_ref) {
77
81
  nameWidth: 120,
78
82
  name: row.name,
79
83
  children: row.value
80
- }, row.name))
84
+ }, row.key))
81
85
  }));
82
86
  }
83
87
  BlockletDiskInfo.propTypes = {
package/lib/locales/en.js CHANGED
@@ -601,15 +601,30 @@ module.exports = {
601
601
  dialog: 'Click on "confirm" to install the update. Blocklet Server will enter maintenance mode until the update is completed and return to production mode automatically.',
602
602
  confirm: 'Upgrade',
603
603
  switchLabel: 'Auto Update Check',
604
- setup: 'Preparing the update',
604
+ setup: 'Preparing the upgrade',
605
605
  installing: 'Installing Blocklet Server v{version}',
606
606
  restarting: 'Restarting Blocklet Server',
607
607
  cleanup: 'Migrating Blocklet Server data',
608
+ verifying: 'Verifying Blocklet Server v{version}',
609
+ rollback: 'Rollback Blocklet Server',
608
610
  complete: 'Upgrade complete!',
609
611
  progress: 'Upgrading Blocklet Server to v{version}',
610
612
  check: 'Check for Updates',
611
613
  latest: 'You are running the latest version.'
612
614
  },
615
+ restart: {
616
+ title: 'Restart Blocklet Server',
617
+ description: 'During the restarting, your Blocklet Server will enter maintenance mode while the restart is completed.',
618
+ dialog: 'Click on "confirm" to restart. Blocklet Server will enter maintenance mode until the restart is completed and return to production mode automatically.',
619
+ confirm: 'Restart',
620
+ setup: 'Preparing the restart',
621
+ verifying: 'Verifying Blocklet Server',
622
+ restarting: 'Restarting Blocklet Server',
623
+ cleanup: 'Ensure everything is OK',
624
+ rollback: 'Cleanup the dirty state',
625
+ complete: 'Maintain complete!',
626
+ progress: 'Restarting Blocklet Server'
627
+ },
613
628
  register: {
614
629
  titleAdded: 'Added to Blocklet Launcher',
615
630
  title: 'Add to Blocklet Launcher',
@@ -1138,6 +1153,17 @@ module.exports = {
1138
1153
  locale: 'Locale',
1139
1154
  localePlaceholder: 'Please input locale need to add',
1140
1155
  localeExists: '{value} is already exists'
1156
+ },
1157
+ action: {
1158
+ add: 'Add navigation',
1159
+ addSub: 'Add sub navigation',
1160
+ edit: 'Edit navigation',
1161
+ hide: 'Hide navigation',
1162
+ show: 'Show navigation',
1163
+ del: 'Delete navigation',
1164
+ noAddSub: "Uninstalled component can't add sub navigation",
1165
+ noEdit: "Uninstalled component can't edit",
1166
+ noDel: 'Not allowed delete built-in navigation'
1141
1167
  }
1142
1168
  }
1143
1169
  };
package/lib/locales/zh.js CHANGED
@@ -606,11 +606,26 @@ module.exports = {
606
606
  installing: '安装节点新版本(v{version})',
607
607
  restarting: '重新启动节点',
608
608
  cleanup: '迁移节点数据',
609
+ verifying: '验证节点新版本 v{version}',
610
+ rollback: '回滚此次升级',
609
611
  complete: '升级完成!',
610
612
  progress: '正在升级节点到 v{version}',
611
613
  check: '检查更新',
612
614
  latest: '太棒了,你的节点已经是最新版!'
613
615
  },
616
+ restart: {
617
+ title: '重新启动节点',
618
+ description: '在重启期间,节点将会进入维护模式几十秒钟。',
619
+ dialog: '点击 “确认” 开启重启。节点将进入维护模式,直到更新完成并自动返回生产模式。',
620
+ confirm: '重启',
621
+ setup: '准备重启中',
622
+ verifying: '验证节点版本',
623
+ restarting: '重启节点中',
624
+ cleanup: '验证重启成功',
625
+ rollback: '撤销重启操作',
626
+ complete: '维护完成',
627
+ progress: '正在重启节点'
628
+ },
614
629
  welcome: {
615
630
  switchLabel: 'Welcome 页面'
616
631
  },
@@ -1143,6 +1158,17 @@ module.exports = {
1143
1158
  locale: '语言',
1144
1159
  localePlaceholder: '请输入要添加的多语言标识符',
1145
1160
  localeExists: '{value} 已经存在'
1161
+ },
1162
+ action: {
1163
+ add: '增加导航',
1164
+ addSub: '增加子导航',
1165
+ edit: '编辑导航',
1166
+ hide: '隐藏导航',
1167
+ show: '显示导航',
1168
+ del: '删除导航',
1169
+ noAddSub: '未安装组件无法添加子导航',
1170
+ noEdit: '未安装组件的导航无法编辑',
1171
+ noDel: '内置的导航无法删除'
1146
1172
  }
1147
1173
  }
1148
1174
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.56",
6
+ "version": "1.8.58",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,18 +21,18 @@
21
21
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@abtnode/auth": "1.8.56",
25
- "@abtnode/constant": "1.8.56",
26
- "@abtnode/util": "1.8.56",
24
+ "@abtnode/auth": "1.8.58",
25
+ "@abtnode/constant": "1.8.58",
26
+ "@abtnode/util": "1.8.58",
27
27
  "@arcblock/did-connect": "^2.4.64",
28
28
  "@arcblock/did-motif": "^1.1.10",
29
29
  "@arcblock/icons": "^2.4.64",
30
30
  "@arcblock/terminal": "^2.4.64",
31
31
  "@arcblock/ux": "^2.4.64",
32
- "@blocklet/constant": "1.8.56",
32
+ "@blocklet/constant": "1.8.58",
33
33
  "@blocklet/launcher-layout": "^1.9.30",
34
34
  "@blocklet/list": "^0.10.47",
35
- "@blocklet/meta": "1.8.56",
35
+ "@blocklet/meta": "1.8.58",
36
36
  "@blocklet/ui-react": "^2.4.64",
37
37
  "@emotion/react": "^11.10.4",
38
38
  "@emotion/styled": "^11.10.4",
@@ -46,7 +46,7 @@
46
46
  "ahooks": "^3.7.1",
47
47
  "axios": "^0.27.2",
48
48
  "classnames": "^2.3.2",
49
- "dayjs": "^1.11.5",
49
+ "dayjs": "^1.11.7",
50
50
  "file-saver": "^2.0.5",
51
51
  "filesize": "^6.4.0",
52
52
  "flat": "^5.0.2",
@@ -65,6 +65,8 @@
65
65
  "prop-types": "^15.8.1",
66
66
  "react": "^18.2.0",
67
67
  "react-color": "^2.19.3",
68
+ "react-dnd": "11.1.3",
69
+ "react-dnd-html5-backend": "11.1.3",
68
70
  "react-error-boundary": "^3.1.4",
69
71
  "react-hook-form": "^7.39.3",
70
72
  "react-iframe": "^1.8.5",
@@ -84,5 +86,5 @@
84
86
  "@babel/preset-react": "^7.18.6",
85
87
  "babel-plugin-inline-react-svg": "^1.1.2"
86
88
  },
87
- "gitHead": "8c24c9d747e96e05510b9cbe863666960569fb46"
89
+ "gitHead": "697fbc1875ee02f6a0dd18e48a5a3f523209f208"
88
90
  }