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,174 +1,92 @@
1
- "use strict";
1
+ import { PureComponent } from 'react';
2
+ import { Form } from 'antd';
3
+ import { get } from 'lodash';
4
+ import fieldsMap, { getFieldWidth } from './fieldsMap';
2
5
 
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
6
+ const FormItem = Form.Item;
7
7
 
8
- require("antd/lib/form/style");
8
+ const isInput = type => ['input', 'string', 'search'].includes(type);
9
9
 
10
- var _form = _interopRequireDefault(require("antd/lib/form"));
10
+ export default class Field extends PureComponent {
11
+ constructor(props) {
12
+ super(props);
11
13
 
12
- var _react = require("react");
13
-
14
- var _lodash = require("lodash");
15
-
16
- var _fieldsMap = _interopRequireWildcard(require("./fieldsMap"));
17
-
18
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
19
-
20
- 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; }
21
-
22
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
23
-
24
- 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); }
25
-
26
- 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); }
27
-
28
- 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; }
29
-
30
- 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; }
31
-
32
- 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; }
33
-
34
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
-
40
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
41
-
42
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
43
-
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
47
-
48
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ this.state = {
15
+ value: props.initialValue
16
+ };
17
+ }
49
18
 
50
- var FormItem = _form["default"].Item;
19
+ render() {
20
+ const {
21
+ type = 'input',
22
+ title,
23
+ name,
24
+ isFieldInDrawer = false,
25
+ className = '',
26
+ component,
27
+ form,
28
+ props: fieldProps
29
+ } = this.props;
30
+ const { value } = this.state;
31
+ const Field = component || fieldsMap[type];
32
+
33
+ return (
34
+ <FormItem label={title} className={className}>
35
+ <Field
36
+ value={value}
37
+ {...(isInput(type) ? {
38
+ onPressEnter: evt => form.emit('search', { [name]: evt?.target?.value, current: 1 })
39
+ } : {})}
40
+ {...fieldProps}
41
+ style={{
42
+ ...fieldProps?.style,
43
+ width: isFieldInDrawer ? '100%' : (fieldProps?.style?.width || getFieldWidth(type))
44
+ }}
45
+ onChange={this.onChange}
46
+ />
47
+ </FormItem>
48
+ );
49
+ }
51
50
 
52
- var isInput = function isInput(type) {
53
- return ['input', 'string', 'search'].includes(type);
54
- };
51
+ updateValue = (name, value) => {
52
+ if (name === this.props.name) {
53
+ this.setState({ value });
54
+ this.props.onChange(name, value);
55
+ }
56
+ }
55
57
 
56
- var Field =
57
- /*#__PURE__*/
58
- function (_PureComponent) {
59
- _inherits(Field, _PureComponent);
58
+ onChange = (...args) => {
59
+ const { name, type = 'input', component, props: fieldProps } = this.props;
60
+ const { onChange } = fieldProps || {};
60
61
 
61
- function Field(props) {
62
- var _this;
62
+ onChange && onChange(...args);
63
63
 
64
- _classCallCheck(this, Field);
64
+ // Input onChange第一个参数为Event对象,取值特殊处理
65
+ if (!component && isInput(type)) {
66
+ args[0] = get(args[0], 'target.value');
67
+ }
65
68
 
66
- _this = _possibleConstructorReturn(this, _getPrototypeOf(Field).call(this, props));
69
+ this.setState({ value: args[0] });
70
+ this.props.onChange(name, args[0]);
71
+ }
67
72
 
68
- _this.updateValue = function (name, value) {
69
- if (name === _this.props.name) {
70
- _this.setState({
71
- value: value
73
+ onFormChange = formData => {
74
+ this.setState({
75
+ value: get(formData, this.props.name)
72
76
  });
73
-
74
- _this.props.onChange(name, value);
75
- }
76
- };
77
-
78
- _this.onChange = function () {
79
- var _this$props = _this.props,
80
- name = _this$props.name,
81
- _this$props$type = _this$props.type,
82
- type = _this$props$type === void 0 ? 'input' : _this$props$type,
83
- component = _this$props.component,
84
- fieldProps = _this$props.props;
85
-
86
- var _ref = fieldProps || {},
87
- onChange = _ref.onChange;
88
-
89
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
90
- args[_key] = arguments[_key];
91
- }
92
-
93
- onChange && onChange.apply(void 0, args); // Input onChange第一个参数为Event对象,取值特殊处理
94
-
95
- if (!component && isInput(type)) {
96
- args[0] = (0, _lodash.get)(args[0], 'target.value');
97
- }
98
-
99
- _this.setState({
100
- value: args[0]
101
- });
102
-
103
- _this.props.onChange(name, args[0]);
104
- };
105
-
106
- _this.onFormChange = function (formData) {
107
- _this.setState({
108
- value: (0, _lodash.get)(formData, _this.props.name)
109
- });
110
- };
111
-
112
- _this.state = {
113
- value: props.initialValue
114
- };
115
- return _this;
116
- }
117
-
118
- _createClass(Field, [{
119
- key: "render",
120
- value: function render() {
121
- var _fieldProps$style;
122
-
123
- var _this$props2 = this.props,
124
- _this$props2$type = _this$props2.type,
125
- type = _this$props2$type === void 0 ? 'input' : _this$props2$type,
126
- title = _this$props2.title,
127
- name = _this$props2.name,
128
- _this$props2$isFieldI = _this$props2.isFieldInDrawer,
129
- isFieldInDrawer = _this$props2$isFieldI === void 0 ? false : _this$props2$isFieldI,
130
- _this$props2$classNam = _this$props2.className,
131
- className = _this$props2$classNam === void 0 ? '' : _this$props2$classNam,
132
- component = _this$props2.component,
133
- form = _this$props2.form,
134
- fieldProps = _this$props2.props;
135
- var value = this.state.value;
136
- var Field = component || _fieldsMap["default"][type];
137
- return React.createElement(FormItem, {
138
- label: title,
139
- className: className
140
- }, React.createElement(Field, _extends({
141
- value: value
142
- }, isInput(type) ? {
143
- onPressEnter: function onPressEnter(evt) {
144
- var _evt$target, _form$emit;
145
-
146
- return form.emit('search', (_form$emit = {}, _defineProperty(_form$emit, name, evt == null ? void 0 : (_evt$target = evt.target) == null ? void 0 : _evt$target.value), _defineProperty(_form$emit, "current", 1), _form$emit));
147
- }
148
- } : {}, fieldProps, {
149
- style: _objectSpread({}, fieldProps == null ? void 0 : fieldProps.style, {
150
- width: isFieldInDrawer ? '100%' : (fieldProps == null ? void 0 : (_fieldProps$style = fieldProps.style) == null ? void 0 : _fieldProps$style.width) || (0, _fieldsMap.getFieldWidth)(type)
151
- }),
152
- onChange: this.onChange
153
- })));
154
- }
155
- }, {
156
- key: "componentDidMount",
157
- value: function componentDidMount() {
158
- var form = this.props.form;
159
- form.on('setValue', this.updateValue);
160
- form.on('setValues', this.onFormChange);
161
77
  }
162
- }, {
163
- key: "componentWillUnmount",
164
- value: function componentWillUnmount() {
165
- var form = this.props.form;
166
- form.off('setValue', this.updateValue);
167
- form.off('setValues', this.onFormChange);
78
+
79
+ componentDidMount() {
80
+ const { form } = this.props;
81
+
82
+ form.on('setValue', this.updateValue);
83
+ form.on('setValues', this.onFormChange);
168
84
  }
169
- }]);
170
85
 
171
- return Field;
172
- }(_react.PureComponent);
86
+ componentWillUnmount() {
87
+ const { form } = this.props;
173
88
 
174
- exports["default"] = Field;
89
+ form.off('setValue', this.updateValue);
90
+ form.off('setValues', this.onFormChange);
91
+ }
92
+ }
@@ -1,66 +1,51 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _eventemitter = _interopRequireDefault(require("eventemitter3"));
9
-
10
- var _lodash = require("lodash");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- 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; }
15
-
16
- 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; }
17
-
18
- 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; }
19
-
20
- var _default = function _default() {
21
- var eventEmitter = new _eventemitter["default"]();
22
- var data = {
23
- initialValues: {},
24
- values: {}
25
- };
26
- return {
27
- setData: function setData(key, value) {
28
- (0, _lodash.set)(data, key, value);
29
- },
30
- getData: function getData(key) {
31
- (0, _lodash.get)(data, key);
32
- },
33
- setValues: function setValues(values) {
34
- data.values = values;
35
- eventEmitter.emit('setValues', values);
36
- },
37
- getValues: function getValues() {
38
- return data.values;
39
- },
40
- resetValues: function resetValues() {
41
- data.values = _objectSpread({}, data.initialValues);
42
- eventEmitter.emit('setValues', data.values);
43
- },
44
- setValue: function setValue(name, value) {
45
- data.values = data.values || {};
46
- data.values[name] = value;
47
- eventEmitter.emit('setValue', name, value);
48
- },
49
- getValue: function getValue(name) {
50
- var _data$values;
51
-
52
- return (_data$values = data.values) == null ? void 0 : _data$values[name];
53
- },
54
- on: function on(eventName, callback) {
55
- eventEmitter.on(eventName, callback);
56
- },
57
- emit: function emit() {
58
- eventEmitter.emit.apply(eventEmitter, arguments);
59
- },
60
- off: function off() {
61
- eventEmitter.removeListener.apply(eventEmitter, arguments);
62
- }
63
- };
1
+ import EventEmitter from 'eventemitter3';
2
+ import { get, set } from 'lodash';
3
+
4
+ export default () => {
5
+ const eventEmitter = new EventEmitter();
6
+ const data = {
7
+ initialValues: {},
8
+ values: {}
9
+ };
10
+
11
+ return {
12
+ setData(key, value) {
13
+ set(data, key, value);
14
+ },
15
+ getData(key) {
16
+ get(data, key);
17
+ },
18
+
19
+ setValues(values) {
20
+ data.values = values;
21
+ eventEmitter.emit('setValues', values);
22
+ },
23
+ getValues() {
24
+ return data.values;
25
+ },
26
+ resetValues() {
27
+ data.values = { ...data.initialValues };
28
+ eventEmitter.emit('setValues', data.values);
29
+ },
30
+ setValue(name, value) {
31
+ data.values = data.values || {};
32
+ data.values[name] = value;
33
+ eventEmitter.emit('setValue', name, value);
34
+ },
35
+ getValue(name) {
36
+ return data.values?.[name];
37
+ },
38
+
39
+ on: (eventName, callback) => {
40
+ eventEmitter.on(eventName, callback);
41
+ },
42
+
43
+ emit: (...args) => {
44
+ eventEmitter.emit(...args);
45
+ },
46
+
47
+ off: (...args) => {
48
+ eventEmitter.removeListener(...args);
49
+ }
50
+ };
64
51
  };
65
-
66
- exports["default"] = _default;