@moving-walls/design-system 1.0.18 → 1.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.js +221 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +221 -40
- package/dist/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -1
package/dist/index.js
CHANGED
|
@@ -49273,6 +49273,169 @@ function getRowSelectionOption(rowSelection, serverSidePagination) {
|
|
|
49273
49273
|
}
|
|
49274
49274
|
return rowSelection;
|
|
49275
49275
|
}
|
|
49276
|
+
/* ------------------------------------------------------------------ */
|
|
49277
|
+
/* Server-side pagination bar – replaces AG Grid's built-in panel */
|
|
49278
|
+
/* when serverSidePagination=true to avoid page-reset feedback loops */
|
|
49279
|
+
/* ------------------------------------------------------------------ */
|
|
49280
|
+
var paginationBtnStyle = function paginationBtnStyle(disabled) {
|
|
49281
|
+
return {
|
|
49282
|
+
display: 'inline-flex',
|
|
49283
|
+
alignItems: 'center',
|
|
49284
|
+
justifyContent: 'center',
|
|
49285
|
+
width: 32,
|
|
49286
|
+
height: 32,
|
|
49287
|
+
border: '1px solid #e2e8f0',
|
|
49288
|
+
borderRadius: 6,
|
|
49289
|
+
background: disabled ? 'transparent' : '#fff',
|
|
49290
|
+
color: disabled ? '#cbd5e1' : '#475569',
|
|
49291
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
49292
|
+
fontSize: 16,
|
|
49293
|
+
lineHeight: 1,
|
|
49294
|
+
transition: 'background 0.15s, border-color 0.15s'
|
|
49295
|
+
};
|
|
49296
|
+
};
|
|
49297
|
+
var ServerSidePaginationBar = /*#__PURE__*/React.memo(function ServerSidePaginationBar(_ref) {
|
|
49298
|
+
var totalCount = _ref.totalCount,
|
|
49299
|
+
currentPage = _ref.currentPage,
|
|
49300
|
+
pageSize = _ref.pageSize,
|
|
49301
|
+
onPageChange = _ref.onPageChange,
|
|
49302
|
+
onPageSizeChange = _ref.onPageSizeChange,
|
|
49303
|
+
_ref$pageSizeSelector = _ref.pageSizeSelector,
|
|
49304
|
+
pageSizeSelector = _ref$pageSizeSelector === void 0 ? DEFAULT_PAGE_SIZE_SELECTOR : _ref$pageSizeSelector;
|
|
49305
|
+
var totalPages = Math.max(1, Math.ceil(totalCount / pageSize));
|
|
49306
|
+
var start = totalCount === 0 ? 0 : (currentPage - 1) * pageSize + 1;
|
|
49307
|
+
var end = Math.min(currentPage * pageSize, totalCount);
|
|
49308
|
+
var atFirst = currentPage <= 1;
|
|
49309
|
+
var atLast = currentPage >= totalPages;
|
|
49310
|
+
return require$$1.jsxs("div", {
|
|
49311
|
+
style: {
|
|
49312
|
+
display: 'flex',
|
|
49313
|
+
alignItems: 'center',
|
|
49314
|
+
justifyContent: 'flex-end',
|
|
49315
|
+
gap: 16,
|
|
49316
|
+
padding: '10px 16px',
|
|
49317
|
+
borderTop: '1px solid #e2e8f0',
|
|
49318
|
+
fontSize: 13,
|
|
49319
|
+
color: '#64748b',
|
|
49320
|
+
background: '#fff',
|
|
49321
|
+
flexShrink: 0,
|
|
49322
|
+
minHeight: 48
|
|
49323
|
+
},
|
|
49324
|
+
role: "navigation",
|
|
49325
|
+
"aria-label": "Pagination",
|
|
49326
|
+
children: [require$$1.jsxs("span", {
|
|
49327
|
+
style: {
|
|
49328
|
+
display: 'flex',
|
|
49329
|
+
alignItems: 'center',
|
|
49330
|
+
gap: 6
|
|
49331
|
+
},
|
|
49332
|
+
children: [require$$1.jsx("span", {
|
|
49333
|
+
children: "Page Size:"
|
|
49334
|
+
}), require$$1.jsx("select", {
|
|
49335
|
+
value: pageSize,
|
|
49336
|
+
onChange: function onChange(e) {
|
|
49337
|
+
return onPageSizeChange(Number(e.target.value));
|
|
49338
|
+
},
|
|
49339
|
+
style: {
|
|
49340
|
+
border: '1px solid #e2e8f0',
|
|
49341
|
+
borderRadius: 6,
|
|
49342
|
+
padding: '4px 8px',
|
|
49343
|
+
fontSize: 13,
|
|
49344
|
+
background: '#fff',
|
|
49345
|
+
color: '#334155',
|
|
49346
|
+
cursor: 'pointer',
|
|
49347
|
+
outline: 'none'
|
|
49348
|
+
},
|
|
49349
|
+
children: pageSizeSelector.map(function (size) {
|
|
49350
|
+
return require$$1.jsx("option", {
|
|
49351
|
+
value: size,
|
|
49352
|
+
children: size
|
|
49353
|
+
}, size);
|
|
49354
|
+
})
|
|
49355
|
+
})]
|
|
49356
|
+
}), require$$1.jsxs("span", {
|
|
49357
|
+
style: {
|
|
49358
|
+
display: 'flex',
|
|
49359
|
+
gap: 4
|
|
49360
|
+
},
|
|
49361
|
+
children: [require$$1.jsx("strong", {
|
|
49362
|
+
style: {
|
|
49363
|
+
color: '#334155'
|
|
49364
|
+
},
|
|
49365
|
+
children: start
|
|
49366
|
+
}), ' to ', require$$1.jsx("strong", {
|
|
49367
|
+
style: {
|
|
49368
|
+
color: '#334155'
|
|
49369
|
+
},
|
|
49370
|
+
children: end
|
|
49371
|
+
}), ' of ', require$$1.jsx("strong", {
|
|
49372
|
+
style: {
|
|
49373
|
+
color: '#334155'
|
|
49374
|
+
},
|
|
49375
|
+
children: totalCount
|
|
49376
|
+
})]
|
|
49377
|
+
}), require$$1.jsxs("span", {
|
|
49378
|
+
style: {
|
|
49379
|
+
display: 'flex',
|
|
49380
|
+
alignItems: 'center',
|
|
49381
|
+
gap: 4
|
|
49382
|
+
},
|
|
49383
|
+
children: [require$$1.jsx("button", {
|
|
49384
|
+
type: "button",
|
|
49385
|
+
disabled: atFirst,
|
|
49386
|
+
onClick: function onClick() {
|
|
49387
|
+
return onPageChange(1);
|
|
49388
|
+
},
|
|
49389
|
+
style: paginationBtnStyle(atFirst),
|
|
49390
|
+
"aria-label": "First Page",
|
|
49391
|
+
children: "\u226A"
|
|
49392
|
+
}), require$$1.jsx("button", {
|
|
49393
|
+
type: "button",
|
|
49394
|
+
disabled: atFirst,
|
|
49395
|
+
onClick: function onClick() {
|
|
49396
|
+
return onPageChange(currentPage - 1);
|
|
49397
|
+
},
|
|
49398
|
+
style: paginationBtnStyle(atFirst),
|
|
49399
|
+
"aria-label": "Previous Page",
|
|
49400
|
+
children: "\u2039"
|
|
49401
|
+
}), require$$1.jsxs("span", {
|
|
49402
|
+
style: {
|
|
49403
|
+
margin: '0 8px',
|
|
49404
|
+
fontSize: 13
|
|
49405
|
+
},
|
|
49406
|
+
children: ["Page ", require$$1.jsx("strong", {
|
|
49407
|
+
style: {
|
|
49408
|
+
color: '#334155'
|
|
49409
|
+
},
|
|
49410
|
+
children: currentPage
|
|
49411
|
+
}), " of ", require$$1.jsx("strong", {
|
|
49412
|
+
style: {
|
|
49413
|
+
color: '#334155'
|
|
49414
|
+
},
|
|
49415
|
+
children: totalPages
|
|
49416
|
+
})]
|
|
49417
|
+
}), require$$1.jsx("button", {
|
|
49418
|
+
type: "button",
|
|
49419
|
+
disabled: atLast,
|
|
49420
|
+
onClick: function onClick() {
|
|
49421
|
+
return onPageChange(currentPage + 1);
|
|
49422
|
+
},
|
|
49423
|
+
style: paginationBtnStyle(atLast),
|
|
49424
|
+
"aria-label": "Next Page",
|
|
49425
|
+
children: "\u203A"
|
|
49426
|
+
}), require$$1.jsx("button", {
|
|
49427
|
+
type: "button",
|
|
49428
|
+
disabled: atLast,
|
|
49429
|
+
onClick: function onClick() {
|
|
49430
|
+
return onPageChange(totalPages);
|
|
49431
|
+
},
|
|
49432
|
+
style: paginationBtnStyle(atLast),
|
|
49433
|
+
"aria-label": "Last Page",
|
|
49434
|
+
children: "\u226B"
|
|
49435
|
+
})]
|
|
49436
|
+
})]
|
|
49437
|
+
});
|
|
49438
|
+
});
|
|
49276
49439
|
function AgGridTableInner(props) {
|
|
49277
49440
|
var _a, _b;
|
|
49278
49441
|
var rowData = props.rowData,
|
|
@@ -49317,7 +49480,8 @@ function AgGridTableInner(props) {
|
|
|
49317
49480
|
state: sortStateToColumnState(sortState)
|
|
49318
49481
|
});
|
|
49319
49482
|
}
|
|
49320
|
-
|
|
49483
|
+
// For non-server-side pagination, sync AG Grid's internal page
|
|
49484
|
+
if (!serverSidePagination && serverSideConfig) {
|
|
49321
49485
|
isPaginationFromExternalRef.current = true;
|
|
49322
49486
|
event.api.paginationGoToPage(serverSideConfig.currentPage - 1);
|
|
49323
49487
|
event.api.setGridOption("paginationPageSize", serverSideConfig.pageSize);
|
|
@@ -49330,8 +49494,9 @@ function AgGridTableInner(props) {
|
|
|
49330
49494
|
state: sortStateToColumnState(sortState)
|
|
49331
49495
|
});
|
|
49332
49496
|
}, [sortState]);
|
|
49497
|
+
// Sync AG Grid internal page — only for NON-server-side pagination
|
|
49333
49498
|
React.useEffect(function () {
|
|
49334
|
-
if (
|
|
49499
|
+
if (serverSidePagination || !serverSideConfig || !apiRef.current) return;
|
|
49335
49500
|
var api = apiRef.current;
|
|
49336
49501
|
var currentGridPage = api.paginationGetCurrentPage();
|
|
49337
49502
|
var currentGridSize = api.paginationGetPageSize();
|
|
@@ -49344,8 +49509,12 @@ function AgGridTableInner(props) {
|
|
|
49344
49509
|
},
|
|
49345
49510
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49346
49511
|
[serverSidePagination, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.currentPage, serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize]);
|
|
49512
|
+
// onPaginationChanged — only relevant for NON-server-side mode
|
|
49347
49513
|
var onPaginationChanged = React.useCallback(function (event) {
|
|
49348
|
-
|
|
49514
|
+
// When serverSidePagination is true, AG Grid's pagination is disabled;
|
|
49515
|
+
// our custom bar handles page changes directly. Ignore all grid events.
|
|
49516
|
+
if (serverSidePagination) return;
|
|
49517
|
+
if (!serverSideConfig || !event.api) return;
|
|
49349
49518
|
if (event.newData) return;
|
|
49350
49519
|
if (isPaginationFromExternalRef.current) {
|
|
49351
49520
|
isPaginationFromExternalRef.current = false;
|
|
@@ -49416,45 +49585,57 @@ function AgGridTableInner(props) {
|
|
|
49416
49585
|
width: "100%"
|
|
49417
49586
|
};
|
|
49418
49587
|
}, [height]);
|
|
49419
|
-
|
|
49420
|
-
|
|
49421
|
-
|
|
49422
|
-
|
|
49423
|
-
|
|
49424
|
-
|
|
49425
|
-
|
|
49426
|
-
|
|
49427
|
-
|
|
49428
|
-
columnDefs: columnDefsWithVisibility,
|
|
49429
|
-
getRowId: function getRowId(params) {
|
|
49430
|
-
return _getRowId(params.data);
|
|
49588
|
+
// When serverSidePagination is true, disable AG Grid's built-in pagination.
|
|
49589
|
+
// We render our own bar below with proper React click handlers.
|
|
49590
|
+
var useGridPagination = !serverSidePagination && pagination;
|
|
49591
|
+
return require$$1.jsxs(require$$1.Fragment, {
|
|
49592
|
+
children: [require$$1.jsx("div", {
|
|
49593
|
+
className: "".concat(AG_GRID_THEME_CLASS, " ag-grid-table-wrapper ").concat(className),
|
|
49594
|
+
style: containerStyle !== null && containerStyle !== void 0 ? containerStyle : {
|
|
49595
|
+
height: "100%",
|
|
49596
|
+
width: "100%"
|
|
49431
49597
|
},
|
|
49432
|
-
|
|
49433
|
-
|
|
49434
|
-
|
|
49435
|
-
|
|
49436
|
-
|
|
49437
|
-
|
|
49438
|
-
|
|
49439
|
-
|
|
49440
|
-
|
|
49441
|
-
|
|
49442
|
-
|
|
49443
|
-
|
|
49444
|
-
|
|
49445
|
-
|
|
49446
|
-
|
|
49447
|
-
|
|
49448
|
-
|
|
49449
|
-
|
|
49450
|
-
|
|
49451
|
-
|
|
49452
|
-
|
|
49453
|
-
|
|
49454
|
-
|
|
49455
|
-
|
|
49598
|
+
children: require$$1.jsx(agGridReact.AgGridReact, {
|
|
49599
|
+
ref: gridRef,
|
|
49600
|
+
rowData: rowData,
|
|
49601
|
+
columnDefs: columnDefsWithVisibility,
|
|
49602
|
+
getRowId: function getRowId(params) {
|
|
49603
|
+
return _getRowId(params.data);
|
|
49604
|
+
},
|
|
49605
|
+
loading: loading,
|
|
49606
|
+
overlayNoRowsTemplate: "<span class=\"ag-overlay-no-rows-center\">".concat(escapeOverlayText(emptyMessage), "</span>"),
|
|
49607
|
+
rowSelection: getRowSelectionOption(rowSelection, serverSidePagination),
|
|
49608
|
+
popupParent: typeof document !== "undefined" ? document.body : null,
|
|
49609
|
+
onGridReady: onGridReady,
|
|
49610
|
+
onSortChanged: onSortChanged,
|
|
49611
|
+
onPaginationChanged: useGridPagination ? onPaginationChanged : undefined,
|
|
49612
|
+
onSelectionChanged: rowSelection !== false ? onSelectionChanged : undefined,
|
|
49613
|
+
defaultColDef: Object.assign({
|
|
49614
|
+
sortable: false,
|
|
49615
|
+
resizable: true
|
|
49616
|
+
}, defaultColDef),
|
|
49617
|
+
domLayout: domLayout,
|
|
49618
|
+
rowHeight: 60,
|
|
49619
|
+
suppressRowTransform: true,
|
|
49620
|
+
headerHeight: 44,
|
|
49621
|
+
pagination: useGridPagination,
|
|
49622
|
+
paginationPageSize: useGridPagination ? (_a = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSize) !== null && _a !== void 0 ? _a : 10 : undefined,
|
|
49623
|
+
paginationPageSizeSelector: useGridPagination ? (_b = serverSideConfig === null || serverSideConfig === void 0 ? void 0 : serverSideConfig.pageSizeSelector) !== null && _b !== void 0 ? _b : DEFAULT_PAGE_SIZE_SELECTOR : undefined,
|
|
49624
|
+
cacheBlockSize: cacheBlockSize,
|
|
49625
|
+
pinnedBottomRowData: footerData === null || footerData === void 0 ? void 0 : footerData.map(function (row, i) {
|
|
49626
|
+
return _typeof(row) === "object" && row !== null && !("id" in row) ? Object.assign(Object.assign({}, row), {
|
|
49627
|
+
id: "pinned-bottom-".concat(i)
|
|
49628
|
+
}) : row;
|
|
49629
|
+
})
|
|
49456
49630
|
})
|
|
49457
|
-
})
|
|
49631
|
+
}), serverSidePagination && serverSideConfig && require$$1.jsx(ServerSidePaginationBar, {
|
|
49632
|
+
totalCount: serverSideConfig.totalCount,
|
|
49633
|
+
currentPage: serverSideConfig.currentPage,
|
|
49634
|
+
pageSize: serverSideConfig.pageSize,
|
|
49635
|
+
onPageChange: serverSideConfig.onPageChange,
|
|
49636
|
+
onPageSizeChange: serverSideConfig.onPageSizeChange,
|
|
49637
|
+
pageSizeSelector: serverSideConfig.pageSizeSelector
|
|
49638
|
+
})]
|
|
49458
49639
|
});
|
|
49459
49640
|
}
|
|
49460
49641
|
var AgGridTable = AgGridTableInner;
|