@equinor/apollo-components 1.2.2 → 1.3.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.
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ interface DataTableConfig {
31
31
  height?: string;
32
32
  sortable?: boolean;
33
33
  virtual?: boolean;
34
- enableRowSelection?: boolean;
34
+ rowSelection?: 'multiple' | 'single';
35
35
  width?: string;
36
36
  }
37
37
 
package/dist/index.js CHANGED
@@ -278,11 +278,11 @@ function getColumnHeader(column) {
278
278
  return typeof columnHeader === "string" ? columnHeader : column.id;
279
279
  }
280
280
  function prependSelectColumnIfEnabled(columns, config) {
281
- if (!(config == null ? void 0 : config.enableRowSelection))
281
+ if (!Boolean(config == null ? void 0 : config.rowSelection))
282
282
  return columns;
283
283
  const selectColumn = {
284
284
  id: "select",
285
- header: ({ table }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
285
+ header: ({ table }) => (config == null ? void 0 : config.rowSelection) === "multiple" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
286
286
  style: { width: "48px" },
287
287
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Checkbox, {
288
288
  checked: table.getIsAllRowsSelected(),
@@ -290,7 +290,7 @@ function prependSelectColumnIfEnabled(columns, config) {
290
290
  "aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
291
291
  onChange: table.getToggleAllRowsSelectedHandler()
292
292
  })
293
- }),
293
+ }) : null,
294
294
  cell: ({ row }) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", {
295
295
  style: { width: "48px" },
296
296
  children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_eds_core_react6.Checkbox, {
@@ -600,6 +600,7 @@ function DataTable({ columns, data, header, filters, config }) {
600
600
  columnVisibility
601
601
  },
602
602
  onRowSelectionChange: setRowSelectionState,
603
+ enableMultiRowSelection: (config == null ? void 0 : config.rowSelection) === "multiple",
603
604
  enableSorting: config == null ? void 0 : config.sortable,
604
605
  onSortingChange: enableOrUndefined(config == null ? void 0 : config.sortable, setSorting),
605
606
  getSortedRowModel: (0, import_react_table4.getSortedRowModel)(),
package/dist/index.mjs CHANGED
@@ -245,11 +245,11 @@ function getColumnHeader(column) {
245
245
  return typeof columnHeader === "string" ? columnHeader : column.id;
246
246
  }
247
247
  function prependSelectColumnIfEnabled(columns, config) {
248
- if (!(config == null ? void 0 : config.enableRowSelection))
248
+ if (!Boolean(config == null ? void 0 : config.rowSelection))
249
249
  return columns;
250
250
  const selectColumn = {
251
251
  id: "select",
252
- header: ({ table }) => /* @__PURE__ */ jsx7("div", {
252
+ header: ({ table }) => (config == null ? void 0 : config.rowSelection) === "multiple" ? /* @__PURE__ */ jsx7("div", {
253
253
  style: { width: "48px" },
254
254
  children: /* @__PURE__ */ jsx7(Checkbox, {
255
255
  checked: table.getIsAllRowsSelected(),
@@ -257,7 +257,7 @@ function prependSelectColumnIfEnabled(columns, config) {
257
257
  "aria-label": table.getIsAllRowsSelected() ? "Deselect all rows" : "Select all rows",
258
258
  onChange: table.getToggleAllRowsSelectedHandler()
259
259
  })
260
- }),
260
+ }) : null,
261
261
  cell: ({ row }) => /* @__PURE__ */ jsx7("div", {
262
262
  style: { width: "48px" },
263
263
  children: /* @__PURE__ */ jsx7(Checkbox, {
@@ -567,6 +567,7 @@ function DataTable({ columns, data, header, filters, config }) {
567
567
  columnVisibility
568
568
  },
569
569
  onRowSelectionChange: setRowSelectionState,
570
+ enableMultiRowSelection: (config == null ? void 0 : config.rowSelection) === "multiple",
570
571
  enableSorting: config == null ? void 0 : config.sortable,
571
572
  onSortingChange: enableOrUndefined(config == null ? void 0 : config.sortable, setSorting),
572
573
  getSortedRowModel: getSortedRowModel(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/apollo-components",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "license": "MIT",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",