ls-pro-common 1.0.72 → 1.0.75
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/common.css +6 -0
- package/dist/common.js +1 -1
- package/dist/common.min.css +6 -0
- package/dist/common.min.js +1 -1
- package/es/hooks/useDtl/index.js +29 -13
- package/es/hooks/useSingle/index.d.ts +0 -2
- package/es/hooks/useSingle/index.js +11 -7
- package/lib/hooks/useDtl/index.js +29 -13
- package/lib/hooks/useSingle/index.d.ts +0 -2
- package/lib/hooks/useSingle/index.js +11 -7
- package/package.json +2 -2
package/es/hooks/useDtl/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
7
7
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
8
|
-
var _excluded = ["current", "pageSize"];
|
|
8
|
+
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
9
9
|
import React from "react";
|
|
10
10
|
import { useState, useRef, useCallback, useMemo } from 'react';
|
|
11
11
|
import { PlusCircleOutlined, EditOutlined, DeleteOutlined, ImportOutlined, ExportOutlined } from '@ant-design/icons';
|
|
@@ -774,13 +774,13 @@ function useDtl(dtlParam) {
|
|
|
774
774
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(params, sort, filter) {
|
|
775
775
|
var _tableRef$current3, _tableRef$current3$cl;
|
|
776
776
|
|
|
777
|
-
var current, pageSize, rest, param, key, sortArr, _key, _key2, result;
|
|
777
|
+
var current, pageSize, sumProperties, rest, param, key, sortArr, _key, _key2, result;
|
|
778
778
|
|
|
779
779
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
780
780
|
while (1) {
|
|
781
781
|
switch (_context8.prev = _context8.next) {
|
|
782
782
|
case 0:
|
|
783
|
-
current = params.current, pageSize = params.pageSize, rest = _objectWithoutProperties(params, _excluded);
|
|
783
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = _objectWithoutProperties(params, _excluded);
|
|
784
784
|
|
|
785
785
|
if (!(!masterObject || !masterObject[mstKeyField])) {
|
|
786
786
|
_context8.next = 3;
|
|
@@ -798,6 +798,13 @@ function useDtl(dtlParam) {
|
|
|
798
798
|
if (current) {
|
|
799
799
|
param.page = current;
|
|
800
800
|
param.pageSize = pageSize;
|
|
801
|
+
} // 合计
|
|
802
|
+
|
|
803
|
+
|
|
804
|
+
if (sumProperties) {
|
|
805
|
+
param.sumProperties = sumProperties;
|
|
806
|
+
delete param.page;
|
|
807
|
+
delete param.pageSize;
|
|
801
808
|
}
|
|
802
809
|
|
|
803
810
|
param.where = {};
|
|
@@ -816,7 +823,7 @@ function useDtl(dtlParam) {
|
|
|
816
823
|
} //处理排序
|
|
817
824
|
|
|
818
825
|
|
|
819
|
-
if (sort && Object.keys(sort).length) {
|
|
826
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
820
827
|
sortArr = [];
|
|
821
828
|
|
|
822
829
|
for (_key in sort) {
|
|
@@ -837,20 +844,20 @@ function useDtl(dtlParam) {
|
|
|
837
844
|
_context8.t0 = beforeLoad;
|
|
838
845
|
|
|
839
846
|
if (!_context8.t0) {
|
|
840
|
-
_context8.next =
|
|
847
|
+
_context8.next = 20;
|
|
841
848
|
break;
|
|
842
849
|
}
|
|
843
850
|
|
|
844
|
-
_context8.next =
|
|
851
|
+
_context8.next = 18;
|
|
845
852
|
return beforeLoad(param);
|
|
846
853
|
|
|
847
|
-
case
|
|
854
|
+
case 18:
|
|
848
855
|
_context8.t1 = _context8.sent;
|
|
849
856
|
_context8.t0 = _context8.t1 === false;
|
|
850
857
|
|
|
851
|
-
case
|
|
858
|
+
case 20:
|
|
852
859
|
if (!_context8.t0) {
|
|
853
|
-
_context8.next =
|
|
860
|
+
_context8.next = 22;
|
|
854
861
|
break;
|
|
855
862
|
}
|
|
856
863
|
|
|
@@ -859,17 +866,26 @@ function useDtl(dtlParam) {
|
|
|
859
866
|
success: true
|
|
860
867
|
});
|
|
861
868
|
|
|
862
|
-
case
|
|
863
|
-
|
|
869
|
+
case 22:
|
|
870
|
+
if (sumProperties && param.sort) {
|
|
871
|
+
delete param.sort;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
_context8.next = 25;
|
|
864
875
|
return dtlService.load(param);
|
|
865
876
|
|
|
866
|
-
case
|
|
877
|
+
case 25:
|
|
867
878
|
result = _context8.sent;
|
|
868
879
|
result.data = result.rows;
|
|
869
880
|
result.success = true;
|
|
881
|
+
|
|
882
|
+
if (sumProperties) {
|
|
883
|
+
result.data = result.footer;
|
|
884
|
+
}
|
|
885
|
+
|
|
870
886
|
return _context8.abrupt("return", result);
|
|
871
887
|
|
|
872
|
-
case
|
|
888
|
+
case 30:
|
|
873
889
|
case "end":
|
|
874
890
|
return _context8.stop();
|
|
875
891
|
}
|
|
@@ -8,8 +8,6 @@ export declare type SingleParamType = {
|
|
|
8
8
|
initItem?: any;
|
|
9
9
|
statusField?: string;
|
|
10
10
|
auditStatus?: number;
|
|
11
|
-
totalFields?: string[];
|
|
12
|
-
customTotal?: (param: Record<string, any>) => Promise<any>;
|
|
13
11
|
beforeLoad?: (param: Record<string, any>) => Promise<boolean>;
|
|
14
12
|
beforeRemove?: (rows: any[]) => Promise<any>;
|
|
15
13
|
beforeAudit?: (rows: any[]) => Promise<any>;
|
|
@@ -38,7 +38,6 @@ function useSingle(inParam) {
|
|
|
38
38
|
initItem = inParam.initItem,
|
|
39
39
|
statusField = inParam.statusField,
|
|
40
40
|
auditStatus = inParam.auditStatus,
|
|
41
|
-
totalFields = inParam.totalFields,
|
|
42
41
|
beforeAudit = inParam.beforeAudit,
|
|
43
42
|
beforeLoad = inParam.beforeLoad,
|
|
44
43
|
beforeRemove = inParam.beforeRemove,
|
|
@@ -48,8 +47,7 @@ function useSingle(inParam) {
|
|
|
48
47
|
afterRemove = inParam.afterRemove,
|
|
49
48
|
afterSave = inParam.afterSave,
|
|
50
49
|
afterAudit = inParam.afterAudit,
|
|
51
|
-
btnStatus = inParam.btnStatus
|
|
52
|
-
customTotal = inParam.customTotal;
|
|
50
|
+
btnStatus = inParam.btnStatus;
|
|
53
51
|
/** @name 选中行数据 */
|
|
54
52
|
|
|
55
53
|
var _useState = useState([]),
|
|
@@ -524,6 +522,8 @@ function useSingle(inParam) {
|
|
|
524
522
|
|
|
525
523
|
if (sumProperties) {
|
|
526
524
|
param.sumProperties = sumProperties;
|
|
525
|
+
delete param.page;
|
|
526
|
+
delete param.pageSize;
|
|
527
527
|
} // 处理查询条件
|
|
528
528
|
|
|
529
529
|
|
|
@@ -552,7 +552,7 @@ function useSingle(inParam) {
|
|
|
552
552
|
} //处理排序
|
|
553
553
|
|
|
554
554
|
|
|
555
|
-
if (sort && Object.keys(sort).length) {
|
|
555
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
556
556
|
sortArr = [];
|
|
557
557
|
|
|
558
558
|
for (_key2 in sort) {
|
|
@@ -591,10 +591,14 @@ function useSingle(inParam) {
|
|
|
591
591
|
});
|
|
592
592
|
|
|
593
593
|
case 18:
|
|
594
|
-
|
|
594
|
+
if (sumProperties && param.sort) {
|
|
595
|
+
delete param.sort;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
_context6.next = 21;
|
|
595
599
|
return service.load(param);
|
|
596
600
|
|
|
597
|
-
case
|
|
601
|
+
case 21:
|
|
598
602
|
result = _context6.sent;
|
|
599
603
|
result.data = result.rows || [];
|
|
600
604
|
result.success = true;
|
|
@@ -605,7 +609,7 @@ function useSingle(inParam) {
|
|
|
605
609
|
|
|
606
610
|
return _context6.abrupt("return", result);
|
|
607
611
|
|
|
608
|
-
case
|
|
612
|
+
case 26:
|
|
609
613
|
case "end":
|
|
610
614
|
return _context6.stop();
|
|
611
615
|
}
|
|
@@ -33,7 +33,7 @@ var _http = require("../../http");
|
|
|
33
33
|
|
|
34
34
|
var _usePermission2 = _interopRequireDefault(require("../usePermission"));
|
|
35
35
|
|
|
36
|
-
var _excluded = ["current", "pageSize"];
|
|
36
|
+
var _excluded = ["current", "pageSize", "sumProperties"];
|
|
37
37
|
|
|
38
38
|
function useDtl(dtlParam) {
|
|
39
39
|
var mstService = dtlParam.service,
|
|
@@ -796,13 +796,13 @@ function useDtl(dtlParam) {
|
|
|
796
796
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(params, sort, filter) {
|
|
797
797
|
var _tableRef$current3, _tableRef$current3$cl;
|
|
798
798
|
|
|
799
|
-
var current, pageSize, rest, param, key, sortArr, _key, _key2, result;
|
|
799
|
+
var current, pageSize, sumProperties, rest, param, key, sortArr, _key, _key2, result;
|
|
800
800
|
|
|
801
801
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
802
802
|
while (1) {
|
|
803
803
|
switch (_context8.prev = _context8.next) {
|
|
804
804
|
case 0:
|
|
805
|
-
current = params.current, pageSize = params.pageSize, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
805
|
+
current = params.current, pageSize = params.pageSize, sumProperties = params.sumProperties, rest = (0, _objectWithoutProperties2.default)(params, _excluded);
|
|
806
806
|
|
|
807
807
|
if (!(!masterObject || !masterObject[mstKeyField])) {
|
|
808
808
|
_context8.next = 3;
|
|
@@ -820,6 +820,13 @@ function useDtl(dtlParam) {
|
|
|
820
820
|
if (current) {
|
|
821
821
|
param.page = current;
|
|
822
822
|
param.pageSize = pageSize;
|
|
823
|
+
} // 合计
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
if (sumProperties) {
|
|
827
|
+
param.sumProperties = sumProperties;
|
|
828
|
+
delete param.page;
|
|
829
|
+
delete param.pageSize;
|
|
823
830
|
}
|
|
824
831
|
|
|
825
832
|
param.where = {};
|
|
@@ -838,7 +845,7 @@ function useDtl(dtlParam) {
|
|
|
838
845
|
} //处理排序
|
|
839
846
|
|
|
840
847
|
|
|
841
|
-
if (sort && Object.keys(sort).length) {
|
|
848
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
842
849
|
sortArr = [];
|
|
843
850
|
|
|
844
851
|
for (_key in sort) {
|
|
@@ -859,20 +866,20 @@ function useDtl(dtlParam) {
|
|
|
859
866
|
_context8.t0 = beforeLoad;
|
|
860
867
|
|
|
861
868
|
if (!_context8.t0) {
|
|
862
|
-
_context8.next =
|
|
869
|
+
_context8.next = 20;
|
|
863
870
|
break;
|
|
864
871
|
}
|
|
865
872
|
|
|
866
|
-
_context8.next =
|
|
873
|
+
_context8.next = 18;
|
|
867
874
|
return beforeLoad(param);
|
|
868
875
|
|
|
869
|
-
case
|
|
876
|
+
case 18:
|
|
870
877
|
_context8.t1 = _context8.sent;
|
|
871
878
|
_context8.t0 = _context8.t1 === false;
|
|
872
879
|
|
|
873
|
-
case
|
|
880
|
+
case 20:
|
|
874
881
|
if (!_context8.t0) {
|
|
875
|
-
_context8.next =
|
|
882
|
+
_context8.next = 22;
|
|
876
883
|
break;
|
|
877
884
|
}
|
|
878
885
|
|
|
@@ -881,17 +888,26 @@ function useDtl(dtlParam) {
|
|
|
881
888
|
success: true
|
|
882
889
|
});
|
|
883
890
|
|
|
884
|
-
case
|
|
885
|
-
|
|
891
|
+
case 22:
|
|
892
|
+
if (sumProperties && param.sort) {
|
|
893
|
+
delete param.sort;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
_context8.next = 25;
|
|
886
897
|
return dtlService.load(param);
|
|
887
898
|
|
|
888
|
-
case
|
|
899
|
+
case 25:
|
|
889
900
|
result = _context8.sent;
|
|
890
901
|
result.data = result.rows;
|
|
891
902
|
result.success = true;
|
|
903
|
+
|
|
904
|
+
if (sumProperties) {
|
|
905
|
+
result.data = result.footer;
|
|
906
|
+
}
|
|
907
|
+
|
|
892
908
|
return _context8.abrupt("return", result);
|
|
893
909
|
|
|
894
|
-
case
|
|
910
|
+
case 30:
|
|
895
911
|
case "end":
|
|
896
912
|
return _context8.stop();
|
|
897
913
|
}
|
|
@@ -8,8 +8,6 @@ export declare type SingleParamType = {
|
|
|
8
8
|
initItem?: any;
|
|
9
9
|
statusField?: string;
|
|
10
10
|
auditStatus?: number;
|
|
11
|
-
totalFields?: string[];
|
|
12
|
-
customTotal?: (param: Record<string, any>) => Promise<any>;
|
|
13
11
|
beforeLoad?: (param: Record<string, any>) => Promise<boolean>;
|
|
14
12
|
beforeRemove?: (rows: any[]) => Promise<any>;
|
|
15
13
|
beforeAudit?: (rows: any[]) => Promise<any>;
|
|
@@ -60,7 +60,6 @@ function useSingle(inParam) {
|
|
|
60
60
|
initItem = inParam.initItem,
|
|
61
61
|
statusField = inParam.statusField,
|
|
62
62
|
auditStatus = inParam.auditStatus,
|
|
63
|
-
totalFields = inParam.totalFields,
|
|
64
63
|
beforeAudit = inParam.beforeAudit,
|
|
65
64
|
beforeLoad = inParam.beforeLoad,
|
|
66
65
|
beforeRemove = inParam.beforeRemove,
|
|
@@ -70,8 +69,7 @@ function useSingle(inParam) {
|
|
|
70
69
|
afterRemove = inParam.afterRemove,
|
|
71
70
|
afterSave = inParam.afterSave,
|
|
72
71
|
afterAudit = inParam.afterAudit,
|
|
73
|
-
btnStatus = inParam.btnStatus
|
|
74
|
-
customTotal = inParam.customTotal;
|
|
72
|
+
btnStatus = inParam.btnStatus;
|
|
75
73
|
/** @name 选中行数据 */
|
|
76
74
|
|
|
77
75
|
var _useState = (0, _react.useState)([]),
|
|
@@ -545,6 +543,8 @@ function useSingle(inParam) {
|
|
|
545
543
|
|
|
546
544
|
if (sumProperties) {
|
|
547
545
|
param.sumProperties = sumProperties;
|
|
546
|
+
delete param.page;
|
|
547
|
+
delete param.pageSize;
|
|
548
548
|
} // 处理查询条件
|
|
549
549
|
|
|
550
550
|
|
|
@@ -573,7 +573,7 @@ function useSingle(inParam) {
|
|
|
573
573
|
} //处理排序
|
|
574
574
|
|
|
575
575
|
|
|
576
|
-
if (sort && Object.keys(sort).length) {
|
|
576
|
+
if (!sumProperties && sort && Object.keys(sort).length) {
|
|
577
577
|
sortArr = [];
|
|
578
578
|
|
|
579
579
|
for (_key2 in sort) {
|
|
@@ -612,10 +612,14 @@ function useSingle(inParam) {
|
|
|
612
612
|
});
|
|
613
613
|
|
|
614
614
|
case 18:
|
|
615
|
-
|
|
615
|
+
if (sumProperties && param.sort) {
|
|
616
|
+
delete param.sort;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
_context6.next = 21;
|
|
616
620
|
return service.load(param);
|
|
617
621
|
|
|
618
|
-
case
|
|
622
|
+
case 21:
|
|
619
623
|
result = _context6.sent;
|
|
620
624
|
result.data = result.rows || [];
|
|
621
625
|
result.success = true;
|
|
@@ -626,7 +630,7 @@ function useSingle(inParam) {
|
|
|
626
630
|
|
|
627
631
|
return _context6.abrupt("return", result);
|
|
628
632
|
|
|
629
|
-
case
|
|
633
|
+
case 26:
|
|
630
634
|
case "end":
|
|
631
635
|
return _context6.stop();
|
|
632
636
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ls-pro-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.75",
|
|
4
4
|
"description": "ls-pro-common",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"antd",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ant-design/icons": "^4.3.0",
|
|
30
|
-
"ls-pro-table": "2.62.
|
|
30
|
+
"ls-pro-table": "2.62.55",
|
|
31
31
|
"ls-pro-form": "1.52.33",
|
|
32
32
|
"@babel/runtime": "^7.16.3",
|
|
33
33
|
"classnames": "^2.2.6",
|