@teamix/pro 1.2.29 → 1.2.33
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 +737 -1579
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/dialog-form.js +58 -9
- package/es/common.scss +22 -0
- package/es/form/Filter/SimpleFilter.js +10 -3
- package/es/form/Filter/index.d.ts +5 -9
- package/es/form/Filter/index.js +371 -154
- package/es/form/Filter/index.scss +33 -11
- package/es/form/Filter/index2.d.ts +9 -5
- package/es/form/Filter/index2.js +154 -370
- package/es/form/Filter/index2.scss +11 -33
- package/es/form/ProForm/index.scss +5 -0
- package/es/form/SchemaForm/index.js +4 -4
- package/es/form/index.d.ts +3 -3
- package/es/form/index.js +3 -3
- package/es/form/typing.d.ts +6 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/info/components/InfoValueItem/index.js +38 -12
- package/es/info/components/InfoValueItem/index.scss +1 -0
- package/es/info/components/ProInfoItem/index.js +6 -3
- package/es/info/components/ProInfoItem/index.scss +9 -0
- package/es/info/components/baseInfo/index.js +4 -2
- package/es/info/components/headerInfo/index.js +2 -1
- package/es/info/components/tableInfo/index.js +2 -1
- package/es/info/index.scss +2 -0
- package/es/info/typing.d.ts +3 -0
- package/es/table/components/Filter/index.js +6 -6
- package/es/table/components/Layout/index.js +39 -18
- package/es/table/components/Layout/index.scss +7 -0
- package/es/table/components/ToolBar/Fullscreen.js +7 -11
- package/es/table/components/ToolBar/index.scss +1 -0
- package/es/table/index.js +82 -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/dialog-form.js +57 -10
- package/lib/common.scss +22 -0
- package/lib/form/Filter/SimpleFilter.js +8 -1
- package/lib/form/Filter/index.d.ts +5 -9
- package/lib/form/Filter/index.js +384 -154
- package/lib/form/Filter/index.scss +33 -11
- package/lib/form/Filter/index2.d.ts +9 -5
- package/lib/form/Filter/index2.js +154 -383
- package/lib/form/Filter/index2.scss +11 -33
- package/lib/form/ProForm/index.scss +5 -0
- package/lib/form/SchemaForm/index.js +4 -4
- package/lib/form/index.d.ts +3 -3
- package/lib/form/index.js +8 -8
- package/lib/form/typing.d.ts +6 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/info/components/InfoValueItem/index.js +38 -12
- package/lib/info/components/InfoValueItem/index.scss +1 -0
- package/lib/info/components/ProInfoItem/index.js +6 -3
- package/lib/info/components/ProInfoItem/index.scss +9 -0
- package/lib/info/components/baseInfo/index.js +4 -2
- package/lib/info/components/headerInfo/index.js +2 -1
- package/lib/info/components/tableInfo/index.js +2 -1
- package/lib/info/index.scss +2 -0
- package/lib/info/typing.d.ts +3 -0
- package/lib/table/components/Filter/index.js +6 -6
- package/lib/table/components/Layout/index.js +39 -18
- package/lib/table/components/Layout/index.scss +7 -0
- package/lib/table/components/ToolBar/Fullscreen.js +7 -11
- package/lib/table/components/ToolBar/index.scss +1 -0
- package/lib/table/index.js +81 -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/dist/212.js +0 -155705
- package/dist/fonts/codicon.ttf +0 -0
- 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/lib/table/index.js
CHANGED
@@ -281,7 +281,24 @@ var ProTable = function ProTable(props) {
|
|
281
281
|
var _useState19 = (0, _react.useState)(true),
|
282
282
|
_useState20 = _slicedToArray(_useState19, 2),
|
283
283
|
showLoading = _useState20[0],
|
284
|
-
setShowLoading = _useState20[1]; //
|
284
|
+
setShowLoading = _useState20[1]; // 存储能够被 on 监听到的 ProTable 状态
|
285
|
+
// 因为只做存储用。不需要更新视图以及需要同步更改。所以不使用 setState 更新
|
286
|
+
|
287
|
+
|
288
|
+
var _useState21 = (0, _react.useState)({
|
289
|
+
fullScreenState: false,
|
290
|
+
filterRules: {},
|
291
|
+
filterColumns: []
|
292
|
+
}),
|
293
|
+
_useState22 = _slicedToArray(_useState21, 1),
|
294
|
+
actionRefState = _useState22[0]; // 存储 on 监听事件
|
295
|
+
|
296
|
+
|
297
|
+
var _useState23 = (0, _react.useState)({
|
298
|
+
fullScreenState: {}
|
299
|
+
}),
|
300
|
+
_useState24 = _slicedToArray(_useState23, 1),
|
301
|
+
actionRefCallback = _useState24[0]; // 存储定时器 id
|
285
302
|
|
286
303
|
|
287
304
|
var autoRefreshTimerRef = (0, _react.useRef)(); // 获取header高度,用作全屏吸底吸底高度计算
|
@@ -305,16 +322,16 @@ var ProTable = function ProTable(props) {
|
|
305
322
|
}; // header 区域高度。用作全屏计算吸顶吸底高度。默认不做计算
|
306
323
|
|
307
324
|
|
308
|
-
var
|
309
|
-
|
310
|
-
headerHeight =
|
311
|
-
setHeaderHeight =
|
325
|
+
var _useState25 = (0, _react.useState)(0),
|
326
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
327
|
+
headerHeight = _useState26[0],
|
328
|
+
setHeaderHeight = _useState26[1]; // 全屏显示 className
|
312
329
|
|
313
330
|
|
314
|
-
var
|
315
|
-
|
316
|
-
fullscreenState =
|
317
|
-
setFullscreenState =
|
331
|
+
var _useState27 = (0, _react.useState)(false),
|
332
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
333
|
+
fullscreenState = _useState28[0],
|
334
|
+
setFullscreenState = _useState28[1]; // 非全屏状态下的
|
318
335
|
|
319
336
|
|
320
337
|
var normalDataFilterFormRef = (0, _react.useRef)();
|
@@ -325,10 +342,10 @@ var ProTable = function ProTable(props) {
|
|
325
342
|
var dataFilterFormRef = !fullscreenState ? normalDataFilterFormRef : fullscreenDataFilterFormRef;
|
326
343
|
var dataFilterForm = dataFilterFormRef.current; // 整个内容区是否超过一屏。用于表格在非全屏模式下的吸底
|
327
344
|
|
328
|
-
var
|
329
|
-
|
330
|
-
footerSuctionState =
|
331
|
-
setFooterSuctionState =
|
345
|
+
var _useState29 = (0, _react.useState)(false),
|
346
|
+
_useState30 = _slicedToArray(_useState29, 2),
|
347
|
+
footerSuctionState = _useState30[0],
|
348
|
+
setFooterSuctionState = _useState30[1]; // TODO 获取内容区是否超出一屏(暂时仅支持全家桶)
|
332
349
|
|
333
350
|
|
334
351
|
var getFooterSuctionState = function getFooterSuctionState() {
|
@@ -451,25 +468,63 @@ var ProTable = function ProTable(props) {
|
|
451
468
|
if (propsDataSource) {
|
452
469
|
setData(propsDataSource);
|
453
470
|
}
|
454
|
-
}, [propsDataSource]); //
|
471
|
+
}, [propsDataSource]); // 初始化 ActionRef。
|
472
|
+
|
473
|
+
(0, _utils2.initActionRef)(actionRef, {
|
474
|
+
getState: function getState() {
|
475
|
+
return actionRefState;
|
476
|
+
},
|
477
|
+
getCallback: function getCallback() {
|
478
|
+
return actionRefCallback;
|
479
|
+
},
|
480
|
+
setState: function setState(key, value) {
|
481
|
+
actionRefState[key] = value;
|
482
|
+
(0, _utils2.actionRefUseStateOn)(actionRefCallback, key, value);
|
483
|
+
},
|
484
|
+
on: function on(fun, state, name) {
|
485
|
+
if (!actionRefCallback[state]) {
|
486
|
+
actionRefCallback[state] = {};
|
487
|
+
}
|
488
|
+
|
489
|
+
actionRefCallback[state][name] = fun;
|
490
|
+
},
|
491
|
+
off: function off(name) {
|
492
|
+
actionRefCallback = Object.fromEntries(Object.entries(actionRefCallback).map(function (_ref) {
|
493
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
494
|
+
k = _ref2[0],
|
495
|
+
v = _ref2[1];
|
496
|
+
|
497
|
+
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref3) {
|
498
|
+
var _ref4 = _slicedToArray(_ref3, 1),
|
499
|
+
k = _ref4[0];
|
500
|
+
|
501
|
+
return k !== name;
|
502
|
+
}));
|
503
|
+
return [k, filterV];
|
504
|
+
}));
|
505
|
+
}
|
506
|
+
}); // 绑定 Actions
|
455
507
|
|
456
508
|
(0, _utils2.useActionType)(actionRef, {
|
457
509
|
fullScreen: function fullScreen() {
|
510
|
+
var _actionRef$current2, _actionRef$current2$s;
|
511
|
+
|
458
512
|
var state = !fullscreenState; // 全屏时需要重新计算header高度
|
459
513
|
|
460
514
|
getHeaderHeight().then(function (height) {
|
461
515
|
setHeaderHeight(height);
|
462
516
|
});
|
463
517
|
setFullscreenState(state);
|
518
|
+
actionRef === null || actionRef === void 0 ? void 0 : (_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, 'fullScreenState', state);
|
464
519
|
return state;
|
465
520
|
},
|
466
521
|
setColumn: function setColumn(newColumns) {
|
467
|
-
var _actionRef$
|
522
|
+
var _actionRef$current3, _actionRef$current3$s;
|
468
523
|
|
469
524
|
var update = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
470
525
|
var columns = processColumns(newColumns, propsColumns);
|
471
526
|
setFilteredColumns(columns);
|
472
|
-
(_actionRef$
|
527
|
+
(_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, 'filterColumns', columns);
|
473
528
|
|
474
529
|
if (update) {
|
475
530
|
(0, _utils2.emit)('refreshFilterState', newColumns);
|
@@ -494,11 +549,11 @@ var ProTable = function ProTable(props) {
|
|
494
549
|
_request(params);
|
495
550
|
},
|
496
551
|
reset: function reset() {
|
497
|
-
var _actionRef$
|
552
|
+
var _actionRef$current4, _actionRef$current4$s, _dataFilterForm;
|
498
553
|
|
499
554
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset()); // 清空列过滤参数
|
500
555
|
|
501
|
-
(_actionRef$
|
556
|
+
(_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, {});
|
502
557
|
(_dataFilterForm = dataFilterForm) === null || _dataFilterForm === void 0 ? void 0 : _dataFilterForm.reset();
|
503
558
|
setCurrentPage(1);
|
504
559
|
|
@@ -613,7 +668,7 @@ var ProTable = function ProTable(props) {
|
|
613
668
|
}); // 请求函数
|
614
669
|
|
615
670
|
function _request(params, noLoading) {
|
616
|
-
var _dataFilterForm2, _actionRef$current$ge, _actionRef$
|
671
|
+
var _dataFilterForm2, _actionRef$current$ge, _actionRef$current5, _actionRef$current5$g, _objectSpread2;
|
617
672
|
|
618
673
|
// 如果没有传 url 且没有 customRequest,直接返回
|
619
674
|
if (!url && !customRequest) {
|
@@ -628,7 +683,7 @@ var ProTable = function ProTable(props) {
|
|
628
683
|
|
629
684
|
var dataFilterParams = toJS((_dataFilterForm2 = dataFilterForm) === null || _dataFilterForm2 === void 0 ? void 0 : _dataFilterForm2.values); // 列过滤请求参数
|
630
685
|
|
631
|
-
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$
|
686
|
+
var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current5 = actionRef.current) === null || _actionRef$current5 === void 0 ? void 0 : (_actionRef$current5$g = _actionRef$current5.getFilterRules) === null || _actionRef$current5$g === void 0 ? void 0 : _actionRef$current5$g.call(_actionRef$current5)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {}; // 格式化后的请求参数
|
632
687
|
|
633
688
|
var requestData = formatParams(_objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, targetPageKey, currentPage), _defineProperty(_objectSpread2, targetPageSizeKey, pageSize), _objectSpread2), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params));
|
634
689
|
|
@@ -677,8 +732,6 @@ var ProTable = function ProTable(props) {
|
|
677
732
|
}
|
678
733
|
|
679
734
|
(0, _react.useEffect)(function () {
|
680
|
-
// 初始化 actionRef state、callback 此时 actionRef 已初始化完成
|
681
|
-
(0, _utils2.initActionRef)();
|
682
735
|
dataFilterForm = dataFilterFormRef.current; // 监听 浏览器变化 更吸底状态
|
683
736
|
|
684
737
|
if (footerSuction) {
|
@@ -732,11 +785,11 @@ var ProTable = function ProTable(props) {
|
|
732
785
|
mode: 'inline'
|
733
786
|
}, propsDataFilter), {}, {
|
734
787
|
onFilter: function onFilter(values) {
|
735
|
-
var _actionRef$
|
788
|
+
var _actionRef$current6, _actionRef$current6$c;
|
736
789
|
|
737
790
|
(propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onFilter(values)); // 搜索变化时,暂时先清空选择
|
738
791
|
|
739
|
-
(_actionRef$
|
792
|
+
(_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);
|
740
793
|
setCurrentPage(1);
|
741
794
|
|
742
795
|
_request(_defineProperty({}, targetPageKey, 1));
|
@@ -832,21 +885,21 @@ var ProTable = function ProTable(props) {
|
|
832
885
|
|
833
886
|
var renderFooter = function renderFooter() {
|
834
887
|
function onChangePagination(currentPage) {
|
835
|
-
var _actionRef$
|
888
|
+
var _actionRef$current7, _actionRef$current7$c;
|
836
889
|
|
837
890
|
var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
838
891
|
// 翻页暂时先清空选择
|
839
|
-
(_actionRef$
|
892
|
+
(_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);
|
840
893
|
setCurrentPage(currentPage);
|
841
894
|
|
842
895
|
_request(_objectSpread(_defineProperty({}, targetPageKey, currentPage), params));
|
843
896
|
}
|
844
897
|
|
845
898
|
function onChangePaginationSize(currentPageSize) {
|
846
|
-
var _actionRef$
|
899
|
+
var _actionRef$current8, _actionRef$current8$c, _request5;
|
847
900
|
|
848
901
|
// 翻页暂时先清空选择
|
849
|
-
(_actionRef$
|
902
|
+
(_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
|
850
903
|
setPageSize(currentPageSize);
|
851
904
|
setCurrentPage(1);
|
852
905
|
|
package/lib/table/index.scss
CHANGED
package/lib/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 = {
|
@@ -157,7 +157,7 @@ var renderCell = function renderCell(value, item, index, record, actionRef) {
|
|
157
157
|
|
158
158
|
if (valueType === 'selectGroup') {
|
159
159
|
newRender = _objectSpread(_objectSpread({
|
160
|
-
maxShowNumber:
|
160
|
+
maxShowNumber: 'auto',
|
161
161
|
foldText: 'more',
|
162
162
|
editOnClick: function editOnClick() {},
|
163
163
|
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/lib/table/utils/index.js
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
+
exports.actionRefUseStateOn = actionRefUseStateOn;
|
6
7
|
exports.cloneDeep = cloneDeep;
|
7
8
|
exports.emit = emit;
|
8
9
|
exports.initActionRef = initActionRef;
|
@@ -33,128 +34,75 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
33
34
|
|
34
35
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
35
36
|
|
36
|
-
//
|
37
|
-
var
|
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
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
},
|
83
|
-
|
84
|
-
/**
|
85
|
-
* 获取筛选规则。为params
|
86
|
-
*/
|
87
|
-
getFilterRules: function getFilterRules() {
|
88
|
-
var result = {};
|
89
|
-
|
90
|
-
if (state.filterRules) {
|
91
|
-
result = Object.entries(state.filterRules).map(function (_ref) {
|
92
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
93
|
-
k = _ref2[0],
|
94
|
-
v = _ref2[1];
|
95
|
-
|
96
|
-
return _defineProperty({}, k, v.params);
|
97
|
-
}).reduce(function (acc, cur) {
|
98
|
-
acc = _objectSpread(_objectSpread({}, acc), cur);
|
99
|
-
return acc;
|
100
|
-
}, {});
|
101
|
-
}
|
37
|
+
// 所有 ProTable 组件公用一套组件内事件转发机制
|
38
|
+
var tableCallback = {}; // 组件内对全局状态的更改
|
39
|
+
|
40
|
+
var getMutations = function getMutations(actionRef) {
|
41
|
+
var _actionRef$current2, _actionRef$current2$g, _actionRef$current2$g2;
|
42
|
+
|
43
|
+
return {
|
44
|
+
setFullScreenState: function setFullScreenState(fullScreenState) {
|
45
|
+
var _actionRef$current, _actionRef$current$se;
|
46
|
+
|
47
|
+
(_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);
|
48
|
+
},
|
49
|
+
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,
|
50
|
+
|
51
|
+
/**
|
52
|
+
* 设置筛选列规则
|
53
|
+
* @param rules 规则
|
54
|
+
* @param dataIndex column.dataIndex
|
55
|
+
*/
|
56
|
+
setFilterRules: function setFilterRules(rules) {
|
57
|
+
var _actionRef$current3, _actionRef$current3$s;
|
58
|
+
|
59
|
+
(_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);
|
60
|
+
},
|
61
|
+
|
62
|
+
/**
|
63
|
+
* 获取筛选规则。为params
|
64
|
+
*/
|
65
|
+
getFilterRules: function getFilterRules() {
|
66
|
+
var _actionRef$current4, _actionRef$current4$g;
|
67
|
+
|
68
|
+
var result = {};
|
69
|
+
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;
|
70
|
+
|
71
|
+
if (filterRules) {
|
72
|
+
result = Object.entries(filterRules).map(function (_ref) {
|
73
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
74
|
+
k = _ref2[0],
|
75
|
+
v = _ref2[1];
|
76
|
+
|
77
|
+
return _defineProperty({}, k, v.params);
|
78
|
+
}).reduce(function (acc, cur) {
|
79
|
+
acc = _objectSpread(_objectSpread({}, acc), cur);
|
80
|
+
return acc;
|
81
|
+
}, {});
|
82
|
+
}
|
102
83
|
|
103
|
-
|
104
|
-
},
|
105
|
-
|
106
|
-
/**
|
107
|
-
* 绑定监听函数
|
108
|
-
* @param fun 监听函数
|
109
|
-
* @param state 需要监听的state
|
110
|
-
* @param name 监听名(作为销毁唯一id使用)
|
111
|
-
*/
|
112
|
-
on: function on(fun, state, name) {
|
113
|
-
if (!callback[state]) {
|
114
|
-
callback[state] = {};
|
84
|
+
return result;
|
115
85
|
}
|
116
|
-
|
117
|
-
callback[state][name] = fun;
|
118
|
-
},
|
119
|
-
off: function off(name) {
|
120
|
-
callback = Object.fromEntries(Object.entries(callback).map(function (_ref4) {
|
121
|
-
var _ref5 = _slicedToArray(_ref4, 2),
|
122
|
-
k = _ref5[0],
|
123
|
-
v = _ref5[1];
|
124
|
-
|
125
|
-
var filterV = Object.fromEntries(Object.entries(v).filter(function (_ref6) {
|
126
|
-
var _ref7 = _slicedToArray(_ref6, 1),
|
127
|
-
k = _ref7[0];
|
128
|
-
|
129
|
-
return k !== name;
|
130
|
-
}));
|
131
|
-
return [k, filterV];
|
132
|
-
}));
|
133
|
-
}
|
86
|
+
};
|
134
87
|
}; // 调用绑定的监听函数
|
135
88
|
|
136
|
-
|
137
|
-
|
138
|
-
|
89
|
+
|
90
|
+
function actionRefUseStateOn(callback, state) {
|
91
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
92
|
+
args[_key - 2] = arguments[_key];
|
139
93
|
}
|
140
94
|
|
141
95
|
if (callback[state]) {
|
142
|
-
Object.entries(callback[state]).forEach(function (
|
143
|
-
var
|
144
|
-
k =
|
145
|
-
v =
|
96
|
+
Object.entries(callback[state]).forEach(function (_ref4) {
|
97
|
+
var _ref5 = _slicedToArray(_ref4, 2),
|
98
|
+
k = _ref5[0],
|
99
|
+
v = _ref5[1];
|
146
100
|
|
147
101
|
if (v) {
|
148
102
|
v === null || v === void 0 ? void 0 : v.apply(void 0, args);
|
149
103
|
}
|
150
104
|
});
|
151
105
|
}
|
152
|
-
}; // 初始化 actionRef
|
153
|
-
|
154
|
-
|
155
|
-
function initActionRef() {
|
156
|
-
state = (0, _lodash.default)(_initState);
|
157
|
-
callback = (0, _lodash.default)(initCallback);
|
158
106
|
}
|
159
107
|
/** table 组件内监听 不对外暴露 */
|
160
108
|
|
@@ -185,13 +133,16 @@ function emit(key) {
|
|
185
133
|
}
|
186
134
|
}
|
187
135
|
|
188
|
-
function
|
189
|
-
|
190
|
-
var userAction = _objectSpread(_objectSpread({}, action), mutations);
|
136
|
+
function initActionRef(ref, action) {
|
137
|
+
var userAction = _objectSpread(_objectSpread({}, action), getMutations(ref));
|
191
138
|
|
192
139
|
ref.current = userAction;
|
193
140
|
}
|
194
141
|
|
142
|
+
function useActionType(ref, action) {
|
143
|
+
ref.current = _objectSpread(_objectSpread({}, ref.current), action);
|
144
|
+
}
|
145
|
+
|
195
146
|
function cloneDeep(obj) {
|
196
147
|
return (0, _lodash.default)(obj);
|
197
148
|
}
|