trotl-table 1.0.65 → 1.0.66

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/Table.cjs.js CHANGED
@@ -9640,6 +9640,7 @@ function TableInner({
9640
9640
  data = [],
9641
9641
  isGrouped = false,
9642
9642
  groupKey = "groupId",
9643
+ routePath = null,
9643
9644
  extraSearchTerm = "",
9644
9645
  rowHeight = 34,
9645
9646
  groupHeaderHeight = 36,
@@ -9798,7 +9799,12 @@ function TableInner({
9798
9799
  setSearchTerm(extraSearchTerm);
9799
9800
  return;
9800
9801
  }
9802
+ const pagePath = routePath || null;
9801
9803
  const updateSearchFromUrl = () => {
9804
+ // prevent clearing filter when we're navigating away from this table route
9805
+ if (pagePath && window.location.pathname !== pagePath) {
9806
+ return;
9807
+ }
9802
9808
  const params = new URLSearchParams(window.location.search);
9803
9809
  const entrySearch = params.get("entry");
9804
9810
  const urlSearch = params.get("search");
@@ -10315,50 +10321,32 @@ function TableInner({
10315
10321
  }));
10316
10322
  }
10317
10323
 
10318
- // Input column type (editable text)
10319
- if (col && col.type === 'input') {
10320
- const text = isNoData ? "" : v == null ? "" : String(v);
10321
- return /*#__PURE__*/React.createElement("input", {
10322
- type: "text",
10323
- className: "table-cell-input",
10324
- value: text,
10325
- placeholder: isNoData ? "..." : undefined,
10326
- title: isNoData ? translate("noData") : text,
10327
- onClick: e => {
10328
- e.stopPropagation();
10329
- triggerCellCallback(row, col, text);
10330
- },
10331
- onChange: e => {
10332
- const next = e.target.value;
10333
- setLocalData(prev => {
10334
- if (isGrouped) {
10335
- return prev.map(g => ({
10336
- ...g,
10337
- rows: (g.rows || []).map(r => r.id === row.id ? {
10338
- ...r,
10339
- [accessor]: next
10340
- } : r)
10341
- }));
10342
- }
10343
- return (prev || []).map(r => r.id === row.id ? {
10344
- ...r,
10345
- [accessor]: next
10346
- } : r);
10347
- });
10348
- refreshTriggerRef.current?.();
10349
- try {
10350
- onCellChangeRef.current?.(row, accessor, next);
10351
- } catch (err) {
10352
- console.error('onCellChange error', err);
10353
- }
10354
- },
10324
+ // Color column type (display color swatch background)
10325
+ if (col && col.type === 'color') {
10326
+ const colorVal = v || "transparent";
10327
+ const text = String(colorVal) ;
10328
+ return /*#__PURE__*/React.createElement("div", {
10355
10329
  style: {
10356
- border: "1px solid var(--border-light, #ccc)",
10357
- padding: "2px 4px"
10358
- }
10359
- });
10330
+ width: '100%',
10331
+ height: '100%',
10332
+ minHeight: '20px',
10333
+ backgroundColor: colorVal,
10334
+ color: '#000',
10335
+ border: '1px solid #ccc',
10336
+ boxSizing: 'border-box',
10337
+ display: 'flex',
10338
+ alignItems: 'center',
10339
+ justifyContent: 'center',
10340
+ fontSize: '12px',
10341
+ overflow: 'hidden'
10342
+ },
10343
+ title: isNoData ? translate("noData") : text,
10344
+ onClick: () => triggerCellCallback(row, col, colorVal)
10345
+ }, text);
10360
10346
  }
10361
- if (isNoData) {
10347
+
10348
+ // Input column type (editable text)
10349
+ if (col && col.type === 'input') {
10362
10350
  return /*#__PURE__*/React.createElement("span", {
10363
10351
  title: translate("noData")
10364
10352
  }, "...");