ebaoferc 2.0.8 → 2.0.9-beta.1

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.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +43 -43
  3. package/dist/components/BlockHeader/style.less +52 -52
  4. package/dist/components/ImageViewTrigger/index.less +25 -25
  5. package/dist/components/MaskInput/index.d.ts +16 -0
  6. package/dist/components/MaskInput/index.js +130 -0
  7. package/dist/components/MaskInput/style.module.less +4 -0
  8. package/dist/components/MaskTxt/index.d.ts +16 -0
  9. package/dist/components/MaskTxt/index.js +123 -0
  10. package/dist/components/MaskTxt/style.module.less +11 -0
  11. package/dist/components/MindGraph/core/graphic/drag.js +15 -15
  12. package/dist/components/MindGraph/core/graphic/index.js +105 -105
  13. package/dist/components/MindGraph/core/helper/depth-first-walk-tree.js +4 -4
  14. package/dist/components/MindGraph/core/helper/descendant.js +3 -3
  15. package/dist/components/MindGraph/core/helper/get-layout-calc-children.js +6 -6
  16. package/dist/components/MindGraph/core/helper/index.d.ts +15 -15
  17. package/dist/components/MindGraph/core/helper/judge-if-all-child-fold.js +4 -4
  18. package/dist/components/MindGraph/core/helper/judge-if-heir-and-fold.js +6 -6
  19. package/dist/components/MindGraph/core/helper/judge-if-visual-leaf.js +3 -3
  20. package/dist/components/MindGraph/core/index.d.ts +6 -2
  21. package/dist/components/MindGraph/core/index.js +26 -26
  22. package/dist/components/MindGraph/core/process/layout/structured/get-node-cross-boundary.js +7 -7
  23. package/dist/components/MindGraph/core/process/layout/type.js +20 -20
  24. package/dist/components/MindGraph/core/process/visible.js +3 -3
  25. package/dist/components/MindGraph/core/render/index.d.ts +12 -12
  26. package/dist/components/MindGraph/react/component/index.module.less +71 -71
  27. package/dist/components/MindGraph/react/hook/use-shadow-state.d.ts +1 -1
  28. package/dist/components/MindGraph/react/scrollbar/axis/index.module.less +47 -47
  29. package/dist/components/QueryProCard/index.less +9 -9
  30. package/dist/components/SectionTitleBar/index.less +31 -31
  31. package/dist/components/SliderVerify/style.module.less +119 -119
  32. package/dist/components/StyledModalForm/index.d.ts +1 -1
  33. package/dist/components/StyledModalForm/index.less +51 -51
  34. package/dist/components/StyledQueryFilter/index.js +11 -9
  35. package/dist/components/StyledQueryFilter/index.less +26 -26
  36. package/dist/components/StyledTable/index.less +18 -18
  37. package/dist/components/ThemeStatusTag/index.less +11 -11
  38. package/dist/components/index.d.ts +3 -0
  39. package/dist/components/index.js +2 -0
  40. package/dist/hooks/usePathname/index.js +2 -2
  41. package/dist/typings.d.ts +20 -20
  42. package/dist/utils/format/index.js +14 -14
  43. package/package.json +102 -102
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,43 +1,43 @@
1
- # ebaoferc
2
-
3
- [![NPM version](https://img.shields.io/npm/v/ebaoferc.svg?style=flat)](https://npmjs.org/package/ebaoferc)
4
- [![NPM downloads](http://img.shields.io/npm/dm/ebaoferc.svg?style=flat)](https://npmjs.org/package/ebaoferc)
5
-
6
- A react library developed with dumi
7
-
8
- ## Usage
9
-
10
- TODO
11
-
12
- ## Options
13
-
14
- TODO
15
-
16
- ## Development
17
-
18
- ```bash
19
- # install dependencies
20
- $ pnpm install
21
-
22
- # develop library by docs demo
23
- $ pnpm start
24
-
25
- # build library source code
26
- $ pnpm run build
27
-
28
- # build library source code in watch mode
29
- $ pnpm run build:watch
30
-
31
- # build docs
32
- $ pnpm run docs:build
33
-
34
- # Locally preview the production build.
35
- $ pnpm run docs:preview
36
-
37
- # check your project for potential problems
38
- $ pnpm run doctor
39
- ```
40
-
41
- ## LICENSE
42
-
43
- MIT
1
+ # ebaoferc
2
+
3
+ [![NPM version](https://img.shields.io/npm/v/ebaoferc.svg?style=flat)](https://npmjs.org/package/ebaoferc)
4
+ [![NPM downloads](http://img.shields.io/npm/dm/ebaoferc.svg?style=flat)](https://npmjs.org/package/ebaoferc)
5
+
6
+ A react library developed with dumi
7
+
8
+ ## Usage
9
+
10
+ TODO
11
+
12
+ ## Options
13
+
14
+ TODO
15
+
16
+ ## Development
17
+
18
+ ```bash
19
+ # install dependencies
20
+ $ pnpm install
21
+
22
+ # develop library by docs demo
23
+ $ pnpm start
24
+
25
+ # build library source code
26
+ $ pnpm run build
27
+
28
+ # build library source code in watch mode
29
+ $ pnpm run build:watch
30
+
31
+ # build docs
32
+ $ pnpm run docs:build
33
+
34
+ # Locally preview the production build.
35
+ $ pnpm run docs:preview
36
+
37
+ # check your project for potential problems
38
+ $ pnpm run doctor
39
+ ```
40
+
41
+ ## LICENSE
42
+
43
+ MIT
@@ -1,52 +1,52 @@
1
- .blockHeader {
2
- &.blockHeaderClose {
3
- margin-bottom: 20px;
4
- }
5
-
6
- .title {
7
- display: flex;
8
- align-items: center;
9
- padding-bottom: 10px;
10
- border-bottom: 1px solid #e6e6e6;
11
- }
12
-
13
- .titleInner {
14
- display: flex;
15
- align-content: center;
16
- justify-content: space-between;
17
- width: 100%;
18
- }
19
-
20
- .titleWithTag {
21
- display: flex;
22
- align-items: center;
23
- }
24
-
25
- .titleText {
26
- color: #000;
27
- font-weight: bold;
28
- font-size: 14px;
29
- }
30
-
31
- .tagContainer {
32
- margin-left: 5px;
33
- }
34
-
35
- .iconContainer {
36
- display: flex;
37
- align-items: center;
38
- cursor: pointer;
39
-
40
- img {
41
- width: 24px;
42
- }
43
- }
44
-
45
- .content {
46
- padding: 20px 0 0;
47
- }
48
-
49
- .contentCollapsed {
50
- display: none;
51
- }
52
- }
1
+ .blockHeader {
2
+ &.blockHeaderClose {
3
+ margin-bottom: 20px;
4
+ }
5
+
6
+ .title {
7
+ display: flex;
8
+ align-items: center;
9
+ padding-bottom: 10px;
10
+ border-bottom: 1px solid #e6e6e6;
11
+ }
12
+
13
+ .titleInner {
14
+ display: flex;
15
+ align-content: center;
16
+ justify-content: space-between;
17
+ width: 100%;
18
+ }
19
+
20
+ .titleWithTag {
21
+ display: flex;
22
+ align-items: center;
23
+ }
24
+
25
+ .titleText {
26
+ color: #000;
27
+ font-weight: bold;
28
+ font-size: 14px;
29
+ }
30
+
31
+ .tagContainer {
32
+ margin-left: 5px;
33
+ }
34
+
35
+ .iconContainer {
36
+ display: flex;
37
+ align-items: center;
38
+ cursor: pointer;
39
+
40
+ img {
41
+ width: 24px;
42
+ }
43
+ }
44
+
45
+ .content {
46
+ padding: 20px 0 0;
47
+ }
48
+
49
+ .contentCollapsed {
50
+ display: none;
51
+ }
52
+ }
@@ -1,25 +1,25 @@
1
- .thumbnail-mode-trigger {
2
- position: relative;
3
- display: inline-block;
4
-
5
- .thumbnail-mask {
6
- position: absolute;
7
- z-index: 1;
8
- inset: 0;
9
- display: flex;
10
- gap: 4px;
11
- align-items: center;
12
- justify-content: center;
13
- color: #fff;
14
- background: rgba(0, 0, 0, 50%);
15
- cursor: pointer;
16
- opacity: 0;
17
- transition: opacity 0.3s;
18
- }
19
-
20
- &:hover {
21
- .thumbnail-mask {
22
- opacity: 1;
23
- }
24
- }
25
- }
1
+ .thumbnail-mode-trigger {
2
+ position: relative;
3
+ display: inline-block;
4
+
5
+ .thumbnail-mask {
6
+ position: absolute;
7
+ z-index: 1;
8
+ inset: 0;
9
+ display: flex;
10
+ gap: 4px;
11
+ align-items: center;
12
+ justify-content: center;
13
+ color: #fff;
14
+ background: rgba(0, 0, 0, 50%);
15
+ cursor: pointer;
16
+ opacity: 0;
17
+ transition: opacity 0.3s;
18
+ }
19
+
20
+ &:hover {
21
+ .thumbnail-mask {
22
+ opacity: 1;
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,16 @@
1
+ import { ProFormText } from '@ant-design/pro-components';
2
+ import { GetProps } from 'antd';
3
+ export type ProFormMaskInputProps = {
4
+ /**
5
+ * 脱敏标识 ID。提供时,输入框进入"已脱敏"态:
6
+ * 禁用编辑、显示脱敏值、眼睛图标可见。
7
+ */
8
+ maskId?: string;
9
+ /**
10
+ * 点击眼睛图标后的异步回调。接收 maskId,返回解密后的明文。
11
+ * 由调用方负责 API 调用和解密逻辑,组件只关心"拿到明文"这个结果。
12
+ * 缺省时点击眼睛仅解除禁用,不拉取数据。
13
+ */
14
+ onReveal?: (maskId: string) => Promise<string>;
15
+ } & GetProps<typeof ProFormText>;
16
+ export declare const ProFormMaskInput: (props: ProFormMaskInputProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,130 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ var _excluded = ["maskId", "fieldProps", "rules", "onReveal"];
3
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
9
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
10
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
11
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
14
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
17
+ 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; }
18
+ 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; }
19
+ import { EyeInvisibleOutlined } from '@ant-design/icons';
20
+ import { ProFormText } from '@ant-design/pro-components';
21
+ import { ConfigProvider, Form, message } from 'antd';
22
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
23
+ import style from "./style.module.less";
24
+ import { jsx as _jsx } from "react/jsx-runtime";
25
+ export var ProFormMaskInput = function ProFormMaskInput(props) {
26
+ var maskId = props.maskId,
27
+ fieldProps = props.fieldProps,
28
+ rules = props.rules,
29
+ onReveal = props.onReveal,
30
+ rest = _objectWithoutProperties(props, _excluded);
31
+ var formInstance = Form.useFormInstance();
32
+
33
+ // Form 的 disabled
34
+ var _ConfigProvider$useCo = ConfigProvider.useConfig(),
35
+ componentDisabled = _ConfigProvider$useCo.componentDisabled;
36
+ // 小眼睛 disabled(maskId 存在时默认脱敏态,输入框禁用)
37
+ var _useState = useState(!!maskId),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ masked = _useState2[0],
40
+ setMasked = _useState2[1];
41
+ // 组合 disabled
42
+ var composeDisabled = useMemo(function () {
43
+ return componentDisabled || masked || rest.disabled;
44
+ }, [componentDisabled, masked, rest]);
45
+ useEffect(function () {
46
+ setMasked(!!maskId);
47
+ }, [maskId]);
48
+
49
+ // 防止切换记录时旧请求回写覆盖新数据
50
+ var idRef = useRef(maskId);
51
+ idRef.current = maskId;
52
+ var handleView = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
53
+ var currentValue, reqId, plaintext;
54
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
55
+ while (1) switch (_context.prev = _context.next) {
56
+ case 0:
57
+ if (!(masked && maskId)) {
58
+ _context.next = 25;
59
+ break;
60
+ }
61
+ currentValue = formInstance.getFieldValue(rest.name); // 字段值已被外部清空时,仅解除禁用,不拉取旧数据回填
62
+ if (!currentValue) {
63
+ _context.next = 24;
64
+ break;
65
+ }
66
+ reqId = maskId;
67
+ _context.prev = 4;
68
+ if (!onReveal) {
69
+ _context.next = 11;
70
+ break;
71
+ }
72
+ _context.next = 8;
73
+ return onReveal(reqId);
74
+ case 8:
75
+ _context.t0 = _context.sent;
76
+ _context.next = 12;
77
+ break;
78
+ case 11:
79
+ _context.t0 = currentValue;
80
+ case 12:
81
+ plaintext = _context.t0;
82
+ if (!(idRef.current !== reqId)) {
83
+ _context.next = 15;
84
+ break;
85
+ }
86
+ return _context.abrupt("return");
87
+ case 15:
88
+ formInstance.setFieldValue(rest.name, plaintext);
89
+ _context.next = 24;
90
+ break;
91
+ case 18:
92
+ _context.prev = 18;
93
+ _context.t1 = _context["catch"](4);
94
+ if (!(idRef.current !== reqId)) {
95
+ _context.next = 22;
96
+ break;
97
+ }
98
+ return _context.abrupt("return");
99
+ case 22:
100
+ message.error('数据加载失败,请稍后重试');
101
+ return _context.abrupt("return");
102
+ case 24:
103
+ setMasked(false);
104
+ case 25:
105
+ case "end":
106
+ return _context.stop();
107
+ }
108
+ }, _callee, null, [[4, 18]]);
109
+ })), [masked, maskId, onReveal, formInstance, rest.name]);
110
+
111
+ // 脱敏状态下字段值为脱敏数据(如 1101**********1234),无法通过格式校验,
112
+ // 因此只保留 required 必填规则,格式校验(IdRule、PhoneRule 等)在点击小眼睛后才生效
113
+ var _rules = masked ? (rules !== null && rules !== void 0 ? rules : []).filter(function (r) {
114
+ return r.required;
115
+ }) : rules;
116
+ var suffix = useMemo(function () {
117
+ return composeDisabled && maskId ? /*#__PURE__*/_jsx(EyeInvisibleOutlined, {
118
+ className: style.icon,
119
+ onClick: handleView
120
+ }) : undefined;
121
+ }, [composeDisabled, handleView, maskId]);
122
+ return /*#__PURE__*/_jsx(ProFormText, _objectSpread(_objectSpread({
123
+ fieldProps: _objectSpread({
124
+ suffix: suffix
125
+ }, fieldProps),
126
+ rules: _rules
127
+ }, rest), {}, {
128
+ disabled: composeDisabled
129
+ }));
130
+ };
@@ -0,0 +1,4 @@
1
+ .icon {
2
+ cursor: pointer;
3
+ color: #1890ff;
4
+ }
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ export type TMaskTxtProps = {
3
+ /** 脱敏态下展示的文本,由调用方直接提供(无需组件解密) */
4
+ sourceTxt: string;
5
+ /** 脱敏标识 ID,作为 onReveal 的入参 */
6
+ maskId: string;
7
+ /**
8
+ * 点击眼睛图标后的异步回调。接收 maskId,返回解密后的明文。
9
+ * 由调用方负责 API 调用和解密逻辑。
10
+ * 缺省时点击眼睛仅切换显示状态,数据需由外部准备好。
11
+ */
12
+ onReveal?: (maskId: string) => Promise<string>;
13
+ };
14
+ export type TMaskTxtRef = Record<string, never>;
15
+ declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<TMaskTxtProps & import("react").RefAttributes<TMaskTxtRef>>>;
16
+ export default _default;
@@ -0,0 +1,123 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
10
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
+ import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';
12
+ import { EyeInvisibleOutlined, EyeOutlined, LoadingOutlined } from '@ant-design/icons';
13
+ import { message } from 'antd';
14
+ import styles from "./style.module.less";
15
+
16
+ // An explicit empty object type for the ref (no properties expected)
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ var MaskTxt = function MaskTxt(props, ref) {
20
+ var sourceTxt = props.sourceTxt,
21
+ maskId = props.maskId,
22
+ onReveal = props.onReveal;
23
+ var _useState = useState(true),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ isMask = _useState2[0],
26
+ setIsMask = _useState2[1];
27
+ var _useState3 = useState(false),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ loading = _useState4[0],
30
+ setLoading = _useState4[1];
31
+ var _useState5 = useState(''),
32
+ _useState6 = _slicedToArray(_useState5, 2),
33
+ revealedTxt = _useState6[0],
34
+ setRevealedTxt = _useState6[1];
35
+
36
+ // 防止切换数据源时旧请求回写覆盖新数据
37
+ var idRef = useRef(maskId);
38
+ idRef.current = maskId;
39
+ var handleView = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
40
+ var reqId, plaintext;
41
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
42
+ while (1) switch (_context.prev = _context.next) {
43
+ case 0:
44
+ if (!(isMask && maskId)) {
45
+ _context.next = 23;
46
+ break;
47
+ }
48
+ reqId = maskId;
49
+ if (!onReveal) {
50
+ _context.next = 22;
51
+ break;
52
+ }
53
+ setLoading(true);
54
+ _context.prev = 4;
55
+ _context.next = 7;
56
+ return onReveal(reqId);
57
+ case 7:
58
+ plaintext = _context.sent;
59
+ if (!(idRef.current !== reqId)) {
60
+ _context.next = 10;
61
+ break;
62
+ }
63
+ return _context.abrupt("return");
64
+ case 10:
65
+ setRevealedTxt(plaintext);
66
+ _context.next = 19;
67
+ break;
68
+ case 13:
69
+ _context.prev = 13;
70
+ _context.t0 = _context["catch"](4);
71
+ if (!(idRef.current !== reqId)) {
72
+ _context.next = 17;
73
+ break;
74
+ }
75
+ return _context.abrupt("return");
76
+ case 17:
77
+ message.error('数据加载失败,请稍后重试');
78
+ return _context.abrupt("return");
79
+ case 19:
80
+ _context.prev = 19;
81
+ setLoading(false);
82
+ return _context.finish(19);
83
+ case 22:
84
+ setIsMask(false);
85
+ case 23:
86
+ case "end":
87
+ return _context.stop();
88
+ }
89
+ }, _callee, null, [[4, 13, 19, 22]]);
90
+ })), [isMask, maskId, onReveal]);
91
+
92
+ /**
93
+ * 侦听数据源,重置 mask 状态,防止展示上一次的调用结果
94
+ */
95
+ useEffect(function () {
96
+ setIsMask(true);
97
+ setRevealedTxt('');
98
+ }, [sourceTxt, maskId]);
99
+ useImperativeHandle(ref, function () {
100
+ return {};
101
+ });
102
+ var showIcon = function showIcon() {
103
+ if (loading) return /*#__PURE__*/_jsx(LoadingOutlined, {});
104
+ return isMask ? /*#__PURE__*/_jsx(EyeInvisibleOutlined, {
105
+ className: styles.icon,
106
+ onClick: handleView
107
+ }) : /*#__PURE__*/_jsx(EyeOutlined, {
108
+ className: styles.icon,
109
+ onClick: function onClick() {
110
+ return setIsMask(true);
111
+ }
112
+ });
113
+ };
114
+ if (!sourceTxt) return '-';
115
+ return /*#__PURE__*/_jsxs("div", {
116
+ className: styles['mask-txt-wrapper'],
117
+ children: [/*#__PURE__*/_jsx("span", {
118
+ className: "mask-txt",
119
+ children: isMask ? sourceTxt : revealedTxt
120
+ }), showIcon()]
121
+ });
122
+ };
123
+ export default /*#__PURE__*/memo( /*#__PURE__*/forwardRef(MaskTxt));
@@ -0,0 +1,11 @@
1
+ .mask-txt-wrapper {
2
+ display: flex;
3
+ align-items: center;
4
+ gap: 8px;
5
+ // .mask-txt{}
6
+ }
7
+
8
+ .icon {
9
+ cursor: pointer;
10
+ color: #1890ff;
11
+ }