@darajs/core 1.23.2-alpha.1 → 1.24.0

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.
@@ -39079,8 +39079,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39079
39079
  style: Object.assign(Object.assign(Object.assign({}, floatingStyles), { maxHeight: 800, minWidth: 150, zIndex: 9999 }), style)
39080
39080
  }), { isOpen, children: jsxRuntimeExports.jsx(SectionedList, { items: allowColumnHiding ? [resetFunctions, columnToggles] : [resetFunctions], onSelect: onOptionSelect }, isOpen ? "open" : "closed") })), document.body)] });
39081
39081
  };
39082
- const { fontSize } = window.getComputedStyle(document.documentElement);
39083
- const DEFAULT_ROW_HEIGHT = parseFloat(fontSize) * 2.5;
39084
39082
  var __rest$1 = function(s, e2) {
39085
39083
  var t2 = {};
39086
39084
  for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2) && e2.indexOf(p2) < 0)
@@ -39092,6 +39090,8 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39092
39090
  }
39093
39091
  return t2;
39094
39092
  };
39093
+ const { fontSize } = window.getComputedStyle(document.documentElement);
39094
+ const ROW_HEIGHT = parseFloat(fontSize) * 2.5;
39095
39095
  const shouldForwardProp$2 = (prop) => !["isSorted", "onClickRow"].includes(prop);
39096
39096
  const Row = styled.div.withConfig({ shouldForwardProp: shouldForwardProp$2 })`
39097
39097
  cursor: ${(props) => props.onClickRow ? "pointer" : "default"};
@@ -39147,7 +39147,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39147
39147
  align-items: center;
39148
39148
 
39149
39149
  min-width: 80px;
39150
- height: ${({ rowHeight }) => `${rowHeight}px`};
39150
+ height: ${() => `${ROW_HEIGHT}px`};
39151
39151
 
39152
39152
  color: ${(props) => props.theme.colors.grey6};
39153
39153
 
@@ -39171,7 +39171,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39171
39171
  var _a;
39172
39172
  return areEqual(prevProps, nextProps) && !(((_a = nextProps.data) === null || _a === void 0 ? void 0 : _a.headerGroups) || []).some((headerGroup) => ((headerGroup === null || headerGroup === void 0 ? void 0 : headerGroup.headers) || []).some((header) => header.isResizing));
39173
39173
  };
39174
- const RenderRow = React__namespace.memo(({ data: { width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns, rowHeight }, index: index2, style: renderRowStyle }) => {
39174
+ const RenderRow = React__namespace.memo(({ data: { width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns }, index: index2, style: renderRowStyle }) => {
39175
39175
  let row = rows[index2];
39176
39176
  if (getItem) {
39177
39177
  const value = getItem(index2);
@@ -39184,8 +39184,8 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39184
39184
  }
39185
39185
  if (!row) {
39186
39186
  return jsxRuntimeExports.jsx("div", { children: headerGroups.map((headerGroup, gidx) => jsxRuntimeExports.jsx(RowPlaceholder, { style: {
39187
- height: rowHeight,
39188
- top: (index2 + 1) * rowHeight,
39187
+ height: ROW_HEIGHT,
39188
+ top: (index2 + 1) * ROW_HEIGHT,
39189
39189
  width: totalColumnsWidth > width ? totalColumnsWidth : "100%"
39190
39190
  }, children: headerGroup === null || headerGroup === void 0 ? void 0 : headerGroup.headers.map((col, cidx) => {
39191
39191
  const headerProps = col.getHeaderProps();
@@ -39203,23 +39203,15 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39203
39203
  }
39204
39204
  };
39205
39205
  const _a = row.getRowProps({ style: renderRowStyle }), { style: rowStyle } = _a, restRow = __rest$1(_a, ["style"]);
39206
- return React$1.createElement(Row, Object.assign({}, restRow, { key: `row-${index2}`, onClick, onClickRow, style: Object.assign(Object.assign({}, rowStyle), {
39207
- // The first row is the header row which is not controlled by this rowHeight prop so it needs to be part of the calculation.
39208
- top: index2 === 0 ? DEFAULT_ROW_HEIGHT : index2 * rowHeight + DEFAULT_ROW_HEIGHT,
39209
- width: totalColumnsWidth > width ? totalColumnsWidth : "100%"
39210
- }) }), row.cells.map((cell, colIdx) => {
39211
- var _a2, _b, _c, _d, _e2;
39206
+ return React$1.createElement(Row, Object.assign({}, restRow, { key: `row-${index2}`, onClick, onClickRow, style: Object.assign(Object.assign({}, rowStyle), { top: (index2 + 1) * ROW_HEIGHT, width: totalColumnsWidth > width ? totalColumnsWidth : "100%" }) }), row.cells.map((cell, colIdx) => {
39207
+ var _a2;
39212
39208
  const cellProps = cell.getCellProps();
39213
39209
  return React$1.createElement(
39214
39210
  Cell,
39215
- Object.assign({}, cellProps, { rowHeight, key: `cell-${index2}-${colIdx}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, cellProps.style), { backgroundColor, justifyContent: mappedColumns[colIdx].align, maxWidth: (_a2 = cell.column) === null || _a2 === void 0 ? void 0 : _a2.maxWidth, width: (
39211
+ Object.assign({}, cellProps, { key: `cell-${index2}-${colIdx}`, style: Object.assign(Object.assign({}, cellProps.style), { backgroundColor, justifyContent: mappedColumns[colIdx].align, maxWidth: (_a2 = cell.column) === null || _a2 === void 0 ? void 0 : _a2.maxWidth, width: (
39216
39212
  // If width calc has messed up then use the raw width from the column
39217
39213
  cellProps.style.width === "NaNpx" ? mappedColumns[colIdx].width : cellProps.style.width
39218
- ) }), ((_b = mappedColumns[colIdx]) === null || _b === void 0 ? void 0 : _b.sticky) === "left" && typeof ((_c = mappedColumns[colIdx]) === null || _c === void 0 ? void 0 : _c.stickyOffset) === "number" ? {
39219
- left: `${mappedColumns[colIdx].stickyOffset}px`
39220
- } : {}), ((_d = mappedColumns[colIdx]) === null || _d === void 0 ? void 0 : _d.sticky) === "right" && typeof ((_e2 = mappedColumns[colIdx]) === null || _e2 === void 0 ? void 0 : _e2.stickyOffset) === "number" ? {
39221
- right: `${mappedColumns[colIdx].stickyOffset}px`
39222
- } : {}) }),
39214
+ ) }) }),
39223
39215
  jsxRuntimeExports.jsx(CellContent, { children: cell.render("Cell", {
39224
39216
  colIdx,
39225
39217
  currentEditCell,
@@ -39300,7 +39292,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39300
39292
  justify-content: space-between;
39301
39293
 
39302
39294
  min-width: 80px;
39303
- height: ${DEFAULT_ROW_HEIGHT}px;
39295
+ height: ${ROW_HEIGHT}px;
39304
39296
 
39305
39297
  color: ${(props) => props.theme.colors.text};
39306
39298
 
@@ -39385,26 +39377,6 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39385
39377
  });
39386
39378
  return [...leftStickyCols, ...nonStickyCols, ...rightStickyCols];
39387
39379
  };
39388
- const appendStickyOffsets = (columns) => {
39389
- let leftOffset = 0;
39390
- let rightOffset = 0;
39391
- const rightStickyColumnWidths = columns.filter((col) => col.sticky === "right").slice(1).map((col) => parseInt(col.width) || 150);
39392
- return columns.map((col) => {
39393
- if (col.sticky === "left") {
39394
- const nextCol = Object.assign(Object.assign({}, col), { stickyOffset: leftOffset });
39395
- const width = parseInt(col.width) || 150;
39396
- leftOffset += width;
39397
- return nextCol;
39398
- }
39399
- if (col.sticky === "right") {
39400
- rightOffset = rightStickyColumnWidths.reduce((acc, width) => acc + width, 0);
39401
- const nextCol = Object.assign(Object.assign({}, col), { stickyOffset: rightOffset });
39402
- rightStickyColumnWidths.shift();
39403
- return nextCol;
39404
- }
39405
- return col;
39406
- });
39407
- };
39408
39380
  const filterComponentMap = {
39409
39381
  categorical: CategoricalFilter,
39410
39382
  datetime: DatetimeFilter,
@@ -39422,26 +39394,12 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39422
39394
  return Object.assign(Object.assign({}, col), { Filter: filterComponentMap[col.filter] });
39423
39395
  });
39424
39396
  };
39425
- const createActionColumn = (actions, accessor, sticky, disableSelectAll = false) => {
39426
- const width = actions.includes(Actions.SELECT) ? 52 : actions.length * 24 + 24;
39427
- return {
39428
- Cell: ActionCell,
39429
- Header: actions.includes(Actions.SELECT) && !disableSelectAll ? SelectHeader : "",
39430
- accessor: accessor || "actions",
39431
- actions,
39432
- disableSortBy: true,
39433
- maxWidth: width,
39434
- minWidth: actions.includes(Actions.SELECT) ? 52 : 48,
39435
- sticky: sticky || null,
39436
- width
39437
- };
39438
- };
39439
39397
  const cells = {
39440
39398
  DATETIME: DatetimeCell,
39441
39399
  EDIT_INPUT: EditInputCell,
39442
39400
  EDIT_SELECT: EditSelectCell
39443
39401
  };
39444
- const createItemData$1 = memoizeOne$1((width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns, rowHeight) => ({
39402
+ const createItemData$1 = memoizeOne$1((width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns) => ({
39445
39403
  backgroundColor,
39446
39404
  currentEditCell,
39447
39405
  getItem,
@@ -39450,14 +39408,12 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39450
39408
  onClickRow,
39451
39409
  prepareRow,
39452
39410
  rows,
39453
- rowHeight,
39454
39411
  throttledClickRow,
39455
39412
  totalColumnsWidth,
39456
39413
  width
39457
39414
  }));
39458
- const Table = React$1.forwardRef(({ allowHiding, actions, backgroundColor, className, columns, data: data2, getItem, initialSort = [], itemCount, maxRows, onAction, onChange: onChange2, onClickRow, onItemsRendered, onFilter, onSort, rowHeight, showTableOptions, style, tableOptionsStyle }, ref) => {
39415
+ const Table = React$1.forwardRef(({ allowHiding, backgroundColor, className, columns, data: data2, getItem, initialSort = [], itemCount, maxRows, onAction, onChange: onChange2, onClickRow, onItemsRendered, onFilter, onSort, showTableOptions, style, tableOptionsStyle }, ref) => {
39459
39416
  const [currentSortBy, setCurrentSortBy] = React$1.useState(initialSort);
39460
- const tableRowHeight = rowHeight || DEFAULT_ROW_HEIGHT;
39461
39417
  React$1.useEffect(
39462
39418
  () => {
39463
39419
  setCurrentSortBy(initialSort);
@@ -39487,14 +39443,7 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39487
39443
  throttledSetEditCell([Number(cell[0]), cell[1]]);
39488
39444
  };
39489
39445
  const infiniteData = React$1.useMemo(() => Array(itemCount).fill(0), [itemCount]);
39490
- const mappedColumns = React$1.useMemo(() => {
39491
- let processedColumns = columns;
39492
- if (actions && actions.length > 0) {
39493
- const actionColumn = createActionColumn(actions);
39494
- processedColumns = [...columns, actionColumn];
39495
- }
39496
- return appendStickyOffsets(appendFilterComponents(orderStickyCols(processedColumns)));
39497
- }, [columns, actions]);
39446
+ const mappedColumns = React$1.useMemo(() => appendFilterComponents(orderStickyCols(columns)), [columns]);
39498
39447
  const hasFixedColumns = React$1.useMemo(() => mappedColumns.some((column) => "sticky" in column), [mappedColumns]);
39499
39448
  const totalColumnsWidth = React$1.useMemo(() => mappedColumns.reduce((acc, column) => acc + (parseInt(column.width) || 150), 0), [mappedColumns]);
39500
39449
  const filterTypes = React$1.useMemo(() => ({
@@ -39550,15 +39499,11 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39550
39499
  const showHeaderCellButtonContainer = showSort || showFilter || showOptions;
39551
39500
  return React$1.createElement(
39552
39501
  HeaderCell,
39553
- Object.assign({}, headerProps, { key: `col-${gidx}-${cidx}`, style: Object.assign(Object.assign(Object.assign(Object.assign({}, headerProps.style), {
39502
+ Object.assign({}, headerProps, { key: `col-${gidx}-${cidx}`, style: Object.assign(Object.assign({}, headerProps.style), {
39554
39503
  maxWidth: col.maxWidth,
39555
39504
  // If width calc has messed up then use the raw width from the column
39556
39505
  width: headerProps.style.width === "NaNpx" ? mappedColumns[cidx].width : headerProps.style.width
39557
- }), col.sticky === "left" && typeof col.stickyOffset === "number" ? {
39558
- left: `${col.stickyOffset}px`
39559
- } : {}), col.sticky === "right" && typeof col.stickyOffset === "number" ? {
39560
- right: `${col.stickyOffset}px`
39561
- } : {}) }),
39506
+ }) }),
39562
39507
  jsxRuntimeExports.jsxs(HeaderTooltipContainer, { isPrimitiveHeader: typeof headerContent === "string", children: [jsxRuntimeExports.jsx(HeaderContentWrapper, Object.assign({}, sortProps, { isPrimitiveHeader: typeof headerContent === "string", title: typeof headerContent === "string" ? headerContent : "", children: headerContent })), col.tooltip && jsxRuntimeExports.jsx(Tooltip, { content: col.tooltip, children: jsxRuntimeExports.jsx(TooltipIcon, { icon: faCircleQuestion }) })] }),
39563
39508
  showHeaderCellButtonContainer && jsxRuntimeExports.jsxs(HeaderCellButtonContainer, { children: [jsxRuntimeExports.jsxs(HeaderIconsWrapper, { children: [showSort && jsxRuntimeExports.jsx(HeaderIconWrapper, { children: jsxRuntimeExports.jsx(SortIcon, Object.assign({}, sortProps, { className: "tableSortArrow", icon: getSortIcon(col.isSorted, col.isSortedDesc), isSorted: col.isSorted })) }), showFilter ? jsxRuntimeExports.jsx(FilterContainer, { col }) : null, showOptions && jsxRuntimeExports.jsx(OptionsMenu, { allColumns, allowColumnHiding: allowHiding, numVisibleColumns, resetResizing, setAllFilters, style: tableOptionsStyle })] }), jsxRuntimeExports.jsx(ResizeBorder, Object.assign({}, resizerProps))] })
39564
39509
  );
@@ -39567,15 +39512,28 @@ You must set sticky: 'left' | 'right' for the '${bugWithUnderColumnsSticky.Heade
39567
39512
  // eslint-disable-next-line react-hooks/exhaustive-deps
39568
39513
  useDeepCompare([tableProps, totalColumnsWidth, headerGroups])
39569
39514
  );
39570
- return jsxRuntimeExports.jsx(Wrapper$2, Object.assign({}, getTableProps(), { "$hasMaxRows": !!maxRows, className: `${className} ${hasFixedColumns ? "sticky" : ""}`, style: Object.assign({ height: maxRows ? (Math.min(rows.length, maxRows) + 1) * tableRowHeight : "100%" }, style), children: jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => {
39571
- return jsxRuntimeExports.jsx(StyledFixedSizeList, { height, innerElementType: renderTable, itemCount: itemCount || rows.length, itemData: createItemData$1(width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns, tableRowHeight), itemSize: tableRowHeight, onItemsRendered, style: {
39515
+ return jsxRuntimeExports.jsx(Wrapper$2, Object.assign({}, getTableProps(), { "$hasMaxRows": !!maxRows, className: `${className} ${hasFixedColumns ? "sticky" : ""}`, style: Object.assign({ height: maxRows ? (Math.min(rows.length, maxRows) + 1) * ROW_HEIGHT : "100%" }, style), children: jsxRuntimeExports.jsx(AutoSizer, { children: ({ height, width }) => {
39516
+ return jsxRuntimeExports.jsx(StyledFixedSizeList, { height, innerElementType: renderTable, itemCount: itemCount || rows.length, itemData: createItemData$1(width, currentEditCell, headerGroups, rows, prepareRow, getItem, totalColumnsWidth, onClickRow, throttledClickRow, backgroundColor, mappedColumns), itemSize: ROW_HEIGHT, onItemsRendered, style: {
39572
39517
  overflowX: width < totalColumnsWidth ? "auto" : "hidden",
39573
- overflowY: height < (rows.length + 1) * tableRowHeight ? "auto" : "hidden"
39518
+ overflowY: height < (rows.length + 1) * ROW_HEIGHT ? "auto" : "hidden"
39574
39519
  }, width, children: RenderRow }, "table-list");
39575
39520
  } }) }));
39576
39521
  });
39577
39522
  Table.displayName = "Table";
39578
- Table.ActionColumn = createActionColumn;
39523
+ Table.ActionColumn = (actions, accessor, sticky, disableSelectAll = false) => {
39524
+ const width = actions.includes(Actions.SELECT) ? 52 : actions.length * 24 + 24;
39525
+ return {
39526
+ Cell: ActionCell,
39527
+ Header: actions.includes(Actions.SELECT) && !disableSelectAll ? SelectHeader : "",
39528
+ accessor: accessor || "actions",
39529
+ actions,
39530
+ disableSortBy: true,
39531
+ maxWidth: width,
39532
+ minWidth: actions.includes(Actions.SELECT) ? 52 : 48,
39533
+ sticky: sticky || null,
39534
+ width
39535
+ };
39536
+ };
39579
39537
  Table.Actions = Actions;
39580
39538
  Table.cells = cells;
39581
39539
  styled.div`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darajs/core",
3
- "version": "1.23.2-alpha.1",
3
+ "version": "1.24.0",
4
4
  "description": "Dara Framework core",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -39,9 +39,9 @@
39
39
  "@babel/preset-env": "^7.23.0",
40
40
  "@babel/preset-react": "^7.22.15",
41
41
  "@babel/preset-typescript": "^7.23.0",
42
- "@darajs/eslint-config": "1.23.2-alpha.1",
43
- "@darajs/prettier-config": "1.23.2-alpha.1",
44
- "@darajs/stylelint-config": "1.23.2-alpha.1",
42
+ "@darajs/eslint-config": "1.24.0",
43
+ "@darajs/prettier-config": "1.24.0",
44
+ "@darajs/stylelint-config": "1.24.0",
45
45
  "@rollup/plugin-inject": "^4.0.4",
46
46
  "@testing-library/dom": "^9.3.0",
47
47
  "@testing-library/jest-dom": "^6.0.0",
@@ -66,19 +66,19 @@
66
66
  "prettier": "^3.0.0",
67
67
  "react-test-renderer": "^17.0.2",
68
68
  "rimraf": "^3.0.2",
69
- "start-server-and-test": "^1.14.0",
69
+ "start-server-and-test": "^2.1.3",
70
70
  "stylelint": "^15.0.0",
71
71
  "tsc-alias": "^1.8.5",
72
- "vite": "7.0.4",
72
+ "vite": "7.0.8",
73
73
  "vitest": "^3.2.4",
74
74
  "vitest-websocket-mock": "^0.5.0",
75
75
  "whatwg-fetch": "^3.6.20"
76
76
  },
77
77
  "dependencies": {
78
- "@darajs/styled-components": "1.23.2-alpha.1",
79
- "@darajs/ui-components": "1.23.2-alpha.1",
80
- "@darajs/ui-notifications": "1.23.2-alpha.1",
81
- "@darajs/ui-utils": "1.23.2-alpha.1",
78
+ "@darajs/styled-components": "1.24.0",
79
+ "@darajs/ui-components": "1.24.0",
80
+ "@darajs/ui-notifications": "1.24.0",
81
+ "@darajs/ui-utils": "1.24.0",
82
82
  "@fortawesome/fontawesome-free": "~6.4.0",
83
83
  "@recoiljs/refine": "^0.1.1",
84
84
  "@tanstack/query-core": "^4.40.0",
@@ -117,5 +117,5 @@
117
117
  "engines": {
118
118
  "node": ">=20.19.0"
119
119
  },
120
- "gitHead": "b74533efadb8254c40fde6d3203d8c1e4bc6067a"
120
+ "gitHead": "b3effe1318255f1d68b4c59b5ef5afedc3288ade"
121
121
  }