@tntd/reference 1.1.0 → 1.1.2

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 (56) hide show
  1. package/.octopus/ar-EG/referenceinfo.d.ts +1 -0
  2. package/.octopus/ar-EG/referenceinfo.js +1 -0
  3. package/.octopus/en-US/referenceinfo.d.ts +1 -0
  4. package/.octopus/en-US/referenceinfo.js +1 -0
  5. package/.octopus/es-ES/referenceinfo.d.ts +1 -0
  6. package/.octopus/es-ES/referenceinfo.js +1 -0
  7. package/.octopus/ko-KR/referenceinfo.d.ts +1 -0
  8. package/.octopus/ko-KR/referenceinfo.js +1 -0
  9. package/.octopus/th-TH/referenceinfo.d.ts +1 -0
  10. package/.octopus/th-TH/referenceinfo.js +1 -0
  11. package/.octopus/zh-CN/referenceinfo.d.ts +1 -0
  12. package/.octopus/zh-CN/referenceinfo.js +1 -0
  13. package/.octopus/zh-TW/referenceinfo.d.ts +1 -0
  14. package/.octopus/zh-TW/referenceinfo.js +1 -0
  15. package/es/AHref/index.js +19 -0
  16. package/es/ReferenceBatchCheck/ReferenceBatchCheck.js +5 -3
  17. package/es/ReferenceDrawer/index.js +10 -2
  18. package/es/ReferenceInfo/index.js +3 -0
  19. package/lib/AHref/index.d.ts.map +1 -1
  20. package/lib/AHref/index.js +85 -50
  21. package/lib/AHref/index.js.map +1 -1
  22. package/lib/I18N.d.ts +8 -0
  23. package/lib/I18N.d.ts.map +1 -1
  24. package/lib/I18N.js +59 -37
  25. package/lib/ReferenceBatchCheck/ReferenceBatchCheck.d.ts +1 -0
  26. package/lib/ReferenceBatchCheck/ReferenceBatchCheck.js +176 -69
  27. package/lib/ReferenceBatchCheck/ReferenceBatchCheck.js.map +1 -1
  28. package/lib/ReferenceBatchCheck/index.js +114 -83
  29. package/lib/ReferenceBatchDrawer/index.d.ts +1 -0
  30. package/lib/ReferenceBatchDrawer/index.js +160 -78
  31. package/lib/ReferenceCheck/ReferenceCheck.d.ts +1 -0
  32. package/lib/ReferenceCheck/ReferenceCheck.js +128 -53
  33. package/lib/ReferenceCheck/index.js +109 -76
  34. package/lib/ReferenceConfigProvider.d.ts +12 -0
  35. package/lib/ReferenceConfigProvider.d.ts.map +1 -0
  36. package/lib/ReferenceConfigProvider.js +121 -0
  37. package/lib/ReferenceConfigProvider.js.map +1 -0
  38. package/lib/ReferenceDrawer/index.d.ts +1 -0
  39. package/lib/ReferenceDrawer/index.js +134 -66
  40. package/lib/ReferenceDrawer/index.js.map +1 -1
  41. package/lib/ReferenceInfo/index.d.ts +1 -0
  42. package/lib/ReferenceInfo/index.js +187 -87
  43. package/lib/ReferenceInfo/index.js.map +1 -1
  44. package/lib/index.js +50 -17
  45. package/lib/locale/ar_EG.js +14 -9
  46. package/lib/locale/en_US.js +14 -9
  47. package/lib/locale/es_ES.js +14 -9
  48. package/lib/locale/ko_KR.js +14 -9
  49. package/lib/locale/th_TH.js +14 -9
  50. package/lib/locale/zh_CN.js +14 -9
  51. package/lib/locale/zh_TW.js +14 -9
  52. package/package.json +1 -1
  53. package/src/AHref/index.js +12 -1
  54. package/src/ReferenceBatchCheck/ReferenceBatchCheck.js +6 -4
  55. package/src/ReferenceDrawer/index.js +38 -26
  56. package/src/ReferenceInfo/index.js +2 -1
@@ -0,0 +1,12 @@
1
+ export function ReferenceConfigProvider({ children, locale }: {
2
+ children: any;
3
+ locale: any;
4
+ }): React.JSX.Element;
5
+ export function useReferenceConfig(): null;
6
+ export function useI18N(): any;
7
+ export function configReference(config: {
8
+ locale: Object | Function;
9
+ }): void;
10
+ export default ReferenceConfigProvider;
11
+ import React from "react";
12
+ //# sourceMappingURL=ReferenceConfigProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReferenceConfigProvider.d.ts","sourceRoot":"","sources":["../src/ReferenceConfigProvider.js"],"names":[],"mappings":"AAUO;;;sBAYN;AAKM,2CAEN;AAMM,+BAMN;AAqCM;IAhC4B,MAAM,EAA9B,MAAM,WAAS;SAwCzB"}
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+
3
+ function _typeof(o) {
4
+ "@babel/helpers - typeof";
5
+
6
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
7
+ return typeof o;
8
+ } : function (o) {
9
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
10
+ }, _typeof(o);
11
+ }
12
+ Object.defineProperty(exports, "__esModule", {
13
+ value: true
14
+ });
15
+ exports.useReferenceConfig = exports.useI18N = exports["default"] = exports.configReference = exports.ReferenceConfigProvider = void 0;
16
+ var _react = _interopRequireWildcard(require("react"));
17
+ var _I18N = require("./I18N");
18
+ function _getRequireWildcardCache(e) {
19
+ if ("function" != typeof WeakMap) return null;
20
+ var r = new WeakMap(),
21
+ t = new WeakMap();
22
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
23
+ return e ? t : r;
24
+ })(e);
25
+ }
26
+ function _interopRequireWildcard(e, r) {
27
+ if (!r && e && e.__esModule) return e;
28
+ if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
29
+ "default": e
30
+ };
31
+ var t = _getRequireWildcardCache(r);
32
+ if (t && t.has(e)) return t.get(e);
33
+ var n = {
34
+ __proto__: null
35
+ },
36
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
37
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
38
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
39
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
40
+ }
41
+ return n["default"] = e, t && t.set(e, n), n;
42
+ }
43
+ // 创建 Context
44
+ var ReferenceConfigContext = (0, _react.createContext)(null);
45
+ /**
46
+ * Reference 全局配置 Provider
47
+ * 用于在应用入口处统一配置国际化等全局配置
48
+ */
49
+ var ReferenceConfigProvider = exports.ReferenceConfigProvider = function ReferenceConfigProvider(_ref) {
50
+ var children = _ref.children,
51
+ locale = _ref.locale;
52
+ var config = (0, _react.useMemo)(function () {
53
+ return {
54
+ locale: locale
55
+ };
56
+ }, [locale]);
57
+ return _react["default"].createElement(ReferenceConfigContext.Provider, {
58
+ value: config
59
+ }, children);
60
+ };
61
+ /**
62
+ * 获取 Reference 全局配置的 Hook
63
+ */
64
+ var useReferenceConfig = exports.useReferenceConfig = function useReferenceConfig() {
65
+ return (0, _react.useContext)(ReferenceConfigContext);
66
+ };
67
+ /**
68
+ * 获取国际化实例的 Hook
69
+ * 优先使用 Context 中的配置,其次使用全局配置,最后使用默认配置
70
+ */
71
+ var useI18N = exports.useI18N = function useI18N() {
72
+ var config = useReferenceConfig();
73
+ return (0, _react.useMemo)(function () {
74
+ return (0, _I18N.createI18N)(config === null || config === void 0 ? void 0 : config.locale);
75
+ }, [config]);
76
+ };
77
+ /**
78
+ * 全局配置方法(不使用 Provider 的情况下)
79
+ * @param {Object} config - 配置对象
80
+ * @param {Object|Function} config.locale - 自定义国际化配置
81
+ *
82
+ * @example
83
+ * // 在应用入口调用
84
+ * import { configReference } from '@tntd/reference';
85
+ *
86
+ * configReference({
87
+ * locale: {
88
+ * cn: {
89
+ * referencedrawer: {
90
+ * index: {
91
+ * chaXunYinYongGuan: '自定义文案'
92
+ * }
93
+ * }
94
+ * }
95
+ * }
96
+ * });
97
+ *
98
+ * // 或者使用函数形式,可以访问默认语言包
99
+ * configReference({
100
+ * locale: (defaultLocale) => ({
101
+ * cn: {
102
+ * ...defaultLocale.cn,
103
+ * referencedrawer: {
104
+ * index: {
105
+ * chaXunYinYongGuan: '自定义文案'
106
+ * }
107
+ * }
108
+ * }
109
+ * })
110
+ * });
111
+ */
112
+ var configReference = exports.configReference = function configReference(config) {
113
+ if (config.locale) {
114
+ if (typeof window !== 'undefined') {
115
+ window.__REFERENCE_LOCALE__ = config.locale;
116
+ } else if (typeof global !== 'undefined') {
117
+ global.__REFERENCE_LOCALE__ = config.locale;
118
+ }
119
+ }
120
+ };
121
+ var _default = exports["default"] = Reference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jB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,MAAM,CAAC,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;SAC7C;aAAM,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACxC,MAAM,CAAC,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;SAC7C;KACF;AACH,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAEF,kBAAe,+BAAuB,CAAC","sourcesContent":["import React, { createContext, useContext, useMemo } from 'react';\nimport { createI18N, getLang } from './I18N';\n\n// 创建 Context\nconst ReferenceConfigContext = createContext(null);\n\n/**\n * Reference 全局配置 Provider\n * 用于在应用入口处统一配置国际化等全局配置\n */\nexport const ReferenceConfigProvider = ({ children, locale }) => {\n const config = useMemo(() => {\n return {\n locale,\n };\n }, [locale]);\n\n return (\n <ReferenceConfigContext.Provider value={config}>\n {children}\n </ReferenceConfigContext.Provider>\n );\n};\n\n/**\n * 获取 Reference 全局配置的 Hook\n */\nexport const useReferenceConfig = () => {\n return useContext(ReferenceConfigContext);\n};\n\n/**\n * 获取国际化实例的 Hook\n * 优先使用 Context 中的配置,其次使用全局配置,最后使用默认配置\n */\nexport const useI18N = () => {\n const config = useReferenceConfig();\n\n return useMemo(() => {\n return createI18N(config?.locale);\n }, [config]);\n};\n\n/**\n * 全局配置方法(不使用 Provider 的情况下)\n * @param {Object} config - 配置对象\n * @param {Object|Function} config.locale - 自定义国际化配置\n *\n * @example\n * // 在应用入口调用\n * import { configReference } from '@tntd/reference';\n *\n * configReference({\n * locale: {\n * cn: {\n * referencedrawer: {\n * index: {\n * chaXunYinYongGuan: '自定义文案'\n * }\n * }\n * }\n * }\n * });\n *\n * // 或者使用函数形式,可以访问默认语言包\n * configReference({\n * locale: (defaultLocale) => ({\n * cn: {\n * ...defaultLocale.cn,\n * referencedrawer: {\n * index: {\n * chaXunYinYongGuan: '自定义文案'\n * }\n * }\n * }\n * })\n * });\n */\nexport const configReference = (config) => {\n if (config.locale) {\n if (typeof window !== 'undefined') {\n window.__REFERENCE_LOCALE__ = config.locale;\n } else if (typeof global !== 'undefined') {\n global.__REFERENCE_LOCALE__ = config.locale;\n }\n }\n};\n\nexport default ReferenceConfigProvider;\n"]}
@@ -1,3 +1,4 @@
1
1
  declare var _default: (props: any) => React.JSX.Element;
2
2
  export default _default;
3
+ import React from "react";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,70 +1,138 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
2
+
3
+ var _excluded = ["fetchReference", "data", "orgMap", "appList", "title", "visible", "onClose", "emptyType", "showPagination", "destroyOnClose", "jumpFun", "iframeJump", "I18N", "customDrawer", "onViewOpen"];
4
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
5
+ 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."); }
6
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
7
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
8
+ 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; } }
9
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
10
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
11
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
12
+ 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); }
13
+ Object.defineProperty(exports, "__esModule", {
14
+ value: true
17
15
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- const I18N_1 = require("../I18N");
41
- const react_1 = __importStar(require("react"));
42
- const tntd_1 = require("tntd");
43
- const ReferenceInfo_1 = __importDefault(require("../ReferenceInfo"));
16
+ exports["default"] = void 0;
17
+ var _drawer = _interopRequireDefault(require("tntd/lib/drawer"));
18
+ var _spin = _interopRequireDefault(require("tntd/lib/spin"));
19
+ var _ellipsis = _interopRequireDefault(require("tntd/lib/ellipsis"));
20
+ var _message2 = _interopRequireDefault(require("tntd/lib/message"));
21
+ var _I18N = require("../I18N");
22
+ var _react = _interopRequireWildcard(require("react"));
23
+ var _ReferenceInfo = _interopRequireDefault(require("../ReferenceInfo"));
44
24
  require("./index.less");
45
- exports.default = (0, I18N_1.WrapLocaleReceiver)((props) => {
46
- const { fetchReference, data = null, orgMap = {}, appList = [], title, visible, onClose, emptyType, showPagination, destroyOnClose = true, jumpFun, iframeJump, I18N } = props, rest = __rest(props, ["fetchReference", "data", "orgMap", "appList", "title", "visible", "onClose", "emptyType", "showPagination", "destroyOnClose", "jumpFun", "iframeJump", "I18N"]);
47
- const [referenceData, setReferenceData] = (0, react_1.useState)(data);
48
- const [referenceLoad, setReferenceLoad] = (0, react_1.useState)(!data);
49
- (0, react_1.useEffect)(() => {
50
- if (visible && fetchReference) {
51
- fetchReference()
52
- .then((res) => {
53
- if ((res === null || res === void 0 ? void 0 : res.success) && (res === null || res === void 0 ? void 0 : res.data)) {
54
- setReferenceData((res === null || res === void 0 ? void 0 : res.data) || []);
55
- }
56
- if (!(res === null || res === void 0 ? void 0 : res.success)) {
57
- tntd_1.message.error(res.message || I18N.referencedrawer.index.chaXunYinYongGuan);
58
- }
59
- })
60
- .finally(() => {
61
- setReferenceLoad(false);
62
- });
25
+ function _getRequireWildcardCache(e) {
26
+ if ("function" != typeof WeakMap) return null;
27
+ var r = new WeakMap(),
28
+ t = new WeakMap();
29
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(e) {
30
+ return e ? t : r;
31
+ })(e);
32
+ }
33
+ function _interopRequireWildcard(e, r) {
34
+ if (!r && e && e.__esModule) return e;
35
+ if (null === e || "object" != _typeof(e) && "function" != typeof e) return {
36
+ "default": e
37
+ };
38
+ var t = _getRequireWildcardCache(r);
39
+ if (t && t.has(e)) return t.get(e);
40
+ var n = {
41
+ __proto__: null
42
+ },
43
+ a = Object.defineProperty && Object.getOwnPropertyDescriptor;
44
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
45
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
46
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
47
+ }
48
+ return n["default"] = e, t && t.set(e, n), n;
49
+ }
50
+ function _interopRequireDefault(e) {
51
+ return e && e.__esModule ? e : {
52
+ "default": e
53
+ };
54
+ }
55
+ function _extends() {
56
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
57
+ for (var e = 1; e < arguments.length; e++) {
58
+ var t = arguments[e];
59
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
60
+ }
61
+ return n;
62
+ }, _extends.apply(null, arguments);
63
+ }
64
+ var _default = exports["default"] = (0, _I18N.WrapLocaleReceiver)(function (props) {
65
+ var fetchReference = props.fetchReference,
66
+ _props$data = props.data,
67
+ data = _props$data === void 0 ? null : _props$data,
68
+ _props$orgMap = props.orgMap,
69
+ orgMap = _props$orgMap === void 0 ? {} : _props$orgMap,
70
+ _props$appList = props.appList,
71
+ appList = _props$appList === void 0 ? [] : _props$appList,
72
+ title = props.title,
73
+ visible = props.visible,
74
+ onClose = props.onClose,
75
+ emptyType = props.emptyType,
76
+ showPagination = props.showPagination,
77
+ _props$destroyOnClose = props.destroyOnClose,
78
+ destroyOnClose = _props$destroyOnClose === void 0 ? true : _props$destroyOnClose,
79
+ jumpFun = props.jumpFun,
80
+ iframeJump = props.iframeJump,
81
+ I18N = props.I18N,
82
+ customDrawer = props.customDrawer,
83
+ onViewOpen = props.onViewOpen,
84
+ rest = _objectWithoutProperties(props, _excluded);
85
+ var _ref = (0, _react.useState)(data),
86
+ _ref2 = _slicedToArray(_ref, 2),
87
+ referenceData = _ref2[0],
88
+ setReferenceData = _ref2[1];
89
+ var _ref3 = (0, _react.useState)(!data),
90
+ _ref4 = _slicedToArray(_ref3, 2),
91
+ referenceLoad = _ref4[0],
92
+ setReferenceLoad = _ref4[1];
93
+ (0, _react.useEffect)(function () {
94
+ if (visible && fetchReference) {
95
+ fetchReference().then(function (res) {
96
+ if (res != null && res.success && res != null && res.data) {
97
+ setReferenceData((res == null ? void 0 : res.data) || []);
63
98
  }
64
- }, [visible, I18N, fetchReference]);
65
- return (react_1.default.createElement(tntd_1.Drawer, Object.assign({ className: "reference-drawer", width: 900, title: typeof title === 'string' ? react_1.default.createElement(tntd_1.Ellipsis, { title: title || '' }) : title, onClose: onClose, visible: visible, destroyOnClose: destroyOnClose, showFooter: false }, rest),
66
- referenceLoad && react_1.default.createElement(tntd_1.Spin, { className: "globalSpin", tip: I18N.referencedrawer.index.chaXunZhong }),
67
- !referenceLoad && (react_1.default.createElement("div", { className: "drawer-reference-body" },
68
- react_1.default.createElement(ReferenceInfo_1.default, { jumpFun: jumpFun, iframeJump: iframeJump, emptyType: emptyType, referenceData: referenceData || [], appList: appList || [], orgMap: orgMap || {}, unmountHandle: onClose, showPagination: showPagination })))));
69
- });
70
- //# sourceMappingURL=index.js.map
99
+ if (!(res != null && res.success)) {
100
+ _message2["default"].error(res.message || I18N.referencedrawer.index.chaXunYinYongGuan);
101
+ }
102
+ })["finally"](function () {
103
+ setReferenceLoad(false);
104
+ });
105
+ }
106
+ }, [visible, I18N, fetchReference]);
107
+ var handleSetOtherVisible = function handleSetOtherVisible(record) {
108
+ if (onViewOpen) {
109
+ onViewOpen(record);
110
+ }
111
+ };
112
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_drawer["default"], _extends({
113
+ className: "reference-drawer",
114
+ width: 900,
115
+ title: typeof title === 'string' ? /*#__PURE__*/_react["default"].createElement(_ellipsis["default"], {
116
+ title: title || ''
117
+ }) : title,
118
+ onClose: onClose,
119
+ visible: visible,
120
+ destroyOnClose: destroyOnClose,
121
+ showFooter: false
122
+ }, rest), referenceLoad && /*#__PURE__*/_react["default"].createElement(_spin["default"], {
123
+ className: "globalSpin",
124
+ tip: I18N.referencedrawer.index.chaXunZhong
125
+ }), !referenceLoad && /*#__PURE__*/_react["default"].createElement("div", {
126
+ className: "drawer-reference-body"
127
+ }, /*#__PURE__*/_react["default"].createElement(_ReferenceInfo["default"], {
128
+ jumpFun: jumpFun,
129
+ iframeJump: iframeJump,
130
+ emptyType: emptyType,
131
+ referenceData: referenceData || [],
132
+ appList: appList || [],
133
+ orgMap: orgMap || {},
134
+ unmountHandle: onClose,
135
+ setOtherVisible: handleSetOtherVisible,
136
+ showPagination: showPagination
137
+ })), customDrawer));
138
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ReferenceDrawer/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA6C;AAC7C,+CAAmD;AACnD,+BAAuD;AACvD,qEAA6C;AAC7C,wBAAsB;AAEtB,kBAAe,IAAA,yBAAkB,EAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,EACJ,cAAc,EACd,IAAI,GA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EAAE,GAAG,EACV,KAAK,EAAE,OAAO,KAAK,KAAG,QAAQ,CAAC,CAAC,CAAC,8BAAC,eAAQ,IAAC,KAAK,EAAE,KAAK,IAAK,EAAE,GAAG,CAAA,CAAC,CAAA,KAAK,EACvE,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,UAAU,EAAE,KAAK,IACb,IAAI;QAEP,aAAa,IAAI,8BAAC,WAAI,IAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,GAAS;QAClG,CAAC,aAAa,IAAI,CACjB,uCAAK,SAAS,EAAC,uBAAuB;YACpC,8BAAC,uBAAa,IACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,IAAI,EAAE,EAClC,OAAO,EAAE,OAAO,IAAI,EAAE,EACtB,MAAM,EAAE,MAAM,IAAI,EAAE,EACpB,aAAa,EAAE,OAAO,EACtB,cAAc,EAAE,cAAc,GAC9B,CACE,CACP,CACM,CACV,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { WrapLocaleReceiver } from '../I18N';\nimport React, { useEffect, useState } from 'react';\nimport { Drawer, Spin, Ellipsis, message } from 'tntd';\nimport ReferenceInfo from '../ReferenceInfo';\nimport './index.less';\n\nexport default WrapLocaleReceiver((props) => {\n const {\n fetchReference,\n data = null,\n orgMap = {},\n appList = [],\n title,\n visible,\n onClose,\n emptyType,\n showPagination,\n destroyOnClose = true,\n jumpFun,\n iframeJump,\n I18N,\n ...rest\n } = props;\n const [referenceData, setReferenceData] = useState(data);\n const [referenceLoad, setReferenceLoad] = useState(!data);\n useEffect(() => {\n if (visible && fetchReference) {\n fetchReference()\n .then((res) => {\n if (res?.success && res?.data) {\n setReferenceData(res?.data || []);\n }\n if (!res?.success) {\n message.error(res.message || I18N.referencedrawer.index.chaXunYinYongGuan);\n }\n })\n .finally(() => {\n setReferenceLoad(false);\n });\n }\n }, [visible,I18N, fetchReference]);\n\n return (\n <Drawer\n className=\"reference-drawer\"\n width={900}\n title={typeof title==='string' ? <Ellipsis title={title || ''}/>:title}\n onClose={onClose}\n visible={visible}\n destroyOnClose={destroyOnClose}\n showFooter={false}\n {...rest}\n >\n {referenceLoad && <Spin className=\"globalSpin\" tip={I18N.referencedrawer.index.chaXunZhong}></Spin>}\n {!referenceLoad && (\n <div className=\"drawer-reference-body\">\n <ReferenceInfo\n jumpFun={jumpFun}\n iframeJump={iframeJump}\n emptyType={emptyType}\n referenceData={referenceData || []}\n appList={appList || []}\n orgMap={orgMap || {}}\n unmountHandle={onClose}\n showPagination={showPagination}\n />\n </div>\n )}\n </Drawer>\n );\n});\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ReferenceDrawer/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kCAA6C;AAC7C,+CAAmD;AACnD,+BAAuD;AACvD,qEAA6C;AAC7C,wBAAsB;AAEtB,kBAAe,IAAA,yBAAkB,EAAC,CAAC,KAAK,EAAE,EAAE;IAC1C,MAAM,EACJ,cAAc,EACd,IAAI,GAAG,IAAI,EACX,MAAM,GAAG,EAAE,EACX,OAAO,GAAG,EAAE,EACZ,KAAK,EACL,OAAO,EACP,OAAO,EACP,SAAS,EACT,cAAc,EACd,cAAc,GAAG,IAAI,EACrB,OAAO,EACP,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,UAAU,KAER,KAAK,EADJ,IAAI,UACL,KAAK,EAjBH,8LAiBL,CAAQ,CAAC;IACV,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;IACzD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,IAAA,gBAAQ,EAAC,CAAC,IAAI,CAAC,CAAC;IAC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,8BAAC,WAAI,IAAC,SAAS,EAAC,YAAY,EAAC,GAAG,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,GAAS;YAClG,CAAC,aAAa,IAAI,CACjB,uCAAK,SAAS,EAAC,uBAAuB;gBACpC,8BAAC,uBAAa,IACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,aAAa,IAAI,EAAE,EAClC,OAAO,EAAE,OAAO,IAAI,EAAE,EACtB,MAAM,EAAE,MAAM,IAAI,EAAE,EACpB,aAAa,EAAE,OAAO,EACtB,eAAe,EAAE,qBAAqB,EACtC,cAAc,EAAE,cAAc,GAC9B,CACE,CACP;YACA,YAAY,CACN,CACR,CACJ,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import { WrapLocaleReceiver } from '../I18N';\nimport React, { useEffect, useState } from 'react';\nimport { Drawer, Spin, Ellipsis, message } from 'tntd';\nimport ReferenceInfo from '../ReferenceInfo';\nimport './index.less';\n\nexport default WrapLocaleReceiver((props) => {\n const {\n fetchReference,\n data = null,\n orgMap = {},\n appList = [],\n title,\n visible,\n onClose,\n emptyType,\n showPagination,\n destroyOnClose = true,\n jumpFun,\n iframeJump,\n I18N,\n customDrawer,\n onViewOpen,\n ...rest\n } = props;\n const [referenceData, setReferenceData] = useState(data);\n const [referenceLoad, setReferenceLoad] = useState(!data);\n useEffect(() => {\n if (visible && fetchReference) {\n fetchReference()\n .then((res) => {\n if (res?.success && res?.data) {\n setReferenceData(res?.data || []);\n }\n if (!res?.success) {\n message.error(res.message || I18N.referencedrawer.index.chaXunYinYongGuan);\n }\n })\n .finally(() => {\n setReferenceLoad(false);\n });\n }\n }, [visible,I18N, fetchReference]);\n\n const handleSetOtherVisible = (record) => {\n if (onViewOpen) {\n onViewOpen(record);\n }\n };\n\n return (\n <>\n <Drawer\n className=\"reference-drawer\"\n width={900}\n title={typeof title==='string' ? <Ellipsis title={title || ''}/>:title}\n onClose={onClose}\n visible={visible}\n destroyOnClose={destroyOnClose}\n showFooter={false}\n {...rest}\n >\n {referenceLoad && <Spin className=\"globalSpin\" tip={I18N.referencedrawer.index.chaXunZhong}></Spin>}\n {!referenceLoad && (\n <div className=\"drawer-reference-body\">\n <ReferenceInfo\n jumpFun={jumpFun}\n iframeJump={iframeJump}\n emptyType={emptyType}\n referenceData={referenceData || []}\n appList={appList || []}\n orgMap={orgMap || {}}\n unmountHandle={onClose}\n setOtherVisible={handleSetOtherVisible}\n showPagination={showPagination}\n />\n </div>\n )}\n {customDrawer}\n </Drawer>\n </>\n );\n});\n"]}
@@ -1,3 +1,4 @@
1
1
  declare var _default: (props: any) => React.JSX.Element;
2
2
  export default _default;
3
+ import React from "react";
3
4
  //# sourceMappingURL=index.d.ts.map