@abtnode/ux 1.16.16-beta-e038cde7 → 1.16.16-beta-d6c5ed65

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.
@@ -539,9 +539,9 @@ export default function AddComponent({
539
539
  }
540
540
  return 0;
541
541
  });
542
- const sharedConfigObj = getSharedConfigObj({
542
+ const sharedConfigObj = getSharedConfigObj(ancestors[0], {
543
543
  configs: componentAllConfigs
544
- }, ancestors);
544
+ });
545
545
  const configsValue = {};
546
546
  const configsList = componentAllConfigs.map(item => {
547
547
  const {
@@ -7,7 +7,7 @@ import MaterialTable from '@material-table/core';
7
7
  import TextField from '@mui/material/TextField';
8
8
  import Alert from '@mui/material/Alert';
9
9
  import { BLOCKLET_CONFIGURABLE_KEY, CHAIN_PROP_MAP } from '@blocklet/constant';
10
- import { getComponentMissingConfigs, getSharedConfigObj } from '@blocklet/meta/lib/util';
10
+ import { getComponentMissingConfigs, getSharedConfigObj, isEnvShareable } from '@blocklet/meta/lib/util';
11
11
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
12
12
  import Toast from '@arcblock/ux/lib/Toast';
13
13
  import ClickToCopy from '../../click-to-copy';
@@ -23,7 +23,7 @@ const getDescription = (data, t) => {
23
23
  let {
24
24
  description
25
25
  } = data;
26
- if (Object.values(CHAIN_PROP_MAP).includes(data.key)) {
26
+ if (Object.values(CHAIN_PROP_MAP).includes(data.key) || isEnvShareable(data)) {
27
27
  if (description) {
28
28
  description = `${description} (${t('blocklet.config.sharedToAllComponents')})`;
29
29
  } else {
@@ -37,6 +37,19 @@ const getDescription = (data, t) => {
37
37
  children: description
38
38
  });
39
39
  };
40
+ const isCustom = (env, blocklet, ancestors = []) => {
41
+ if (!ancestors?.length &&
42
+ // is container
43
+ !env.custom &&
44
+ // is not manual
45
+ !['CHAIN_ID', 'CHAIN_HOST'].includes(env.key) && !blocklet.meta.environments.find(y => y.name === env.key) &&
46
+ // is not declared in blocklet.yml
47
+ blocklet.children.every(child => !child.meta.environments.find(y => y.name === env.key)) // is not declared in all children
48
+ ) {
49
+ return true;
50
+ }
51
+ return env.custom;
52
+ };
40
53
  export default function ComponentEnvironment({
41
54
  blocklet,
42
55
  ancestors
@@ -50,7 +63,7 @@ export default function ComponentEnvironment({
50
63
  } = useContext(LocaleContext);
51
64
  const dids = [...ancestors.map(x => x.meta.did), blocklet.meta.did];
52
65
  const onConfigChanged = () => Toast.success(t('blocklet.config.changedTip'));
53
- const isConfigEditable = x => x.custom;
66
+ const isConfigEditable = x => isCustom(x, blocklet, ancestors);
54
67
  if (isInstalling(blocklet.status)) {
55
68
  return null;
56
69
  }
@@ -96,7 +109,7 @@ export default function ComponentEnvironment({
96
109
  }
97
110
  const configs = [newData];
98
111
  if (newData.key !== oldData.key) {
99
- if (!newData.custom) {
112
+ if (!isCustom(newData, blocklet, ancestors)) {
100
113
  Toast.error('Only key of custom env can be changed');
101
114
  return;
102
115
  }
@@ -124,7 +137,7 @@ export default function ComponentEnvironment({
124
137
  Toast.error(t('blocklet.config.environment.deleteForbidden'));
125
138
  return;
126
139
  }
127
- if (!data.custom) {
140
+ if (!isCustom(data, blocklet, ancestors)) {
128
141
  Toast.error('Only key of custom env can be changed');
129
142
  return;
130
143
  }
@@ -144,8 +157,8 @@ export default function ComponentEnvironment({
144
157
 
145
158
  // configs
146
159
  const componentConfigs = (blocklet.configs || []).filter(x => !BLOCKLET_CONFIGURABLE_KEY[x.key]);
147
- const sharedConfigObj = getSharedConfigObj(blocklet, ancestors);
148
- const missingRequiredConfigs = getComponentMissingConfigs(blocklet, ancestors);
160
+ const sharedConfigObj = getSharedConfigObj(ancestors[0], blocklet);
161
+ const missingRequiredConfigs = getComponentMissingConfigs(blocklet, ancestors[0]);
149
162
  const configs = componentConfigs.map(x => ({
150
163
  ...x,
151
164
  value: Object.values(CHAIN_PROP_MAP).includes(x.key) && Object.keys(sharedConfigObj).includes(x.key) ? sharedConfigObj[x.key] : sharedConfigObj[x.key] || x.value
@@ -364,7 +364,7 @@ function ComponentItem({
364
364
  color: "error",
365
365
  badgeContent: "",
366
366
  variant: "dot",
367
- invisible: !getComponentMissingConfigs(blocklet, ancestors).length,
367
+ invisible: !getComponentMissingConfigs(blocklet, ancestors[0]).length,
368
368
  children: /*#__PURE__*/_jsx(IconButton, {
369
369
  onClick: open,
370
370
  size: "small",
@@ -56,6 +56,7 @@ function TreeTitle({
56
56
  variant: "body2",
57
57
  color: "gray",
58
58
  ml: 1.5,
59
+ lineHeight: 1,
59
60
  children: subtitleShow
60
61
  })]
61
62
  });
@@ -65,7 +65,8 @@ export default function HeaderAddon({
65
65
  session: session,
66
66
  size: 24,
67
67
  showRole: true,
68
- ...sessionManagerProps
68
+ ...sessionManagerProps,
69
+ showManageBlocklet: false
69
70
  })]
70
71
  });
71
72
  }
package/es/locales/en.js CHANGED
@@ -1040,7 +1040,8 @@ module.exports = {
1040
1040
  error: {
1041
1041
  passportEmpty: 'Passport should not be empty'
1042
1042
  },
1043
- connectedAccounts: 'Connected Accounts'
1043
+ connectedAccounts: 'Connected Accounts',
1044
+ federated: 'Federated'
1044
1045
  },
1045
1046
  transferNode: {
1046
1047
  name: 'Transfer Ownership',
package/es/locales/zh.js CHANGED
@@ -1042,7 +1042,8 @@ module.exports = {
1042
1042
  error: {
1043
1043
  passportEmpty: '通行证不能为空'
1044
1044
  },
1045
- connectedAccounts: '已连接账号'
1045
+ connectedAccounts: '已连接账号',
1046
+ federated: '统一登录'
1046
1047
  },
1047
1048
  transferNode: {
1048
1049
  name: '转移所有者',
@@ -294,14 +294,19 @@ export default function MemberList({
294
294
  label: t('team.member.source'),
295
295
  name: 'sourceProvider',
296
296
  options: {
297
- customBodyRender: e => {
298
- const source = e || USER_TYPE.WALLET;
297
+ customBodyRenderLite: rowIndex => {
298
+ const user = users[rowIndex];
299
+ const source = user.sourceProvider || USER_TYPE.WALLET;
299
300
  const providerNameMap = {
300
301
  auth0: 'Auth0',
301
302
  wallet: 'DID wallet',
302
303
  federated: 'Federated'
303
304
  };
304
- return providerNameMap[source] || source;
305
+ const providerName = providerNameMap[source] || source;
306
+ if (user.sourceAppPid) {
307
+ return `${providerName} (${t('team.member.federated')})`;
308
+ }
309
+ return providerName;
305
310
  }
306
311
  }
307
312
  }, {
@@ -550,9 +550,9 @@ function AddComponent(_ref2) {
550
550
  }
551
551
  return 0;
552
552
  });
553
- const sharedConfigObj = (0, _util.getSharedConfigObj)({
553
+ const sharedConfigObj = (0, _util.getSharedConfigObj)(ancestors[0], {
554
554
  configs: componentAllConfigs
555
- }, ancestors);
555
+ });
556
556
  const configsValue = {};
557
557
  const configsList = componentAllConfigs.map(item => {
558
558
  const {
@@ -34,7 +34,7 @@ const getDescription = (data, t) => {
34
34
  let {
35
35
  description
36
36
  } = data;
37
- if (Object.values(_constant.CHAIN_PROP_MAP).includes(data.key)) {
37
+ if (Object.values(_constant.CHAIN_PROP_MAP).includes(data.key) || (0, _util.isEnvShareable)(data)) {
38
38
  if (description) {
39
39
  description = "".concat(description, " (").concat(t('blocklet.config.sharedToAllComponents'), ")");
40
40
  } else {
@@ -48,6 +48,20 @@ const getDescription = (data, t) => {
48
48
  children: description
49
49
  });
50
50
  };
51
+ const isCustom = function isCustom(env, blocklet) {
52
+ let ancestors = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
53
+ if (!(ancestors !== null && ancestors !== void 0 && ancestors.length) &&
54
+ // is container
55
+ !env.custom &&
56
+ // is not manual
57
+ !['CHAIN_ID', 'CHAIN_HOST'].includes(env.key) && !blocklet.meta.environments.find(y => y.name === env.key) &&
58
+ // is not declared in blocklet.yml
59
+ blocklet.children.every(child => !child.meta.environments.find(y => y.name === env.key)) // is not declared in all children
60
+ ) {
61
+ return true;
62
+ }
63
+ return env.custom;
64
+ };
51
65
  function ComponentEnvironment(_ref) {
52
66
  let {
53
67
  blocklet,
@@ -62,7 +76,7 @@ function ComponentEnvironment(_ref) {
62
76
  } = (0, _react.useContext)(_context.LocaleContext);
63
77
  const dids = [...ancestors.map(x => x.meta.did), blocklet.meta.did];
64
78
  const onConfigChanged = () => _Toast.default.success(t('blocklet.config.changedTip'));
65
- const isConfigEditable = x => x.custom;
79
+ const isConfigEditable = x => isCustom(x, blocklet, ancestors);
66
80
  if ((0, _util2.isInstalling)(blocklet.status)) {
67
81
  return null;
68
82
  }
@@ -108,7 +122,7 @@ function ComponentEnvironment(_ref) {
108
122
  }
109
123
  const configs = [newData];
110
124
  if (newData.key !== oldData.key) {
111
- if (!newData.custom) {
125
+ if (!isCustom(newData, blocklet, ancestors)) {
112
126
  _Toast.default.error('Only key of custom env can be changed');
113
127
  return;
114
128
  }
@@ -136,7 +150,7 @@ function ComponentEnvironment(_ref) {
136
150
  _Toast.default.error(t('blocklet.config.environment.deleteForbidden'));
137
151
  return;
138
152
  }
139
- if (!data.custom) {
153
+ if (!isCustom(data, blocklet, ancestors)) {
140
154
  _Toast.default.error('Only key of custom env can be changed');
141
155
  return;
142
156
  }
@@ -156,8 +170,8 @@ function ComponentEnvironment(_ref) {
156
170
 
157
171
  // configs
158
172
  const componentConfigs = (blocklet.configs || []).filter(x => !_constant.BLOCKLET_CONFIGURABLE_KEY[x.key]);
159
- const sharedConfigObj = (0, _util.getSharedConfigObj)(blocklet, ancestors);
160
- const missingRequiredConfigs = (0, _util.getComponentMissingConfigs)(blocklet, ancestors);
173
+ const sharedConfigObj = (0, _util.getSharedConfigObj)(ancestors[0], blocklet);
174
+ const missingRequiredConfigs = (0, _util.getComponentMissingConfigs)(blocklet, ancestors[0]);
161
175
  const configs = componentConfigs.map(x => _objectSpread(_objectSpread({}, x), {}, {
162
176
  value: Object.values(_constant.CHAIN_PROP_MAP).includes(x.key) && Object.keys(sharedConfigObj).includes(x.key) ? sharedConfigObj[x.key] : sharedConfigObj[x.key] || x.value
163
177
  }));
@@ -389,7 +389,7 @@ function ComponentItem(_ref) {
389
389
  color: "error",
390
390
  badgeContent: "",
391
391
  variant: "dot",
392
- invisible: !(0, _util.getComponentMissingConfigs)(blocklet, ancestors).length,
392
+ invisible: !(0, _util.getComponentMissingConfigs)(blocklet, ancestors[0]).length,
393
393
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
394
394
  onClick: open,
395
395
  size: "small",
@@ -68,6 +68,7 @@ function TreeTitle(_ref2) {
68
68
  variant: "body2",
69
69
  color: "gray",
70
70
  ml: 1.5,
71
+ lineHeight: 1,
71
72
  children: subtitleShow
72
73
  })]
73
74
  });
@@ -73,12 +73,14 @@ function HeaderAddon(_ref) {
73
73
  }), showHelper && /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
74
74
  onClick: onHelpClick,
75
75
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_QuestionMarkCircle.default, {})
76
- }), showSessionManager && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SessionManager.default, _objectSpread({
76
+ }), showSessionManager && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SessionManager.default, _objectSpread(_objectSpread({
77
77
  locale: locale,
78
78
  session: session,
79
79
  size: 24,
80
80
  showRole: true
81
- }, sessionManagerProps))]
81
+ }, sessionManagerProps), {}, {
82
+ showManageBlocklet: false
83
+ }))]
82
84
  });
83
85
  }
84
86
  HeaderAddon.propTypes = {
package/lib/locales/en.js CHANGED
@@ -1042,7 +1042,8 @@ module.exports = {
1042
1042
  error: {
1043
1043
  passportEmpty: 'Passport should not be empty'
1044
1044
  },
1045
- connectedAccounts: 'Connected Accounts'
1045
+ connectedAccounts: 'Connected Accounts',
1046
+ federated: 'Federated'
1046
1047
  },
1047
1048
  transferNode: {
1048
1049
  name: 'Transfer Ownership',
package/lib/locales/zh.js CHANGED
@@ -1044,7 +1044,8 @@ module.exports = {
1044
1044
  error: {
1045
1045
  passportEmpty: '通行证不能为空'
1046
1046
  },
1047
- connectedAccounts: '已连接账号'
1047
+ connectedAccounts: '已连接账号',
1048
+ federated: '统一登录'
1048
1049
  },
1049
1050
  transferNode: {
1050
1051
  name: '转移所有者',
@@ -312,14 +312,19 @@ function MemberList(_ref2) {
312
312
  label: t('team.member.source'),
313
313
  name: 'sourceProvider',
314
314
  options: {
315
- customBodyRender: e => {
316
- const source = e || _constant.USER_TYPE.WALLET;
315
+ customBodyRenderLite: rowIndex => {
316
+ const user = users[rowIndex];
317
+ const source = user.sourceProvider || _constant.USER_TYPE.WALLET;
317
318
  const providerNameMap = {
318
319
  auth0: 'Auth0',
319
320
  wallet: 'DID wallet',
320
321
  federated: 'Federated'
321
322
  };
322
- return providerNameMap[source] || source;
323
+ const providerName = providerNameMap[source] || source;
324
+ if (user.sourceAppPid) {
325
+ return "".concat(providerName, " (").concat(t('team.member.federated'), ")");
326
+ }
327
+ return providerName;
323
328
  }
324
329
  }
325
330
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.16-beta-e038cde7",
3
+ "version": "1.16.16-beta-d6c5ed65",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,23 +27,23 @@
27
27
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@abtnode/auth": "1.16.16-beta-e038cde7",
31
- "@abtnode/constant": "1.16.16-beta-e038cde7",
32
- "@abtnode/util": "1.16.16-beta-e038cde7",
30
+ "@abtnode/auth": "1.16.16-beta-d6c5ed65",
31
+ "@abtnode/constant": "1.16.16-beta-d6c5ed65",
32
+ "@abtnode/util": "1.16.16-beta-d6c5ed65",
33
33
  "@ahooksjs/use-url-state": "^3.5.1",
34
34
  "@arcblock/did": "^1.18.89",
35
- "@arcblock/did-connect": "^2.7.16",
35
+ "@arcblock/did-connect": "^2.7.17",
36
36
  "@arcblock/did-motif": "^1.1.13",
37
- "@arcblock/icons": "^2.7.16",
38
- "@arcblock/nft-display": "2.7.16",
39
- "@arcblock/react-hooks": "^2.7.16",
40
- "@arcblock/terminal": "^2.7.16",
41
- "@arcblock/ux": "^2.7.16",
42
- "@blocklet/constant": "1.16.16-beta-e038cde7",
43
- "@blocklet/launcher-layout": "2.2.5",
44
- "@blocklet/list": "^0.12.35",
45
- "@blocklet/meta": "1.16.16-beta-e038cde7",
46
- "@blocklet/ui-react": "^2.7.16",
37
+ "@arcblock/icons": "^2.7.17",
38
+ "@arcblock/nft-display": "2.7.17",
39
+ "@arcblock/react-hooks": "^2.7.17",
40
+ "@arcblock/terminal": "^2.7.17",
41
+ "@arcblock/ux": "^2.7.17",
42
+ "@blocklet/constant": "1.16.16-beta-d6c5ed65",
43
+ "@blocklet/launcher-layout": "2.2.7",
44
+ "@blocklet/list": "^0.12.37",
45
+ "@blocklet/meta": "1.16.16-beta-d6c5ed65",
46
+ "@blocklet/ui-react": "^2.7.17",
47
47
  "@emotion/react": "^11.10.4",
48
48
  "@emotion/styled": "^11.10.4",
49
49
  "@iconify/react": "^4.0.0",
@@ -98,7 +98,7 @@
98
98
  "babel-plugin-inline-react-svg": "^1.1.2",
99
99
  "glob": "^10.3.3"
100
100
  },
101
- "gitHead": "688b1c7ae0f6652094100c101f5d218266dd86ac",
101
+ "gitHead": "16f5632a7b86283381fa49acc4d2553c65cd2aa3",
102
102
  "exports": {
103
103
  ".": {
104
104
  "import": "./es/index.js",