trotl-table 1.0.64 → 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 +39 -39
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +39 -39
- package/dist/Table.esm.js.map +1 -1
- package/package.json +1 -1
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,
|
|
@@ -9701,6 +9702,7 @@ function TableInner({
|
|
|
9701
9702
|
yesDelete: "Yes, Delete",
|
|
9702
9703
|
areYouSureYouWantToDelete: "Are you sure you want to delete",
|
|
9703
9704
|
action: "Action",
|
|
9705
|
+
noData: "No Data",
|
|
9704
9706
|
DropHereToMoveIntoThisGroup: "Drop here to move into this group"
|
|
9705
9707
|
};
|
|
9706
9708
|
return translations[key] || key;
|
|
@@ -9797,7 +9799,12 @@ function TableInner({
|
|
|
9797
9799
|
setSearchTerm(extraSearchTerm);
|
|
9798
9800
|
return;
|
|
9799
9801
|
}
|
|
9802
|
+
const pagePath = routePath || null;
|
|
9800
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
|
+
}
|
|
9801
9808
|
const params = new URLSearchParams(window.location.search);
|
|
9802
9809
|
const entrySearch = params.get("entry");
|
|
9803
9810
|
const urlSearch = params.get("search");
|
|
@@ -10236,12 +10243,15 @@ function TableInner({
|
|
|
10236
10243
|
}
|
|
10237
10244
|
}, [getAccessorKey, getAccessorValue]);
|
|
10238
10245
|
const renderCell = React.useCallback((v, accessor, row, col) => {
|
|
10246
|
+
const isNoData = v === undefined;
|
|
10247
|
+
|
|
10239
10248
|
// Checkbox column type (editable in-table)
|
|
10240
10249
|
if (col && col.type === 'checkbox') {
|
|
10241
10250
|
const checked = !!v;
|
|
10242
10251
|
return /*#__PURE__*/React.createElement("input", {
|
|
10243
10252
|
type: "checkbox",
|
|
10244
10253
|
checked: checked,
|
|
10254
|
+
title: isNoData ? translate("noData") : undefined,
|
|
10245
10255
|
onClick: e => {
|
|
10246
10256
|
e.stopPropagation();
|
|
10247
10257
|
triggerCellCallback(row, col, checked);
|
|
@@ -10277,6 +10287,7 @@ function TableInner({
|
|
|
10277
10287
|
if (col && col.type === 'switch') {
|
|
10278
10288
|
const checked = !!v;
|
|
10279
10289
|
return /*#__PURE__*/React.createElement("div", {
|
|
10290
|
+
title: isNoData ? translate("noData") : undefined,
|
|
10280
10291
|
onClick: e => {
|
|
10281
10292
|
e.stopPropagation();
|
|
10282
10293
|
triggerCellCallback(row, col, checked);
|
|
@@ -10310,46 +10321,35 @@ function TableInner({
|
|
|
10310
10321
|
}));
|
|
10311
10322
|
}
|
|
10312
10323
|
|
|
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", {
|
|
10329
|
+
style: {
|
|
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);
|
|
10346
|
+
}
|
|
10347
|
+
|
|
10313
10348
|
// Input column type (editable text)
|
|
10314
10349
|
if (col && col.type === 'input') {
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
className: "table-cell-input",
|
|
10319
|
-
value: text,
|
|
10320
|
-
onClick: e => {
|
|
10321
|
-
e.stopPropagation();
|
|
10322
|
-
triggerCellCallback(row, col, text);
|
|
10323
|
-
},
|
|
10324
|
-
onChange: e => {
|
|
10325
|
-
const next = e.target.value;
|
|
10326
|
-
setLocalData(prev => {
|
|
10327
|
-
if (isGrouped) {
|
|
10328
|
-
return prev.map(g => ({
|
|
10329
|
-
...g,
|
|
10330
|
-
rows: (g.rows || []).map(r => r.id === row.id ? {
|
|
10331
|
-
...r,
|
|
10332
|
-
[accessor]: next
|
|
10333
|
-
} : r)
|
|
10334
|
-
}));
|
|
10335
|
-
}
|
|
10336
|
-
return (prev || []).map(r => r.id === row.id ? {
|
|
10337
|
-
...r,
|
|
10338
|
-
[accessor]: next
|
|
10339
|
-
} : r);
|
|
10340
|
-
});
|
|
10341
|
-
refreshTriggerRef.current?.();
|
|
10342
|
-
try {
|
|
10343
|
-
onCellChangeRef.current?.(row, accessor, next);
|
|
10344
|
-
} catch (err) {
|
|
10345
|
-
console.error('onCellChange error', err);
|
|
10346
|
-
}
|
|
10347
|
-
},
|
|
10348
|
-
style: {
|
|
10349
|
-
border: "1px solid var(--border-light, #ccc)",
|
|
10350
|
-
padding: "2px 4px"
|
|
10351
|
-
}
|
|
10352
|
-
});
|
|
10350
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
10351
|
+
title: translate("noData")
|
|
10352
|
+
}, "...");
|
|
10353
10353
|
}
|
|
10354
10354
|
|
|
10355
10355
|
// If column has dateFormat, format value as date/time
|
|
@@ -10396,7 +10396,7 @@ function TableInner({
|
|
|
10396
10396
|
}
|
|
10397
10397
|
// existing highlight logic for other fields
|
|
10398
10398
|
return highlight(String(v));
|
|
10399
|
-
}, [highlight, isGrouped, triggerCellCallback]);
|
|
10399
|
+
}, [highlight, isGrouped, triggerCellCallback, translate]);
|
|
10400
10400
|
const showView = buttons.includes("view");
|
|
10401
10401
|
const showEdit = buttons.includes("edit");
|
|
10402
10402
|
// show delete only when view is also shown (per request)
|