@abtnode/ux 1.16.0-beta-1f8bf936 → 1.16.0-beta-58020de5

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.
@@ -27,7 +27,8 @@ const defaultLocale = 'en';
27
27
  function LocaleTabs(_ref) {
28
28
  let {
29
29
  sx,
30
- onChange,
30
+ onAdd,
31
+ onChange: _onChange,
31
32
  locales,
32
33
  onRemoveLocale
33
34
  } = _ref;
@@ -45,15 +46,18 @@ function LocaleTabs(_ref) {
45
46
  const openChooseLocale = (0, _react.useMemo)(() => {
46
47
  return !!addLocaleButtonEl;
47
48
  }, [addLocaleButtonEl]);
49
+ const showLocale = (0, _react.useMemo)(() => {
50
+ if (locales.includes(state.currentLocale)) {
51
+ return state.currentLocale;
52
+ }
53
+ return defaultLocale;
54
+ }, [locales, state.currentLocale]);
48
55
  const localeOptions = (0, _react.useMemo)(() => {
49
56
  return Object.keys((0, _lodash.omit)(_locales.default, [...state.localeList, defaultLocale])).map(locale => ({
50
57
  title: _locales.default[locale],
51
58
  value: locale
52
59
  }));
53
60
  }, [state.localeList]);
54
- (0, _react.useEffect)(() => {
55
- onChange(state.currentLocale);
56
- }, [onChange, state.currentLocale]);
57
61
  (0, _react.useEffect)(() => {
58
62
  state.localeList = [...locales];
59
63
  }, [locales, state]);
@@ -97,6 +101,7 @@ function LocaleTabs(_ref) {
97
101
  close();
98
102
  state.localeList.push(value);
99
103
  state.currentLocale = value;
104
+ onAdd(value);
100
105
  }
101
106
  }
102
107
  function close() {
@@ -123,9 +128,10 @@ function LocaleTabs(_ref) {
123
128
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
124
129
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Tabs.default, {
125
130
  sx: sx,
126
- value: state.currentLocale,
131
+ value: showLocale,
127
132
  onChange: (e, value) => {
128
133
  state.currentLocale = value;
134
+ _onChange(value);
129
135
  },
130
136
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Tab.default, {
131
137
  label: "Default (".concat(_locales.default[defaultLocale], ")"),
@@ -210,12 +216,14 @@ function LocaleTabs(_ref) {
210
216
  }
211
217
  LocaleTabs.propTypes = {
212
218
  sx: _propTypes.default.any,
219
+ onAdd: _propTypes.default.func,
213
220
  onChange: _propTypes.default.func,
214
221
  onRemoveLocale: _propTypes.default.func,
215
222
  locales: _propTypes.default.array
216
223
  };
217
224
  LocaleTabs.defaultProps = {
218
225
  sx: null,
226
+ onAdd: () => {},
219
227
  onChange: () => {},
220
228
  onRemoveLocale: () => {},
221
229
  locales: []
@@ -214,6 +214,8 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
214
214
  return '--';
215
215
  }, [state.type, t]);
216
216
  const reset = (0, _react.useCallback)(() => {
217
+ state.isRoot = true;
218
+ state.locale = defaultLocale;
217
219
  state.type = defaultType;
218
220
  state.linkDisabled = false;
219
221
  saveFn.current = () => {};
@@ -402,6 +404,15 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
402
404
  state.formState.title = (0, _omit.default)(state.formState.title, currentLocale);
403
405
  state.formState.link = (0, _omit.default)(state.formState.link, currentLocale);
404
406
  }, [state.formState]);
407
+ const handleAddLocale = (0, _react.useCallback)(newLocale => {
408
+ var _state$formState$titl, _state$formState$link;
409
+ state.locale = newLocale;
410
+ state.formState.title[newLocale] = (_state$formState$titl = state.formState.title) === null || _state$formState$titl === void 0 ? void 0 : _state$formState$titl[defaultLocale];
411
+ state.formState.link[newLocale] = (_state$formState$link = state.formState.link) === null || _state$formState$link === void 0 ? void 0 : _state$formState$link[defaultLocale];
412
+ setTimeout(() => {
413
+ clearErrors();
414
+ });
415
+ }, [clearErrors, state]);
405
416
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Dialog.default, {
406
417
  open: show,
407
418
  title: name,
@@ -417,6 +428,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
417
428
  sx: {
418
429
  mb: 1
419
430
  },
431
+ onAdd: handleAddLocale,
420
432
  onChange: handleChangeLocale,
421
433
  onRemoveLocale: handleRemoveLocale,
422
434
  locales: state.localeList
@@ -464,6 +476,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
464
476
  placeholder: t('navigation.form.iconPlaceholder'),
465
477
  label: t('navigation.form.icon'),
466
478
  error: !!(errors !== null && errors !== void 0 && (_errors$icon = errors.icon) !== null && _errors$icon !== void 0 && _errors$icon.message),
479
+ disabled: state.locale !== defaultLocale,
467
480
  helperText: (errors === null || errors === void 0 ? void 0 : (_errors$icon2 = errors.icon) === null || _errors$icon2 === void 0 ? void 0 : _errors$icon2.message) || /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
468
481
  display: "flex",
469
482
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
@@ -490,7 +503,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
490
503
  },
491
504
  disableFocusRipple: true,
492
505
  disableRipple: true,
493
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSuffix, {
506
+ children: watchIcon && /*#__PURE__*/(0, _jsxRuntime.jsx)(IconSuffix, {
494
507
  icon: watchIcon
495
508
  })
496
509
  })
@@ -509,7 +522,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
509
522
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_simpleSelect.default, _objectSpread({
510
523
  fullWidth: true,
511
524
  margin: "dense",
512
- disabled: state.type === 'edit',
525
+ disabled: state.type === 'edit' || state.locale !== defaultLocale,
513
526
  label: t('navigation.form.component'),
514
527
  placeholer: t('navigation.form.componentPlaceholder'),
515
528
  options: components.map(item => ({
@@ -519,7 +532,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
519
532
  })),
520
533
  error: !!(errors !== null && errors !== void 0 && (_errors$component = errors.component) !== null && _errors$component !== void 0 && _errors$component.message),
521
534
  helperText: (errors === null || errors === void 0 ? void 0 : (_errors$component2 = errors.component) === null || _errors$component2 === void 0 ? void 0 : _errors$component2.message) || ' '
522
- }, field));
535
+ }, (0, _omit.default)(field, 'ref')));
523
536
  }
524
537
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
525
538
  name: "link",
@@ -528,7 +541,6 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
528
541
  validate: validLink
529
542
  },
530
543
  render: _ref6 => {
531
- var _errors$link3, _errors$link4;
532
544
  let {
533
545
  field
534
546
  } = _ref6;
@@ -575,8 +587,6 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
575
587
  children: option.title
576
588
  })]
577
589
  })),
578
- error: !!(errors !== null && errors !== void 0 && (_errors$link3 = errors.link) !== null && _errors$link3 !== void 0 && _errors$link3.message),
579
- helperText: (errors === null || errors === void 0 ? void 0 : (_errors$link4 = errors.link) === null || _errors$link4 === void 0 ? void 0 : _errors$link4.message) || ' ',
580
590
  margin: "dense"
581
591
  }, field), {}, {
582
592
  onChange: () => {},
@@ -606,7 +616,7 @@ const NavigationDialog = /*#__PURE__*/(0, _react.forwardRef)(function Navigation
606
616
  })),
607
617
  error: !!(errors !== null && errors !== void 0 && (_errors$role = errors.role) !== null && _errors$role !== void 0 && _errors$role.message),
608
618
  helperText: (errors === null || errors === void 0 ? void 0 : (_errors$role2 = errors.role) === null || _errors$role2 === void 0 ? void 0 : _errors$role2.message) || ' '
609
- }, field));
619
+ }, (0, _omit.default)(field, 'ref')));
610
620
  }
611
621
  })]
612
622
  })]
@@ -23,6 +23,7 @@ var _util = require("@blocklet/meta/lib/util");
23
23
  var _node = require("../contexts/node");
24
24
  var _session = require("../contexts/session");
25
25
  var _util2 = require("../util");
26
+ var _util3 = require("./util");
26
27
  var _didAddress = _interopRequireDefault(require("../did-address"));
27
28
  var _jsxRuntime = require("react/jsx-runtime");
28
29
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -319,6 +320,7 @@ function InstallFromUrl(_ref) {
319
320
  onSuccess: onEndInstall,
320
321
  extraParams: {
321
322
  title: meta.title,
323
+ wt: (0, _util3.getWalletType)(meta),
322
324
  blockletMetaUrl: decodeURIComponent(url.trim())
323
325
  },
324
326
  messages: {
@@ -8,7 +8,7 @@ exports.fixBlocklet = exports.ensureDomainAliases = void 0;
8
8
  exports.genExportedMeta = genExportedMeta;
9
9
  exports.getLaunchAgreementUrl = exports.getAppCapabilities = void 0;
10
10
  exports.getNameByTitle = getNameByTitle;
11
- exports.getServerUrl = void 0;
11
+ exports.getWalletType = exports.getServerUrl = void 0;
12
12
  var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
13
13
  var _pick = _interopRequireDefault(require("lodash/pick"));
14
14
  var _pickBy = _interopRequireDefault(require("lodash/pickBy"));
@@ -230,4 +230,9 @@ const fixBlocklet = async function fixBlocklet(blocklet) {
230
230
  }
231
231
  blocklet.capabilities = getAppCapabilities(blocklet);
232
232
  };
233
- exports.fixBlocklet = fixBlocklet;
233
+ exports.fixBlocklet = fixBlocklet;
234
+ const getWalletType = meta => {
235
+ const type = (meta.environments || []).find(x => x.name === 'BLOCKLET_WALLET_TYPE');
236
+ return (type === null || type === void 0 ? void 0 : type.default) || 'default';
237
+ };
238
+ exports.getWalletType = getWalletType;
package/lib/locales/en.js CHANGED
@@ -228,6 +228,7 @@ module.exports = {
228
228
  requiredErrorText: '{name} is required',
229
229
  resource: 'Resource',
230
230
  restart: 'Restart',
231
+ restore: 'Restore',
231
232
  retry: 'Retry',
232
233
  revoke: 'Revoke',
233
234
  role: 'Role',
@@ -306,6 +307,7 @@ module.exports = {
306
307
  reloadSuccess: 'Blocklet was reloaded successfully',
307
308
  statusTip: 'Blocklet is {status}',
308
309
  initialUptime: 'Less than 1m',
310
+ dashboard: 'Blocklet Dashboard',
309
311
  fromUrl: {
310
312
  title: 'Install Blocklet',
311
313
  label: 'Blocklet Meta URL',
@@ -321,8 +323,8 @@ module.exports = {
321
323
  confirmStop: 'Yes, Stop It',
322
324
  cancelDownloadDescription: 'Cancel download {name} ?',
323
325
  removeApplicationDescription: 'Removing the application will erase code and data generated by this application, which is not recoverable if you do not have any backups',
324
- removeApplicationAfterBackup: 'Backup and delete the application. You can restore the application from this server if you need',
325
- removeApplicationComplete: 'Delete the application directly',
326
+ removeApplicationAfterBackup: 'Backup and remove the application. You can restore the application from this server if you need',
327
+ removeApplicationComplete: 'Remove both code and data for this application',
326
328
  removeComponentDescription: 'Removing the component will erase code and data generated by this component, which is not recoverable if you do not have any backups',
327
329
  removeComponentKeepData: 'Keep data for this component, only remove code',
328
330
  removeComponentComplete: 'Remove both code and data for this component',
@@ -1151,6 +1153,7 @@ module.exports = {
1151
1153
  title: 'Lost Passport',
1152
1154
  description: 'The owner of {name} can scan the QR code to retrieve the passport, members please contact the owner to reissue the passport',
1153
1155
  dialog: {
1156
+ title: 'Recover Passport',
1154
1157
  scan: 'Use your DID Wallet to recover the passport',
1155
1158
  confirm: 'Confirm on your DID Wallet',
1156
1159
  success: 'The passport has been successfully added in your wallet'
package/lib/locales/zh.js CHANGED
@@ -234,6 +234,7 @@ module.exports = {
234
234
  requiredErrorText: '{name}是必填的',
235
235
  resource: '资源',
236
236
  restart: '重启',
237
+ restore: '还原',
237
238
  retry: '重试',
238
239
  revoke: '撤销',
239
240
  role: '角色',
@@ -312,13 +313,14 @@ module.exports = {
312
313
  reloadSuccess: 'Blocklet 重启成功',
313
314
  statusTip: 'Blocklet {status}',
314
315
  initialUptime: '少于1分钟',
316
+ dashboard: 'Blocklet 控制台',
315
317
  action: {
316
318
  stopDescription: '停止该基石程序将会使页面不可以访问,可能会导致使用它的用户出现错误',
317
319
  confirmStop: '是的,停止',
318
320
  cancelDownloadDescription: '取消下载 {name} ?',
319
321
  removeApplicationDescription: '如果没有备份数据,删除应用将会删除所有数据,包括应用运行时产生的所有数据',
320
- removeApplicationAfterBackup: '备份和删除该应用。 需要时您可以从此服务器恢复该应用',
321
- removeApplicationComplete: '直接删除该应用',
322
+ removeApplicationAfterBackup: '备份后删除应用。 需要时您可以从此服务器恢复该应用',
323
+ removeApplicationComplete: '直接删除应用程序和数据',
322
324
  removeComponentDescription: '如果没有备份数据,删除该组件将会删除所有数据,包括组件运行时产生的所有数据',
323
325
  removeComponentKeepData: '保留该组件的数据,只删除组件',
324
326
  removeComponentComplete: '删除组件和数据',
@@ -1156,6 +1158,7 @@ module.exports = {
1156
1158
  title: '找回通行证',
1157
1159
  description: '{name} 所有者可扫描二维码找回通行证,成员请联系所有者重新颁发通行证',
1158
1160
  dialog: {
1161
+ title: '找回通行证',
1159
1162
  scan: '用您的 DID 钱包扫描下面的二维码',
1160
1163
  confirm: '在您的 DID 钱包上确认',
1161
1164
  success: '通行证已成功添加到您的 DID 钱包'
@@ -170,6 +170,7 @@ function LostPassport(_ref2) {
170
170
  onSuccess: onGetUser,
171
171
  locale: locale,
172
172
  messages: {
173
+ title: t('lostPassport.dialog.title'),
173
174
  scan: t('lostPassport.dialog.scan'),
174
175
  confirm: t('lostPassport.dialog.confirm'),
175
176
  success: t('lostPassport.dialog.success')
@@ -260,6 +261,7 @@ function LostPassport(_ref2) {
260
261
  onSuccess: onReceivePassport,
261
262
  locale: locale,
262
263
  messages: {
264
+ title: "".concat(t('lostPassport.dialog.title')),
263
265
  scan: t('lostPassport.dialog.scan'),
264
266
  confirm: t('lostPassport.dialog.confirm'),
265
267
  success: t('lostPassport.dialog.success')
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.0-beta-1f8bf936",
6
+ "version": "1.16.0-beta-58020de5",
7
7
  "description": "UX components shared across abtnode packages",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -21,20 +21,20 @@
21
21
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@abtnode/auth": "1.16.0-beta-1f8bf936",
25
- "@abtnode/constant": "1.16.0-beta-1f8bf936",
26
- "@abtnode/util": "1.16.0-beta-1f8bf936",
27
- "@arcblock/did-connect": "^2.5.15",
24
+ "@abtnode/auth": "1.16.0-beta-58020de5",
25
+ "@abtnode/constant": "1.16.0-beta-58020de5",
26
+ "@abtnode/util": "1.16.0-beta-58020de5",
27
+ "@arcblock/did-connect": "^2.5.16",
28
28
  "@arcblock/did-motif": "^1.1.10",
29
- "@arcblock/icons": "^2.5.15",
30
- "@arcblock/react-hooks": "^2.5.15",
31
- "@arcblock/terminal": "^2.5.15",
32
- "@arcblock/ux": "^2.5.15",
33
- "@blocklet/constant": "1.16.0-beta-1f8bf936",
29
+ "@arcblock/icons": "^2.5.16",
30
+ "@arcblock/react-hooks": "^2.5.16",
31
+ "@arcblock/terminal": "^2.5.16",
32
+ "@arcblock/ux": "^2.5.16",
33
+ "@blocklet/constant": "1.16.0-beta-58020de5",
34
34
  "@blocklet/launcher-layout": "1.9.65",
35
35
  "@blocklet/list": "^0.11.10",
36
- "@blocklet/meta": "1.16.0-beta-1f8bf936",
37
- "@blocklet/ui-react": "^2.5.15",
36
+ "@blocklet/meta": "1.16.0-beta-58020de5",
37
+ "@blocklet/ui-react": "^2.5.16",
38
38
  "@emotion/react": "^11.10.4",
39
39
  "@emotion/styled": "^11.10.4",
40
40
  "@iconify/react": "^4.0.0",
@@ -88,5 +88,5 @@
88
88
  "@babel/preset-react": "^7.18.6",
89
89
  "babel-plugin-inline-react-svg": "^1.1.2"
90
90
  },
91
- "gitHead": "d832948cdc83e67ea42a2aefba3649fa73723b65"
91
+ "gitHead": "9d3f47f9827acf13e9efea38cd605d3b36f9f523"
92
92
  }