@homebound/beam 2.132.0 → 2.132.3

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.
@@ -274,6 +274,11 @@ const renders = {
274
274
  /** Renders table using divs with flexbox rows, which is the default render */
275
275
  function renderDiv(style, id, columns, headerRows, totalsRows, filteredRows, firstRowMessage, _stickyHeader, firstLastColumnWidth, xss, _virtuosoRef, tableRef) {
276
276
  return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: tableRef, css: {
277
+ // Use `fit-content` to ensure the width of the table takes up the full width of its content.
278
+ // Otherwise, the table's width would be that of its container, which may not be as wide as the table itself.
279
+ // In cases where we have sticky columns on a very wide table, then the container which the columns "stick" to (which is the table),
280
+ // needs to be as wide as the table's content, or else we lose the "stickiness" once scrolling past width of the table's container.
281
+ ...Css_1.Css.mw("fit-content").$,
277
282
  /*
278
283
  Using (n + 3) here to target all rows that are after the first non-header row. Since n starts at 0, we can use
279
284
  the + operator as an offset.
@@ -126,19 +126,19 @@ class RowState {
126
126
  }
127
127
  // Should be called in an Observer/useComputed to trigger re-renders
128
128
  isCollapsed(id) {
129
- return this.collapsedRows.has(id) || this.collapsedRows.has("header");
129
+ return this.collapsedRows.has(id);
130
130
  }
131
131
  toggleCollapsed(id) {
132
132
  const collapsedIds = [...this.collapsedRows.values()];
133
133
  // We have different behavior when going from expand/collapse all.
134
134
  if (id === "header") {
135
- const isAllCollapsed = collapsedIds[0] === "header";
135
+ const isAllCollapsed = collapsedIds.includes("header");
136
136
  if (isAllCollapsed) {
137
137
  // Expand all means keep `collapsedIds` empty
138
138
  collapsedIds.splice(0, collapsedIds.length);
139
139
  }
140
140
  else {
141
- // Otherwise push `header` on the list as a hint that we're in the collapsed-all state
141
+ // Otherwise push `header` to the list as a hint that we're in the collapsed-all state
142
142
  collapsedIds.push("header");
143
143
  // Find all non-leaf rows so that toggling "all collapsed" -> "all not collapsed" opens
144
144
  // the parent rows of any level.
@@ -164,6 +164,16 @@ class RowState {
164
164
  else {
165
165
  collapsedIds.splice(i, 1);
166
166
  }
167
+ // If all rows have been expanded individually, but the 'header' was collapsed, then remove the header from the collapsedIds so it reverts to the expanded state
168
+ if (collapsedIds.length === 1 && collapsedIds[0] === "header") {
169
+ collapsedIds.splice(0, 1);
170
+ }
171
+ else {
172
+ // If every top level child has been collapsed, then push "header" into the array to be considered collapsed as well.
173
+ if (this.rows.every((maybeParent) => (maybeParent.children ? collapsedIds.includes(maybeParent.id) : true))) {
174
+ collapsedIds.push("header");
175
+ }
176
+ }
167
177
  }
168
178
  this.collapsedRows.replace(collapsedIds);
169
179
  if (this.persistCollapse) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.132.0",
3
+ "version": "2.132.3",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -116,6 +116,7 @@
116
116
  "identity-obj-proxy": "^3.0.0",
117
117
  "jest": "^26.6.3",
118
118
  "jest-chain": "^1.1.5",
119
+ "jest-watch-typeahead": "^0.6.5",
119
120
  "mobx": "^6.3.2",
120
121
  "mobx-react": "^7.2.0",
121
122
  "prettier": "^2.2.1",