trotl-table 1.0.91 → 1.0.92
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 +17 -54
- package/dist/Table.cjs.js.map +1 -1
- package/dist/Table.esm.js +17 -54
- 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.cjs.js
CHANGED
|
@@ -9663,8 +9663,6 @@ function TableInner({
|
|
|
9663
9663
|
onCellChange = () => {},
|
|
9664
9664
|
// callback for any cell click
|
|
9665
9665
|
cellCallback = () => {},
|
|
9666
|
-
// when true, skip the integrated confirmation modal and delete immediately
|
|
9667
|
-
disableDeleteModal = false,
|
|
9668
9666
|
deleteLabelKey = "name",
|
|
9669
9667
|
buttons = ["view", "edit", "delete", "share", "duplicate"],
|
|
9670
9668
|
enableDragRow = false,
|
|
@@ -9717,6 +9715,9 @@ function TableInner({
|
|
|
9717
9715
|
return translations[key] || key;
|
|
9718
9716
|
};
|
|
9719
9717
|
}
|
|
9718
|
+
|
|
9719
|
+
// normalize delete modal flag early (handles string 'false' etc)
|
|
9720
|
+
|
|
9720
9721
|
// Use refs for callbacks to prevent infinite loops from dependency changes
|
|
9721
9722
|
const selectedRowsCallbackRef = React.useRef(selectedRowsCallback);
|
|
9722
9723
|
const refreshTriggerRef = React.useRef(refreshTrigger);
|
|
@@ -10184,17 +10185,25 @@ function TableInner({
|
|
|
10184
10185
|
return a === b;
|
|
10185
10186
|
}, []);
|
|
10186
10187
|
const formatArrayValue = React.useCallback((value, col) => {
|
|
10187
|
-
if (!Array.isArray(value)) return
|
|
10188
|
+
if (!Array.isArray(value)) return "";
|
|
10188
10189
|
const objectKey = col?.objectKey;
|
|
10189
10190
|
const parts = value.map(item => {
|
|
10190
10191
|
if (item == null) return "";
|
|
10192
|
+
|
|
10193
|
+
// When objectKey is configured, only use that field. This prevents
|
|
10194
|
+
// objects without a label from displaying their key or JSON value.
|
|
10195
|
+
if (objectKey) {
|
|
10196
|
+
if (typeof item !== "object" || typeof item[objectKey] !== "string") {
|
|
10197
|
+
return "";
|
|
10198
|
+
}
|
|
10199
|
+
return item[objectKey].trim();
|
|
10200
|
+
}
|
|
10191
10201
|
if (typeof item !== "object") return String(item);
|
|
10192
|
-
if (objectKey && item?.[objectKey] !== undefined) return String(item[objectKey]);
|
|
10193
10202
|
if (item.label !== undefined) return String(item.label);
|
|
10194
10203
|
if (item.value !== undefined) return String(item.value);
|
|
10195
10204
|
return JSON.stringify(item);
|
|
10196
|
-
}).filter(
|
|
10197
|
-
return parts.join(", ");
|
|
10205
|
+
}).filter(Boolean);
|
|
10206
|
+
return [...new Set(parts)].join(", ");
|
|
10198
10207
|
}, []);
|
|
10199
10208
|
|
|
10200
10209
|
// console.log(extraSearchTerm)
|
|
@@ -10793,10 +10802,8 @@ function TableInner({
|
|
|
10793
10802
|
}, formatted);
|
|
10794
10803
|
}
|
|
10795
10804
|
if (col && col.type === "array") {
|
|
10796
|
-
const
|
|
10797
|
-
const
|
|
10798
|
-
const count = arr.length;
|
|
10799
|
-
const display = count > 0 ? `${count}: ${list}` : "...";
|
|
10805
|
+
const list = formatArrayValue(v, col);
|
|
10806
|
+
const display = list || "...";
|
|
10800
10807
|
return /*#__PURE__*/React.createElement("span", {
|
|
10801
10808
|
title: list || translate("noData")
|
|
10802
10809
|
}, display);
|
|
@@ -10980,50 +10987,6 @@ function TableInner({
|
|
|
10980
10987
|
});
|
|
10981
10988
|
}, [tableDataFlat, isGrouped, groupKey]);
|
|
10982
10989
|
|
|
10983
|
-
// DUPLICATE
|
|
10984
|
-
React.useCallback(row => {
|
|
10985
|
-
if (!row) return;
|
|
10986
|
-
// try user callback first; if it returns an object with newRow use that
|
|
10987
|
-
let newRow = null;
|
|
10988
|
-
if (duplicateCallbackRef.current) {
|
|
10989
|
-
try {
|
|
10990
|
-
const res = duplicateCallbackRef.current(row);
|
|
10991
|
-
if (res && res.newRow) {
|
|
10992
|
-
newRow = res.newRow;
|
|
10993
|
-
}
|
|
10994
|
-
} catch (err) {
|
|
10995
|
-
console.error("duplicateCallback threw", err);
|
|
10996
|
-
}
|
|
10997
|
-
}
|
|
10998
|
-
// fallback simple clone if callback didn't provide newRow
|
|
10999
|
-
if (!newRow) {
|
|
11000
|
-
newRow = {
|
|
11001
|
-
...row
|
|
11002
|
-
};
|
|
11003
|
-
// give it a distinct id if possible
|
|
11004
|
-
if (newRow.id != null) {
|
|
11005
|
-
newRow.id = `${newRow.id}-dup-${Date.now()}`;
|
|
11006
|
-
}
|
|
11007
|
-
}
|
|
11008
|
-
setLocalData(prev => {
|
|
11009
|
-
if (isGrouped) {
|
|
11010
|
-
return prev.map(g => {
|
|
11011
|
-
const gid = g[groupKey] ?? g.groupId ?? g.groupName;
|
|
11012
|
-
// insert into same group as original row
|
|
11013
|
-
if (row[groupKey] === gid || g.rows.some(r => r.id === row.id)) {
|
|
11014
|
-
return {
|
|
11015
|
-
...g,
|
|
11016
|
-
rows: [...(g.rows || []), newRow]
|
|
11017
|
-
};
|
|
11018
|
-
}
|
|
11019
|
-
return g;
|
|
11020
|
-
});
|
|
11021
|
-
}
|
|
11022
|
-
return [...(prev || []), newRow];
|
|
11023
|
-
});
|
|
11024
|
-
refreshTriggerRef.current?.();
|
|
11025
|
-
}, [duplicateCallbackRef, isGrouped, groupKey, refreshTriggerRef]);
|
|
11026
|
-
|
|
11027
10990
|
// ROW RENDERER
|
|
11028
10991
|
const rowRenderer = React.useCallback(({
|
|
11029
10992
|
index,
|