tntd 1.4.7 → 1.4.8

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 (79) hide show
  1. package/dist/stats.json +38 -38
  2. package/lib/ArrayInput/icon.js +31 -27
  3. package/lib/ArrayInput/index.js +298 -211
  4. package/lib/AuthContext.js +13 -2
  5. package/lib/Columns/index.js +100 -71
  6. package/lib/DevelopmentLogin/LoginModal.js +141 -79
  7. package/lib/DevelopmentLogin/index.js +55 -28
  8. package/lib/Ellipsis/Svg/CopySVG.js +71 -23
  9. package/lib/Ellipsis/Svg/TickSVG.js +49 -17
  10. package/lib/Ellipsis/index.js +154 -148
  11. package/lib/Handle/index.js +109 -72
  12. package/lib/Icon/fonts/iconfont.js +43 -1
  13. package/lib/Icon/iconList.js +8 -119
  14. package/lib/Icon/index.js +45 -13
  15. package/lib/Img/Contain.js +81 -49
  16. package/lib/Img/Cover.js +136 -88
  17. package/lib/Img/index.js +89 -36
  18. package/lib/Layout/ActionsContext.js +11 -2
  19. package/lib/Layout/AppList.js +256 -262
  20. package/lib/Layout/Application.js +135 -119
  21. package/lib/Layout/Avatar.js +137 -137
  22. package/lib/Layout/CompatibleLanguage.js +195 -214
  23. package/lib/Layout/EnterpriseLayout/Avatar.js +168 -156
  24. package/lib/Layout/EnterpriseLayout/Language.js +100 -75
  25. package/lib/Layout/EnterpriseLayout/Theme.js +94 -96
  26. package/lib/Layout/EnterpriseLayout/index.js +45 -32
  27. package/lib/Layout/GlobalNavigation/NavigationPopup.js +407 -335
  28. package/lib/Layout/GlobalNavigation/index.js +158 -110
  29. package/lib/Layout/Header.js +116 -165
  30. package/lib/Layout/HeaderActions.js +129 -132
  31. package/lib/Layout/HeaderNavs.js +113 -90
  32. package/lib/Layout/HeaderTabs.js +278 -312
  33. package/lib/Layout/Iconfont.js +15 -2
  34. package/lib/Layout/Language.js +102 -63
  35. package/lib/Layout/Layout.js +261 -272
  36. package/lib/Layout/Logo.js +87 -132
  37. package/lib/Layout/OrgAppList.js +319 -440
  38. package/lib/Layout/SideMenu.js +343 -429
  39. package/lib/Layout/Theme.js +124 -95
  40. package/lib/Layout/checkAuth.js +35 -21
  41. package/lib/Layout/createActions.js +51 -38
  42. package/lib/Layout/images/index.js +41 -33
  43. package/lib/Layout/index.js +161 -110
  44. package/lib/Layout/paaslayout/CompactSideMenu.js +178 -200
  45. package/lib/Layout/paaslayout/Header.js +90 -84
  46. package/lib/Layout/paaslayout/Logo.js +32 -27
  47. package/lib/Layout/paaslayout/SideMenu.js +174 -161
  48. package/lib/Layout/paaslayout/index.js +261 -240
  49. package/lib/Layout/storage.js +78 -20
  50. package/lib/Layout/utils.js +143 -93
  51. package/lib/LoadingButton/index.js +67 -25
  52. package/lib/Modal/index.js +108 -83
  53. package/lib/Page/Box.js +81 -56
  54. package/lib/Page/index.js +173 -151
  55. package/lib/Page/utils.js +30 -12
  56. package/lib/QueryForm/Field/Checkbox.js +33 -11
  57. package/lib/QueryForm/Field/Select.js +99 -63
  58. package/lib/QueryForm/Field/SelectInput.js +114 -69
  59. package/lib/QueryForm/Field/fieldsMap.js +52 -30
  60. package/lib/QueryForm/Field/index.js +158 -76
  61. package/lib/QueryForm/createActions.js +65 -50
  62. package/lib/QueryForm/index.js +383 -304
  63. package/lib/QueryForm/useForm.js +17 -6
  64. package/lib/QueryListScene/List.js +366 -290
  65. package/lib/QueryListScene/QueryForm.js +161 -93
  66. package/lib/QueryListScene/QueryListScene.js +87 -33
  67. package/lib/QueryListScene/Title.js +20 -10
  68. package/lib/QueryListScene/Toolbar.js +31 -8
  69. package/lib/QueryListScene/createActions.js +79 -64
  70. package/lib/QueryListScene/index.js +40 -23
  71. package/lib/QueryListScene/useActions.js +17 -6
  72. package/lib/Select/DropDownWrap.js +124 -60
  73. package/lib/Select/index.js +561 -425
  74. package/lib/Table/ResizableTable/index.js +121 -77
  75. package/lib/Table/index.js +51 -19
  76. package/lib/Title/index.js +52 -34
  77. package/lib/index.js +159 -19
  78. package/lib/locale.js +63 -48
  79. package/package.json +1 -1
@@ -1,459 +1,338 @@
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
- }
1
+ "use strict";
28
2
 
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
- }
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); }
38
4
 
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
- }
55
- }
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
- // }
69
- }
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
70
9
 
71
- .ant-select-arrow {
72
- .hasHeaderTabs & {
73
- color: #B2BECD;
74
- }
75
- .tnt-themeS1 & {
76
- /* color: rgba(255,255,255,.85); */
77
- }
78
- }
10
+ require("antd/lib/select/style");
79
11
 
80
- .tnt-themeS1 & {
81
- border-radius: 2px;
82
- }
12
+ var _select = _interopRequireDefault(require("antd/lib/select"));
83
13
 
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
- }
14
+ require("antd/lib/tree-select/style");
142
15
 
143
- .tnt-themeS1 & {
144
- border-radius: 2px;
145
- }
16
+ var _treeSelect = _interopRequireDefault(require("antd/lib/tree-select"));
146
17
 
147
- .isInIframe & {
148
- margin-left: 20px;
149
- }
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
- }
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());
98
+
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
+ }); // 初始化数据函数
115
+
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;
236
123
  }
124
+ });
125
+ return find;
126
+ };
127
+
128
+ var current = findByKey(selectedKey || (0, _lodash.get)(currentStore, 'key'));
129
+
130
+ if (type) {
131
+ return current;
237
132
  }
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
133
 
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
- };
134
+ return current || dataList[0];
135
+ }; // 初始化数据函数机构树
282
136
 
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
- };
315
137
 
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);
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
328
146
  };
147
+ });
148
+ (0, _storage.setCurrentOrgTreeStore)(temp);
149
+ return temp;
150
+ }
151
+ }; // 初始化值
152
+ // 机构
329
153
 
330
- // app变化事件
331
- const changeApp = app => {
332
- setSelectedApp(app);
333
- setCurrentAppStore(app);
334
- onAppChange && onAppChange(app);
335
- };
336
154
 
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
- };
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
+
187
+ if (!val.length) {
188
+ val = orgListFormatData.map(function (res) {
189
+ return {
190
+ label: res.title,
191
+ value: res.uuid
373
192
  };
193
+ });
194
+ }
374
195
 
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
- }
196
+ setSelectedOrgTree(val);
197
+ (0, _storage.setCurrentOrgTreeStore)(val);
198
+ onOrgChange && onOrgChange(val);
199
+ }; // app变化事件
404
200
 
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
- );
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
+
216
+
217
+ var newApp = getInitialSelected(selectedAppKey, (0, _storage.getCurrentAppStore)(), orgAppList);
218
+
219
+ if ((newApp == null ? void 0 : newApp.key) !== (selectedApp == null ? void 0 : selectedApp.key)) {
220
+ changeApp(newApp);
458
221
  }
459
- );
222
+ }, [orgList, selectedOrgKey, selectedAppKey, orgAppList]); // 如果是多签页的模式 则居右对齐
223
+
224
+ var treeSelectPosition = {},
225
+ selectPosition = {};
226
+
227
+ if (headerTabs) {
228
+ treeSelectPosition = {
229
+ dropdownPopupAlign: {
230
+ points: ['tr', 'br']
231
+ }
232
+ };
233
+ selectPosition = {
234
+ dropdownAlign: {
235
+ points: ['tr', 'br']
236
+ }
237
+ };
238
+ }
239
+
240
+ ;
241
+ var orgTreeConfigProp = {};
242
+
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
+ }
269
+
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
+ }
291
+
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
326
+ }
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;