@teamix/pro 1.2.27 → 1.2.31
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/pro.css +1 -1
- package/dist/pro.js +250 -202
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/index.d.ts +2 -3
- package/es/actions/index.js +15 -19
- package/es/form/Filter/SimpleFilter.js +10 -3
- package/es/form/typing.d.ts +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/baseInfo/index.js +2 -1
- package/es/table/components/Filter/index.js +6 -6
- package/es/table/components/Layout/index.js +18 -3
- package/es/table/index.js +92 -29
- package/es/table/index.scss +4 -0
- package/es/table/typing.d.ts +2 -2
- package/es/table/utils/columnRender.js +1 -1
- package/es/table/utils/index.d.ts +2 -1
- package/es/table/utils/index.js +62 -113
- package/lib/actions/index.d.ts +2 -3
- package/lib/actions/index.js +15 -19
- package/lib/form/Filter/SimpleFilter.js +8 -1
- package/lib/form/typing.d.ts +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/baseInfo/index.js +2 -1
- package/lib/table/components/Filter/index.js +6 -6
- package/lib/table/components/Layout/index.js +18 -3
- package/lib/table/index.js +91 -28
- package/lib/table/index.scss +4 -0
- package/lib/table/typing.d.ts +2 -2
- package/lib/table/utils/columnRender.js +1 -1
- package/lib/table/utils/index.d.ts +2 -1
- package/lib/table/utils/index.js +63 -112
- package/package.json +1 -1
- package/es/form/Components/SelectTable/index.d.ts +0 -24
- package/es/form/Components/SelectTable/index.js +0 -135
- package/es/form/Components/SelectTable/index.scss +0 -28
- package/es/form/Components/SelectTable/table.d.ts +0 -6
- package/es/form/Components/SelectTable/table.js +0 -64
- package/lib/form/Components/SelectTable/index.d.ts +0 -24
- package/lib/form/Components/SelectTable/index.js +0 -157
- package/lib/form/Components/SelectTable/index.scss +0 -28
- package/lib/form/Components/SelectTable/table.d.ts +0 -6
- package/lib/form/Components/SelectTable/table.js +0 -76
package/es/actions/index.d.ts
CHANGED
@@ -41,6 +41,7 @@ export interface ProActionCommonProps {
|
|
41
41
|
export interface ProActionMenuButtonProps extends ProActionCommonProps, Omit<MenuButtonProps, 'visible'> {
|
42
42
|
actions: ProActionProps[];
|
43
43
|
icon?: string;
|
44
|
+
noArrow?: boolean;
|
44
45
|
}
|
45
46
|
export declare const ProActionMenuButton: (props: ProActionMenuButtonProps) => JSX.Element;
|
46
47
|
export interface ProActionDividerProps extends ProActionCommonProps {
|
@@ -61,9 +62,7 @@ export declare type ProActionGroupProps = {
|
|
61
62
|
*/
|
62
63
|
moreText?: string;
|
63
64
|
/** 更多按钮的配置,只有在actions数量超过max时才有效 */
|
64
|
-
more?: string |
|
65
|
-
noArrow?: boolean;
|
66
|
-
});
|
65
|
+
more?: string | Omit<ProActionMenuButtonProps, 'actions'>;
|
67
66
|
/** 是否有分割线,只有type="text"时生效,默认有分割线 */
|
68
67
|
divider?: boolean;
|
69
68
|
} & React.HTMLAttributes<HTMLElement>;
|
package/es/actions/index.js
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
var _excluded = ["type"],
|
2
2
|
_excluded2 = ["config", "icon", "iconSize", "type", "context", "children", "visible", "onClick"],
|
3
3
|
_excluded3 = ["loading"],
|
4
|
-
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type"],
|
4
|
+
_excluded4 = ["icon", "iconSize", "label", "actions", "children", "context", "type", "className", "noArrow"],
|
5
5
|
_excluded5 = ["context", "text"],
|
6
|
-
_excluded6 = ["
|
7
|
-
_excluded7 = ["key", "
|
8
|
-
_excluded8 = ["
|
9
|
-
_excluded9 = ["type", "divider", "max", "moreText", "more", "context", "actions", "className"];
|
6
|
+
_excluded6 = ["key", "actions"],
|
7
|
+
_excluded7 = ["key", "config"],
|
8
|
+
_excluded8 = ["type", "divider", "max", "moreText", "more", "context", "actions", "className"];
|
10
9
|
|
11
10
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
12
11
|
|
@@ -243,6 +242,8 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
243
242
|
context = props.context,
|
244
243
|
_props$type2 = props.type,
|
245
244
|
type = _props$type2 === void 0 ? 'primary' : _props$type2,
|
245
|
+
className = props.className,
|
246
|
+
noArrow = props.noArrow,
|
246
247
|
others = _objectWithoutProperties(props, _excluded4);
|
247
248
|
|
248
249
|
return /*#__PURE__*/React.createElement(MenuButton, _objectSpread({
|
@@ -256,7 +257,10 @@ export var ProActionMenuButton = function ProActionMenuButton(props) {
|
|
256
257
|
v2: true
|
257
258
|
},
|
258
259
|
type: type,
|
259
|
-
label: buttonContent(label || children, icon, iconSize, context)
|
260
|
+
label: buttonContent(label || children, icon, iconSize, context),
|
261
|
+
className: cls(className, {
|
262
|
+
'teamix-pro-actions-text-menu-btn-no-arrow': noArrow
|
263
|
+
})
|
260
264
|
}, others), actions.map(function (action, i) {
|
261
265
|
return renderCommonActionButtonMenuItem(action, action.key || i, context);
|
262
266
|
}));
|
@@ -316,14 +320,12 @@ function renderCommonActionButton(button, context, isTypeText) {
|
|
316
320
|
}
|
317
321
|
|
318
322
|
function getDefaultMoreButton(type, more) {
|
319
|
-
var noArrowClassName = 'teamix-pro-actions-text-menu-btn-no-arrow';
|
320
323
|
var defaultConfig = type === 'button' ? {
|
321
324
|
children: getMessage('more')
|
322
325
|
} : {
|
323
326
|
icon: 'more-line',
|
324
|
-
// iconSize: 'small',
|
325
327
|
autoWidth: false,
|
326
|
-
|
328
|
+
noArrow: true
|
327
329
|
};
|
328
330
|
|
329
331
|
if (!more) {
|
@@ -338,13 +340,7 @@ function getDefaultMoreButton(type, more) {
|
|
338
340
|
return Object.assign(defaultConfig, moreConfig);
|
339
341
|
}
|
340
342
|
|
341
|
-
|
342
|
-
className = moreConfig.className,
|
343
|
-
others = _objectWithoutProperties(moreConfig, _excluded6);
|
344
|
-
|
345
|
-
return _objectSpread({
|
346
|
-
className: cls(className, _defineProperty({}, "".concat(noArrowClassName), noArrow))
|
347
|
-
}, others);
|
343
|
+
return moreConfig;
|
348
344
|
}
|
349
345
|
|
350
346
|
var MAX_ACTTIONS = 4;
|
@@ -361,7 +357,7 @@ function getActionConfig(action, index, context) {
|
|
361
357
|
if (action.actions) {
|
362
358
|
var _key = action.key,
|
363
359
|
actions = action.actions,
|
364
|
-
_others = _objectWithoutProperties(action,
|
360
|
+
_others = _objectWithoutProperties(action, _excluded6);
|
365
361
|
|
366
362
|
return _objectSpread({
|
367
363
|
key: getKey(index, _key),
|
@@ -373,7 +369,7 @@ function getActionConfig(action, index, context) {
|
|
373
369
|
|
374
370
|
var key = action.key,
|
375
371
|
config = action.config,
|
376
|
-
others = _objectWithoutProperties(action,
|
372
|
+
others = _objectWithoutProperties(action, _excluded7);
|
377
373
|
|
378
374
|
return _objectSpread({
|
379
375
|
key: getKey(index, key),
|
@@ -394,7 +390,7 @@ export function ProActionGroup(props) {
|
|
394
390
|
_props$actions = props.actions,
|
395
391
|
actions = _props$actions === void 0 ? [] : _props$actions,
|
396
392
|
className = props.className,
|
397
|
-
containerProps = _objectWithoutProperties(props,
|
393
|
+
containerProps = _objectWithoutProperties(props, _excluded8);
|
398
394
|
|
399
395
|
var isTypeText = type === 'text';
|
400
396
|
var filteredActions = actions.map(function (action, index) {
|
@@ -10,13 +10,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
10
10
|
|
11
11
|
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; }
|
12
12
|
|
13
|
-
import React, { memo, useCallback, useMemo, useRef } from 'react';
|
13
|
+
import React, { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
14
14
|
import cls from 'classnames';
|
15
|
-
import { usePrefixCls } from '@teamix/utils';
|
15
|
+
import { usePrefixCls, isValid } from '@teamix/utils';
|
16
16
|
import ProForm from '../ProForm'; // 初始化Search组件,内置部分属性
|
17
17
|
|
18
18
|
var initializeSearch = function initializeSearch(schema) {
|
19
|
-
var searchName;
|
19
|
+
var searchName = '';
|
20
20
|
var initializedSchema = schema.map(function (item) {
|
21
21
|
if (item.component === 'Search') {
|
22
22
|
searchName = item.name;
|
@@ -85,6 +85,13 @@ var SimpleFilter = /*#__PURE__*/memo(function (props) {
|
|
85
85
|
onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
|
86
86
|
}
|
87
87
|
}, [searchName, searchValue.current]);
|
88
|
+
useEffect(function () {
|
89
|
+
var _props$form$initialVa, _props$form$initialVa2;
|
90
|
+
|
91
|
+
// 处理Search组件,缓存input的默认值
|
92
|
+
var searchDefaultValue = (_props$form$initialVa = props.form.initialValues) === null || _props$form$initialVa === void 0 ? void 0 : (_props$form$initialVa2 = _props$form$initialVa[searchName]) === null || _props$form$initialVa2 === void 0 ? void 0 : _props$form$initialVa2[1];
|
93
|
+
searchValue.current = isValid(searchDefaultValue) ? searchDefaultValue : '';
|
94
|
+
}, []);
|
88
95
|
return /*#__PURE__*/React.createElement(ProForm, _objectSpread(_objectSpread({}, otherProps), {}, {
|
89
96
|
className: cls(prefixCls, props.className),
|
90
97
|
schema: simpleSchema,
|
package/es/form/typing.d.ts
CHANGED
@@ -24,7 +24,7 @@ export interface ProFormSchemaItem {
|
|
24
24
|
name?: string;
|
25
25
|
description?: React.ReactNode;
|
26
26
|
title?: string;
|
27
|
-
component?: IBaseComponent | IButtonComponent | IComboComponent | ILayoutComponent |
|
27
|
+
component?: IBaseComponent | IButtonComponent | IComboComponent | ILayoutComponent | any;
|
28
28
|
props?: AnyObject | any;
|
29
29
|
decorator?: string | null;
|
30
30
|
decoratorProps?: AnyObject;
|
package/es/index.d.ts
CHANGED
@@ -24,5 +24,5 @@ export * from './skeleton';
|
|
24
24
|
export * from './table';
|
25
25
|
export * from './utils';
|
26
26
|
export * from './step';
|
27
|
-
declare const version = "1.2.
|
27
|
+
declare const version = "1.2.31";
|
28
28
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProStep, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -30,7 +30,7 @@ export * from './table';
|
|
30
30
|
export * from './utils'; // export * from './sidebar';
|
31
31
|
|
32
32
|
export * from './step';
|
33
|
-
var version = '1.2.
|
33
|
+
var version = '1.2.31';
|
34
34
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
35
35
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, // ProSidebar,
|
36
36
|
ProStep, hooks, nocode, templates, utils };
|
@@ -84,7 +84,8 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
84
84
|
|
85
85
|
return /*#__PURE__*/React.createElement(React.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/React.createElement(Row, {
|
86
86
|
wrap: true,
|
87
|
-
className: "teamix-pro-info-content-row"
|
87
|
+
className: "teamix-pro-info-content-row",
|
88
|
+
gutter: 20
|
88
89
|
}, renderContent()));
|
89
90
|
};
|
90
91
|
|
@@ -51,10 +51,10 @@ var Filter = function Filter(props) {
|
|
51
51
|
setVisible = _useState4[1];
|
52
52
|
|
53
53
|
useEffect(function () {
|
54
|
-
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4;
|
54
|
+
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
55
55
|
|
56
56
|
// 从全局状态中读取上次存储的条件
|
57
|
-
var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)
|
57
|
+
var rules = (_actionRef$current$ge = (_actionRef$current = actionRef.current) === null || _actionRef$current === void 0 ? void 0 : (_actionRef$current$ge2 = _actionRef$current.getState) === null || _actionRef$current$ge2 === void 0 ? void 0 : (_actionRef$current$ge3 = _actionRef$current$ge2.call(_actionRef$current)) === null || _actionRef$current$ge3 === void 0 ? void 0 : (_actionRef$current$ge4 = _actionRef$current$ge3.filterRules) === null || _actionRef$current$ge4 === void 0 ? void 0 : (_actionRef$current$ge5 = _actionRef$current$ge4[column.dataIndex]) === null || _actionRef$current$ge5 === void 0 ? void 0 : _actionRef$current$ge5.rules) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : [];
|
58
58
|
setSelected(rules);
|
59
59
|
}, []); // 获取过滤项
|
60
60
|
|
@@ -172,7 +172,7 @@ var Filter = function Filter(props) {
|
|
172
172
|
btn: true
|
173
173
|
}),
|
174
174
|
onClick: function onClick() {
|
175
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$
|
175
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
176
176
|
|
177
177
|
(_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
|
178
178
|
|
@@ -187,7 +187,7 @@ var Filter = function Filter(props) {
|
|
187
187
|
} // 需要带上其他所有的信息
|
188
188
|
|
189
189
|
|
190
|
-
var rules = (_actionRef$current$
|
190
|
+
var rules = (_actionRef$current$ge6 = (_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$g = _actionRef$current3.getState) === null || _actionRef$current3$g === void 0 ? void 0 : (_actionRef$current3$g2 = _actionRef$current3$g.call(_actionRef$current3)) === null || _actionRef$current3$g2 === void 0 ? void 0 : _actionRef$current3$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {}; // 再设置所有的列筛选状态
|
191
191
|
|
192
192
|
(_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$s = _actionRef$current4.setFilterRules) === null || _actionRef$current4$s === void 0 ? void 0 : _actionRef$current4$s.call(_actionRef$current4, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
193
193
|
rules: selected,
|
@@ -220,10 +220,10 @@ var Filter = function Filter(props) {
|
|
220
220
|
btn: true
|
221
221
|
}),
|
222
222
|
onClick: function onClick() {
|
223
|
-
var _actionRef$current$
|
223
|
+
var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
|
224
224
|
|
225
225
|
setSelected([]);
|
226
|
-
var rules = (_actionRef$current$
|
226
|
+
var rules = (_actionRef$current$ge7 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge7 !== void 0 ? _actionRef$current$ge7 : {};
|
227
227
|
(_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
|
228
228
|
rules: [],
|
229
229
|
params: ''
|
@@ -60,8 +60,10 @@ var Layout = function Layout(props) {
|
|
60
60
|
|
61
61
|
|
62
62
|
var renderQueryFilter = function renderQueryFilter() {
|
63
|
-
|
64
|
-
|
63
|
+
var _dataFilter$schema;
|
64
|
+
|
65
|
+
if (dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema = dataFilter.schema) === null || _dataFilter$schema === void 0 ? void 0 : _dataFilter$schema.length) {
|
66
|
+
var _dataFilter$schema2;
|
65
67
|
|
66
68
|
if ( /*#__PURE__*/isValidElement(dataFilter === null || dataFilter === void 0 ? void 0 : dataFilter.content)) {
|
67
69
|
// 自定义渲染内容
|
@@ -89,7 +91,7 @@ var Layout = function Layout(props) {
|
|
89
91
|
actionRef: actionRef
|
90
92
|
}, otherProps)))
|
91
93
|
}, dataFilter));
|
92
|
-
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$
|
94
|
+
} else if ((dataFilter === null || dataFilter === void 0 ? void 0 : (_dataFilter$schema2 = dataFilter.schema) === null || _dataFilter$schema2 === void 0 ? void 0 : _dataFilter$schema2.length) >= 0) {
|
93
95
|
return /*#__PURE__*/React.createElement(QueryFilter, _objectSpread({
|
94
96
|
formRef: dataFilterFormRef,
|
95
97
|
onExpand: function onExpand(expand) {
|
@@ -115,6 +117,19 @@ var Layout = function Layout(props) {
|
|
115
117
|
}, otherProps)))
|
116
118
|
}, dataFilter));
|
117
119
|
}
|
120
|
+
} else if (mainAction) {
|
121
|
+
// 没传 dataFilter 但是传了 mainAction
|
122
|
+
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
123
|
+
className: "mb8",
|
124
|
+
addonBefore: renderMainAction(),
|
125
|
+
addonAfter: /*#__PURE__*/React.createElement(React.Fragment, null, extra && !header && /*#__PURE__*/React.createElement(QuickAction, {
|
126
|
+
actionRef: actionRef,
|
127
|
+
quickAction: extra,
|
128
|
+
rowSelection: rowSelection
|
129
|
+
}), /*#__PURE__*/React.createElement(ToolBar, _objectSpread({
|
130
|
+
actionRef: actionRef
|
131
|
+
}, otherProps)))
|
132
|
+
});
|
118
133
|
}
|
119
134
|
}; // 区域组合渲染
|
120
135
|
|
package/es/table/index.js
CHANGED
@@ -40,7 +40,7 @@ import { baseClass, useRequest, request as utilResquest, getDeepValue, getMessag
|
|
40
40
|
import { ProSkeletonRaw as Skeleton } from '../skeleton';
|
41
41
|
import './index.scss';
|
42
42
|
import Layout from './components/Layout';
|
43
|
-
import { emit, initActionRef, processDefaultFilter, useActionType } from './utils';
|
43
|
+
import { actionRefUseStateOn, emit, initActionRef, processDefaultFilter, useActionType } from './utils';
|
44
44
|
import getTableProps from './utils/getTableProps';
|
45
45
|
import getTableSortIcons from './utils/getTableSortIcons';
|
46
46
|
import useTableSelection from './utils/useTableSelection';
|
@@ -121,7 +121,7 @@ var globalFormatSort = function globalFormatSort(sort) {
|
|
121
121
|
};
|
122
122
|
|
123
123
|
var ProTable = function ProTable(props) {
|
124
|
-
var _rowSelection$selecte;
|
124
|
+
var _rowSelection$selecte, _dataFilterForm4;
|
125
125
|
|
126
126
|
var header = props.header,
|
127
127
|
className = props.className,
|
@@ -237,7 +237,24 @@ var ProTable = function ProTable(props) {
|
|
237
237
|
var _useState19 = useState(true),
|
238
238
|
_useState20 = _slicedToArray(_useState19, 2),
|
239
239
|
showLoading = _useState20[0],
|
240
|
-
setShowLoading = _useState20[1]; //
|
240
|
+
setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
|
241
|
+
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
242
|
+
|
243
|
+
|
244
|
+
var _useState21 = useState({
|
245
|
+
fullScreenState: false,
|
246
|
+
filterRules: {},
|
247
|
+
filterColumns: []
|
248
|
+
}),
|
249
|
+
_useState22 = _slicedToArray(_useState21, 1),
|
250
|
+
actionRefState = _useState22[0]; // 存储 on 监听事件
|
251
|
+
|
252
|
+
|
253
|
+
var _useState23 = useState({
|
254
|
+
fullScreenState: {}
|
255
|
+
}),
|
256
|
+
_useState24 = _slicedToArray(_useState23, 1),
|
257
|
+
actionRefCallback = _useState24[0]; // 存储定时器 id
|
241
258
|
|
242
259
|
|
243
260
|
var autoRefreshTimerRef = useRef(); // 获取header高度,用作全屏吸底吸底高度计算
|
@@ -261,16 +278,16 @@ var ProTable = function ProTable(props) {
|
|
261
278
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
262
279
|
|
263
280
|
|
264
|
-
var
|
265
|
-
|
266
|
-
headerHeight =
|
267
|
-
setHeaderHeight =
|
281
|
+
var _useState25 = useState(0),
|
282
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
283
|
+
headerHeight = _useState26[0],
|
284
|
+
setHeaderHeight = _useState26[1]; // 全屏显示 className
|
268
285
|
|
269
286
|
|
270
|
-
var
|
271
|
-
|
272
|
-
fullscreenState =
|
273
|
-
setFullscreenState =
|
287
|
+
var _useState27 = useState(false),
|
288
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
289
|
+
fullscreenState = _useState28[0],
|
290
|
+
setFullscreenState = _useState28[1]; // 非全屏状态下的
|
274
291
|
|
275
292
|
|
276
293
|
var normalDataFilterFormRef = useRef();
|
@@ -278,13 +295,13 @@ var ProTable = function ProTable(props) {
|
|
278
295
|
var normalDataFilterForm = normalDataFilterFormRef.current;
|
279
296
|
var fullscreenDataFilterForm = fullscreenDataFilterFormRef.current; // 传给 QueryFilter 的 formRef
|
280
297
|
|
281
|
-
var dataFilterFormRef = fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
298
|
+
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
282
299
|
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
283
300
|
|
284
|
-
var
|
285
|
-
|
286
|
-
footerSuctionState =
|
287
|
-
setFooterSuctionState =
|
301
|
+
var _useState29 = useState(false),
|
302
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
303
|
+
footerSuctionState = _useState30[0],
|
304
|
+
setFooterSuctionState = _useState30[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
288
305
|
|
289
306
|
|
290
307
|
var getFooterSuctionState = function getFooterSuctionState() {
|
@@ -407,7 +424,42 @@ var ProTable = function ProTable(props) {
|
|
407
424
|
if (propsDataSource) {
|
408
425
|
setData(propsDataSource);
|
409
426
|
}
|
410
|
-
}, [propsDataSource]); //
|
427
|
+
}, [propsDataSource]); // 初始化 ActionRef。
|
428
|
+
|
429
|
+
initActionRef(actionRef, {
|
430
|
+
getState: function getState() {
|
431
|
+
return actionRefState;
|
432
|
+
},
|
433
|
+
getCallback: function getCallback() {
|
434
|
+
return actionRefCallback;
|
435
|
+
},
|
436
|
+
setState: function setState(key, value) {
|
437
|
+
actionRefState[key] = value;
|
438
|
+
actionRefUseStateOn(actionRefCallback, key, value);
|
439
|
+
},
|
440
|
+
on: function on(fun, state, name) {
|
441
|
+
if (!actionRefCallback[state]) {
|
442
|
+
actionRefCallback[state] = {};
|
443
|
+
}
|
444
|
+
|
445
|
+
actionRefCallback[state][name] = fun;
|
446
|
+
},
|
447
|
+
off: function off(name) {
|
448
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
|
449
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
450
|
+
k = _ref2[0],
|
451
|
+
v = _ref2[1];
|
452
|
+
|
453
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
|
454
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
455
|
+
k = _ref4[0];
|
456
|
+
|
457
|
+
return k !== name;
|
458
|
+
}));
|
459
|
+
return [k, filterV];
|
460
|
+
}));
|
461
|
+
}
|
462
|
+
}); // 绑定 Actions
|
411
463
|
|
412
464
|
useActionType(actionRef, {
|
413
465
|
fullScreen: function fullScreen() {
|
@@ -450,12 +502,12 @@ var ProTable = function ProTable(props) {
|
|
450
502
|
_request(params);
|
451
503
|
},
|
452
504
|
reset: function reset() {
|
453
|
-
var _actionRef$current3, _actionRef$current3$s;
|
505
|
+
var _actionRef$current3, _actionRef$current3$s, _dataFilterForm;
|
454
506
|
|
455
507
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
456
508
|
|
457
509
|
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setFilterRules) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, {});
|
458
|
-
dataFilterForm === null ||
|
510
|
+
(_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
|
459
511
|
setCurrentPage(1);
|
460
512
|
|
461
513
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -569,7 +621,7 @@ var ProTable = function ProTable(props) {
|
|
569
621
|
}); // 请求函数
|
570
622
|
|
571
623
|
function _request(params, noLoading) {
|
572
|
-
var _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
624
|
+
var _dataFilterForm2, _actionRef$current$ge, _actionRef$current4, _actionRef$current4$g, _objectSpread2;
|
573
625
|
|
574
626
|
// 如果没有传 url 且没有 customRequest,直接返回
|
575
627
|
if (!url && !customRequest) {
|
@@ -582,7 +634,7 @@ var ProTable = function ProTable(props) {
|
|
582
634
|
|
583
635
|
var sortParams = targetFormatSort(sort); // 筛选区请求参数
|
584
636
|
|
585
|
-
var dataFilterParams = toJS(dataFilterForm === null ||
|
637
|
+
var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
|
586
638
|
|
587
639
|
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getFilterRules) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
588
640
|
|
@@ -633,8 +685,7 @@ var ProTable = function ProTable(props) {
|
|
633
685
|
}
|
634
686
|
|
635
687
|
useEffect(function () {
|
636
|
-
|
637
|
-
initActionRef(); // 监听 浏览器变化 更吸底状态
|
688
|
+
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
638
689
|
|
639
690
|
if (footerSuction) {
|
640
691
|
getFooterSuctionState();
|
@@ -644,11 +695,21 @@ var ProTable = function ProTable(props) {
|
|
644
695
|
};
|
645
696
|
}
|
646
697
|
|
647
|
-
if (
|
648
|
-
|
649
|
-
|
698
|
+
if (propsDataFilter) {
|
699
|
+
var _dataFilterForm3;
|
700
|
+
|
701
|
+
if (requestWhenMount && ((_dataFilterForm3 = dataFilterForm) === null || _dataFilterForm3 === void 0 ? void 0 : _dataFilterForm3.id)) {
|
702
|
+
// 在请求发送之前 处理漏斗默认数据
|
703
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
650
704
|
|
651
|
-
|
705
|
+
_request();
|
706
|
+
}
|
707
|
+
} else {
|
708
|
+
if (requestWhenMount) {
|
709
|
+
processDefaultFilter(propsColumns, actionRef, defaultFilterParams);
|
710
|
+
|
711
|
+
_request();
|
712
|
+
}
|
652
713
|
}
|
653
714
|
|
654
715
|
return function () {
|
@@ -662,7 +723,7 @@ var ProTable = function ProTable(props) {
|
|
662
723
|
|
663
724
|
actionRef.current = undefined;
|
664
725
|
};
|
665
|
-
}, []);
|
726
|
+
}, [(_dataFilterForm4 = dataFilterForm) === null || _dataFilterForm4 === void 0 ? void 0 : _dataFilterForm4.id]);
|
666
727
|
|
667
728
|
function onSort(dataIndex, order) {
|
668
729
|
var nextSort = _defineProperty({}, dataIndex, order);
|
@@ -687,8 +748,10 @@ var ProTable = function ProTable(props) {
|
|
687
748
|
_request(_defineProperty({}, targetPageKey, 1));
|
688
749
|
},
|
689
750
|
onReset: function onReset() {
|
751
|
+
var _dataFilterForm5;
|
752
|
+
|
690
753
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
|
691
|
-
dataFilterForm === null ||
|
754
|
+
(_dataFilterForm5 = dataFilterForm) === null || _dataFilterForm5 === void 0 ? void 0 : _dataFilterForm5.reset();
|
692
755
|
setCurrentPage(1);
|
693
756
|
|
694
757
|
_request(_defineProperty({}, targetPageKey, 1));
|
package/es/table/index.scss
CHANGED
package/es/table/typing.d.ts
CHANGED
@@ -201,8 +201,6 @@ export declare type ProTableActionTypeMutations = {
|
|
201
201
|
getState?: () => ProTableActionTypeState;
|
202
202
|
/** 设置state 状态 */
|
203
203
|
setState?: (key: string, value: any) => void;
|
204
|
-
/** 初始化 state 状态 */
|
205
|
-
initState?: () => void;
|
206
204
|
/** 设置全屏状态 */
|
207
205
|
setFullScreenState?: (state: boolean) => void;
|
208
206
|
/** 绑定state监听事件 */
|
@@ -217,6 +215,8 @@ export declare type ProTableActionTypeMutations = {
|
|
217
215
|
resetTableMaxBodyHeight?: () => void;
|
218
216
|
/** 列筛选规则 */
|
219
217
|
filterColumns?: any[];
|
218
|
+
/** 获取所有 on 监听事件 */
|
219
|
+
getCallback?: () => any;
|
220
220
|
};
|
221
221
|
/** action Mutations 定义 */
|
222
222
|
export declare type ProTableActionTypeState = {
|
@@ -144,7 +144,7 @@ export var renderCell = function renderCell(value, item, index, record, actionRe
|
|
144
144
|
|
145
145
|
if (valueType === 'selectGroup') {
|
146
146
|
newRender = _objectSpread(_objectSpread({
|
147
|
-
maxShowNumber:
|
147
|
+
maxShowNumber: 'auto',
|
148
148
|
foldText: 'more',
|
149
149
|
editOnClick: function editOnClick() {},
|
150
150
|
edit: true
|
@@ -1,13 +1,14 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProTableActionType } from '../typing';
|
3
3
|
import { ProTableProps, ProTableColumnProps } from '..';
|
4
|
-
export declare function
|
4
|
+
export declare function actionRefUseStateOn(callback: any, state: string, ...args: any): void;
|
5
5
|
/** table 组件内监听 不对外暴露 */
|
6
6
|
export declare function on(fun: any, key: string): void;
|
7
7
|
/** table 组件内销毁监听 不对外暴露 */
|
8
8
|
export declare function off(key: string): void;
|
9
9
|
/** table 组件内触发事件 不对外暴露 */
|
10
10
|
export declare function emit(key: string, ...args: any): void;
|
11
|
+
export declare function initActionRef(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
11
12
|
export declare function useActionType<T>(ref: React.MutableRefObject<ProTableActionType | undefined>, action: ProTableActionType): void;
|
12
13
|
export declare function cloneDeep<T>(obj: T): T;
|
13
14
|
/**
|