@teamix/pro 1.2.18 → 1.2.22
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/dist/212.js +49 -49
- package/dist/pro.css +1 -1
- package/dist/pro.js +3581 -990
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +2 -1
- package/es/actions/base.js +1 -1
- package/es/actions/danger-pop-confirm.d.ts +5 -0
- package/es/actions/danger-pop-confirm.js +10 -0
- package/es/actions/dialog.d.ts +1 -1
- package/es/actions/dialog.js +42 -55
- package/es/actions/index.d.ts +13 -0
- package/es/actions/index.js +21 -16
- package/es/actions/pop-confirm.d.ts +9 -0
- package/es/actions/pop-confirm.js +9 -0
- package/es/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/es/form/Components/LightFilter/componentMap.js +4 -2
- package/es/form/Components/LightFilter/index.d.ts +1 -0
- package/es/form/Components/LightFilter/index.js +34 -16
- package/es/form/Components/LightFilter/index.scss +14 -4
- package/es/form/Filter/AdvancedFilter.d.ts +7 -0
- package/es/form/Filter/AdvancedFilter.js +114 -0
- package/es/form/Filter/LightFilter.d.ts +7 -0
- package/es/form/Filter/LightFilter.js +79 -0
- package/es/form/Filter/SimpleFilter.d.ts +7 -0
- package/es/form/Filter/SimpleFilter.js +74 -0
- package/es/form/Filter/index2.js +288 -235
- package/es/form/Filter/index2.scss +3 -0
- package/es/form/ProForm/index.js +11 -7
- package/es/form/ProForm/index.scss +40 -6
- package/es/form/ProForm/useFormDisplayValues.js +4 -2
- package/es/form/SchemaForm/index.js +16 -10
- package/es/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/es/form/SchemaForm/initializeDataSource.js +4 -9
- package/es/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/es/form/SchemaForm/initializeRequest.js +4 -10
- package/es/form/SchemaForm/initializeRules.d.ts +7 -1
- package/es/form/SchemaForm/initializeRules.js +9 -13
- package/es/form/SchemaForm/reactions.d.ts +5 -5
- package/es/form/SchemaForm/reactions.js +27 -29
- package/es/form/global.scss +1 -0
- package/es/form/typing.d.ts +11 -2
- package/es/form/utils.d.ts +8 -7
- package/es/form/utils.js +5 -4
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/table/components/Filter/index.js +1 -0
- package/es/table/components/Layout/index.js +21 -12
- package/es/table/components/Pagination/index.d.ts +4 -0
- package/es/table/components/Pagination/index.js +154 -0
- package/es/table/components/Pagination/index.scss +22 -0
- package/es/table/components/ToolBar/FilterColumnIcon.js +42 -8
- package/es/table/components/ToolBar/index.scss +17 -6
- package/es/table/index.js +118 -34
- package/es/table/index.scss +7 -1
- package/es/table/typing.d.ts +6 -2
- package/es/table/utils/columnRender.js +2 -1
- package/es/table/utils/index.d.ts +7 -0
- package/es/table/utils/index.js +38 -4
- package/lib/actions/base.d.ts +2 -1
- package/lib/actions/base.js +1 -1
- package/lib/actions/danger-pop-confirm.d.ts +5 -0
- package/lib/actions/danger-pop-confirm.js +22 -0
- package/lib/actions/dialog.d.ts +1 -1
- package/lib/actions/dialog.js +42 -54
- package/lib/actions/index.d.ts +13 -0
- package/lib/actions/index.js +23 -16
- package/lib/actions/pop-confirm.d.ts +9 -0
- package/lib/actions/pop-confirm.js +23 -0
- package/lib/form/Components/LightFilter/componentMap.d.ts +2 -1
- package/lib/form/Components/LightFilter/componentMap.js +6 -4
- package/lib/form/Components/LightFilter/index.d.ts +1 -0
- package/lib/form/Components/LightFilter/index.js +31 -14
- package/lib/form/Components/LightFilter/index.scss +14 -4
- package/lib/form/Filter/AdvancedFilter.d.ts +7 -0
- package/lib/form/Filter/AdvancedFilter.js +134 -0
- package/lib/form/Filter/LightFilter.d.ts +7 -0
- package/lib/form/Filter/LightFilter.js +99 -0
- package/lib/form/Filter/SimpleFilter.d.ts +7 -0
- package/lib/form/Filter/SimpleFilter.js +93 -0
- package/lib/form/Filter/index2.js +291 -234
- package/lib/form/Filter/index2.scss +3 -0
- package/lib/form/ProForm/index.js +10 -6
- package/lib/form/ProForm/index.scss +40 -6
- package/lib/form/ProForm/useFormDisplayValues.js +3 -1
- package/lib/form/SchemaForm/index.js +16 -9
- package/lib/form/SchemaForm/initializeDataSource.d.ts +2 -2
- package/lib/form/SchemaForm/initializeDataSource.js +4 -11
- package/lib/form/SchemaForm/initializeRequest.d.ts +2 -2
- package/lib/form/SchemaForm/initializeRequest.js +4 -11
- package/lib/form/SchemaForm/initializeRules.d.ts +7 -1
- package/lib/form/SchemaForm/initializeRules.js +9 -16
- package/lib/form/SchemaForm/reactions.d.ts +5 -5
- package/lib/form/SchemaForm/reactions.js +29 -31
- package/lib/form/global.scss +1 -0
- package/lib/form/typing.d.ts +11 -2
- package/lib/form/utils.d.ts +8 -7
- package/lib/form/utils.js +6 -5
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/table/components/Layout/index.js +20 -11
- package/lib/table/components/Pagination/index.d.ts +4 -0
- package/lib/table/components/Pagination/index.js +174 -0
- package/lib/table/components/Pagination/index.scss +22 -0
- package/lib/table/components/ToolBar/FilterColumnIcon.js +41 -7
- package/lib/table/components/ToolBar/index.scss +17 -6
- package/lib/table/index.js +115 -32
- package/lib/table/index.scss +7 -1
- package/lib/table/typing.d.ts +6 -2
- package/lib/table/utils/columnRender.js +2 -1
- package/lib/table/utils/index.d.ts +7 -0
- package/lib/table/utils/index.js +46 -4
- package/package.json +3 -3
@@ -0,0 +1,154 @@
|
|
1
|
+
var _excluded = ["className", "onChange", "total", "totalRender", "pageSize", "current", "pageSizeList", "pageSizeSelector", "type", "onPageSizeChange"];
|
2
|
+
|
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
|
+
|
5
|
+
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; }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
10
|
+
|
11
|
+
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."); }
|
12
|
+
|
13
|
+
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); }
|
14
|
+
|
15
|
+
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; }
|
16
|
+
|
17
|
+
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; }
|
18
|
+
|
19
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
20
|
+
|
21
|
+
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; }
|
22
|
+
|
23
|
+
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; }
|
24
|
+
|
25
|
+
// 自适应宽度的翻页器
|
26
|
+
import React, { useState } from 'react';
|
27
|
+
import { Pagination, Balloon, Select, Button } from '@alicloudfe/components';
|
28
|
+
import { getMessage, baseClass } from '@teamix/utils';
|
29
|
+
import { useResponsiveProps } from '@teamix/hooks';
|
30
|
+
import './index.scss';
|
31
|
+
var cls = baseClass('teamix-pro-pagination');
|
32
|
+
export default (function (props) {
|
33
|
+
var className = props.className,
|
34
|
+
onChange = props.onChange,
|
35
|
+
total = props.total,
|
36
|
+
totalRender = props.totalRender,
|
37
|
+
pageSize = props.pageSize,
|
38
|
+
current = props.current,
|
39
|
+
pageSizeList = props.pageSizeList,
|
40
|
+
pageSizeSelector = props.pageSizeSelector,
|
41
|
+
type = props.type,
|
42
|
+
onPageSizeChange = props.onPageSizeChange,
|
43
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
44
|
+
|
45
|
+
var _useResponsiveProps = useResponsiveProps([480, 590, 700], ['mini', 'small', 'simple', 'normal']),
|
46
|
+
responsiveProps = _useResponsiveProps.responsiveProps,
|
47
|
+
paginationWrapperRef = _useResponsiveProps.ref;
|
48
|
+
|
49
|
+
var _useState = useState(false),
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
51
|
+
visible = _useState2[0],
|
52
|
+
setVisible = _useState2[1];
|
53
|
+
|
54
|
+
var commonPaginationProps = {
|
55
|
+
className: className,
|
56
|
+
onChange: onChange,
|
57
|
+
total: total,
|
58
|
+
pageSize: pageSize,
|
59
|
+
shape: 'arrow-only',
|
60
|
+
pageSizeList: pageSizeList,
|
61
|
+
pageSizeSelector: pageSizeSelector,
|
62
|
+
pageSizePosition: 'end',
|
63
|
+
onPageSizeChange: onPageSizeChange
|
64
|
+
};
|
65
|
+
|
66
|
+
var customTotalRender = function customTotalRender(total) {
|
67
|
+
return /*#__PURE__*/React.createElement(Balloon, {
|
68
|
+
visible: visible,
|
69
|
+
closable: false,
|
70
|
+
onVisibleChange: function onVisibleChange(visible) {
|
71
|
+
return setVisible(visible);
|
72
|
+
},
|
73
|
+
align: "t",
|
74
|
+
// triggerType="click"
|
75
|
+
trigger: /*#__PURE__*/React.createElement(Button, {
|
76
|
+
text: true,
|
77
|
+
onMouseEnter: function onMouseEnter() {
|
78
|
+
return setVisible(true);
|
79
|
+
}
|
80
|
+
}, getMessage('total', {
|
81
|
+
total: total
|
82
|
+
}))
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
84
|
+
className: cls('custom-total-content')
|
85
|
+
}, /*#__PURE__*/React.createElement("div", {
|
86
|
+
className: "title"
|
87
|
+
}, getMessage('pageSize')), /*#__PURE__*/React.createElement(Select, {
|
88
|
+
className: cls('custom-page-size-selector'),
|
89
|
+
dataSource: pageSizeList,
|
90
|
+
defaultValue: pageSize,
|
91
|
+
followTrigger: true,
|
92
|
+
menuProps: {
|
93
|
+
hasSelectedIcon: false
|
94
|
+
},
|
95
|
+
onChange: function onChange(value) {
|
96
|
+
setVisible(false);
|
97
|
+
onPageSizeChange === null || onPageSizeChange === void 0 ? void 0 : onPageSizeChange(value);
|
98
|
+
}
|
99
|
+
})));
|
100
|
+
};
|
101
|
+
|
102
|
+
var renderPagination = function renderPagination() {
|
103
|
+
switch (responsiveProps) {
|
104
|
+
case 'normal':
|
105
|
+
return /*#__PURE__*/React.createElement(Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
106
|
+
totalRender: function totalRender(total) {
|
107
|
+
return getMessage('total', {
|
108
|
+
total: total
|
109
|
+
});
|
110
|
+
}
|
111
|
+
}, otherProps));
|
112
|
+
|
113
|
+
case 'simple':
|
114
|
+
return /*#__PURE__*/React.createElement(Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
115
|
+
pageShowCount: 3,
|
116
|
+
totalRender: function totalRender(total) {
|
117
|
+
return getMessage('total', {
|
118
|
+
total: total
|
119
|
+
});
|
120
|
+
}
|
121
|
+
}, otherProps));
|
122
|
+
|
123
|
+
case 'small':
|
124
|
+
return /*#__PURE__*/React.createElement(Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
125
|
+
pageShowCount: 3,
|
126
|
+
pageSizeSelector: false,
|
127
|
+
totalRender: function totalRender(total) {
|
128
|
+
return customTotalRender(total);
|
129
|
+
}
|
130
|
+
}, otherProps));
|
131
|
+
|
132
|
+
case 'mini':
|
133
|
+
return /*#__PURE__*/React.createElement(Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), {}, {
|
134
|
+
pageSizeSelector: false,
|
135
|
+
totalRender: function totalRender(total) {
|
136
|
+
return customTotalRender(total);
|
137
|
+
},
|
138
|
+
type: "simple"
|
139
|
+
}, otherProps));
|
140
|
+
|
141
|
+
default:
|
142
|
+
return /*#__PURE__*/React.createElement(Pagination, _objectSpread(_objectSpread({}, commonPaginationProps), otherProps));
|
143
|
+
}
|
144
|
+
};
|
145
|
+
|
146
|
+
return (
|
147
|
+
/*#__PURE__*/
|
148
|
+
// 用于获取翻页器响应式 ref
|
149
|
+
React.createElement("div", {
|
150
|
+
ref: paginationWrapperRef,
|
151
|
+
className: cls('wrapper')
|
152
|
+
}, renderPagination())
|
153
|
+
);
|
154
|
+
});
|
@@ -0,0 +1,22 @@
|
|
1
|
+
$prefix: 'teamix-pro-pagination';
|
2
|
+
|
3
|
+
.#{$prefix} {
|
4
|
+
&-custom-total {
|
5
|
+
&-content {
|
6
|
+
display: flex;
|
7
|
+
align-items: center;
|
8
|
+
.next-menu {
|
9
|
+
min-width: 56px !important;
|
10
|
+
.next-menu-item.next-select-menu-item {
|
11
|
+
padding: 0 8px !important;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}
|
16
|
+
&-custom-page-size-selector.next-select-trigger {
|
17
|
+
min-width: 56px;
|
18
|
+
.next-select-inner {
|
19
|
+
min-width: 56px;
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}
|
@@ -31,7 +31,7 @@ import { Button, Dropdown, Menu, Dialog, Grid, Checkbox } from '@alicloudfe/comp
|
|
31
31
|
import TeamixIcon from '@teamix/icon';
|
32
32
|
import { baseClass, getMessage } from '@teamix/utils';
|
33
33
|
import React, { useState, useEffect } from 'react';
|
34
|
-
import { cloneDeep } from '../../utils';
|
34
|
+
import { cloneDeep, off, on } from '../../utils';
|
35
35
|
import './index.scss';
|
36
36
|
import { Ellipsis } from '@teamix/utils';
|
37
37
|
var CheckboxItem = Menu.CheckboxItem;
|
@@ -54,7 +54,8 @@ var processColumns = function processColumns(columns) {
|
|
54
54
|
var FilterColumnIcon = function FilterColumnIcon(props) {
|
55
55
|
var _props$columns = props.columns,
|
56
56
|
columns = _props$columns === void 0 ? [] : _props$columns,
|
57
|
-
actionRef = props.actionRef
|
57
|
+
actionRef = props.actionRef,
|
58
|
+
filterColumnType = props.filterColumnType;
|
58
59
|
|
59
60
|
var _useState = useState(true),
|
60
61
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -84,6 +85,26 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
84
85
|
dropdownVisible = _useState10[0],
|
85
86
|
setDropdownVisible = _useState10[1];
|
86
87
|
|
88
|
+
useEffect(function () {
|
89
|
+
on === null || on === void 0 ? void 0 : on(function (stateFilterColumns) {
|
90
|
+
if (stateFilterColumns && stateFilterColumns.length > 0) {
|
91
|
+
var showDataIndex = stateFilterColumns.map(function (item) {
|
92
|
+
return item.dataIndex;
|
93
|
+
});
|
94
|
+
var stateColumns = cloneDeep(processColumns(columns)).map(function (item) {
|
95
|
+
if (!showDataIndex.includes(item.dataIndex)) {
|
96
|
+
item.columnFilters = false;
|
97
|
+
}
|
98
|
+
|
99
|
+
return item;
|
100
|
+
});
|
101
|
+
setNewColumns(stateColumns);
|
102
|
+
}
|
103
|
+
}, 'refreshFilterState');
|
104
|
+
return function () {
|
105
|
+
off('refreshFilterState');
|
106
|
+
};
|
107
|
+
});
|
87
108
|
useEffect(function () {
|
88
109
|
setNewColumns(processColumns(columns));
|
89
110
|
}, [columns]); // 全选
|
@@ -195,7 +216,7 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
195
216
|
|
196
217
|
calculateSelectAllState(columns);
|
197
218
|
setNewColumns(columns);
|
198
|
-
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setColumn) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, columns);
|
219
|
+
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setColumn) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, columns, false);
|
199
220
|
}; // 计算全选状态
|
200
221
|
|
201
222
|
|
@@ -241,7 +262,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
241
262
|
align: "tr br"
|
242
263
|
}, /*#__PURE__*/React.createElement("div", {
|
243
264
|
className: cls()
|
244
|
-
}, /*#__PURE__*/React.createElement(Menu,
|
265
|
+
}, /*#__PURE__*/React.createElement(Menu, {
|
266
|
+
className: cls('all-select')
|
267
|
+
}, /*#__PURE__*/React.createElement(CheckboxItem, {
|
245
268
|
indeterminate: indeterminate,
|
246
269
|
checked: allVisible,
|
247
270
|
onChange: onChangeAllColumns
|
@@ -254,7 +277,9 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
254
277
|
type: "primary"
|
255
278
|
}, getMessage('reset'))), /*#__PURE__*/React.createElement(Menu.Divider, {
|
256
279
|
key: "divider"
|
257
|
-
}),
|
280
|
+
})), /*#__PURE__*/React.createElement(Menu, {
|
281
|
+
className: cls('checkbox-group')
|
282
|
+
}, newColumns.map(function (_ref9, index) {
|
258
283
|
var _newColumns$find;
|
259
284
|
|
260
285
|
var dataIndex = _ref9.dataIndex,
|
@@ -312,7 +337,8 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
312
337
|
onOk: onChangeColumnsForDialog,
|
313
338
|
onCancel: dialogOnClose,
|
314
339
|
onClose: dialogOnClose,
|
315
|
-
width: 480
|
340
|
+
width: 480,
|
341
|
+
className: cls('dialog')
|
316
342
|
}, /*#__PURE__*/React.createElement(Row, {
|
317
343
|
gutter: 20,
|
318
344
|
wrap: true,
|
@@ -344,12 +370,20 @@ var FilterColumnIcon = function FilterColumnIcon(props) {
|
|
344
370
|
},
|
345
371
|
disabled: columnFiltersDisabled
|
346
372
|
}, /*#__PURE__*/React.createElement(Ellipsis, {
|
347
|
-
tooltip:
|
373
|
+
tooltip: title
|
348
374
|
}, title)));
|
349
375
|
}))));
|
350
376
|
};
|
351
377
|
|
352
|
-
if (
|
378
|
+
if (filterColumnType === 'dialog') {
|
379
|
+
return renderDialog();
|
380
|
+
}
|
381
|
+
|
382
|
+
if (filterColumnType === 'dropdown') {
|
383
|
+
return renderDropdown();
|
384
|
+
}
|
385
|
+
|
386
|
+
if (newColumns.length >= 20) {
|
353
387
|
return renderDialog();
|
354
388
|
}
|
355
389
|
|
@@ -18,10 +18,14 @@
|
|
18
18
|
// FilterColumn
|
19
19
|
.teamix-pro-table-toolbar-filter-column {
|
20
20
|
min-width: 180px;
|
21
|
-
max-height: 350px;
|
22
|
-
overflow: auto;
|
23
21
|
box-shadow: var(--popup-local-shadow, 0px 6px 24px 0px rgba(0, 0, 0, 0.1));
|
24
22
|
background: var(--menu-background);
|
23
|
+
|
24
|
+
&-dialog {
|
25
|
+
.next-checkbox-label {
|
26
|
+
line-height: var(--checkbox-size,16px);
|
27
|
+
}
|
28
|
+
}
|
25
29
|
&-reset {
|
26
30
|
position: absolute;
|
27
31
|
right: 16px;
|
@@ -40,7 +44,6 @@
|
|
40
44
|
visibility: visible;
|
41
45
|
cursor: pointer;
|
42
46
|
}
|
43
|
-
|
44
47
|
}
|
45
48
|
}
|
46
49
|
.next-menu-item-text {
|
@@ -76,6 +79,14 @@
|
|
76
79
|
align-items: center;
|
77
80
|
}
|
78
81
|
}
|
82
|
+
.teamix-pro-table-toolbar-filter-column-all-select.teamix-pro-table-toolbar-filter-column-all-select {
|
83
|
+
padding-bottom: 0;
|
84
|
+
}
|
85
|
+
.teamix-pro-table-toolbar-filter-column-checkbox-group.teamix-pro-table-toolbar-filter-column-checkbox-group {
|
86
|
+
padding-top: 0;
|
87
|
+
max-height: 310px;
|
88
|
+
overflow: auto;
|
89
|
+
}
|
79
90
|
|
80
91
|
// fullscreen
|
81
92
|
.teamix-pro-table-full-screen {
|
@@ -88,7 +99,7 @@
|
|
88
99
|
background-color: var(--balloon-tooltip-color-bg, #292929);
|
89
100
|
border-color: var(--balloon-tooltip-color-border, transparent);
|
90
101
|
box-shadow: var(--balloon-tooltip-shadow, none);
|
91
|
-
color: var(--balloon-tooltip-color, #
|
102
|
+
color: var(--balloon-tooltip-color, #ffffff);
|
92
103
|
display: flex;
|
93
104
|
align-items: center;
|
94
105
|
height: 36px;
|
@@ -99,7 +110,7 @@
|
|
99
110
|
display: none;
|
100
111
|
}
|
101
112
|
.next-message-content {
|
102
|
-
color: var(--balloon-tooltip-color, #
|
113
|
+
color: var(--balloon-tooltip-color, #ffffff);
|
103
114
|
padding: 0;
|
104
115
|
}
|
105
116
|
.teamix-pro-table-full-screen-message-esc {
|
@@ -108,7 +119,7 @@
|
|
108
119
|
padding: 0 2px;
|
109
120
|
position: relative;
|
110
121
|
// box-shadow: inset 0 0 1px 1px var(--color-fill1-1);
|
111
|
-
border: 1px solid var(--balloon-tooltip-color, #
|
122
|
+
border: 1px solid var(--balloon-tooltip-color, #ffffff);
|
112
123
|
display: inline-block;
|
113
124
|
line-height: 1;
|
114
125
|
&-title {
|
package/es/table/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest"];
|
1
|
+
var _excluded = ["header", "className", "tableClassName", "mainAction", "extra", "dataFilter", "toolBar", "columns", "useRowSelection", "rowSelection", "onChangeRowSelection", "getRowSelection", "primaryKey", "footerAction", "footer", "url", "pageKey", "pageSizeKey", "method", "params", "formatSort", "formatParams", "formatResult", "requestWhenMount", "showPagination", "pageSizeList", "showSkeleton", "skeletonSize", "actionRef", "dataSource", "filterDebounce", "footerSuction", "autoRefresh", "customRequest", "filterColumnType"];
|
2
2
|
|
3
3
|
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); }
|
4
4
|
|
@@ -33,13 +33,14 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
33
33
|
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; }
|
34
34
|
|
35
35
|
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
36
|
-
import { Table,
|
36
|
+
import { Table, Checkbox, Pagination } from '@alicloudfe/components'; // import Pagination from './components/Pagination';
|
37
|
+
|
37
38
|
import genProColumnToColumn from './utils/genProColumnToColumn';
|
38
39
|
import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessage, pickProps } from '@teamix/utils';
|
39
40
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
40
41
|
import './index.scss';
|
41
42
|
import Layout from './components/Layout';
|
42
|
-
import { useActionType } from './utils';
|
43
|
+
import { emit, initActionRef, useActionType } from './utils';
|
43
44
|
import getTableProps from './utils/getTableProps';
|
44
45
|
import getTableSortIcons from './utils/getTableSortIcons';
|
45
46
|
import useTableSelection from './utils/useTableSelection';
|
@@ -59,10 +60,38 @@ var toJS = formilyReactive.toJS;
|
|
59
60
|
* @returns
|
60
61
|
*/
|
61
62
|
|
62
|
-
var processColumns = function processColumns(columns) {
|
63
|
-
|
63
|
+
var processColumns = function processColumns(columns, initialColumns) {
|
64
|
+
var filterColumns = columns.filter(function (item) {
|
64
65
|
return item.columnFilters !== false;
|
65
|
-
});
|
66
|
+
}); // 处理只剩一列批量选择的情况下宽度错乱问题
|
67
|
+
|
68
|
+
if (filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) {
|
69
|
+
var _initialColumns$;
|
70
|
+
|
71
|
+
if ((filterColumns === null || filterColumns === void 0 ? void 0 : filterColumns.length) === 1) {
|
72
|
+
var _filterColumns$, _filterColumns$2;
|
73
|
+
|
74
|
+
if ((_filterColumns$ = filterColumns[0]) === null || _filterColumns$ === void 0 ? void 0 : _filterColumns$.width) {
|
75
|
+
delete filterColumns[0].width;
|
76
|
+
}
|
77
|
+
|
78
|
+
if ((_filterColumns$2 = filterColumns[0]) === null || _filterColumns$2 === void 0 ? void 0 : _filterColumns$2.lock) {
|
79
|
+
filterColumns[0].lock = false;
|
80
|
+
}
|
81
|
+
} else if (((_initialColumns$ = initialColumns[0]) === null || _initialColumns$ === void 0 ? void 0 : _initialColumns$.columnFilters) !== false) {
|
82
|
+
var _initialColumns$2, _initialColumns$3;
|
83
|
+
|
84
|
+
if ((_initialColumns$2 = initialColumns[0]) === null || _initialColumns$2 === void 0 ? void 0 : _initialColumns$2.width) {
|
85
|
+
filterColumns[0].width = initialColumns[0].width;
|
86
|
+
}
|
87
|
+
|
88
|
+
if ((_initialColumns$3 = initialColumns[0]) === null || _initialColumns$3 === void 0 ? void 0 : _initialColumns$3.lock) {
|
89
|
+
filterColumns[0].lock = initialColumns[0].lock;
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
return filterColumns;
|
66
95
|
};
|
67
96
|
/** 默认请求翻页参数 */
|
68
97
|
|
@@ -132,6 +161,8 @@ var ProTable = function ProTable(props) {
|
|
132
161
|
return false;
|
133
162
|
} : _props$autoRefresh,
|
134
163
|
customRequest = props.customRequest,
|
164
|
+
_props$filterColumnTy = props.filterColumnType,
|
165
|
+
filterColumnType = _props$filterColumnTy === void 0 ? 'auto' : _props$filterColumnTy,
|
135
166
|
otherProps = _objectWithoutProperties(props, _excluded);
|
136
167
|
|
137
168
|
var targetPageKey = pageKey || globalPageKey;
|
@@ -163,7 +194,7 @@ var ProTable = function ProTable(props) {
|
|
163
194
|
sort = _useState10[0],
|
164
195
|
setSort = _useState10[1];
|
165
196
|
|
166
|
-
var _useState11 = useState(requestWhenMount && propsShowSkeleton),
|
197
|
+
var _useState11 = useState(!propsDataSource && requestWhenMount && propsShowSkeleton),
|
167
198
|
_useState12 = _slicedToArray(_useState11, 2),
|
168
199
|
showSkeleton = _useState12[0],
|
169
200
|
setShowSkeleton = _useState12[1]; // 首次加载,渲染骨架屏
|
@@ -175,12 +206,14 @@ var ProTable = function ProTable(props) {
|
|
175
206
|
var _useState13 = useState(true),
|
176
207
|
_useState14 = _slicedToArray(_useState13, 2),
|
177
208
|
customTableLoading = _useState14[0],
|
178
|
-
setCustomTableLoading = _useState14[1];
|
209
|
+
setCustomTableLoading = _useState14[1]; // 用于存放 Search 组件之前值的 ref
|
179
210
|
|
211
|
+
|
212
|
+
var searchValueRef = useRef('');
|
180
213
|
var tableRef = useRef(null);
|
181
214
|
var actionRef = useRef(); // 传给 table 的过滤后的 columns
|
182
215
|
|
183
|
-
var _useState15 = useState(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [])),
|
216
|
+
var _useState15 = useState(processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns)),
|
184
217
|
_useState16 = _slicedToArray(_useState15, 2),
|
185
218
|
filteredColumns = _useState16[0],
|
186
219
|
setFilteredColumns = _useState16[1];
|
@@ -351,10 +384,16 @@ var ProTable = function ProTable(props) {
|
|
351
384
|
useEffect(function () {
|
352
385
|
var _actionRef$current, _actionRef$current$se;
|
353
386
|
|
354
|
-
var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : []);
|
387
|
+
var columns = processColumns(propsColumns !== null && propsColumns !== void 0 ? propsColumns : [], propsColumns);
|
355
388
|
setFilteredColumns(columns);
|
356
389
|
(_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$se = _actionRef$current.setState) === null || _actionRef$current$se === void 0 ? void 0 : _actionRef$current$se.call(_actionRef$current, 'filterColumns', columns);
|
357
|
-
}, [propsColumns]); //
|
390
|
+
}, [propsColumns]); // dataSource 受控
|
391
|
+
|
392
|
+
useEffect(function () {
|
393
|
+
if (propsDataSource) {
|
394
|
+
setData(propsDataSource);
|
395
|
+
}
|
396
|
+
}, [propsDataSource]); // 绑定 Actions
|
358
397
|
|
359
398
|
useActionType(actionRef, {
|
360
399
|
fullScreen: function fullScreen() {
|
@@ -369,9 +408,14 @@ var ProTable = function ProTable(props) {
|
|
369
408
|
setColumn: function setColumn(newColumns) {
|
370
409
|
var _actionRef$current2, _actionRef$current2$s;
|
371
410
|
|
372
|
-
var
|
411
|
+
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
412
|
+
var columns = processColumns(newColumns, propsColumns);
|
373
413
|
setFilteredColumns(columns);
|
374
414
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$s = _actionRef$current2.setState) === null || _actionRef$current2$s === void 0 ? void 0 : _actionRef$current2$s.call(_actionRef$current2, 'filterColumns', columns);
|
415
|
+
|
416
|
+
if (update) {
|
417
|
+
emit('refreshFilterState', newColumns);
|
418
|
+
}
|
375
419
|
},
|
376
420
|
setSize: function setSize(mode) {
|
377
421
|
_setSize(mode);
|
@@ -575,10 +619,8 @@ var ProTable = function ProTable(props) {
|
|
575
619
|
}
|
576
620
|
|
577
621
|
useEffect(function () {
|
578
|
-
|
579
|
-
|
580
|
-
// 初始化 state 状态
|
581
|
-
actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$i = _actionRef$current5.initState) === null || _actionRef$current5$i === void 0 ? void 0 : _actionRef$current5$i.call(_actionRef$current5); // 监听 浏览器变化 更吸底状态
|
622
|
+
// 初始化 actionRef state、callback 此时 actionRef 已初始化完成
|
623
|
+
initActionRef(); // 监听 浏览器变化 更吸底状态
|
582
624
|
|
583
625
|
if (footerSuction) {
|
584
626
|
getFooterSuctionState();
|
@@ -592,6 +634,14 @@ var ProTable = function ProTable(props) {
|
|
592
634
|
_request();
|
593
635
|
}
|
594
636
|
|
637
|
+
var searchName = getSearchName();
|
638
|
+
|
639
|
+
if (searchName) {
|
640
|
+
// 如果有初始值,需要赋值
|
641
|
+
var initialValues = toJS(dataFilterForm.initialValues);
|
642
|
+
searchValueRef.current = initialValues[searchName][1];
|
643
|
+
}
|
644
|
+
|
595
645
|
return function () {
|
596
646
|
if (autoRefreshTimerRef.current) {
|
597
647
|
clearTimeout(autoRefreshTimerRef.current);
|
@@ -611,22 +661,55 @@ var ProTable = function ProTable(props) {
|
|
611
661
|
setSort(nextSort);
|
612
662
|
|
613
663
|
_request(targetFormatSort(nextSort));
|
614
|
-
} //
|
664
|
+
} // 找到 Search 组件对应的 name
|
665
|
+
|
666
|
+
|
667
|
+
var getSearchName = function getSearchName() {
|
668
|
+
var _dataFilter$schema;
|
669
|
+
|
670
|
+
if ((dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.schema) && ((_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) > 0) {
|
671
|
+
var searchSchema = dataFilter.schema.find(function (item) {
|
672
|
+
return item.component === 'Search';
|
673
|
+
});
|
674
|
+
|
675
|
+
if (searchSchema) {
|
676
|
+
var searchName = searchSchema.name;
|
677
|
+
return searchName;
|
678
|
+
}
|
679
|
+
}
|
680
|
+
}; // 处理 dataFilter 中的 onFilter、onReset
|
615
681
|
|
616
682
|
|
617
|
-
var dataFilter = _objectSpread(_objectSpread({
|
618
|
-
|
619
|
-
|
683
|
+
var dataFilter = _objectSpread(_objectSpread({
|
684
|
+
mode: 'inline'
|
685
|
+
}, propsDataFilter), {}, {
|
686
|
+
onFilter: debounce(function (values) {
|
687
|
+
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values));
|
620
688
|
|
621
689
|
if (dataFilterForm.validate()) {
|
622
|
-
var _actionRef$
|
690
|
+
var _actionRef$current5, _actionRef$current5$c;
|
623
691
|
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
692
|
+
/**
|
693
|
+
* 针对 inline 模式下的 Search 组件做特殊处理
|
694
|
+
* 当切换条件且输入内容为空的时候,类似[a, ''] => [b, ''] 不触发请求
|
695
|
+
*/
|
696
|
+
if (dataFilter.mode === 'inline') {
|
697
|
+
var searchName = getSearchName();
|
698
|
+
|
699
|
+
if (searchName) {
|
700
|
+
var searchValue = values[searchName][1];
|
701
|
+
|
702
|
+
if (searchValue === (searchValueRef === null || searchValueRef === void 0 ? void 0 : searchValueRef.current)) {
|
703
|
+
return;
|
704
|
+
}
|
705
|
+
|
706
|
+
searchValueRef.current = searchValue;
|
707
|
+
}
|
708
|
+
} // 搜索变化时,暂时先清空选择
|
709
|
+
|
710
|
+
|
711
|
+
(_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$c = _actionRef$current5.clearRowSelection) === null || _actionRef$current5$c === void 0 ? void 0 : _actionRef$current5$c.call(_actionRef$current5);
|
712
|
+
setCurrentPage(1);
|
630
713
|
|
631
714
|
_request(_defineProperty({}, targetPageKey, 1));
|
632
715
|
}
|
@@ -661,7 +744,8 @@ var ProTable = function ProTable(props) {
|
|
661
744
|
columns: propsColumns,
|
662
745
|
dataFilter: dataFilter,
|
663
746
|
dataFilterForm: dataFilterForm,
|
664
|
-
rowSelection: rowSelection
|
747
|
+
rowSelection: rowSelection,
|
748
|
+
filterColumnType: filterColumnType
|
665
749
|
}), /*#__PURE__*/React.createElement(Table.StickyLock, _objectSpread({
|
666
750
|
hasBorder: false,
|
667
751
|
dataSource: showSkeleton ? skeletonDataSource : data || props.dataSource,
|
@@ -719,21 +803,21 @@ var ProTable = function ProTable(props) {
|
|
719
803
|
|
720
804
|
var renderFooter = function renderFooter() {
|
721
805
|
function onChangePagination(currentPage) {
|
722
|
-
var _actionRef$
|
806
|
+
var _actionRef$current6, _actionRef$current6$c;
|
723
807
|
|
724
808
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
725
809
|
// 翻页暂时先清空选择
|
726
|
-
(_actionRef$
|
810
|
+
(_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$c = _actionRef$current6.clearRowSelection) === null || _actionRef$current6$c === void 0 ? void 0 : _actionRef$current6$c.call(_actionRef$current6);
|
727
811
|
setCurrentPage(currentPage);
|
728
812
|
|
729
813
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
730
814
|
}
|
731
815
|
|
732
816
|
function onChangePaginationSize(currentPageSize) {
|
733
|
-
var _actionRef$
|
817
|
+
var _actionRef$current7, _actionRef$current7$c, _request5;
|
734
818
|
|
735
819
|
// 翻页暂时先清空选择
|
736
|
-
(_actionRef$
|
820
|
+
(_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
|
737
821
|
setPageSize(currentPageSize);
|
738
822
|
setCurrentPage(1);
|
739
823
|
|
@@ -773,6 +857,8 @@ var ProTable = function ProTable(props) {
|
|
773
857
|
return onChangePagination(number);
|
774
858
|
},
|
775
859
|
total: total,
|
860
|
+
shape: "arrow-only",
|
861
|
+
pageSizePosition: "end",
|
776
862
|
totalRender: function totalRender(total) {
|
777
863
|
return getMessage('total', {
|
778
864
|
total: total
|
@@ -780,10 +866,8 @@ var ProTable = function ProTable(props) {
|
|
780
866
|
},
|
781
867
|
pageSize: pageSize,
|
782
868
|
current: currentPage,
|
783
|
-
shape: "arrow-only",
|
784
869
|
pageSizeList: pageSizeList,
|
785
870
|
pageSizeSelector: total > (props.pageSize || 10) * 2 ? 'dropdown' : false,
|
786
|
-
pageSizePosition: "end",
|
787
871
|
type: total / pageSize <= 2 ? 'simple' : 'normal',
|
788
872
|
onPageSizeChange: function onPageSizeChange(number) {
|
789
873
|
return onChangePaginationSize(number);
|
package/es/table/index.scss
CHANGED
@@ -32,12 +32,18 @@ $fullscreenPadding: 24px;
|
|
32
32
|
}
|
33
33
|
&-footer-left-wrapper {
|
34
34
|
display: flex;
|
35
|
-
flex:
|
35
|
+
flex-shrink: 0;
|
36
36
|
align-items: center;
|
37
37
|
}
|
38
38
|
&-footer-right-wrapper {
|
39
39
|
display: flex;
|
40
40
|
justify-content: flex-end;
|
41
|
+
width: 100%;
|
42
|
+
}
|
43
|
+
.teamix-pro-pagination-wrapper {
|
44
|
+
display: flex;
|
45
|
+
justify-content: flex-end;
|
46
|
+
width: 100%;
|
41
47
|
}
|
42
48
|
&-footer-action {
|
43
49
|
margin-left: 16px;
|