trotl-table 1.0.91 → 1.0.93
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 +20 -56
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +20 -56
- package/dist/Table.esm.js.map +1 -1
- package/dist/WorkOrderAnalyticsByClient.cjs.js +417 -0
- package/dist/WorkOrderAnalyticsByClient.cjs.js.map +1 -0
- package/dist/WorkOrderAnalyticsByClient.esm.js +412 -0
- package/dist/WorkOrderAnalyticsByClient.esm.js.map +1 -0
- package/package.json +1 -1
package/dist/Table.esm.js
CHANGED
|
@@ -9641,8 +9641,6 @@ function TableInner({
|
|
|
9641
9641
|
onCellChange = () => {},
|
|
9642
9642
|
// callback for any cell click
|
|
9643
9643
|
cellCallback = () => {},
|
|
9644
|
-
// when true, skip the integrated confirmation modal and delete immediately
|
|
9645
|
-
disableDeleteModal = false,
|
|
9646
9644
|
deleteLabelKey = "name",
|
|
9647
9645
|
buttons = ["view", "edit", "delete", "share", "duplicate"],
|
|
9648
9646
|
enableDragRow = false,
|
|
@@ -9695,6 +9693,9 @@ function TableInner({
|
|
|
9695
9693
|
return translations[key] || key;
|
|
9696
9694
|
};
|
|
9697
9695
|
}
|
|
9696
|
+
|
|
9697
|
+
// normalize delete modal flag early (handles string 'false' etc)
|
|
9698
|
+
|
|
9698
9699
|
// Use refs for callbacks to prevent infinite loops from dependency changes
|
|
9699
9700
|
const selectedRowsCallbackRef = useRef(selectedRowsCallback);
|
|
9700
9701
|
const refreshTriggerRef = useRef(refreshTrigger);
|
|
@@ -10162,17 +10163,25 @@ function TableInner({
|
|
|
10162
10163
|
return a === b;
|
|
10163
10164
|
}, []);
|
|
10164
10165
|
const formatArrayValue = useCallback((value, col) => {
|
|
10165
|
-
if (!Array.isArray(value)) return
|
|
10166
|
+
if (!Array.isArray(value)) return "";
|
|
10166
10167
|
const objectKey = col?.objectKey;
|
|
10167
10168
|
const parts = value.map(item => {
|
|
10168
10169
|
if (item == null) return "";
|
|
10170
|
+
|
|
10171
|
+
// When objectKey is configured, only use that field. This prevents
|
|
10172
|
+
// objects without a label from displaying their key or JSON value.
|
|
10173
|
+
if (objectKey) {
|
|
10174
|
+
if (typeof item !== "object" || typeof item[objectKey] !== "string") {
|
|
10175
|
+
return "";
|
|
10176
|
+
}
|
|
10177
|
+
return item[objectKey].trim();
|
|
10178
|
+
}
|
|
10169
10179
|
if (typeof item !== "object") return String(item);
|
|
10170
|
-
if (objectKey && item?.[objectKey] !== undefined) return String(item[objectKey]);
|
|
10171
10180
|
if (item.label !== undefined) return String(item.label);
|
|
10172
10181
|
if (item.value !== undefined) return String(item.value);
|
|
10173
10182
|
return JSON.stringify(item);
|
|
10174
|
-
}).filter(
|
|
10175
|
-
return parts.join(", ");
|
|
10183
|
+
}).filter(Boolean);
|
|
10184
|
+
return [...new Set(parts)].join(", ");
|
|
10176
10185
|
}, []);
|
|
10177
10186
|
|
|
10178
10187
|
// console.log(extraSearchTerm)
|
|
@@ -10771,10 +10780,8 @@ function TableInner({
|
|
|
10771
10780
|
}, formatted);
|
|
10772
10781
|
}
|
|
10773
10782
|
if (col && col.type === "array") {
|
|
10774
|
-
const
|
|
10775
|
-
const
|
|
10776
|
-
const count = arr.length;
|
|
10777
|
-
const display = count > 0 ? `${count}: ${list}` : "...";
|
|
10783
|
+
const list = formatArrayValue(v, col);
|
|
10784
|
+
const display = list || "...";
|
|
10778
10785
|
return /*#__PURE__*/React__default.createElement("span", {
|
|
10779
10786
|
title: list || translate("noData")
|
|
10780
10787
|
}, display);
|
|
@@ -10840,8 +10847,9 @@ function TableInner({
|
|
|
10840
10847
|
}
|
|
10841
10848
|
}, v ? "✓" : "✗");
|
|
10842
10849
|
}
|
|
10843
|
-
//
|
|
10844
|
-
|
|
10850
|
+
// Translate only the displayed value; keep the raw value for data operations.
|
|
10851
|
+
const displayValue = col?.translate ? translate(String(v)) : v;
|
|
10852
|
+
return highlight(String(displayValue ?? v));
|
|
10845
10853
|
}, [highlight, isGrouped, triggerCellCallback, translate, formatArrayValue]);
|
|
10846
10854
|
const showView = buttons.includes("view");
|
|
10847
10855
|
const showEdit = buttons.includes("edit");
|
|
@@ -10958,50 +10966,6 @@ function TableInner({
|
|
|
10958
10966
|
});
|
|
10959
10967
|
}, [tableDataFlat, isGrouped, groupKey]);
|
|
10960
10968
|
|
|
10961
|
-
// DUPLICATE
|
|
10962
|
-
useCallback(row => {
|
|
10963
|
-
if (!row) return;
|
|
10964
|
-
// try user callback first; if it returns an object with newRow use that
|
|
10965
|
-
let newRow = null;
|
|
10966
|
-
if (duplicateCallbackRef.current) {
|
|
10967
|
-
try {
|
|
10968
|
-
const res = duplicateCallbackRef.current(row);
|
|
10969
|
-
if (res && res.newRow) {
|
|
10970
|
-
newRow = res.newRow;
|
|
10971
|
-
}
|
|
10972
|
-
} catch (err) {
|
|
10973
|
-
console.error("duplicateCallback threw", err);
|
|
10974
|
-
}
|
|
10975
|
-
}
|
|
10976
|
-
// fallback simple clone if callback didn't provide newRow
|
|
10977
|
-
if (!newRow) {
|
|
10978
|
-
newRow = {
|
|
10979
|
-
...row
|
|
10980
|
-
};
|
|
10981
|
-
// give it a distinct id if possible
|
|
10982
|
-
if (newRow.id != null) {
|
|
10983
|
-
newRow.id = `${newRow.id}-dup-${Date.now()}`;
|
|
10984
|
-
}
|
|
10985
|
-
}
|
|
10986
|
-
setLocalData(prev => {
|
|
10987
|
-
if (isGrouped) {
|
|
10988
|
-
return prev.map(g => {
|
|
10989
|
-
const gid = g[groupKey] ?? g.groupId ?? g.groupName;
|
|
10990
|
-
// insert into same group as original row
|
|
10991
|
-
if (row[groupKey] === gid || g.rows.some(r => r.id === row.id)) {
|
|
10992
|
-
return {
|
|
10993
|
-
...g,
|
|
10994
|
-
rows: [...(g.rows || []), newRow]
|
|
10995
|
-
};
|
|
10996
|
-
}
|
|
10997
|
-
return g;
|
|
10998
|
-
});
|
|
10999
|
-
}
|
|
11000
|
-
return [...(prev || []), newRow];
|
|
11001
|
-
});
|
|
11002
|
-
refreshTriggerRef.current?.();
|
|
11003
|
-
}, [duplicateCallbackRef, isGrouped, groupKey, refreshTriggerRef]);
|
|
11004
|
-
|
|
11005
10969
|
// ROW RENDERER
|
|
11006
10970
|
const rowRenderer = useCallback(({
|
|
11007
10971
|
index,
|