@publishfx/publish-components 2.0.3
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/README.md +191 -0
- package/dist/ActionButton/index.d.ts +10 -0
- package/dist/ActionButton/index.js +40 -0
- package/dist/ActionButton/index.module.js +9 -0
- package/dist/ActionButton/index_module.css +23 -0
- package/dist/ActionButton/interface.d.ts +12 -0
- package/dist/ActionButton/interface.js +9 -0
- package/dist/CommonModal/config.d.ts +8 -0
- package/dist/CommonModal/config.js +13 -0
- package/dist/CommonModal/confirm.d.ts +7 -0
- package/dist/CommonModal/confirm.js +132 -0
- package/dist/CommonModal/index.d.ts +2 -0
- package/dist/CommonModal/index.js +3 -0
- package/dist/CommonModal/interface.d.ts +17 -0
- package/dist/CommonModal/interface.js +0 -0
- package/dist/CommonModal/modal.d.ts +11 -0
- package/dist/CommonModal/modal.js +161 -0
- package/dist/CompareChange/index.d.ts +20 -0
- package/dist/CompareChange/index.js +66 -0
- package/dist/CustomTransfer/BaseTransfer.d.ts +35 -0
- package/dist/CustomTransfer/BaseTransfer.js +155 -0
- package/dist/CustomTransfer/SelectItemList.d.ts +9 -0
- package/dist/CustomTransfer/SelectItemList.js +54 -0
- package/dist/CustomTransfer/SelectTreeList.d.ts +43 -0
- package/dist/CustomTransfer/SelectTreeList.js +248 -0
- package/dist/CustomTransfer/SelectedItemList.d.ts +21 -0
- package/dist/CustomTransfer/SelectedItemList.js +132 -0
- package/dist/CustomTransfer/SimpleLink.d.ts +4 -0
- package/dist/CustomTransfer/SimpleLink.js +20 -0
- package/dist/CustomTransfer/index.d.ts +22 -0
- package/dist/CustomTransfer/index.js +92 -0
- package/dist/CustomTransfer/styled.d.ts +27 -0
- package/dist/CustomTransfer/styled.js +181 -0
- package/dist/PerformanceTable/ResizableTitle.d.ts +12 -0
- package/dist/PerformanceTable/ResizableTitle.js +85 -0
- package/dist/PerformanceTable/index.d.ts +4 -0
- package/dist/PerformanceTable/index.js +417 -0
- package/dist/PerformanceTable/interface.d.ts +47 -0
- package/dist/PerformanceTable/interface.js +0 -0
- package/dist/PerformanceTable/style.d.ts +19 -0
- package/dist/PerformanceTable/style.js +402 -0
- package/dist/PerformanceTable/useResizable.d.ts +29 -0
- package/dist/PerformanceTable/useResizable.js +108 -0
- package/dist/ReactSticky/Container.d.ts +19 -0
- package/dist/ReactSticky/Container.js +93 -0
- package/dist/ReactSticky/Sticky.d.ts +27 -0
- package/dist/ReactSticky/Sticky.js +123 -0
- package/dist/ReactSticky/index.d.ts +5 -0
- package/dist/ReactSticky/index.js +4 -0
- package/dist/assets/icons/403.js +15 -0
- package/dist/assets/icons/Icon403.d.ts +3 -0
- package/dist/assets/icons/Icon403.js +14 -0
- package/dist/assets/icons/IconAdd.d.ts +3 -0
- package/dist/assets/icons/IconAdd.js +24 -0
- package/dist/assets/icons/IconAim.d.ts +3 -0
- package/dist/assets/icons/IconAim.js +36 -0
- package/dist/assets/icons/IconBatchupload.d.ts +3 -0
- package/dist/assets/icons/IconBatchupload.js +23 -0
- package/dist/assets/icons/IconClose.d.ts +3 -0
- package/dist/assets/icons/IconClose.js +15 -0
- package/dist/assets/icons/IconDrag_sort.d.ts +3 -0
- package/dist/assets/icons/IconDrag_sort.js +28 -0
- package/dist/assets/icons/IconError.d.ts +3 -0
- package/dist/assets/icons/IconError.js +42 -0
- package/dist/assets/icons/IconExport.d.ts +3 -0
- package/dist/assets/icons/IconExport.js +15 -0
- package/dist/assets/icons/IconFolder.d.ts +3 -0
- package/dist/assets/icons/IconFolder.js +126 -0
- package/dist/assets/icons/IconOpen_down.d.ts +3 -0
- package/dist/assets/icons/IconOpen_down.js +13 -0
- package/dist/assets/icons/IconOpen_right.d.ts +3 -0
- package/dist/assets/icons/IconOpen_right.js +13 -0
- package/dist/assets/icons/IconPlus.d.ts +3 -0
- package/dist/assets/icons/IconPlus.js +17 -0
- package/dist/assets/icons/IconSearch.d.ts +3 -0
- package/dist/assets/icons/IconSearch.js +15 -0
- package/dist/assets/icons/IconSelected_transfer.d.ts +3 -0
- package/dist/assets/icons/IconSelected_transfer.js +15 -0
- package/dist/assets/icons/IconSettings.d.ts +3 -0
- package/dist/assets/icons/IconSettings.js +15 -0
- package/dist/assets/icons/IconUp_down.d.ts +3 -0
- package/dist/assets/icons/IconUp_down.js +15 -0
- package/dist/assets/icons/IconUpload.d.ts +3 -0
- package/dist/assets/icons/IconUpload.js +20 -0
- package/dist/assets/icons/Up_down.js +17 -0
- package/dist/assets/icons/add.js +28 -0
- package/dist/assets/icons/batchupload.js +24 -0
- package/dist/assets/icons/close.js +17 -0
- package/dist/assets/icons/data_increase.js +31 -0
- package/dist/assets/icons/data_no_change.js +19 -0
- package/dist/assets/icons/data_reduction.js +31 -0
- package/dist/assets/icons/drag_sort.js +30 -0
- package/dist/assets/icons/error.js +44 -0
- package/dist/assets/icons/export.js +16 -0
- package/dist/assets/icons/folder.js +128 -0
- package/dist/assets/icons/open_down.js +15 -0
- package/dist/assets/icons/open_right.js +15 -0
- package/dist/assets/icons/plus.js +19 -0
- package/dist/assets/icons/search.js +17 -0
- package/dist/assets/icons/selected.js +17 -0
- package/dist/assets/icons/selected_transfer.js +17 -0
- package/dist/assets/icons/settings.js +17 -0
- package/dist/assets/icons/upload.js +23 -0
- package/dist/assets/images/book.js +2 -0
- package/dist/assets/images/emptyVideo.js +2 -0
- package/dist/assets/images/excel.js +2 -0
- package/dist/assets/images/fail.js +2 -0
- package/dist/assets/images/file.js +2 -0
- package/dist/assets/images/noResult.js +2 -0
- package/dist/assets/images/platform/Apple.js +23 -0
- package/dist/assets/images/platform/Facebook.js +42 -0
- package/dist/assets/images/platform/Google.js +54 -0
- package/dist/assets/images/platform/Instagram.js +2 -0
- package/dist/assets/images/platform/TikTok.js +42 -0
- package/dist/assets/images/platform/Twitch.js +2 -0
- package/dist/assets/images/platform/Twitter.js +2 -0
- package/dist/assets/images/platform/Youtube.js +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/static/image/Instagram.png +0 -0
- package/dist/static/image/Twitch.png +0 -0
- package/dist/static/image/Twitter.png +0 -0
- package/dist/static/image/Youtube.png +0 -0
- package/dist/static/image/book.png +0 -0
- package/dist/static/image/emptyVideo.png +0 -0
- package/dist/static/image/excel.png +0 -0
- package/dist/static/image/fail.png +0 -0
- package/dist/static/image/file.png +0 -0
- package/dist/static/image/noResult.png +0 -0
- package/dist/static/svg/403.svg +22 -0
- package/dist/static/svg/Apple.svg +4 -0
- package/dist/static/svg/Facebook.svg +9 -0
- package/dist/static/svg/Google.svg +14 -0
- package/dist/static/svg/TikTok.svg +9 -0
- package/dist/static/svg/Up_down.svg +1 -0
- package/dist/static/svg/add.svg +1 -0
- package/dist/static/svg/batchupload.svg +1 -0
- package/dist/static/svg/close.svg +1 -0
- package/dist/static/svg/data_increase.svg +15 -0
- package/dist/static/svg/data_no_change.svg +1 -0
- package/dist/static/svg/data_reduction.svg +15 -0
- package/dist/static/svg/drag_sort.svg +1 -0
- package/dist/static/svg/error.svg +8 -0
- package/dist/static/svg/export.svg +1 -0
- package/dist/static/svg/folder.svg +36 -0
- package/dist/static/svg/open_down.svg +1 -0
- package/dist/static/svg/open_right.svg +8 -0
- package/dist/static/svg/plus.svg +3 -0
- package/dist/static/svg/search.svg +1 -0
- package/dist/static/svg/selected.svg +3 -0
- package/dist/static/svg/selected_transfer.svg +3 -0
- package/dist/static/svg/settings.svg +1 -0
- package/dist/static/svg/upload.svg +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Table } from "@arco-design/web-react";
|
|
3
|
+
import "react";
|
|
4
|
+
import styled_components, { css } from "styled-components";
|
|
5
|
+
const StyledIcon = styled_components.img`
|
|
6
|
+
vertical-align: middle;
|
|
7
|
+
margin-right: 2px;
|
|
8
|
+
width: 16px;
|
|
9
|
+
height: 16px;
|
|
10
|
+
`;
|
|
11
|
+
const BoldTitle = styled_components.span`
|
|
12
|
+
font-weight: bold;
|
|
13
|
+
vertical-align: middle;
|
|
14
|
+
`;
|
|
15
|
+
const ResizeTable = styled_components(Table)`
|
|
16
|
+
&.arco-table {
|
|
17
|
+
.arco-table-th:first-child,
|
|
18
|
+
.arco-table-th:last-child {
|
|
19
|
+
border-radius: 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* 修复第一列拖拽位置 */
|
|
24
|
+
/* &.arco-table {
|
|
25
|
+
.arco-table-th:first-child {
|
|
26
|
+
.resize-handle {
|
|
27
|
+
right: -2px;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
} */
|
|
31
|
+
|
|
32
|
+
.arco-table-no-data {
|
|
33
|
+
border-bottom: 1px solid #eaebed;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.arco-table-content-scroll {
|
|
37
|
+
overflow: unset;
|
|
38
|
+
|
|
39
|
+
&::before,
|
|
40
|
+
&::after {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.arco-table-content-inner {
|
|
45
|
+
overflow: unset;
|
|
46
|
+
|
|
47
|
+
.arco-table-header {
|
|
48
|
+
border-radius: 0;
|
|
49
|
+
background-color: unset;
|
|
50
|
+
scrollbar-color: inherit;
|
|
51
|
+
position: sticky;
|
|
52
|
+
top: ${(props)=>props.isFullScreen ? "64px" : "131px"};
|
|
53
|
+
z-index: 99;
|
|
54
|
+
|
|
55
|
+
.arco-table-col-has-sorter .arco-table-cell-with-sorter {
|
|
56
|
+
padding: 0;
|
|
57
|
+
cursor: pointer;
|
|
58
|
+
margin: 9px 8px;
|
|
59
|
+
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: end;
|
|
63
|
+
|
|
64
|
+
.arco-table-th-item-title {
|
|
65
|
+
width: 100%;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.arco-table-body {
|
|
71
|
+
&::-webkit-scrollbar {
|
|
72
|
+
height: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
div.arco-table-tfoot {
|
|
77
|
+
background-color: unset;
|
|
78
|
+
margin-bottom: 0 !important;
|
|
79
|
+
position: sticky;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
scrollbar-color: inherit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.arco-table-col-fixed-left-last::after {
|
|
85
|
+
box-shadow: inset 6px 0 8px -3px rgb(0 0 0 / 15%);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.arco-table-header,
|
|
91
|
+
.arco-table-body,
|
|
92
|
+
div.arco-table-tfoot {
|
|
93
|
+
th {
|
|
94
|
+
border-right: 2px solid #f4f5f7;
|
|
95
|
+
}
|
|
96
|
+
td {
|
|
97
|
+
border-right: 2px solid transparent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.arco-table-th.arco-table-col-sorted {
|
|
102
|
+
background-color: #e6e6e9 !important;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.arco-table-td.arco-table-col-sorted:not(:first-child) {
|
|
106
|
+
background-color: rgba(237, 237, 240, 0.5) !important;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.arco-table-cell {
|
|
110
|
+
cursor: pointer;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.arco-table-th {
|
|
114
|
+
position: sticky;
|
|
115
|
+
.arco-table-th-item {
|
|
116
|
+
&.arco-table-col-has-sorter,
|
|
117
|
+
&.arco-table-col-sorted {
|
|
118
|
+
position: static;
|
|
119
|
+
height: 100%;
|
|
120
|
+
.arco-table-th-item-title {
|
|
121
|
+
padding-bottom: 8px;
|
|
122
|
+
}
|
|
123
|
+
.arco-table-cell-with-sorter {
|
|
124
|
+
height: 100%;
|
|
125
|
+
margin-right: 10px !important;
|
|
126
|
+
}
|
|
127
|
+
.arco-table-sorter {
|
|
128
|
+
margin: 0;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.arco-table-body {
|
|
135
|
+
max-height: calc(100vh - 260px);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.arco-table-cell-wrap-value div {
|
|
139
|
+
padding: 9px 8px;
|
|
140
|
+
}
|
|
141
|
+
/* 周末行加粗样式 */
|
|
142
|
+
.performance-table-weekend-row {
|
|
143
|
+
font-weight: bold;
|
|
144
|
+
|
|
145
|
+
.arco-table-cell {
|
|
146
|
+
font-weight: bold;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/* 周末行文本颜色样式(独立于加粗) */
|
|
151
|
+
.performance-table-weekend-text-color {
|
|
152
|
+
|
|
153
|
+
.arco-table-td:first-child {
|
|
154
|
+
.arco-table-cell {
|
|
155
|
+
color: var(--weekend-text-color, inherit);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.arco-table-td.arco-table-col-fixed-left:first-child {
|
|
161
|
+
/* 固定列的处理 */
|
|
162
|
+
&.arco-table-col-fixed-left {
|
|
163
|
+
.arco-table-cell-wrapper {
|
|
164
|
+
padding-left: 38px !important; /* 为图标留出空间:16px 图标 + 6px 间距 + 16px 原有 padding */
|
|
165
|
+
// 控制整体文本字体粗细
|
|
166
|
+
font-weight: bold;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/* 周末行图标样式 */
|
|
171
|
+
.performance-table-weekend-row-icon {
|
|
172
|
+
/* 针对日期列(第一个固定列)添加图标 */
|
|
173
|
+
.arco-table-td:first-child {
|
|
174
|
+
/* 固定列的处理 */
|
|
175
|
+
&.arco-table-col-fixed-left {
|
|
176
|
+
.arco-table-cell-wrapper {
|
|
177
|
+
position: relative;
|
|
178
|
+
// padding-left: 38px !important; /* 为图标留出空间:16px 图标 + 6px 间距 + 16px 原有 padding */
|
|
179
|
+
&::before {
|
|
180
|
+
content: "";
|
|
181
|
+
position: absolute;
|
|
182
|
+
left: 8px;
|
|
183
|
+
top: 50%;
|
|
184
|
+
transform: translateY(-50%);
|
|
185
|
+
width: 16px;
|
|
186
|
+
height: 16px;
|
|
187
|
+
background-image: var(--weekend-icon-url, none);
|
|
188
|
+
background-size: contain;
|
|
189
|
+
background-repeat: no-repeat;
|
|
190
|
+
background-position: center;
|
|
191
|
+
pointer-events: none;
|
|
192
|
+
z-index: 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* 非固定列的处理 */
|
|
198
|
+
&:not(.arco-table-col-fixed-left) {
|
|
199
|
+
.arco-table-cell {
|
|
200
|
+
position: relative;
|
|
201
|
+
padding-left: 38px !important; /* 为图标留出空间:16px 图标 + 6px 间距 + 16px 原有 padding */
|
|
202
|
+
|
|
203
|
+
&::before {
|
|
204
|
+
content: "";
|
|
205
|
+
position: absolute;
|
|
206
|
+
left: 16px;
|
|
207
|
+
top: 50%;
|
|
208
|
+
transform: translateY(-50%);
|
|
209
|
+
width: 16px;
|
|
210
|
+
height: 16px;
|
|
211
|
+
background-image: var(--weekend-icon-url, none);
|
|
212
|
+
background-size: contain;
|
|
213
|
+
background-repeat: no-repeat;
|
|
214
|
+
background-position: center;
|
|
215
|
+
pointer-events: none;
|
|
216
|
+
z-index: 1;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* 周末行背景纹理样式 */
|
|
224
|
+
.performance-table-weekend-row-pattern {
|
|
225
|
+
// background-color: #fff;
|
|
226
|
+
|
|
227
|
+
.arco-table-td.arco-table-col-fixed-left
|
|
228
|
+
{
|
|
229
|
+
|
|
230
|
+
&:hover {
|
|
231
|
+
&::before {
|
|
232
|
+
content: "";
|
|
233
|
+
position: absolute;
|
|
234
|
+
top: 0;
|
|
235
|
+
left: 0;
|
|
236
|
+
right: 0;
|
|
237
|
+
bottom: 0;
|
|
238
|
+
background-image: repeating-linear-gradient(
|
|
239
|
+
-45deg,
|
|
240
|
+
transparent,
|
|
241
|
+
transparent 2px,
|
|
242
|
+
rgba(0, 0, 0, 0.06) 2px,
|
|
243
|
+
rgba(0, 0, 0, 0.06) 4px
|
|
244
|
+
);
|
|
245
|
+
pointer-events: none;
|
|
246
|
+
z-index: -1;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
background-color: var(--color-fill-1);
|
|
251
|
+
&::before {
|
|
252
|
+
content: "";
|
|
253
|
+
position: absolute;
|
|
254
|
+
top: 0;
|
|
255
|
+
left: 0;
|
|
256
|
+
right: 0;
|
|
257
|
+
bottom: 0;
|
|
258
|
+
background-image: repeating-linear-gradient(
|
|
259
|
+
-45deg,
|
|
260
|
+
transparent,
|
|
261
|
+
transparent 2px,
|
|
262
|
+
rgba(0, 0, 0, 0.08) 2px,
|
|
263
|
+
rgba(0, 0, 0, 0.08) 4px
|
|
264
|
+
);
|
|
265
|
+
pointer-events: none;
|
|
266
|
+
z-index: -1;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
> * {
|
|
270
|
+
position: relative;
|
|
271
|
+
z-index: 1;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
.arco-table-td:not(.arco-table-col-fixed-left) {
|
|
277
|
+
.arco-table-cell-wrap-value div {
|
|
278
|
+
position: relative;
|
|
279
|
+
&::before {
|
|
280
|
+
content: "";
|
|
281
|
+
position: absolute;
|
|
282
|
+
top: 0;
|
|
283
|
+
left: 0;
|
|
284
|
+
right: 0;
|
|
285
|
+
bottom: 0;
|
|
286
|
+
background-image: repeating-linear-gradient(
|
|
287
|
+
-45deg,
|
|
288
|
+
transparent,
|
|
289
|
+
transparent 2px,
|
|
290
|
+
rgba(0, 0, 0, 0.08) 2px,
|
|
291
|
+
rgba(0, 0, 0, 0.08) 4px
|
|
292
|
+
);
|
|
293
|
+
pointer-events: none;
|
|
294
|
+
background-color: rgba(0, 0, 0, 0.03) !important;
|
|
295
|
+
z-index: 0;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
> * {
|
|
299
|
+
position: relative;
|
|
300
|
+
z-index: 1;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* 针对固定列的特殊处理 */
|
|
307
|
+
&.arco-table-col-fixed-left {
|
|
308
|
+
.arco-table-cell-wrapper {
|
|
309
|
+
position: relative;
|
|
310
|
+
|
|
311
|
+
&::before {
|
|
312
|
+
content: "";
|
|
313
|
+
position: absolute;
|
|
314
|
+
top: 0;
|
|
315
|
+
left: 0;
|
|
316
|
+
right: 0;
|
|
317
|
+
bottom: 0;
|
|
318
|
+
background-image: repeating-linear-gradient(
|
|
319
|
+
-45deg,
|
|
320
|
+
transparent,
|
|
321
|
+
transparent 6px,
|
|
322
|
+
rgba(0, 0, 0, 0.12) 6px,
|
|
323
|
+
rgba(0, 0, 0, 0.12) 12px
|
|
324
|
+
);
|
|
325
|
+
pointer-events: none;
|
|
326
|
+
z-index: 0;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
> * {
|
|
330
|
+
position: relative;
|
|
331
|
+
z-index: 1;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.arco-table-cell-indent + .arco-table-cell-wrap-value {
|
|
338
|
+
float: unset;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
${(props)=>props.resizingIndex && props.resizingIndex > 0 && css`
|
|
342
|
+
.arco-table-header,
|
|
343
|
+
.arco-table-body,
|
|
344
|
+
div.arco-table-tfoot {
|
|
345
|
+
cursor: col-resize;
|
|
346
|
+
|
|
347
|
+
th:nth-child(${props.resizingIndex}) {
|
|
348
|
+
.resize-handle {
|
|
349
|
+
background-color: var(--primary-color);
|
|
350
|
+
}
|
|
351
|
+
border-right: 2px solid var(--primary-color);
|
|
352
|
+
}
|
|
353
|
+
td:nth-child(${props.resizingIndex}) {
|
|
354
|
+
border-right: 2px solid var(--primary-color);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
`}
|
|
358
|
+
`;
|
|
359
|
+
const StyledTd = styled_components.td`
|
|
360
|
+
.arco-table-cell {
|
|
361
|
+
// display: -webkit-box;
|
|
362
|
+
// -webkit-box-orient: vertical;
|
|
363
|
+
// -webkit-line-clamp: 1;
|
|
364
|
+
overflow: hidden;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
&.arco-table-col-fixed-left {
|
|
368
|
+
padding: 0;
|
|
369
|
+
border-left: none !important;
|
|
370
|
+
|
|
371
|
+
.arco-table-cell-wrapper {
|
|
372
|
+
width: 100%;
|
|
373
|
+
position: sticky;
|
|
374
|
+
left: 0;
|
|
375
|
+
box-sizing: border-box;
|
|
376
|
+
// padding: 9px 8px;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
${(props)=>props.colSpan > 1 && css`
|
|
381
|
+
&.arco-table-col-fixed-left[colSpan="${props.colSpan}"] {
|
|
382
|
+
background-color: #ffffff !important;
|
|
383
|
+
|
|
384
|
+
.arco-table-cell-wrapper {
|
|
385
|
+
padding: 5px 16px;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
&::after {
|
|
389
|
+
display: none;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
`}
|
|
393
|
+
`;
|
|
394
|
+
const StyledTdComp = ({ colSpan, children, ...restProps })=>/*#__PURE__*/ jsx(StyledTd, {
|
|
395
|
+
...restProps,
|
|
396
|
+
colSpan: colSpan,
|
|
397
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
398
|
+
className: "arco-table-cell-wrapper",
|
|
399
|
+
children: children
|
|
400
|
+
})
|
|
401
|
+
});
|
|
402
|
+
export { BoldTitle, ResizeTable, StyledIcon, StyledTd, StyledTdComp };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PerformanceTableColumn } from './interface';
|
|
3
|
+
import { ResizableTitleProps } from './ResizableTitle';
|
|
4
|
+
import { ResizeTable } from './style';
|
|
5
|
+
type ResizableProps = {
|
|
6
|
+
columns: PerformanceTableColumn[];
|
|
7
|
+
th?: any;
|
|
8
|
+
compact?: boolean;
|
|
9
|
+
firstColumnAutoWidth?: boolean;
|
|
10
|
+
resizeCallback?: () => void;
|
|
11
|
+
};
|
|
12
|
+
declare function useResizable({ columns: originColumns, th, compact, firstColumnAutoWidth, resizeCallback, }: ResizableProps): {
|
|
13
|
+
columns: PerformanceTableColumn<any>[];
|
|
14
|
+
resizingIndex: number | undefined;
|
|
15
|
+
};
|
|
16
|
+
export { ResizeTable };
|
|
17
|
+
export declare const components: {
|
|
18
|
+
header: {
|
|
19
|
+
th: React.FunctionComponent<ResizableTitleProps>;
|
|
20
|
+
};
|
|
21
|
+
body: {
|
|
22
|
+
td: React.FunctionComponent<{
|
|
23
|
+
[key: string]: any;
|
|
24
|
+
colSpan: number;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
}>;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default useResizable;
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import ResizableTitle from "./ResizableTitle.js";
|
|
3
|
+
import { ResizeTable, StyledTdComp } from "./style.js";
|
|
4
|
+
function useResizable({ columns: originColumns, th, compact = false, firstColumnAutoWidth = false, resizeCallback = ()=>{} }) {
|
|
5
|
+
const [columns, setColumns] = useState(originColumns || []);
|
|
6
|
+
const [resizingIndex, setResizingIndex] = useState();
|
|
7
|
+
const resizeCallbackRef = useRef(resizeCallback);
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
resizeCallbackRef.current = resizeCallback;
|
|
10
|
+
}, [
|
|
11
|
+
resizeCallback
|
|
12
|
+
]);
|
|
13
|
+
const prevOriginColumnsRef = useRef(originColumns);
|
|
14
|
+
const handleResize = useCallback((index)=>(e, { size })=>{
|
|
15
|
+
if (0 === index) resizeCallbackRef.current?.();
|
|
16
|
+
setColumns((prevColumns)=>{
|
|
17
|
+
const nextColumns = [
|
|
18
|
+
...prevColumns
|
|
19
|
+
];
|
|
20
|
+
nextColumns[index] = {
|
|
21
|
+
...nextColumns[index],
|
|
22
|
+
width: size.width,
|
|
23
|
+
adjusted: true
|
|
24
|
+
};
|
|
25
|
+
return nextColumns;
|
|
26
|
+
});
|
|
27
|
+
}, []);
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
if (!originColumns || 0 === originColumns.length) return;
|
|
30
|
+
if (prevOriginColumnsRef.current === originColumns) return;
|
|
31
|
+
const prevColumns = prevOriginColumnsRef.current;
|
|
32
|
+
if (prevColumns.length === originColumns.length) {
|
|
33
|
+
const hasChanged = originColumns.some((column, index)=>{
|
|
34
|
+
const prevCol = prevColumns[index];
|
|
35
|
+
if (!prevCol) return true;
|
|
36
|
+
if (column.key !== prevCol.key) return true;
|
|
37
|
+
const colDataIndex = 'string' == typeof column.dataIndex ? column.dataIndex : Array.isArray(column.dataIndex) ? column.dataIndex[0] : '';
|
|
38
|
+
const prevDataIndex = 'string' == typeof prevCol.dataIndex ? prevCol.dataIndex : Array.isArray(prevCol.dataIndex) ? prevCol.dataIndex[0] : '';
|
|
39
|
+
if (colDataIndex !== prevDataIndex) return true;
|
|
40
|
+
return false;
|
|
41
|
+
});
|
|
42
|
+
if (!hasChanged) {
|
|
43
|
+
prevOriginColumnsRef.current = originColumns;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
prevOriginColumnsRef.current = originColumns;
|
|
48
|
+
const lastIndex = originColumns.length - 1;
|
|
49
|
+
setColumns((prevColumns)=>originColumns.map((column, index)=>{
|
|
50
|
+
const isLast = lastIndex === index;
|
|
51
|
+
const { minWidth, maxWidth, ...restColumnProps } = column;
|
|
52
|
+
let width = 160;
|
|
53
|
+
let isAdjust = false;
|
|
54
|
+
const existingColumn = prevColumns.find((c)=>{
|
|
55
|
+
if (c.key && column.key && c.key === column.key) return true;
|
|
56
|
+
const cDataIndex = 'string' == typeof c.dataIndex ? c.dataIndex : Array.isArray(c.dataIndex) ? c.dataIndex[0] : '';
|
|
57
|
+
const colDataIndex = 'string' == typeof column.dataIndex ? column.dataIndex : Array.isArray(column.dataIndex) ? column.dataIndex[0] : '';
|
|
58
|
+
return cDataIndex === colDataIndex && '' !== cDataIndex;
|
|
59
|
+
});
|
|
60
|
+
if (existingColumn) {
|
|
61
|
+
width = existingColumn.width || 160;
|
|
62
|
+
isAdjust = existingColumn.adjusted || false;
|
|
63
|
+
}
|
|
64
|
+
const titleWidth = column.rawTitle ? 14 * column.rawTitle.length + 32 + 16 : 0;
|
|
65
|
+
if (isAdjust) {
|
|
66
|
+
if (firstColumnAutoWidth && 0 === index) width = 'number' == typeof column.width ? column.width : 'string' == typeof column.width ? parseInt(String(column.width), 10) : width;
|
|
67
|
+
} else if (false === compact) {
|
|
68
|
+
const colWidth = 'number' == typeof column.width ? column.width : 'string' == typeof column.width ? parseInt(String(column.width), 10) : 160;
|
|
69
|
+
width = colWidth && (colWidth > titleWidth ? colWidth : titleWidth) || width;
|
|
70
|
+
} else width = 'number' == typeof column.width ? column.width : 'string' == typeof column.width ? parseInt(String(column.width), 10) : width;
|
|
71
|
+
return {
|
|
72
|
+
...restColumnProps,
|
|
73
|
+
width: 'number' == typeof width ? width : 'string' == typeof width ? parseInt(width, 10) : 160,
|
|
74
|
+
adjusted: isAdjust,
|
|
75
|
+
onHeaderCell: (col)=>({
|
|
76
|
+
disableResize: isLast || col.disableResize,
|
|
77
|
+
width: 'number' == typeof col.width ? col.width : 'string' == typeof col.width ? parseInt(String(col.width), 10) : width,
|
|
78
|
+
onResize: handleResize(index),
|
|
79
|
+
minWidth: col.minWidth || minWidth || 100,
|
|
80
|
+
maxWidth: col.maxWidth || maxWidth || 800,
|
|
81
|
+
currentIndex: index,
|
|
82
|
+
setResizingIndex,
|
|
83
|
+
th: th || 'th'
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
}));
|
|
87
|
+
}, [
|
|
88
|
+
handleResize,
|
|
89
|
+
originColumns,
|
|
90
|
+
th,
|
|
91
|
+
compact,
|
|
92
|
+
firstColumnAutoWidth
|
|
93
|
+
]);
|
|
94
|
+
return {
|
|
95
|
+
columns,
|
|
96
|
+
resizingIndex
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
const components = {
|
|
100
|
+
header: {
|
|
101
|
+
th: ResizableTitle
|
|
102
|
+
},
|
|
103
|
+
body: {
|
|
104
|
+
td: StyledTdComp
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const PerformanceTable_useResizable = useResizable;
|
|
108
|
+
export { ResizeTable, components, PerformanceTable_useResizable as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
interface Subscriber {
|
|
3
|
+
(params: {
|
|
4
|
+
distanceFromTop: number;
|
|
5
|
+
distanceFromBottom: number;
|
|
6
|
+
eventSource: HTMLElement | Window | Document;
|
|
7
|
+
}): void;
|
|
8
|
+
}
|
|
9
|
+
interface StickyContextType {
|
|
10
|
+
subscribe: (handler: Subscriber) => void;
|
|
11
|
+
unsubscribe: (handler: Subscriber) => void;
|
|
12
|
+
getParent: () => HTMLDivElement | null;
|
|
13
|
+
}
|
|
14
|
+
export declare const StickyContext: React.Context<StickyContextType | null>;
|
|
15
|
+
interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
16
|
+
scrollroot?: HTMLElement | Window;
|
|
17
|
+
}
|
|
18
|
+
declare const Container: React.FC<PropsWithChildren<ContainerProps>>;
|
|
19
|
+
export default Container;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useCallback, useEffect, useRef } from "react";
|
|
3
|
+
const StickyContext = /*#__PURE__*/ createContext(null);
|
|
4
|
+
const Container = ({ scrollroot, ...props })=>{
|
|
5
|
+
const subscribersRef = useRef([]);
|
|
6
|
+
const rafHandleRef = useRef(null);
|
|
7
|
+
const framePendingRef = useRef(false);
|
|
8
|
+
const nodeRef = useRef(null);
|
|
9
|
+
const scrollRootRef = useRef(scrollroot || window);
|
|
10
|
+
const subscribe = useCallback((handler)=>{
|
|
11
|
+
subscribersRef.current = [
|
|
12
|
+
...subscribersRef.current,
|
|
13
|
+
handler
|
|
14
|
+
];
|
|
15
|
+
}, []);
|
|
16
|
+
const unsubscribe = useCallback((handler)=>{
|
|
17
|
+
subscribersRef.current = subscribersRef.current.filter((current)=>current !== handler);
|
|
18
|
+
}, []);
|
|
19
|
+
const getParent = useCallback(()=>nodeRef.current, []);
|
|
20
|
+
const notifySubscribers = useCallback((evt)=>{
|
|
21
|
+
if (!framePendingRef.current && nodeRef.current) {
|
|
22
|
+
const currentTarget = 'currentTarget' in evt ? evt.currentTarget : scrollRootRef.current;
|
|
23
|
+
rafHandleRef.current = requestAnimationFrame(()=>{
|
|
24
|
+
framePendingRef.current = false;
|
|
25
|
+
if (!nodeRef.current) return;
|
|
26
|
+
const { top, bottom } = nodeRef.current.getBoundingClientRect();
|
|
27
|
+
subscribersRef.current.forEach((handler)=>handler({
|
|
28
|
+
distanceFromTop: top,
|
|
29
|
+
distanceFromBottom: bottom,
|
|
30
|
+
eventSource: currentTarget === scrollRootRef.current ? scrollRootRef.current === window ? document.body : scrollRootRef.current : nodeRef.current
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
framePendingRef.current = true;
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
const handleTouchStart = useCallback((evt)=>{
|
|
37
|
+
notifySubscribers(evt);
|
|
38
|
+
}, [
|
|
39
|
+
notifySubscribers
|
|
40
|
+
]);
|
|
41
|
+
const handleTouchMove = useCallback((evt)=>{
|
|
42
|
+
notifySubscribers(evt);
|
|
43
|
+
}, [
|
|
44
|
+
notifySubscribers
|
|
45
|
+
]);
|
|
46
|
+
const handleTouchEnd = useCallback((evt)=>{
|
|
47
|
+
notifySubscribers(evt);
|
|
48
|
+
}, [
|
|
49
|
+
notifySubscribers
|
|
50
|
+
]);
|
|
51
|
+
useEffect(()=>{
|
|
52
|
+
const events = [
|
|
53
|
+
"resize",
|
|
54
|
+
"scroll",
|
|
55
|
+
"touchstart",
|
|
56
|
+
"touchmove",
|
|
57
|
+
"touchend",
|
|
58
|
+
"pageshow",
|
|
59
|
+
"load"
|
|
60
|
+
];
|
|
61
|
+
const handleGlobalEvent = (evt)=>{
|
|
62
|
+
notifySubscribers(evt);
|
|
63
|
+
};
|
|
64
|
+
events.forEach((event)=>scrollRootRef.current.addEventListener(event, handleGlobalEvent));
|
|
65
|
+
return ()=>{
|
|
66
|
+
if (rafHandleRef.current) {
|
|
67
|
+
cancelAnimationFrame(rafHandleRef.current);
|
|
68
|
+
rafHandleRef.current = null;
|
|
69
|
+
}
|
|
70
|
+
events.forEach((event)=>scrollRootRef.current.removeEventListener(event, handleGlobalEvent));
|
|
71
|
+
};
|
|
72
|
+
}, [
|
|
73
|
+
notifySubscribers
|
|
74
|
+
]);
|
|
75
|
+
const contextValue = {
|
|
76
|
+
subscribe,
|
|
77
|
+
unsubscribe,
|
|
78
|
+
getParent
|
|
79
|
+
};
|
|
80
|
+
return /*#__PURE__*/ jsx(StickyContext.Provider, {
|
|
81
|
+
value: contextValue,
|
|
82
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
83
|
+
...props,
|
|
84
|
+
ref: nodeRef,
|
|
85
|
+
onScroll: notifySubscribers,
|
|
86
|
+
onTouchStart: handleTouchStart,
|
|
87
|
+
onTouchMove: handleTouchMove,
|
|
88
|
+
onTouchEnd: handleTouchEnd
|
|
89
|
+
})
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
const ReactSticky_Container = Container;
|
|
93
|
+
export { StickyContext, ReactSticky_Container as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface StickyChildArgs {
|
|
3
|
+
style: React.CSSProperties;
|
|
4
|
+
isSticky: boolean;
|
|
5
|
+
wasSticky: boolean;
|
|
6
|
+
distanceFromTop: number;
|
|
7
|
+
distanceFromBottom: number;
|
|
8
|
+
calculatedHeight: number;
|
|
9
|
+
}
|
|
10
|
+
interface StickyProps {
|
|
11
|
+
children: (args: StickyChildArgs) => React.ReactElement;
|
|
12
|
+
relative?: boolean;
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
className?: string;
|
|
15
|
+
style?: any;
|
|
16
|
+
stickyClassName?: string;
|
|
17
|
+
stickyStyle?: any;
|
|
18
|
+
topOffset?: number;
|
|
19
|
+
bottomOffset?: number;
|
|
20
|
+
onStickyStateChange?: (isSticky: boolean) => void;
|
|
21
|
+
disableCompensation?: boolean;
|
|
22
|
+
disableHardwareAcceleration?: boolean;
|
|
23
|
+
isSider?: boolean;
|
|
24
|
+
getCalculatedHeight?: (height: number) => void;
|
|
25
|
+
}
|
|
26
|
+
declare const Sticky: React.FC<StickyProps>;
|
|
27
|
+
export default Sticky;
|