trotl-table 1.0.98 → 1.0.99

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.esm.js CHANGED
@@ -9760,6 +9760,10 @@ function TableInner({
9760
9760
  const downloadCallbackRef = useRef(downloadCallback);
9761
9761
  const undeleteCallbackRef = useRef(undeleteCallback);
9762
9762
  const mobileRowClickRef = useRef(mobileRowClick);
9763
+ const lastTapRef = useRef({
9764
+ timer: null,
9765
+ rowId: null
9766
+ });
9763
9767
  const onCellChangeRef = useRef(onCellChange);
9764
9768
  const cellCallbackRef = useRef(cellCallback);
9765
9769
 
@@ -10957,7 +10961,7 @@ function TableInner({
10957
10961
  const showUndelete = buttons.includes("undelete");
10958
10962
  const showDuplicate = buttons.includes("duplicate") || buttons.includes("duplicates");
10959
10963
  const showDownload = buttons.includes("download");
10960
- const showActions = showView || showEdit || showDelete || showShare || showUndelete || showDuplicate || showDownload;
10964
+ const showActions = !isMobile && (showView || showEdit || showDelete || showShare || showUndelete || showDuplicate || showDownload);
10961
10965
  const visibleActionCount = [showView, showEdit, showDuplicate, showDelete, showShare, showUndelete, showDownload].filter(Boolean).length;
10962
10966
  const actionColumnStyle = useMemo(() => {
10963
10967
  if (!showActions) return undefined;
@@ -11198,11 +11202,47 @@ function TableInner({
11198
11202
  if (!isMobile || event.target.closest(".checkbox-cell, .action-cell, button, input, select, textarea, a, [contenteditable='true']")) {
11199
11203
  return;
11200
11204
  }
11201
- if (typeof mobileRowClickRef.current === "function") {
11202
- mobileRowClickRef.current(row);
11203
- } else {
11204
- setMobileDetailRow(row);
11205
+ const openSingleTap = () => {
11206
+ if (typeof mobileRowClickRef.current === "function") {
11207
+ mobileRowClickRef.current(row);
11208
+ } else {
11209
+ setMobileDetailRow(row);
11210
+ }
11211
+ };
11212
+ const hasContextActions = Array.isArray(enableMouseRightClick) && enableMouseRightClick.length > 0;
11213
+ if (!hasContextActions) {
11214
+ openSingleTap();
11215
+ return;
11216
+ }
11217
+
11218
+ // Double tap opens the context menu; a single tap waits briefly so
11219
+ // the first tap of a double tap does not open the details modal.
11220
+ const tap = lastTapRef.current;
11221
+ if (tap.timer && tap.rowId === row.id) {
11222
+ window.clearTimeout(tap.timer);
11223
+ lastTapRef.current = {
11224
+ timer: null,
11225
+ rowId: null
11226
+ };
11227
+ setContextMenu({
11228
+ visible: true,
11229
+ x: Math.max(0, Math.min(event.clientX, window.innerWidth - 180)),
11230
+ y: Math.max(0, Math.min(event.clientY, window.innerHeight - 160)),
11231
+ row
11232
+ });
11233
+ return;
11205
11234
  }
11235
+ window.clearTimeout(tap.timer);
11236
+ lastTapRef.current = {
11237
+ rowId: row.id,
11238
+ timer: window.setTimeout(() => {
11239
+ lastTapRef.current = {
11240
+ timer: null,
11241
+ rowId: null
11242
+ };
11243
+ openSingleTap();
11244
+ }, 280)
11245
+ };
11206
11246
  };
11207
11247
  const content = /*#__PURE__*/React__default.createElement("div", {
11208
11248
  key: key,
@@ -11343,7 +11383,7 @@ function TableInner({
11343
11383
  }, content);
11344
11384
  }
11345
11385
  return content;
11346
- }, [tableDataFlat, visibleColumns, selectedRows, toggleRowSelection, groupRowsById, renderCell, getCellStyle, showActions, showDelete, showEdit, showKey, showView, translate, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns, isMobile, doubleClickEnable, keyWidth, actionColumnStyle, showDuplicate, showDownload, showIcons, showShare, getHighlightRowStyle, triggerCellCallback, getAccessorKey, getAccessorValue]);
11386
+ }, [tableDataFlat, visibleColumns, selectedRows, toggleRowSelection, groupRowsById, renderCell, getCellStyle, showActions, showDelete, showEdit, showKey, showView, translate, enableDragRow, moveRow, enableMultiSelect, rowHeight, tableId, customColumns, isMobile, enableMouseRightClick, doubleClickEnable, keyWidth, actionColumnStyle, showDuplicate, showDownload, showIcons, showShare, getHighlightRowStyle, triggerCellCallback, getAccessorKey, getAccessorValue]);
11347
11387
  const rightClickActions = Array.isArray(enableMouseRightClick) ? enableMouseRightClick : [];
11348
11388
  const [hoveredActionIndex, setHoveredActionIndex] = useState(null);
11349
11389
  const rowHeightGetter = ({