ztxkui 4.2.18-9 → 4.2.18-91
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/App.js +315 -291
- package/dist/Demo.js +58 -42
- package/dist/DemoCom/BasicDemo.js +57 -56
- package/dist/DemoCom/CodeQueryDemo.js +3 -2
- package/dist/DemoCom/CollapseDemo.js +28 -27
- package/dist/DemoCom/DragSort.js +11 -10
- package/dist/DemoCom/FormDemo.js +36 -30
- package/dist/DemoCom/PrintContainerDemo.js +151 -150
- package/dist/DemoCom/PrintDemo.js +15 -14
- package/dist/DemoCom/SinaturesDemo.js +9 -8
- package/dist/DemoCom/SyhDemo.js +21 -20
- package/dist/DemoCom/TableAnalyse.js +34 -33
- package/dist/DemoCom/TableDemo.js +74 -70
- package/dist/DemoCom/TableDemo1.js +34 -33
- package/dist/DemoCom/TableDetail.d.ts +9 -0
- package/dist/DemoCom/TableDetail.js +259 -0
- package/dist/DemoCom/TestCom.js +22 -19
- package/dist/DemoCom/data.d.ts +110 -0
- package/dist/DemoCom/data.js +2308 -0
- package/dist/TableDemo/BasicTable.js +103 -29
- package/dist/TableDemo/EditableTable.js +177 -91
- package/dist/TableDemo/ModalTable.js +25 -24
- package/dist/TableDemo/ProEditableTable.d.ts +21 -0
- package/dist/TableDemo/ProEditableTable.js +483 -0
- package/dist/TableDemo/data.d.ts +15 -0
- package/dist/TableDemo/data.js +44 -11
- package/dist/TableDemo/index.js +5 -4
- package/dist/TreeDemo.js +8 -7
- package/dist/TreeSelectDemo.js +10 -7
- package/dist/UI/Form/index.d.ts +3 -0
- package/dist/UI/Form/index.js +346 -0
- package/dist/UI/index.d.ts +2 -0
- package/dist/UI/index.js +10 -0
- package/dist/UploadDemo.js +12 -17
- package/dist/components/Button/button.js +3 -2
- package/dist/components/Collapse/collapse.js +2 -1
- package/dist/components/EnhanceSelect/index.d.ts +5 -1
- package/dist/components/EnhanceSelect/index.js +179 -32
- package/dist/components/EnhanceTree/index.js +4 -3
- package/dist/components/EnhanceTreeSelect/index.js +11 -5
- package/dist/components/Export/export.js +5 -4
- package/dist/components/Input/input.d.ts +3 -0
- package/dist/components/Input/input.js +53 -3
- package/dist/components/InputNumber/input-number.js +3 -2
- package/dist/components/NumberCase/index.js +9 -7
- package/dist/components/Print/print.js +4 -3
- package/dist/components/PrintContainer/AttachPreviewModal.js +3 -2
- package/dist/components/PrintContainer/PrintModal.js +4 -3
- package/dist/components/PrintContainer/handle.d.ts +2 -4
- package/dist/components/PrintContainer/handle.js +3 -2
- package/dist/components/PrintContainer/lodop.js +2 -1
- package/dist/components/PrintContainer/print-container.js +74 -73
- package/dist/components/PrintContainer/service.js +5 -4
- package/dist/components/ProForm/hooks.d.ts +23 -0
- package/dist/components/ProForm/hooks.js +209 -0
- package/dist/components/ProForm/index.d.ts +6 -0
- package/dist/components/ProForm/index.js +101 -0
- package/dist/components/ProForm/interface.d.ts +169 -0
- package/dist/components/ProForm/interface.js +1 -0
- package/dist/components/ProForm/item.d.ts +13 -0
- package/dist/components/ProForm/item.js +221 -0
- package/dist/components/ProForm/items.d.ts +5 -0
- package/dist/components/ProForm/items.js +36 -0
- package/dist/components/ProForm/search-drawer.d.ts +12 -0
- package/dist/components/ProForm/search-drawer.js +202 -0
- package/dist/components/ProForm/setting.d.ts +5 -0
- package/dist/components/ProForm/setting.js +13 -0
- package/dist/components/ProFormList/index.d.ts +12 -0
- package/dist/components/ProFormList/index.js +34 -0
- package/dist/components/ProTable/hooks.d.ts +28 -0
- package/dist/components/ProTable/hooks.js +279 -0
- package/dist/components/ProTable/index.d.ts +8 -0
- package/dist/components/ProTable/index.js +77 -0
- package/dist/components/ProTable/interface.d.ts +51 -0
- package/dist/components/ProTable/interface.js +1 -0
- package/dist/components/RangePicker/range-picker.js +5 -2
- package/dist/components/SortableCancel/sortable-cancel.d.ts +1 -0
- package/dist/components/SortableCancel/sortable-cancel.js +2 -2
- package/dist/components/Table/components/FillDown.d.ts +8 -0
- package/dist/components/Table/components/FillDown.js +11 -0
- package/dist/components/Table/components/FilterDropdown.d.ts +15 -0
- package/dist/components/Table/components/FilterDropdown.js +93 -0
- package/dist/components/Table/constants.d.ts +2 -0
- package/dist/components/Table/constants.js +2 -0
- package/dist/components/Table/hooks/useColumns.d.ts +25 -8
- package/dist/components/Table/hooks/useColumns.js +704 -180
- package/dist/components/Table/hooks/useDropRef.js +4 -2
- package/dist/components/Table/hooks/useInnerPagination.js +1 -0
- package/dist/components/Table/hooks/useSelectSubtotal.d.ts +4 -0
- package/dist/components/Table/hooks/useSelectSubtotal.js +182 -0
- package/dist/components/Table/hooks/useVituralScrollBar.d.ts +10 -0
- package/dist/components/Table/hooks/useVituralScrollBar.js +234 -0
- package/dist/components/Table/index.d.ts +11 -0
- package/dist/components/Table/table-adddel-column.d.ts +8 -5
- package/dist/components/Table/table-adddel-column.js +16 -5
- package/dist/components/Table/table-dynamic.js +165 -18
- package/dist/components/Table/table-enhance-cell.d.ts +7 -3
- package/dist/components/Table/table-enhance-cell.js +214 -109
- package/dist/components/Table/table-enhance-row.d.ts +4 -4
- package/dist/components/Table/table-enhance-row.js +10 -11
- package/dist/components/Table/table-headTooltip.d.ts +6 -0
- package/dist/components/Table/table-headTooltip.js +13 -0
- package/dist/components/Table/table-resizable-title.d.ts +4 -5
- package/dist/components/Table/table-resizable-title.js +33 -6
- package/dist/components/Table/table-sort.d.ts +11 -0
- package/dist/components/Table/table-sort.js +66 -0
- package/dist/components/Table/table.d.ts +30 -4
- package/dist/components/Table/table.js +526 -180
- package/dist/components/Table/utils/dom.d.ts +26 -0
- package/dist/components/Table/utils/dom.js +123 -0
- package/dist/components/Table/utils/filterHandle.d.ts +1 -0
- package/dist/components/Table/utils/filterHandle.js +66 -0
- package/dist/components/Table/utils/getSummaryData.d.ts +2 -1
- package/dist/components/Table/utils/getSummaryData.js +282 -25
- package/dist/components/Table/utils/shallowEqual.d.ts +2 -0
- package/dist/components/Table/utils/shallowEqual.js +35 -0
- package/dist/components/Table/utils/validate.d.ts +1 -1
- package/dist/components/Table/utils/validate.js +30 -11
- package/dist/components/TreeSelect/index.d.ts +15 -0
- package/dist/components/TreeSelect/index.js +29 -0
- package/dist/components/Upload/upload-table.js +31 -26
- package/dist/components/Upload/upload.js +23 -18
- package/dist/components/Upload/utils.js +11 -10
- package/dist/components/UploadSingle/upload-single.js +5 -4
- package/dist/components/Watermark/index.d.ts +2 -0
- package/dist/components/Watermark/index.js +2 -0
- package/dist/components/Watermark/interface.d.ts +20 -0
- package/dist/components/Watermark/interface.js +1 -0
- package/dist/components/Watermark/utils.d.ts +1 -0
- package/dist/components/Watermark/utils.js +70 -0
- package/dist/components/Watermark/water.d.ts +50 -0
- package/dist/components/Watermark/water.js +66 -0
- package/dist/components/Watermark/watermark-div.d.ts +4 -0
- package/dist/components/Watermark/watermark-div.js +41 -0
- package/dist/components/Watermark/watermark-shadow.d.ts +6 -0
- package/dist/components/Watermark/watermark-shadow.js +116 -0
- package/dist/components/Watermark/watermark.d.ts +3 -0
- package/dist/components/Watermark/watermark.js +102 -0
- package/dist/components/WorkflowPrintContainer/component/Gragh/Gragh.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/Gragh/Gragh.js +63 -0
- package/dist/components/WorkflowPrintContainer/component/Header.d.ts +12 -0
- package/dist/components/WorkflowPrintContainer/component/Header.js +109 -0
- package/dist/components/WorkflowPrintContainer/component/ProcessDetail.d.ts +18 -0
- package/dist/components/WorkflowPrintContainer/component/ProcessDetail.js +243 -0
- package/dist/components/WorkflowPrintContainer/component/Upload/index.d.ts +20 -0
- package/dist/components/WorkflowPrintContainer/component/Upload/index.js +59 -0
- package/dist/components/WorkflowPrintContainer/component/association/component/TableList.d.ts +10 -0
- package/dist/components/WorkflowPrintContainer/component/association/component/TableList.js +75 -0
- package/dist/components/WorkflowPrintContainer/component/association/index.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/association/index.js +92 -0
- package/dist/components/WorkflowPrintContainer/component/attention/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/attention/component/TableList.js +38 -0
- package/dist/components/WorkflowPrintContainer/component/attention/index.d.ts +10 -0
- package/dist/components/WorkflowPrintContainer/component/attention/index.js +95 -0
- package/dist/components/WorkflowPrintContainer/component/audit/component/TableList.d.ts +8 -0
- package/dist/components/WorkflowPrintContainer/component/audit/component/TableList.js +53 -0
- package/dist/components/WorkflowPrintContainer/component/audit/index.d.ts +7 -0
- package/dist/components/WorkflowPrintContainer/component/audit/index.js +88 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/component/TableList.js +53 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/index.d.ts +11 -0
- package/dist/components/WorkflowPrintContainer/component/previewTable/index.js +60 -0
- package/dist/components/WorkflowPrintContainer/component/send/component/TableList.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/send/component/TableList.js +50 -0
- package/dist/components/WorkflowPrintContainer/component/send/index.d.ts +9 -0
- package/dist/components/WorkflowPrintContainer/component/send/index.js +92 -0
- package/dist/components/WorkflowPrintContainer/component/trail/component/TableList.d.ts +12 -0
- package/dist/components/WorkflowPrintContainer/component/trail/component/TableList.js +282 -0
- package/dist/components/WorkflowPrintContainer/component/trail/index.d.ts +11 -0
- package/dist/components/WorkflowPrintContainer/component/trail/index.js +56 -0
- package/dist/components/WorkflowPrintContainer/images.d.ts +2 -0
- package/dist/components/WorkflowPrintContainer/images.js +2 -0
- package/dist/components/WorkflowPrintContainer/index.d.ts +2 -0
- package/dist/components/WorkflowPrintContainer/index.js +2 -0
- package/dist/components/WorkflowPrintContainer/service.d.ts +14 -0
- package/dist/components/WorkflowPrintContainer/service.js +101 -0
- package/dist/components/WorkflowPrintContainer/usePagination.d.ts +14 -0
- package/dist/components/WorkflowPrintContainer/usePagination.js +22 -0
- package/dist/components/WorkflowPrintContainer/workflow-print-container.d.ts +100 -0
- package/dist/components/WorkflowPrintContainer/workflow-print-container.js +236 -0
- package/dist/components/business/Analyse/index.js +12 -11
- package/dist/components/business/CodeQuery/component/SearchForm.js +3 -2
- package/dist/components/business/CodeQuery/component/TableList.js +5 -4
- package/dist/components/business/CodeQuery/hooks.js +2 -1
- package/dist/components/business/CodeQuery/index.js +2 -1
- package/dist/components/business/Common/UserForgetPassword/index.js +36 -28
- package/dist/components/business/Common/UserInfo/component/MakingForm.js +11 -10
- package/dist/components/business/Common/UserInfo/index.js +7 -4
- package/dist/components/business/Common/UserPassword/index.d.ts +1 -0
- package/dist/components/business/Common/UserPassword/index.js +39 -18
- package/dist/components/business/Common/validatePassword.d.ts +1 -1
- package/dist/components/business/Common/validatePassword.js +17 -7
- package/dist/components/business/DetailCard/index.js +7 -6
- package/dist/components/business/DetailHeader/index.js +7 -6
- package/dist/components/business/DetailList/index.js +5 -4
- package/dist/components/business/DgColumns/index.js +12 -11
- package/dist/components/business/ExportButton/index.js +6 -5
- package/dist/components/business/Footer/index.js +4 -1
- package/dist/components/business/GridList/item.d.ts +1 -1
- package/dist/components/business/List/item.d.ts +1 -1
- package/dist/components/business/NewList/item.d.ts +1 -1
- package/dist/components/business/NewList/item.js +1 -1
- package/dist/components/business/OperationBtnGroup/index.js +17 -16
- package/dist/components/business/SearchContainer/hooks/useToggle.d.ts +1 -1
- package/dist/components/business/SearchContainer/hooks/useToggle.js +5 -4
- package/dist/components/business/SearchContainer/record-common-item.d.ts +14 -0
- package/dist/components/business/SearchContainer/record-common-item.js +82 -0
- package/dist/components/business/SearchContainer/record-common-list.d.ts +3 -0
- package/dist/components/business/SearchContainer/record-common-list.js +64 -0
- package/dist/components/business/SearchContainer/search-container.d.ts +13 -0
- package/dist/components/business/SearchContainer/search-container.js +32 -3
- package/dist/components/business/SearchContainer/search-drawer.d.ts +1 -0
- package/dist/components/business/SearchContainer/search-drawer.js +139 -13
- package/dist/components/business/SearchContainer/search-item.js +33 -2
- package/dist/components/business/SearchContainer/search-left.d.ts +1 -0
- package/dist/components/business/SearchContainer/search-left.js +11 -3
- package/dist/components/business/SearchContainer/search-right.js +23 -4
- package/dist/components/business/SearchContainer/useRecordCommonInit.d.ts +15 -0
- package/dist/components/business/SearchContainer/useRecordCommonInit.js +242 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearch.d.ts +7 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearch.js +140 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearchContext.d.ts +31 -0
- package/dist/components/business/SearchContainer/useRecordCommonSearchContext.js +8 -0
- package/dist/components/business/Signatures/components/AttachOperation.js +7 -6
- package/dist/components/business/Signatures/components/CompareResult.js +7 -6
- package/dist/components/business/Signatures/components/DetailTable.js +37 -34
- package/dist/components/business/Signatures/components/QunjSeal.js +5 -4
- package/dist/components/business/Signatures/components/SealCheckbox.js +3 -2
- package/dist/components/business/Signatures/components/TemplateAttach.js +2 -1
- package/dist/components/business/Signatures/index.js +64 -53
- package/dist/components/business/SortList/sort-drawer.js +5 -4
- package/dist/components/business/Template/index.js +11 -10
- package/dist/components/utils/MyStorage.d.ts +36 -0
- package/dist/components/utils/MyStorage.js +120 -0
- package/dist/components/utils/ZtxkContext.d.ts +34 -0
- package/dist/components/utils/ZtxkContext.js +13 -0
- package/dist/components/utils/fetch.d.ts +10 -0
- package/dist/components/utils/fetch.js +119 -0
- package/dist/components/utils/index.d.ts +1 -0
- package/dist/components/utils/index.js +20 -0
- package/dist/components/utils/processNumber.d.ts +12 -0
- package/dist/components/utils/processNumber.js +106 -0
- package/dist/components/utils/upload.js +6 -3
- package/dist/components/utils/useBaseContext.d.ts +5 -0
- package/dist/components/utils/useBaseContext.js +10 -0
- package/dist/components/utils/useLastest.d.ts +2 -0
- package/dist/components/utils/useLastest.js +6 -0
- package/dist/components/utils/useMemoizedFn.d.ts +4 -0
- package/dist/components/utils/useMemoizedFn.js +19 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -1
- package/dist/index.css +1011 -7
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +200 -84
- package/dist/locales/en-US.json +818 -0
- package/dist/locales/zh-CN.json +818 -0
- package/dist/request.js +6 -5
- package/package.json +7 -2
|
@@ -1,82 +1,143 @@
|
|
|
1
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
1
2
|
/**
|
|
2
3
|
* @author 陈亚雄
|
|
3
4
|
* @description 基础表格,充当列表
|
|
4
5
|
*/
|
|
5
|
-
import React from 'react';
|
|
6
|
+
import React, { useState } from 'react';
|
|
6
7
|
// redux
|
|
7
8
|
// ztxkui公共组件
|
|
8
9
|
import { Table } from '../index';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
var dataObj = {
|
|
11
|
+
1: [
|
|
12
|
+
{ id: 1, test1: '1', test2: '2', test3: '3', test4: '4' },
|
|
13
|
+
{ id: 2, test1: '11', test2: '22', test3: '33', test4: '44' },
|
|
14
|
+
{ id: 3, test1: '111', test2: '222', test3: '333', test4: '444' },
|
|
15
|
+
],
|
|
16
|
+
2: [
|
|
17
|
+
{ id: 3, test1: '2-1', test2: '2-2', test3: '2-3', test4: '2-4' },
|
|
18
|
+
{ id: 2, test1: '2-11', test2: '2-22', test3: '2-33', test4: '2-44' },
|
|
19
|
+
{ id: 4, test1: '2-111', test2: '2-222', test3: '2-333', test4: '2-444' },
|
|
20
|
+
],
|
|
21
|
+
3: [
|
|
22
|
+
{ id: 3, test1: '3-1', test2: '3-2', test3: '3-3', test4: '3-4' },
|
|
23
|
+
{ id: 2, test1: '3-11', test2: '3-22', test3: '3-33', test4: '3-44' },
|
|
24
|
+
{ id: 4, test1: '3-111', test2: '3-222', test3: '3-333', test4: '3-444' },
|
|
25
|
+
],
|
|
26
|
+
4: [
|
|
27
|
+
{ id: 1, test1: '4-1', test2: '4-2', test3: '4-3', test4: '4-4' },
|
|
28
|
+
{ id: 2, test1: '4-11', test2: '4-22', test3: '4-33', test4: '4-44' },
|
|
29
|
+
{ id: 3, test1: '4-111', test2: '4-222', test3: '4-333', test4: '4-444' },
|
|
30
|
+
],
|
|
31
|
+
5: [
|
|
32
|
+
{ id: 1, test1: '5-1', test2: '5-2', test3: '5-3', test4: '5-4' },
|
|
33
|
+
{ id: 2, test1: '5-11', test2: '5-22', test3: '5-33', test4: '5-44' },
|
|
34
|
+
{ id: '3', test1: '5-111', test2: '5-222', test3: '5-333', test4: '5-444' },
|
|
35
|
+
{
|
|
36
|
+
id: '3',
|
|
37
|
+
test1: '5-1111',
|
|
38
|
+
test2: '5-2222',
|
|
39
|
+
test3: '5-3333',
|
|
40
|
+
test4: '5-4444',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
id: '3',
|
|
44
|
+
test1: '5-11111',
|
|
45
|
+
test2: '5-22222',
|
|
46
|
+
test3: '5-33333',
|
|
47
|
+
test4: '5-44444',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
6: [
|
|
51
|
+
{ id: 11, test1: '6-1', test2: '6-2', test3: '6-3', test4: '6-4' },
|
|
52
|
+
{ id: 22, test1: '6-11', test2: '6-22', test3: '6-33', test4: '6-44' },
|
|
53
|
+
{
|
|
54
|
+
id: '33',
|
|
55
|
+
test1: '6-111',
|
|
56
|
+
test2: '6-222',
|
|
57
|
+
test3: '6-333',
|
|
58
|
+
test4: '6-444',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: '36',
|
|
62
|
+
test1: '6-1111',
|
|
63
|
+
test2: '6-2222',
|
|
64
|
+
test3: '6-3333',
|
|
65
|
+
test4: '6-4444',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: '34',
|
|
69
|
+
test1: '6-11111',
|
|
70
|
+
test2: '6-22222',
|
|
71
|
+
test3: '6-33333',
|
|
72
|
+
test4: '6-44444',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
7: [],
|
|
76
|
+
8: [],
|
|
77
|
+
9: [],
|
|
78
|
+
};
|
|
79
|
+
var i = 0;
|
|
14
80
|
var BasicTable = function (_a) {
|
|
15
81
|
var dynamicKey = _a.dynamicKey;
|
|
82
|
+
var _b = useState([]), data = _b[0], setData = _b[1];
|
|
16
83
|
var columns = [
|
|
17
84
|
{
|
|
18
|
-
title: '
|
|
19
|
-
width: 62,
|
|
20
|
-
fixed: 'left',
|
|
21
|
-
key: 'index',
|
|
22
|
-
render: function (_text, _record, index) { return "" + (index + 1); },
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: '测试1',
|
|
85
|
+
title: i18next.t('测试1'),
|
|
26
86
|
width: 100,
|
|
27
87
|
dataIndex: 'test1',
|
|
28
88
|
key: 'test1',
|
|
89
|
+
fixed: true,
|
|
29
90
|
},
|
|
30
91
|
{
|
|
31
|
-
title: '测试2',
|
|
92
|
+
title: i18next.t('测试2'),
|
|
32
93
|
width: 100,
|
|
33
94
|
dataIndex: 'test2',
|
|
34
95
|
key: 'test2',
|
|
35
96
|
},
|
|
36
97
|
{
|
|
37
|
-
title: '测试3',
|
|
98
|
+
title: i18next.t('测试3'),
|
|
38
99
|
width: 100,
|
|
39
100
|
dataIndex: 'test3',
|
|
40
101
|
key: 'test3',
|
|
41
102
|
},
|
|
42
103
|
{
|
|
43
|
-
title: '测试4',
|
|
104
|
+
title: i18next.t('测试4'),
|
|
44
105
|
width: 100,
|
|
45
106
|
dataIndex: 'test4',
|
|
46
107
|
key: 'test4',
|
|
47
108
|
},
|
|
48
109
|
{
|
|
49
|
-
title: '测试5',
|
|
110
|
+
title: i18next.t('测试5'),
|
|
50
111
|
width: 100,
|
|
51
112
|
dataIndex: 'test5',
|
|
52
113
|
key: 'test5',
|
|
53
114
|
},
|
|
54
115
|
{
|
|
55
|
-
title: '测试6',
|
|
116
|
+
title: i18next.t('测试6'),
|
|
56
117
|
width: 100,
|
|
57
118
|
dataIndex: 'test6',
|
|
58
119
|
key: 'test6',
|
|
59
120
|
},
|
|
60
121
|
{
|
|
61
|
-
title: '测试7',
|
|
122
|
+
title: i18next.t('测试7'),
|
|
62
123
|
width: 100,
|
|
63
124
|
dataIndex: 'test7',
|
|
64
125
|
key: 'test7',
|
|
65
126
|
},
|
|
66
127
|
{
|
|
67
|
-
title: '测试8',
|
|
128
|
+
title: i18next.t('测试8'),
|
|
68
129
|
width: 100,
|
|
69
130
|
dataIndex: 'test8',
|
|
70
131
|
key: 'test8',
|
|
71
132
|
},
|
|
72
133
|
{
|
|
73
|
-
title: '测试9',
|
|
134
|
+
title: i18next.t('测试9'),
|
|
74
135
|
width: 100,
|
|
75
136
|
dataIndex: 'test9',
|
|
76
137
|
key: 'test9',
|
|
77
138
|
},
|
|
78
139
|
{
|
|
79
|
-
title: '测试10',
|
|
140
|
+
title: i18next.t('测试10'),
|
|
80
141
|
width: 100,
|
|
81
142
|
dataIndex: 'test10',
|
|
82
143
|
key: 'test10',
|
|
@@ -84,13 +145,26 @@ var BasicTable = function (_a) {
|
|
|
84
145
|
];
|
|
85
146
|
return (React.createElement("div", null,
|
|
86
147
|
React.createElement("div", null,
|
|
87
|
-
|
|
148
|
+
i18next.t('基础展示表格;'),
|
|
88
149
|
React.createElement("br", null),
|
|
89
|
-
React.createElement("b", null,
|
|
90
|
-
|
|
150
|
+
React.createElement("b", null, i18next.t('动态列配置;')),
|
|
151
|
+
i18next.t('如果需要缓存住动态列配置,需要传入showColumnDynamicKey; 表格内部进行了优化,数据将存储在本地缓存中,可以不用通过外界传入配置'),
|
|
91
152
|
React.createElement("br", null),
|
|
92
|
-
React.createElement("b", null,
|
|
93
|
-
|
|
94
|
-
React.createElement(
|
|
153
|
+
React.createElement("b", null, i18next.t('列伸缩;')),
|
|
154
|
+
i18next.t('isResizableColumn属性默认为true,如果不需要列伸缩可以传入false')),
|
|
155
|
+
React.createElement("button", { onClick: function () {
|
|
156
|
+
i++;
|
|
157
|
+
setData(dataObj[i]);
|
|
158
|
+
console.log(dataObj[i]);
|
|
159
|
+
} },
|
|
160
|
+
i18next.t('切换数据'),
|
|
161
|
+
i),
|
|
162
|
+
React.createElement("button", { onClick: function () {
|
|
163
|
+
i--;
|
|
164
|
+
setData(dataObj[i]);
|
|
165
|
+
} },
|
|
166
|
+
i18next.t('--切换数据'),
|
|
167
|
+
i),
|
|
168
|
+
React.createElement(Table, { dataSource: data, columns: columns, rowKey: "id", scroll: { x: 400, y: 300 }, isOpenVirtualScrollBar: true })));
|
|
95
169
|
};
|
|
96
170
|
export default BasicTable;
|
|
@@ -50,6 +50,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
|
|
|
50
50
|
to[j] = from[i];
|
|
51
51
|
return to;
|
|
52
52
|
};
|
|
53
|
+
import i18next from 'ztxkutils/dist/i18next';
|
|
53
54
|
/**
|
|
54
55
|
* @author 陈亚雄
|
|
55
56
|
* @description 可编辑表格
|
|
@@ -146,22 +147,75 @@ export function divide(num1, num2) {
|
|
|
146
147
|
return 0;
|
|
147
148
|
}
|
|
148
149
|
}
|
|
150
|
+
var dataObj = {
|
|
151
|
+
1: [
|
|
152
|
+
{ id: 1, test1: '1', test2: '2', test3: '3', test4: '4' },
|
|
153
|
+
{ id: 2, test1: '11', test2: '22', test3: '33', test4: '44' },
|
|
154
|
+
{ id: 3, test1: '111', test2: '222', test3: '333', test4: '444' },
|
|
155
|
+
],
|
|
156
|
+
2: [
|
|
157
|
+
{ id: 3, test1: '2-1', test2: '2-2', test3: '2-3', test4: '2-4' },
|
|
158
|
+
{ id: 2, test1: '2-11', test2: '2-22', test3: '2-33', test4: '2-44' },
|
|
159
|
+
{ id: 4, test1: '2-111', test2: '2-222', test3: '2-333', test4: '2-444' },
|
|
160
|
+
],
|
|
161
|
+
3: [
|
|
162
|
+
{ id: 3, test1: '3-1', test2: '3-2', test3: '3-3', test4: '3-4' },
|
|
163
|
+
{ id: 2, test1: '3-11', test2: '3-22', test3: '3-33', test4: '3-44' },
|
|
164
|
+
{ id: 4, test1: '3-111', test2: '3-222', test3: '3-333', test4: '3-444' },
|
|
165
|
+
],
|
|
166
|
+
4: [
|
|
167
|
+
{ id: 1, test1: '4-1', test2: '4-2', test3: '4-3', test4: '4-4' },
|
|
168
|
+
{ id: 2, test1: '4-11', test2: '4-22', test3: '4-33', test4: '4-44' },
|
|
169
|
+
{ id: 3, test1: '4-111', test2: '4-222', test3: '4-333', test4: '4-444' },
|
|
170
|
+
],
|
|
171
|
+
5: [
|
|
172
|
+
{ id: 1, test1: '5-1', test2: '5-2', test3: '5-3', test4: '5-4' },
|
|
173
|
+
{ id: 2, test1: '5-11', test2: '5-22', test3: '5-33', test4: '5-44' },
|
|
174
|
+
{ id: '3', test1: '5-111', test2: '5-222', test3: '5-333', test4: '5-444' },
|
|
175
|
+
{
|
|
176
|
+
id: '3',
|
|
177
|
+
test1: '5-1111',
|
|
178
|
+
test2: '5-2222',
|
|
179
|
+
test3: '5-3333',
|
|
180
|
+
test4: '5-4444',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: '3',
|
|
184
|
+
test1: '5-11111',
|
|
185
|
+
test2: '5-22222',
|
|
186
|
+
test3: '5-33333',
|
|
187
|
+
test4: '5-44444',
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
6: [],
|
|
191
|
+
7: [],
|
|
192
|
+
8: [],
|
|
193
|
+
9: [],
|
|
194
|
+
};
|
|
195
|
+
var i = 0;
|
|
149
196
|
var EditableTable = function () {
|
|
150
|
-
var _a = useState(
|
|
197
|
+
var _a = useState(), records = _a[0], setRecords = _a[1];
|
|
198
|
+
var _b = useState([]), data = _b[0], setData = _b[1];
|
|
199
|
+
useEffect(function () {
|
|
200
|
+
setTimeout(function () {
|
|
201
|
+
setRecords(dataSource);
|
|
202
|
+
}, 1000);
|
|
203
|
+
}, []);
|
|
151
204
|
var recordsRef = useRef([]);
|
|
152
205
|
// 初始化渲染,针对配置了editable、editableConfig的列配置
|
|
153
|
-
var
|
|
206
|
+
var _c = useState(false), firstRender = _c[0], setFirstRender = _c[1];
|
|
154
207
|
// 新增删除行改变
|
|
155
|
-
var
|
|
208
|
+
var _d = useState(false), lengthChange = _d[0], setLengthChange = _d[1];
|
|
156
209
|
// 表格行拖拽改变
|
|
157
|
-
var
|
|
210
|
+
var _e = useState(false), moveChange = _e[0], setMoveChange = _e[1];
|
|
158
211
|
// 表格
|
|
159
212
|
var tableHandleRef = useRef({});
|
|
213
|
+
var _f = useState([]), expandedRowKeys = _f[0], setExpandedRowKeys = _f[1];
|
|
160
214
|
// 表格配置
|
|
161
|
-
var
|
|
215
|
+
var _g = useState({
|
|
162
216
|
test1: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
163
217
|
test2: { isChangeable: 1, isDisplay: 1, isRequired: 1 },
|
|
164
|
-
}), tableConfig =
|
|
218
|
+
}), tableConfig = _g[0], setTableConfig = _g[1];
|
|
165
219
|
useEffect(function () {
|
|
166
220
|
setTimeout(function () {
|
|
167
221
|
setTableConfig({
|
|
@@ -174,18 +228,22 @@ var EditableTable = function () {
|
|
|
174
228
|
}, []);
|
|
175
229
|
var columns = [
|
|
176
230
|
{
|
|
177
|
-
title: '序号',
|
|
231
|
+
title: i18next.t('序号'),
|
|
178
232
|
width: 62,
|
|
179
233
|
fixed: 'left',
|
|
180
234
|
key: 'index',
|
|
181
235
|
render: function (_text, _record, index) { return "" + (index + 1); },
|
|
182
236
|
},
|
|
183
237
|
{
|
|
184
|
-
title: '测试1',
|
|
185
|
-
width:
|
|
238
|
+
title: i18next.t('测试1'),
|
|
239
|
+
width: 400,
|
|
186
240
|
dataIndex: 'test1',
|
|
187
241
|
key: 'test1',
|
|
188
242
|
editable: true,
|
|
243
|
+
editableConfig: {
|
|
244
|
+
type: 'textArea',
|
|
245
|
+
maxLength: 100,
|
|
246
|
+
},
|
|
189
247
|
showCopy: true,
|
|
190
248
|
validate: {},
|
|
191
249
|
shouldCellUpdate: function (record, preRecord) {
|
|
@@ -205,14 +263,14 @@ var EditableTable = function () {
|
|
|
205
263
|
},
|
|
206
264
|
},
|
|
207
265
|
{
|
|
208
|
-
title: '测试111',
|
|
209
|
-
width:
|
|
266
|
+
title: i18next.t('测试111'),
|
|
267
|
+
width: 400,
|
|
210
268
|
dataIndex: 'test111',
|
|
211
269
|
key: 'test111',
|
|
212
270
|
editable: true,
|
|
213
271
|
editableConfig: {
|
|
214
272
|
type: 'inputNumber',
|
|
215
|
-
placeholder: '输入',
|
|
273
|
+
placeholder: i18next.t('输入'),
|
|
216
274
|
min: 0,
|
|
217
275
|
precision: 2,
|
|
218
276
|
formatterType: 'currency',
|
|
@@ -235,14 +293,14 @@ var EditableTable = function () {
|
|
|
235
293
|
},
|
|
236
294
|
},
|
|
237
295
|
{
|
|
238
|
-
title: '测试2',
|
|
296
|
+
title: i18next.t('测试2'),
|
|
239
297
|
width: 150,
|
|
240
298
|
dataIndex: 'test2',
|
|
241
299
|
key: 'test2',
|
|
242
300
|
editable: true,
|
|
243
301
|
editableConfig: {
|
|
244
302
|
type: 'inputNumber',
|
|
245
|
-
placeholder: '输入',
|
|
303
|
+
placeholder: i18next.t('输入'),
|
|
246
304
|
min: 0,
|
|
247
305
|
precision: 2,
|
|
248
306
|
formatterType: 'currency',
|
|
@@ -256,7 +314,7 @@ var EditableTable = function () {
|
|
|
256
314
|
return Promise.reject({
|
|
257
315
|
errorFields: [
|
|
258
316
|
{
|
|
259
|
-
errors:
|
|
317
|
+
errors: i18next.t('测试-明细表 第{{index}}行 测试2 不能小于102!', { index: index }),
|
|
260
318
|
},
|
|
261
319
|
],
|
|
262
320
|
});
|
|
@@ -281,7 +339,7 @@ var EditableTable = function () {
|
|
|
281
339
|
},
|
|
282
340
|
},
|
|
283
341
|
{
|
|
284
|
-
title:
|
|
342
|
+
title: i18next.t('金额(含税)', {}),
|
|
285
343
|
width: 130,
|
|
286
344
|
dataIndex: 'test2222',
|
|
287
345
|
key: 'test2222',
|
|
@@ -308,7 +366,7 @@ var EditableTable = function () {
|
|
|
308
366
|
},
|
|
309
367
|
},
|
|
310
368
|
{
|
|
311
|
-
title: '测试3',
|
|
369
|
+
title: i18next.t('测试3'),
|
|
312
370
|
width: 100,
|
|
313
371
|
dataIndex: 'test3',
|
|
314
372
|
key: 'test3',
|
|
@@ -337,62 +395,62 @@ var EditableTable = function () {
|
|
|
337
395
|
} }));
|
|
338
396
|
},
|
|
339
397
|
},
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
398
|
+
{
|
|
399
|
+
title: i18next.t('测试4'),
|
|
400
|
+
width: 100,
|
|
401
|
+
dataIndex: 'test4',
|
|
402
|
+
key: 'test4',
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
title: i18next.t('测试5'),
|
|
406
|
+
// width: 100,
|
|
407
|
+
// dataIndex: 'test5',
|
|
408
|
+
// key: 'test5',
|
|
409
|
+
children: [
|
|
410
|
+
{
|
|
411
|
+
title: i18next.t('测试5-001'),
|
|
412
|
+
width: 100,
|
|
413
|
+
dataIndex: 'test5-001',
|
|
414
|
+
key: 'test5-001',
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
title: i18next.t('测试5-002'),
|
|
418
|
+
width: 100,
|
|
419
|
+
dataIndex: 'test5-002',
|
|
420
|
+
key: 'test5-002',
|
|
421
|
+
},
|
|
422
|
+
],
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
title: i18next.t('测试6'),
|
|
426
|
+
width: 100,
|
|
427
|
+
dataIndex: 'test6',
|
|
428
|
+
key: 'test6',
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
title: i18next.t('测试7'),
|
|
432
|
+
width: 100,
|
|
433
|
+
dataIndex: 'test7',
|
|
434
|
+
key: 'test7',
|
|
435
|
+
},
|
|
436
|
+
{
|
|
437
|
+
title: i18next.t('测试8'),
|
|
438
|
+
width: 100,
|
|
439
|
+
dataIndex: 'test8',
|
|
440
|
+
key: 'test8',
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
title: i18next.t('测试9'),
|
|
444
|
+
width: 100,
|
|
445
|
+
dataIndex: 'test9',
|
|
446
|
+
key: 'test9',
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
title: i18next.t('测试10'),
|
|
450
|
+
width: 100,
|
|
451
|
+
dataIndex: 'test10',
|
|
452
|
+
key: 'test10',
|
|
453
|
+
},
|
|
396
454
|
];
|
|
397
455
|
// 初始化渲染,针对配置了editable、editableConfig的列配置
|
|
398
456
|
useEffect(function () {
|
|
@@ -483,18 +541,18 @@ var EditableTable = function () {
|
|
|
483
541
|
}, []);
|
|
484
542
|
return (React.createElement("div", null,
|
|
485
543
|
React.createElement("div", null,
|
|
486
|
-
|
|
544
|
+
i18next.t('可编辑表格;如果是输入框,可使用表格默认提供的编辑框; 配置editable为true即可,还可配置editableConfig配置执行类型等;具体editableConfig可查看详细签名'),
|
|
487
545
|
React.createElement("br", null),
|
|
488
|
-
React.createElement("b", null,
|
|
546
|
+
React.createElement("b", null, i18next.t('对于配置了编辑的表格,一定要使用SCU来优化表格渲染,此举可以优化表格渲染')),
|
|
489
547
|
React.createElement("br", null),
|
|
490
|
-
React.createElement("b", null,
|
|
548
|
+
React.createElement("b", null, i18next.t('如果配置了editable,并且配置了SCU来优化渲染,那么初始化的时候需要用一个变量标识首次需要渲染')),
|
|
491
549
|
React.createElement("br", null),
|
|
492
|
-
React.createElement("b", null,
|
|
493
|
-
|
|
550
|
+
React.createElement("b", null, i18next.t('新增删除行,表格拖拽排序;')),
|
|
551
|
+
i18next.t('对于配置了SCU的列,需要在新增删除的时候重新渲染,通过设置state标识'),
|
|
494
552
|
React.createElement("br", null),
|
|
495
|
-
React.createElement("b", null,
|
|
496
|
-
React.createElement("p", null,
|
|
497
|
-
React.createElement("p", null,
|
|
553
|
+
React.createElement("b", null, i18next.t('表格自定义验证,传入tableHandleRef一个Ref对象,可获取表格提供相关方法')),
|
|
554
|
+
React.createElement("p", null, i18next.t('1.编写验证规则,在列里面编写,通过传入validate属性配置,具体可查看签名 如果只是简单的非空验证,那么可传入一个空对象即可 如果是复杂验证可通过validate传入更多配置')),
|
|
555
|
+
React.createElement("p", null, i18next.t('2.如果传入了自定义render函数,组件无法掌握在何时清空错误信息,所以需要调用方主动清空错误信息'))),
|
|
498
556
|
React.createElement(Button, { onClick: function () {
|
|
499
557
|
console.log(records);
|
|
500
558
|
(function () {
|
|
@@ -522,10 +580,25 @@ var EditableTable = function () {
|
|
|
522
580
|
});
|
|
523
581
|
});
|
|
524
582
|
})();
|
|
525
|
-
} },
|
|
583
|
+
} }, i18next.t('验证')),
|
|
526
584
|
React.createElement(Button, { onClick: function () {
|
|
527
585
|
console.log(records);
|
|
528
|
-
|
|
586
|
+
var ids = records.map(function (item) { return item.id; });
|
|
587
|
+
setExpandedRowKeys(ids);
|
|
588
|
+
} }, i18next.t('获取数据')),
|
|
589
|
+
React.createElement("button", { onClick: function () {
|
|
590
|
+
i++;
|
|
591
|
+
console.log(dataObj[i]);
|
|
592
|
+
setData(dataObj[i]);
|
|
593
|
+
} },
|
|
594
|
+
i18next.t('切换数据'),
|
|
595
|
+
i),
|
|
596
|
+
React.createElement("button", { onClick: function () {
|
|
597
|
+
i--;
|
|
598
|
+
setData(dataObj[i]);
|
|
599
|
+
} },
|
|
600
|
+
i18next.t('--切换数据'),
|
|
601
|
+
i),
|
|
529
602
|
React.createElement(Table, { dataSource: records, columns: columns, rowKey: "id",
|
|
530
603
|
// 表格项可输入
|
|
531
604
|
onEditableSave: onEditableSaveHandle,
|
|
@@ -534,16 +607,29 @@ var EditableTable = function () {
|
|
|
534
607
|
// 表格行拖拽
|
|
535
608
|
onMoveRow: onMoveRowHandle,
|
|
536
609
|
// tableValidate
|
|
537
|
-
tableHandleRef: tableHandleRef, tableName:
|
|
610
|
+
tableHandleRef: tableHandleRef, tableName: i18next.t('我是一个表格'),
|
|
538
611
|
// 显隐配置
|
|
539
|
-
configInfo
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
612
|
+
// configInfo={tableConfig}
|
|
613
|
+
showColumnDynamic: true, showColumnDynamicKey: "test-o-0011", onTableChange: onTableChange, showInnerPagination: true, expandable: {
|
|
614
|
+
// expandedRowRender: (record) => <p style={{ margin: 0 }}>111</p>,
|
|
615
|
+
// rowExpandable: (record) => true,
|
|
616
|
+
expandedRowKeys: expandedRowKeys,
|
|
617
|
+
onExpand: function (expanded, record) {
|
|
618
|
+
if (expanded) {
|
|
619
|
+
setExpandedRowKeys(function (pre) { return __spreadArray(__spreadArray([], pre), [record === null || record === void 0 ? void 0 : record.id]); });
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
setExpandedRowKeys(function (pre) {
|
|
623
|
+
var index = pre.findIndex(function (id) { return id === (record === null || record === void 0 ? void 0 : record.id); });
|
|
624
|
+
var newRecord = pre.slice();
|
|
625
|
+
newRecord.splice(index, 1);
|
|
626
|
+
return newRecord;
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
}, isOpenVirtualScrollBar: true, scroll: { x: 1200, y: 400 }, showDelAllBtn: true, delAllChange: onDelAllChange, rowSelection: {
|
|
545
631
|
type: 'checkbox',
|
|
546
|
-
}, summaryConfig: [
|
|
632
|
+
}, summaryFixed: true, summaryConfig: [
|
|
547
633
|
{
|
|
548
634
|
type: 'subtotal',
|
|
549
635
|
fields: [
|