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.
- package/components/Layout/HeaderActions.js +90 -128
- package/components/LoadingButton/index.js +11 -15
- package/dist/stats.json +4958 -4958
- package/dist/tntd.js +1 -1
- package/es/Layout/HeaderActions.js +10 -10
- package/es/LoadingButton/index.js +20 -10
- package/lib/ArrayInput/icon.js +27 -31
- package/lib/ArrayInput/index.js +211 -298
- package/lib/AuthContext.js +2 -13
- package/lib/Columns/index.js +71 -100
- package/lib/DevelopmentLogin/LoginModal.js +79 -141
- package/lib/DevelopmentLogin/index.js +28 -55
- package/lib/Ellipsis/Svg/CopySVG.js +23 -71
- package/lib/Ellipsis/Svg/TickSVG.js +17 -49
- package/lib/Ellipsis/index.js +148 -154
- package/lib/Handle/index.js +72 -109
- package/lib/Icon/fonts/iconfont.js +1 -43
- package/lib/Icon/iconList.js +119 -8
- package/lib/Icon/index.js +13 -45
- package/lib/Img/Contain.js +49 -81
- package/lib/Img/Cover.js +88 -136
- package/lib/Img/index.js +36 -89
- package/lib/Layout/ActionsContext.js +2 -11
- package/lib/Layout/AppList.js +262 -256
- package/lib/Layout/Application.js +119 -135
- package/lib/Layout/Avatar.js +137 -137
- package/lib/Layout/CompatibleLanguage.js +214 -195
- package/lib/Layout/EnterpriseLayout/Avatar.js +156 -168
- package/lib/Layout/EnterpriseLayout/Language.js +75 -100
- package/lib/Layout/EnterpriseLayout/Theme.js +96 -94
- package/lib/Layout/EnterpriseLayout/index.js +32 -45
- package/lib/Layout/GlobalNavigation/NavigationPopup.js +335 -407
- package/lib/Layout/GlobalNavigation/index.js +110 -158
- package/lib/Layout/Header.js +165 -116
- package/lib/Layout/HeaderActions.js +132 -129
- package/lib/Layout/HeaderNavs.js +90 -113
- package/lib/Layout/HeaderTabs.js +312 -278
- package/lib/Layout/Iconfont.js +2 -15
- package/lib/Layout/Language.js +63 -102
- package/lib/Layout/Layout.js +272 -261
- package/lib/Layout/Logo.js +132 -87
- package/lib/Layout/OrgAppList.js +440 -319
- package/lib/Layout/SideMenu.js +429 -343
- package/lib/Layout/Theme.js +95 -124
- package/lib/Layout/checkAuth.js +21 -35
- package/lib/Layout/createActions.js +38 -51
- package/lib/Layout/images/index.js +33 -41
- package/lib/Layout/index.js +110 -161
- package/lib/Layout/paaslayout/CompactSideMenu.js +200 -178
- package/lib/Layout/paaslayout/Header.js +84 -90
- package/lib/Layout/paaslayout/Logo.js +27 -32
- package/lib/Layout/paaslayout/SideMenu.js +161 -174
- package/lib/Layout/paaslayout/index.js +240 -261
- package/lib/Layout/storage.js +20 -78
- package/lib/Layout/utils.js +93 -143
- package/lib/LoadingButton/index.js +25 -57
- package/lib/Modal/index.js +83 -108
- package/lib/Page/Box.js +56 -81
- package/lib/Page/index.js +151 -173
- package/lib/Page/utils.js +12 -30
- package/lib/QueryForm/Field/Checkbox.js +11 -33
- package/lib/QueryForm/Field/Select.js +63 -99
- package/lib/QueryForm/Field/SelectInput.js +69 -114
- package/lib/QueryForm/Field/fieldsMap.js +30 -52
- package/lib/QueryForm/Field/index.js +76 -158
- package/lib/QueryForm/createActions.js +50 -65
- package/lib/QueryForm/index.js +304 -383
- package/lib/QueryForm/useForm.js +6 -17
- package/lib/QueryListScene/List.js +290 -366
- package/lib/QueryListScene/QueryForm.js +93 -161
- package/lib/QueryListScene/QueryListScene.js +33 -87
- package/lib/QueryListScene/Title.js +10 -20
- package/lib/QueryListScene/Toolbar.js +8 -31
- package/lib/QueryListScene/createActions.js +64 -79
- package/lib/QueryListScene/index.js +23 -40
- package/lib/QueryListScene/useActions.js +6 -17
- package/lib/Select/DropDownWrap.js +60 -124
- package/lib/Select/index.js +425 -561
- package/lib/Table/ResizableTable/index.js +77 -121
- package/lib/Table/index.js +19 -51
- package/lib/Title/index.js +34 -52
- package/lib/index.js +19 -159
- package/lib/locale.js +48 -63
- package/package.json +1 -1
- package/lib/Layout/EnterpriseLayout/Header.js +0 -113
- package/lib/Layout/EnterpriseLayout/HeaderActions.js +0 -104
|
@@ -1,181 +1,113 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import Form from '../QueryForm';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
5
|
+
const clsPrefix = 'tnt-querylistscene-queryform';
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
export default class QueryForm extends React.PureComponent {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
const { actions, form } = props;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _QueryForm = _interopRequireDefault(require("../QueryForm"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
15
|
-
|
|
16
|
-
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); }
|
|
17
|
-
|
|
18
|
-
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); }
|
|
19
|
-
|
|
20
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
21
|
-
|
|
22
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
31
|
-
|
|
32
|
-
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); } }
|
|
33
|
-
|
|
34
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
35
|
-
|
|
36
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
-
|
|
38
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
-
|
|
40
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
-
|
|
42
|
-
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); }
|
|
43
|
-
|
|
44
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
-
|
|
46
|
-
var clsPrefix = 'tnt-querylistscene-queryform';
|
|
47
|
-
|
|
48
|
-
var QueryForm =
|
|
49
|
-
/*#__PURE__*/
|
|
50
|
-
function (_React$PureComponent) {
|
|
51
|
-
_inherits(QueryForm, _React$PureComponent);
|
|
52
|
-
|
|
53
|
-
function QueryForm(props) {
|
|
54
|
-
var _this;
|
|
55
|
-
|
|
56
|
-
_classCallCheck(this, QueryForm);
|
|
57
|
-
|
|
58
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryForm).call(this, props));
|
|
59
|
-
|
|
60
|
-
_this.onSearch = function () {
|
|
61
|
-
var _this$props = _this.props,
|
|
62
|
-
onSearch = _this$props.onSearch,
|
|
63
|
-
actions = _this$props.actions;
|
|
64
|
-
var values = actions.getFormData();
|
|
65
|
-
|
|
66
|
-
var params = _objectSpread({}, values, {
|
|
67
|
-
current: 1
|
|
68
|
-
}); // memory 与 url解析setForm时 监听事件异步
|
|
12
|
+
this.form = form || Form.createForm();
|
|
69
13
|
|
|
14
|
+
actions.on('setFormData', this.setFormData);
|
|
15
|
+
actions.on('resetFormData', this.resetFormData);
|
|
16
|
+
}
|
|
70
17
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
18
|
+
render() {
|
|
19
|
+
const {
|
|
20
|
+
className,
|
|
21
|
+
actions,
|
|
22
|
+
extraActions,
|
|
23
|
+
extralActions,
|
|
24
|
+
qlsProps,
|
|
25
|
+
...props
|
|
26
|
+
} = this.props;
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Form
|
|
30
|
+
{...props}
|
|
31
|
+
form={this.form}
|
|
32
|
+
className={classnames(clsPrefix, { [className]: className })}
|
|
33
|
+
// 前期拼写错误,导致需要兼容错误的api
|
|
34
|
+
extraActions={extraActions || extralActions}
|
|
35
|
+
onChange={this.onChange}
|
|
36
|
+
onSearch={this.onSearch}
|
|
37
|
+
onReset={this.onReset}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
const { initialValues = {}, actions, qlsProps } = this.props;
|
|
44
|
+
|
|
45
|
+
if (qlsProps.memory) {
|
|
46
|
+
actions.setFormData({
|
|
47
|
+
...initialValues,
|
|
48
|
+
...actions.getFormData()
|
|
49
|
+
}, false);
|
|
50
|
+
} else {
|
|
51
|
+
actions.setData('formData', initialValues);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
85
54
|
|
|
86
|
-
|
|
55
|
+
onSearch = () => {
|
|
56
|
+
const {
|
|
57
|
+
onSearch,
|
|
58
|
+
actions
|
|
59
|
+
} = this.props;
|
|
60
|
+
const values = actions.getFormData();
|
|
61
|
+
const params = { ...values, current: 1 };
|
|
62
|
+
|
|
63
|
+
// memory 与 url解析setForm时 监听事件异步
|
|
64
|
+
actions.setData('formData', values);
|
|
65
|
+
Promise.resolve().then(()=>{
|
|
66
|
+
onSearch && onSearch(params);
|
|
67
|
+
actions.emit('search', params);
|
|
68
|
+
});
|
|
87
69
|
};
|
|
88
70
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onChange = _this$props3.onChange,
|
|
92
|
-
actions = _this$props3.actions;
|
|
71
|
+
onReset = () => {
|
|
72
|
+
const { initialValues, onReset, actions } = this.props;
|
|
93
73
|
|
|
94
|
-
|
|
95
|
-
rest[_key - 2] = arguments[_key];
|
|
96
|
-
}
|
|
74
|
+
actions.setFormData(initialValues, false);
|
|
97
75
|
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
onReset && onReset(initialValues);
|
|
77
|
+
this.onSearch();
|
|
100
78
|
};
|
|
101
79
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
actions.setData('formData', data);
|
|
80
|
+
onChange = (newValues, changedInfo, ...rest) => {
|
|
81
|
+
const { onChange, actions } = this.props;
|
|
105
82
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
83
|
+
onChange && onChange(
|
|
84
|
+
newValues,
|
|
85
|
+
changedInfo,
|
|
86
|
+
...rest
|
|
87
|
+
);
|
|
88
|
+
actions.setFormData(newValues, false);
|
|
89
|
+
}
|
|
110
90
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
setFormData = (data, needSearch) => {
|
|
92
|
+
const { actions } = this.props;
|
|
93
|
+
actions.setData('formData', data);
|
|
94
|
+
this.form.setValues(data);
|
|
95
|
+
needSearch && this.onSearch();
|
|
96
|
+
}
|
|
116
97
|
|
|
117
|
-
|
|
118
|
-
|
|
98
|
+
resetFormData = (needSearch) => {
|
|
99
|
+
const { initialValues, actions } = this.props;
|
|
119
100
|
|
|
120
|
-
|
|
121
|
-
form
|
|
122
|
-
_this.form = form || _QueryForm["default"].createForm();
|
|
123
|
-
|
|
124
|
-
_actions.on('setFormData', _this.setFormData);
|
|
125
|
-
|
|
126
|
-
_actions.on('resetFormData', _this.resetFormData);
|
|
127
|
-
|
|
128
|
-
return _this;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
_createClass(QueryForm, [{
|
|
132
|
-
key: "render",
|
|
133
|
-
value: function render() {
|
|
134
|
-
var _this$props5 = this.props,
|
|
135
|
-
className = _this$props5.className,
|
|
136
|
-
actions = _this$props5.actions,
|
|
137
|
-
extraActions = _this$props5.extraActions,
|
|
138
|
-
extralActions = _this$props5.extralActions,
|
|
139
|
-
qlsProps = _this$props5.qlsProps,
|
|
140
|
-
props = _objectWithoutProperties(_this$props5, ["className", "actions", "extraActions", "extralActions", "qlsProps"]);
|
|
141
|
-
|
|
142
|
-
return _react["default"].createElement(_QueryForm["default"], _extends({}, props, {
|
|
143
|
-
form: this.form,
|
|
144
|
-
className: (0, _classnames2["default"])(clsPrefix, _defineProperty({}, className, className)) // 前期拼写错误,导致需要兼容错误的api
|
|
145
|
-
,
|
|
146
|
-
extraActions: extraActions || extralActions,
|
|
147
|
-
onChange: this.onChange,
|
|
148
|
-
onSearch: this.onSearch,
|
|
149
|
-
onReset: this.onReset
|
|
150
|
-
}));
|
|
101
|
+
actions.setFormData(initialValues, needSearch);
|
|
102
|
+
this.form.resetValues();
|
|
151
103
|
}
|
|
152
|
-
}, {
|
|
153
|
-
key: "componentDidMount",
|
|
154
|
-
value: function componentDidMount() {
|
|
155
|
-
var _this$props6 = this.props,
|
|
156
|
-
_this$props6$initialV = _this$props6.initialValues,
|
|
157
|
-
initialValues = _this$props6$initialV === void 0 ? {} : _this$props6$initialV,
|
|
158
|
-
actions = _this$props6.actions,
|
|
159
|
-
qlsProps = _this$props6.qlsProps;
|
|
160
|
-
|
|
161
|
-
if (qlsProps.memory) {
|
|
162
|
-
actions.setFormData(_objectSpread({}, initialValues, {}, actions.getFormData()), false);
|
|
163
|
-
} else {
|
|
164
|
-
actions.setData('formData', initialValues);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}, {
|
|
168
|
-
key: "componentWillUnmount",
|
|
169
|
-
value: function componentWillUnmount() {
|
|
170
|
-
var actions = this.props.actions;
|
|
171
|
-
actions.removeListener('setFormData', this.setFormData);
|
|
172
|
-
actions.removeListener('resetFormData', this.resetFormData);
|
|
173
|
-
}
|
|
174
|
-
}]);
|
|
175
104
|
|
|
176
|
-
|
|
177
|
-
}
|
|
105
|
+
componentWillUnmount() {
|
|
106
|
+
const { actions } = this.props;
|
|
107
|
+
|
|
108
|
+
actions.removeListener('setFormData', this.setFormData);
|
|
109
|
+
actions.removeListener('resetFormData', this.resetFormData);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
178
112
|
|
|
179
|
-
|
|
180
|
-
;
|
|
181
|
-
QueryForm.Field = _QueryForm["default"].Field;
|
|
113
|
+
QueryForm.Field = Form.Field;
|
|
@@ -1,89 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _Title = _interopRequireDefault(require("./Title"));
|
|
13
|
-
|
|
14
|
-
var _Toolbar = _interopRequireDefault(require("./Toolbar"));
|
|
15
|
-
|
|
16
|
-
var _createActions = _interopRequireDefault(require("./createActions"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
|
-
|
|
20
|
-
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); }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
-
|
|
26
|
-
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); } }
|
|
27
|
-
|
|
28
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
-
|
|
30
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
31
|
-
|
|
32
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
33
|
-
|
|
34
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
35
|
-
|
|
36
|
-
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); }
|
|
37
|
-
|
|
38
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
39
|
-
|
|
40
|
-
var QueryListScene =
|
|
41
|
-
/*#__PURE__*/
|
|
42
|
-
function (_React$Component) {
|
|
43
|
-
_inherits(QueryListScene, _React$Component);
|
|
44
|
-
|
|
45
|
-
function QueryListScene(props) {
|
|
46
|
-
var _this;
|
|
47
|
-
|
|
48
|
-
_classCallCheck(this, QueryListScene);
|
|
49
|
-
|
|
50
|
-
_this = _possibleConstructorReturn(this, _getPrototypeOf(QueryListScene).call(this, props));
|
|
51
|
-
_this.actions = props.actions || (0, _createActions["default"])();
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
_createClass(QueryListScene, [{
|
|
56
|
-
key: "render",
|
|
57
|
-
value: function render() {
|
|
58
|
-
var _cn,
|
|
59
|
-
_this2 = this;
|
|
60
|
-
|
|
61
|
-
var _this$props = this.props,
|
|
62
|
-
title = _this$props.title,
|
|
63
|
-
children = _this$props.children,
|
|
64
|
-
size = _this$props.size,
|
|
65
|
-
_this$props$className = _this$props.className,
|
|
66
|
-
className = _this$props$className === void 0 ? '' : _this$props$className;
|
|
67
|
-
var hasToolbar = [].some.call(children || [], function (child) {
|
|
68
|
-
return (child == null ? void 0 : child.type) === _Toolbar["default"];
|
|
69
|
-
});
|
|
70
|
-
return _react["default"].createElement("div", {
|
|
71
|
-
className: (0, _classnames["default"])('tnt-querylistscene', (_cn = {}, _defineProperty(_cn, className, className), _defineProperty(_cn, 'large-size', size === 'large'), _defineProperty(_cn, "hasToolbar", hasToolbar), _cn))
|
|
72
|
-
}, title && _react["default"].createElement(_Title["default"], {
|
|
73
|
-
title: title,
|
|
74
|
-
size: size
|
|
75
|
-
}), _react["default"].createElement("div", {
|
|
76
|
-
className: "tnt-querylistscene-content"
|
|
77
|
-
}, _react["default"].Children.map(children, function (child) {
|
|
78
|
-
return child && _react["default"].cloneElement(child, {
|
|
79
|
-
qlsProps: _this2.props,
|
|
80
|
-
actions: _this2.actions
|
|
81
|
-
});
|
|
82
|
-
})));
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import Title from './Title';
|
|
4
|
+
import Toolbar from './Toolbar';
|
|
5
|
+
import createActions from './createActions';
|
|
6
|
+
|
|
7
|
+
export default class QueryListScene extends React.Component {
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super(props);
|
|
10
|
+
this.actions = props.actions || createActions();
|
|
83
11
|
}
|
|
84
|
-
}]);
|
|
85
|
-
|
|
86
|
-
return QueryListScene;
|
|
87
|
-
}(_react["default"].Component);
|
|
88
12
|
|
|
89
|
-
|
|
13
|
+
render() {
|
|
14
|
+
const { title, children, size, className = '' } = this.props;
|
|
15
|
+
const hasToolbar = [].some.call(children || [], child => child?.type === Toolbar);
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div className={cn('tnt-querylistscene', { [className]: className, 'large-size': size === 'large', hasToolbar })}>
|
|
19
|
+
{
|
|
20
|
+
title && <Title title={title} size={size} />
|
|
21
|
+
}
|
|
22
|
+
<div className="tnt-querylistscene-content">
|
|
23
|
+
{
|
|
24
|
+
React.Children.map(
|
|
25
|
+
children, child => child && React.cloneElement(child, {
|
|
26
|
+
qlsProps: this.props,
|
|
27
|
+
actions: this.actions
|
|
28
|
+
})
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,24 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
1
|
/**
|
|
13
2
|
* @file Title
|
|
14
3
|
* @author zhangyou
|
|
15
4
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
export default ({ title, children }) => (
|
|
8
|
+
<div className="tnt-querylistscene-title">
|
|
9
|
+
<span>{title}</span>
|
|
10
|
+
<span>
|
|
11
|
+
{children}
|
|
12
|
+
</span>
|
|
13
|
+
</div>
|
|
14
|
+
);
|
|
@@ -1,32 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
|
-
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); }
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
17
|
-
|
|
18
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
19
|
-
|
|
20
|
-
var _default = function _default(_ref) {
|
|
21
|
-
var className = _ref.className,
|
|
22
|
-
children = _ref.children,
|
|
23
|
-
actions = _ref.actions,
|
|
24
|
-
qslProps = _ref.qslProps,
|
|
25
|
-
rest = _objectWithoutProperties(_ref, ["className", "children", "actions", "qslProps"]);
|
|
26
|
-
|
|
27
|
-
return React.createElement("div", _extends({}, rest, {
|
|
28
|
-
className: (0, _classnames["default"])('tnt-querylistscene-toolbar', _defineProperty({}, className, className))
|
|
29
|
-
}), children);
|
|
1
|
+
import cn from 'classnames';
|
|
2
|
+
|
|
3
|
+
export default ({ className, children, actions, qslProps, ...rest }) => {
|
|
4
|
+
return (
|
|
5
|
+
<div {...rest} className={cn('tnt-querylistscene-toolbar', { [className]: className })}>
|
|
6
|
+
{children}
|
|
7
|
+
</div>
|
|
8
|
+
);
|
|
30
9
|
};
|
|
31
|
-
|
|
32
|
-
exports["default"] = _default;
|
|
@@ -1,85 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import EventEmitter from 'eventemitter3';
|
|
2
|
+
import { get, set } from 'lodash';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export default () => {
|
|
5
|
+
const eventEmitter = new EventEmitter();
|
|
6
|
+
const data = {
|
|
7
|
+
dataSource: [],
|
|
8
|
+
pagination: {},
|
|
9
|
+
formData: {},
|
|
10
|
+
submittedFormData: {}
|
|
11
|
+
};
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
return {
|
|
14
|
+
setData: (key, val) => {
|
|
15
|
+
set(data, key, val);
|
|
16
|
+
},
|
|
9
17
|
|
|
10
|
-
|
|
18
|
+
getFormData: name => get(data, `formData${name ? ('.' + name) : ''}`),
|
|
19
|
+
getSubmittedFormData: name => get(data, `submittedFormData${name ? ('.' + name) : ''}`),
|
|
20
|
+
getTableDataSource: () => get(data, 'dataSource'),
|
|
21
|
+
getPagination: () => get(data, 'pagination'),
|
|
11
22
|
|
|
12
|
-
|
|
23
|
+
setFormData: (formData, needSearch = true) => {
|
|
24
|
+
set('formData', formData);
|
|
25
|
+
eventEmitter.emit('setFormData', formData, needSearch);
|
|
26
|
+
},
|
|
27
|
+
resetFormData: (needSearch = false) => {
|
|
28
|
+
eventEmitter.emit('resetFormData', needSearch);
|
|
29
|
+
},
|
|
30
|
+
setTableDataSource: dataSource => {
|
|
31
|
+
set('dataSource', dataSource);
|
|
32
|
+
eventEmitter.emit('setTableDataSource', dataSource);
|
|
33
|
+
},
|
|
34
|
+
setPagination: pagination => {
|
|
35
|
+
set('pagination', pagination);
|
|
36
|
+
eventEmitter.emit('setPagination', pagination);
|
|
37
|
+
},
|
|
13
38
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
getTableDataSource: function getTableDataSource() {
|
|
33
|
-
return (0, _lodash.get)(data, 'dataSource');
|
|
34
|
-
},
|
|
35
|
-
getPagination: function getPagination() {
|
|
36
|
-
return (0, _lodash.get)(data, 'pagination');
|
|
37
|
-
},
|
|
38
|
-
setFormData: function setFormData(formData) {
|
|
39
|
-
var needSearch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
40
|
-
(0, _lodash.set)('formData', formData);
|
|
41
|
-
eventEmitter.emit('setFormData', formData, needSearch);
|
|
42
|
-
},
|
|
43
|
-
resetFormData: function resetFormData() {
|
|
44
|
-
var needSearch = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
45
|
-
eventEmitter.emit('resetFormData', needSearch);
|
|
46
|
-
},
|
|
47
|
-
setTableDataSource: function setTableDataSource(dataSource) {
|
|
48
|
-
(0, _lodash.set)('dataSource', dataSource);
|
|
49
|
-
eventEmitter.emit('setTableDataSource', dataSource);
|
|
50
|
-
},
|
|
51
|
-
setPagination: function setPagination(pagination) {
|
|
52
|
-
(0, _lodash.set)('pagination', pagination);
|
|
53
|
-
eventEmitter.emit('setPagination', pagination);
|
|
54
|
-
},
|
|
55
|
-
// 重置记忆数据,form、pagination
|
|
56
|
-
resetMemoryData: function resetMemoryData() {
|
|
57
|
-
data.formData = {};
|
|
58
|
-
data.pagination = {};
|
|
59
|
-
},
|
|
60
|
-
search: function search() {
|
|
61
|
-
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
62
|
-
var showLoading = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
63
|
-
return new Promise(function (resolve, reject) {
|
|
64
|
-
eventEmitter.emit('search', params, {
|
|
65
|
-
callback: resolve,
|
|
66
|
-
showLoading: showLoading
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
},
|
|
70
|
-
on: function on(eventName, callback) {
|
|
71
|
-
eventEmitter.on(eventName, callback);
|
|
72
|
-
},
|
|
73
|
-
emit: function emit() {
|
|
74
|
-
eventEmitter.emit.apply(eventEmitter, arguments);
|
|
75
|
-
},
|
|
76
|
-
removeListener: function removeListener() {
|
|
77
|
-
eventEmitter.removeListener.apply(eventEmitter, arguments);
|
|
78
|
-
},
|
|
79
|
-
off: function off() {
|
|
80
|
-
eventEmitter.removeListener.apply(eventEmitter, arguments);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
};
|
|
39
|
+
// 重置记忆数据,form、pagination
|
|
40
|
+
resetMemoryData: () => {
|
|
41
|
+
data.formData = {};
|
|
42
|
+
data.pagination = {};
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
search: (params = {}, showLoading = true) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
eventEmitter.emit('search', params, {
|
|
48
|
+
callback: resolve,
|
|
49
|
+
showLoading
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
on: (eventName, callback) => {
|
|
55
|
+
eventEmitter.on(eventName, callback);
|
|
56
|
+
},
|
|
84
57
|
|
|
85
|
-
|
|
58
|
+
emit: (...args) => {
|
|
59
|
+
eventEmitter.emit(...args);
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
removeListener: (...args) => {
|
|
63
|
+
eventEmitter.removeListener(...args);
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
off: (...args) => {
|
|
67
|
+
eventEmitter.removeListener(...args);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
};
|