@teamix/pro 1.2.30 → 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.js +193 -165
- package/dist/pro.min.js +1 -1
- 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/index.js +67 -17
- 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/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/index.js +66 -16
- 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
@@ -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: ''
|
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';
|
@@ -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();
|
@@ -281,10 +298,10 @@ var ProTable = function ProTable(props) {
|
|
281
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() {
|
@@ -633,8 +685,6 @@ var ProTable = function ProTable(props) {
|
|
633
685
|
}
|
634
686
|
|
635
687
|
useEffect(function () {
|
636
|
-
// 初始化 actionRef state、callback 此时 actionRef 已初始化完成
|
637
|
-
initActionRef();
|
638
688
|
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
639
689
|
|
640
690
|
if (footerSuction) {
|
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
|
/**
|
package/es/table/utils/index.js
CHANGED
@@ -16,129 +16,76 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
16
16
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
18
18
|
|
19
|
-
import cloneDeepLodash from 'lodash.clonedeep'; //
|
20
|
-
|
21
|
-
var
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
},
|
67
|
-
|
68
|
-
/**
|
69
|
-
* 获取筛选规则。为params
|
70
|
-
*/
|
71
|
-
getFilterRules: function getFilterRules() {
|
72
|
-
var result = {};
|
73
|
-
|
74
|
-
if (state.filterRules) {
|
75
|
-
result = Object.entries(state.filterRules).map(function (_ref) {
|
76
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
77
|
-
k = _ref2[0],
|
78
|
-
v = _ref2[1];
|
79
|
-
|
80
|
-
return _defineProperty({}, k, v.params);
|
81
|
-
}).reduce(function (acc, cur) {
|
82
|
-
acc = _objectSpread(_objectSpread({}, acc), cur);
|
83
|
-
return acc;
|
84
|
-
}, {});
|
85
|
-
}
|
19
|
+
import cloneDeepLodash from 'lodash.clonedeep'; // 所有 ProTable 组件公用一套组件内事件转发机制
|
20
|
+
|
21
|
+
var tableCallback = {}; // 组件内对全局状态的更改
|
22
|
+
|
23
|
+
var getMutations = function getMutations(actionRef) {
|
24
|
+
var _actionRef$current2, _actionRef$current2$g, _actionRef$current2$g2;
|
25
|
+
|
26
|
+
return {
|
27
|
+
setFullScreenState: function setFullScreenState(fullScreenState) {
|
28
|
+
var _actionRef$current, _actionRef$current$se;
|
29
|
+
|
30
|
+
(_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, 'fullScreenState', fullScreenState);
|
31
|
+
},
|
32
|
+
filterColumns: (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$g = _actionRef$current2.getState) === null || _actionRef$current2$g === void 0 ? void 0 : (_actionRef$current2$g2 = _actionRef$current2$g.call(_actionRef$current2)) === null || _actionRef$current2$g2 === void 0 ? void 0 : _actionRef$current2$g2.filterColumns,
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 设置筛选列规则
|
36
|
+
* @param rules 规则
|
37
|
+
* @param dataIndex column.dataIndex
|
38
|
+
*/
|
39
|
+
setFilterRules: function setFilterRules(rules) {
|
40
|
+
var _actionRef$current3, _actionRef$current3$s;
|
41
|
+
|
42
|
+
(_actionRef$current3 = actionRef.current) === null || _actionRef$current3 === void 0 ? void 0 : (_actionRef$current3$s = _actionRef$current3.setState) === null || _actionRef$current3$s === void 0 ? void 0 : _actionRef$current3$s.call(_actionRef$current3, 'filterRules', rules);
|
43
|
+
},
|
44
|
+
|
45
|
+
/**
|
46
|
+
* 获取筛选规则。为params
|
47
|
+
*/
|
48
|
+
getFilterRules: function getFilterRules() {
|
49
|
+
var _actionRef$current4, _actionRef$current4$g;
|
50
|
+
|
51
|
+
var result = {};
|
52
|
+
var filterRules = (_actionRef$current4 = actionRef.current) === null || _actionRef$current4 === void 0 ? void 0 : (_actionRef$current4$g = _actionRef$current4.getState) === null || _actionRef$current4$g === void 0 ? void 0 : _actionRef$current4$g.call(_actionRef$current4).filterRules;
|
53
|
+
|
54
|
+
if (filterRules) {
|
55
|
+
result = Object.entries(filterRules).map(function (_ref) {
|
56
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
57
|
+
k = _ref2[0],
|
58
|
+
v = _ref2[1];
|
59
|
+
|
60
|
+
return _defineProperty({}, k, v.params);
|
61
|
+
}).reduce(function (acc, cur) {
|
62
|
+
acc = _objectSpread(_objectSpread({}, acc), cur);
|
63
|
+
return acc;
|
64
|
+
}, {});
|
65
|
+
}
|
86
66
|
|
87
|
-
|
88
|
-
},
|
89
|
-
|
90
|
-
/**
|
91
|
-
* 绑定监听函数
|
92
|
-
* @param fun 监听函数
|
93
|
-
* @param state 需要监听的state
|
94
|
-
* @param name 监听名(作为销毁唯一id使用)
|
95
|
-
*/
|
96
|
-
on: function on(fun, state, name) {
|
97
|
-
if (!callback[state]) {
|
98
|
-
callback[state] = {};
|
67
|
+
return result;
|
99
68
|
}
|
100
|
-
|
101
|
-
callback[state][name] = fun;
|
102
|
-
},
|
103
|
-
off: function off(name) {
|
104
|
-
callback = Object.fromEntries(Object.entries(callback).map(function (_ref4) {
|
105
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
106
|
-
k = _ref5[0],
|
107
|
-
v = _ref5[1];
|
108
|
-
|
109
|
-
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref6) {
|
110
|
-
var _ref7 = _slicedToArray(_ref6, 1),
|
111
|
-
k = _ref7[0];
|
112
|
-
|
113
|
-
return k !== name;
|
114
|
-
}));
|
115
|
-
return [k, filterV];
|
116
|
-
}));
|
117
|
-
}
|
69
|
+
};
|
118
70
|
}; // 调用绑定的监听函数
|
119
71
|
|
120
|
-
|
121
|
-
|
122
|
-
|
72
|
+
|
73
|
+
export function actionRefUseStateOn(callback, state) {
|
74
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
75
|
+
args[_key - 2] = arguments[_key];
|
123
76
|
}
|
124
77
|
|
125
78
|
if (callback[state]) {
|
126
|
-
Object.entries(callback[state]).forEach(function (
|
127
|
-
var
|
128
|
-
k =
|
129
|
-
v =
|
79
|
+
Object.entries(callback[state]).forEach(function (_ref4) {
|
80
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
81
|
+
k = _ref5[0],
|
82
|
+
v = _ref5[1];
|
130
83
|
|
131
84
|
if (v) {
|
132
85
|
v === null || v === void 0 ? void 0 : v.apply(void 0, args);
|
133
86
|
}
|
134
87
|
});
|
135
88
|
}
|
136
|
-
}; // 初始化 actionRef
|
137
|
-
|
138
|
-
|
139
|
-
export function initActionRef() {
|
140
|
-
state = cloneDeepLodash(_initState);
|
141
|
-
callback = cloneDeepLodash(initCallback);
|
142
89
|
}
|
143
90
|
/** table 组件内监听 不对外暴露 */
|
144
91
|
|
@@ -165,12 +112,14 @@ export function emit(key) {
|
|
165
112
|
fun.apply(void 0, args);
|
166
113
|
}
|
167
114
|
}
|
168
|
-
export function
|
169
|
-
|
170
|
-
var userAction = _objectSpread(_objectSpread({}, action), mutations);
|
115
|
+
export function initActionRef(ref, action) {
|
116
|
+
var userAction = _objectSpread(_objectSpread({}, action), getMutations(ref));
|
171
117
|
|
172
118
|
ref.current = userAction;
|
173
119
|
}
|
120
|
+
export function useActionType(ref, action) {
|
121
|
+
ref.current = _objectSpread(_objectSpread({}, ref.current), action);
|
122
|
+
}
|
174
123
|
export function cloneDeep(obj) {
|
175
124
|
return cloneDeepLodash(obj);
|
176
125
|
}
|
@@ -35,7 +35,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
35
35
|
|
36
36
|
// 初始化Search组件,内置部分属性
|
37
37
|
var initializeSearch = function initializeSearch(schema) {
|
38
|
-
var searchName;
|
38
|
+
var searchName = '';
|
39
39
|
var initializedSchema = schema.map(function (item) {
|
40
40
|
if (item.component === 'Search') {
|
41
41
|
searchName = item.name;
|
@@ -104,6 +104,13 @@ var SimpleFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
104
104
|
onChange === null || onChange === void 0 ? void 0 : onChange(values, name, value);
|
105
105
|
}
|
106
106
|
}, [searchName, searchValue.current]);
|
107
|
+
(0, _react.useEffect)(function () {
|
108
|
+
var _props$form$initialVa, _props$form$initialVa2;
|
109
|
+
|
110
|
+
// 处理Search组件,缓存input的默认值
|
111
|
+
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];
|
112
|
+
searchValue.current = (0, _utils.isValid)(searchDefaultValue) ? searchDefaultValue : '';
|
113
|
+
}, []);
|
107
114
|
return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread({}, otherProps), {}, {
|
108
115
|
className: (0, _classnames.default)(prefixCls, props.className),
|
109
116
|
schema: simpleSchema,
|
package/lib/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/lib/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/lib/index.js
CHANGED
@@ -103,7 +103,8 @@ var ProBaseInfo = function ProBaseInfo(props) {
|
|
103
103
|
|
104
104
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (size === null || size === void 0 ? void 0 : size.width) && /*#__PURE__*/_react.default.createElement(Row, {
|
105
105
|
wrap: true,
|
106
|
-
className: "teamix-pro-info-content-row"
|
106
|
+
className: "teamix-pro-info-content-row",
|
107
|
+
gutter: 20
|
107
108
|
}, renderContent()));
|
108
109
|
};
|
109
110
|
|
@@ -70,10 +70,10 @@ var Filter = function Filter(props) {
|
|
70
70
|
setVisible = _useState4[1];
|
71
71
|
|
72
72
|
(0, _react.useEffect)(function () {
|
73
|
-
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4;
|
73
|
+
var _actionRef$current$ge, _actionRef$current, _actionRef$current$ge2, _actionRef$current$ge3, _actionRef$current$ge4, _actionRef$current$ge5;
|
74
74
|
|
75
75
|
// 从全局状态中读取上次存储的条件
|
76
|
-
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)
|
76
|
+
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 : [];
|
77
77
|
setSelected(rules);
|
78
78
|
}, []); // 获取过滤项
|
79
79
|
|
@@ -191,7 +191,7 @@ var Filter = function Filter(props) {
|
|
191
191
|
btn: true
|
192
192
|
}),
|
193
193
|
onClick: function onClick() {
|
194
|
-
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$
|
194
|
+
var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge6, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current4$s;
|
195
195
|
|
196
196
|
(_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
|
197
197
|
|
@@ -206,7 +206,7 @@ var Filter = function Filter(props) {
|
|
206
206
|
} // 需要带上其他所有的信息
|
207
207
|
|
208
208
|
|
209
|
-
var rules = (_actionRef$current$
|
209
|
+
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 : {}; // 再设置所有的列筛选状态
|
210
210
|
|
211
211
|
(_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, {
|
212
212
|
rules: selected,
|
@@ -239,10 +239,10 @@ var Filter = function Filter(props) {
|
|
239
239
|
btn: true
|
240
240
|
}),
|
241
241
|
onClick: function onClick() {
|
242
|
-
var _actionRef$current$
|
242
|
+
var _actionRef$current$ge7, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
|
243
243
|
|
244
244
|
setSelected([]);
|
245
|
-
var rules = (_actionRef$current$
|
245
|
+
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 : {};
|
246
246
|
(_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, {
|
247
247
|
rules: [],
|
248
248
|
params: ''
|