@equinor/apollo-components 1.5.2 → 1.6.1

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.d.ts CHANGED
@@ -25,8 +25,9 @@ declare const ChipsCell: (props: {
25
25
  declare type TableCellProps<T> = {
26
26
  cell: Cell<T, unknown>;
27
27
  highlight?: boolean;
28
+ getStickyCellColor?: (cell: Cell<T, unknown>) => string;
28
29
  };
29
- declare function DynamicCell<T>({ cell, highlight }: TableCellProps<T>): JSX.Element;
30
+ declare function DynamicCell<T>({ cell, highlight, getStickyCellColor }: TableCellProps<T>): JSX.Element;
30
31
 
31
32
  declare type HierarchyCellOptions = {
32
33
  getRowDepth?: () => number;
@@ -42,6 +43,7 @@ interface HeaderConfig {
42
43
  interface FilterConfig {
43
44
  globalFilter?: boolean;
44
45
  globalFilterPlaceholder?: string;
46
+ filterFromLeafRows?: boolean;
45
47
  }
46
48
  declare type RowSelectionMode = 'single' | 'multiple';
47
49
  declare type DataTableConfig<T> = {
package/dist/index.js CHANGED
@@ -224,13 +224,14 @@ var StyledStickyCell = (0, import_styled_components6.default)(StickyCell)`
224
224
  ${leftCellShadow}
225
225
  `;
226
226
  var StyledCell = (0, import_styled_components6.default)(import_eds_core_react4.Table.Cell)`
227
- background-color: ${(props) => props.backgroundColor ? props.backgroundColor + " !important" : void 0};
227
+ ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
228
228
  `;
229
- function DynamicCell({ cell, highlight }) {
229
+ function DynamicCell({ cell, highlight, getStickyCellColor }) {
230
230
  var _a;
231
231
  const cellContent = (0, import_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext());
232
232
  if ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.sticky) {
233
233
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(StyledStickyCell, {
234
+ backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell),
234
235
  "data-column": cell.column.id,
235
236
  children: cellContent
236
237
  });
@@ -548,6 +549,8 @@ function BasicTable({ table, config, stickyHeader, isLoading }) {
548
549
  }),
549
550
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Table.Body, {
550
551
  children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_eds_core_react10.Table.Row, {
552
+ active: row.getIsSelected(),
553
+ style: { cursor: (config == null ? void 0 : config.onRowClick) ? "pointer" : "initial" },
551
554
  onClick: () => {
552
555
  var _a;
553
556
  return (_a = config == null ? void 0 : config.onRowClick) == null ? void 0 : _a.call(config, row);
@@ -837,6 +840,7 @@ function VirtualTable({ table, config, containerRef, ...props }) {
837
840
  const row = rows[virtualRow.index];
838
841
  return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_eds_core_react15.Table.Row, {
839
842
  active: row.getIsSelected(),
843
+ style: { cursor: (config == null ? void 0 : config.onRowClick) ? "pointer" : "initial" },
840
844
  onClick: () => {
841
845
  var _a2;
842
846
  return (_a2 = config == null ? void 0 : config.onRowClick) == null ? void 0 : _a2.call(config, row);
@@ -910,6 +914,7 @@ function DataTable({
910
914
  enableExpanding: !(config == null ? void 0 : config.hideExpandControls),
911
915
  enableMultiRowSelection: (config == null ? void 0 : config.rowSelectionMode) === "multiple",
912
916
  enableSubRowSelection: (config == null ? void 0 : config.rowSelectionMode) !== "single",
917
+ filterFromLeafRows: filters == null ? void 0 : filters.filterFromLeafRows,
913
918
  getFilteredRowModel: enableGlobalFilter((0, import_react_table5.getFilteredRowModel)()),
914
919
  getCoreRowModel: (0, import_react_table5.getCoreRowModel)(),
915
920
  getExpandedRowModel: (0, import_react_table5.getExpandedRowModel)(),
package/dist/index.mjs CHANGED
@@ -178,13 +178,14 @@ var StyledStickyCell = styled5(StickyCell)`
178
178
  ${leftCellShadow}
179
179
  `;
180
180
  var StyledCell = styled5(Table2.Cell)`
181
- background-color: ${(props) => props.backgroundColor ? props.backgroundColor + " !important" : void 0};
181
+ ${(props) => props.backgroundColor ? `background-color: ${props.backgroundColor} !important;` : ``}
182
182
  `;
183
- function DynamicCell({ cell, highlight }) {
183
+ function DynamicCell({ cell, highlight, getStickyCellColor }) {
184
184
  var _a;
185
185
  const cellContent = flexRender(cell.column.columnDef.cell, cell.getContext());
186
186
  if ((_a = cell.column.columnDef.meta) == null ? void 0 : _a.sticky) {
187
187
  return /* @__PURE__ */ jsx4(StyledStickyCell, {
188
+ backgroundColor: getStickyCellColor == null ? void 0 : getStickyCellColor(cell),
188
189
  "data-column": cell.column.id,
189
190
  children: cellContent
190
191
  });
@@ -510,6 +511,8 @@ function BasicTable({ table, config, stickyHeader, isLoading }) {
510
511
  }),
511
512
  /* @__PURE__ */ jsx11(EdsTable.Body, {
512
513
  children: tableRows.length ? tableRows.map((row) => /* @__PURE__ */ jsx11(EdsTable.Row, {
514
+ active: row.getIsSelected(),
515
+ style: { cursor: (config == null ? void 0 : config.onRowClick) ? "pointer" : "initial" },
513
516
  onClick: () => {
514
517
  var _a;
515
518
  return (_a = config == null ? void 0 : config.onRowClick) == null ? void 0 : _a.call(config, row);
@@ -799,6 +802,7 @@ function VirtualTable({ table, config, containerRef, ...props }) {
799
802
  const row = rows[virtualRow.index];
800
803
  return /* @__PURE__ */ jsx16(Table8.Row, {
801
804
  active: row.getIsSelected(),
805
+ style: { cursor: (config == null ? void 0 : config.onRowClick) ? "pointer" : "initial" },
802
806
  onClick: () => {
803
807
  var _a2;
804
808
  return (_a2 = config == null ? void 0 : config.onRowClick) == null ? void 0 : _a2.call(config, row);
@@ -872,6 +876,7 @@ function DataTable({
872
876
  enableExpanding: !(config == null ? void 0 : config.hideExpandControls),
873
877
  enableMultiRowSelection: (config == null ? void 0 : config.rowSelectionMode) === "multiple",
874
878
  enableSubRowSelection: (config == null ? void 0 : config.rowSelectionMode) !== "single",
879
+ filterFromLeafRows: filters == null ? void 0 : filters.filterFromLeafRows,
875
880
  getFilteredRowModel: enableGlobalFilter(getFilteredRowModel()),
876
881
  getCoreRowModel: getCoreRowModel(),
877
882
  getExpandedRowModel: getExpandedRowModel(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "1.5.2",
3
+ "version": "1.6.1",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -20,8 +20,8 @@
20
20
  "@equinor/eds-core-react": "^0.27.0",
21
21
  "@equinor/eds-icons": "^0.15.0",
22
22
  "@equinor/eds-tokens": "^0.9.0",
23
- "@tanstack/match-sorter-utils": "^8.5.14",
24
- "@tanstack/react-table": "^8.5.15",
23
+ "@tanstack/match-sorter-utils": "^8.7.6",
24
+ "@tanstack/react-table": "^8.7.6",
25
25
  "@tanstack/react-virtual": "^3.0.0-beta.23",
26
26
  "jotai": "^1.10.0",
27
27
  "styled-components": "^5.3.6",