@tntd/reference 1.0.3 → 1.0.4

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.
@@ -1,3 +1,4 @@
1
- declare function _default(props: any): import("react").JSX.Element;
1
+ declare function _default(props: any): React.JSX.Element;
2
2
  export default _default;
3
+ import React from "react";
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AHref/index.js"],"names":[],"mappings":"AAAe,mEA2Cd"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AHref/index.js"],"names":[],"mappings":"AACe,yDA2Cd"}
@@ -1,50 +1,64 @@
1
1
  "use strict";
2
- var __rest = (this && this.__rest) || function (s, e) {
3
- var t = {};
4
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
- t[p] = s[p];
6
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
- t[p[i]] = s[p[i]];
10
- }
11
- return t;
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ function _interopRequireDefault(e) {
9
+ return e && e.__esModule ? e : {
10
+ "default": e
11
+ };
12
+ }
13
+ var __rest = void 0 && (void 0).__rest || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
18
+ }
19
+ return t;
12
20
  };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.default = (props) => {
15
- const { children, href, unmountHandle, jumpFun, iframeJump } = props, rest = __rest(props, ["children", "href", "unmountHandle", "jumpFun", "iframeJump"]);
16
- if (window.__isMultiTab__) {
17
- return (React.createElement("a", { onClick: (evt) => {
18
- evt.preventDefault();
19
- if (unmountHandle && typeof unmountHandle === 'function') {
20
- unmountHandle();
21
- }
22
- let pathName = href;
23
- if (href && href.includes('?')) {
24
- pathName = href === null || href === void 0 ? void 0 : href.split('?')[0];
25
- }
26
- if (jumpFun && typeof jumpFun === 'function') {
27
- jumpFun(href);
28
- return;
29
- }
30
- const isInIframe = (window === null || window === void 0 ? void 0 : window.self) !== (window === null || window === void 0 ? void 0 : window.top);
31
- if (iframeJump && isInIframe) {
32
- if (pathName === window.location.pathname) {
33
- window.parent.location.href = href;
34
- }
35
- else {
36
- window.parent.open(href);
37
- }
38
- return;
39
- }
40
- if (pathName === window.location.pathname) {
41
- window.location.href = href;
42
- }
43
- else {
44
- window.push(href);
45
- }
46
- } }, children));
47
- }
48
- return (React.createElement("a", Object.assign({ href: href }, rest), children));
21
+ var _default = function _default(props) {
22
+ var children = props.children,
23
+ href = props.href,
24
+ unmountHandle = props.unmountHandle,
25
+ jumpFun = props.jumpFun,
26
+ iframeJump = props.iframeJump,
27
+ rest = __rest(props, ["children", "href", "unmountHandle", "jumpFun", "iframeJump"]);
28
+ if (window.__isMultiTab__) {
29
+ return _react["default"].createElement("a", {
30
+ onClick: function onClick(evt) {
31
+ evt.preventDefault();
32
+ if (unmountHandle && typeof unmountHandle === 'function') {
33
+ unmountHandle();
34
+ }
35
+ var pathName = href;
36
+ if (href && href.includes('?')) {
37
+ pathName = href === null || href === void 0 ? void 0 : href.split('?')[0];
38
+ }
39
+ if (jumpFun && typeof jumpFun === 'function') {
40
+ jumpFun(href);
41
+ return;
42
+ }
43
+ var isInIframe = (window === null || window === void 0 ? void 0 : window.self) !== (window === null || window === void 0 ? void 0 : window.top);
44
+ if (iframeJump && isInIframe) {
45
+ if (pathName === window.location.pathname) {
46
+ window.parent.location.href = href;
47
+ } else {
48
+ window.parent.open(href);
49
+ }
50
+ return;
51
+ }
52
+ if (pathName === window.location.pathname) {
53
+ window.location.href = href;
54
+ } else {
55
+ window.push(href);
56
+ }
57
+ }
58
+ }, children);
59
+ }
60
+ return _react["default"].createElement("a", Object.assign({
61
+ href: href
62
+ }, rest), children);
49
63
  };
50
- //# sourceMappingURL=index.js.map
64
+ exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AHref/index.js"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,kBAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,KAAa,KAAK,EAAd,IAAI,UAAK,KAAK,EAAtE,8DAA8D,CAAQ,CAAC;IAC7E,IAAI,MAAM,CAAC,cAAc,EAAE;QACzB,OAAO,CACL,2BACE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,IAAI,aAAa,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;oBACtD,aAAa,EAAE,CAAC;iBACnB;gBACD,IAAI,QAAQ,GAAG,IAAI,CAAC;gBACpB,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBAC5B,QAAQ,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;iBAClC;gBACD,IAAG,OAAO,IAAI,OAAO,OAAO,KAAG,UAAU,EAAC;oBACtC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,OAAM;iBACT;gBACD,MAAM,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,OAAK,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAA,CAAC;gBAChD,IAAG,UAAU,IAAI,UAAU,EAAC;oBACxB,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;wBACvC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;qBACtC;yBAAM;wBACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC5B;oBACD,OAAM;iBACT;gBACD,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;oBACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;iBAC/B;qBAAM;oBACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACrB;YACL,CAAC,IAEA,QAAQ,CACP,CACL,CAAC;KACH;IACD,OAAO,CACL,yCAAG,IAAI,EAAE,IAAI,IAAM,IAAI,GACpB,QAAQ,CACP,CACL,CAAC;AACJ,CAAC,CAAC","sourcesContent":["export default (props) => {\n const { children, href, unmountHandle, jumpFun, iframeJump,...rest } = props;\n if (window.__isMultiTab__) {\n return (\n <a\n onClick={(evt) => {\n evt.preventDefault();\n if (unmountHandle && typeof unmountHandle === 'function') {\n unmountHandle();\n }\n let pathName = href;\n if (href && href.includes('?')) {\n pathName = href?.split('?')[0];\n }\n if(jumpFun && typeof jumpFun==='function'){\n jumpFun(href);\n return\n }\n const isInIframe = window?.self !== window?.top;\n if(iframeJump && isInIframe){\n if (pathName === window.location.pathname) {\n window.parent.location.href = href;\n } else {\n window.parent.open(href);\n }\n return\n }\n if (pathName === window.location.pathname) {\n window.location.href = href;\n } else {\n window.push(href);\n }\n }}\n >\n {children}\n </a>\n );\n }\n return (\n <a href={href} {...rest}>\n {children}\n </a>\n );\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/AHref/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,kBAAe,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,KAAa,KAAK,EAAd,IAAI,UAAK,KAAK,EAAtE,8DAA8D,CAAQ,CAAC;IAC7E,IAAI,MAAM,CAAC,cAAc,EAAE;QACzB,OAAO,CACL,qCACE,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,GAAG,CAAC,cAAc,EAAE,CAAC;gBACrB,IAAI,aAAa,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE;oBACtD,aAAa,EAAE,CAAC;iBACnB;gBACD,IAAI,QAAQ,GAAG,IAAI,CAAC;gBACpB,IAAI,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBAC5B,QAAQ,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;iBAClC;gBACD,IAAG,OAAO,IAAI,OAAO,OAAO,KAAG,UAAU,EAAC;oBACtC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACd,OAAM;iBACT;gBACD,MAAM,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,OAAK,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,CAAA,CAAC;gBAChD,IAAG,UAAU,IAAI,UAAU,EAAC;oBACxB,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;wBACvC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;qBACtC;yBAAM;wBACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC5B;oBACD,OAAM;iBACT;gBACD,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;oBACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;iBAC/B;qBAAM;oBACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACrB;YACL,CAAC,IAEA,QAAQ,CACP,CACL,CAAC;KACH;IACD,OAAO,CACL,mDAAG,IAAI,EAAE,IAAI,IAAM,IAAI,GACpB,QAAQ,CACP,CACL,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import React from 'react';\nexport default (props) => {\n const { children, href, unmountHandle, jumpFun, iframeJump,...rest } = props;\n if (window.__isMultiTab__) {\n return (\n <a\n onClick={(evt) => {\n evt.preventDefault();\n if (unmountHandle && typeof unmountHandle === 'function') {\n unmountHandle();\n }\n let pathName = href;\n if (href && href.includes('?')) {\n pathName = href?.split('?')[0];\n }\n if(jumpFun && typeof jumpFun==='function'){\n jumpFun(href);\n return\n }\n const isInIframe = window?.self !== window?.top;\n if(iframeJump && isInIframe){\n if (pathName === window.location.pathname) {\n window.parent.location.href = href;\n } else {\n window.parent.open(href);\n }\n return\n }\n if (pathName === window.location.pathname) {\n window.location.href = href;\n } else {\n window.push(href);\n }\n }}\n >\n {children}\n </a>\n );\n }\n return (\n <a href={href} {...rest}>\n {children}\n </a>\n );\n};\n"]}
package/lib/I18N.js CHANGED
@@ -1,21 +1,25 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getLang = void 0;
7
- const otp_intl_1 = __importDefault(require("otp-intl"));
8
- const universal_cookie_1 = __importDefault(require("universal-cookie"));
9
- const zh_CN_1 = __importDefault(require("../.octopus/zh-CN"));
10
- const en_US_1 = __importDefault(require("../.octopus/en-US"));
11
- const cookies = new universal_cookie_1.default();
12
- const getLang = () => {
13
- return cookies.get('lang') || 'cn';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getLang = exports["default"] = void 0;
7
+ var _otpIntl = _interopRequireDefault(require("otp-intl"));
8
+ var _universalCookie = _interopRequireDefault(require("universal-cookie"));
9
+ var _zhCN = _interopRequireDefault(require("../.octopus/zh-CN"));
10
+ var _enUS = _interopRequireDefault(require("../.octopus/en-US"));
11
+ function _interopRequireDefault(e) {
12
+ return e && e.__esModule ? e : {
13
+ "default": e
14
+ };
15
+ }
16
+ var cookies = new _universalCookie["default"]();
17
+ var getLang = function getLang() {
18
+ return cookies.get('lang') || 'cn';
14
19
  };
15
20
  exports.getLang = getLang;
16
- const kiwiIntl = otp_intl_1.default.init((0, exports.getLang)(), {
17
- cn: zh_CN_1.default,
18
- en: en_US_1.default
21
+ var kiwiIntl = _otpIntl["default"].init(getLang(), {
22
+ cn: _zhCN["default"],
23
+ en: _enUS["default"]
19
24
  });
20
- exports.default = kiwiIntl;
21
- //# sourceMappingURL=I18N.js.map
25
+ var _default = exports["default"] = kiwiIntl;
@@ -1,94 +1,171 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const I18N_1 = __importDefault(require("../I18N"));
7
- const react_dom_1 = __importDefault(require("react-dom"));
8
- const tntd_1 = require("tntd");
9
- const ReferenceInfo_1 = __importDefault(require("../ReferenceInfo"));
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _message2 = _interopRequireDefault(require("tntd/lib/message"));
8
+ var _tag = _interopRequireDefault(require("tntd/lib/tag"));
9
+ var _tooltip = _interopRequireDefault(require("tntd/lib/tooltip"));
10
+ var _alert = _interopRequireDefault(require("tntd/lib/alert"));
11
+ var _button = _interopRequireDefault(require("tntd/lib/button"));
12
+ var _modal = _interopRequireDefault(require("tntd/lib/modal"));
13
+ var _icon = _interopRequireDefault(require("tntd/lib/icon"));
14
+ var _collapse = _interopRequireDefault(require("tntd/lib/collapse"));
15
+ var _I18N = _interopRequireDefault(require("../I18N"));
16
+ var _reactDom = _interopRequireDefault(require("react-dom"));
17
+ var _ReferenceInfo = _interopRequireDefault(require("../ReferenceInfo"));
10
18
  require("./index.less");
11
- const { Panel } = tntd_1.Collapse;
12
- exports.default = (props) => {
13
- const { title = (React.createElement(React.Fragment, null,
14
- React.createElement(tntd_1.Icon, { type: "warning", style: { marginRight: '4px', color: '#EF6555' } }),
15
- I18N_1.default.referencebatchcheck.index.shangXianJiaoYanShi)), rq, checkReferResponse, showPagination, destroyOnClose = true, orgMap = {}, appList = [], value = undefined, onChange = () => { }, cancelText, okText, emptyType, weakMsg = I18N_1.default.referencebatchcheck.index.cunZaiRuoYinYong, strongMsg = I18N_1.default.referencebatchcheck.index.cunZaiQiangYinYong, jumpFun } = props || {};
16
- const appendModal = (reject, resolve, referenceData = []) => {
17
- let type = '';
18
- if (!Array.isArray(referenceData) && (referenceData === null || referenceData === void 0 ? void 0 : referenceData.type)) {
19
- type = referenceData === null || referenceData === void 0 ? void 0 : referenceData.type;
20
- referenceData = (referenceData === null || referenceData === void 0 ? void 0 : referenceData.result) || [];
21
- }
22
- const modalWrap = document.createElement('div');
23
- modalWrap.setAttribute('id', 'tddc-reference-online-check-modal');
24
- const removeModal = () => {
25
- var _a;
26
- const tddcModal = document.querySelectorAll('#tddc-reference-online-check-modal');
27
- if (tddcModal) {
28
- tddcModal.forEach((ele) => { var _a; return (_a = ele === null || ele === void 0 ? void 0 : ele.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(ele); });
29
- }
30
- modalWrap && ((_a = modalWrap === null || modalWrap === void 0 ? void 0 : modalWrap.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(modalWrap));
31
- !type && reject && reject(referenceData);
32
- if (document.body.getAttribute('style')) {
33
- document.body.removeAttribute('style');
34
- }
35
- };
36
- removeModal();
37
- document.body.appendChild(modalWrap);
38
- // 能进行下一步操作
39
- const canNextOpera = !!type && !['STRONG'].includes(type);
40
- react_dom_1.default.render(React.createElement(tntd_1.Modal, { title: title, visible: true, width: 1000, destroyOnClose: destroyOnClose, getContainer: modalWrap, onCancel: removeModal, footer: [
41
- React.createElement(tntd_1.Button, { key: "back", onClick: removeModal }, cancelText || I18N_1.default.referencebatchcheck.index.quXiao),
42
- canNextOpera && (React.createElement(tntd_1.Button, { key: "submit", type: "primary", onClick: () => {
43
- removeModal();
44
- resolve(type);
45
- } }, okText || I18N_1.default.referencebatchcheck.index.xiaYiBu)),
46
- ] },
47
- React.createElement("div", { className: "reference-online-check-modal" },
48
- !!type && canNextOpera && (React.createElement("div", { className: "mb16" },
49
- React.createElement(tntd_1.Alert, { type: "warning", message: weakMsg || (referenceData === null || referenceData === void 0 ? void 0 : referenceData.message) || I18N_1.default.referencebatchcheck.index.cunZaiRuoYinYong }))),
50
- !!type && !canNextOpera && (React.createElement("div", { className: "mb16" },
51
- React.createElement(tntd_1.Alert, { type: "error", message: strongMsg || (referenceData === null || referenceData === void 0 ? void 0 : referenceData.message) || I18N_1.default.referencebatchcheck.index.cunZaiQiangYinYong }))),
52
- React.createElement(tntd_1.Collapse, { defaultActiveKey: value || [0], onChange: onChange }, referenceData === null || referenceData === void 0 ? void 0 : referenceData.map((d, i) => {
53
- let headerTxt = d === null || d === void 0 ? void 0 : d.componentName;
54
- if (d === null || d === void 0 ? void 0 : d.componentCode) {
55
- headerTxt += `[${d === null || d === void 0 ? void 0 : d.componentCode}]`;
56
- }
57
- return (React.createElement(Panel, { header: React.createElement("div", { className: "refer-panel-head" },
58
- React.createElement(tntd_1.Tooltip, { title: headerTxt, placement: "topLeft" },
59
- React.createElement("span", null, headerTxt)),
60
- (d === null || d === void 0 ? void 0 : d.componentVersion) && (React.createElement(tntd_1.Tag, { size: "small", color: "tnt-purple" },
61
- "V", d === null || d === void 0 ? void 0 :
62
- d.componentVersion)),
63
- (d === null || d === void 0 ? void 0 : d.type) === 'STRONG' && (React.createElement(tntd_1.Tag, { color: "red", size: "small" },
64
- I18N_1.default.referencebatchcheck.index.cunZai,
65
- (d === null || d === void 0 ? void 0 : d.typeName) || I18N_1.default.referencebatchcheck.index.qiangYinYong))), key: i },
66
- React.createElement(ReferenceInfo_1.default, { jumpFun: jumpFun, emptyType: emptyType, from: "ReferenceBatchCheck", unmountHandle: removeModal, referenceData: (d === null || d === void 0 ? void 0 : d.result) || [], orgMap: orgMap, appList: appList, showPagination: showPagination })));
67
- })))), modalWrap);
68
- };
69
- if (rq && typeof rq === 'function') {
70
- return new Promise((resolve, reject) => {
71
- return rq().then((res) => {
72
- const { success, data } = res || {};
73
- if (success) {
74
- if (Array.isArray(data) && !!(data === null || data === void 0 ? void 0 : data.length)) {
75
- appendModal(reject, resolve, data);
76
- }
77
- else if (!Array.isArray(data) && (data === null || data === void 0 ? void 0 : data.type) !== 'NO_EXIST') {
78
- appendModal(reject, resolve, data);
79
- }
80
- else {
81
- resolve(data);
82
- }
83
- }
84
- else {
85
- reject(I18N_1.default.referencebatchcheck.index.chaXunGuanLianGuan);
86
- }
87
- });
88
- });
89
- }
90
- else {
91
- tntd_1.message.error(I18N_1.default.referencebatchcheck.index.qingTiGongYiGe);
19
+ function _interopRequireDefault(e) {
20
+ return e && e.__esModule ? e : {
21
+ "default": e
22
+ };
23
+ }
24
+ var Panel = _collapse["default"].Panel;
25
+ var _default = function _default(props) {
26
+ var _ref = props || {},
27
+ _ref$title = _ref.title,
28
+ title = _ref$title === void 0 ? React.createElement(React.Fragment, null, React.createElement(_icon["default"], {
29
+ type: "warning",
30
+ style: {
31
+ marginRight: '4px',
32
+ color: '#EF6555'
33
+ }
34
+ }), _I18N["default"].referencebatchcheck.index.shangXianJiaoYanShi) : _ref$title,
35
+ rq = _ref.rq,
36
+ checkReferResponse = _ref.checkReferResponse,
37
+ showPagination = _ref.showPagination,
38
+ _ref$destroyOnClose = _ref.destroyOnClose,
39
+ destroyOnClose = _ref$destroyOnClose === void 0 ? true : _ref$destroyOnClose,
40
+ _ref$orgMap = _ref.orgMap,
41
+ orgMap = _ref$orgMap === void 0 ? {} : _ref$orgMap,
42
+ _ref$appList = _ref.appList,
43
+ appList = _ref$appList === void 0 ? [] : _ref$appList,
44
+ _ref$value = _ref.value,
45
+ value = _ref$value === void 0 ? undefined : _ref$value,
46
+ _ref$onChange = _ref.onChange,
47
+ onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange,
48
+ cancelText = _ref.cancelText,
49
+ okText = _ref.okText,
50
+ emptyType = _ref.emptyType,
51
+ _ref$weakMsg = _ref.weakMsg,
52
+ weakMsg = _ref$weakMsg === void 0 ? _I18N["default"].referencebatchcheck.index.cunZaiRuoYinYong : _ref$weakMsg,
53
+ _ref$strongMsg = _ref.strongMsg,
54
+ strongMsg = _ref$strongMsg === void 0 ? _I18N["default"].referencebatchcheck.index.cunZaiQiangYinYong : _ref$strongMsg,
55
+ jumpFun = _ref.jumpFun;
56
+ var appendModal = function appendModal(reject, resolve) {
57
+ var referenceData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
58
+ var type = '';
59
+ if (!Array.isArray(referenceData) && (referenceData === null || referenceData === void 0 ? void 0 : referenceData.type)) {
60
+ type = referenceData === null || referenceData === void 0 ? void 0 : referenceData.type;
61
+ referenceData = (referenceData === null || referenceData === void 0 ? void 0 : referenceData.result) || [];
92
62
  }
63
+ var modalWrap = document.createElement('div');
64
+ modalWrap.setAttribute('id', 'tddc-reference-online-check-modal');
65
+ var removeModal = function removeModal() {
66
+ var _a;
67
+ var tddcModal = document.querySelectorAll('#tddc-reference-online-check-modal');
68
+ if (tddcModal) {
69
+ tddcModal.forEach(function (ele) {
70
+ var _a;
71
+ return (_a = ele === null || ele === void 0 ? void 0 : ele.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(ele);
72
+ });
73
+ }
74
+ modalWrap && ((_a = modalWrap === null || modalWrap === void 0 ? void 0 : modalWrap.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(modalWrap));
75
+ !type && reject && reject(referenceData);
76
+ if (document.body.getAttribute('style')) {
77
+ document.body.removeAttribute('style');
78
+ }
79
+ };
80
+ removeModal();
81
+ document.body.appendChild(modalWrap);
82
+ // 能进行下一步操作
83
+ var canNextOpera = !!type && !['STRONG'].includes(type);
84
+ _reactDom["default"].render(React.createElement(_modal["default"], {
85
+ title: title,
86
+ visible: true,
87
+ width: 1000,
88
+ destroyOnClose: destroyOnClose,
89
+ getContainer: modalWrap,
90
+ onCancel: removeModal,
91
+ footer: [React.createElement(_button["default"], {
92
+ key: "back",
93
+ onClick: removeModal
94
+ }, cancelText || _I18N["default"].referencebatchcheck.index.quXiao), canNextOpera && React.createElement(_button["default"], {
95
+ key: "submit",
96
+ type: "primary",
97
+ onClick: function onClick() {
98
+ removeModal();
99
+ resolve(type);
100
+ }
101
+ }, okText || _I18N["default"].referencebatchcheck.index.xiaYiBu)]
102
+ }, React.createElement("div", {
103
+ className: "reference-online-check-modal"
104
+ }, !!type && canNextOpera && React.createElement("div", {
105
+ className: "mb16"
106
+ }, React.createElement(_alert["default"], {
107
+ type: "warning",
108
+ message: weakMsg || (referenceData === null || referenceData === void 0 ? void 0 : referenceData.message) || _I18N["default"].referencebatchcheck.index.cunZaiRuoYinYong
109
+ })), !!type && !canNextOpera && React.createElement("div", {
110
+ className: "mb16"
111
+ }, React.createElement(_alert["default"], {
112
+ type: "error",
113
+ message: strongMsg || (referenceData === null || referenceData === void 0 ? void 0 : referenceData.message) || _I18N["default"].referencebatchcheck.index.cunZaiQiangYinYong
114
+ })), React.createElement(_collapse["default"], {
115
+ defaultActiveKey: value || [0],
116
+ onChange: onChange
117
+ }, referenceData === null || referenceData === void 0 ? void 0 : referenceData.map(function (d, i) {
118
+ var headerTxt = d === null || d === void 0 ? void 0 : d.componentName;
119
+ if (d === null || d === void 0 ? void 0 : d.componentCode) {
120
+ headerTxt += "[".concat(d === null || d === void 0 ? void 0 : d.componentCode, "]");
121
+ }
122
+ return React.createElement(Panel, {
123
+ header: React.createElement("div", {
124
+ className: "refer-panel-head"
125
+ }, React.createElement(_tooltip["default"], {
126
+ title: headerTxt,
127
+ placement: "topLeft"
128
+ }, React.createElement("span", null, headerTxt)), (d === null || d === void 0 ? void 0 : d.componentVersion) && React.createElement(_tag["default"], {
129
+ size: "small",
130
+ color: "tnt-purple"
131
+ }, "V", d === null || d === void 0 ? void 0 : d.componentVersion), (d === null || d === void 0 ? void 0 : d.type) === 'STRONG' && React.createElement(_tag["default"], {
132
+ color: "red",
133
+ size: "small"
134
+ }, _I18N["default"].referencebatchcheck.index.cunZai, (d === null || d === void 0 ? void 0 : d.typeName) || _I18N["default"].referencebatchcheck.index.qiangYinYong)),
135
+ key: i
136
+ }, React.createElement(_ReferenceInfo["default"], {
137
+ jumpFun: jumpFun,
138
+ emptyType: emptyType,
139
+ from: "ReferenceBatchCheck",
140
+ unmountHandle: removeModal,
141
+ referenceData: (d === null || d === void 0 ? void 0 : d.result) || [],
142
+ orgMap: orgMap,
143
+ appList: appList,
144
+ showPagination: showPagination
145
+ }));
146
+ })))), modalWrap);
147
+ };
148
+ if (rq && typeof rq === 'function') {
149
+ return new Promise(function (resolve, reject) {
150
+ return rq().then(function (res) {
151
+ var _ref2 = res || {},
152
+ success = _ref2.success,
153
+ data = _ref2.data;
154
+ if (success) {
155
+ if (Array.isArray(data) && !!(data === null || data === void 0 ? void 0 : data.length)) {
156
+ appendModal(reject, resolve, data);
157
+ } else if (!Array.isArray(data) && (data === null || data === void 0 ? void 0 : data.type) !== 'NO_EXIST') {
158
+ appendModal(reject, resolve, data);
159
+ } else {
160
+ resolve(data);
161
+ }
162
+ } else {
163
+ reject(_I18N["default"].referencebatchcheck.index.chaXunGuanLianGuan);
164
+ }
165
+ });
166
+ });
167
+ } else {
168
+ _message2["default"].error(_I18N["default"].referencebatchcheck.index.qingTiGongYiGe);
169
+ }
93
170
  };
94
- //# sourceMappingURL=index.js.map
171
+ exports["default"] = _default;