@lemon-fe/components 0.0.27 → 0.1.0-alpha.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/es/Actions/index.d.ts +3 -2
- package/es/Actions/index.js +10 -17
- package/es/Actions/index.less +9 -34
- package/es/BaseTable/ResizeHeaderCell.js +16 -5
- package/es/BaseTable/index.js +69 -17
- package/es/BaseTable/index.less +43 -0
- package/es/BaseTable/typings.d.ts +7 -0
- package/es/Filter/index.js +97 -35
- package/es/Filter/index.less +11 -7
- package/es/Filter/typings.d.ts +3 -2
- package/es/Icons/Down.js +11 -5
- package/es/Icons/Search.js +8 -12
- package/es/Layout/index.js +80 -3
- package/es/Layout/index.less +73 -25
- package/es/Portal/index.d.ts +12 -0
- package/es/Portal/index.js +72 -0
- package/es/Section/TabBar.d.ts +12 -0
- package/es/Section/TabBar.js +48 -0
- package/es/Section/index.js +38 -53
- package/es/Section/index.less +44 -91
- package/es/SiderTree/TreeNodeTitle.d.ts +1 -1
- package/es/SiderTree/TreeNodeTitle.js +17 -35
- package/es/SiderTree/index.d.ts +3 -1
- package/es/SiderTree/index.js +40 -64
- package/es/SiderTree/index.less +66 -73
- package/es/TabBar/index.d.ts +14 -0
- package/es/TabBar/index.js +52 -0
- package/es/TabBar/index.less +31 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/index.less +91 -2
- package/es/init.js +12 -16
- package/es/utils.d.ts +2 -0
- package/es/utils.js +14 -0
- package/package.json +3 -3
- package/es/BaseTable/Sort.d.ts +0 -10
- package/es/BaseTable/Sort.js +0 -122
package/es/Actions/index.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ import type { CSSProperties } from 'react';
|
|
|
3
3
|
import { ButtonProps } from 'antd';
|
|
4
4
|
interface ActionBtn extends ButtonProps {
|
|
5
5
|
text: string | ReactElement;
|
|
6
|
+
onClick?: () => void;
|
|
6
7
|
/**
|
|
7
|
-
* deprecated
|
|
8
|
+
* @deprecated
|
|
9
|
+
* 请不要使用
|
|
8
10
|
*/
|
|
9
11
|
action?: () => void;
|
|
10
|
-
onClick?: () => void;
|
|
11
12
|
dropDown?: ({
|
|
12
13
|
text: string;
|
|
13
14
|
onClick: () => void;
|
package/es/Actions/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["disabled", "dropDown", "text", "
|
|
1
|
+
var _excluded = ["disabled", "dropDown", "text", "onClick", "icon", "action"];
|
|
2
2
|
|
|
3
3
|
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; }
|
|
4
4
|
|
|
@@ -65,9 +65,9 @@ function Actions(props) {
|
|
|
65
65
|
var disabled = item.disabled,
|
|
66
66
|
dropDown = item.dropDown,
|
|
67
67
|
text = item.text,
|
|
68
|
-
action = item.action,
|
|
69
68
|
onClick = item.onClick,
|
|
70
69
|
icon = item.icon,
|
|
70
|
+
action = item.action,
|
|
71
71
|
rest = _objectWithoutProperties(item, _excluded);
|
|
72
72
|
|
|
73
73
|
if ( /*#__PURE__*/React.isValidElement(text)) {
|
|
@@ -94,13 +94,11 @@ function Actions(props) {
|
|
|
94
94
|
if (handleClick !== undefined) {
|
|
95
95
|
return /*#__PURE__*/React.createElement(Dropdown.Button, {
|
|
96
96
|
key: text,
|
|
97
|
-
type: 'text',
|
|
98
97
|
disabled: disabled,
|
|
99
98
|
overlay: overlay,
|
|
100
|
-
onClick: handleClick
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}, icon) : null, text);
|
|
99
|
+
onClick: handleClick,
|
|
100
|
+
icon: icon
|
|
101
|
+
}, text);
|
|
104
102
|
}
|
|
105
103
|
|
|
106
104
|
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
@@ -109,20 +107,16 @@ function Actions(props) {
|
|
|
109
107
|
overlay: overlay
|
|
110
108
|
}, /*#__PURE__*/React.createElement(Button, _objectSpread({
|
|
111
109
|
disabled: disabled,
|
|
112
|
-
|
|
113
|
-
}, rest),
|
|
114
|
-
className: "".concat(prefixCls, "-actions-icon")
|
|
115
|
-
}, icon) : null, text, /*#__PURE__*/React.createElement(Down, null)));
|
|
110
|
+
icon: icon
|
|
111
|
+
}, rest), text, /*#__PURE__*/React.createElement(Down, null)));
|
|
116
112
|
}
|
|
117
113
|
|
|
118
|
-
return /*#__PURE__*/React.createElement(Button, {
|
|
114
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread({
|
|
119
115
|
key: text,
|
|
120
116
|
disabled: disabled,
|
|
121
117
|
onClick: handleClick,
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
-
className: "".concat(prefixCls, "-actions-icon")
|
|
125
|
-
}, icon) : null, text);
|
|
118
|
+
icon: icon
|
|
119
|
+
}, rest), text);
|
|
126
120
|
}), collapsedBtns.length > 0 ? /*#__PURE__*/React.createElement(Popover, {
|
|
127
121
|
placement: "bottomRight",
|
|
128
122
|
overlayClassName: "".concat(prefixCls, "-actions-popover"),
|
|
@@ -161,7 +155,6 @@ function Actions(props) {
|
|
|
161
155
|
}, item.text);
|
|
162
156
|
}))
|
|
163
157
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
164
|
-
type: "text",
|
|
165
158
|
icon: /*#__PURE__*/React.createElement(EllipsisOutlined, null)
|
|
166
159
|
})) : null));
|
|
167
160
|
}
|
package/es/Actions/index.less
CHANGED
|
@@ -51,45 +51,20 @@
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
.ant-btn {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
border-radius: 2px;
|
|
54
|
+
.ant-btn:not(.ant-btn-icon-only) {
|
|
55
|
+
min-width: 80px;
|
|
56
|
+
padding: 4px 12px;
|
|
58
57
|
}
|
|
59
58
|
|
|
60
|
-
.ant-
|
|
61
|
-
|
|
62
|
-
padding-left: 4px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.ant-btn-text {
|
|
66
|
-
display: inline-flex;
|
|
67
|
-
align-items: center;
|
|
68
|
-
|
|
69
|
-
&:not(:disabled) {
|
|
70
|
-
color: rgba(51, 51, 51, 0.65);
|
|
71
|
-
|
|
72
|
-
&:hover {
|
|
73
|
-
background: rgba(0, 0, 0, 0.08);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
59
|
+
.ant-btn-default:not(:disabled) {
|
|
60
|
+
background-color: #fff;
|
|
77
61
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
font-size: 20px;
|
|
81
|
-
line-height: 1;
|
|
82
|
-
|
|
83
|
-
svg > use {
|
|
84
|
-
color: .primary() [rgb];
|
|
85
|
-
fill: #595959;
|
|
62
|
+
.anticon {
|
|
63
|
+
color: rgba(51, 51, 51, 0.7);
|
|
86
64
|
}
|
|
87
|
-
}
|
|
88
65
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
color: inherit;
|
|
92
|
-
fill: currentColor;
|
|
66
|
+
&:hover .anticon {
|
|
67
|
+
color: var(--ant-primary-color);
|
|
93
68
|
}
|
|
94
69
|
}
|
|
95
70
|
}
|
|
@@ -36,13 +36,24 @@ export default function ResizeHeaderCell(props) {
|
|
|
36
36
|
setSize(width);
|
|
37
37
|
}, [width]);
|
|
38
38
|
|
|
39
|
+
var getTable = function getTable() {
|
|
40
|
+
if (fullTableRef.current === null) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return fullTableRef.current.querySelector('.ant-table');
|
|
45
|
+
};
|
|
46
|
+
|
|
39
47
|
var handleResizeStart = function handleResizeStart() {
|
|
40
|
-
var
|
|
48
|
+
var table = getTable();
|
|
49
|
+
|
|
50
|
+
if (table === null) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
41
53
|
|
|
42
54
|
var elm = document.createElement('div');
|
|
43
|
-
elm.style.height = "".concat(
|
|
55
|
+
elm.style.height = "".concat(table.offsetHeight || 0, "px");
|
|
44
56
|
elm.classList.add("".concat(prefixCls, "-resizable-indicator"));
|
|
45
|
-
var table = fullTableRef.current;
|
|
46
57
|
|
|
47
58
|
if (table) {
|
|
48
59
|
table.appendChild(elm);
|
|
@@ -73,9 +84,9 @@ export default function ResizeHeaderCell(props) {
|
|
|
73
84
|
};
|
|
74
85
|
|
|
75
86
|
var handleResizeStop = function handleResizeStop() {
|
|
76
|
-
var table =
|
|
87
|
+
var table = getTable();
|
|
77
88
|
|
|
78
|
-
if (table && indicator.current) {
|
|
89
|
+
if (table !== null && indicator.current !== undefined) {
|
|
79
90
|
table.removeChild(indicator.current);
|
|
80
91
|
table.classList.remove("".concat(prefixCls, "-resizing-col"));
|
|
81
92
|
|
package/es/BaseTable/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
var _excluded = ["onWidthChange", "width", "fullTableRef"],
|
|
2
|
-
_excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "onChange", "rowHeight", "tableLayout"];
|
|
2
|
+
_excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "onChange", "rowHeight", "tableLayout", "rowActions"];
|
|
3
3
|
|
|
4
4
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
5
5
|
|
|
@@ -9,6 +9,8 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
9
9
|
|
|
10
10
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
11
11
|
|
|
12
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
13
|
+
|
|
12
14
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
15
|
|
|
14
16
|
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."); }
|
|
@@ -35,7 +37,7 @@ import React, { useMemo, useState, useEffect, useRef } from 'react';
|
|
|
35
37
|
import { Table as AntdTable } from 'antd';
|
|
36
38
|
import { get } from 'lodash';
|
|
37
39
|
import { useThrottle } from '@lemon-fe/hooks';
|
|
38
|
-
import { isColumnType, getColumnKey
|
|
40
|
+
import { isColumnType, getColumnKey } from './utils';
|
|
39
41
|
import ResizeHeaderCell from './ResizeHeaderCell';
|
|
40
42
|
import { PREFIX_CLS } from '../constants';
|
|
41
43
|
import VirtualList from './VirtualBody';
|
|
@@ -98,12 +100,10 @@ function BaseTable(props) {
|
|
|
98
100
|
rowHeight = props.rowHeight,
|
|
99
101
|
_props$tableLayout = props.tableLayout,
|
|
100
102
|
tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
|
|
103
|
+
rowActions = props.rowActions,
|
|
101
104
|
restProps = _objectWithoutProperties(props, _excluded2);
|
|
102
105
|
|
|
103
106
|
var fullTableRef = useRef(null);
|
|
104
|
-
var tableID = useMemo(function () {
|
|
105
|
-
return id || randomStr();
|
|
106
|
-
}, [id]);
|
|
107
107
|
|
|
108
108
|
var _useState = useState(0),
|
|
109
109
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -115,22 +115,21 @@ function BaseTable(props) {
|
|
|
115
115
|
colsState = _useState4[0],
|
|
116
116
|
setColsState = _useState4[1];
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, [tableID]);
|
|
118
|
+
var actions = useRef(rowActions);
|
|
119
|
+
actions.current = rowActions;
|
|
121
120
|
/** auto scroll y */
|
|
122
121
|
|
|
123
122
|
var calcScrollY = function calcScrollY() {
|
|
124
|
-
var
|
|
123
|
+
var wrapper = fullTableRef.current;
|
|
125
124
|
|
|
126
|
-
if (
|
|
125
|
+
if (wrapper === null) {
|
|
127
126
|
return null;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
var
|
|
131
|
-
var tableBody =
|
|
129
|
+
var table = wrapper.querySelector('.ant-table');
|
|
130
|
+
var tableBody = wrapper.querySelector('.ant-table-body');
|
|
132
131
|
|
|
133
|
-
if (tableBody === null ||
|
|
132
|
+
if (tableBody === null || table === null) {
|
|
134
133
|
return null;
|
|
135
134
|
}
|
|
136
135
|
|
|
@@ -165,13 +164,38 @@ function BaseTable(props) {
|
|
|
165
164
|
};
|
|
166
165
|
|
|
167
166
|
var changeScrollY = useThrottle(function () {
|
|
167
|
+
var nextScrollY = scrollY;
|
|
168
|
+
|
|
168
169
|
if ((scroll === null || scroll === void 0 ? void 0 : scroll.y) === true) {
|
|
169
170
|
var y = calcScrollY();
|
|
170
|
-
|
|
171
|
+
nextScrollY = y || undefined;
|
|
171
172
|
} else {
|
|
172
|
-
|
|
173
|
+
nextScrollY = scroll === null || scroll === void 0 ? void 0 : scroll.y;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
setScrollY(nextScrollY);
|
|
177
|
+
|
|
178
|
+
if (fullTableRef.current !== null) {
|
|
179
|
+
var body = fullTableRef.current.querySelector('.ant-table-body');
|
|
180
|
+
|
|
181
|
+
if (body !== null) {
|
|
182
|
+
var dataType = _typeof(nextScrollY);
|
|
183
|
+
|
|
184
|
+
switch (dataType) {
|
|
185
|
+
case 'string':
|
|
186
|
+
body.style.height = nextScrollY;
|
|
187
|
+
break;
|
|
188
|
+
|
|
189
|
+
case 'number':
|
|
190
|
+
body.style.height = nextScrollY + 'px';
|
|
191
|
+
break;
|
|
192
|
+
|
|
193
|
+
default:
|
|
194
|
+
body.style.height = 'auto';
|
|
195
|
+
}
|
|
196
|
+
}
|
|
173
197
|
}
|
|
174
|
-
},
|
|
198
|
+
}, 100, {
|
|
175
199
|
trailing: true
|
|
176
200
|
});
|
|
177
201
|
useEffect(function () {
|
|
@@ -279,6 +303,34 @@ function BaseTable(props) {
|
|
|
279
303
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
280
304
|
formatedColumns = _useMemo2[0],
|
|
281
305
|
flattenColumns = _useMemo2[1];
|
|
306
|
+
/** row actions */
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
if (rowActions !== undefined && rowActions.length > 0) {
|
|
310
|
+
var actionCol = {
|
|
311
|
+
title: '',
|
|
312
|
+
className: "".concat(PREFIX_CLS, "-table-operator-column"),
|
|
313
|
+
width: 1,
|
|
314
|
+
fixed: 'right',
|
|
315
|
+
render: function render(_, row, index) {
|
|
316
|
+
var _actions$current;
|
|
317
|
+
|
|
318
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
319
|
+
className: "".concat(PREFIX_CLS, "-table-operator")
|
|
320
|
+
}, (_actions$current = actions.current) === null || _actions$current === void 0 ? void 0 : _actions$current.map(function (item) {
|
|
321
|
+
return /*#__PURE__*/React.createElement("button", {
|
|
322
|
+
className: "".concat(PREFIX_CLS, "-table-operator-item"),
|
|
323
|
+
key: item.title,
|
|
324
|
+
onClick: function onClick() {
|
|
325
|
+
item.onClick(row, index);
|
|
326
|
+
}
|
|
327
|
+
}, item.title);
|
|
328
|
+
}));
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
formatedColumns.push(actionCol);
|
|
332
|
+
flattenColumns.push(actionCol);
|
|
333
|
+
}
|
|
282
334
|
/** virtualize scroll */
|
|
283
335
|
|
|
284
336
|
|
|
@@ -341,7 +393,7 @@ function BaseTable(props) {
|
|
|
341
393
|
value: ctx
|
|
342
394
|
}, /*#__PURE__*/React.createElement(AntdTable, _objectSpread(_objectSpread({
|
|
343
395
|
size: "small",
|
|
344
|
-
|
|
396
|
+
ref: fullTableRef,
|
|
345
397
|
columns: formatedColumns,
|
|
346
398
|
dataSource: dataSource,
|
|
347
399
|
rowKey: rowKey,
|
package/es/BaseTable/index.less
CHANGED
|
@@ -49,6 +49,49 @@
|
|
|
49
49
|
color: @text-color;
|
|
50
50
|
font-size: @font-size-base;
|
|
51
51
|
|
|
52
|
+
.ant-table-tbody > tr:hover > td > &-operator {
|
|
53
|
+
display: flex;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&-operator {
|
|
57
|
+
position: absolute;
|
|
58
|
+
top: 0;
|
|
59
|
+
right: 0;
|
|
60
|
+
z-index: 10;
|
|
61
|
+
display: none;
|
|
62
|
+
align-items: center;
|
|
63
|
+
justify-content: flex-end;
|
|
64
|
+
height: 100%;
|
|
65
|
+
padding: 0 !important;
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
background-color: @table-row-hover-bg;
|
|
68
|
+
|
|
69
|
+
&-column::after {
|
|
70
|
+
display: none !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&-item {
|
|
74
|
+
margin-right: 8px;
|
|
75
|
+
padding: 0 8px;
|
|
76
|
+
color: @primary-color;
|
|
77
|
+
line-height: 28px;
|
|
78
|
+
background-color: transparent;
|
|
79
|
+
border: none;
|
|
80
|
+
border-radius: 4px;
|
|
81
|
+
outline: none;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
user-select: none;
|
|
84
|
+
|
|
85
|
+
&:hover {
|
|
86
|
+
background-color: .primary(0.12) [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
&:active {
|
|
90
|
+
color: .primary(0.8) [];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
52
95
|
&-resizable-handle {
|
|
53
96
|
position: absolute;
|
|
54
97
|
top: 50%;
|
|
@@ -29,4 +29,11 @@ export interface BaseTableProps<T> extends Omit<TableProps<T>, 'columns' | 'scro
|
|
|
29
29
|
x?: number | string | true;
|
|
30
30
|
y?: number | string | true;
|
|
31
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @description 行操作按钮组
|
|
34
|
+
*/
|
|
35
|
+
rowActions?: {
|
|
36
|
+
title: string;
|
|
37
|
+
onClick: (row: T, index: number) => void;
|
|
38
|
+
}[];
|
|
32
39
|
}
|
package/es/Filter/index.js
CHANGED
|
@@ -29,18 +29,28 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
29
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
30
|
|
|
31
31
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
32
|
-
import { Button,
|
|
33
|
-
import { EllipsisOutlined
|
|
32
|
+
import { Button, Checkbox, Form, Input, Popover, Space, Dropdown, Menu, Modal, message, Select, Empty, InputNumber } from 'antd';
|
|
33
|
+
import { EllipsisOutlined } from '@ant-design/icons';
|
|
34
34
|
import { useDebounce, useRequest } from '@lemon-fe/hooks';
|
|
35
35
|
import Search from '../Icons/Search';
|
|
36
36
|
import DurationPicker from '../DurationPicker';
|
|
37
37
|
import FormLayout from '../FormLayout';
|
|
38
38
|
import { PREFIX_CLS } from '../constants';
|
|
39
|
+
import TabBar from '../TabBar';
|
|
39
40
|
var components = [{
|
|
40
41
|
type: 'input',
|
|
41
42
|
render: function render(item) {
|
|
42
43
|
return /*#__PURE__*/React.createElement(Input, _objectSpread({}, item.extraProps));
|
|
43
44
|
}
|
|
45
|
+
}, {
|
|
46
|
+
type: 'input-number',
|
|
47
|
+
render: function render(item) {
|
|
48
|
+
return /*#__PURE__*/React.createElement(InputNumber, _objectSpread({
|
|
49
|
+
style: {
|
|
50
|
+
width: '100%'
|
|
51
|
+
}
|
|
52
|
+
}, item.extraProps));
|
|
53
|
+
}
|
|
44
54
|
}, {
|
|
45
55
|
type: 'select',
|
|
46
56
|
render: function render(item) {
|
|
@@ -77,7 +87,8 @@ function Filter(props) {
|
|
|
77
87
|
value = props.value,
|
|
78
88
|
defaultActiveKeys = props.defaultActiveKeys,
|
|
79
89
|
storageKey = props.storageKey,
|
|
80
|
-
onValuesChange = props.onValuesChange
|
|
90
|
+
onValuesChange = props.onValuesChange,
|
|
91
|
+
style = props.style;
|
|
81
92
|
var prefixCls = PREFIX_CLS;
|
|
82
93
|
var defaultValue = useMemo(function () {
|
|
83
94
|
return defaultValueProp || value;
|
|
@@ -337,6 +348,15 @@ function Filter(props) {
|
|
|
337
348
|
|
|
338
349
|
return data;
|
|
339
350
|
}, [keywords, data]);
|
|
351
|
+
|
|
352
|
+
var getColStyle = function getColStyle() {
|
|
353
|
+
var colSpan = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
|
354
|
+
return {
|
|
355
|
+
width: colSpan * 348,
|
|
356
|
+
padding: '0 8px'
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
|
|
340
360
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Modal, {
|
|
341
361
|
destroyOnClose: true,
|
|
342
362
|
visible: showModal,
|
|
@@ -364,29 +384,16 @@ function Filter(props) {
|
|
|
364
384
|
onFinish: handleFinish,
|
|
365
385
|
form: form,
|
|
366
386
|
className: "".concat(prefixCls, "-filter"),
|
|
367
|
-
onValuesChange: handleValuesChange
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
376
|
-
style: {
|
|
377
|
-
maxWidth: '1334px'
|
|
378
|
-
}
|
|
379
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
387
|
+
onValuesChange: handleValuesChange,
|
|
388
|
+
style: style
|
|
389
|
+
}, /*#__PURE__*/React.createElement(TabBar, {
|
|
390
|
+
tabs: tabs,
|
|
391
|
+
activeKey: tabs[active].title,
|
|
392
|
+
onTabClick: function onTabClick(_, index) {
|
|
393
|
+
return handleTabChange(index);
|
|
394
|
+
},
|
|
380
395
|
className: "".concat(prefixCls, "-filter-tab-bar")
|
|
381
|
-
},
|
|
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, {
|
|
396
|
+
}), /*#__PURE__*/React.createElement(FormLayout, {
|
|
390
397
|
direction: "row"
|
|
391
398
|
}, data.map(function (item) {
|
|
392
399
|
var visible = activeKeys.has(item.key);
|
|
@@ -396,18 +403,22 @@ function Filter(props) {
|
|
|
396
403
|
return null;
|
|
397
404
|
}
|
|
398
405
|
|
|
399
|
-
return /*#__PURE__*/React.createElement(
|
|
400
|
-
|
|
406
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
407
|
+
style: getColStyle(item.colSpan || target.colSpan),
|
|
401
408
|
key: item.key
|
|
402
409
|
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
403
410
|
key: item.key,
|
|
404
411
|
name: item.key,
|
|
405
412
|
label: item.hideLabel ? undefined : item.label
|
|
406
413
|
}, target.render(item)));
|
|
407
|
-
})
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
414
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
415
|
+
style: getColStyle()
|
|
416
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
417
|
+
label: /*#__PURE__*/React.createElement(Button, {
|
|
418
|
+
type: "primary",
|
|
419
|
+
htmlType: "submit"
|
|
420
|
+
}, "\u67E5\u8BE2")
|
|
421
|
+
}, /*#__PURE__*/React.createElement(Space, null, /*#__PURE__*/React.createElement(Dropdown, {
|
|
411
422
|
placement: "bottomRight",
|
|
412
423
|
overlay: /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
413
424
|
key: "reset",
|
|
@@ -456,13 +467,64 @@ function Filter(props) {
|
|
|
456
467
|
}))),
|
|
457
468
|
placement: "bottomRight"
|
|
458
469
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
459
|
-
|
|
460
|
-
padding: '4px 8px'
|
|
461
|
-
},
|
|
470
|
+
className: "".concat(prefixCls, "-filter-btn"),
|
|
462
471
|
onClick: function onClick() {
|
|
463
472
|
setKeywords('');
|
|
464
473
|
}
|
|
465
|
-
}, /*#__PURE__*/React.createElement(
|
|
474
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
475
|
+
width: "18",
|
|
476
|
+
height: "18",
|
|
477
|
+
viewBox: "0 0 18 18",
|
|
478
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
479
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
480
|
+
transform: "translate(2 2)",
|
|
481
|
+
fill: "none",
|
|
482
|
+
fillRule: "evenodd"
|
|
483
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
484
|
+
fillOpacity: ".65",
|
|
485
|
+
fill: "currentColor",
|
|
486
|
+
y: "4",
|
|
487
|
+
width: "14",
|
|
488
|
+
height: "1.5",
|
|
489
|
+
rx: ".75"
|
|
490
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
491
|
+
fillOpacity: ".65",
|
|
492
|
+
fill: "currentColor",
|
|
493
|
+
y: "8",
|
|
494
|
+
width: "6",
|
|
495
|
+
height: "1.5",
|
|
496
|
+
rx: ".75"
|
|
497
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
498
|
+
fillOpacity: ".65",
|
|
499
|
+
fill: "currentColor",
|
|
500
|
+
y: "12",
|
|
501
|
+
width: "6",
|
|
502
|
+
height: "1.5",
|
|
503
|
+
rx: ".75"
|
|
504
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
505
|
+
fillOpacity: ".65",
|
|
506
|
+
fill: "currentColor",
|
|
507
|
+
width: "14",
|
|
508
|
+
height: "1.5",
|
|
509
|
+
rx: ".75"
|
|
510
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
511
|
+
transform: "rotate(-45 15.45 -2.157)"
|
|
512
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
513
|
+
strokeOpacity: ".65",
|
|
514
|
+
stroke: "currentColor",
|
|
515
|
+
strokeWidth: "1.5",
|
|
516
|
+
cx: "3",
|
|
517
|
+
cy: "3",
|
|
518
|
+
r: "2.25"
|
|
519
|
+
}), /*#__PURE__*/React.createElement("rect", {
|
|
520
|
+
strokeOpacity: ".65",
|
|
521
|
+
stroke: "currentColor",
|
|
522
|
+
x: "2.75",
|
|
523
|
+
y: "5.5",
|
|
524
|
+
width: "1",
|
|
525
|
+
height: "2",
|
|
526
|
+
rx: ".5"
|
|
527
|
+
}))))))))))));
|
|
466
528
|
}
|
|
467
529
|
|
|
468
530
|
Filter.setComponents = setComponents;
|
package/es/Filter/index.less
CHANGED
|
@@ -6,14 +6,7 @@
|
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
|
|
8
8
|
&-bar {
|
|
9
|
-
display: flex;
|
|
10
|
-
height: 25px;
|
|
11
9
|
margin-bottom: 16px;
|
|
12
|
-
line-height: 1;
|
|
13
|
-
|
|
14
|
-
& > div + div {
|
|
15
|
-
margin-left: 32px;
|
|
16
|
-
}
|
|
17
10
|
}
|
|
18
11
|
|
|
19
12
|
&-active {
|
|
@@ -34,8 +27,19 @@
|
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
29
|
|
|
30
|
+
&-btn {
|
|
31
|
+
padding: 6px;
|
|
32
|
+
|
|
33
|
+
& > svg {
|
|
34
|
+
display: block;
|
|
35
|
+
width: 18px;
|
|
36
|
+
height: 18px;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
37
40
|
&-popover {
|
|
38
41
|
width: 227px;
|
|
42
|
+
padding-top: 0;
|
|
39
43
|
|
|
40
44
|
.ant-popover-arrow {
|
|
41
45
|
display: none;
|
package/es/Filter/typings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FormInstance } from 'antd';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import type { FormInstance } from 'antd';
|
|
2
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
export interface FilterItemType {
|
|
5
5
|
key: string;
|
|
@@ -18,6 +18,7 @@ export interface FilterProps<T extends Record<string, any> = Record<string, any>
|
|
|
18
18
|
onValuesChange?: (changedValues: Partial<T>, allValues: T, form: FormInstance<T>) => void;
|
|
19
19
|
defaultActiveKeys?: string[];
|
|
20
20
|
storageKey?: string;
|
|
21
|
+
style?: CSSProperties;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export interface ComponentOption {
|
package/es/Icons/Down.js
CHANGED
|
@@ -9,14 +9,20 @@ import Icon from '@ant-design/icons';
|
|
|
9
9
|
|
|
10
10
|
var DownSvg = function DownSvg(props) {
|
|
11
11
|
return /*#__PURE__*/React.createElement("svg", _objectSpread({
|
|
12
|
-
width: "
|
|
13
|
-
height: "
|
|
12
|
+
width: "16",
|
|
13
|
+
height: "16",
|
|
14
14
|
viewBox: "0 0 16 16",
|
|
15
15
|
xmlns: "http://www.w3.org/2000/svg"
|
|
16
16
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
17
|
-
d: "
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d: "M3.757 5.757 8 10l4.243-4.243",
|
|
18
|
+
stroke: "currentColor",
|
|
19
|
+
strokeWidth: "1.5",
|
|
20
|
+
opacity: ".7",
|
|
21
|
+
strokeLinecap: "round",
|
|
22
|
+
strokeLinejoin: "round",
|
|
23
|
+
strokeDasharray: "0,0",
|
|
24
|
+
fill: "none",
|
|
25
|
+
fillRule: "evenodd"
|
|
20
26
|
}));
|
|
21
27
|
};
|
|
22
28
|
|