linkmore-design 1.1.27 → 1.1.28-alpha.5
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/LmEditTable/DndContainer.d.ts +6 -3
- package/dist/LmEditTable/EditTable.d.ts +15 -5
- package/dist/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/dist/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/dist/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/dist/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/dist/LmEditTable/components/index.d.ts +17 -0
- package/dist/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/dist/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/dist/LmEditTable/sortableItem.d.ts +3 -2
- package/dist/LmEditTable/util.d.ts +10 -0
- package/dist/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/dist/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/dist/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/dist/LmEditTable/virtual/context.d.ts +13 -0
- package/dist/LmEditTable/virtual/index.d.ts +4 -0
- package/dist/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.umd.js +1907 -677
- package/dist/index.umd.min.js +21 -21
- package/dist/variables.css +115 -2
- package/es/CardTable/style/index.css +3 -2
- package/es/CardTable/style/variables.css +3 -2
- package/es/CustomTableOption/columnsSort.js +41 -18
- package/es/CustomTableOption/filterSort.js +14 -6
- package/es/CustomTableOption/style/index.css +3 -0
- package/es/CustomTableOption/style/variables.css +3 -0
- package/es/Form/FormItem/index.js +5 -1
- package/es/InputNumber/index.js +7 -9
- package/es/LmEditTable/DndContainer.d.ts +6 -3
- package/es/LmEditTable/DndContainer.js +70 -10
- package/es/LmEditTable/DragHandle.js +1 -1
- package/es/LmEditTable/EditTable.d.ts +15 -5
- package/es/LmEditTable/EditTable.js +696 -361
- package/es/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/es/LmEditTable/components/DraggableContainer.js +39 -0
- package/es/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/es/LmEditTable/components/QuickOpetate.js +82 -0
- package/es/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/es/LmEditTable/components/bottomOpetateComponent.js +23 -0
- package/es/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/es/LmEditTable/components/customRenderEmpty.js +20 -0
- package/es/LmEditTable/components/index.d.ts +17 -0
- package/es/LmEditTable/components/index.js +8 -0
- package/es/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/es/LmEditTable/hooks/useForkRef.js +22 -0
- package/es/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/es/LmEditTable/rowSort/DndContainerRow.js +83 -0
- package/es/LmEditTable/sortableItem.d.ts +3 -2
- package/es/LmEditTable/sortableItem.js +16 -4
- package/es/LmEditTable/sortableItemCol.js +40 -10
- package/es/LmEditTable/style/index.css +109 -0
- package/es/LmEditTable/style/variables.css +109 -0
- package/es/LmEditTable/util.d.ts +10 -0
- package/es/LmEditTable/util.js +156 -7
- package/es/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow.js +148 -0
- package/es/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/es/LmEditTable/virtual/VirtualRow2.js +62 -0
- package/es/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualTable.js +64 -0
- package/es/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/es/LmEditTable/virtual/VirtualWrapper.js +60 -0
- package/es/LmEditTable/virtual/context.d.ts +13 -0
- package/es/LmEditTable/virtual/context.js +66 -0
- package/es/LmEditTable/virtual/index.d.ts +4 -0
- package/es/LmEditTable/virtual/index.js +4 -0
- package/es/LmFilter/baseFilter/index.js +3 -2
- package/es/LmFilter/filterFns/index.js +4 -2
- package/es/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/es/LmTable/virTual/VirtualRow.js +82 -48
- package/es/LmTable/virTual/VirtualTable.js +17 -9
- package/es/LmTable/virTual/context.js +14 -2
- package/es/LmUpload/body/UploadCore.js +1 -1
- package/es/LmUpload/fns/index.js +1 -1
- package/es/Radio/index.js +9 -1
- package/es/Switch/index.js +7 -2
- package/es/hooks/useEvent/index.js +1 -1
- package/es/index.d.ts +1 -2
- package/es/styles/variables.css +115 -2
- package/lib/CardTable/style/index.css +3 -2
- package/lib/CardTable/style/variables.css +3 -2
- package/lib/CustomTableOption/columnsSort.js +48 -22
- package/lib/CustomTableOption/filterSort.js +19 -10
- package/lib/CustomTableOption/style/index.css +3 -0
- package/lib/CustomTableOption/style/variables.css +3 -0
- package/lib/Form/FormItem/index.js +5 -1
- package/lib/InputNumber/index.js +9 -9
- package/lib/LmEditTable/DndContainer.d.ts +6 -3
- package/lib/LmEditTable/DndContainer.js +74 -9
- package/lib/LmEditTable/DragHandle.js +1 -1
- package/lib/LmEditTable/EditTable.d.ts +15 -5
- package/lib/LmEditTable/EditTable.js +694 -358
- package/lib/LmEditTable/components/DraggableContainer.d.ts +10 -0
- package/lib/LmEditTable/components/DraggableContainer.js +52 -0
- package/lib/LmEditTable/components/QuickOpetate.d.ts +12 -0
- package/lib/LmEditTable/components/QuickOpetate.js +96 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.d.ts +13 -0
- package/lib/LmEditTable/components/bottomOpetateComponent.js +34 -0
- package/lib/LmEditTable/components/customRenderEmpty.d.ts +2 -0
- package/lib/LmEditTable/components/customRenderEmpty.js +32 -0
- package/lib/LmEditTable/components/index.d.ts +17 -0
- package/lib/LmEditTable/components/index.js +45 -0
- package/lib/LmEditTable/hooks/useForkRef.d.ts +2 -0
- package/lib/LmEditTable/hooks/useForkRef.js +29 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.d.ts +10 -0
- package/lib/LmEditTable/rowSort/DndContainerRow.js +100 -0
- package/lib/LmEditTable/sortableItem.d.ts +3 -2
- package/lib/LmEditTable/sortableItem.js +19 -5
- package/lib/LmEditTable/sortableItemCol.js +37 -8
- package/lib/LmEditTable/style/index.css +109 -0
- package/lib/LmEditTable/style/variables.css +109 -0
- package/lib/LmEditTable/util.d.ts +10 -0
- package/lib/LmEditTable/util.js +165 -6
- package/lib/LmEditTable/virtual/VirtualRow.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow.js +164 -0
- package/lib/LmEditTable/virtual/VirtualRow2.d.ts +7 -0
- package/lib/LmEditTable/virtual/VirtualRow2.js +78 -0
- package/lib/LmEditTable/virtual/VirtualTable.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualTable.js +81 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.d.ts +3 -0
- package/lib/LmEditTable/virtual/VirtualWrapper.js +73 -0
- package/lib/LmEditTable/virtual/context.d.ts +13 -0
- package/lib/LmEditTable/virtual/context.js +76 -0
- package/lib/LmEditTable/virtual/index.d.ts +4 -0
- package/lib/LmEditTable/virtual/index.js +31 -0
- package/lib/LmFilter/baseFilter/index.js +3 -2
- package/lib/LmFilter/filterFns/index.js +4 -2
- package/lib/LmTable/virTual/VirtualRow.d.ts +1 -1
- package/lib/LmTable/virTual/VirtualRow.js +81 -48
- package/lib/LmTable/virTual/VirtualTable.js +16 -8
- package/lib/LmTable/virTual/context.js +14 -2
- package/lib/LmUpload/body/UploadCore.js +1 -1
- package/lib/LmUpload/fns/index.js +1 -1
- package/lib/Radio/index.js +9 -1
- package/lib/Switch/index.js +9 -2
- package/lib/hooks/useEvent/index.js +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/styles/variables.css +115 -2
- package/package.json +7 -9
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
.lm_editTable_warpper {
|
|
2
|
+
height: 100%;
|
|
3
|
+
width: 100%;
|
|
4
|
+
}
|
|
1
5
|
.lm_editTable_warpper .ant-picker {
|
|
2
6
|
width: 100%;
|
|
3
7
|
}
|
|
@@ -26,6 +30,9 @@
|
|
|
26
30
|
width: 32px;
|
|
27
31
|
padding: 0 8px;
|
|
28
32
|
}
|
|
33
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
34
|
+
height: 100%;
|
|
35
|
+
}
|
|
29
36
|
.lm_editTable_warpper .lm_editTable_cell {
|
|
30
37
|
cursor: pointer;
|
|
31
38
|
height: 40px;
|
|
@@ -37,6 +44,21 @@
|
|
|
37
44
|
letter-spacing: 0px;
|
|
38
45
|
color: var(--color-85);
|
|
39
46
|
}
|
|
47
|
+
.lm_editTable_warpper .lm_custom_cell_td {
|
|
48
|
+
position: relative;
|
|
49
|
+
}
|
|
50
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: row;
|
|
53
|
+
flex-wrap: nowrap;
|
|
54
|
+
}
|
|
55
|
+
.lm_editTable_warpper .lm_custom_cell_td.ant-table-cell-with-append .ant-table-row-expand-icon {
|
|
56
|
+
margin-right: 8px;
|
|
57
|
+
flex: none;
|
|
58
|
+
}
|
|
59
|
+
.lm_editTable_warpper .lm_custom_cell_td > .ant-form-item {
|
|
60
|
+
flex: 1 1 auto;
|
|
61
|
+
}
|
|
40
62
|
.lm_editTable_warpper .lm_custom_cell_td .ant-form-item-control-input-content {
|
|
41
63
|
display: flex;
|
|
42
64
|
flex-direction: row;
|
|
@@ -48,6 +70,32 @@
|
|
|
48
70
|
.lm_editTable_warpper .lm_custom_cell_td .ant-table-row-expand-icon {
|
|
49
71
|
margin-top: 6px;
|
|
50
72
|
}
|
|
73
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp {
|
|
74
|
+
font-size: 8px;
|
|
75
|
+
position: absolute;
|
|
76
|
+
left: calc(50% - 10px);
|
|
77
|
+
z-index: 100;
|
|
78
|
+
width: 20px;
|
|
79
|
+
height: 10px;
|
|
80
|
+
background-color: var(--color-6);
|
|
81
|
+
display: flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
color: #D8D8D8;
|
|
85
|
+
}
|
|
86
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_warp:hover {
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
background-color: var(--primary-color);
|
|
89
|
+
color: #fff;
|
|
90
|
+
}
|
|
91
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_up {
|
|
92
|
+
top: -4px;
|
|
93
|
+
left: calc(50% - 10px);
|
|
94
|
+
}
|
|
95
|
+
.lm_editTable_warpper .lm_custom_cell_td .quick_copy_down {
|
|
96
|
+
bottom: -6px;
|
|
97
|
+
left: calc(50% - 10px);
|
|
98
|
+
}
|
|
51
99
|
.lm_editTable_warpper .lm_editTable_cell_edit {
|
|
52
100
|
height: 40px;
|
|
53
101
|
padding: 8px 8px !important;
|
|
@@ -59,6 +107,9 @@
|
|
|
59
107
|
.lm_editTable_warpper .lm_table_quickcopy .anticon {
|
|
60
108
|
color: var(--text-color);
|
|
61
109
|
}
|
|
110
|
+
.lm_editTable_warpper .ant-table-body {
|
|
111
|
+
scroll-behavior: smooth;
|
|
112
|
+
}
|
|
62
113
|
.lm_editTable_warpper .icon_drag {
|
|
63
114
|
color: var(--tip-text-color);
|
|
64
115
|
}
|
|
@@ -75,12 +126,55 @@
|
|
|
75
126
|
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
76
127
|
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
77
128
|
}
|
|
129
|
+
.lm_editTable_warpper .ant-table-thead > tr > th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
130
|
+
background-color: rgba(0, 0, 0, 0.06) !important;
|
|
131
|
+
}
|
|
132
|
+
.lm_editTable_warpper .lm_table_empty {
|
|
133
|
+
display: flex;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
align-items: center;
|
|
136
|
+
padding: 12px 0;
|
|
137
|
+
font-size: 12px;
|
|
138
|
+
}
|
|
139
|
+
.lm_editTable_warpper .lm_table_empty > img {
|
|
140
|
+
width: 130px;
|
|
141
|
+
height: 80px;
|
|
142
|
+
margin-bottom: 8px;
|
|
143
|
+
}
|
|
144
|
+
.lm_editTable_warpper .lm_table_empty .empty_img {
|
|
145
|
+
margin-bottom: 8px;
|
|
146
|
+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQQAAACgCAYAAADq8hJGAAAABHNCSVQICAgIfAhkiAAADh9JREFUeJzt3U1sG2d+x/HvMy98EUlblivHbmPXrrN14KCbLBrEhwViC0jjxusgiz3oViC5NLdstkCBHraoChRFT6mL9uJLHBQoUCiHtnBgBHBQ+VAECGDD6SHZYOvYRrqxEzu2JVMWxZeZpwdyJpJqSRQ15PDl97mMHHGGfzLUPD8+8zzPGKQrZmdnMwD5fN4DePXVV5fa3G8CoFAolACWl5cBCILgNsD09HStC+X2rZmZGQfghRde8AFc1/UAbt26FQAUCoU6wPT0dJBWjcPESbsAEekfJu0Chs2HH364DyAIgidW/vcgCOoA1tqvAF577bUywOzsrAtQKBQOtx469rjjNhqNEMBxnGvQfuIYNBcuXNgBUK/X9wB4nldsZ7/o/XVddxEgDMNHAMVicR5gamqq0Y16h40SgojElBASMjs7uxMgn88fbOfxlUrl1wC5XG4SwBizq539jDE1gNOnT/+qo0L7TJSQcrncAQBjzI4kjx8EQdg67h2Aq1ev3gWYmZkJk3yeYaGEICIxJYSEnD9//gcAnufl29yl2tpmO3k+a+1tgFOnTt3tZP+0XbhwIQvguu4hgDAMM7143kajUWs97w2AU6dOVTfeY7QoIYhITAlhmz7++OM8QLlcPrzZYxPWADh58uQXPX7ebVmbDAAvjTocxwkAwjD8CuDkyZOP0qij3yghiEhs5B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QqHET5fH5Vn4wSgojE4i+6c3NzHkClUhkD8P0eL+Pb5zxvYhKgYbOHARwn3PBk6u46/GcAxs281P3qhldYX/4PgHDhxtl2Hu8Z9xuAWu3W9W7WNSwePHhQA5ienq6AEoKIrPD/UsDZs2d9gP379+d7X07/KRR+ZzeAdbMHOzqAmy8COJniU8lVNfzCyt1Pt7P/cm3pPkC4/M2NZCoaTq+88koZwBijqwwistq6/QRRn8LExEQWwOv2zfv61MNK5vcBshk/m3Yt0j5rbbPFC+e/AMhkMo10K+ovR48eXQYwxqx6X5QQRCS2aas/OzvrAhw5ciTX/XL6T93fuQPAs+xNuxZp35ifXwCoVL75Nu1a+onneXWAZ555pva43yshiEis7X6BmZkZB+D48eMZgFKpNFInE9/3iwAmt2MCwGiyQn9yGosA1fn5e2mX0k/K5XINYGpqasO+lJH6oxaRjXXcykV9C5OTkz5ANpsdiRYzk8m0XmdpDCCf91ojOz3NBemhIAhDAN8PlgCq1eoSwMLCQpBmXf2iWq1agBMnTtQAjDFtrSOhhCAiscRadWttdHKJ7kwwaieb6PX6K7ePHsUrW49EgkqatQQAxSJRr3i9tVUSWC1aFyIAMMZ09P6M2h+tiGyga62WtTY69tqTjllnO+zWvh9rt+u9X8MmasnCTbZaCWljaxNBImtNDvuHT0S2oG9a5xWJYr3kMGqJYj3tvv7NHrf29+22yEk/TtqzKkFFsxOTpoQgIrGBb21XJIvIeq9pqy2mSBpW9aF0KwmsRwlBRGJqFdv0mCQS6TSRyGhZ29KnkgA2o4QgIjG1YkNug2Qjbei3FrzblBBERERERGQD/wcbRqz954lTWQAAAABJRU5ErkJggg==');
|
|
147
|
+
background-size: cover;
|
|
148
|
+
}
|
|
149
|
+
.lm_editTable_warpper .lm_table_empty > span {
|
|
150
|
+
color: var(--font-color);
|
|
151
|
+
}
|
|
152
|
+
.lm_editTable_warpper .ant-table-empty table {
|
|
153
|
+
height: 100%;
|
|
154
|
+
}
|
|
78
155
|
.lm_editTable_warpper .ant-picker {
|
|
79
156
|
height: 24px !important;
|
|
80
157
|
padding: 2px 8px;
|
|
81
158
|
padding-left: 7px;
|
|
82
159
|
box-sizing: border-box;
|
|
83
160
|
}
|
|
161
|
+
.lm_editTable_warpper .ant-table-bordered > .ant-table-container {
|
|
162
|
+
border: 1px solid #f0f0f0;
|
|
163
|
+
}
|
|
164
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper,
|
|
165
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading,
|
|
166
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container,
|
|
167
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table,
|
|
168
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container {
|
|
169
|
+
height: 100%;
|
|
170
|
+
}
|
|
171
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-wrapper .ant-table-body,
|
|
172
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-nested-loading .ant-table-body,
|
|
173
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-spin-container .ant-table-body,
|
|
174
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table .ant-table-body,
|
|
175
|
+
.lm_editTable_warpper.lm_editable_autosize .ant-table-container .ant-table-body {
|
|
176
|
+
height: calc(100% - 41px);
|
|
177
|
+
}
|
|
84
178
|
.lm_editTable_wrapperRange .inputRange {
|
|
85
179
|
display: inline-flex;
|
|
86
180
|
align-items: center;
|
|
@@ -118,3 +212,18 @@
|
|
|
118
212
|
.lm_table_append_add_popover .ant-popover-inner-content ul li:hover {
|
|
119
213
|
background-color: var(--color-15);
|
|
120
214
|
}
|
|
215
|
+
.lm_edittable_col_sort_item {
|
|
216
|
+
overflow: hidden;
|
|
217
|
+
}
|
|
218
|
+
.lm_editable_col_drag {
|
|
219
|
+
background-color: #fff;
|
|
220
|
+
font-size: 12px;
|
|
221
|
+
display: flex;
|
|
222
|
+
box-sizing: border-box;
|
|
223
|
+
transform: translate3d(var(--translate-x, 0), var(--translate-y, 0), 0) scaleX(var(--scale-x, 1)) scaleY(var(--scale-y, 1));
|
|
224
|
+
transform-origin: 0 0;
|
|
225
|
+
touch-action: manipulation;
|
|
226
|
+
scale: 1.05;
|
|
227
|
+
box-shadow: 0 0 0 calc(1px / var(--scale-x, 1)) rgba(63, 63, 68, 0.05), 0 1px calc(3px / var(--scale-x, 1)) 0 rgba(34, 33, 81, 0.15);
|
|
228
|
+
padding: 8px;
|
|
229
|
+
}
|
package/es/LmEditTable/util.d.ts
CHANGED
|
@@ -2,6 +2,16 @@ export declare function isObjEmpty(obj: Record<string, any>): boolean;
|
|
|
2
2
|
export declare function deepDataSourcePreKeys(dataSource: any[], rowKey: string): any;
|
|
3
3
|
export declare function isExpandRow(children: any): boolean;
|
|
4
4
|
export declare function checkRowKeyByDataSource(dataSource: any, rowKey: any): any;
|
|
5
|
+
export declare function getExpandStatus(children: any): any;
|
|
6
|
+
export declare function checkMemoShouldUploadSpecialFun(prev: any, next: any): any;
|
|
7
|
+
export declare function checkExpandIconColumnIndex({ rowSelection, sortOpen, indexCol }: {
|
|
8
|
+
rowSelection: any;
|
|
9
|
+
sortOpen: any;
|
|
10
|
+
indexCol: any;
|
|
11
|
+
}): number;
|
|
12
|
+
export declare function checkDataSourceIsEmpty(config: any, dataSource: any, scrollInfo: any): any;
|
|
13
|
+
/** 根据传入的disabedRows, 得出最终需要disabed的rowKeys */
|
|
14
|
+
export declare function checkTableRowIsDisable(deepDataSource: any, disabledRows: any, rowKey: any): any[];
|
|
5
15
|
declare const _default: {
|
|
6
16
|
isObjEmpty: typeof isObjEmpty;
|
|
7
17
|
};
|
package/es/LmEditTable/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
-
import { keyBy } from 'lodash';
|
|
3
|
+
import { keyBy, isEqual, pick, isFunction, omit, isObject } from 'lodash';
|
|
4
4
|
export function isObjEmpty(obj) {
|
|
5
5
|
var _a;
|
|
6
6
|
|
|
@@ -9,19 +9,20 @@ export function isObjEmpty(obj) {
|
|
|
9
9
|
export function deepDataSourcePreKeys(dataSource, rowKey) {
|
|
10
10
|
var deepDataSource = [];
|
|
11
11
|
|
|
12
|
-
var eachChildren = function eachChildren(children, preKeys) {
|
|
13
|
-
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
12
|
+
var eachChildren = function eachChildren(children, preKeys, deepIds) {
|
|
13
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item, index) {
|
|
14
14
|
deepDataSource.push(Object.assign(Object.assign({}, item), {
|
|
15
|
-
preKeys: [].concat(_toConsumableArray(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]])
|
|
15
|
+
preKeys: [].concat(_toConsumableArray(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]]),
|
|
16
|
+
_deepIds: [].concat(_toConsumableArray(deepIds), [index + 1])
|
|
16
17
|
}));
|
|
17
18
|
|
|
18
19
|
if (item === null || item === void 0 ? void 0 : item.children) {
|
|
19
|
-
eachChildren(item === null || item === void 0 ? void 0 : item.children, [].concat(_toConsumableArray(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]])); // deepDataSource.push({ ...item, preKeys: [...preKeys, item[rowKey]] })
|
|
20
|
+
eachChildren(item === null || item === void 0 ? void 0 : item.children, [].concat(_toConsumableArray(preKeys), [item === null || item === void 0 ? void 0 : item[rowKey]]), [].concat(_toConsumableArray(deepIds), [index + 1])); // deepDataSource.push({ ...item, preKeys: [...preKeys, item[rowKey]] })
|
|
20
21
|
}
|
|
21
22
|
});
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
eachChildren(dataSource, []);
|
|
25
|
+
eachChildren(dataSource, [], []);
|
|
25
26
|
return keyBy(deepDataSource, rowKey);
|
|
26
27
|
}
|
|
27
28
|
export function isExpandRow(children) {
|
|
@@ -53,7 +54,155 @@ export function checkRowKeyByDataSource(dataSource, rowKey) {
|
|
|
53
54
|
|
|
54
55
|
return Object.assign(Object.assign({}, v), _defineProperty({}, rowKey, v[rowKey] || "v".concat(idx + 1)));
|
|
55
56
|
});
|
|
56
|
-
return res;
|
|
57
|
+
return res || [];
|
|
58
|
+
}
|
|
59
|
+
export function getExpandStatus(children) {
|
|
60
|
+
var _a, _b, _c, _d, _e;
|
|
61
|
+
|
|
62
|
+
return isExpandRow(children) ? (_e = (_d = (_c = (_b = (_a = children === null || children === void 0 ? void 0 : children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.children) === null || _c === void 0 ? void 0 : _c[1]) === null || _d === void 0 ? void 0 : _d.props) === null || _e === void 0 ? void 0 : _e['aria-label'] : '';
|
|
63
|
+
}
|
|
64
|
+
export function checkMemoShouldUploadSpecialFun(prev, next) {
|
|
65
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
66
|
+
|
|
67
|
+
var checkExpandStatus = getExpandStatus(prev.children) === getExpandStatus(next.children);
|
|
68
|
+
|
|
69
|
+
if (!checkExpandStatus) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var prevCol = prev === null || prev === void 0 ? void 0 : prev.col;
|
|
74
|
+
var nextCol = next === null || next === void 0 ? void 0 : next.col;
|
|
75
|
+
/** TODO: 使用了自定义render, 是否要判断rowIndex? 这样排序之后,渲染的性能就会变差 */
|
|
76
|
+
|
|
77
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.render) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.render)) && !isEqual(pick(prev, ['colIndex', 'record', 'children']), pick(next, ['colIndex', 'record', 'children']))) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (!(next === null || next === void 0 ? void 0 : next.quickOpetateClearAll) && ((next === null || next === void 0 ? void 0 : next.getLength) < 2 || (prev === null || prev === void 0 ? void 0 : prev.getLength) === 1) && (next === null || next === void 0 ? void 0 : next.dataIndex) === 'lm_edit_opetate') {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (prev.isEdit !== next.isEdit) {
|
|
86
|
+
return false;
|
|
87
|
+
} // console.log(22, prevCol?.editable === 'render', nextCol?.editable === 'render', prevCol?.componentProps, prevCol?.componentProps)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.editable) === 'render' || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.editable) === 'render') && (((_a = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _a === void 0 ? void 0 : _a.render) || ((_b = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _b === void 0 ? void 0 : _b.render)) && (!isEqual(omit(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, ['render']), omit(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps, ['render'])) || !isEqual(pick(prev, ['colIndex', 'record', 'rowIndex']), pick(next, ['colIndex', 'record', 'rowIndex'])))) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.fixed) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.fixed)) && !isEqual(prev === null || prev === void 0 ? void 0 : prev.style, next === null || next === void 0 ? void 0 : next.style)) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if ((((_c = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _c === void 0 ? void 0 : _c.optionOnly) || ((_d = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _d === void 0 ? void 0 : _d.optionOnly)) && !isEqual((_e = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _e === void 0 ? void 0 : _e.options, (_f = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _f === void 0 ? void 0 : _f.options)) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if ((((_g = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _g === void 0 ? void 0 : _g.options) || ((_h = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _h === void 0 ? void 0 : _h.options)) && !isEqual((_j = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _j === void 0 ? void 0 : _j.options, (_k = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _k === void 0 ? void 0 : _k.options)) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if ((isFunction(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) || isFunction(nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) && !isEqual(prevCol.newOptions, nextCol.newOptions) && !isEqual(prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps, nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps)) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (((prevCol === null || prevCol === void 0 ? void 0 : prevCol.order) || (nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) && !isEqual(prevCol === null || prevCol === void 0 ? void 0 : prevCol.order, nextCol === null || nextCol === void 0 ? void 0 : nextCol.order)) {
|
|
111
|
+
// return isEqual(prevCol?.order, nextCol?.fixed)
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (next.className.indexOf('drag-visible') > -1) {
|
|
116
|
+
return isEqual(prev.style, next.style);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (((_l = next.className) === null || _l === void 0 ? void 0 : _l.indexOf('ant-table-row-expand-icon-cell')) > -1) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (next.className.indexOf('ant-table-selection-column') > -1) {
|
|
124
|
+
return isEqual((_o = (_m = prev.children) === null || _m === void 0 ? void 0 : _m[1]) === null || _o === void 0 ? void 0 : _o.props, (_q = (_p = next.children) === null || _p === void 0 ? void 0 : _p[1]) === null || _q === void 0 ? void 0 : _q.props);
|
|
125
|
+
}
|
|
126
|
+
/** 如果启用了快速复制功能,需要实时判断rowIndex与getLength */
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if (((_r = prevCol === null || prevCol === void 0 ? void 0 : prevCol.componentProps) === null || _r === void 0 ? void 0 : _r.quickcopy) || ((_s = nextCol === null || nextCol === void 0 ? void 0 : nextCol.componentProps) === null || _s === void 0 ? void 0 : _s.quickcopy)) {
|
|
130
|
+
var pickProps = ['record', 'colIndex', 'rowIndex', 'getLength'];
|
|
131
|
+
var p = pick(prev, pickProps);
|
|
132
|
+
var n = pick(next, pickProps);
|
|
133
|
+
return isEqual(p, n);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
export function checkExpandIconColumnIndex(_ref) {
|
|
139
|
+
var rowSelection = _ref.rowSelection,
|
|
140
|
+
sortOpen = _ref.sortOpen,
|
|
141
|
+
indexCol = _ref.indexCol;
|
|
142
|
+
var arr = [rowSelection, sortOpen, indexCol].filter(function (item) {
|
|
143
|
+
return !!item;
|
|
144
|
+
});
|
|
145
|
+
return arr.length;
|
|
146
|
+
}
|
|
147
|
+
export function checkDataSourceIsEmpty(config, dataSource, scrollInfo) {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
|
|
150
|
+
var resultConfig = Object.assign({}, config);
|
|
151
|
+
|
|
152
|
+
if (scrollInfo) {
|
|
153
|
+
resultConfig = Object.assign(Object.assign({}, resultConfig), {
|
|
154
|
+
scroll: {
|
|
155
|
+
x: ((_a = resultConfig.scroll) === null || _a === void 0 ? void 0 : _a.x) || '100%',
|
|
156
|
+
y: scrollInfo.height || ((_b = resultConfig.scroll) === null || _b === void 0 ? void 0 : _b.y)
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (dataSource.length) {
|
|
162
|
+
return resultConfig;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
return Object.assign(Object.assign({}, resultConfig), {
|
|
166
|
+
components: Object.assign(Object.assign({}, resultConfig.components), {
|
|
167
|
+
body: {}
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
/** 根据传入的disabedRows, 得出最终需要disabed的rowKeys */
|
|
172
|
+
|
|
173
|
+
export function checkTableRowIsDisable(deepDataSource, disabledRows, rowKey) {
|
|
174
|
+
var disabledRkeys = [];
|
|
175
|
+
|
|
176
|
+
if (!disabledRows.length) {
|
|
177
|
+
return disabledRkeys;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
var disableIds = disabledRows.map(function (item) {
|
|
181
|
+
return isObject(item) ? item === null || item === void 0 ? void 0 : item[rowKey] : item;
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
function deep(children, arrs) {
|
|
185
|
+
children === null || children === void 0 ? void 0 : children.forEach(function (item) {
|
|
186
|
+
arrs.push(item[rowKey]);
|
|
187
|
+
|
|
188
|
+
if (item.children) {
|
|
189
|
+
deep(item.children, arrs);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
if (disableIds.length) {
|
|
195
|
+
disableIds === null || disableIds === void 0 ? void 0 : disableIds.forEach(function (item) {
|
|
196
|
+
disabledRkeys.push(item);
|
|
197
|
+
var record = deepDataSource[item];
|
|
198
|
+
|
|
199
|
+
if (record === null || record === void 0 ? void 0 : record.children) {
|
|
200
|
+
deep(record.children, disabledRkeys);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return disabledRkeys;
|
|
57
206
|
}
|
|
58
207
|
export default {
|
|
59
208
|
isObjEmpty: isObjEmpty
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
|
|
4
|
+
for (var p in s) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
import React, { useRef, useMemo, useEffect } from 'react';
|
|
15
|
+
import { useStore } from './context';
|
|
16
|
+
import useForkRef from '../hooks/useForkRef';
|
|
17
|
+
import { omit } from 'lodash';
|
|
18
|
+
|
|
19
|
+
var useOptions = function useOptions(_ref) {
|
|
20
|
+
var children = _ref.children,
|
|
21
|
+
ref = _ref.ref,
|
|
22
|
+
trRef = _ref.trRef;
|
|
23
|
+
|
|
24
|
+
var _a;
|
|
25
|
+
|
|
26
|
+
var _useStore = useStore(),
|
|
27
|
+
state = _useStore.state,
|
|
28
|
+
dispatch = _useStore.dispatch,
|
|
29
|
+
instance = _useStore.instance;
|
|
30
|
+
|
|
31
|
+
var virtualItems = instance.columnVirtual.virtualItems;
|
|
32
|
+
var rowHeight = state.rowHeight,
|
|
33
|
+
totalLen = state.totalLen;
|
|
34
|
+
var sliceColumns = useMemo(function () {
|
|
35
|
+
var _a;
|
|
36
|
+
|
|
37
|
+
return (_a = children === null || children === void 0 ? void 0 : children.reduce) === null || _a === void 0 ? void 0 : _a.call(children, function (pre, cur) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
|
|
40
|
+
if (typeof ((_a = cur.props) === null || _a === void 0 ? void 0 : _a.fixLeft) === 'number') {
|
|
41
|
+
pre.leftColumns.push(cur);
|
|
42
|
+
return pre;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (typeof ((_b = cur.props) === null || _b === void 0 ? void 0 : _b.fixRight) === 'number') {
|
|
46
|
+
pre.rightColumns.push(cur);
|
|
47
|
+
return pre;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
pre.centerColumns.push(cur);
|
|
51
|
+
return pre;
|
|
52
|
+
}, {
|
|
53
|
+
leftColumns: [],
|
|
54
|
+
rightColumns: [],
|
|
55
|
+
centerColumns: []
|
|
56
|
+
});
|
|
57
|
+
}, [children]);
|
|
58
|
+
useEffect(function () {
|
|
59
|
+
dispatch({
|
|
60
|
+
type: 'changeSliceColumns',
|
|
61
|
+
sliceColumns: sliceColumns
|
|
62
|
+
});
|
|
63
|
+
}, [sliceColumns]); // 非固定列长度
|
|
64
|
+
|
|
65
|
+
var centerColumnsLen = useMemo(function () {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
|
|
68
|
+
return (_b = (_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
69
|
+
}, [sliceColumns]);
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (state.columnsLen !== centerColumnsLen) {
|
|
72
|
+
dispatch({
|
|
73
|
+
type: 'changeColumnsLen',
|
|
74
|
+
columnsLen: centerColumnsLen !== null && centerColumnsLen !== void 0 ? centerColumnsLen : 0
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}, [centerColumnsLen, dispatch, state.columnsLen]); // 获取行的高度
|
|
78
|
+
|
|
79
|
+
useEffect(function () {
|
|
80
|
+
var initHeight = function initHeight(tempRef) {
|
|
81
|
+
var _a, _b, _c;
|
|
82
|
+
|
|
83
|
+
if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
|
|
84
|
+
var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
|
|
85
|
+
dispatch({
|
|
86
|
+
type: 'initHeight',
|
|
87
|
+
rowHeight: tempRowHeight + 1
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
initHeight(Object.prototype.hasOwnProperty.call(ref, 'current') ? ref : trRef);
|
|
93
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]); // 横向单元格合并
|
|
94
|
+
|
|
95
|
+
var leftColSpan = useMemo(function () {
|
|
96
|
+
var _a;
|
|
97
|
+
|
|
98
|
+
return (_a = virtualItems[0]) === null || _a === void 0 ? void 0 : _a.index;
|
|
99
|
+
}, [virtualItems]); // 右侧隐藏数量
|
|
100
|
+
|
|
101
|
+
var rightColSpan = useMemo(function () {
|
|
102
|
+
var _a;
|
|
103
|
+
|
|
104
|
+
return ((_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length) - (virtualItems === null || virtualItems === void 0 ? void 0 : virtualItems.length) - leftColSpan || 0;
|
|
105
|
+
}, [(_a = sliceColumns === null || sliceColumns === void 0 ? void 0 : sliceColumns.centerColumns) === null || _a === void 0 ? void 0 : _a.length, virtualItems.length, leftColSpan]);
|
|
106
|
+
return Object.assign(Object.assign({
|
|
107
|
+
virtualItems: virtualItems
|
|
108
|
+
}, sliceColumns), {
|
|
109
|
+
leftColSpan: leftColSpan,
|
|
110
|
+
rightColSpan: rightColSpan
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
|
|
115
|
+
var children = _a.children,
|
|
116
|
+
pref = _a.pref,
|
|
117
|
+
resetProps = __rest(_a, ["children", "pref"]);
|
|
118
|
+
|
|
119
|
+
var trRef = useRef(null);
|
|
120
|
+
var clearProps = omit(resetProps, ['dataKey', 'pushAllForm']);
|
|
121
|
+
|
|
122
|
+
var _useOptions = useOptions({
|
|
123
|
+
children: children,
|
|
124
|
+
ref: ref,
|
|
125
|
+
trRef: trRef
|
|
126
|
+
}),
|
|
127
|
+
virtualItems = _useOptions.virtualItems,
|
|
128
|
+
leftColumns = _useOptions.leftColumns,
|
|
129
|
+
centerColumns = _useOptions.centerColumns,
|
|
130
|
+
rightColumns = _useOptions.rightColumns,
|
|
131
|
+
leftColSpan = _useOptions.leftColSpan,
|
|
132
|
+
rightColSpan = _useOptions.rightColSpan;
|
|
133
|
+
|
|
134
|
+
return /*#__PURE__*/React.createElement("tr", Object.assign({}, clearProps, {
|
|
135
|
+
ref: useForkRef(pref, trRef)
|
|
136
|
+
}), leftColumns, !!leftColSpan && /*#__PURE__*/React.createElement("td", {
|
|
137
|
+
key: "leftColSpan",
|
|
138
|
+
colSpan: leftColSpan
|
|
139
|
+
}), virtualItems.map(function (virtualCol) {
|
|
140
|
+
return /*#__PURE__*/React.cloneElement(centerColumns[virtualCol.index], {
|
|
141
|
+
ref: virtualCol.measureRef
|
|
142
|
+
});
|
|
143
|
+
}), !!rightColSpan && /*#__PURE__*/React.createElement("td", {
|
|
144
|
+
key: "rightColSpan",
|
|
145
|
+
colSpan: rightColSpan
|
|
146
|
+
}), rightColumns);
|
|
147
|
+
});
|
|
148
|
+
export default VirtualRow;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
|
|
4
|
+
for (var p in s) {
|
|
5
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
import React, { useRef, useMemo, useEffect } from 'react';
|
|
15
|
+
import { useStore } from './context';
|
|
16
|
+
import useForkRef from '../hooks/useForkRef';
|
|
17
|
+
var VirtualRow = /*#__PURE__*/React.memo(function (_a, ref) {
|
|
18
|
+
var children = _a.children,
|
|
19
|
+
pref = _a.pref,
|
|
20
|
+
resetProps = __rest(_a, ["children", "pref"]);
|
|
21
|
+
|
|
22
|
+
var _useStore = useStore(),
|
|
23
|
+
state = _useStore.state,
|
|
24
|
+
dispatch = _useStore.dispatch;
|
|
25
|
+
|
|
26
|
+
var rowHeight = state.rowHeight,
|
|
27
|
+
totalLen = state.totalLen;
|
|
28
|
+
var trRef = useRef(null); // 列长度
|
|
29
|
+
|
|
30
|
+
var columnsLen = useMemo(function () {
|
|
31
|
+
var _a;
|
|
32
|
+
|
|
33
|
+
return (_a = children === null || children === void 0 ? void 0 : children.length) !== null && _a !== void 0 ? _a : 0;
|
|
34
|
+
}, [children]);
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
if (state.columnsLen !== columnsLen) {
|
|
37
|
+
dispatch({
|
|
38
|
+
type: 'changeColumnsLen',
|
|
39
|
+
columnsLen: columnsLen !== null && columnsLen !== void 0 ? columnsLen : 0
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}, [columnsLen, dispatch, state.columnsLen]);
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
var initHeight = function initHeight(tempRef) {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
|
|
47
|
+
if (((_a = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) && !rowHeight && totalLen) {
|
|
48
|
+
var tempRowHeight = (_c = (_b = tempRef === null || tempRef === void 0 ? void 0 : tempRef.current) === null || _b === void 0 ? void 0 : _b.offsetHeight) !== null && _c !== void 0 ? _c : 0;
|
|
49
|
+
dispatch({
|
|
50
|
+
type: 'initHeight',
|
|
51
|
+
rowHeight: tempRowHeight
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
initHeight(trRef);
|
|
57
|
+
}, [trRef, dispatch, rowHeight, totalLen, ref]);
|
|
58
|
+
return /*#__PURE__*/React.createElement("tr", Object.assign({}, resetProps, {
|
|
59
|
+
ref: useForkRef(pref, trRef)
|
|
60
|
+
}), children);
|
|
61
|
+
});
|
|
62
|
+
export default VirtualRow;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import React, { useCallback, useRef } from 'react';
|
|
3
|
+
import { useVirtual } from 'react-virtual';
|
|
4
|
+
import { TableContext, useRealive } from './context';
|
|
5
|
+
var VirtualTable = /*#__PURE__*/React.memo(function (tableProps) {
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
|
+
|
|
8
|
+
var fn = tableProps.fn;
|
|
9
|
+
var bodyRef = useRef(null);
|
|
10
|
+
|
|
11
|
+
var _useRealive = useRealive(),
|
|
12
|
+
_useRealive2 = _slicedToArray(_useRealive, 2),
|
|
13
|
+
state = _useRealive2[0],
|
|
14
|
+
dispatch = _useRealive2[1]; // 行虚拟化 { totalSize, virtualItems }
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var rowVirtual = useVirtual({
|
|
18
|
+
size: state.totalLen,
|
|
19
|
+
// 绑定父节点
|
|
20
|
+
parentRef: {
|
|
21
|
+
current: (_a = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode
|
|
22
|
+
},
|
|
23
|
+
estimateSize: React.useCallback(function () {
|
|
24
|
+
return state.rowHeight;
|
|
25
|
+
}, [state.rowHeight]),
|
|
26
|
+
overscan: 5
|
|
27
|
+
});
|
|
28
|
+
fn.current = rowVirtual.scrollToIndex; // 列动态宽度
|
|
29
|
+
|
|
30
|
+
var columnEstimateSize = useCallback(function (i) {
|
|
31
|
+
var _a, _b;
|
|
32
|
+
|
|
33
|
+
var colWidths = (_b = (_a = tableProps === null || tableProps === void 0 ? void 0 : tableProps.children[0]) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.colWidths;
|
|
34
|
+
var leftColumnsLen = state.sliceColumns.leftColumns.length;
|
|
35
|
+
var centerColumnsLen = state.sliceColumns.centerColumns.length; // 获取非固定列
|
|
36
|
+
|
|
37
|
+
var virList = colWidths.slice(leftColumnsLen, leftColumnsLen + centerColumnsLen);
|
|
38
|
+
return virList[i] || 0;
|
|
39
|
+
}, [(_c = (_b = tableProps.children[0]) === null || _b === void 0 ? void 0 : _b.props) === null || _c === void 0 ? void 0 : _c.colWidths, state.sliceColumns.leftColumns.length, state.sliceColumns.centerColumns.length]); // 列虚拟化
|
|
40
|
+
|
|
41
|
+
var columnVirtual = useVirtual({
|
|
42
|
+
horizontal: true,
|
|
43
|
+
size: state.columnsLen,
|
|
44
|
+
parentRef: {
|
|
45
|
+
current: (_d = bodyRef === null || bodyRef === void 0 ? void 0 : bodyRef.current) === null || _d === void 0 ? void 0 : _d.parentNode
|
|
46
|
+
},
|
|
47
|
+
estimateSize: columnEstimateSize,
|
|
48
|
+
overscan: 5
|
|
49
|
+
});
|
|
50
|
+
var instance = {
|
|
51
|
+
rowVirtual: rowVirtual,
|
|
52
|
+
columnVirtual: columnVirtual
|
|
53
|
+
};
|
|
54
|
+
return /*#__PURE__*/React.createElement(TableContext.Provider, {
|
|
55
|
+
value: {
|
|
56
|
+
state: state,
|
|
57
|
+
dispatch: dispatch,
|
|
58
|
+
instance: instance
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/React.createElement("table", Object.assign({
|
|
61
|
+
ref: bodyRef
|
|
62
|
+
}, tableProps)));
|
|
63
|
+
});
|
|
64
|
+
export default VirtualTable;
|