@majoo-ui/react 1.58.20-rc.3 → 1.58.20-rc.4
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/components/table/Table.d.ts +4 -7
- package/index.esm.js +70 -81
- package/index.umd.js +101 -112
- package/package.json +1 -1
|
@@ -1281,16 +1281,13 @@ export interface TableProps {
|
|
|
1281
1281
|
*/
|
|
1282
1282
|
onExpand?: (expanded: object) => void;
|
|
1283
1283
|
/**
|
|
1284
|
-
* Additional id table for unique identifier each table
|
|
1285
|
-
|
|
1286
|
-
id?: string | null;
|
|
1287
|
-
/**
|
|
1288
|
-
* Option for customize column to show in table <br />
|
|
1284
|
+
* Additional id table for unique identifier each table <br />
|
|
1285
|
+
* if id exist, column in the header can be customize to show in table <br />
|
|
1289
1286
|
* can be filled with 'string' value eg: 'product_table'
|
|
1290
1287
|
*/
|
|
1291
|
-
|
|
1288
|
+
id?: string | null;
|
|
1292
1289
|
}
|
|
1293
|
-
export declare function Table({ columns, data: rawData, keyId, pageIndex: controlledPageIndex, totalPage, totalData, fetchData, hideDataInfo, rowsPerPageOptions, emptyDataMessage, customEmptyDataProps: emptyDataProps, isLoading, css, headerCss, hideHeader, onSelectedChange, isInfiniteScroll, hasMoreItems, rowLimit, cellAlign, selectedIds, rowGroup, decoration, hiddenColumns, columnOrder, customRowsStyle, isMobileLayout, showDuplicatedData, onRowClick, hidePagination, searchQuery, additionalExceptionIds, onExpand, id,
|
|
1290
|
+
export declare function Table({ columns, data: rawData, keyId, pageIndex: controlledPageIndex, totalPage, totalData, fetchData, hideDataInfo, rowsPerPageOptions, emptyDataMessage, customEmptyDataProps: emptyDataProps, isLoading, css, headerCss, hideHeader, onSelectedChange, isInfiniteScroll, hasMoreItems, rowLimit, cellAlign, selectedIds, rowGroup, decoration, hiddenColumns, columnOrder, customRowsStyle, isMobileLayout, showDuplicatedData, onRowClick, hidePagination, searchQuery, additionalExceptionIds, onExpand, id, }: TableProps): JSX.Element;
|
|
1294
1291
|
export interface TableColumnProps {
|
|
1295
1292
|
/**
|
|
1296
1293
|
* Required if accessor is a function<br/>
|
package/index.esm.js
CHANGED
|
@@ -22565,25 +22565,7 @@ const cssAfter = {
|
|
|
22565
22565
|
pointerEvents: 'none',
|
|
22566
22566
|
boxSizing: 'border'
|
|
22567
22567
|
};
|
|
22568
|
-
|
|
22569
|
-
position: 'sticky',
|
|
22570
|
-
top: 0,
|
|
22571
|
-
right: 0,
|
|
22572
|
-
display: 'flex',
|
|
22573
|
-
justifyContent: 'center',
|
|
22574
|
-
alignItems: 'center',
|
|
22575
|
-
'@sm': {
|
|
22576
|
-
zIndex: 3
|
|
22577
|
-
},
|
|
22578
|
-
'@md': {
|
|
22579
|
-
zIndex: 'unset'
|
|
22580
|
-
},
|
|
22581
|
-
backgroundColor: 'white',
|
|
22582
|
-
'&::after': Object.assign(Object.assign({}, cssAfter), {
|
|
22583
|
-
right: '50%',
|
|
22584
|
-
boxShadow: 'inset -10px 0 10px -10px #00000026'
|
|
22585
|
-
})
|
|
22586
|
-
};
|
|
22568
|
+
|
|
22587
22569
|
const stickyShadowStyling = (column, tableScrollPosition, scrollAreaWidth) => {
|
|
22588
22570
|
if ((column === null || column === void 0 ? void 0 : column.sticky) && (column === null || column === void 0 ? void 0 : column.shadow)) {
|
|
22589
22571
|
return column.sticky === 'left' ? {
|
|
@@ -22716,7 +22698,7 @@ function HeaderMenuOption(props) {
|
|
|
22716
22698
|
label: item.Header,
|
|
22717
22699
|
value: item.id,
|
|
22718
22700
|
disabled: index === 0
|
|
22719
|
-
},
|
|
22701
|
+
}, index), row.length !== index + 1 && jsx(Separator$2, {}, void 0)]
|
|
22720
22702
|
}, void 0))
|
|
22721
22703
|
}), void 0)
|
|
22722
22704
|
}), void 0)
|
|
@@ -22737,8 +22719,8 @@ function HeaderMenuOption(props) {
|
|
|
22737
22719
|
portalled: true,
|
|
22738
22720
|
isMobile: false,
|
|
22739
22721
|
style: {
|
|
22740
|
-
right:
|
|
22741
|
-
left:
|
|
22722
|
+
right: 20,
|
|
22723
|
+
left: null
|
|
22742
22724
|
}
|
|
22743
22725
|
}, {
|
|
22744
22726
|
children: jsx(Flex$1, Object.assign({
|
|
@@ -22749,10 +22731,9 @@ function HeaderMenuOption(props) {
|
|
|
22749
22731
|
boxShadow: '$medium',
|
|
22750
22732
|
backgroundColor: 'white',
|
|
22751
22733
|
maxHeight: 440,
|
|
22752
|
-
height: rowData.length <= 5 ? 300 : 'fit-content',
|
|
22753
22734
|
minWidth: 167,
|
|
22754
|
-
width: '
|
|
22755
|
-
overflowY: visibleHeaders.filter(val => typeof val.Header === 'string').length > 7
|
|
22735
|
+
width: 'max-content',
|
|
22736
|
+
overflowY: visibleHeaders.filter(val => typeof val.Header === 'string').length > 7 ? 'scroll' : 'none'
|
|
22756
22737
|
}
|
|
22757
22738
|
}, {
|
|
22758
22739
|
children: jsx(CheckboxGroup, Object.assign({
|
|
@@ -22766,7 +22747,7 @@ function HeaderMenuOption(props) {
|
|
|
22766
22747
|
label: item.Header,
|
|
22767
22748
|
value: item.id,
|
|
22768
22749
|
disabled: index === 0
|
|
22769
|
-
},
|
|
22750
|
+
}, index), row.length !== index + 1 && jsx(Separator$2, {}, void 0)]
|
|
22770
22751
|
}, void 0))
|
|
22771
22752
|
}), void 0)
|
|
22772
22753
|
}), void 0)
|
|
@@ -22817,17 +22798,16 @@ function Table({
|
|
|
22817
22798
|
searchQuery,
|
|
22818
22799
|
additionalExceptionIds = [],
|
|
22819
22800
|
onExpand,
|
|
22820
|
-
id = null
|
|
22821
|
-
customizableColumn = null
|
|
22801
|
+
id = null
|
|
22822
22802
|
}) {
|
|
22823
|
-
var _a, _b, _c, _d;
|
|
22803
|
+
var _a, _b, _c, _d, _e;
|
|
22824
22804
|
const [openMenu, setOpen] = useState(false);
|
|
22825
22805
|
const [limit, setLimit] = useState(rowLimit);
|
|
22826
22806
|
const [dataRow, setDataRow] = useState({});
|
|
22827
22807
|
const [tableScrollPosition, setTableScrollPosition] = useState('start');
|
|
22828
22808
|
const [scrollAreaWidth, setScrollAreaWidth] = useState(0);
|
|
22829
22809
|
const [stateSelectedRowIds, setStateSelectedRowIds] = useState([]);
|
|
22830
|
-
const [filterHeader, setFilterHeader] = useLocalStorageState(`menu:${
|
|
22810
|
+
const [filterHeader, setFilterHeader] = useLocalStorageState(`menu:${id}`, []);
|
|
22831
22811
|
const {
|
|
22832
22812
|
t
|
|
22833
22813
|
} = useTranslation('MajooUI/table');
|
|
@@ -23176,6 +23156,7 @@ function Table({
|
|
|
23176
23156
|
const cssTableCell = {
|
|
23177
23157
|
backgroundColor: 'white'
|
|
23178
23158
|
};
|
|
23159
|
+
const tableHeight = (_c = document.getElementById('table-container')) === null || _c === void 0 ? void 0 : _c.offsetHeight;
|
|
23179
23160
|
return jsxs(Box, Object.assign({
|
|
23180
23161
|
css: {
|
|
23181
23162
|
position: 'relative',
|
|
@@ -23202,8 +23183,9 @@ function Table({
|
|
|
23202
23183
|
}, {
|
|
23203
23184
|
children: "Loading .... "
|
|
23204
23185
|
}), void 0)
|
|
23205
|
-
}), void 0), !isMobile ||
|
|
23186
|
+
}), void 0), !isMobile || id ? jsxs(Fragment, {
|
|
23206
23187
|
children: [jsxs(TableContainer$3, Object.assign({
|
|
23188
|
+
id: "table-container",
|
|
23207
23189
|
css: css,
|
|
23208
23190
|
ref: scrollerRef,
|
|
23209
23191
|
decoration: Boolean(decoration),
|
|
@@ -23233,10 +23215,10 @@ function Table({
|
|
|
23233
23215
|
if (filterHeader.length > 0) {
|
|
23234
23216
|
visibleHeaders = visibleHeaders.filter(item => filterHeader.includes(item.id));
|
|
23235
23217
|
}
|
|
23236
|
-
return
|
|
23218
|
+
return jsx(TableHeadRow$3, Object.assign({
|
|
23237
23219
|
css: cssTableCell
|
|
23238
23220
|
}, headerGroup.getHeaderGroupProps(), {
|
|
23239
|
-
children:
|
|
23221
|
+
children: visibleHeaders.map((column, index) => {
|
|
23240
23222
|
const headerRender = column.render('Header');
|
|
23241
23223
|
return jsx(TableHeadCell$3, Object.assign({}, column.getHeaderProps(props => [props, !column.unsortable ? column.getSortByToggleProps({
|
|
23242
23224
|
title: t('sortColumnTitle', 'Urutkan') || 'Urutkan'
|
|
@@ -23253,7 +23235,7 @@ function Table({
|
|
|
23253
23235
|
}, {
|
|
23254
23236
|
children: typeof headerRender === 'string' ? jsx(TableHeaderCellContainer, Object.assign({
|
|
23255
23237
|
isSortedDesc: column.isSortedDesc,
|
|
23256
|
-
unsortable:
|
|
23238
|
+
unsortable: id ? true : column.unsortable,
|
|
23257
23239
|
isToggleable: !!column.onToggle,
|
|
23258
23240
|
isToggled: column.isToggled
|
|
23259
23241
|
}, {
|
|
@@ -23264,38 +23246,7 @@ function Table({
|
|
|
23264
23246
|
}), void 0)
|
|
23265
23247
|
}), void 0) : headerRender
|
|
23266
23248
|
}), void 0);
|
|
23267
|
-
})
|
|
23268
|
-
css: cssBtnCustom
|
|
23269
|
-
}, {
|
|
23270
|
-
children: jsx(HeaderMenuOption, Object.assign({
|
|
23271
|
-
rowData: tableRowData,
|
|
23272
|
-
open: openMenu,
|
|
23273
|
-
id: customizableColumn,
|
|
23274
|
-
onOpenChange: setOpen,
|
|
23275
|
-
onChange: useCallback(items => {
|
|
23276
|
-
setFilterHeader(items);
|
|
23277
|
-
}, [filterHeader]),
|
|
23278
|
-
headerGroups: headerGroups,
|
|
23279
|
-
filterHeader: filterHeader
|
|
23280
|
-
}, {
|
|
23281
|
-
children: jsx(IconButton, Object.assign({
|
|
23282
|
-
css: {
|
|
23283
|
-
'&:hover': {
|
|
23284
|
-
backgroundColor: 'unset'
|
|
23285
|
-
},
|
|
23286
|
-
backgroundColor: '#c0c4c4',
|
|
23287
|
-
padding: 0,
|
|
23288
|
-
boxShadow: '0px 22px 43px 0px rgba(0, 0, 0, 0.08), 0px 9px 24px 0px rgba(0, 0, 0, 0.09), 0px 3px 9px 0px rgba(0, 0, 0, 0.13)'
|
|
23289
|
-
},
|
|
23290
|
-
onClick: () => setOpen(!openMenu),
|
|
23291
|
-
buttonType: "secondary"
|
|
23292
|
-
}, {
|
|
23293
|
-
children: jsx(PlusPrimitive, {
|
|
23294
|
-
size: "20"
|
|
23295
|
-
}, void 0)
|
|
23296
|
-
}), void 0)
|
|
23297
|
-
}), void 0)
|
|
23298
|
-
}), void 0)]
|
|
23249
|
+
})
|
|
23299
23250
|
}), void 0);
|
|
23300
23251
|
})
|
|
23301
23252
|
}), void 0), jsxs(TableBody$3, Object.assign({}, getTableBodyProps(), {
|
|
@@ -23305,7 +23256,7 @@ function Table({
|
|
|
23305
23256
|
height: `${paddingTop}px`
|
|
23306
23257
|
}
|
|
23307
23258
|
}, void 0)
|
|
23308
|
-
}, void 0), (
|
|
23259
|
+
}, void 0), (_d = decoration === null || decoration === void 0 ? void 0 : decoration.headerRender) === null || _d === void 0 ? void 0 : _d.call(decoration), decoration && page.map((row, i) => {
|
|
23309
23260
|
var _a;
|
|
23310
23261
|
prepareRow(row);
|
|
23311
23262
|
const isContextMenu = (_a = row.cells.filter(cell => {
|
|
@@ -23376,10 +23327,10 @@ function Table({
|
|
|
23376
23327
|
variant: "contentButton"
|
|
23377
23328
|
}, {
|
|
23378
23329
|
children: row.cells[0].render('Cell')
|
|
23379
|
-
}), void 0)),
|
|
23330
|
+
}), void 0)), jsx(TableRow$3, Object.assign({
|
|
23380
23331
|
css: customStyle
|
|
23381
23332
|
}, row && row.getRowProps ? row.getRowProps() : {}, {
|
|
23382
|
-
children:
|
|
23333
|
+
children: row.cells.filter(cell => filterHeader.length > 0 ? filterHeader.includes(cell.column.id) : cell).filter(cell => !cell.column.isSubRow).map((cell, index, row) => {
|
|
23383
23334
|
var _a, _b, _c;
|
|
23384
23335
|
let visibleHeaders = (_a = headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[0]) === null || _a === void 0 ? void 0 : _a.headers.filter(column => !column.isSubRow);
|
|
23385
23336
|
if (filterHeader.length > 0) {
|
|
@@ -23388,11 +23339,13 @@ function Table({
|
|
|
23388
23339
|
const collId = (_b = cell === null || cell === void 0 ? void 0 : cell.column) === null || _b === void 0 ? void 0 : _b.id;
|
|
23389
23340
|
const exceptionId = (_c = ['expander', 'multiple-expander', 'selection', 'menu', 'eye'].concat(additionalExceptionIds)) === null || _c === void 0 ? void 0 : _c.includes(collId);
|
|
23390
23341
|
return jsx(TableCell$3, Object.assign({}, cell.getCellProps(addOnCellStyle(cell.column.id)), {
|
|
23391
|
-
css: Object.assign(Object.assign(Object.assign(Object.assign({}, cssTableCell), {
|
|
23342
|
+
css: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, cssTableCell), {
|
|
23392
23343
|
padding: !isContextMenu || exceptionId ? collId === 'expander' || collId === 'multiple-expander' ? '20px 4px' : '20px 8px' : '',
|
|
23393
23344
|
verticalAlign: cell.column.accessor ? cellAlign : 'center',
|
|
23394
23345
|
cursor: onRowClick ? 'pointer' : 'unset'
|
|
23395
|
-
}), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
|
|
23346
|
+
}), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)), {
|
|
23347
|
+
paddingRight: row.length === index + 1 ? 30 : null
|
|
23348
|
+
}),
|
|
23396
23349
|
onClick: () => {
|
|
23397
23350
|
if (!exceptionId) {
|
|
23398
23351
|
handleRowClick(row, i);
|
|
@@ -23425,14 +23378,7 @@ function Table({
|
|
|
23425
23378
|
}), void 0)
|
|
23426
23379
|
}), void 0)
|
|
23427
23380
|
}), void 0);
|
|
23428
|
-
})
|
|
23429
|
-
css: Object.assign(Object.assign({}, cssBtnCustom), {
|
|
23430
|
-
maxHeight: 100,
|
|
23431
|
-
'&::after': Object.assign(Object.assign({}, cssBtnCustom['&::after']), {
|
|
23432
|
-
height: 100
|
|
23433
|
-
})
|
|
23434
|
-
})
|
|
23435
|
-
}, void 0)]
|
|
23381
|
+
})
|
|
23436
23382
|
}), void 0), row.isExpanded ? subRowCells.map((cell, index) => jsxs(TableRow$3, Object.assign({
|
|
23437
23383
|
subRow: true
|
|
23438
23384
|
}, {
|
|
@@ -23484,7 +23430,7 @@ function Table({
|
|
|
23484
23430
|
}))]
|
|
23485
23431
|
}, row.id);
|
|
23486
23432
|
})
|
|
23487
|
-
}), void 0), (
|
|
23433
|
+
}), void 0), (_e = decoration === null || decoration === void 0 ? void 0 : decoration.footerRender) === null || _e === void 0 ? void 0 : _e.call(decoration), isInfiniteScroll && paddingBottom > 0 && jsx("tr", {
|
|
23488
23434
|
children: jsx("td", {
|
|
23489
23435
|
style: {
|
|
23490
23436
|
height: `${paddingBottom}px`
|
|
@@ -23493,7 +23439,50 @@ function Table({
|
|
|
23493
23439
|
}, void 0)]
|
|
23494
23440
|
}), void 0)]
|
|
23495
23441
|
}), void 0)
|
|
23496
|
-
}), void 0), renderContextMenu()
|
|
23442
|
+
}), void 0), renderContextMenu(), id && jsxs(Fragment, {
|
|
23443
|
+
children: [jsx(HeaderMenuOption, Object.assign({
|
|
23444
|
+
rowData: tableRowData,
|
|
23445
|
+
open: openMenu,
|
|
23446
|
+
id: id,
|
|
23447
|
+
onOpenChange: setOpen,
|
|
23448
|
+
onChange: useCallback(items => {
|
|
23449
|
+
setFilterHeader(items);
|
|
23450
|
+
}, [filterHeader]),
|
|
23451
|
+
headerGroups: headerGroups,
|
|
23452
|
+
filterHeader: filterHeader
|
|
23453
|
+
}, {
|
|
23454
|
+
children: jsx(IconButton, Object.assign({
|
|
23455
|
+
css: {
|
|
23456
|
+
zIndex: '$docked',
|
|
23457
|
+
position: 'fixed',
|
|
23458
|
+
top: 20,
|
|
23459
|
+
right: 10,
|
|
23460
|
+
'&:hover': {
|
|
23461
|
+
backgroundColor: 'unset'
|
|
23462
|
+
},
|
|
23463
|
+
backgroundColor: '#c0c4c4',
|
|
23464
|
+
padding: 0,
|
|
23465
|
+
boxShadow: '0px 22px 43px 0px rgba(0, 0, 0, 0.08), 0px 9px 24px 0px rgba(0, 0, 0, 0.09), 0px 3px 9px 0px rgba(0, 0, 0, 0.13)'
|
|
23466
|
+
},
|
|
23467
|
+
onClick: () => setOpen(!openMenu),
|
|
23468
|
+
buttonType: "secondary"
|
|
23469
|
+
}, {
|
|
23470
|
+
children: jsx(PlusPrimitive, {
|
|
23471
|
+
size: "20"
|
|
23472
|
+
}, void 0)
|
|
23473
|
+
}), void 0)
|
|
23474
|
+
}), void 0), jsx(Box, {
|
|
23475
|
+
css: {
|
|
23476
|
+
backgroundColor: 'white',
|
|
23477
|
+
position: 'fixed',
|
|
23478
|
+
top: 0,
|
|
23479
|
+
height: tableHeight - 1,
|
|
23480
|
+
right: 0,
|
|
23481
|
+
width: 20,
|
|
23482
|
+
boxShadow: ' -2px 0px 5px 0px #00000026'
|
|
23483
|
+
}
|
|
23484
|
+
}, void 0)]
|
|
23485
|
+
}, void 0)]
|
|
23497
23486
|
}), void 0), !isInfiniteScroll && jsx(Box, Object.assign({
|
|
23498
23487
|
css: {
|
|
23499
23488
|
width: '100%'
|
package/index.umd.js
CHANGED
|
@@ -22885,25 +22885,7 @@
|
|
|
22885
22885
|
pointerEvents: 'none',
|
|
22886
22886
|
boxSizing: 'border'
|
|
22887
22887
|
};
|
|
22888
|
-
|
|
22889
|
-
position: 'sticky',
|
|
22890
|
-
top: 0,
|
|
22891
|
-
right: 0,
|
|
22892
|
-
display: 'flex',
|
|
22893
|
-
justifyContent: 'center',
|
|
22894
|
-
alignItems: 'center',
|
|
22895
|
-
'@sm': {
|
|
22896
|
-
zIndex: 3
|
|
22897
|
-
},
|
|
22898
|
-
'@md': {
|
|
22899
|
-
zIndex: 'unset'
|
|
22900
|
-
},
|
|
22901
|
-
backgroundColor: 'white',
|
|
22902
|
-
'&::after': __assign(__assign({}, cssAfter), {
|
|
22903
|
-
right: '50%',
|
|
22904
|
-
boxShadow: 'inset -10px 0 10px -10px #00000026'
|
|
22905
|
-
})
|
|
22906
|
-
};
|
|
22888
|
+
|
|
22907
22889
|
var stickyShadowStyling = function stickyShadowStyling(column, tableScrollPosition, scrollAreaWidth) {
|
|
22908
22890
|
if ((column === null || column === void 0 ? void 0 : column.sticky) && (column === null || column === void 0 ? void 0 : column.shadow)) {
|
|
22909
22891
|
return column.sticky === 'left' ? {
|
|
@@ -22998,8 +22980,8 @@
|
|
|
22998
22980
|
children = props.children,
|
|
22999
22981
|
headerGroups = props.headerGroups;
|
|
23000
22982
|
props.id;
|
|
23001
|
-
var items = props.filterHeader
|
|
23002
|
-
|
|
22983
|
+
var items = props.filterHeader;
|
|
22984
|
+
props.rowData;
|
|
23003
22985
|
var headers = (headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[0]).headers;
|
|
23004
22986
|
var visibleHeaders = headers.filter(function (column) {
|
|
23005
22987
|
return !column.isSubRow;
|
|
@@ -23047,7 +23029,7 @@
|
|
|
23047
23029
|
label: item.Header,
|
|
23048
23030
|
value: item.id,
|
|
23049
23031
|
disabled: index === 0
|
|
23050
|
-
},
|
|
23032
|
+
}, index), row.length !== index + 1 && jsxRuntime.jsx(Separator$2, {}, void 0)]
|
|
23051
23033
|
}, void 0);
|
|
23052
23034
|
})
|
|
23053
23035
|
}), void 0)
|
|
@@ -23069,8 +23051,8 @@
|
|
|
23069
23051
|
portalled: true,
|
|
23070
23052
|
isMobile: false,
|
|
23071
23053
|
style: {
|
|
23072
|
-
right:
|
|
23073
|
-
left:
|
|
23054
|
+
right: 20,
|
|
23055
|
+
left: null
|
|
23074
23056
|
}
|
|
23075
23057
|
}, {
|
|
23076
23058
|
children: jsxRuntime.jsx(Flex$1, __assign({
|
|
@@ -23081,12 +23063,11 @@
|
|
|
23081
23063
|
boxShadow: '$medium',
|
|
23082
23064
|
backgroundColor: 'white',
|
|
23083
23065
|
maxHeight: 440,
|
|
23084
|
-
height: rowData.length <= 5 ? 300 : 'fit-content',
|
|
23085
23066
|
minWidth: 167,
|
|
23086
|
-
width: '
|
|
23067
|
+
width: 'max-content',
|
|
23087
23068
|
overflowY: visibleHeaders.filter(function (val) {
|
|
23088
23069
|
return typeof val.Header === 'string';
|
|
23089
|
-
}).length > 7
|
|
23070
|
+
}).length > 7 ? 'scroll' : 'none'
|
|
23090
23071
|
}
|
|
23091
23072
|
}, {
|
|
23092
23073
|
children: jsxRuntime.jsx(CheckboxGroup, __assign({
|
|
@@ -23107,7 +23088,7 @@
|
|
|
23107
23088
|
label: item.Header,
|
|
23108
23089
|
value: item.id,
|
|
23109
23090
|
disabled: index === 0
|
|
23110
|
-
},
|
|
23091
|
+
}, index), row.length !== index + 1 && jsxRuntime.jsx(Separator$2, {}, void 0)]
|
|
23111
23092
|
}, void 0);
|
|
23112
23093
|
})
|
|
23113
23094
|
}), void 0)
|
|
@@ -23128,37 +23109,37 @@
|
|
|
23128
23109
|
return [state, setState];
|
|
23129
23110
|
};
|
|
23130
23111
|
function Table(_a) {
|
|
23131
|
-
var _b, _c, _d, _e;
|
|
23112
|
+
var _b, _c, _d, _e, _f;
|
|
23132
23113
|
var columns = _a.columns,
|
|
23133
23114
|
rawData = _a.data,
|
|
23134
|
-
|
|
23135
|
-
keyId =
|
|
23136
|
-
|
|
23137
|
-
controlledPageIndex =
|
|
23115
|
+
_g = _a.keyId,
|
|
23116
|
+
keyId = _g === void 0 ? 'id' : _g,
|
|
23117
|
+
_h = _a.pageIndex,
|
|
23118
|
+
controlledPageIndex = _h === void 0 ? 0 : _h,
|
|
23138
23119
|
totalPage = _a.totalPage,
|
|
23139
|
-
|
|
23140
|
-
totalData =
|
|
23120
|
+
_j = _a.totalData,
|
|
23121
|
+
totalData = _j === void 0 ? 0 : _j,
|
|
23141
23122
|
fetchData = _a.fetchData,
|
|
23142
|
-
|
|
23143
|
-
hideDataInfo =
|
|
23144
|
-
|
|
23145
|
-
rowsPerPageOptions =
|
|
23123
|
+
_k = _a.hideDataInfo,
|
|
23124
|
+
hideDataInfo = _k === void 0 ? false : _k,
|
|
23125
|
+
_l = _a.rowsPerPageOptions,
|
|
23126
|
+
rowsPerPageOptions = _l === void 0 ? [10, 25, 50, 100] : _l;
|
|
23146
23127
|
_a.emptyDataMessage;
|
|
23147
23128
|
var emptyDataProps = _a.customEmptyDataProps,
|
|
23148
|
-
|
|
23149
|
-
isLoading =
|
|
23129
|
+
_o = _a.isLoading,
|
|
23130
|
+
isLoading = _o === void 0 ? false : _o,
|
|
23150
23131
|
css = _a.css,
|
|
23151
23132
|
headerCss = _a.headerCss,
|
|
23152
23133
|
hideHeader = _a.hideHeader,
|
|
23153
23134
|
onSelectedChange = _a.onSelectedChange,
|
|
23154
|
-
|
|
23155
|
-
isInfiniteScroll =
|
|
23156
|
-
|
|
23157
|
-
hasMoreItems =
|
|
23158
|
-
|
|
23159
|
-
rowLimit =
|
|
23160
|
-
|
|
23161
|
-
cellAlign =
|
|
23135
|
+
_p = _a.isInfiniteScroll,
|
|
23136
|
+
isInfiniteScroll = _p === void 0 ? false : _p,
|
|
23137
|
+
_q = _a.hasMoreItems,
|
|
23138
|
+
hasMoreItems = _q === void 0 ? true : _q,
|
|
23139
|
+
_r = _a.rowLimit,
|
|
23140
|
+
rowLimit = _r === void 0 ? 10 : _r,
|
|
23141
|
+
_s = _a.cellAlign,
|
|
23142
|
+
cellAlign = _s === void 0 ? 'center' : _s,
|
|
23162
23143
|
selectedIds = _a.selectedIds,
|
|
23163
23144
|
rowGroup = _a.rowGroup,
|
|
23164
23145
|
decoration = _a.decoration,
|
|
@@ -23168,15 +23149,14 @@
|
|
|
23168
23149
|
isMobileLayout = _a.isMobileLayout,
|
|
23169
23150
|
showDuplicatedData = _a.showDuplicatedData,
|
|
23170
23151
|
onRowClick = _a.onRowClick,
|
|
23171
|
-
|
|
23172
|
-
hidePagination =
|
|
23152
|
+
_t = _a.hidePagination,
|
|
23153
|
+
hidePagination = _t === void 0 ? false : _t,
|
|
23173
23154
|
searchQuery = _a.searchQuery,
|
|
23174
|
-
|
|
23175
|
-
additionalExceptionIds =
|
|
23176
|
-
onExpand = _a.onExpand
|
|
23177
|
-
_a.id
|
|
23178
|
-
|
|
23179
|
-
customizableColumn = _v === void 0 ? null : _v;
|
|
23155
|
+
_u = _a.additionalExceptionIds,
|
|
23156
|
+
additionalExceptionIds = _u === void 0 ? [] : _u,
|
|
23157
|
+
onExpand = _a.onExpand,
|
|
23158
|
+
_v = _a.id,
|
|
23159
|
+
id = _v === void 0 ? null : _v;
|
|
23180
23160
|
var _w = React.useState(false),
|
|
23181
23161
|
openMenu = _w[0],
|
|
23182
23162
|
setOpen = _w[1];
|
|
@@ -23195,7 +23175,7 @@
|
|
|
23195
23175
|
var _1 = React.useState([]),
|
|
23196
23176
|
stateSelectedRowIds = _1[0],
|
|
23197
23177
|
setStateSelectedRowIds = _1[1];
|
|
23198
|
-
var _2 = useLocalStorageState("menu:".concat(
|
|
23178
|
+
var _2 = useLocalStorageState("menu:".concat(id), []),
|
|
23199
23179
|
filterHeader = _2[0],
|
|
23200
23180
|
setFilterHeader = _2[1];
|
|
23201
23181
|
var t = reactI18next.useTranslation('MajooUI/table').t;
|
|
@@ -23573,6 +23553,7 @@
|
|
|
23573
23553
|
var cssTableCell = {
|
|
23574
23554
|
backgroundColor: 'white'
|
|
23575
23555
|
};
|
|
23556
|
+
var tableHeight = (_d = document.getElementById('table-container')) === null || _d === void 0 ? void 0 : _d.offsetHeight;
|
|
23576
23557
|
return jsxRuntime.jsxs(Box, __assign({
|
|
23577
23558
|
css: {
|
|
23578
23559
|
position: 'relative',
|
|
@@ -23599,8 +23580,9 @@
|
|
|
23599
23580
|
}, {
|
|
23600
23581
|
children: "Loading .... "
|
|
23601
23582
|
}), void 0)
|
|
23602
|
-
}), void 0), !isMobile ||
|
|
23583
|
+
}), void 0), !isMobile || id ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23603
23584
|
children: [jsxRuntime.jsxs(TableContainer$3, __assign({
|
|
23585
|
+
id: "table-container",
|
|
23604
23586
|
css: css,
|
|
23605
23587
|
ref: scrollerRef,
|
|
23606
23588
|
decoration: Boolean(decoration),
|
|
@@ -23636,10 +23618,10 @@
|
|
|
23636
23618
|
return filterHeader.includes(item.id);
|
|
23637
23619
|
});
|
|
23638
23620
|
}
|
|
23639
|
-
return jsxRuntime.
|
|
23621
|
+
return jsxRuntime.jsx(TableHeadRow$3, __assign({
|
|
23640
23622
|
css: cssTableCell
|
|
23641
23623
|
}, headerGroup.getHeaderGroupProps(), {
|
|
23642
|
-
children:
|
|
23624
|
+
children: visibleHeaders.map(function (column, index) {
|
|
23643
23625
|
var headerRender = column.render('Header');
|
|
23644
23626
|
return jsxRuntime.jsx(TableHeadCell$3, __assign({}, column.getHeaderProps(function (props) {
|
|
23645
23627
|
return [props, !column.unsortable ? column.getSortByToggleProps({
|
|
@@ -23658,7 +23640,7 @@
|
|
|
23658
23640
|
}, {
|
|
23659
23641
|
children: typeof headerRender === 'string' ? jsxRuntime.jsx(TableHeaderCellContainer, __assign({
|
|
23660
23642
|
isSortedDesc: column.isSortedDesc,
|
|
23661
|
-
unsortable:
|
|
23643
|
+
unsortable: id ? true : column.unsortable,
|
|
23662
23644
|
isToggleable: !!column.onToggle,
|
|
23663
23645
|
isToggled: column.isToggled
|
|
23664
23646
|
}, {
|
|
@@ -23669,40 +23651,7 @@
|
|
|
23669
23651
|
}), void 0)
|
|
23670
23652
|
}), void 0) : headerRender
|
|
23671
23653
|
}), void 0);
|
|
23672
|
-
})
|
|
23673
|
-
css: cssBtnCustom
|
|
23674
|
-
}, {
|
|
23675
|
-
children: jsxRuntime.jsx(HeaderMenuOption, __assign({
|
|
23676
|
-
rowData: tableRowData,
|
|
23677
|
-
open: openMenu,
|
|
23678
|
-
id: customizableColumn,
|
|
23679
|
-
onOpenChange: setOpen,
|
|
23680
|
-
onChange: React.useCallback(function (items) {
|
|
23681
|
-
setFilterHeader(items);
|
|
23682
|
-
}, [filterHeader]),
|
|
23683
|
-
headerGroups: headerGroups,
|
|
23684
|
-
filterHeader: filterHeader
|
|
23685
|
-
}, {
|
|
23686
|
-
children: jsxRuntime.jsx(IconButton, __assign({
|
|
23687
|
-
css: {
|
|
23688
|
-
'&:hover': {
|
|
23689
|
-
backgroundColor: 'unset'
|
|
23690
|
-
},
|
|
23691
|
-
backgroundColor: '#c0c4c4',
|
|
23692
|
-
padding: 0,
|
|
23693
|
-
boxShadow: '0px 22px 43px 0px rgba(0, 0, 0, 0.08), 0px 9px 24px 0px rgba(0, 0, 0, 0.09), 0px 3px 9px 0px rgba(0, 0, 0, 0.13)'
|
|
23694
|
-
},
|
|
23695
|
-
onClick: function () {
|
|
23696
|
-
return setOpen(!openMenu);
|
|
23697
|
-
},
|
|
23698
|
-
buttonType: "secondary"
|
|
23699
|
-
}, {
|
|
23700
|
-
children: jsxRuntime.jsx(icons.PlusPrimitive, {
|
|
23701
|
-
size: "20"
|
|
23702
|
-
}, void 0)
|
|
23703
|
-
}), void 0)
|
|
23704
|
-
}), void 0)
|
|
23705
|
-
}), void 0)]
|
|
23654
|
+
})
|
|
23706
23655
|
}), void 0);
|
|
23707
23656
|
})
|
|
23708
23657
|
}), void 0), jsxRuntime.jsxs(TableBody$3, __assign({}, getTableBodyProps(), {
|
|
@@ -23712,7 +23661,7 @@
|
|
|
23712
23661
|
height: "".concat(paddingTop, "px")
|
|
23713
23662
|
}
|
|
23714
23663
|
}, void 0)
|
|
23715
|
-
}, void 0), (
|
|
23664
|
+
}, void 0), (_e = decoration === null || decoration === void 0 ? void 0 : decoration.headerRender) === null || _e === void 0 ? void 0 : _e.call(decoration), decoration && page.map(function (row, i) {
|
|
23716
23665
|
var _a;
|
|
23717
23666
|
prepareRow(row);
|
|
23718
23667
|
var isContextMenu = (_a = row.cells.filter(function (cell) {
|
|
@@ -23793,14 +23742,14 @@
|
|
|
23793
23742
|
variant: "contentButton"
|
|
23794
23743
|
}, {
|
|
23795
23744
|
children: row.cells[0].render('Cell')
|
|
23796
|
-
}), void 0)), jsxRuntime.
|
|
23745
|
+
}), void 0)), jsxRuntime.jsx(TableRow$3, __assign({
|
|
23797
23746
|
css: customStyle
|
|
23798
23747
|
}, row && row.getRowProps ? row.getRowProps() : {}, {
|
|
23799
|
-
children:
|
|
23748
|
+
children: row.cells.filter(function (cell) {
|
|
23800
23749
|
return filterHeader.length > 0 ? filterHeader.includes(cell.column.id) : cell;
|
|
23801
23750
|
}).filter(function (cell) {
|
|
23802
23751
|
return !cell.column.isSubRow;
|
|
23803
|
-
}).map(function (cell) {
|
|
23752
|
+
}).map(function (cell, index, row) {
|
|
23804
23753
|
var _a, _b, _c;
|
|
23805
23754
|
var visibleHeaders = (_a = headerGroups === null || headerGroups === void 0 ? void 0 : headerGroups[0]) === null || _a === void 0 ? void 0 : _a.headers.filter(function (column) {
|
|
23806
23755
|
return !column.isSubRow;
|
|
@@ -23813,11 +23762,13 @@
|
|
|
23813
23762
|
var collId = (_b = cell === null || cell === void 0 ? void 0 : cell.column) === null || _b === void 0 ? void 0 : _b.id;
|
|
23814
23763
|
var exceptionId = (_c = ['expander', 'multiple-expander', 'selection', 'menu', 'eye'].concat(additionalExceptionIds)) === null || _c === void 0 ? void 0 : _c.includes(collId);
|
|
23815
23764
|
return jsxRuntime.jsx(TableCell$3, __assign({}, cell.getCellProps(addOnCellStyle(cell.column.id)), {
|
|
23816
|
-
css: __assign(__assign(__assign(__assign({}, cssTableCell), {
|
|
23765
|
+
css: __assign(__assign(__assign(__assign(__assign({}, cssTableCell), {
|
|
23817
23766
|
padding: !isContextMenu || exceptionId ? collId === 'expander' || collId === 'multiple-expander' ? '20px 4px' : '20px 8px' : '',
|
|
23818
23767
|
verticalAlign: cell.column.accessor ? cellAlign : 'center',
|
|
23819
23768
|
cursor: onRowClick ? 'pointer' : 'unset'
|
|
23820
|
-
}), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)),
|
|
23769
|
+
}), stickyPositionStyling(cell.column)), stickyShadowStyling(cell.column, tableScrollPosition, scrollAreaWidth)), {
|
|
23770
|
+
paddingRight: row.length === index + 1 ? 30 : null
|
|
23771
|
+
}),
|
|
23821
23772
|
onClick: function () {
|
|
23822
23773
|
if (!exceptionId) {
|
|
23823
23774
|
handleRowClick(row, i);
|
|
@@ -23854,14 +23805,7 @@
|
|
|
23854
23805
|
}), void 0)
|
|
23855
23806
|
}), void 0)
|
|
23856
23807
|
}), void 0);
|
|
23857
|
-
})
|
|
23858
|
-
css: __assign(__assign({}, cssBtnCustom), {
|
|
23859
|
-
maxHeight: 100,
|
|
23860
|
-
'&::after': __assign(__assign({}, cssBtnCustom['&::after']), {
|
|
23861
|
-
height: 100
|
|
23862
|
-
})
|
|
23863
|
-
})
|
|
23864
|
-
}, void 0)]
|
|
23808
|
+
})
|
|
23865
23809
|
}), void 0), row.isExpanded ? subRowCells.map(function (cell, index) {
|
|
23866
23810
|
return jsxRuntime.jsxs(TableRow$3, __assign({
|
|
23867
23811
|
subRow: true
|
|
@@ -23919,7 +23863,7 @@
|
|
|
23919
23863
|
}))]
|
|
23920
23864
|
}, row.id);
|
|
23921
23865
|
})
|
|
23922
|
-
}), void 0), (
|
|
23866
|
+
}), void 0), (_f = decoration === null || decoration === void 0 ? void 0 : decoration.footerRender) === null || _f === void 0 ? void 0 : _f.call(decoration), isInfiniteScroll && paddingBottom > 0 && jsxRuntime.jsx("tr", {
|
|
23923
23867
|
children: jsxRuntime.jsx("td", {
|
|
23924
23868
|
style: {
|
|
23925
23869
|
height: "".concat(paddingBottom, "px")
|
|
@@ -23928,7 +23872,52 @@
|
|
|
23928
23872
|
}, void 0)]
|
|
23929
23873
|
}), void 0)]
|
|
23930
23874
|
}), void 0)
|
|
23931
|
-
}), void 0), renderContextMenu()
|
|
23875
|
+
}), void 0), renderContextMenu(), id && jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
23876
|
+
children: [jsxRuntime.jsx(HeaderMenuOption, __assign({
|
|
23877
|
+
rowData: tableRowData,
|
|
23878
|
+
open: openMenu,
|
|
23879
|
+
id: id,
|
|
23880
|
+
onOpenChange: setOpen,
|
|
23881
|
+
onChange: React.useCallback(function (items) {
|
|
23882
|
+
setFilterHeader(items);
|
|
23883
|
+
}, [filterHeader]),
|
|
23884
|
+
headerGroups: headerGroups,
|
|
23885
|
+
filterHeader: filterHeader
|
|
23886
|
+
}, {
|
|
23887
|
+
children: jsxRuntime.jsx(IconButton, __assign({
|
|
23888
|
+
css: {
|
|
23889
|
+
zIndex: '$docked',
|
|
23890
|
+
position: 'fixed',
|
|
23891
|
+
top: 20,
|
|
23892
|
+
right: 10,
|
|
23893
|
+
'&:hover': {
|
|
23894
|
+
backgroundColor: 'unset'
|
|
23895
|
+
},
|
|
23896
|
+
backgroundColor: '#c0c4c4',
|
|
23897
|
+
padding: 0,
|
|
23898
|
+
boxShadow: '0px 22px 43px 0px rgba(0, 0, 0, 0.08), 0px 9px 24px 0px rgba(0, 0, 0, 0.09), 0px 3px 9px 0px rgba(0, 0, 0, 0.13)'
|
|
23899
|
+
},
|
|
23900
|
+
onClick: function () {
|
|
23901
|
+
return setOpen(!openMenu);
|
|
23902
|
+
},
|
|
23903
|
+
buttonType: "secondary"
|
|
23904
|
+
}, {
|
|
23905
|
+
children: jsxRuntime.jsx(icons.PlusPrimitive, {
|
|
23906
|
+
size: "20"
|
|
23907
|
+
}, void 0)
|
|
23908
|
+
}), void 0)
|
|
23909
|
+
}), void 0), jsxRuntime.jsx(Box, {
|
|
23910
|
+
css: {
|
|
23911
|
+
backgroundColor: 'white',
|
|
23912
|
+
position: 'fixed',
|
|
23913
|
+
top: 0,
|
|
23914
|
+
height: tableHeight - 1,
|
|
23915
|
+
right: 0,
|
|
23916
|
+
width: 20,
|
|
23917
|
+
boxShadow: ' -2px 0px 5px 0px #00000026'
|
|
23918
|
+
}
|
|
23919
|
+
}, void 0)]
|
|
23920
|
+
}, void 0)]
|
|
23932
23921
|
}), void 0), !isInfiniteScroll && jsxRuntime.jsx(Box, __assign({
|
|
23933
23922
|
css: {
|
|
23934
23923
|
width: '100%'
|