@kne/table-page 0.1.1 → 0.1.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 +286 -153
- package/dist/index.css +68 -7
- package/dist/index.css.map +1 -1
- package/dist/index.js +231 -82
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +236 -90
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { withFetch } from '@kne/react-fetch';
|
|
2
|
-
import { Typography, Tooltip, Tag, Space, Checkbox, Row, Col, Input, List, Button, Collapse, Popover, Empty, Table as Table$1, Dropdown, Pagination } from 'antd';
|
|
2
|
+
import { Typography, Tooltip, Tag, Space, Badge, Checkbox, Row, Col, Input, List, Button, Collapse, Popover, Empty, Table as Table$1, Dropdown, Pagination } from 'antd';
|
|
3
3
|
import { FilterProvider, FilterLines, SearchInput, FilterValueDisplay, getFilterValue } from '@kne/react-filter';
|
|
4
4
|
import { useState, useCallback, useMemo, useRef, useEffect, useLayoutEffect, forwardRef } from 'react';
|
|
5
5
|
import classnames from 'classnames';
|
|
@@ -215,14 +215,15 @@ const formatView = (value, format, context) => {
|
|
|
215
215
|
const globalParams = {
|
|
216
216
|
renderType: null,
|
|
217
217
|
renderTypeSize: {},
|
|
218
|
-
tagTypeColors: {}
|
|
218
|
+
tagTypeColors: {},
|
|
219
|
+
statusTypeColors: {}
|
|
219
220
|
};
|
|
220
221
|
|
|
221
222
|
const defaultRender = value => value;
|
|
222
223
|
|
|
223
224
|
var ellipsisStyle = {"ellipsis":"kne-table-page_mMMw1","tooltip":"kne-table-page_CkWQu","cell-content":"kne-table-page_OXmYu","cell-full-width":"kne-table-page_jN-vq"};
|
|
224
225
|
|
|
225
|
-
const _excluded$
|
|
226
|
+
const _excluded$8 = ["showTitle"];
|
|
226
227
|
const Ellipsis = ({
|
|
227
228
|
children,
|
|
228
229
|
ellipsis
|
|
@@ -234,7 +235,7 @@ const Ellipsis = ({
|
|
|
234
235
|
const {
|
|
235
236
|
showTitle
|
|
236
237
|
} = userConfig,
|
|
237
|
-
rest = _objectWithoutPropertiesLoose(userConfig, _excluded$
|
|
238
|
+
rest = _objectWithoutPropertiesLoose(userConfig, _excluded$8);
|
|
238
239
|
return /*#__PURE__*/jsx(Typography.Text, {
|
|
239
240
|
className: ellipsisStyle['ellipsis'],
|
|
240
241
|
ellipsis: Object.assign({}, {
|
|
@@ -246,19 +247,22 @@ const Ellipsis = ({
|
|
|
246
247
|
});
|
|
247
248
|
};
|
|
248
249
|
|
|
249
|
-
var style$
|
|
250
|
+
var style$8 = {"text":"kne-table-page_5N2-a","ellipsis":"kne-table-page_Lkl3D","hover":"kne-table-page_RnF6d","primary":"kne-table-page_g-Sky","clickable":"kne-table-page_vPcDo","loading":"kne-table-page_FeQ09"};
|
|
250
251
|
|
|
251
|
-
const
|
|
252
|
+
const MainCell = ({
|
|
253
|
+
value,
|
|
252
254
|
column,
|
|
253
255
|
dataSource
|
|
254
|
-
}
|
|
256
|
+
}) => {
|
|
255
257
|
const {
|
|
256
258
|
ellipsis = true,
|
|
257
259
|
hover = true,
|
|
258
260
|
primary = true,
|
|
259
261
|
onClick
|
|
260
262
|
} = column || {};
|
|
261
|
-
|
|
263
|
+
const [loading, setLoading] = useState(false);
|
|
264
|
+
const isClickable = Boolean(hover || primary || onClick);
|
|
265
|
+
if (!isClickable) {
|
|
262
266
|
return /*#__PURE__*/jsx(Ellipsis, {
|
|
263
267
|
ellipsis: ellipsis,
|
|
264
268
|
children: value
|
|
@@ -266,16 +270,27 @@ const main = (value, {
|
|
|
266
270
|
}
|
|
267
271
|
const ellipsisConfig = typeof ellipsis === 'object' ? ellipsis : {};
|
|
268
272
|
const showTooltip = ellipsis && ellipsisConfig.showTitle !== false;
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
onClick
|
|
273
|
+
const handleClick = onClick ? e => {
|
|
274
|
+
if (loading) {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
setLoading(true);
|
|
278
|
+
Promise.resolve(onClick({
|
|
275
279
|
item: value,
|
|
276
280
|
colItem: dataSource,
|
|
277
281
|
event: e
|
|
278
|
-
})
|
|
282
|
+
})).finally(() => {
|
|
283
|
+
setLoading(false);
|
|
284
|
+
});
|
|
285
|
+
} : undefined;
|
|
286
|
+
const text = /*#__PURE__*/jsx("span", {
|
|
287
|
+
className: classnames(style$8['text'], ellipsis && style$8['ellipsis'], {
|
|
288
|
+
[style$8['hover']]: hover,
|
|
289
|
+
[style$8['primary']]: primary,
|
|
290
|
+
[style$8['clickable']]: Boolean(onClick),
|
|
291
|
+
[style$8['loading']]: loading
|
|
292
|
+
}),
|
|
293
|
+
onClick: handleClick,
|
|
279
294
|
children: value
|
|
280
295
|
});
|
|
281
296
|
if (!showTooltip) {
|
|
@@ -287,8 +302,16 @@ const main = (value, {
|
|
|
287
302
|
children: text
|
|
288
303
|
});
|
|
289
304
|
};
|
|
305
|
+
const main = (value, {
|
|
306
|
+
column,
|
|
307
|
+
dataSource
|
|
308
|
+
} = {}) => /*#__PURE__*/jsx(MainCell, {
|
|
309
|
+
value: value,
|
|
310
|
+
column: column,
|
|
311
|
+
dataSource: dataSource
|
|
312
|
+
});
|
|
290
313
|
|
|
291
|
-
var style$
|
|
314
|
+
var style$7 = {"amount":"kne-table-page_AH-3R"};
|
|
292
315
|
|
|
293
316
|
const amount = (value, {
|
|
294
317
|
column
|
|
@@ -297,7 +320,7 @@ const amount = (value, {
|
|
|
297
320
|
ellipsis = true
|
|
298
321
|
} = column || {};
|
|
299
322
|
return /*#__PURE__*/jsx("span", {
|
|
300
|
-
className: style$
|
|
323
|
+
className: style$7['amount'],
|
|
301
324
|
children: /*#__PURE__*/jsx(Ellipsis, {
|
|
302
325
|
ellipsis: ellipsis,
|
|
303
326
|
children: value
|
|
@@ -305,7 +328,7 @@ const amount = (value, {
|
|
|
305
328
|
});
|
|
306
329
|
};
|
|
307
330
|
|
|
308
|
-
const _excluded$
|
|
331
|
+
const _excluded$7 = ["text", "type", "color", "children"];
|
|
309
332
|
const DEFAULT_TAG_TYPE_COLORS = {
|
|
310
333
|
default: 'default',
|
|
311
334
|
success: 'success',
|
|
@@ -360,7 +383,7 @@ const renderTagItem = (item, key) => {
|
|
|
360
383
|
color,
|
|
361
384
|
children
|
|
362
385
|
} = tag,
|
|
363
|
-
rest = _objectWithoutPropertiesLoose(tag, _excluded$
|
|
386
|
+
rest = _objectWithoutPropertiesLoose(tag, _excluded$7);
|
|
364
387
|
return /*#__PURE__*/jsx(Tag, _extends({
|
|
365
388
|
color: color != null ? color : getTagColor(type)
|
|
366
389
|
}, rest, {
|
|
@@ -382,6 +405,73 @@ const tag = value => renderTagItem(value);
|
|
|
382
405
|
|
|
383
406
|
const tagList = value => renderTagList(value);
|
|
384
407
|
|
|
408
|
+
const _excluded$6 = ["text", "type", "status", "color", "children"];
|
|
409
|
+
const DEFAULT_STATUS_TYPE_MAP = {
|
|
410
|
+
default: 'default',
|
|
411
|
+
success: 'success',
|
|
412
|
+
progress: 'processing',
|
|
413
|
+
processing: 'processing',
|
|
414
|
+
danger: 'error',
|
|
415
|
+
error: 'error',
|
|
416
|
+
warning: 'warning',
|
|
417
|
+
info: 'processing',
|
|
418
|
+
other: 'default',
|
|
419
|
+
active: 'success',
|
|
420
|
+
vacation: 'warning',
|
|
421
|
+
resigned: 'default',
|
|
422
|
+
probation: 'processing',
|
|
423
|
+
completed: 'success',
|
|
424
|
+
pending: 'warning',
|
|
425
|
+
shipped: 'processing',
|
|
426
|
+
paid: 'success',
|
|
427
|
+
cancelled: 'error'
|
|
428
|
+
};
|
|
429
|
+
const getStatusType = type => {
|
|
430
|
+
if (!type) {
|
|
431
|
+
return 'default';
|
|
432
|
+
}
|
|
433
|
+
const customTypes = globalParams.statusTypeColors || {};
|
|
434
|
+
return customTypes[type] || DEFAULT_STATUS_TYPE_MAP[type] || type;
|
|
435
|
+
};
|
|
436
|
+
const normalizeStatusItem = item => {
|
|
437
|
+
if (item == null) {
|
|
438
|
+
return null;
|
|
439
|
+
}
|
|
440
|
+
if (typeof item === 'string' || typeof item === 'number') {
|
|
441
|
+
return {
|
|
442
|
+
text: String(item)
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
if (typeof item === 'object') {
|
|
446
|
+
var _ref, _item$text;
|
|
447
|
+
return Object.assign({}, item, {
|
|
448
|
+
text: (_ref = (_item$text = item.text) != null ? _item$text : item.children) != null ? _ref : item.label
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
return null;
|
|
452
|
+
};
|
|
453
|
+
const renderStatusItem = item => {
|
|
454
|
+
var _ref2;
|
|
455
|
+
const statusItem = normalizeStatusItem(item);
|
|
456
|
+
if (!statusItem || statusItem.text == null) {
|
|
457
|
+
return null;
|
|
458
|
+
}
|
|
459
|
+
const {
|
|
460
|
+
text,
|
|
461
|
+
type,
|
|
462
|
+
status,
|
|
463
|
+
color,
|
|
464
|
+
children
|
|
465
|
+
} = statusItem,
|
|
466
|
+
rest = _objectWithoutPropertiesLoose(statusItem, _excluded$6);
|
|
467
|
+
return /*#__PURE__*/jsx(Badge, _extends({
|
|
468
|
+
status: (_ref2 = status != null ? status : color) != null ? _ref2 : getStatusType(type),
|
|
469
|
+
text: children != null ? children : text
|
|
470
|
+
}, rest));
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const status = value => renderStatusItem(value);
|
|
474
|
+
|
|
385
475
|
const DEFAULT_SPLIT = ',';
|
|
386
476
|
const normalizeListValue = value => {
|
|
387
477
|
if (Array.isArray(value)) {
|
|
@@ -551,10 +641,10 @@ const getColumnLayout = (column, {
|
|
|
551
641
|
};
|
|
552
642
|
};
|
|
553
643
|
|
|
554
|
-
var style$
|
|
644
|
+
var style$6 = {"col-item":"kne-table-page_nL1tj","options":"kne-table-page_EwzO-","options-column":"kne-table-page_im2Lc","options-btn":"kne-table-page_SJxZl"};
|
|
555
645
|
|
|
556
646
|
const _excluded$5 = ["children", "label", "text", "className"],
|
|
557
|
-
_excluded2$
|
|
647
|
+
_excluded2$3 = ["list"];
|
|
558
648
|
const normalizeOptionItem = (item, buttonClassName) => {
|
|
559
649
|
var _ref;
|
|
560
650
|
if (item == null) {
|
|
@@ -593,22 +683,22 @@ const options = (value, {
|
|
|
593
683
|
const {
|
|
594
684
|
list: valueList
|
|
595
685
|
} = value,
|
|
596
|
-
rest = _objectWithoutPropertiesLoose(value, _excluded2$
|
|
686
|
+
rest = _objectWithoutPropertiesLoose(value, _excluded2$3);
|
|
597
687
|
list = valueList;
|
|
598
688
|
buttonGroupProps = _extends({}, buttonGroupProps, rest);
|
|
599
689
|
}
|
|
600
690
|
if (!Array.isArray(list) || list.length === 0) {
|
|
601
691
|
return null;
|
|
602
692
|
}
|
|
603
|
-
const wrapperClassName = classnames(style$
|
|
604
|
-
const buttonClassName = classnames(wrapperClassName, style$
|
|
693
|
+
const wrapperClassName = classnames(style$6['col-item'], style$6['options']);
|
|
694
|
+
const buttonClassName = classnames(wrapperClassName, style$6['options-btn']);
|
|
605
695
|
const normalizedList = list.map(item => normalizeOptionItem(item, buttonClassName)).filter(item => item != null && !item.hidden);
|
|
606
696
|
if (normalizedList.length === 0) {
|
|
607
697
|
return null;
|
|
608
698
|
}
|
|
609
699
|
const width = parseColumnWidth(column == null ? void 0 : column.width);
|
|
610
700
|
return /*#__PURE__*/jsx("div", {
|
|
611
|
-
className: classnames(wrapperClassName, style$
|
|
701
|
+
className: classnames(wrapperClassName, style$6['options-column']),
|
|
612
702
|
style: width > 0 ? {
|
|
613
703
|
'--max-width': `${width}px`
|
|
614
704
|
} : undefined,
|
|
@@ -630,6 +720,7 @@ const renderType = {
|
|
|
630
720
|
amount,
|
|
631
721
|
tag,
|
|
632
722
|
tagList,
|
|
723
|
+
status,
|
|
633
724
|
list,
|
|
634
725
|
options,
|
|
635
726
|
enum: enumRender,
|
|
@@ -667,6 +758,11 @@ const typeSize = {
|
|
|
667
758
|
min: 100,
|
|
668
759
|
max: 400
|
|
669
760
|
},
|
|
761
|
+
status: {
|
|
762
|
+
width: 100,
|
|
763
|
+
min: 80,
|
|
764
|
+
max: 140
|
|
765
|
+
},
|
|
670
766
|
tagList: {
|
|
671
767
|
width: 300,
|
|
672
768
|
min: 160,
|
|
@@ -985,9 +1081,9 @@ const computeColumnsDisplay = ({
|
|
|
985
1081
|
computeColumnsValue.computeDisplay = computeDisplay;
|
|
986
1082
|
computeColumnsValue.computeColumnsDisplay = computeColumnsDisplay;
|
|
987
1083
|
|
|
988
|
-
var style$
|
|
1084
|
+
var style$5 = {"table":"kne-table-page_lZgIW","tableView":"kne-table-page_fUw6j","grid":"kne-table-page_JlDmf","header-cell":"kne-table-page_P-ebv","col-content":"kne-table-page_HT5Rr","body-row":"kne-table-page_Z6mVv","col":"kne-table-page_KNy4z","body-cell":"kne-table-page_BSOzz","body":"kne-table-page_9qon1","is-selected-all":"kne-table-page_f2i1e","is-selected":"kne-table-page_n3V6m","is-disabled":"kne-table-page_AfmkR","col-width-based":"kne-table-page_ZvnDi","col-width-fill":"kne-table-page_cV7PE","single-checked":"kne-table-page_9UAoL","col-fixed":"kne-table-page_aB-1c","empty":"kne-table-page_SRI8Q"};
|
|
989
1085
|
|
|
990
|
-
var style$
|
|
1086
|
+
var style$4 = {"table":"kne-table-page_awa1L","is-selected-all":"kne-table-page_692q3","is-selected":"kne-table-page_IWgjl","is-disabled":"kne-table-page_YUG4k","has-summary":"kne-table-page_Cb-du","has-group-header":"kne-table-page_7qTC5","is-sticky":"kne-table-page_jGzIR","is-sticky-scroll-y":"kne-table-page_P6lxG","is-sticky-viewport":"kne-table-page_Kr-p6","table-cell":"kne-table-page_HPmr3","selection-col":"kne-table-page_D7YhS","radio-col":"kne-table-page_df9z3","is-computed":"kne-table-page_ZA1Je","is-resize":"kne-table-page_CA0uL","column-resize-guide":"kne-table-page_JARA2"};
|
|
991
1087
|
|
|
992
1088
|
const useSelectedRow = options => {
|
|
993
1089
|
const {
|
|
@@ -1066,7 +1162,26 @@ const useSelectedRow = options => {
|
|
|
1066
1162
|
};
|
|
1067
1163
|
};
|
|
1068
1164
|
|
|
1069
|
-
var style$
|
|
1165
|
+
var style$3 = {"title":"kne-table-page_Yn7Wc","title-text":"kne-table-page_QhSty","has-sort":"kne-table-page_YaVIX","sort-btn":"kne-table-page_XkYCi","sort-icon":"kne-table-page_SSGYi","active":"kne-table-page_VT0uN","sort-up":"kne-table-page_CIokw","sort-down":"kne-table-page_5xrlc"};
|
|
1166
|
+
|
|
1167
|
+
var style$2 = {"ellipsis":"kne-table-page_QBxlu"};
|
|
1168
|
+
|
|
1169
|
+
const isSimpleTitle = title => typeof title === 'string' || typeof title === 'number';
|
|
1170
|
+
const wrapColumnHeaderTitle = title => {
|
|
1171
|
+
if (title == null || title === '') {
|
|
1172
|
+
return title;
|
|
1173
|
+
}
|
|
1174
|
+
if (isSimpleTitle(title)) {
|
|
1175
|
+
return /*#__PURE__*/jsx(Ellipsis, {
|
|
1176
|
+
ellipsis: true,
|
|
1177
|
+
children: title
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
return /*#__PURE__*/jsx("span", {
|
|
1181
|
+
className: style$2['ellipsis'],
|
|
1182
|
+
children: title
|
|
1183
|
+
});
|
|
1184
|
+
};
|
|
1070
1185
|
|
|
1071
1186
|
const sortArrayToMap = sort => new Map((sort || []).map(item => {
|
|
1072
1187
|
return [item.name, item.sort];
|
|
@@ -1141,21 +1256,22 @@ const getSortSingle = sortOption => {
|
|
|
1141
1256
|
return true;
|
|
1142
1257
|
};
|
|
1143
1258
|
const renderColumnTitle = (title, column, sortRender) => {
|
|
1259
|
+
const titleContent = wrapColumnHeaderTitle(title);
|
|
1144
1260
|
if (!column.sort || typeof sortRender !== 'function') {
|
|
1145
|
-
return
|
|
1261
|
+
return titleContent;
|
|
1146
1262
|
}
|
|
1147
1263
|
return /*#__PURE__*/jsxs("span", {
|
|
1148
|
-
className: classnames(style$
|
|
1264
|
+
className: classnames(style$3['title'], style$3['has-sort']),
|
|
1149
1265
|
children: [/*#__PURE__*/jsx("span", {
|
|
1150
|
-
className: style$
|
|
1151
|
-
children:
|
|
1266
|
+
className: style$3['title-text'],
|
|
1267
|
+
children: titleContent
|
|
1152
1268
|
}), sortRender({
|
|
1153
1269
|
name: column.name,
|
|
1154
1270
|
single: getSortSingle(column.sort)
|
|
1155
1271
|
})]
|
|
1156
1272
|
});
|
|
1157
1273
|
};
|
|
1158
|
-
const useSort = props => {
|
|
1274
|
+
const useSort = (props = {}) => {
|
|
1159
1275
|
const [sort, setSort] = useControlValue({
|
|
1160
1276
|
value: props.sort,
|
|
1161
1277
|
defaultValue: props.defaultSort || [],
|
|
@@ -1179,7 +1295,7 @@ const useSort = props => {
|
|
|
1179
1295
|
}) => {
|
|
1180
1296
|
const direction = mapSort.get(name);
|
|
1181
1297
|
return /*#__PURE__*/jsxs("span", {
|
|
1182
|
-
className: style$
|
|
1298
|
+
className: style$3['sort-btn'],
|
|
1183
1299
|
onClick: e => {
|
|
1184
1300
|
e.stopPropagation();
|
|
1185
1301
|
setMapSort(sortMap => {
|
|
@@ -1202,12 +1318,12 @@ const useSort = props => {
|
|
|
1202
1318
|
});
|
|
1203
1319
|
},
|
|
1204
1320
|
children: [/*#__PURE__*/jsx(CaretUpOutlined, {
|
|
1205
|
-
className: classnames(style$
|
|
1206
|
-
[style$
|
|
1321
|
+
className: classnames(style$3['sort-icon'], style$3['sort-up'], {
|
|
1322
|
+
[style$3['active']]: direction === 'ASC'
|
|
1207
1323
|
})
|
|
1208
1324
|
}), /*#__PURE__*/jsx(CaretDownOutlined, {
|
|
1209
|
-
className: classnames(style$
|
|
1210
|
-
[style$
|
|
1325
|
+
className: classnames(style$3['sort-icon'], style$3['sort-down'], {
|
|
1326
|
+
[style$3['active']]: direction === 'DESC'
|
|
1211
1327
|
})
|
|
1212
1328
|
})]
|
|
1213
1329
|
});
|
|
@@ -1918,7 +2034,8 @@ const getColumnEllipsis = column => {
|
|
|
1918
2034
|
return typeof column.ellipsis === 'object' ? column.ellipsis : true;
|
|
1919
2035
|
};
|
|
1920
2036
|
|
|
1921
|
-
const _excluded$3 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "headerStyle", "pagination", "sortRender", "name", "controllerOpen", "tableServerApis", "scroll", "summary"]
|
|
2037
|
+
const _excluded$3 = ["className", "dataSource", "columns", "rowKey", "rowSelection", "valueIsEmpty", "emptyIsPlaceholder", "placeholder", "empty", "onRowSelect", "render", "context", "sticky", "stickyOffset", "getStickyContainer", "headerStyle", "pagination", "sortRender", "name", "controllerOpen", "tableServerApis", "scroll", "summary"],
|
|
2038
|
+
_excluded2$2 = ["getContainer"];
|
|
1922
2039
|
const mapJustifyToAlign = justify => {
|
|
1923
2040
|
if (justify === 'center') {
|
|
1924
2041
|
return 'center';
|
|
@@ -1952,9 +2069,9 @@ const getColCellStyle = column => ({
|
|
|
1952
2069
|
textAlign: mapJustifyToAlign(column.justify),
|
|
1953
2070
|
verticalAlign: column.align === 'middle' ? 'middle' : column.align === 'bottom' ? 'bottom' : 'top'
|
|
1954
2071
|
});
|
|
1955
|
-
const getAntCellClassName = (...extra) => classnames(style$
|
|
2072
|
+
const getAntCellClassName = (...extra) => classnames(style$4['table-cell'], 'info-page-table-col', ...extra);
|
|
1956
2073
|
const wrapColContent = node => /*#__PURE__*/jsx("span", {
|
|
1957
|
-
className: style$
|
|
2074
|
+
className: style$5['col-content'],
|
|
1958
2075
|
children: node
|
|
1959
2076
|
});
|
|
1960
2077
|
const Table = p => {
|
|
@@ -1983,6 +2100,8 @@ const Table = p => {
|
|
|
1983
2100
|
render,
|
|
1984
2101
|
context,
|
|
1985
2102
|
sticky,
|
|
2103
|
+
stickyOffset,
|
|
2104
|
+
getStickyContainer,
|
|
1986
2105
|
headerStyle,
|
|
1987
2106
|
pagination = false,
|
|
1988
2107
|
sortRender,
|
|
@@ -2081,7 +2200,7 @@ const Table = p => {
|
|
|
2081
2200
|
key: colName,
|
|
2082
2201
|
dataIndex: colName,
|
|
2083
2202
|
title: /*#__PURE__*/jsx("span", {
|
|
2084
|
-
className: style$
|
|
2203
|
+
className: style$5['col-content'],
|
|
2085
2204
|
children: renderColumnTitle(title, column, sortRender)
|
|
2086
2205
|
}),
|
|
2087
2206
|
width: toAntdWidth(width),
|
|
@@ -2114,7 +2233,7 @@ const Table = p => {
|
|
|
2114
2233
|
placeholder,
|
|
2115
2234
|
dataSource: record,
|
|
2116
2235
|
context
|
|
2117
|
-
}), computedColumn, style$
|
|
2236
|
+
}), computedColumn, style$5['col-content']);
|
|
2118
2237
|
}
|
|
2119
2238
|
};
|
|
2120
2239
|
if (!controllerOpen) {
|
|
@@ -2122,7 +2241,7 @@ const Table = p => {
|
|
|
2122
2241
|
}
|
|
2123
2242
|
const configProps = computedColumnProps(column, index, {
|
|
2124
2243
|
title: /*#__PURE__*/jsx("span", {
|
|
2125
|
-
className: style$
|
|
2244
|
+
className: style$5['col-content'],
|
|
2126
2245
|
children: renderColumnTitle(title, column, sortRender)
|
|
2127
2246
|
})
|
|
2128
2247
|
});
|
|
@@ -2145,8 +2264,8 @@ const Table = p => {
|
|
|
2145
2264
|
return {
|
|
2146
2265
|
key: column.name,
|
|
2147
2266
|
title: /*#__PURE__*/jsx("span", {
|
|
2148
|
-
className: style$
|
|
2149
|
-
children: column.title
|
|
2267
|
+
className: style$5['col-content'],
|
|
2268
|
+
children: wrapColumnHeaderTitle(column.title)
|
|
2150
2269
|
}),
|
|
2151
2270
|
onHeaderCell: () => ({
|
|
2152
2271
|
className: getAntCellClassName(),
|
|
@@ -2211,13 +2330,13 @@ const Table = p => {
|
|
|
2211
2330
|
})),
|
|
2212
2331
|
renderCell: (checked, record, index, originNode) => wrapColContent(originNode),
|
|
2213
2332
|
onCell: () => ({
|
|
2214
|
-
className: getAntCellClassName(style$
|
|
2333
|
+
className: getAntCellClassName(style$4['selection-col'])
|
|
2215
2334
|
})
|
|
2216
2335
|
} : {
|
|
2217
2336
|
columnWidth: 30,
|
|
2218
2337
|
renderCell: (checked, record, index, originNode) => wrapColContent(originNode),
|
|
2219
2338
|
onCell: () => ({
|
|
2220
|
-
className: getAntCellClassName(style$
|
|
2339
|
+
className: getAntCellClassName(style$4['radio-col'])
|
|
2221
2340
|
})
|
|
2222
2341
|
});
|
|
2223
2342
|
}, [context, dataSource, rowKey, rowSelection, hasFixedColumn]);
|
|
@@ -2232,6 +2351,32 @@ const Table = p => {
|
|
|
2232
2351
|
x
|
|
2233
2352
|
} : {}, scroll);
|
|
2234
2353
|
}, [hasFixedColumn, controllerOpen, totalWidth, tableWidth, scroll]);
|
|
2354
|
+
const hasScrollY = (scroll == null ? void 0 : scroll.y) != null && (scroll == null ? void 0 : scroll.y) !== false;
|
|
2355
|
+
const antdSticky = useMemo(() => {
|
|
2356
|
+
if (!sticky) {
|
|
2357
|
+
return undefined;
|
|
2358
|
+
}
|
|
2359
|
+
const config = typeof sticky === 'object' ? Object.assign({}, sticky) : {};
|
|
2360
|
+
if (hasScrollY) {
|
|
2361
|
+
const scrollSticky = _objectWithoutPropertiesLoose(config, _excluded2$2);
|
|
2362
|
+
return Object.assign({
|
|
2363
|
+
offsetHeader: 0
|
|
2364
|
+
}, scrollSticky);
|
|
2365
|
+
}
|
|
2366
|
+
return Object.assign({
|
|
2367
|
+
offsetHeader: 0
|
|
2368
|
+
}, config, getStickyContainer ? {
|
|
2369
|
+
getContainer: getStickyContainer
|
|
2370
|
+
} : null);
|
|
2371
|
+
}, [sticky, getStickyContainer, hasScrollY]);
|
|
2372
|
+
const tableWrapperStyle = useMemo(() => {
|
|
2373
|
+
if (!sticky || stickyOffset == null || hasScrollY) {
|
|
2374
|
+
return undefined;
|
|
2375
|
+
}
|
|
2376
|
+
return {
|
|
2377
|
+
'--sticky-offset': stickyOffset
|
|
2378
|
+
};
|
|
2379
|
+
}, [sticky, stickyOffset, hasScrollY]);
|
|
2235
2380
|
const tableElement = /*#__PURE__*/jsx(Table$1, _extends({}, others, {
|
|
2236
2381
|
showHeader: true,
|
|
2237
2382
|
dataSource: dataSource,
|
|
@@ -2240,57 +2385,57 @@ const Table = p => {
|
|
|
2240
2385
|
rowSelection: antdRowSelection,
|
|
2241
2386
|
pagination: pagination,
|
|
2242
2387
|
summary: typeof summary === 'function' ? (pageData, ...args) => summary(pageData, ...args) : undefined,
|
|
2243
|
-
sticky:
|
|
2244
|
-
offsetHeader: 0
|
|
2245
|
-
} : undefined,
|
|
2388
|
+
sticky: antdSticky,
|
|
2246
2389
|
tableLayout: controllerOpen || hasFixedColumn ? 'fixed' : undefined,
|
|
2247
2390
|
scroll: tableScroll,
|
|
2248
2391
|
onHeaderRow: () => ({
|
|
2249
|
-
className: classnames(style$
|
|
2250
|
-
[style$4['sticky']]: sticky && !hasFixedColumn
|
|
2251
|
-
}),
|
|
2392
|
+
className: classnames(style$5['header'], 'info-page-table-header'),
|
|
2252
2393
|
style: headerStyle
|
|
2253
2394
|
}),
|
|
2254
2395
|
locale: {
|
|
2255
2396
|
emptyText: /*#__PURE__*/jsx("div", {
|
|
2256
|
-
className: style$
|
|
2397
|
+
className: style$5['empty'],
|
|
2257
2398
|
children: empty
|
|
2258
2399
|
})
|
|
2259
2400
|
},
|
|
2260
2401
|
rowClassName: record => {
|
|
2261
2402
|
const id = resolveRowKey(rowKey, record);
|
|
2262
2403
|
const isChecked = (rowSelection == null ? void 0 : rowSelection.selectedRowKeys) && rowSelection.selectedRowKeys.indexOf(id) > -1;
|
|
2263
|
-
return classnames(style$
|
|
2264
|
-
[style$
|
|
2265
|
-
[style$
|
|
2266
|
-
[style$
|
|
2404
|
+
return classnames(style$5['body'], 'info-page-table-row', {
|
|
2405
|
+
[style$5['is-selected-all']]: rowSelection == null ? void 0 : rowSelection.isSelectedAll,
|
|
2406
|
+
[style$5['is-selected']]: isChecked,
|
|
2407
|
+
[style$5['is-disabled']]: record.disabled
|
|
2267
2408
|
});
|
|
2268
2409
|
},
|
|
2269
|
-
onRow: record => ({
|
|
2410
|
+
onRow: onRowSelect ? record => ({
|
|
2270
2411
|
onClick: () => {
|
|
2271
2412
|
if (record.disabled) {
|
|
2272
2413
|
return;
|
|
2273
2414
|
}
|
|
2274
|
-
onRowSelect
|
|
2415
|
+
onRowSelect(record, {
|
|
2275
2416
|
columns: visibleColumns,
|
|
2276
2417
|
dataSource
|
|
2277
2418
|
});
|
|
2278
2419
|
}
|
|
2279
|
-
})
|
|
2420
|
+
}) : undefined
|
|
2280
2421
|
}));
|
|
2281
2422
|
const wrappedTable = /*#__PURE__*/jsxs("div", {
|
|
2282
2423
|
ref: tableRef,
|
|
2283
|
-
className: classnames(style$
|
|
2284
|
-
[style$
|
|
2285
|
-
[style$
|
|
2286
|
-
[style$
|
|
2287
|
-
[style$
|
|
2424
|
+
className: classnames(style$5['table'], style$4['table'], 'info-page-table', className, {
|
|
2425
|
+
[style$4['is-resize']]: currentMoveColumnIndex !== null,
|
|
2426
|
+
[style$4['is-computed']]: isLayout,
|
|
2427
|
+
[style$4['has-group-header']]: hasGroupHeader,
|
|
2428
|
+
[style$4['has-summary']]: typeof summary === 'function',
|
|
2429
|
+
[style$4['is-sticky']]: !!sticky,
|
|
2430
|
+
[style$4['is-sticky-scroll-y']]: !!sticky && hasScrollY,
|
|
2431
|
+
[style$4['is-sticky-viewport']]: !!sticky && !hasScrollY
|
|
2288
2432
|
}),
|
|
2433
|
+
style: tableWrapperStyle,
|
|
2289
2434
|
children: [/*#__PURE__*/jsx("div", {
|
|
2290
2435
|
className: "info-page-table-body",
|
|
2291
2436
|
children: !isLayout && tableElement
|
|
2292
2437
|
}), currentMoveColumnIndex !== null && resizeGuideStyle && /*#__PURE__*/jsx("span", {
|
|
2293
|
-
className: style$
|
|
2438
|
+
className: style$4['column-resize-guide'],
|
|
2294
2439
|
style: resizeGuideStyle,
|
|
2295
2440
|
"aria-hidden": true
|
|
2296
2441
|
})]
|
|
@@ -2343,7 +2488,7 @@ const renderHeaderCellContent = (column, {
|
|
|
2343
2488
|
colsSize
|
|
2344
2489
|
}) => {
|
|
2345
2490
|
const titleNode = renderColumnTitle(column.title, column, sortRender);
|
|
2346
|
-
const contentClassName = style$
|
|
2491
|
+
const contentClassName = style$5['col-content'];
|
|
2347
2492
|
if (widthBased) {
|
|
2348
2493
|
return /*#__PURE__*/jsx("span", {
|
|
2349
2494
|
className: contentClassName,
|
|
@@ -2373,9 +2518,9 @@ const renderHeaderGridCells = ({
|
|
|
2373
2518
|
const cells = [];
|
|
2374
2519
|
if ((rowSelection == null ? void 0 : rowSelection.type) === 'checkbox') {
|
|
2375
2520
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2376
|
-
className: classnames(style$
|
|
2521
|
+
className: classnames(style$5['col'], style$5['col-fixed'], style$5['header-cell'], 'info-page-table-col'),
|
|
2377
2522
|
children: /*#__PURE__*/jsx("span", {
|
|
2378
|
-
className: classnames(style$
|
|
2523
|
+
className: classnames(style$5['col-content'], 'info-page-table-col-content'),
|
|
2379
2524
|
children: rowSelection.allowSelectedAll ? (() => {
|
|
2380
2525
|
const checkedAll = rowSelection.isSelectedAll || dataSource && dataSource.every(item => rowSelection.selectedRowKeys && rowSelection.selectedRowKeys.indexOf(get(item, typeof rowKey === 'function' ? rowKey(item) : rowKey)) > -1);
|
|
2381
2526
|
return /*#__PURE__*/jsx(Checkbox, {
|
|
@@ -2413,7 +2558,7 @@ const renderHeaderGridCells = ({
|
|
|
2413
2558
|
});
|
|
2414
2559
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2415
2560
|
style: columnStyle,
|
|
2416
|
-
className: classnames(style$
|
|
2561
|
+
className: classnames(style$5['col'], fillRemaining ? style$5['col-width-fill'] : widthBased && style$5['col-width-based'], style$5['header-cell'], 'info-page-table-col'),
|
|
2417
2562
|
children: renderHeaderCellContent(column, {
|
|
2418
2563
|
sortRender,
|
|
2419
2564
|
widthBased,
|
|
@@ -2425,7 +2570,7 @@ const renderHeaderGridCells = ({
|
|
|
2425
2570
|
});
|
|
2426
2571
|
if ((rowSelection == null ? void 0 : rowSelection.type) === 'radio') {
|
|
2427
2572
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2428
|
-
className: classnames(style$
|
|
2573
|
+
className: classnames(style$5['col'], style$5['single-checked'], style$5['header-cell'], 'info-page-table-col')
|
|
2429
2574
|
}, "__radio__"));
|
|
2430
2575
|
}
|
|
2431
2576
|
return cells;
|
|
@@ -2446,7 +2591,7 @@ const Header = p => {
|
|
|
2446
2591
|
}, p);
|
|
2447
2592
|
return /*#__PURE__*/jsx("div", {
|
|
2448
2593
|
style: headerStyle,
|
|
2449
|
-
className: classnames(style$
|
|
2594
|
+
className: classnames(style$5['header'], 'info-page-table-header'),
|
|
2450
2595
|
children: renderHeaderGridCells({
|
|
2451
2596
|
dataSource,
|
|
2452
2597
|
columns,
|
|
@@ -2564,10 +2709,10 @@ const TableView = p => {
|
|
|
2564
2709
|
const columnMap = columnsValue.reduce((result, column) => Object.assign(result, {
|
|
2565
2710
|
[column.name]: column
|
|
2566
2711
|
}), {});
|
|
2567
|
-
const rowClassName = classnames(style$
|
|
2568
|
-
[style$
|
|
2569
|
-
[style$
|
|
2570
|
-
[style$
|
|
2712
|
+
const rowClassName = classnames(style$5['body'], style$5['body-cell'], style$5['body-row'], 'info-page-table-row', {
|
|
2713
|
+
[style$5['is-selected-all']]: rowSelection == null ? void 0 : rowSelection.isSelectedAll,
|
|
2714
|
+
[style$5['is-selected']]: isChecked,
|
|
2715
|
+
[style$5['is-disabled']]: item.disabled
|
|
2571
2716
|
});
|
|
2572
2717
|
const onSelectionChange = () => handleRowClick(item, {
|
|
2573
2718
|
dataSource,
|
|
@@ -2578,9 +2723,9 @@ const TableView = p => {
|
|
|
2578
2723
|
const cells = [];
|
|
2579
2724
|
if ((rowSelection == null ? void 0 : rowSelection.type) === 'checkbox') {
|
|
2580
2725
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2581
|
-
className: classnames(style$
|
|
2726
|
+
className: classnames(style$5['col'], style$5['col-fixed'], 'info-page-table-col'),
|
|
2582
2727
|
children: /*#__PURE__*/jsx("span", {
|
|
2583
|
-
className: classnames(style$
|
|
2728
|
+
className: classnames(style$5['col-content'], 'info-page-table-col-content'),
|
|
2584
2729
|
children: /*#__PURE__*/jsx(Checkbox, {
|
|
2585
2730
|
disabled: item.disabled || rowSelection.isSelectedAll,
|
|
2586
2731
|
checked: rowSelection.isSelectedAll && !item.disabled || isChecked,
|
|
@@ -2603,20 +2748,20 @@ const TableView = p => {
|
|
|
2603
2748
|
});
|
|
2604
2749
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2605
2750
|
style: columnStyle,
|
|
2606
|
-
className: classnames(style$
|
|
2751
|
+
className: classnames(style$5['col'], fillRemaining ? style$5['col-width-fill'] : widthBased && style$5['col-width-based'], 'info-page-table-col'),
|
|
2607
2752
|
children: columnValue ? renderCellContent(computeDisplay({
|
|
2608
2753
|
column: columnValue,
|
|
2609
2754
|
placeholder,
|
|
2610
2755
|
dataSource: item,
|
|
2611
2756
|
context
|
|
2612
|
-
}), columnValue, style$
|
|
2613
|
-
className: style$
|
|
2757
|
+
}), columnValue, style$5['col-content']) : /*#__PURE__*/jsx("span", {
|
|
2758
|
+
className: style$5['col-content']
|
|
2614
2759
|
})
|
|
2615
2760
|
}, `${id}-${column.name}`));
|
|
2616
2761
|
});
|
|
2617
2762
|
if ((rowSelection == null ? void 0 : rowSelection.type) === 'radio') {
|
|
2618
2763
|
cells.push(/*#__PURE__*/jsx("div", {
|
|
2619
|
-
className: classnames(style$
|
|
2764
|
+
className: classnames(style$5['col'], style$5['single-checked'], 'info-page-table-col'),
|
|
2620
2765
|
onClick: onSelectionChange,
|
|
2621
2766
|
children: isChecked && /*#__PURE__*/jsx(CheckOutlined, {})
|
|
2622
2767
|
}, `${id}__radio__`));
|
|
@@ -2628,7 +2773,7 @@ const TableView = p => {
|
|
|
2628
2773
|
});
|
|
2629
2774
|
};
|
|
2630
2775
|
const renderGrid = (dataSource, context) => /*#__PURE__*/jsxs("div", {
|
|
2631
|
-
className: style$
|
|
2776
|
+
className: style$5['grid'],
|
|
2632
2777
|
style: {
|
|
2633
2778
|
gridTemplateColumns
|
|
2634
2779
|
},
|
|
@@ -2637,7 +2782,7 @@ const TableView = p => {
|
|
|
2637
2782
|
const renderBody = (dataSource, context) => {
|
|
2638
2783
|
if (!dataSource || dataSource.length === 0) {
|
|
2639
2784
|
return /*#__PURE__*/jsx("div", {
|
|
2640
|
-
className: style$
|
|
2785
|
+
className: style$5['empty'],
|
|
2641
2786
|
children: empty
|
|
2642
2787
|
});
|
|
2643
2788
|
}
|
|
@@ -2653,16 +2798,16 @@ const TableView = p => {
|
|
|
2653
2798
|
}));
|
|
2654
2799
|
}
|
|
2655
2800
|
return /*#__PURE__*/jsx("div", _extends({}, others, {
|
|
2656
|
-
className: classnames(style$
|
|
2801
|
+
className: classnames(style$5['table'], style$5['tableView'], 'info-page-table', className),
|
|
2657
2802
|
children: dataSource && dataSource.length > 0 ? renderGrid(dataSource, context) : /*#__PURE__*/jsxs(Fragment, {
|
|
2658
2803
|
children: [/*#__PURE__*/jsx("div", {
|
|
2659
|
-
className: style$
|
|
2804
|
+
className: style$5['grid'],
|
|
2660
2805
|
style: {
|
|
2661
2806
|
gridTemplateColumns
|
|
2662
2807
|
},
|
|
2663
2808
|
children: renderHeaderGridCells(headerCellProps)
|
|
2664
2809
|
}), /*#__PURE__*/jsx("div", {
|
|
2665
|
-
className: style$
|
|
2810
|
+
className: style$5['empty'],
|
|
2666
2811
|
children: empty
|
|
2667
2812
|
})]
|
|
2668
2813
|
})
|
|
@@ -3349,6 +3494,7 @@ const TablePageInnerContent = withLocale(_ref => {
|
|
|
3349
3494
|
dataSource: formatData.list,
|
|
3350
3495
|
pagination: false,
|
|
3351
3496
|
sticky,
|
|
3497
|
+
getStickyContainer: getScrollContainer,
|
|
3352
3498
|
className: classnames(className, {
|
|
3353
3499
|
[style$1['table-in-toolbar']]: hasToolbar
|
|
3354
3500
|
}),
|
|
@@ -3451,5 +3597,5 @@ const preset = props => {
|
|
|
3451
3597
|
return next;
|
|
3452
3598
|
};
|
|
3453
3599
|
|
|
3454
|
-
export { RENDER_TYPE_NAMES, SIZE_NAMES, Table, TableView, TablePage as default, getColumnRender, getRenderTypeDimensions, getRenderTypeNames, getTagColor, globalParams, isOptionsColumn, parseRenderType, preset, renderTagItem, renderTagList, resolveColumn, resolveColumnDimensions, resolveColumns, resolveRenderType, sortDataSource, tableLocalApis, useSelectedRow, useSort, useTableConfig };
|
|
3600
|
+
export { RENDER_TYPE_NAMES, SIZE_NAMES, Table, TableView, TablePage as default, getColumnRender, getRenderTypeDimensions, getRenderTypeNames, getStatusType, getTagColor, globalParams, isOptionsColumn, parseRenderType, preset, renderStatusItem, renderTagItem, renderTagList, resolveColumn, resolveColumnDimensions, resolveColumns, resolveRenderType, sortDataSource, tableLocalApis, useSelectedRow, useSort, useTableConfig };
|
|
3455
3601
|
//# sourceMappingURL=index.modern.js.map
|