@bchr/bchr-front-lib 0.6.12 → 0.6.14
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.
|
@@ -115,6 +115,8 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
115
115
|
var realValueRef = (0, _react.useRef)(incomingValue);
|
|
116
116
|
var emittedRef = (0, _react.useRef)(incomingValue);
|
|
117
117
|
var editingRef = (0, _react.useRef)(false);
|
|
118
|
+
var decryptedValueRef = (0, _react.useRef)("");
|
|
119
|
+
var hasDecryptedRef = (0, _react.useRef)(false);
|
|
118
120
|
var maskLengthRef = (0, _react.useRef)(resolvedMaskLength);
|
|
119
121
|
var composingRef = (0, _react.useRef)(false);
|
|
120
122
|
var composeBaseDisplayRef = (0, _react.useRef)("");
|
|
@@ -196,6 +198,8 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
196
198
|
emittedRef.current = incomingValue;
|
|
197
199
|
editingRef.current = false;
|
|
198
200
|
realValueRef.current = incomingValue;
|
|
201
|
+
decryptedValueRef.current = "";
|
|
202
|
+
hasDecryptedRef.current = false;
|
|
199
203
|
setRealValue(incomingValue);
|
|
200
204
|
requestSeqRef.current += 1;
|
|
201
205
|
clearHideTimer();
|
|
@@ -219,6 +223,8 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
219
223
|
emittedRef.current = normalized;
|
|
220
224
|
editingRef.current = true;
|
|
221
225
|
realValueRef.current = normalized;
|
|
226
|
+
decryptedValueRef.current = normalized;
|
|
227
|
+
hasDecryptedRef.current = true;
|
|
222
228
|
setCompositionDisplay(null);
|
|
223
229
|
setRealValue(normalized);
|
|
224
230
|
if (flash) {
|
|
@@ -250,17 +256,21 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
250
256
|
resetReveal();
|
|
251
257
|
secret = realValueRef.current;
|
|
252
258
|
if (!(ui_render_type === "modify")) {
|
|
253
|
-
_context.n =
|
|
259
|
+
_context.n = 5;
|
|
254
260
|
break;
|
|
255
261
|
}
|
|
256
262
|
if (secret) {
|
|
257
263
|
_context.n = 3;
|
|
258
264
|
break;
|
|
259
265
|
}
|
|
266
|
+
decryptedValueRef.current = "";
|
|
267
|
+
hasDecryptedRef.current = true;
|
|
260
268
|
showPlainText("", false);
|
|
261
|
-
|
|
262
|
-
inputRef.current.focus
|
|
263
|
-
|
|
269
|
+
setTimeout(function () {
|
|
270
|
+
if (inputRef.current && inputRef.current.focus) {
|
|
271
|
+
inputRef.current.focus();
|
|
272
|
+
}
|
|
273
|
+
}, 0);
|
|
264
274
|
return _context.a(2);
|
|
265
275
|
case 3:
|
|
266
276
|
if (!editingRef.current) {
|
|
@@ -270,75 +280,86 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
270
280
|
showPlainText(secret, false);
|
|
271
281
|
return _context.a(2);
|
|
272
282
|
case 4:
|
|
273
|
-
if (
|
|
283
|
+
if (!hasDecryptedRef.current) {
|
|
274
284
|
_context.n = 5;
|
|
275
285
|
break;
|
|
276
286
|
}
|
|
287
|
+
showPlainText(decryptedValueRef.current, false);
|
|
277
288
|
return _context.a(2);
|
|
278
289
|
case 5:
|
|
279
|
-
if (
|
|
290
|
+
if (secret) {
|
|
280
291
|
_context.n = 6;
|
|
281
292
|
break;
|
|
282
293
|
}
|
|
283
|
-
_antd.message.error("请为组件注入属性【requestUrl】");
|
|
284
294
|
return _context.a(2);
|
|
285
295
|
case 6:
|
|
286
|
-
if (
|
|
296
|
+
if (requestContextPath) {
|
|
287
297
|
_context.n = 7;
|
|
288
298
|
break;
|
|
289
299
|
}
|
|
290
|
-
_antd.message.error("请为组件注入属性【
|
|
300
|
+
_antd.message.error("请为组件注入属性【requestUrl】");
|
|
291
301
|
return _context.a(2);
|
|
292
302
|
case 7:
|
|
303
|
+
if (serviceConfig) {
|
|
304
|
+
_context.n = 8;
|
|
305
|
+
break;
|
|
306
|
+
}
|
|
307
|
+
_antd.message.error("请为组件注入属性【appconfig】");
|
|
308
|
+
return _context.a(2);
|
|
309
|
+
case 8:
|
|
293
310
|
requestSeq = requestSeqRef.current + 1;
|
|
294
311
|
requestSeqRef.current = requestSeq;
|
|
295
312
|
setLoading(true);
|
|
296
|
-
_context.p =
|
|
297
|
-
_context.n =
|
|
313
|
+
_context.p = 9;
|
|
314
|
+
_context.n = 10;
|
|
298
315
|
return new _HttpService["default"](requestContextPath, serviceConfig).post("decrypt", {
|
|
299
316
|
data: secret
|
|
300
317
|
});
|
|
301
|
-
case
|
|
318
|
+
case 10:
|
|
302
319
|
result = _context.v;
|
|
303
320
|
if (!(requestSeq !== requestSeqRef.current)) {
|
|
304
|
-
_context.n =
|
|
321
|
+
_context.n = 11;
|
|
305
322
|
break;
|
|
306
323
|
}
|
|
307
324
|
return _context.a(2);
|
|
308
|
-
case
|
|
325
|
+
case 11:
|
|
309
326
|
if (!(typeof result !== "string")) {
|
|
310
|
-
_context.n =
|
|
327
|
+
_context.n = 12;
|
|
311
328
|
break;
|
|
312
329
|
}
|
|
313
330
|
_antd.message.error("解密失败");
|
|
314
331
|
return _context.a(2);
|
|
315
|
-
case
|
|
332
|
+
case 12:
|
|
333
|
+
if (ui_render_type === "modify") {
|
|
334
|
+
decryptedValueRef.current = result;
|
|
335
|
+
hasDecryptedRef.current = true;
|
|
336
|
+
}
|
|
316
337
|
showPlainText(result, ui_render_type !== "modify");
|
|
317
|
-
_context.n =
|
|
338
|
+
_context.n = 15;
|
|
318
339
|
break;
|
|
319
|
-
case
|
|
320
|
-
_context.p =
|
|
340
|
+
case 13:
|
|
341
|
+
_context.p = 13;
|
|
321
342
|
_t = _context.v;
|
|
322
343
|
if (!(requestSeq !== requestSeqRef.current)) {
|
|
323
|
-
_context.n =
|
|
344
|
+
_context.n = 14;
|
|
324
345
|
break;
|
|
325
346
|
}
|
|
326
347
|
return _context.a(2);
|
|
327
|
-
case
|
|
348
|
+
case 14:
|
|
328
349
|
resetReveal();
|
|
329
350
|
setToggle(false);
|
|
330
351
|
setToggleVal(maskValue(secret, resolvedMaskLength));
|
|
331
352
|
_antd.message.error(getErrorMessage(_t));
|
|
332
|
-
case
|
|
333
|
-
_context.p =
|
|
353
|
+
case 15:
|
|
354
|
+
_context.p = 15;
|
|
334
355
|
if (requestSeq === requestSeqRef.current) {
|
|
335
356
|
setLoading(false);
|
|
336
357
|
}
|
|
337
|
-
return _context.f(
|
|
338
|
-
case
|
|
358
|
+
return _context.f(15);
|
|
359
|
+
case 16:
|
|
339
360
|
return _context.a(2);
|
|
340
361
|
}
|
|
341
|
-
}, _callee, null, [[
|
|
362
|
+
}, _callee, null, [[9, 13, 15, 16]]);
|
|
342
363
|
}));
|
|
343
364
|
return function onToggleFull() {
|
|
344
365
|
return _ref.apply(this, arguments);
|
|
@@ -432,15 +453,22 @@ var InputPasswordDecrypt = function InputPasswordDecrypt(props) {
|
|
|
432
453
|
} else {
|
|
433
454
|
modifyDisplay = maskValue(realValue, resolvedMaskLength);
|
|
434
455
|
}
|
|
435
|
-
return /*#__PURE__*/_react["default"].createElement(_antd.Input, _extends({}, restInputProps,
|
|
456
|
+
return /*#__PURE__*/_react["default"].createElement(_antd.Input, _extends({}, restInputProps, {
|
|
436
457
|
ref: inputRef,
|
|
437
|
-
className: className,
|
|
438
458
|
style: style,
|
|
439
459
|
value: modifyDisplay,
|
|
440
460
|
placeholder: placeholder,
|
|
441
461
|
disabled: !toggle || disabled,
|
|
442
|
-
allowClear: allowClear && toggle
|
|
443
|
-
|
|
462
|
+
allowClear: allowClear && toggle,
|
|
463
|
+
className: [className, MODIFY_INPUT_CLASS].filter(Boolean).join(" "),
|
|
464
|
+
maxLength: toggle && typeof maxLength === "number" ? maxLength : undefined,
|
|
465
|
+
onChange: onModifyChange,
|
|
466
|
+
onKeyDown: onModifyKeyDown,
|
|
467
|
+
onPaste: onModifyPaste,
|
|
468
|
+
onCompositionStart: onCompositionStart,
|
|
469
|
+
onCompositionEnd: onCompositionEnd,
|
|
470
|
+
suffix: renderToggleIcon()
|
|
471
|
+
}));
|
|
444
472
|
}
|
|
445
473
|
return /*#__PURE__*/_react["default"].createElement(_react.Fragment, null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
446
474
|
className: className,
|
package/package.json
CHANGED
|
@@ -79,6 +79,8 @@ const InputPasswordDecrypt = (props) => {
|
|
|
79
79
|
const realValueRef = useRef(incomingValue);
|
|
80
80
|
const emittedRef = useRef(incomingValue);
|
|
81
81
|
const editingRef = useRef(false);
|
|
82
|
+
const decryptedValueRef = useRef("");
|
|
83
|
+
const hasDecryptedRef = useRef(false);
|
|
82
84
|
const maskLengthRef = useRef(resolvedMaskLength);
|
|
83
85
|
const composingRef = useRef(false);
|
|
84
86
|
const composeBaseDisplayRef = useRef("");
|
|
@@ -167,6 +169,8 @@ const InputPasswordDecrypt = (props) => {
|
|
|
167
169
|
emittedRef.current = incomingValue;
|
|
168
170
|
editingRef.current = false;
|
|
169
171
|
realValueRef.current = incomingValue;
|
|
172
|
+
decryptedValueRef.current = "";
|
|
173
|
+
hasDecryptedRef.current = false;
|
|
170
174
|
setRealValue(incomingValue);
|
|
171
175
|
requestSeqRef.current += 1;
|
|
172
176
|
clearHideTimer();
|
|
@@ -188,6 +192,8 @@ const InputPasswordDecrypt = (props) => {
|
|
|
188
192
|
emittedRef.current = normalized;
|
|
189
193
|
editingRef.current = true;
|
|
190
194
|
realValueRef.current = normalized;
|
|
195
|
+
decryptedValueRef.current = normalized;
|
|
196
|
+
hasDecryptedRef.current = true;
|
|
191
197
|
setCompositionDisplay(null);
|
|
192
198
|
setRealValue(normalized);
|
|
193
199
|
if (flash) {
|
|
@@ -211,16 +217,24 @@ const InputPasswordDecrypt = (props) => {
|
|
|
211
217
|
const secret = realValueRef.current;
|
|
212
218
|
if (ui_render_type === "modify") {
|
|
213
219
|
if (!secret) {
|
|
220
|
+
decryptedValueRef.current = "";
|
|
221
|
+
hasDecryptedRef.current = true;
|
|
214
222
|
showPlainText("", false);
|
|
215
|
-
|
|
216
|
-
inputRef.current.focus
|
|
217
|
-
|
|
223
|
+
setTimeout(() => {
|
|
224
|
+
if (inputRef.current && inputRef.current.focus) {
|
|
225
|
+
inputRef.current.focus();
|
|
226
|
+
}
|
|
227
|
+
}, 0);
|
|
218
228
|
return;
|
|
219
229
|
}
|
|
220
230
|
if (editingRef.current) {
|
|
221
231
|
showPlainText(secret, false);
|
|
222
232
|
return;
|
|
223
233
|
}
|
|
234
|
+
if (hasDecryptedRef.current) {
|
|
235
|
+
showPlainText(decryptedValueRef.current, false);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
224
238
|
}
|
|
225
239
|
if (!secret) {
|
|
226
240
|
return;
|
|
@@ -246,6 +260,10 @@ const InputPasswordDecrypt = (props) => {
|
|
|
246
260
|
message.error("解密失败");
|
|
247
261
|
return;
|
|
248
262
|
}
|
|
263
|
+
if (ui_render_type === "modify") {
|
|
264
|
+
decryptedValueRef.current = result;
|
|
265
|
+
hasDecryptedRef.current = true;
|
|
266
|
+
}
|
|
249
267
|
showPlainText(result, ui_render_type !== "modify");
|
|
250
268
|
} catch (error) {
|
|
251
269
|
if (requestSeq !== requestSeqRef.current) {
|
|
@@ -358,7 +376,6 @@ const InputPasswordDecrypt = (props) => {
|
|
|
358
376
|
<Input
|
|
359
377
|
{...restInputProps}
|
|
360
378
|
ref={inputRef}
|
|
361
|
-
className={className}
|
|
362
379
|
style={style}
|
|
363
380
|
value={modifyDisplay}
|
|
364
381
|
placeholder={placeholder}
|