@homebound/beam 2.190.0 → 2.190.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.
@@ -101,7 +101,7 @@ export interface GridTableProps<R extends Kinded, S, X> {
101
101
  activeRowId?: string;
102
102
  /**
103
103
  * Defines which cell in the table should be provided with an "active" styling.
104
- * Expected format is `${row.kind}_${row.id}_${column.name}`.
104
+ * Expected format is `${row.kind}_${row.id}_${column.id}`.
105
105
  */
106
106
  activeCellId?: string;
107
107
  }
@@ -21,17 +21,17 @@ function EditColumnsButton(props) {
21
21
  // Only include options that can be hidden and have the `name` property defined.
22
22
  if (!column.canHide)
23
23
  return acc;
24
- if (!column.name || column.name.length === 0) {
24
+ if (!column.id || column.id.length === 0) {
25
25
  console.warn("Column is missing 'name' property required by the Edit Columns button", column);
26
26
  return acc;
27
27
  }
28
28
  // Add current column as an option
29
- return { ...acc, options: acc.options.concat({ label: column.name, value: column.name }) };
29
+ return { ...acc, options: acc.options.concat({ label: column.id, value: column.id }) };
30
30
  }, { options: [] });
31
31
  }, [allColumns]);
32
- const selectedValues = selectedColumns.map((column) => column.name);
32
+ const selectedValues = selectedColumns.map((column) => column.id);
33
33
  const setSelectedValues = (0, react_1.useCallback)((values) => {
34
- setSelectedColumns(allColumns.filter((column) => (column.canHide ? values.includes(column.name) : true)));
34
+ setSelectedColumns(allColumns.filter((column) => (column.canHide ? values.includes(column.id) : true)));
35
35
  }, [allColumns, setSelectedColumns]);
36
36
  return ((0, jsx_runtime_1.jsx)(OverlayTrigger_1.OverlayTrigger, Object.assign({}, props, { menuTriggerProps: menuTriggerProps, state: state, buttonRef: buttonRef }, tid, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ css: {
37
37
  ...Css_1.Css.bgWhite.py5.px3.maxwPx(380).bshBasic.$,
@@ -100,8 +100,8 @@ function RowImpl(props) {
100
100
  : {}),
101
101
  }
102
102
  : {};
103
- const cellId = `${row.kind}_${row.id}_${column.name}`;
104
- const applyCellHighlight = cellHighlight && !!column.name && !isHeader && !isTotals;
103
+ const cellId = `${row.kind}_${row.id}_${column.id}`;
104
+ const applyCellHighlight = cellHighlight && !!column.id && !isHeader && !isTotals;
105
105
  const isCellActive = rowState.activeCellId === cellId;
106
106
  // Note that it seems expensive to calc a per-cell class name/CSS-in-JS output,
107
107
  // vs. setting global/table-wide CSS like `style.cellCss` on the root grid div with
@@ -6,27 +6,27 @@ const react_1 = require("react");
6
6
  const useSessionStorage_1 = require("../../../hooks/useSessionStorage");
7
7
  function useColumns(tableColumns, maybeStorageKey) {
8
8
  const { selectedColumns, hideColumns } = tableColumns.reduce((acc, column) => {
9
- // Only include options that can be hidden and have the `name` property defined.
10
- if (!column.name || column.name.length === 0) {
11
- console.warn("Column is missing 'name' property required by the Edit Columns button", column);
9
+ // Only include options that can be hidden and have the `id` property defined.
10
+ if (!column.id || column.id.length === 0) {
11
+ console.warn("Column is missing 'id' property required by the Edit Columns button", column);
12
12
  return acc;
13
13
  }
14
14
  // Add hide-able columns
15
15
  if (column.canHide) {
16
- acc.hideColumns.push(column.name);
16
+ acc.hideColumns.push(column.id);
17
17
  }
18
18
  // Add selected columns
19
19
  if (!column.canHide || (column.canHide && column.initVisible)) {
20
- acc.selectedColumns.push(column.name);
20
+ acc.selectedColumns.push(column.id);
21
21
  }
22
22
  return { ...acc };
23
23
  }, { selectedColumns: [], hideColumns: [] });
24
24
  const storageKey = maybeStorageKey !== null && maybeStorageKey !== void 0 ? maybeStorageKey : (0, change_case_1.camelCase)(hideColumns.map((c) => c).join(""));
25
25
  const [storageNames, setStorageNames] = (0, useSessionStorage_1.useSessionStorage)(storageKey, selectedColumns);
26
- const storageColumns = storageNames && storageNames.map((sc) => tableColumns.find((column) => column.name === sc));
26
+ const storageColumns = storageNames && storageNames.map((sc) => tableColumns.find((column) => column.id === sc));
27
27
  const [columns, setColumns] = (0, react_1.useState)(storageColumns);
28
28
  (0, react_1.useEffect)(() => {
29
- setStorageNames(columns.map((column) => column.name));
29
+ setStorageNames(columns.map((column) => column.id));
30
30
  }, [columns]);
31
31
  return [columns, setColumns];
32
32
  }
@@ -64,8 +64,8 @@ export declare type GridColumn<R extends Kinded, S = {}> = {
64
64
  wrapAction?: false;
65
65
  /** Used as a signal to defer adding the 'indent' styling */
66
66
  isAction?: true;
67
- /** Column name that will be used to generate an unique identifier for every row cell */
68
- name?: string;
67
+ /** Column id that will be used to generate an unique identifier for every row cell */
68
+ id?: string;
69
69
  /** Flag that will allow to know which columns are hide-able */
70
70
  canHide?: boolean;
71
71
  /** Flag that will allow to know which hide-able columns are visible on initial load */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.190.0",
3
+ "version": "2.190.1",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",