@blocklet/ui-react 2.9.58 → 2.9.60

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.
@@ -178,13 +178,26 @@ export default function UserSessions({
178
178
  }
179
179
  }
180
180
  },
181
+ {
182
+ label: t("createdAt"),
183
+ name: "createdAt",
184
+ options: {
185
+ customBodyRenderLite: (rawIndex) => {
186
+ const x = safeData[rawIndex];
187
+ return x.createdAt ? (
188
+ // @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示
189
+ /* @__PURE__ */ jsx(RelativeTime, { value: x.createdAt, relativeRange: 3 * 86400 * 1e3, locale })
190
+ ) : t("unknown");
191
+ }
192
+ }
193
+ },
181
194
  {
182
195
  label: t("updatedAt"),
183
196
  name: "updatedAt",
184
197
  options: {
185
198
  customBodyRenderLite: (rawIndex) => {
186
199
  const x = safeData[rawIndex];
187
- return /* @__PURE__ */ jsx(RelativeTime, { value: x.updatedAt, relativeRange: 3 * 86400 * 1e3, locale });
200
+ return x.status === "expired" ? t("expired") : /* @__PURE__ */ jsx(RelativeTime, { value: x.updatedAt, relativeRange: 3 * 86400 * 1e3, locale });
188
201
  }
189
202
  }
190
203
  },
@@ -220,7 +233,7 @@ export default function UserSessions({
220
233
  size: "small",
221
234
  color: "error",
222
235
  onClick: () => logout({ visitorId: x.visitorId }),
223
- children: currentVisitorId === x.visitorId ? t("currentSession") : t("logout")
236
+ children: x.status === "expired" ? t("remove") : currentVisitorId === x.visitorId ? t("currentSession") : t("logout")
224
237
  }
225
238
  ) });
226
239
  }
@@ -11,6 +11,7 @@ export declare const translations: {
11
11
  email: string;
12
12
  avatar: string;
13
13
  user: string;
14
+ createdAt: string;
14
15
  updatedAt: string;
15
16
  lastLoginIp: string;
16
17
  actions: string;
@@ -19,6 +20,8 @@ export declare const translations: {
19
20
  logout: string;
20
21
  currentSession: string;
21
22
  unknown: string;
23
+ expired: string;
24
+ remove: string;
22
25
  logoutThisSession: string;
23
26
  logoutThisSessionConfirm: string;
24
27
  logoutAllSession: string;
@@ -36,6 +39,7 @@ export declare const translations: {
36
39
  email: string;
37
40
  avatar: string;
38
41
  user: string;
42
+ createdAt: string;
39
43
  updatedAt: string;
40
44
  actions: string;
41
45
  lastLoginIp: string;
@@ -44,6 +48,8 @@ export declare const translations: {
44
48
  logout: string;
45
49
  currentSession: string;
46
50
  unknown: string;
51
+ expired: string;
52
+ remove: string;
47
53
  logoutThisSession: string;
48
54
  logoutThisSessionConfirm: string;
49
55
  logoutAllSession: string;
@@ -11,6 +11,7 @@ export const translations = {
11
11
  email: "\u90AE\u7BB1",
12
12
  avatar: "\u5934\u50CF",
13
13
  user: "\u7528\u6237",
14
+ createdAt: "\u9996\u6B21\u6D3B\u52A8\u65F6\u95F4",
14
15
  updatedAt: "\u6700\u8FD1\u6D3B\u52A8\u65F6\u95F4",
15
16
  lastLoginIp: "\u6700\u8FD1\u6D3B\u52A8\u5730\u5740",
16
17
  actions: "\u64CD\u4F5C",
@@ -19,6 +20,8 @@ export const translations = {
19
20
  logout: "\u6CE8\u9500",
20
21
  currentSession: "\u5F53\u524D\u4F1A\u8BDD",
21
22
  unknown: "\u672A\u77E5",
23
+ expired: "\u5DF2\u8FC7\u671F",
24
+ remove: "\u5220\u9664",
22
25
  logoutThisSession: "\u6CE8\u9500\u6307\u5B9A\u4F1A\u8BDD",
23
26
  logoutThisSessionConfirm: "\u786E\u5B9A\u8981\u6CE8\u9500\u6B64\u4F1A\u8BDD\u5417?",
24
27
  logoutAllSession: "\u6CE8\u9500\u6240\u6709\u4F1A\u8BDD",
@@ -36,6 +39,7 @@ export const translations = {
36
39
  email: "Email",
37
40
  avatar: "Avatar",
38
41
  user: "User",
42
+ createdAt: "First Active Time",
39
43
  updatedAt: "Last Active Time",
40
44
  actions: "Actions",
41
45
  lastLoginIp: "Last Login IP",
@@ -44,6 +48,8 @@ export const translations = {
44
48
  logout: "Logout",
45
49
  currentSession: "Current Session",
46
50
  unknown: "Unknown",
51
+ expired: "Expired",
52
+ remove: "Remove",
47
53
  logoutThisSession: "Logout this session",
48
54
  logoutThisSessionConfirm: "Are you sure to logout this session?",
49
55
  logoutAllSession: "Logout all sessions",
@@ -202,13 +202,29 @@ function UserSessions({
202
202
  });
203
203
  }
204
204
  }
205
+ }, {
206
+ label: t("createdAt"),
207
+ name: "createdAt",
208
+ options: {
209
+ customBodyRenderLite: rawIndex => {
210
+ const x = safeData[rawIndex];
211
+ return x.createdAt ?
212
+ // @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示
213
+ /* @__PURE__ */
214
+ (0, _jsxRuntime.jsx)(_RelativeTime.default, {
215
+ value: x.createdAt,
216
+ relativeRange: 3 * 86400 * 1e3,
217
+ locale
218
+ }) : t("unknown");
219
+ }
220
+ }
205
221
  }, {
206
222
  label: t("updatedAt"),
207
223
  name: "updatedAt",
208
224
  options: {
209
225
  customBodyRenderLite: rawIndex => {
210
226
  const x = safeData[rawIndex];
211
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_RelativeTime.default, {
227
+ return x.status === "expired" ? t("expired") : /* @__PURE__ */(0, _jsxRuntime.jsx)(_RelativeTime.default, {
212
228
  value: x.updatedAt,
213
229
  relativeRange: 3 * 86400 * 1e3,
214
230
  locale
@@ -257,7 +273,7 @@ function UserSessions({
257
273
  onClick: () => logout({
258
274
  visitorId: x.visitorId
259
275
  }),
260
- children: currentVisitorId === x.visitorId ? t("currentSession") : t("logout")
276
+ children: x.status === "expired" ? t("remove") : currentVisitorId === x.visitorId ? t("currentSession") : t("logout")
261
277
  })
262
278
  });
263
279
  }
@@ -11,6 +11,7 @@ export declare const translations: {
11
11
  email: string;
12
12
  avatar: string;
13
13
  user: string;
14
+ createdAt: string;
14
15
  updatedAt: string;
15
16
  lastLoginIp: string;
16
17
  actions: string;
@@ -19,6 +20,8 @@ export declare const translations: {
19
20
  logout: string;
20
21
  currentSession: string;
21
22
  unknown: string;
23
+ expired: string;
24
+ remove: string;
22
25
  logoutThisSession: string;
23
26
  logoutThisSessionConfirm: string;
24
27
  logoutAllSession: string;
@@ -36,6 +39,7 @@ export declare const translations: {
36
39
  email: string;
37
40
  avatar: string;
38
41
  user: string;
42
+ createdAt: string;
39
43
  updatedAt: string;
40
44
  actions: string;
41
45
  lastLoginIp: string;
@@ -44,6 +48,8 @@ export declare const translations: {
44
48
  logout: string;
45
49
  currentSession: string;
46
50
  unknown: string;
51
+ expired: string;
52
+ remove: string;
47
53
  logoutThisSession: string;
48
54
  logoutThisSessionConfirm: string;
49
55
  logoutAllSession: string;
@@ -17,6 +17,7 @@ const translations = exports.translations = {
17
17
  email: "\u90AE\u7BB1",
18
18
  avatar: "\u5934\u50CF",
19
19
  user: "\u7528\u6237",
20
+ createdAt: "\u9996\u6B21\u6D3B\u52A8\u65F6\u95F4",
20
21
  updatedAt: "\u6700\u8FD1\u6D3B\u52A8\u65F6\u95F4",
21
22
  lastLoginIp: "\u6700\u8FD1\u6D3B\u52A8\u5730\u5740",
22
23
  actions: "\u64CD\u4F5C",
@@ -25,6 +26,8 @@ const translations = exports.translations = {
25
26
  logout: "\u6CE8\u9500",
26
27
  currentSession: "\u5F53\u524D\u4F1A\u8BDD",
27
28
  unknown: "\u672A\u77E5",
29
+ expired: "\u5DF2\u8FC7\u671F",
30
+ remove: "\u5220\u9664",
28
31
  logoutThisSession: "\u6CE8\u9500\u6307\u5B9A\u4F1A\u8BDD",
29
32
  logoutThisSessionConfirm: "\u786E\u5B9A\u8981\u6CE8\u9500\u6B64\u4F1A\u8BDD\u5417?",
30
33
  logoutAllSession: "\u6CE8\u9500\u6240\u6709\u4F1A\u8BDD",
@@ -42,6 +45,7 @@ const translations = exports.translations = {
42
45
  email: "Email",
43
46
  avatar: "Avatar",
44
47
  user: "User",
48
+ createdAt: "First Active Time",
45
49
  updatedAt: "Last Active Time",
46
50
  actions: "Actions",
47
51
  lastLoginIp: "Last Login IP",
@@ -50,6 +54,8 @@ const translations = exports.translations = {
50
54
  logout: "Logout",
51
55
  currentSession: "Current Session",
52
56
  unknown: "Unknown",
57
+ expired: "Expired",
58
+ remove: "Remove",
53
59
  logoutThisSession: "Logout this session",
54
60
  logoutThisSessionConfirm: "Are you sure to logout this session?",
55
61
  logoutAllSession: "Logout all sessions",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.9.58",
3
+ "version": "2.9.60",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -62,9 +62,9 @@
62
62
  }
63
63
  },
64
64
  "dependencies": {
65
- "@arcblock/did-connect": "^2.9.58",
66
- "@arcblock/react-hooks": "^2.9.58",
67
- "@arcblock/ux": "^2.9.58",
65
+ "@arcblock/did-connect": "^2.9.60",
66
+ "@arcblock/react-hooks": "^2.9.60",
67
+ "@arcblock/ux": "^2.9.60",
68
68
  "@blocklet/js-sdk": "1.16.25-beta-be3a37f4",
69
69
  "@emotion/react": "^11.10.4",
70
70
  "@emotion/styled": "^11.10.4",
@@ -108,5 +108,5 @@
108
108
  "jest": "^28.1.3",
109
109
  "unbuild": "^2.0.0"
110
110
  },
111
- "gitHead": "908522ee6638e31a421ee0bb1942f0a20792ba8a"
111
+ "gitHead": "fdeb4c09774c3abf8401ac7bf5a619415677c502"
112
112
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable no-nested-ternary */
1
2
  /* eslint-disable react/no-unstable-nested-components */
2
3
  import Datatable from '@arcblock/ux/lib/Datatable';
3
4
  import { useCreation, useMemoizedFn, useRequest } from 'ahooks';
@@ -194,13 +195,34 @@ export default function UserSessions({
194
195
  },
195
196
  },
196
197
  },
198
+ {
199
+ label: t('createdAt'),
200
+ name: 'createdAt',
201
+ options: {
202
+ customBodyRenderLite: (rawIndex: number) => {
203
+ const x = safeData[rawIndex];
204
+ // @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示
205
+ return x.createdAt ? (
206
+ // @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示
207
+ <RelativeTime value={x.createdAt} relativeRange={3 * 86400 * 1000} locale={locale} />
208
+ ) : (
209
+ t('unknown')
210
+ );
211
+ },
212
+ },
213
+ },
197
214
  {
198
215
  label: t('updatedAt'),
199
216
  name: 'updatedAt',
200
217
  options: {
201
218
  customBodyRenderLite: (rawIndex: number) => {
202
219
  const x = safeData[rawIndex];
203
- return <RelativeTime value={x.updatedAt} relativeRange={3 * 86400 * 1000} locale={locale} />;
220
+ // @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示
221
+ return x.status === 'expired' ? (
222
+ t('expired')
223
+ ) : (
224
+ <RelativeTime value={x.updatedAt} relativeRange={3 * 86400 * 1000} locale={locale} />
225
+ );
204
226
  },
205
227
  },
206
228
  },
@@ -246,7 +268,12 @@ export default function UserSessions({
246
268
  size="small"
247
269
  color="error"
248
270
  onClick={() => logout({ visitorId: x.visitorId })}>
249
- {currentVisitorId === x.visitorId ? t('currentSession') : t('logout')}
271
+ {/* @ts-ignore FIXME: @zhanghan 新版 js-sdk 会提供这个属性的提示 */}
272
+ {x.status === 'expired'
273
+ ? t('remove')
274
+ : currentVisitorId === x.visitorId
275
+ ? t('currentSession')
276
+ : t('logout')}
250
277
  </Button>
251
278
  </Box>
252
279
  );
@@ -11,6 +11,7 @@ export const translations = {
11
11
  email: '邮箱',
12
12
  avatar: '头像',
13
13
  user: '用户',
14
+ createdAt: '首次活动时间',
14
15
  updatedAt: '最近活动时间',
15
16
  lastLoginIp: '最近活动地址',
16
17
  actions: '操作',
@@ -19,6 +20,8 @@ export const translations = {
19
20
  logout: '注销',
20
21
  currentSession: '当前会话',
21
22
  unknown: '未知',
23
+ expired: '已过期',
24
+ remove: '删除',
22
25
  logoutThisSession: '注销指定会话',
23
26
  logoutThisSessionConfirm: '确定要注销此会话吗?',
24
27
  logoutAllSession: '注销所有会话',
@@ -36,6 +39,7 @@ export const translations = {
36
39
  email: 'Email',
37
40
  avatar: 'Avatar',
38
41
  user: 'User',
42
+ createdAt: 'First Active Time',
39
43
  updatedAt: 'Last Active Time',
40
44
  actions: 'Actions',
41
45
  lastLoginIp: 'Last Login IP',
@@ -44,6 +48,8 @@ export const translations = {
44
48
  logout: 'Logout',
45
49
  currentSession: 'Current Session',
46
50
  unknown: 'Unknown',
51
+ expired: 'Expired',
52
+ remove: 'Remove',
47
53
  logoutThisSession: 'Logout this session',
48
54
  logoutThisSessionConfirm: 'Are you sure to logout this session?',
49
55
  logoutAllSession: 'Logout all sessions',