tntd 1.4.6 → 1.4.7

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 (86) hide show
  1. package/components/Layout/HeaderActions.js +90 -128
  2. package/components/LoadingButton/index.js +11 -15
  3. package/dist/stats.json +4958 -4958
  4. package/dist/tntd.js +1 -1
  5. package/es/Layout/HeaderActions.js +10 -10
  6. package/es/LoadingButton/index.js +20 -10
  7. package/lib/ArrayInput/icon.js +27 -31
  8. package/lib/ArrayInput/index.js +211 -298
  9. package/lib/AuthContext.js +2 -13
  10. package/lib/Columns/index.js +71 -100
  11. package/lib/DevelopmentLogin/LoginModal.js +79 -141
  12. package/lib/DevelopmentLogin/index.js +28 -55
  13. package/lib/Ellipsis/Svg/CopySVG.js +23 -71
  14. package/lib/Ellipsis/Svg/TickSVG.js +17 -49
  15. package/lib/Ellipsis/index.js +148 -154
  16. package/lib/Handle/index.js +72 -109
  17. package/lib/Icon/fonts/iconfont.js +1 -43
  18. package/lib/Icon/iconList.js +119 -8
  19. package/lib/Icon/index.js +13 -45
  20. package/lib/Img/Contain.js +49 -81
  21. package/lib/Img/Cover.js +88 -136
  22. package/lib/Img/index.js +36 -89
  23. package/lib/Layout/ActionsContext.js +2 -11
  24. package/lib/Layout/AppList.js +262 -256
  25. package/lib/Layout/Application.js +119 -135
  26. package/lib/Layout/Avatar.js +137 -137
  27. package/lib/Layout/CompatibleLanguage.js +214 -195
  28. package/lib/Layout/EnterpriseLayout/Avatar.js +156 -168
  29. package/lib/Layout/EnterpriseLayout/Language.js +75 -100
  30. package/lib/Layout/EnterpriseLayout/Theme.js +96 -94
  31. package/lib/Layout/EnterpriseLayout/index.js +32 -45
  32. package/lib/Layout/GlobalNavigation/NavigationPopup.js +335 -407
  33. package/lib/Layout/GlobalNavigation/index.js +110 -158
  34. package/lib/Layout/Header.js +165 -116
  35. package/lib/Layout/HeaderActions.js +132 -129
  36. package/lib/Layout/HeaderNavs.js +90 -113
  37. package/lib/Layout/HeaderTabs.js +312 -278
  38. package/lib/Layout/Iconfont.js +2 -15
  39. package/lib/Layout/Language.js +63 -102
  40. package/lib/Layout/Layout.js +272 -261
  41. package/lib/Layout/Logo.js +132 -87
  42. package/lib/Layout/OrgAppList.js +440 -319
  43. package/lib/Layout/SideMenu.js +429 -343
  44. package/lib/Layout/Theme.js +95 -124
  45. package/lib/Layout/checkAuth.js +21 -35
  46. package/lib/Layout/createActions.js +38 -51
  47. package/lib/Layout/images/index.js +33 -41
  48. package/lib/Layout/index.js +110 -161
  49. package/lib/Layout/paaslayout/CompactSideMenu.js +200 -178
  50. package/lib/Layout/paaslayout/Header.js +84 -90
  51. package/lib/Layout/paaslayout/Logo.js +27 -32
  52. package/lib/Layout/paaslayout/SideMenu.js +161 -174
  53. package/lib/Layout/paaslayout/index.js +240 -261
  54. package/lib/Layout/storage.js +20 -78
  55. package/lib/Layout/utils.js +93 -143
  56. package/lib/LoadingButton/index.js +25 -57
  57. package/lib/Modal/index.js +83 -108
  58. package/lib/Page/Box.js +56 -81
  59. package/lib/Page/index.js +151 -173
  60. package/lib/Page/utils.js +12 -30
  61. package/lib/QueryForm/Field/Checkbox.js +11 -33
  62. package/lib/QueryForm/Field/Select.js +63 -99
  63. package/lib/QueryForm/Field/SelectInput.js +69 -114
  64. package/lib/QueryForm/Field/fieldsMap.js +30 -52
  65. package/lib/QueryForm/Field/index.js +76 -158
  66. package/lib/QueryForm/createActions.js +50 -65
  67. package/lib/QueryForm/index.js +304 -383
  68. package/lib/QueryForm/useForm.js +6 -17
  69. package/lib/QueryListScene/List.js +290 -366
  70. package/lib/QueryListScene/QueryForm.js +93 -161
  71. package/lib/QueryListScene/QueryListScene.js +33 -87
  72. package/lib/QueryListScene/Title.js +10 -20
  73. package/lib/QueryListScene/Toolbar.js +8 -31
  74. package/lib/QueryListScene/createActions.js +64 -79
  75. package/lib/QueryListScene/index.js +23 -40
  76. package/lib/QueryListScene/useActions.js +6 -17
  77. package/lib/Select/DropDownWrap.js +60 -124
  78. package/lib/Select/index.js +425 -561
  79. package/lib/Table/ResizableTable/index.js +77 -121
  80. package/lib/Table/index.js +19 -51
  81. package/lib/Title/index.js +34 -52
  82. package/lib/index.js +19 -159
  83. package/lib/locale.js +48 -63
  84. package/package.json +1 -1
  85. package/lib/Layout/EnterpriseLayout/Header.js +0 -113
  86. package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
@@ -1,338 +1,459 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- require("antd/lib/select/style");
11
-
12
- var _select = _interopRequireDefault(require("antd/lib/select"));
13
-
14
- require("antd/lib/tree-select/style");
15
-
16
- var _treeSelect = _interopRequireDefault(require("antd/lib/tree-select"));
17
-
18
- require("antd/lib/input/style");
19
-
20
- var _input = _interopRequireDefault(require("antd/lib/input"));
21
-
22
- var _react = require("react");
23
-
24
- var _styledComponents = _interopRequireWildcard(require("styled-components"));
25
-
26
- var _lodash = require("lodash");
27
-
28
- var _storage = require("./storage");
29
-
30
- var _utils = require("./utils");
31
-
32
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
33
-
34
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
37
-
38
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
39
-
40
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
41
-
42
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
43
-
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
47
-
48
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
49
-
50
- function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
51
-
52
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
53
-
54
- function _templateObject3() {
55
- var data = _taggedTemplateLiteral(["\n .org-tree-select {\n &.ant-select-tree-dropdown .ant-select-dropdown-search{\n padding: 10px;\n .ant-select-search__field{\n padding: 0 7px;\n height:28px;\n line-height: 28px;\n }\n }\n .ant-select-tree {\n margin-top:0;\n padding: 0 10px 0 4px;\n li{\n margin:4px 0 ;\n .ant-select-tree-switcher{\n height: 30px;\n line-height: 30px;\n float: left;\n }\n .ant-select-tree-node-content-wrapper{\n height: 30px;\n line-height:30px;\n padding: 0;\n border-radius: 0;\n &.ant-select-tree-node-selected{\n background: #E7F0FE;\n }\n }\n .ant-select-tree-node-content-wrapper:hover{\n background: #E7F0FE;\n }\n .ant-select-tree-title{\n font-family: PingFangSC-Regular;\n color: #17233D;\n padding-left: 4px;\n padding-right: 4px;\n display: block;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n }\n }\n .org-tree-check-select {\n .ant-select-tree {\n margin-top:0;\n padding: 0 10px 0 4px;\n li{\n margin:4px 0 ;\n .ant-select-tree-switcher{\n height: 30px;\n line-height: 30px;\n vertical-align: top;\n }\n\n .ant-select-tree-checkbox{\n vertical-align: super;\n }\n \n .ant-select-tree-node-content-wrapper{\n height: 30px;\n line-height:30px;\n padding: 0;\n border-radius: 0;\n &.ant-select-tree-node-selected{\n background: #E7F0FE;\n }\n }\n .ant-select-tree-node-content-wrapper:hover{\n background: #E7F0FE;\n }\n .ant-select-tree-title{\n font-family: PingFangSC-Regular;\n color: #17233D;\n padding-left: 4px;\n padding-right: 4px;\n display: block;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n }\n }\n }\n }\n"]);
56
-
57
- _templateObject3 = function _templateObject3() {
58
- return data;
59
- };
60
-
61
- return data;
62
- }
63
-
64
- function _templateObject2() {
65
- var data = _taggedTemplateLiteral(["\n min-width: 160px;\n height: 28px;\n line-height: 28;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n .ant-select-selection, .ant-select-selection__rendered {\n line-height: 28px;\n height: 28px;\n }\n .ant-select-selection--multiple {\n padding-bottom: 0;\n overflow: auto;\n min-height: 28px;\n }\n .ant-select-selection {\n .hasHeaderTabs & {\n border-radius: 14px;\n font-size: 12px;\n // \u5220\u9664\u9ED8\u8BA4\u9ED1\u8272\n // background: #191D29;\n // border: 1px solid rgba(186,189,197,0.60);\n // color: rgba(255,255,255,.8);\n // \u7EDF\u4E00\u4E3A\u6D45\u8272\n background: #fff !important;\n border-color: #c9d2dd !important;\n color: #8b919e !important;\n }\n // \u4E0D\u9700\u8981\u533A\u5206\u8272\u7CFB\n // .tnt-themeS1.hasHeaderTabs & {\n // /* background: #141825; */\n // /* color: rgba(255,255,255,.85); */\n // background: #fff;\n // border-color: #c9d2dd;\n // color: #8b919e;\n // }\n\n // .tnt-themeS3.hasHeaderTabs &{\n // background: ", "; //#1D4295\n // color: rgba(255,255,255,0.8);\n // border-color: rgba(255,255,255,0.5);\n // }\n }\n .ant-select-arrow {\n .hasHeaderTabs & {\n color: #B2BECD;\n }\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n }\n\n .tnt-themeS1 & {\n border-radius: 2px;\n }\n\n .isInIframe & {\n margin-left: 20px;\n }\n"]);
66
-
67
- _templateObject2 = function _templateObject2() {
68
- return data;
69
- };
70
-
71
- return data;
72
- }
73
-
74
- function _templateObject() {
75
- var data = _taggedTemplateLiteral(["\n display: inline-block !important;\n width:auto !important;\n min-width: 260px;\n height: 28px;\n line-height: 28;\n position: relative;\n top: 50%;\n transform: translateY(-50%);\n\n &.ant-input-group.ant-input-group-compact::before,\n &.ant-input-group.ant-input-group-compact::after{\n content:\"\";\n display: none;\n }\n\n .ant-select-selection, .ant-select-selection__rendered {\n line-height: 28px;\n height: 28px;\n }\n .ant-select-selection--multiple {\n padding-bottom: 0;\n overflow: auto;\n min-height: 28px;\n }\n\n .ant-select-selection {\n .hasHeaderTabs & {\n border-radius: 14px;\n font-size: 12px;\n // \u5220\u9664\u9ED8\u8BA4\u9ED1\u8272\n // background: #191D29;\n // border: 1px solid rgba(186,189,197,0.60);\n // color: rgba(255,255,255,.8);\n // \u7EDF\u4E00\u6539\u4E3A\u6D45\u8272\n background: #fff !important;\n border-color: #c9d2dd !important;\n color: #8b919e !important;\n\n .ant-select-selection__placeholder, .ant-select-search__field__placeholder{\n color: #8B919E;\n }\n }\n // \u5220\u9664\u8272\u7CFB\u5DEE\u5F02\n // .tnt-themeS1.hasHeaderTabs & {\n // background: #fff;\n // border-color: #c9d2dd;\n // color: #8b919e;\n // }\n\n // \u5220\u9664\u8272\u7CFB\u5DEE\u5F02\n // .tnt-themeS3.hasHeaderTabs &{\n // background: ", "; //#1D4295 !important;\n // color: rgba(255,255,255,0.8);\n // border-color: rgba(255,255,255,0.5);\n // }\n }\n\n .ant-select-arrow {\n .hasHeaderTabs & {\n color: #B2BECD;\n }\n .tnt-themeS1 & {\n /* color: rgba(255,255,255,.85); */\n }\n }\n\n .tnt-themeS1 & {\n border-radius: 2px;\n }\n\n .isInIframe & {\n margin-left: 20px;\n }\n"]);
76
-
77
- _templateObject = function _templateObject() {
78
- return data;
79
- };
80
-
81
- return data;
82
- }
83
-
84
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
85
-
86
- var InputGroup = _input["default"].Group;
87
- var TreeNode = _treeSelect["default"].TreeNode;
88
- var Option = _select["default"].Option; // 机构+应用UI
89
-
90
- var OrgAppsInputGroup = (0, _styledComponents["default"])(InputGroup)(_templateObject(), function (props) {
91
- return "".concat(props.theme.blueBgColor, " !important");
92
- }); // 只展示机构
93
-
94
- var AppTreeSelect = (0, _styledComponents["default"])(_treeSelect["default"])(_templateObject2(), function (props) {
95
- return "".concat(props.theme.blueBgColor, " !important");
96
- });
97
- var GlobalStyle = (0, _styledComponents.createGlobalStyle)(_templateObject3());
1
+ import { useState, useEffect } from 'react';
2
+ import styled, { withTheme, createGlobalStyle } from 'styled-components';
3
+ import { Input, Select, TreeSelect } from 'antd';
4
+ import { get } from 'lodash';
5
+ import { getCurrentAppStore, setCurrentAppStore, getCurrentOrgStore, setCurrentOrgStore, getCurrentOrgTreeStore,setCurrentOrgTreeStore } from './storage';
6
+ import { traverseTree } from './utils';
7
+
8
+ const { Group:InputGroup } = Input;
9
+ const { TreeNode } = TreeSelect;
10
+ const { Option } = Select;
11
+
12
+ // 机构+应用UI
13
+ const OrgAppsInputGroup= styled(InputGroup)`
14
+ display: inline-block !important;
15
+ width:auto !important;
16
+ min-width: 260px;
17
+ height: 28px;
18
+ line-height: 28;
19
+ position: relative;
20
+ top: 50%;
21
+ transform: translateY(-50%);
22
+
23
+ &.ant-input-group.ant-input-group-compact::before,
24
+ &.ant-input-group.ant-input-group-compact::after{
25
+ content:"";
26
+ display: none;
27
+ }
98
28
 
99
- var _default = (0, _styledComponents.withTheme)(function (props) {
100
- var orgAppShow = props.orgAppShow,
101
- selectedOrgKey = props.selectedOrgKey,
102
- orgList = props.orgList,
103
- orgTreeConfig = props.orgTreeConfig,
104
- onOrgChange = props.onOrgChange,
105
- selectedAppKey = props.selectedAppKey,
106
- _props$orgAppList = props.orgAppList,
107
- orgAppList = _props$orgAppList === void 0 ? [] : _props$orgAppList,
108
- onAppChange = props.onAppChange,
109
- headerTabs = props.headerTabs;
110
- var orgListFormatData = (0, _utils.traverseTree)([orgList], function (item) {
111
- item.title = item.name;
112
- item.value = item.uuid;
113
- item.key = item.uuid;
114
- }); // 初始化数据函数
29
+ .ant-select-selection, .ant-select-selection__rendered {
30
+ line-height: 28px;
31
+ height: 28px;
32
+ }
33
+ .ant-select-selection--multiple {
34
+ padding-bottom: 0;
35
+ overflow: auto;
36
+ min-height: 28px;
37
+ }
115
38
 
116
- var getInitialSelected = function getInitialSelected(selectedKey, currentStore, dataList, type) {
117
- var findByKey = function findByKey(selectedKey) {
118
- var find;
119
- (0, _utils.traverseTree)(dataList, function (item) {
120
- if (item.key === selectedKey) {
121
- find = item;
122
- return false;
39
+ .ant-select-selection {
40
+ .hasHeaderTabs & {
41
+ border-radius: 14px;
42
+ font-size: 12px;
43
+ // 删除默认黑色
44
+ // background: #191D29;
45
+ // border: 1px solid rgba(186,189,197,0.60);
46
+ // color: rgba(255,255,255,.8);
47
+ // 统一改为浅色
48
+ background: #fff !important;
49
+ border-color: #c9d2dd !important;
50
+ color: #8b919e !important;
51
+
52
+ .ant-select-selection__placeholder, .ant-select-search__field__placeholder{
53
+ color: #8B919E;
54
+ }
123
55
  }
124
- });
125
- return find;
126
- };
127
-
128
- var current = findByKey(selectedKey || (0, _lodash.get)(currentStore, 'key'));
129
-
130
- if (type) {
131
- return current;
56
+ // 删除色系差异
57
+ // .tnt-themeS1.hasHeaderTabs & {
58
+ // background: #fff;
59
+ // border-color: #c9d2dd;
60
+ // color: #8b919e;
61
+ // }
62
+
63
+ // 删除色系差异
64
+ // .tnt-themeS3.hasHeaderTabs &{
65
+ // background: ${props => `${props.theme.blueBgColor} !important`}; //#1D4295 !important;
66
+ // color: rgba(255,255,255,0.8);
67
+ // border-color: rgba(255,255,255,0.5);
68
+ // }
132
69
  }
133
70
 
134
- return current || dataList[0];
135
- }; // 初始化数据函数机构树
136
-
137
-
138
- var getInitialSelectedTree = function getInitialSelectedTree(selecteds, dataList) {
139
- if (selecteds.length) {
140
- return selecteds;
141
- } else {
142
- var temp = dataList.map(function (res) {
143
- return {
144
- label: res.title,
145
- value: res.uuid
146
- };
147
- });
148
- (0, _storage.setCurrentOrgTreeStore)(temp);
149
- return temp;
71
+ .ant-select-arrow {
72
+ .hasHeaderTabs & {
73
+ color: #B2BECD;
74
+ }
75
+ .tnt-themeS1 & {
76
+ /* color: rgba(255,255,255,.85); */
77
+ }
150
78
  }
151
- }; // 初始化值
152
- // 机构
153
-
154
-
155
- var _useState = (0, _react.useState)(getInitialSelected(selectedOrgKey, (0, _storage.getCurrentOrgStore)(), orgListFormatData)),
156
- _useState2 = _slicedToArray(_useState, 2),
157
- selectedOrg = _useState2[0],
158
- setSelectedOrg = _useState2[1]; // 机构树
159
-
160
-
161
- var _useState3 = (0, _react.useState)(getInitialSelectedTree((0, _storage.getCurrentOrgTreeStore)(), orgListFormatData)),
162
- _useState4 = _slicedToArray(_useState3, 2),
163
- selectedOrgTree = _useState4[0],
164
- setSelectedOrgTree = _useState4[1]; // 应用
165
-
166
-
167
- var _useState5 = (0, _react.useState)(getInitialSelected(selectedAppKey, (0, _storage.getCurrentAppStore)(), orgAppList, 'default')),
168
- _useState6 = _slicedToArray(_useState5, 2),
169
- selectedApp = _useState6[0],
170
- setSelectedApp = _useState6[1]; // org变化事件
171
-
172
-
173
- var changeOrg = function changeOrg() {
174
- var org = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
175
- setSelectedOrg(org);
176
- (0, _storage.setCurrentOrgStore)({
177
- name: org == null ? void 0 : org.name,
178
- key: org == null ? void 0 : org.key,
179
- code: org == null ? void 0 : org.code
180
- });
181
- onOrgChange && onOrgChange(org);
182
- };
183
-
184
- var changeOrgTree = function changeOrgTree() {
185
- var val = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
186
79
 
187
- if (!val.length) {
188
- val = orgListFormatData.map(function (res) {
189
- return {
190
- label: res.title,
191
- value: res.uuid
192
- };
193
- });
80
+ .tnt-themeS1 & {
81
+ border-radius: 2px;
194
82
  }
195
83
 
196
- setSelectedOrgTree(val);
197
- (0, _storage.setCurrentOrgTreeStore)(val);
198
- onOrgChange && onOrgChange(val);
199
- }; // app变化事件
200
-
201
-
202
- var changeApp = function changeApp(app) {
203
- setSelectedApp(app);
204
- (0, _storage.setCurrentAppStore)(app);
205
- onAppChange && onAppChange(app);
206
- };
207
-
208
- (0, _react.useEffect)(function () {
209
- // 监听org机构
210
- var newOrg = getInitialSelected(selectedOrgKey, (0, _storage.getCurrentOrgStore)(), orgListFormatData);
211
-
212
- if ((newOrg == null ? void 0 : newOrg.key) !== (selectedOrg == null ? void 0 : selectedOrg.key)) {
213
- changeOrg(newOrg);
214
- } // 监听应用
215
-
84
+ .isInIframe & {
85
+ margin-left: 20px;
86
+ }
87
+ `;
88
+
89
+ // 只展示机构
90
+ const AppTreeSelect = styled(TreeSelect)`
91
+ min-width: 160px;
92
+ height: 28px;
93
+ line-height: 28;
94
+ position: relative;
95
+ top: 50%;
96
+ transform: translateY(-50%);
97
+ .ant-select-selection, .ant-select-selection__rendered {
98
+ line-height: 28px;
99
+ height: 28px;
100
+ }
101
+ .ant-select-selection--multiple {
102
+ padding-bottom: 0;
103
+ overflow: auto;
104
+ min-height: 28px;
105
+ }
106
+ .ant-select-selection {
107
+ .hasHeaderTabs & {
108
+ border-radius: 14px;
109
+ font-size: 12px;
110
+ // 删除默认黑色
111
+ // background: #191D29;
112
+ // border: 1px solid rgba(186,189,197,0.60);
113
+ // color: rgba(255,255,255,.8);
114
+ // 统一为浅色
115
+ background: #fff !important;
116
+ border-color: #c9d2dd !important;
117
+ color: #8b919e !important;
118
+ }
119
+ // 不需要区分色系
120
+ // .tnt-themeS1.hasHeaderTabs & {
121
+ // /* background: #141825; */
122
+ // /* color: rgba(255,255,255,.85); */
123
+ // background: #fff;
124
+ // border-color: #c9d2dd;
125
+ // color: #8b919e;
126
+ // }
127
+
128
+ // .tnt-themeS3.hasHeaderTabs &{
129
+ // background: ${props => `${props.theme.blueBgColor} !important`}; //#1D4295
130
+ // color: rgba(255,255,255,0.8);
131
+ // border-color: rgba(255,255,255,0.5);
132
+ // }
133
+ }
134
+ .ant-select-arrow {
135
+ .hasHeaderTabs & {
136
+ color: #B2BECD;
137
+ }
138
+ .tnt-themeS1 & {
139
+ /* color: rgba(255,255,255,.85); */
140
+ }
141
+ }
216
142
 
217
- var newApp = getInitialSelected(selectedAppKey, (0, _storage.getCurrentAppStore)(), orgAppList);
143
+ .tnt-themeS1 & {
144
+ border-radius: 2px;
145
+ }
218
146
 
219
- if ((newApp == null ? void 0 : newApp.key) !== (selectedApp == null ? void 0 : selectedApp.key)) {
220
- changeApp(newApp);
147
+ .isInIframe & {
148
+ margin-left: 20px;
221
149
  }
222
- }, [orgList, selectedOrgKey, selectedAppKey, orgAppList]); // 如果是多签页的模式 则居右对齐
150
+ `;
151
+
152
+ const GlobalStyle = createGlobalStyle`
153
+ .org-tree-select {
154
+ &.ant-select-tree-dropdown .ant-select-dropdown-search{
155
+ padding: 10px;
156
+ .ant-select-search__field{
157
+ padding: 0 7px;
158
+ height:28px;
159
+ line-height: 28px;
160
+ }
161
+ }
162
+ .ant-select-tree {
163
+ margin-top:0;
164
+ padding: 0 10px 0 4px;
165
+ li{
166
+ margin:4px 0 ;
167
+ .ant-select-tree-switcher{
168
+ height: 30px;
169
+ line-height: 30px;
170
+ float: left;
171
+ }
172
+ .ant-select-tree-node-content-wrapper{
173
+ height: 30px;
174
+ line-height:30px;
175
+ padding: 0;
176
+ border-radius: 0;
177
+ &.ant-select-tree-node-selected{
178
+ background: #E7F0FE;
179
+ }
180
+ }
181
+ .ant-select-tree-node-content-wrapper:hover{
182
+ background: #E7F0FE;
183
+ }
184
+ .ant-select-tree-title{
185
+ font-family: PingFangSC-Regular;
186
+ color: #17233D;
187
+ padding-left: 4px;
188
+ padding-right: 4px;
189
+ display: block;
190
+ overflow: hidden;
191
+ white-space: nowrap;
192
+ text-overflow: ellipsis;
193
+ }
194
+ }
195
+ }
196
+ }
197
+ .org-tree-check-select {
198
+ .ant-select-tree {
199
+ margin-top:0;
200
+ padding: 0 10px 0 4px;
201
+ li{
202
+ margin:4px 0 ;
203
+ .ant-select-tree-switcher{
204
+ height: 30px;
205
+ line-height: 30px;
206
+ vertical-align: top;
207
+ }
208
+
209
+ .ant-select-tree-checkbox{
210
+ vertical-align: super;
211
+ }
212
+
213
+ .ant-select-tree-node-content-wrapper{
214
+ height: 30px;
215
+ line-height:30px;
216
+ padding: 0;
217
+ border-radius: 0;
218
+ &.ant-select-tree-node-selected{
219
+ background: #E7F0FE;
220
+ }
221
+ }
222
+ .ant-select-tree-node-content-wrapper:hover{
223
+ background: #E7F0FE;
224
+ }
225
+ .ant-select-tree-title{
226
+ font-family: PingFangSC-Regular;
227
+ color: #17233D;
228
+ padding-left: 4px;
229
+ padding-right: 4px;
230
+ display: block;
231
+ overflow: hidden;
232
+ white-space: nowrap;
233
+ text-overflow: ellipsis;
234
+ }
235
+ }
236
+ }
237
+ }
238
+ `;
239
+
240
+ export default withTheme(
241
+ props => {
242
+ const { orgAppShow, selectedOrgKey, orgList, orgTreeConfig, onOrgChange, selectedAppKey, orgAppList = [], onAppChange, headerTabs } = props;
243
+ const orgListFormatData = traverseTree([orgList], item => {
244
+ item.title = item.name;
245
+ item.value = item.uuid;
246
+ item.key = item.uuid;
247
+ });
248
+
249
+ // 初始化数据函数
250
+ const getInitialSelected = (selectedKey, currentStore, dataList, type) => {
251
+ const findByKey = selectedKey => {
252
+ let find;
253
+ traverseTree(dataList, item => {
254
+ if (item.key === selectedKey) {
255
+ find = item;
256
+ return false;
257
+ }
258
+ });
259
+ return find;
260
+ };
261
+ const current = findByKey(selectedKey || get(currentStore, 'key'));
262
+ if(type){
263
+ return current;
264
+ }
265
+ return current || dataList[0];
266
+ };
267
+ // 初始化数据函数机构树
268
+ const getInitialSelectedTree = (selecteds, dataList) => {
269
+ if(selecteds.length){
270
+ return selecteds;
271
+ } else {
272
+ const temp = dataList.map(res => {
273
+ return {
274
+ label: res.title,
275
+ value: res.uuid
276
+ };
277
+ });
278
+ setCurrentOrgTreeStore(temp);
279
+ return temp;
280
+ }
281
+ };
223
282
 
224
- var treeSelectPosition = {},
225
- selectPosition = {};
283
+ // 初始化值
284
+ // 机构
285
+ const [selectedOrg, setSelectedOrg] = useState(getInitialSelected(
286
+ selectedOrgKey,
287
+ getCurrentOrgStore(),
288
+ orgListFormatData,
289
+ ));
290
+
291
+ // 机构树
292
+ const [selectedOrgTree, setSelectedOrgTree] = useState(getInitialSelectedTree(
293
+ getCurrentOrgTreeStore(),
294
+ orgListFormatData
295
+ ));
296
+
297
+ // 应用
298
+ const [selectedApp, setSelectedApp] = useState(getInitialSelected(
299
+ selectedAppKey,
300
+ getCurrentAppStore(),
301
+ orgAppList,
302
+ 'default'
303
+ ));
304
+
305
+ // org变化事件
306
+ const changeOrg = (org={}) => {
307
+ setSelectedOrg(org);
308
+ setCurrentOrgStore({
309
+ name: org?.name,
310
+ key: org?.key,
311
+ code: org?.code
312
+ });
313
+ onOrgChange && onOrgChange(org);
314
+ };
226
315
 
227
- if (headerTabs) {
228
- treeSelectPosition = {
229
- dropdownPopupAlign: {
230
- points: ['tr', 'br']
231
- }
232
- };
233
- selectPosition = {
234
- dropdownAlign: {
235
- points: ['tr', 'br']
236
- }
237
- };
238
- }
316
+ const changeOrgTree = (val = []) => {
317
+ if (!val.length){
318
+ val = orgListFormatData.map(res => {
319
+ return {
320
+ label: res.title,
321
+ value: res.uuid
322
+ };
323
+ });
324
+ }
325
+ setSelectedOrgTree(val);
326
+ setCurrentOrgTreeStore(val);
327
+ onOrgChange && onOrgChange(val);
328
+ };
239
329
 
240
- ;
241
- var orgTreeConfigProp = {};
330
+ // app变化事件
331
+ const changeApp = app => {
332
+ setSelectedApp(app);
333
+ setCurrentAppStore(app);
334
+ onAppChange && onAppChange(app);
335
+ };
242
336
 
243
- if (orgTreeConfig) {
244
- orgTreeConfigProp = _objectSpread({
245
- dropdownClassName: 'org-tree-check-select',
246
- treeCheckable: true,
247
- treeCheckStrictly: true,
248
- onChange: function onChange(val) {
249
- changeOrgTree(val);
250
- },
251
- value: selectedOrgTree
252
- }, orgTreeConfig);
253
- } else {
254
- orgTreeConfigProp = {
255
- dropdownClassName: 'org-tree-select',
256
- onChange: function onChange(orgKey) {
257
- var findItem;
258
- (0, _utils.traverseTree)(orgListFormatData, function (node) {
259
- if (node.key === orgKey) {
260
- findItem = node;
261
- return false;
262
- }
263
- });
264
- changeOrg(findItem);
265
- },
266
- value: (0, _lodash.get)(selectedOrg, 'key')
267
- };
268
- }
337
+ useEffect(() => {
338
+ // 监听org机构
339
+ const newOrg = getInitialSelected(
340
+ selectedOrgKey,
341
+ getCurrentOrgStore(),
342
+ orgListFormatData
343
+ );
344
+ if (newOrg?.key !== selectedOrg?.key) {
345
+ changeOrg(newOrg);
346
+ }
347
+
348
+ // 监听应用
349
+ const newApp = getInitialSelected(
350
+ selectedAppKey,
351
+ getCurrentAppStore(),
352
+ orgAppList
353
+ );
354
+ if (newApp?.key !== selectedApp?.key) {
355
+ changeApp(newApp);
356
+ }
357
+ }, [orgList, selectedOrgKey, selectedAppKey, orgAppList]);
358
+
359
+ // 如果是多签页的模式 则居右对齐
360
+ let [treeSelectPosition,selectPosition] = [{},{}];
361
+ if(headerTabs){
362
+ treeSelectPosition = {
363
+ dropdownPopupAlign:{
364
+ points: ['tr', 'br']
365
+ }
366
+ };
367
+
368
+ selectPosition = {
369
+ dropdownAlign:{
370
+ points: ['tr', 'br']
371
+ }
372
+ };
373
+ };
269
374
 
270
- if (!orgAppShow) {
271
- return React.createElement(React.Fragment, null, React.createElement(AppTreeSelect, _extends({
272
- placeholder: "\u9009\u62E9\u673A\u6784",
273
- searchPlaceholder: "\u673A\u6784\u540D\u79F0",
274
- treeNodeFilterProp: "title",
275
- showSearch: true,
276
- treeData: orgListFormatData,
277
- treeDefaultExpandAll: true
278
- }, treeSelectPosition, {
279
- style: {
280
- width: 160,
281
- height: 28,
282
- lineHeight: 28
283
- },
284
- dropdownStyle: {
285
- maxHeight: 300,
286
- overflow: 'auto',
287
- width: 320
288
- }
289
- }, orgTreeConfigProp)), React.createElement(GlobalStyle, null));
290
- }
375
+ let orgTreeConfigProp = {};
376
+ if (orgTreeConfig) {
377
+
378
+ orgTreeConfigProp = {
379
+ dropdownClassName: 'org-tree-check-select',
380
+ treeCheckable: true,
381
+ treeCheckStrictly: true,
382
+ onChange: (val) => {
383
+ changeOrgTree(val);
384
+ },
385
+ value: selectedOrgTree,
386
+ ...orgTreeConfig
387
+ };
388
+ } else {
389
+ orgTreeConfigProp = {
390
+ dropdownClassName: 'org-tree-select',
391
+ onChange: orgKey => {
392
+ let findItem;
393
+ traverseTree(orgListFormatData, node => {
394
+ if (node.key === orgKey) {
395
+ findItem = node;
396
+ return false;
397
+ }
398
+ });
399
+ changeOrg(findItem);
400
+ },
401
+ value: get(selectedOrg, 'key')
402
+ };
403
+ }
291
404
 
292
- return React.createElement(OrgAppsInputGroup, {
293
- compact: true
294
- }, React.createElement(_treeSelect["default"], _extends({
295
- placeholder: "\u9009\u62E9\u673A\u6784",
296
- searchPlaceholder: "\u673A\u6784\u540D\u79F0",
297
- treeNodeFilterProp: "title",
298
- showSearch: true,
299
- treeData: orgListFormatData,
300
- treeDefaultExpandAll: true,
301
- style: {
302
- width: 130,
303
- height: 28,
304
- lineHeight: 28
305
- },
306
- dropdownStyle: {
307
- maxHeight: 300,
308
- overflow: 'auto',
309
- width: 320
310
- }
311
- }, orgTreeConfigProp)), React.createElement(GlobalStyle, null), React.createElement(_select["default"], {
312
- placeholder: "\u8BF7\u9009\u62E9",
313
- showSearch: true,
314
- optionFilterProp: "children",
315
- onChange: function onChange(appKey) {
316
- changeApp(orgAppList.find(function (_ref) {
317
- var key = _ref.key;
318
- return key === appKey;
319
- }));
320
- },
321
- value: (0, _lodash.get)(selectedApp, 'key'),
322
- style: {
323
- width: 130,
324
- height: 28,
325
- lineHeight: 28
405
+ if(!orgAppShow){
406
+ return (
407
+ <>
408
+ <AppTreeSelect
409
+ placeholder="选择机构"
410
+ searchPlaceholder="机构名称"
411
+ treeNodeFilterProp="title"
412
+ showSearch
413
+ treeData={orgListFormatData}
414
+ treeDefaultExpandAll
415
+ {...treeSelectPosition}
416
+ style={{ width: 160, height: 28, lineHeight: 28 }}
417
+ dropdownStyle={{ maxHeight: 300, overflow: 'auto', width: 320 }}
418
+ {...orgTreeConfigProp}
419
+ />
420
+ <GlobalStyle />
421
+ </>
422
+ );
423
+ }
424
+ return (
425
+ <OrgAppsInputGroup compact>
426
+ <TreeSelect
427
+ placeholder="选择机构"
428
+ searchPlaceholder="机构名称"
429
+ treeNodeFilterProp="title"
430
+ showSearch
431
+ treeData={orgListFormatData}
432
+ treeDefaultExpandAll
433
+ style={{ width: 130, height: 28, lineHeight: 28 }}
434
+ dropdownStyle={{ maxHeight: 300, overflow: 'auto', width: 320 }}
435
+ {...orgTreeConfigProp}
436
+ />
437
+ <GlobalStyle />
438
+ <Select
439
+ placeholder="请选择"
440
+ showSearch
441
+ optionFilterProp="children"
442
+ onChange={appKey => {
443
+ changeApp(orgAppList.find(({ key }) => key === appKey));
444
+ }}
445
+ value={get(selectedApp, 'key')}
446
+ style={{ width: 130, height: 28, lineHeight: 28 }}
447
+ >
448
+ {
449
+ orgAppList.map(({ key, name }) => (
450
+ <Option key={key} value={key} title={name}>
451
+ {name}
452
+ </Option>
453
+ ))
454
+ }
455
+ </Select>
456
+ </OrgAppsInputGroup>
457
+ );
326
458
  }
327
- }, orgAppList.map(function (_ref2) {
328
- var key = _ref2.key,
329
- name = _ref2.name;
330
- return React.createElement(Option, {
331
- key: key,
332
- value: key,
333
- title: name
334
- }, name);
335
- })));
336
- });
337
-
338
- exports["default"] = _default;
459
+ );