tntd 1.4.4 → 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 (88) hide show
  1. package/components/Layout/HeaderActions.js +90 -128
  2. package/components/LoadingButton/index.js +11 -15
  3. package/components/QueryListScene/QueryForm.js +7 -4
  4. package/dist/stats.json +4990 -4990
  5. package/dist/tntd.js +1 -1
  6. package/es/Layout/HeaderActions.js +10 -10
  7. package/es/LoadingButton/index.js +20 -10
  8. package/es/QueryListScene/QueryForm.js +6 -3
  9. package/lib/ArrayInput/icon.js +27 -31
  10. package/lib/ArrayInput/index.js +211 -298
  11. package/lib/AuthContext.js +2 -13
  12. package/lib/Columns/index.js +71 -100
  13. package/lib/DevelopmentLogin/LoginModal.js +79 -141
  14. package/lib/DevelopmentLogin/index.js +28 -55
  15. package/lib/Ellipsis/Svg/CopySVG.js +23 -71
  16. package/lib/Ellipsis/Svg/TickSVG.js +17 -49
  17. package/lib/Ellipsis/index.js +148 -154
  18. package/lib/Handle/index.js +72 -109
  19. package/lib/Icon/fonts/iconfont.js +1 -43
  20. package/lib/Icon/iconList.js +119 -8
  21. package/lib/Icon/index.js +13 -45
  22. package/lib/Img/Contain.js +49 -81
  23. package/lib/Img/Cover.js +88 -136
  24. package/lib/Img/index.js +36 -89
  25. package/lib/Layout/ActionsContext.js +2 -11
  26. package/lib/Layout/AppList.js +262 -256
  27. package/lib/Layout/Application.js +119 -135
  28. package/lib/Layout/Avatar.js +137 -137
  29. package/lib/Layout/CompatibleLanguage.js +214 -195
  30. package/lib/Layout/EnterpriseLayout/Avatar.js +156 -168
  31. package/lib/Layout/EnterpriseLayout/Language.js +75 -100
  32. package/lib/Layout/EnterpriseLayout/Theme.js +96 -94
  33. package/lib/Layout/EnterpriseLayout/index.js +32 -45
  34. package/lib/Layout/GlobalNavigation/NavigationPopup.js +335 -407
  35. package/lib/Layout/GlobalNavigation/index.js +110 -158
  36. package/lib/Layout/Header.js +165 -116
  37. package/lib/Layout/HeaderActions.js +132 -129
  38. package/lib/Layout/HeaderNavs.js +90 -113
  39. package/lib/Layout/HeaderTabs.js +312 -278
  40. package/lib/Layout/Iconfont.js +2 -15
  41. package/lib/Layout/Language.js +63 -102
  42. package/lib/Layout/Layout.js +272 -261
  43. package/lib/Layout/Logo.js +132 -87
  44. package/lib/Layout/OrgAppList.js +440 -319
  45. package/lib/Layout/SideMenu.js +429 -343
  46. package/lib/Layout/Theme.js +95 -124
  47. package/lib/Layout/checkAuth.js +21 -35
  48. package/lib/Layout/createActions.js +38 -51
  49. package/lib/Layout/images/index.js +33 -41
  50. package/lib/Layout/index.js +110 -161
  51. package/lib/Layout/paaslayout/CompactSideMenu.js +200 -178
  52. package/lib/Layout/paaslayout/Header.js +84 -90
  53. package/lib/Layout/paaslayout/Logo.js +27 -32
  54. package/lib/Layout/paaslayout/SideMenu.js +161 -174
  55. package/lib/Layout/paaslayout/index.js +240 -261
  56. package/lib/Layout/storage.js +20 -78
  57. package/lib/Layout/utils.js +93 -143
  58. package/lib/LoadingButton/index.js +25 -57
  59. package/lib/Modal/index.js +83 -108
  60. package/lib/Page/Box.js +56 -81
  61. package/lib/Page/index.js +151 -173
  62. package/lib/Page/utils.js +12 -30
  63. package/lib/QueryForm/Field/Checkbox.js +11 -33
  64. package/lib/QueryForm/Field/Select.js +63 -99
  65. package/lib/QueryForm/Field/SelectInput.js +69 -114
  66. package/lib/QueryForm/Field/fieldsMap.js +30 -52
  67. package/lib/QueryForm/Field/index.js +76 -158
  68. package/lib/QueryForm/createActions.js +50 -65
  69. package/lib/QueryForm/index.js +304 -383
  70. package/lib/QueryForm/useForm.js +6 -17
  71. package/lib/QueryListScene/List.js +290 -366
  72. package/lib/QueryListScene/QueryForm.js +93 -158
  73. package/lib/QueryListScene/QueryListScene.js +33 -87
  74. package/lib/QueryListScene/Title.js +10 -20
  75. package/lib/QueryListScene/Toolbar.js +8 -31
  76. package/lib/QueryListScene/createActions.js +64 -79
  77. package/lib/QueryListScene/index.js +23 -40
  78. package/lib/QueryListScene/useActions.js +6 -17
  79. package/lib/Select/DropDownWrap.js +60 -124
  80. package/lib/Select/index.js +425 -561
  81. package/lib/Table/ResizableTable/index.js +77 -121
  82. package/lib/Table/index.js +19 -51
  83. package/lib/Title/index.js +34 -52
  84. package/lib/index.js +19 -159
  85. package/lib/locale.js +48 -63
  86. package/package.json +1 -1
  87. package/lib/Layout/EnterpriseLayout/Header.js +0 -113
  88. package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
@@ -1,203 +1,222 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- require("antd/lib/popover/style");
9
-
10
- var _popover = _interopRequireDefault(require("antd/lib/popover"));
11
-
12
- var _react = require("react");
13
-
14
- var _styledComponents = _interopRequireDefault(require("styled-components"));
15
-
16
- var _classnames = _interopRequireDefault(require("classnames"));
17
-
18
- var _lodash = require("lodash");
19
-
20
- var _Icon = _interopRequireDefault(require("../Icon"));
21
-
22
- var _images = _interopRequireDefault(require("./images"));
23
-
24
- var _storage = require("./storage");
25
-
26
- var _this = void 0;
27
-
28
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
29
-
30
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
31
-
32
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
33
-
34
- 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; }
35
-
36
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
37
-
38
- function _templateObject4() {
39
- var data = _taggedTemplateLiteral(["\n z-index: 1;\n background-color: #fff;\n border-radius: 4px;\n min-width: 203px;\n padding: 8px 4px 8px 8px;\n .line {\n background: #f0f0f0;\n height: 1px;\n margin: 20px 0;\n width: calc(100% + 44px);\n transform: translateX(-22px);\n }\n"]);
40
-
41
- _templateObject4 = function _templateObject4() {
42
- return data;
43
- };
44
-
45
- return data;
46
- }
47
-
48
- function _templateObject3() {
49
- var data = _taggedTemplateLiteral(["\n margin-bottom: 20px;\n & > div {\n position: relative;\n display: inline-block;\n cursor: pointer;\n img {\n width: 48px;\n }\n &:first-child {\n margin-right: 10px;\n }\n &:last-child {\n margin-left: 10px;\n }\n & > i, & > .tnt-icon, & > .anticon {\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n color: #1890ff;\n }\n }\n"]);
50
-
51
- _templateObject3 = function _templateObject3() {
52
- return data;
53
- };
54
-
55
- return data;
56
- }
57
-
58
- function _templateObject2() {
59
- var data = _taggedTemplateLiteral(["\n margin-left: 20px;\n font-size: 20px;\n .tnt-themeS1 & {\n color: rgba(255,255,255,.85);\n }\n .isInIframe & {\n display: none;\n }\n .tnt-icon {\n font-size: 30px;\n vertical-align: middle;\n opacity: .75;\n color: #2b5696;\n .tnt-themeS1 & {\n /* color: #fff; */\n }\n }\n"]);
60
-
61
- _templateObject2 = function _templateObject2() {
62
- return data;
63
- };
64
-
65
- return data;
66
- }
67
-
68
- function _templateObject() {
69
- var data = _taggedTemplateLiteral(["\n margin-bottom: 10px;\n\n & > div {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n display: inline-block;\n color: #fff;\n width: 49%;\n text-align: center;\n font-size: 14px;\n letter-spacing: 0!important;\n color: #666;\n border: 1px solid #e5e5e5;\n vertical-align: middle;\n display: inline-block;\n letter-spacing: -4px;\n cursor: pointer;\n &:first-child {\n padding: 10px 13px 10px 17px;\n border-radius: 20px 0 0 20px;\n border-right: none;\n }\n &:last-child {\n padding: 10px 17px 10px 13px;\n border-radius: 0 20px 20px 0;\n border-left: none;\n }\n &.active {\n background-color: #4b93e5;\n border-color: #4b93e5;\n color: #fff;\n }\n }\n"]);
70
-
71
- _templateObject = function _templateObject() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
79
-
80
- var languages = [{
81
- value: 'cn',
82
- name: '中文'
83
- }, {
84
- value: 'en',
85
- name: ' EN '
86
- }];
87
- var languagesMap = languages.reduce(function (acc, cur) {
88
- acc[cur.value] = cur;
89
- return acc;
1
+ import { useState } from 'react';
2
+ import styled from 'styled-components';
3
+ import cn from 'classnames';
4
+ import { Popover } from 'antd';
5
+ import { get } from 'lodash';
6
+ import Icon from '../Icon';
7
+ import images from './images';
8
+ import {
9
+ setThemeStore, getThemeStore,
10
+ setLanguageStore, getLanguageStore
11
+ } from './storage';
12
+
13
+ const languages = [
14
+ { value: 'cn', name: '中文' },
15
+ { value: 'en', name: ' EN ' }
16
+ ];
17
+ const languagesMap = languages.reduce((acc, cur) => {
18
+ acc[cur.value] = cur;
19
+ return acc;
90
20
  }, {});
91
21
 
92
- var LanguageSwitch = _styledComponents["default"].div(_templateObject());
93
-
94
- var Theme = _styledComponents["default"].li(_templateObject2());
95
-
96
- var ThemeSwitch = _styledComponents["default"].div(_templateObject3());
97
-
98
- var ThemeContentWrapper = _styledComponents["default"].div(_templateObject4());
99
-
100
- var themes = [{
101
- value: 'themeS1',
102
- img: _images["default"].themeSymbol1
103
- }, {
104
- value: 'themeS2',
105
- img: _images["default"].themeSymbol2
106
- }];
107
-
108
- var ThemeContent = function ThemeContent(props) {
109
- var config = props.config,
110
- onLanguageChange = props.onLanguageChange,
111
- onThemeChange = props.onThemeChange;
112
-
113
- var _ref = config || {},
114
- _ref$language = _ref.language,
115
- languageVisible = _ref$language === void 0 ? true : _ref$language,
116
- _ref$theme = _ref.theme,
117
- themeVisible = _ref$theme === void 0 ? true : _ref$theme;
118
-
119
- var getTheme = function getTheme() {
120
- var theme = (0, _storage.getThemeStore)() || props.theme || 'themeS2';
121
- return themes.some(function (_ref2) {
122
- var value = _ref2.value;
123
- return value === theme;
124
- }) ? theme : 'themeS2';
125
- };
126
-
127
- var _useState = (0, _react.useState)(getTheme()),
128
- _useState2 = _slicedToArray(_useState, 2),
129
- theme = _useState2[0],
130
- setTheme = _useState2[1];
131
-
132
- var changeTheme = function changeTheme(theme) {
133
- setTheme(theme);
134
- (0, _storage.setThemeStore)(theme);
135
- onThemeChange(theme);
136
- };
137
-
138
- var getLanguage = function getLanguage() {
139
- var lang = (0, _storage.getLanguageStore)() || props.language;
140
-
141
- if (!languagesMap[lang]) {
142
- lang = (0, _lodash.get)(languages, '0.value');
22
+ const LanguageSwitch = styled.div`
23
+ margin-bottom: 10px;
24
+
25
+ & > div {
26
+ padding: 10px 13px 10px 17px;
27
+ border-radius: 20px 0 0 20px;
28
+ border-right: none;
29
+ display: inline-block;
30
+ color: #fff;
31
+ width: 49%;
32
+ text-align: center;
33
+ font-size: 14px;
34
+ letter-spacing: 0!important;
35
+ color: #666;
36
+ border: 1px solid #e5e5e5;
37
+ vertical-align: middle;
38
+ display: inline-block;
39
+ letter-spacing: -4px;
40
+ cursor: pointer;
41
+ &:first-child {
42
+ padding: 10px 13px 10px 17px;
43
+ border-radius: 20px 0 0 20px;
44
+ border-right: none;
45
+ }
46
+ &:last-child {
47
+ padding: 10px 17px 10px 13px;
48
+ border-radius: 0 20px 20px 0;
49
+ border-left: none;
50
+ }
51
+ &.active {
52
+ background-color: #4b93e5;
53
+ border-color: #4b93e5;
54
+ color: #fff;
55
+ }
143
56
  }
57
+ `;
144
58
 
145
- return lang;
146
- };
147
-
148
- var _useState3 = (0, _react.useState)(getLanguage()),
149
- _useState4 = _slicedToArray(_useState3, 2),
150
- _useState4$ = _useState4[0],
151
- language = _useState4$ === void 0 ? 'cn' : _useState4$,
152
- setLanguage = _useState4[1];
153
-
154
- var changeLanguage = function changeLanguage(language) {
155
- setLanguage(language);
156
- (0, _storage.setLanguageStore)(language);
157
- onLanguageChange(language);
158
- };
159
-
160
- return React.createElement(ThemeContentWrapper, null, themeVisible && React.createElement(ThemeSwitch, null, themes.map(function (_ref3) {
161
- var value = _ref3.value,
162
- img = _ref3.img;
163
- return React.createElement("div", {
164
- key: value,
165
- onClick: changeTheme.bind(_this, value)
166
- }, React.createElement("img", {
167
- src: img
168
- }), theme === value && React.createElement(_Icon["default"], {
169
- type: "check1"
170
- }));
171
- })), themeVisible && languageVisible && React.createElement("div", {
172
- className: "line"
173
- }), languageVisible && React.createElement(LanguageSwitch, null, languages.map(function (_ref4) {
174
- var value = _ref4.value,
175
- name = _ref4.name;
176
- return React.createElement("div", {
177
- className: (0, _classnames["default"])({
178
- active: value === language
179
- }),
180
- key: value,
181
- onClick: changeLanguage.bind(_this, value)
182
- }, name);
183
- })));
59
+ const Theme = styled.li`
60
+ margin-left: 20px;
61
+ font-size: 20px;
62
+ .tnt-themeS1 & {
63
+ color: rgba(255,255,255,.85);
64
+ }
65
+ .isInIframe & {
66
+ display: none;
67
+ }
68
+ .tnt-icon {
69
+ font-size: 30px;
70
+ vertical-align: middle;
71
+ opacity: .75;
72
+ color: #2b5696;
73
+ .tnt-themeS1 & {
74
+ /* color: #fff; */
75
+ }
76
+ }
77
+ `;
78
+
79
+ const ThemeSwitch = styled.div`
80
+ margin-bottom: 20px;
81
+ & > div {
82
+ position: relative;
83
+ display: inline-block;
84
+ cursor: pointer;
85
+ img {
86
+ width: 48px;
87
+ }
88
+ &:first-child {
89
+ margin-right: 10px;
90
+ }
91
+ &:last-child {
92
+ margin-left: 10px;
93
+ }
94
+ & > i, & > .tnt-icon, & > .anticon {
95
+ position: absolute;
96
+ top: 50%;
97
+ left: 50%;
98
+ transform: translate(-50%, -50%);
99
+ color: #1890ff;
100
+ }
101
+ }
102
+ `;
103
+
104
+ const ThemeContentWrapper = styled.div`
105
+ z-index: 1;
106
+ background-color: #fff;
107
+ border-radius: 4px;
108
+ min-width: 203px;
109
+ padding: 8px 4px 8px 8px;
110
+ .line {
111
+ background: #f0f0f0;
112
+ height: 1px;
113
+ margin: 20px 0;
114
+ width: calc(100% + 44px);
115
+ transform: translateX(-22px);
116
+ }
117
+ `;
118
+
119
+ const themes = [
120
+ { value: 'themeS1', img: images.themeSymbol1 },
121
+ { value: 'themeS2', img: images.themeSymbol2 }
122
+ ];
123
+
124
+ const ThemeContent = props => {
125
+ const { config, onLanguageChange, onThemeChange } = props;
126
+ const {
127
+ language: languageVisible = true,
128
+ theme: themeVisible = true
129
+ } = config || {};
130
+ const getTheme = () => {
131
+ let theme = getThemeStore() || props.theme || 'themeS2';
132
+
133
+ return themes.some(({ value }) => value === theme) ? theme : 'themeS2';
134
+ };
135
+ const [theme, setTheme] = useState(getTheme());
136
+ const changeTheme = theme => {
137
+ setTheme(theme);
138
+ setThemeStore(theme);
139
+ onThemeChange(theme);
140
+ };
141
+ const getLanguage = () => {
142
+ let lang = getLanguageStore() || props.language;
143
+
144
+ if (!languagesMap[lang]) {
145
+ lang = get(languages, '0.value');
146
+ }
147
+
148
+ return lang;
149
+ };
150
+ const [language = 'cn', setLanguage] = useState(getLanguage());
151
+ const changeLanguage = language => {
152
+ setLanguage(language);
153
+ setLanguageStore(language);
154
+ onLanguageChange(language);
155
+ };
156
+
157
+ return (
158
+ <ThemeContentWrapper>
159
+ {
160
+ themeVisible && (
161
+ <ThemeSwitch>
162
+ {
163
+ themes.map(({ value, img }) => (
164
+ <div key={value} onClick={changeTheme.bind(this, value)}>
165
+ <img src={img} />
166
+ {
167
+ theme === value && (
168
+ <Icon type="check1" />
169
+ )
170
+ }
171
+ </div>
172
+ ))
173
+ }
174
+ </ThemeSwitch>
175
+ )
176
+ }
177
+ {
178
+ themeVisible && languageVisible && (
179
+ <div className="line"></div>
180
+ )
181
+ }
182
+ {
183
+ languageVisible && (
184
+ <LanguageSwitch>
185
+ {
186
+ languages.map(({ value, name }) => (
187
+ <div
188
+ className={cn({ active: value === language })}
189
+ key={value}
190
+ onClick={changeLanguage.bind(this, value)}
191
+ >
192
+ {name}
193
+ </div>
194
+ ))
195
+ }
196
+ </LanguageSwitch>
197
+ )
198
+ }
199
+ </ThemeContentWrapper>
200
+ );
184
201
  };
185
202
 
186
- var _default = function _default(props) {
187
- var config = props.config;
188
-
189
- if ((config == null ? void 0 : config.language) === false && (config == null ? void 0 : config.theme) === false) {
190
- return null;
191
- }
203
+ export default props => {
204
+ const { config } = props;
205
+
206
+ if (config?.language === false && config?.theme === false) {
207
+ return null;
208
+ }
192
209
 
193
- return React.createElement(Theme, null, React.createElement(_popover["default"], {
194
- placement: "bottomRight",
195
- title: null,
196
- content: React.createElement(ThemeContent, props),
197
- trigger: "click"
198
- }, React.createElement(_Icon["default"], {
199
- type: "daxiaoxie"
200
- })));
210
+ return (
211
+ <Theme>
212
+ <Popover
213
+ placement="bottomRight"
214
+ title={null}
215
+ content={<ThemeContent {...props} />}
216
+ trigger="click"
217
+ >
218
+ <Icon type="daxiaoxie" />
219
+ </Popover>
220
+ </Theme>
221
+ );
201
222
  };
202
-
203
- exports["default"] = _default;