@lemon-fe/components 0.0.0
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/README.md +11 -0
- package/es/Actions/index.d.ts +25 -0
- package/es/Actions/index.js +164 -0
- package/es/Actions/index.less +82 -0
- package/es/BaseTable/BaseTableContext.d.ts +6 -0
- package/es/BaseTable/BaseTableContext.js +6 -0
- package/es/BaseTable/ResizeHeaderCell.d.ts +8 -0
- package/es/BaseTable/ResizeHeaderCell.js +115 -0
- package/es/BaseTable/Sort.d.ts +10 -0
- package/es/BaseTable/Sort.js +122 -0
- package/es/BaseTable/VirtualBody.d.ts +8 -0
- package/es/BaseTable/VirtualBody.js +165 -0
- package/es/BaseTable/index.d.ts +7 -0
- package/es/BaseTable/index.js +371 -0
- package/es/BaseTable/index.less +103 -0
- package/es/BaseTable/typings.d.ts +32 -0
- package/es/BaseTable/utils.d.ts +4 -0
- package/es/BaseTable/utils.js +26 -0
- package/es/DurationPicker/index.d.ts +26 -0
- package/es/DurationPicker/index.js +234 -0
- package/es/DurationPicker/index.less +63 -0
- package/es/EditableTable/EditableCell.d.ts +11 -0
- package/es/EditableTable/EditableCell.js +37 -0
- package/es/EditableTable/EditableTableFormItem.d.ts +6 -0
- package/es/EditableTable/EditableTableFormItem.js +49 -0
- package/es/EditableTable/Table.d.ts +7 -0
- package/es/EditableTable/Table.js +363 -0
- package/es/EditableTable/index.d.ts +9 -0
- package/es/EditableTable/index.js +8 -0
- package/es/EditableTable/index.less +19 -0
- package/es/EditableTable/typings.d.ts +86 -0
- package/es/EditableTable/util.d.ts +25 -0
- package/es/EditableTable/util.js +387 -0
- package/es/Filter/index.d.ts +7 -0
- package/es/Filter/index.js +469 -0
- package/es/Filter/index.less +77 -0
- package/es/Filter/typings.d.ts +27 -0
- package/es/FormLayout/index.d.ts +32 -0
- package/es/FormLayout/index.js +41 -0
- package/es/FormLayout/index.less +89 -0
- package/es/Icons/DarkSearch.d.ts +5 -0
- package/es/Icons/DarkSearch.js +38 -0
- package/es/Icons/Down.d.ts +5 -0
- package/es/Icons/Down.js +30 -0
- package/es/Icons/Empty.d.ts +2 -0
- package/es/Icons/Empty.js +267 -0
- package/es/Icons/Search.d.ts +5 -0
- package/es/Icons/Search.js +39 -0
- package/es/Icons/Tip.d.ts +6 -0
- package/es/Icons/Tip.js +169 -0
- package/es/Icons/index.d.ts +12 -0
- package/es/Icons/index.js +13 -0
- package/es/InputMaxLength/index.d.ts +14 -0
- package/es/InputMaxLength/index.js +92 -0
- package/es/InputMaxLength/index.less +8 -0
- package/es/Layout/index.d.ts +21 -0
- package/es/Layout/index.js +35 -0
- package/es/Layout/index.less +92 -0
- package/es/PageLoading/index.d.ts +5 -0
- package/es/PageLoading/index.js +15 -0
- package/es/PageLoading/index.less +10 -0
- package/es/Popup/index.d.ts +27 -0
- package/es/Popup/index.js +191 -0
- package/es/Popup/index.less +14 -0
- package/es/Section/index.d.ts +54 -0
- package/es/Section/index.js +111 -0
- package/es/Section/index.less +177 -0
- package/es/SiderTree/TreeNodeTitle.d.ts +9 -0
- package/es/SiderTree/TreeNodeTitle.js +124 -0
- package/es/SiderTree/index.d.ts +35 -0
- package/es/SiderTree/index.js +237 -0
- package/es/SiderTree/index.less +170 -0
- package/es/SiderTree/typings.d.ts +19 -0
- package/es/Table/index.d.ts +3 -0
- package/es/Table/index.js +224 -0
- package/es/Table/index.less +1 -0
- package/es/Table/typings.d.ts +26 -0
- package/es/Table/utils.d.ts +2 -0
- package/es/Table/utils.js +3 -0
- package/es/TipMark/index.d.ts +10 -0
- package/es/TipMark/index.js +45 -0
- package/es/TipMark/index.less +8 -0
- package/es/constants.d.ts +1 -0
- package/es/constants.js +1 -0
- package/es/index.d.ts +21 -0
- package/es/index.js +17 -0
- package/es/index.less +50 -0
- package/es/init.d.ts +3 -0
- package/es/init.js +100 -0
- package/es/theme.less +13 -0
- package/package.json +43 -0
|
@@ -0,0 +1,469 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
|
+
|
|
3
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
4
|
+
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
|
|
7
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_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; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
14
|
+
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
+
|
|
17
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
+
|
|
19
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
20
|
+
|
|
21
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
22
|
+
|
|
23
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
24
|
+
|
|
25
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
26
|
+
|
|
27
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
28
|
+
|
|
29
|
+
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; }
|
|
30
|
+
|
|
31
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
32
|
+
import { Button, Col, Checkbox, Form, Input, Popover, Row, Space, Dropdown, Menu, Modal, message, Select, Empty } from 'antd';
|
|
33
|
+
import { EllipsisOutlined, UnorderedListOutlined } from '@ant-design/icons';
|
|
34
|
+
import { useDebounce, useRequest } from '@lemon-fe/hooks';
|
|
35
|
+
import Search from '../Icons/Search';
|
|
36
|
+
import DurationPicker from '../DurationPicker';
|
|
37
|
+
import FormLayout from '../FormLayout';
|
|
38
|
+
import { PREFIX_CLS } from '../constants';
|
|
39
|
+
var components = [{
|
|
40
|
+
type: 'input',
|
|
41
|
+
render: function render(item) {
|
|
42
|
+
return /*#__PURE__*/React.createElement(Input, _objectSpread({}, item.extraProps));
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
type: 'select',
|
|
46
|
+
render: function render(item) {
|
|
47
|
+
return /*#__PURE__*/React.createElement(Select, _objectSpread({}, item.extraProps));
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
type: 'range-picker',
|
|
51
|
+
colSpan: 2,
|
|
52
|
+
render: function render(item) {
|
|
53
|
+
return /*#__PURE__*/React.createElement(DurationPicker, _objectSpread({
|
|
54
|
+
types: [{
|
|
55
|
+
label: '日期',
|
|
56
|
+
value: 'date'
|
|
57
|
+
}]
|
|
58
|
+
}, item.extraProps));
|
|
59
|
+
}
|
|
60
|
+
}];
|
|
61
|
+
var DEFAULT_TAB_TITLE = '默认';
|
|
62
|
+
|
|
63
|
+
function setComponents(items) {
|
|
64
|
+
var compMap = new Map(components.map(function (item) {
|
|
65
|
+
return [item.type, item];
|
|
66
|
+
}));
|
|
67
|
+
items.forEach(function (item) {
|
|
68
|
+
compMap.set(item.type, item);
|
|
69
|
+
});
|
|
70
|
+
components = _toConsumableArray(compMap.values());
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function Filter(props) {
|
|
74
|
+
var data = props.data,
|
|
75
|
+
defaultValueProp = props.defaultValue,
|
|
76
|
+
onChange = props.onChange,
|
|
77
|
+
value = props.value,
|
|
78
|
+
defaultActiveKeys = props.defaultActiveKeys,
|
|
79
|
+
storageKey = props.storageKey,
|
|
80
|
+
onValuesChange = props.onValuesChange;
|
|
81
|
+
var prefixCls = PREFIX_CLS;
|
|
82
|
+
var defaultValue = useMemo(function () {
|
|
83
|
+
return defaultValueProp || value;
|
|
84
|
+
}, []);
|
|
85
|
+
var defaultKeys = useMemo(function () {
|
|
86
|
+
if (defaultActiveKeys) {
|
|
87
|
+
return new Set(defaultActiveKeys);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return new Set(data.map(function (item) {
|
|
91
|
+
return item.key;
|
|
92
|
+
}));
|
|
93
|
+
}, []);
|
|
94
|
+
var compMap = useMemo(function () {
|
|
95
|
+
return new Map(components.map(function (item) {
|
|
96
|
+
return [item.type, item];
|
|
97
|
+
}));
|
|
98
|
+
}, []);
|
|
99
|
+
|
|
100
|
+
var _useState = useState(defaultKeys),
|
|
101
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
102
|
+
activeKeys = _useState2[0],
|
|
103
|
+
setActiveKeys = _useState2[1];
|
|
104
|
+
|
|
105
|
+
var _useState3 = useState(''),
|
|
106
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
107
|
+
keywords = _useState4[0],
|
|
108
|
+
setKeywords = _useState4[1];
|
|
109
|
+
|
|
110
|
+
var _useState5 = useState([{
|
|
111
|
+
title: DEFAULT_TAB_TITLE,
|
|
112
|
+
value: defaultValue || value
|
|
113
|
+
}]),
|
|
114
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
115
|
+
tabs = _useState6[0],
|
|
116
|
+
setTabs = _useState6[1];
|
|
117
|
+
|
|
118
|
+
var _useState7 = useState(0),
|
|
119
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
120
|
+
active = _useState8[0],
|
|
121
|
+
setActive = _useState8[1];
|
|
122
|
+
|
|
123
|
+
var _useState9 = useState(false),
|
|
124
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
125
|
+
showModal = _useState10[0],
|
|
126
|
+
setShowModal = _useState10[1];
|
|
127
|
+
|
|
128
|
+
var _Form$useForm = Form.useForm(),
|
|
129
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
130
|
+
modalForm = _Form$useForm2[0];
|
|
131
|
+
|
|
132
|
+
var _Form$useForm3 = Form.useForm(),
|
|
133
|
+
_Form$useForm4 = _slicedToArray(_Form$useForm3, 1),
|
|
134
|
+
form = _Form$useForm4[0];
|
|
135
|
+
|
|
136
|
+
var _useRequest = useRequest( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
137
|
+
var tabsJson;
|
|
138
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
139
|
+
while (1) {
|
|
140
|
+
switch (_context.prev = _context.next) {
|
|
141
|
+
case 0:
|
|
142
|
+
if (storageKey) {
|
|
143
|
+
_context.next = 2;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return _context.abrupt("return", null);
|
|
148
|
+
|
|
149
|
+
case 2:
|
|
150
|
+
tabsJson = localStorage.getItem("filter-storage-".concat(storageKey));
|
|
151
|
+
|
|
152
|
+
if (!tabsJson) {
|
|
153
|
+
_context.next = 5;
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return _context.abrupt("return", JSON.parse(tabsJson));
|
|
158
|
+
|
|
159
|
+
case 5:
|
|
160
|
+
return _context.abrupt("return", null);
|
|
161
|
+
|
|
162
|
+
case 6:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context.stop();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, _callee);
|
|
168
|
+
})), {
|
|
169
|
+
loadingState: false,
|
|
170
|
+
onSuccess: function onSuccess(res) {
|
|
171
|
+
if (res !== null) {
|
|
172
|
+
setTabs(function (prev) {
|
|
173
|
+
return [prev[0]].concat(_toConsumableArray(res));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}),
|
|
178
|
+
init = _useRequest.run;
|
|
179
|
+
|
|
180
|
+
useEffect(function () {
|
|
181
|
+
init();
|
|
182
|
+
}, []);
|
|
183
|
+
useEffect(function () {
|
|
184
|
+
if (!!value) {
|
|
185
|
+
form.setFieldsValue(value);
|
|
186
|
+
}
|
|
187
|
+
}, [value]);
|
|
188
|
+
var handleChangeKeywords = useDebounce(setKeywords, 300);
|
|
189
|
+
|
|
190
|
+
var toggleModal = function toggleModal() {
|
|
191
|
+
setShowModal(function (prev) {
|
|
192
|
+
return !prev;
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
var handleValuesChange = function handleValuesChange(changedValues, allValues) {
|
|
197
|
+
onValuesChange === null || onValuesChange === void 0 ? void 0 : onValuesChange(changedValues, allValues, form);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
var handleSave = function handleSave(_ref2) {
|
|
201
|
+
var title = _ref2.name;
|
|
202
|
+
var index = tabs.findIndex(function (item) {
|
|
203
|
+
return item.title === title;
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
var next = _toConsumableArray(tabs);
|
|
207
|
+
|
|
208
|
+
var tab = {
|
|
209
|
+
title: title,
|
|
210
|
+
value: form.getFieldsValue()
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
if (index >= 0) {
|
|
214
|
+
next[index] = tab;
|
|
215
|
+
} else {
|
|
216
|
+
index = next.length;
|
|
217
|
+
next.push(tab);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
setTabs(next);
|
|
221
|
+
setActive(index);
|
|
222
|
+
setShowModal(false);
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
var handleOk = /*#__PURE__*/function () {
|
|
226
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
227
|
+
var values;
|
|
228
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
229
|
+
while (1) {
|
|
230
|
+
switch (_context2.prev = _context2.next) {
|
|
231
|
+
case 0:
|
|
232
|
+
_context2.prev = 0;
|
|
233
|
+
_context2.next = 3;
|
|
234
|
+
return modalForm.validateFields();
|
|
235
|
+
|
|
236
|
+
case 3:
|
|
237
|
+
values = _context2.sent;
|
|
238
|
+
handleSave(values);
|
|
239
|
+
_context2.next = 9;
|
|
240
|
+
break;
|
|
241
|
+
|
|
242
|
+
case 7:
|
|
243
|
+
_context2.prev = 7;
|
|
244
|
+
_context2.t0 = _context2["catch"](0);
|
|
245
|
+
|
|
246
|
+
case 9:
|
|
247
|
+
case "end":
|
|
248
|
+
return _context2.stop();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}, _callee2, null, [[0, 7]]);
|
|
252
|
+
}));
|
|
253
|
+
|
|
254
|
+
return function handleOk() {
|
|
255
|
+
return _ref3.apply(this, arguments);
|
|
256
|
+
};
|
|
257
|
+
}();
|
|
258
|
+
|
|
259
|
+
var handleReset = function handleReset() {
|
|
260
|
+
form.resetFields();
|
|
261
|
+
|
|
262
|
+
if (onChange) {
|
|
263
|
+
onChange(form.getFieldsValue());
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
var handleAddTab = function handleAddTab() {
|
|
268
|
+
if (tabs.length > 6) {
|
|
269
|
+
message.warning('查询方案总数不可超过6个');
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
modalForm.setFieldsValue({
|
|
274
|
+
name: active === 0 ? '' : tabs[active].title
|
|
275
|
+
});
|
|
276
|
+
toggleModal();
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
var handleDelete = function handleDelete() {
|
|
280
|
+
if (active === 0) {
|
|
281
|
+
message.warning('不允许删除默认');
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
Modal.confirm({
|
|
286
|
+
title: '提示',
|
|
287
|
+
content: "\u786E\u8BA4\u5220\u9664".concat(tabs[active].title, "\uFF1F"),
|
|
288
|
+
maskClosable: true,
|
|
289
|
+
width: 300,
|
|
290
|
+
onOk: function onOk() {
|
|
291
|
+
form.setFieldsValue(tabs[active - 1].value);
|
|
292
|
+
setTabs(function (prev) {
|
|
293
|
+
var next = _toConsumableArray(prev);
|
|
294
|
+
|
|
295
|
+
next.splice(active, 1);
|
|
296
|
+
return next;
|
|
297
|
+
});
|
|
298
|
+
setActive(active - 1);
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
|
|
303
|
+
var handleTabChange = function handleTabChange(index) {
|
|
304
|
+
if (index !== active) {
|
|
305
|
+
setActive(index);
|
|
306
|
+
form.setFieldsValue(tabs[index].value);
|
|
307
|
+
handleFinish(form.getFieldsValue());
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
var handleFinish = function handleFinish(value) {
|
|
312
|
+
if (onChange) {
|
|
313
|
+
onChange(value);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
var handleActiveKey = function handleActiveKey(key, value) {
|
|
318
|
+
setActiveKeys(function (prev) {
|
|
319
|
+
var next = new Set(prev);
|
|
320
|
+
|
|
321
|
+
if (value) {
|
|
322
|
+
next.add(key);
|
|
323
|
+
} else {
|
|
324
|
+
next.delete(key);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
return next;
|
|
328
|
+
});
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
var items = useMemo(function () {
|
|
332
|
+
if (keywords) {
|
|
333
|
+
return data.filter(function (item) {
|
|
334
|
+
return item.label ? item.label.includes(keywords) : true;
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
return data;
|
|
339
|
+
}, [keywords, data]);
|
|
340
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
341
|
+
destroyOnClose: true,
|
|
342
|
+
visible: showModal,
|
|
343
|
+
onCancel: toggleModal,
|
|
344
|
+
onOk: handleOk,
|
|
345
|
+
title: "\u4FDD\u5B58\u65B9\u6848",
|
|
346
|
+
width: 300
|
|
347
|
+
}, /*#__PURE__*/React.createElement(Form, {
|
|
348
|
+
form: modalForm,
|
|
349
|
+
onFinish: handleSave,
|
|
350
|
+
initialValues: {
|
|
351
|
+
name: tabs[active].title
|
|
352
|
+
}
|
|
353
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
354
|
+
label: "\u65B9\u6848\u540D\u79F0",
|
|
355
|
+
name: "name",
|
|
356
|
+
rules: [{
|
|
357
|
+
required: true
|
|
358
|
+
}]
|
|
359
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
360
|
+
maxLength: 8,
|
|
361
|
+
autoFocus: true
|
|
362
|
+
})))), /*#__PURE__*/React.createElement(Form, {
|
|
363
|
+
initialValues: defaultValue,
|
|
364
|
+
onFinish: handleFinish,
|
|
365
|
+
form: form,
|
|
366
|
+
className: "".concat(prefixCls, "-filter"),
|
|
367
|
+
onValuesChange: handleValuesChange
|
|
368
|
+
}, /*#__PURE__*/React.createElement(Row, {
|
|
369
|
+
align: "bottom",
|
|
370
|
+
justify: "space-between",
|
|
371
|
+
wrap: false,
|
|
372
|
+
gutter: [16, 16]
|
|
373
|
+
}, /*#__PURE__*/React.createElement(Col, {
|
|
374
|
+
flex: 1
|
|
375
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
376
|
+
style: {
|
|
377
|
+
maxWidth: '1334px'
|
|
378
|
+
}
|
|
379
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
380
|
+
className: "".concat(prefixCls, "-filter-tab-bar")
|
|
381
|
+
}, tabs.map(function (item, index) {
|
|
382
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
383
|
+
className: "".concat(prefixCls, "-filter-tab").concat(active === index ? '-active' : ''),
|
|
384
|
+
key: item.title,
|
|
385
|
+
onClick: function onClick() {
|
|
386
|
+
return handleTabChange(index);
|
|
387
|
+
}
|
|
388
|
+
}, item.title);
|
|
389
|
+
})), /*#__PURE__*/React.createElement(FormLayout, {
|
|
390
|
+
direction: "row"
|
|
391
|
+
}, data.map(function (item) {
|
|
392
|
+
var visible = activeKeys.has(item.key);
|
|
393
|
+
var target = compMap.get(item.type);
|
|
394
|
+
|
|
395
|
+
if (!visible || !target) {
|
|
396
|
+
return null;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
return /*#__PURE__*/React.createElement(FormLayout.Col, {
|
|
400
|
+
span: (item.colSpan || target.colSpan || 1) * 6,
|
|
401
|
+
key: item.key
|
|
402
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
403
|
+
key: item.key,
|
|
404
|
+
name: item.key,
|
|
405
|
+
label: item.hideLabel ? undefined : item.label
|
|
406
|
+
}, target.render(item)));
|
|
407
|
+
})))), /*#__PURE__*/React.createElement(Col, null, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Button, {
|
|
408
|
+
type: "primary",
|
|
409
|
+
htmlType: "submit"
|
|
410
|
+
}, "\u67E5\u8BE2"), /*#__PURE__*/React.createElement(Dropdown, {
|
|
411
|
+
placement: "bottomRight",
|
|
412
|
+
overlay: /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
413
|
+
key: "reset",
|
|
414
|
+
onClick: handleReset
|
|
415
|
+
}, "\u91CD\u7F6E"), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
416
|
+
key: "save",
|
|
417
|
+
onClick: handleAddTab
|
|
418
|
+
}, "\u4FDD\u5B58\u65B9\u6848"), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
419
|
+
key: "delete",
|
|
420
|
+
onClick: handleDelete
|
|
421
|
+
}, "\u5220\u9664\u65B9\u6848"))
|
|
422
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
423
|
+
style: {
|
|
424
|
+
padding: '4px 8px'
|
|
425
|
+
}
|
|
426
|
+
}, /*#__PURE__*/React.createElement(EllipsisOutlined, null))), /*#__PURE__*/React.createElement(Popover, {
|
|
427
|
+
trigger: "click",
|
|
428
|
+
overlayClassName: "".concat(prefixCls, "-filter-popover"),
|
|
429
|
+
destroyTooltipOnHide: true,
|
|
430
|
+
content: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Input, {
|
|
431
|
+
placeholder: "\u641C\u7D22\u9009\u9879",
|
|
432
|
+
allowClear: true,
|
|
433
|
+
className: "".concat(prefixCls, "-filter-items-search"),
|
|
434
|
+
suffix: /*#__PURE__*/React.createElement(Search, {
|
|
435
|
+
style: {
|
|
436
|
+
color: '#686868'
|
|
437
|
+
}
|
|
438
|
+
}),
|
|
439
|
+
onChange: function onChange(e) {
|
|
440
|
+
return handleChangeKeywords(e.currentTarget.value);
|
|
441
|
+
}
|
|
442
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
443
|
+
className: "".concat(prefixCls, "-filter-items")
|
|
444
|
+
}, items.length > 0 ? items.map(function (item) {
|
|
445
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
446
|
+
key: item.key,
|
|
447
|
+
className: "".concat(prefixCls, "-filter-item")
|
|
448
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
449
|
+
checked: activeKeys.has(item.key),
|
|
450
|
+
onChange: function onChange(e) {
|
|
451
|
+
handleActiveKey(item.key, e.target.checked);
|
|
452
|
+
}
|
|
453
|
+
}, item.label));
|
|
454
|
+
}) : /*#__PURE__*/React.createElement(Empty, {
|
|
455
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
456
|
+
}))),
|
|
457
|
+
placement: "bottomRight"
|
|
458
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
459
|
+
style: {
|
|
460
|
+
padding: '4px 8px'
|
|
461
|
+
},
|
|
462
|
+
onClick: function onClick() {
|
|
463
|
+
setKeywords('');
|
|
464
|
+
}
|
|
465
|
+
}, /*#__PURE__*/React.createElement(UnorderedListOutlined, null))))))));
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
Filter.setComponents = setComponents;
|
|
469
|
+
export default Filter;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@import '../theme.less';
|
|
2
|
+
|
|
3
|
+
.@{prefixCls}-filter {
|
|
4
|
+
&-tab {
|
|
5
|
+
height: 100%;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
|
|
8
|
+
&-bar {
|
|
9
|
+
display: flex;
|
|
10
|
+
height: 25px;
|
|
11
|
+
margin-bottom: 16px;
|
|
12
|
+
line-height: 1;
|
|
13
|
+
|
|
14
|
+
& > div + div {
|
|
15
|
+
margin-left: 32px;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-active {
|
|
20
|
+
position: relative;
|
|
21
|
+
color: .primary(1) [];
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
|
|
24
|
+
&::after {
|
|
25
|
+
position: absolute;
|
|
26
|
+
bottom: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
display: block;
|
|
29
|
+
width: 100%;
|
|
30
|
+
height: 2px;
|
|
31
|
+
background-color: .primary(1) [];
|
|
32
|
+
content: '';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&-popover {
|
|
38
|
+
width: 227px;
|
|
39
|
+
|
|
40
|
+
.ant-popover-arrow {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.ant-popover-inner {
|
|
45
|
+
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.15);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.ant-popover-inner-content {
|
|
49
|
+
padding: 4px 5px 16px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&-items-search.ant-input-affix-wrapper {
|
|
54
|
+
height: 40px;
|
|
55
|
+
background-color: #f7f6f6;
|
|
56
|
+
border: none;
|
|
57
|
+
outline: none;
|
|
58
|
+
box-shadow: none;
|
|
59
|
+
|
|
60
|
+
input {
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&-items {
|
|
66
|
+
max-height: 400px;
|
|
67
|
+
padding: 0 20px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
&-item {
|
|
71
|
+
margin-top: 16px;
|
|
72
|
+
|
|
73
|
+
.ant-checkbox-wrapper {
|
|
74
|
+
color: #888;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { FormInstance } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface FilterItemType {
|
|
5
|
+
key: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
type: string;
|
|
8
|
+
colSpan?: number;
|
|
9
|
+
hideLabel?: boolean;
|
|
10
|
+
extraProps?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface FilterProps<T extends Record<string, any> = Record<string, any>> {
|
|
14
|
+
data: FilterItemType[];
|
|
15
|
+
defaultValue?: T;
|
|
16
|
+
value?: T;
|
|
17
|
+
onChange?: (value: T) => void;
|
|
18
|
+
onValuesChange?: (changedValues: Partial<T>, allValues: T, form: FormInstance<T>) => void;
|
|
19
|
+
defaultActiveKeys?: string[];
|
|
20
|
+
storageKey?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ComponentOption {
|
|
24
|
+
type: string;
|
|
25
|
+
colSpan?: number;
|
|
26
|
+
render: (item: FilterItemType) => ReactNode;
|
|
27
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode, CSSProperties } from 'react';
|
|
3
|
+
interface Props {
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
/**
|
|
6
|
+
* @description 布局类型
|
|
7
|
+
* 栅格系统同antd,总计24列,默认占8列
|
|
8
|
+
* flex 弹性型,默认占24列
|
|
9
|
+
* @default default
|
|
10
|
+
*/
|
|
11
|
+
layout?: 'default' | 'flex';
|
|
12
|
+
/**
|
|
13
|
+
* @description 布局的方向
|
|
14
|
+
* row 沿水平方向排列,类似于inline类型的Form,宽度不足会自动换行;
|
|
15
|
+
* column 沿垂直方向排列,类似于horizontal类型的Form;
|
|
16
|
+
* @default column
|
|
17
|
+
*/
|
|
18
|
+
direction?: 'row' | 'column';
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
declare function FormLayout(props: Props): JSX.Element;
|
|
23
|
+
declare namespace FormLayout {
|
|
24
|
+
var Row: React.FC<{
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
var Col: React.FC<{
|
|
28
|
+
span?: number | undefined;
|
|
29
|
+
children?: React.ReactNode;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
export default FormLayout;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
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; }
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import classNames from 'classnames';
|
|
5
|
+
import { PREFIX_CLS } from '../constants';
|
|
6
|
+
|
|
7
|
+
var FormRow = function FormRow(props) {
|
|
8
|
+
var children = props.children;
|
|
9
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
10
|
+
className: classNames("".concat(PREFIX_CLS, "-form-row"))
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var FormCol = function FormCol(props) {
|
|
15
|
+
var span = props.span,
|
|
16
|
+
children = props.children;
|
|
17
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
18
|
+
className: classNames("".concat(PREFIX_CLS, "-form-col"), _defineProperty({}, "".concat(PREFIX_CLS, "-form-col-").concat(span), span !== undefined))
|
|
19
|
+
}, children);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
function FormLayout(props) {
|
|
23
|
+
var _props$direction = props.direction,
|
|
24
|
+
direction = _props$direction === void 0 ? 'column' : _props$direction,
|
|
25
|
+
children = props.children,
|
|
26
|
+
style = props.style,
|
|
27
|
+
className = props.className,
|
|
28
|
+
layout = props.layout;
|
|
29
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
30
|
+
className: classNames("".concat(PREFIX_CLS, "-form-layout"), _defineProperty({}, "".concat(PREFIX_CLS, "-form-layout-flex"), layout === 'flex'), className),
|
|
31
|
+
style: style
|
|
32
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: "".concat(PREFIX_CLS, "-form-layout-").concat(direction)
|
|
34
|
+
}, children));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
FormCol.displayName = 'FormCol';
|
|
38
|
+
FormRow.displayName = 'FormRow';
|
|
39
|
+
FormLayout.Row = FormRow;
|
|
40
|
+
FormLayout.Col = FormCol;
|
|
41
|
+
export default FormLayout;
|