@abtnode/ux 1.8.0 → 1.8.3
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.
- package/lib/card-selector.js +28 -28
- package/lib/invitation/invitation-app.js +26 -15
- package/lib/invitation/invitation-passport.js +69 -57
- package/lib/invitation/invitation-receive.js +39 -35
- package/lib/invitation/invitation-user.js +23 -22
- package/lib/invitation/invitation.js +23 -21
- package/lib/issue-passport.js +54 -47
- package/lib/launch-blocklet/content-layout.js +11 -3
- package/lib/launch-blocklet/page-header.js +11 -7
- package/lib/layout/addon.js +29 -27
- package/lib/locales/en.js +43 -5
- package/lib/locales/index.js +4 -2
- package/lib/locales/zh.js +45 -6
- package/lib/lost-passport.js +135 -110
- package/lib/nav-logo.js +63 -39
- package/lib/schema-form/color-input.js +57 -61
- package/lib/schema-form/index.js +104 -80
- package/lib/schema-form/passport-input.js +25 -24
- package/lib/schema-form/text-input.js +12 -7
- package/lib/toast.js +17 -14
- package/lib/util/index.js +2 -1
- package/lib/who-can-access/config.js +52 -0
- package/lib/wrap-locale.js +12 -8
- package/package.json +9 -8
package/lib/lost-passport.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
11
|
|
|
@@ -49,11 +49,11 @@ var _wrapLocale = _interopRequireDefault(require("./wrap-locale"));
|
|
|
49
49
|
|
|
50
50
|
var _usePassportId = _interopRequireDefault(require("./hooks/use-passport-id"));
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
53
53
|
|
|
54
|
-
function
|
|
54
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/* eslint-disable react/no-unstable-nested-components */
|
|
57
57
|
|
|
58
58
|
/* eslint-disable react/jsx-one-expression-per-line */
|
|
59
59
|
// eslint-disable-next-line react/prop-types
|
|
@@ -64,13 +64,13 @@ function ColorStepIcon(_ref) {
|
|
|
64
64
|
completed
|
|
65
65
|
} = _ref;
|
|
66
66
|
const icons = {
|
|
67
|
-
1: /*#__PURE__*/
|
|
67
|
+
1: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewList.default, {
|
|
68
68
|
className: "step-icon"
|
|
69
69
|
}),
|
|
70
|
-
2: /*#__PURE__*/
|
|
70
|
+
2: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GetApp.default, {
|
|
71
71
|
className: "step-icon"
|
|
72
72
|
}),
|
|
73
|
-
3: /*#__PURE__*/
|
|
73
|
+
3: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Done.default, {
|
|
74
74
|
className: "step-icon"
|
|
75
75
|
})
|
|
76
76
|
};
|
|
@@ -84,9 +84,10 @@ function ColorStepIcon(_ref) {
|
|
|
84
84
|
classNames.push('step-icon-w--completed');
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
return /*#__PURE__*/
|
|
88
|
-
className: classNames.join(' ')
|
|
89
|
-
|
|
87
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
88
|
+
className: classNames.join(' '),
|
|
89
|
+
children: icons[String(icon)]
|
|
90
|
+
});
|
|
90
91
|
} // eslint-disable-next-line react/prop-types
|
|
91
92
|
|
|
92
93
|
|
|
@@ -170,7 +171,7 @@ function LostPassport(_ref2) {
|
|
|
170
171
|
label: t('lostPassport.selectPassport'),
|
|
171
172
|
content: () => {
|
|
172
173
|
if (!user) {
|
|
173
|
-
return /*#__PURE__*/
|
|
174
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
174
175
|
popup: true,
|
|
175
176
|
open: true,
|
|
176
177
|
hideCloseButton: true,
|
|
@@ -190,58 +191,70 @@ function LostPassport(_ref2) {
|
|
|
190
191
|
});
|
|
191
192
|
}
|
|
192
193
|
|
|
193
|
-
return /*#__PURE__*/
|
|
194
|
-
className: "select-passport"
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
194
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
195
|
+
className: "select-passport",
|
|
196
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
197
|
+
my: 1,
|
|
198
|
+
display: "flex",
|
|
199
|
+
alignItems: "center",
|
|
200
|
+
className: "user-info",
|
|
201
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
202
|
+
src: user.avatar,
|
|
203
|
+
style: {
|
|
204
|
+
width: 48,
|
|
205
|
+
height: 48,
|
|
206
|
+
backgroundColor: 'transparent',
|
|
207
|
+
marginRight: 16
|
|
208
|
+
}
|
|
209
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
210
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
211
|
+
className: "name",
|
|
212
|
+
children: user.fullName
|
|
213
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
214
|
+
className: "did",
|
|
215
|
+
mt: 1,
|
|
216
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Address.default, {
|
|
217
|
+
children: user.did
|
|
218
|
+
})
|
|
219
|
+
})]
|
|
220
|
+
})]
|
|
221
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
222
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_cardSelector.default, {
|
|
223
|
+
width: 230,
|
|
224
|
+
height: 306,
|
|
225
|
+
cardSpace: 24,
|
|
226
|
+
list: user.passportTypes.map(x => {
|
|
227
|
+
return {
|
|
228
|
+
src: createPassportSvg({
|
|
229
|
+
title: x.title,
|
|
230
|
+
issuer: x.issuer.name,
|
|
231
|
+
issuerDid: x.issuer.id,
|
|
232
|
+
ownerName: user.fullName,
|
|
233
|
+
ownerAvatarUrl: user.avatar,
|
|
234
|
+
isDataUrl: true,
|
|
235
|
+
preferredColor: passportColor || 'auto'
|
|
236
|
+
}),
|
|
237
|
+
name: x.title
|
|
238
|
+
};
|
|
227
239
|
}),
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
}),
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
onSelect: index => handleChange({
|
|
241
|
+
target: {
|
|
242
|
+
value: user.passportTypes[index].name
|
|
243
|
+
}
|
|
244
|
+
}),
|
|
245
|
+
defaultIndex: 0
|
|
246
|
+
})
|
|
247
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
248
|
+
textAlign: "center",
|
|
249
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
250
|
+
variant: "contained",
|
|
251
|
+
color: "primary",
|
|
252
|
+
onClick: () => onSelectPassport(),
|
|
253
|
+
disabled: !passport,
|
|
254
|
+
children: t('common.next')
|
|
255
|
+
})
|
|
256
|
+
})]
|
|
257
|
+
});
|
|
245
258
|
}
|
|
246
259
|
}, {
|
|
247
260
|
label: t('lostPassport.receivePassport'),
|
|
@@ -250,7 +263,7 @@ function LostPassport(_ref2) {
|
|
|
250
263
|
receiverDid: user.did,
|
|
251
264
|
passportName: passport
|
|
252
265
|
};
|
|
253
|
-
return /*#__PURE__*/
|
|
266
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Connect.default, {
|
|
254
267
|
popup: true,
|
|
255
268
|
open: true,
|
|
256
269
|
hideCloseButton: true,
|
|
@@ -272,54 +285,66 @@ function LostPassport(_ref2) {
|
|
|
272
285
|
}
|
|
273
286
|
}, {
|
|
274
287
|
label: t('common.complete'),
|
|
275
|
-
content: () => /*#__PURE__*/
|
|
276
|
-
textAlign: "center"
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
288
|
+
content: () => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
289
|
+
textAlign: "center",
|
|
290
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
291
|
+
mb: 3,
|
|
292
|
+
color: "success.main",
|
|
293
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
|
|
294
|
+
style: {
|
|
295
|
+
fontSize: 60
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Typography.default, {
|
|
299
|
+
component: "p",
|
|
300
|
+
variant: "body1",
|
|
301
|
+
className: "subheader",
|
|
302
|
+
children: t('issuePassport.dialog.success')
|
|
303
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
|
304
|
+
style: {
|
|
305
|
+
marginTop: 40
|
|
306
|
+
},
|
|
307
|
+
variant: "contained",
|
|
308
|
+
color: "primary",
|
|
309
|
+
onClick: onUsePassport,
|
|
310
|
+
children: t('issuePassport.dialog.loginWithPassport')
|
|
311
|
+
})]
|
|
312
|
+
})
|
|
296
313
|
}];
|
|
297
|
-
return /*#__PURE__*/
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
314
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Div, {
|
|
315
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
316
|
+
className: "stepper",
|
|
317
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Stepper.default, {
|
|
318
|
+
className: "stepper-progress",
|
|
319
|
+
alternativeLabel: true,
|
|
320
|
+
activeStep: activeStep,
|
|
321
|
+
children: steps.map(_ref3 => {
|
|
322
|
+
let {
|
|
323
|
+
label
|
|
324
|
+
} = _ref3;
|
|
325
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Step.default, {
|
|
326
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StepLabel.default, {
|
|
327
|
+
StepIconComponent: ColorStepIcon,
|
|
328
|
+
children: label
|
|
329
|
+
})
|
|
330
|
+
}, label);
|
|
331
|
+
})
|
|
332
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
333
|
+
className: "stepper-content",
|
|
334
|
+
children: steps[activeStep].content()
|
|
335
|
+
}), !success && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
336
|
+
textAlign: "center",
|
|
337
|
+
fontSize: 12,
|
|
338
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactRouterDom.Link, {
|
|
339
|
+
to: "/",
|
|
340
|
+
style: {
|
|
341
|
+
color: '#4598FA'
|
|
342
|
+
},
|
|
343
|
+
children: t('lostPassport.return')
|
|
344
|
+
})
|
|
345
|
+
})]
|
|
346
|
+
})
|
|
347
|
+
});
|
|
323
348
|
}
|
|
324
349
|
|
|
325
350
|
const Div = (0, _styledComponents.default)(_Container.default).withConfig({
|
package/lib/nav-logo.js
CHANGED
|
@@ -5,17 +5,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = LogoContainer;
|
|
7
7
|
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
9
|
|
|
12
10
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
11
|
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
|
|
14
14
|
const _excluded = ["logo", "name", "subname", "previousData"],
|
|
15
15
|
_excluded2 = ["logo"];
|
|
16
16
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
|
|
19
|
+
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; }
|
|
20
|
+
|
|
21
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
+
|
|
23
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
24
|
+
|
|
19
25
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
20
26
|
|
|
21
27
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -29,56 +35,72 @@ function LogoContainer(_ref) {
|
|
|
29
35
|
} = _ref,
|
|
30
36
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
31
37
|
|
|
32
|
-
let logoEle = /*#__PURE__*/
|
|
38
|
+
let logoEle = /*#__PURE__*/(0, _jsxRuntime.jsx)(LogoImg, {
|
|
33
39
|
logo: logo
|
|
34
40
|
});
|
|
35
|
-
|
|
36
41
|
let nameEle = name;
|
|
37
42
|
let subnameEle = subname;
|
|
38
43
|
|
|
39
44
|
if (previousData.logo) {
|
|
40
|
-
logoEle = /*#__PURE__*/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
logoEle = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
46
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(LogoImg, {
|
|
47
|
+
logo: logo,
|
|
48
|
+
className: "left-fade-in-ele"
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(LogoImg, {
|
|
50
|
+
logo: previousData.logo,
|
|
51
|
+
className: "postion-abs left-fade-out-ele"
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
if (previousData.name && previousData.name !== name) {
|
|
50
|
-
nameEle = /*#__PURE__*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
nameEle = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
58
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
59
|
+
className: "right-fade-in-ele",
|
|
60
|
+
style: {
|
|
61
|
+
display: 'inline-block'
|
|
62
|
+
},
|
|
63
|
+
children: name
|
|
64
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
65
|
+
className: "postion-abs right-fade-out-ele",
|
|
66
|
+
children: previousData.name
|
|
67
|
+
})]
|
|
68
|
+
});
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
if (previousData.subname && previousData.subname !== subname) {
|
|
61
|
-
subnameEle = /*#__PURE__*/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
subnameEle = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
73
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
74
|
+
className: "right-fade-in-ele",
|
|
75
|
+
style: {
|
|
76
|
+
display: 'inline-block'
|
|
77
|
+
},
|
|
78
|
+
children: subname
|
|
79
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
80
|
+
className: "postion-abs right-fade-out-ele",
|
|
81
|
+
children: previousData.subname
|
|
82
|
+
})]
|
|
83
|
+
});
|
|
69
84
|
}
|
|
70
85
|
|
|
71
|
-
return /*#__PURE__*/
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Container, _objectSpread(_objectSpread({}, rest), {}, {
|
|
87
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
88
|
+
className: "logo-inner",
|
|
89
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
90
|
+
className: "logo-img-content",
|
|
91
|
+
children: logoEle
|
|
92
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
93
|
+
className: "logo-info ".concat(!name && !subname ? 'zero-left' : ''),
|
|
94
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
95
|
+
className: "logo-name",
|
|
96
|
+
children: nameEle
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
98
|
+
className: "logo-subname",
|
|
99
|
+
children: subnameEle
|
|
100
|
+
})]
|
|
101
|
+
})]
|
|
102
|
+
})
|
|
103
|
+
}));
|
|
82
104
|
}
|
|
83
105
|
|
|
84
106
|
LogoContainer.propTypes = {
|
|
@@ -103,7 +125,9 @@ function LogoImg(_ref2) {
|
|
|
103
125
|
} = _ref2,
|
|
104
126
|
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
105
127
|
|
|
106
|
-
return /*#__PURE__*/
|
|
128
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(LogoImgDiv, _objectSpread(_objectSpread({}, rest), {}, {
|
|
129
|
+
children: logo
|
|
130
|
+
}));
|
|
107
131
|
}
|
|
108
132
|
|
|
109
133
|
const LogoImgDiv = _styledComponents.default.div.withConfig({
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = ColorInput;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = require("react");
|
|
9
9
|
|
|
10
10
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
11
11
|
|
|
@@ -13,15 +13,11 @@ var _Popover = _interopRequireDefault(require("@mui/material/Popover"));
|
|
|
13
13
|
|
|
14
14
|
var _reactColor = require("react-color");
|
|
15
15
|
|
|
16
|
-
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
17
|
-
|
|
18
16
|
var _commonPropTypes = _interopRequireDefault(require("./common-prop-types"));
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
19
|
|
|
24
|
-
function
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
21
|
|
|
26
22
|
function ColorInput(_ref) {
|
|
27
23
|
let {
|
|
@@ -29,9 +25,6 @@ function ColorInput(_ref) {
|
|
|
29
25
|
value,
|
|
30
26
|
onChange
|
|
31
27
|
} = _ref;
|
|
32
|
-
const {
|
|
33
|
-
t
|
|
34
|
-
} = (0, _context.useLocaleContext)();
|
|
35
28
|
const [open, setOpen] = (0, _react.useState)(false);
|
|
36
29
|
const colorElm = (0, _react.useRef)();
|
|
37
30
|
const colorValue = (0, _react.useRef)(value); // auto open color picker when editing, should wait the useRef to be ready
|
|
@@ -60,62 +53,65 @@ function ColorInput(_ref) {
|
|
|
60
53
|
onChange(colorValue.current);
|
|
61
54
|
};
|
|
62
55
|
|
|
63
|
-
const ReadView = /*#__PURE__*/
|
|
56
|
+
const ReadView = /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
64
57
|
className: "form-item-input slot",
|
|
65
|
-
px: 1
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
58
|
+
px: 1,
|
|
59
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
60
|
+
display: "flex",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
children: [value, value !== 'auto' && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
63
|
+
style: {
|
|
64
|
+
marginLeft: 4,
|
|
65
|
+
backgroundColor: value,
|
|
66
|
+
width: '1em',
|
|
67
|
+
height: '1em',
|
|
68
|
+
borderRadius: '0.2em'
|
|
69
|
+
}
|
|
70
|
+
})]
|
|
71
|
+
})
|
|
72
|
+
});
|
|
73
|
+
const EditView = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
80
74
|
display: "flex",
|
|
81
75
|
flexGrow: 1,
|
|
82
76
|
alignItems: "center",
|
|
83
77
|
height: "40px",
|
|
84
|
-
onKeyDown: handleEnterKeyDown
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
78
|
+
onKeyDown: handleEnterKeyDown,
|
|
79
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
80
|
+
display: "flex",
|
|
81
|
+
alignItems: "center",
|
|
82
|
+
onClick: () => setOpen(true),
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
84
|
+
ref: colorElm,
|
|
85
|
+
style: {
|
|
86
|
+
flexShrink: 0,
|
|
87
|
+
marginLeft: '8px',
|
|
88
|
+
backgroundColor: value,
|
|
89
|
+
width: '32px',
|
|
90
|
+
height: '32px',
|
|
91
|
+
boxSizing: 'border-box',
|
|
92
|
+
borderRadius: '8px',
|
|
93
|
+
border: '1px solid #eee',
|
|
94
|
+
cursor: value === 'auto' ? 'default' : 'pointer'
|
|
95
|
+
}
|
|
96
|
+
})
|
|
97
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Popover.default, {
|
|
98
|
+
open: open,
|
|
99
|
+
anchorEl: colorElm.current,
|
|
100
|
+
onClose: () => setOpen(false),
|
|
101
|
+
anchorOrigin: {
|
|
102
|
+
vertical: 'bottom',
|
|
103
|
+
horizontal: 'center'
|
|
104
|
+
},
|
|
105
|
+
transformOrigin: {
|
|
106
|
+
vertical: 'top',
|
|
107
|
+
horizontal: 'center'
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactColor.ChromePicker, {
|
|
110
|
+
color: value,
|
|
111
|
+
onChange: c => onColorChange(c.hex)
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
119
115
|
return editing ? EditView : ReadView;
|
|
120
116
|
}
|
|
121
117
|
|