@economic/taco 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/taco.cjs.development.js +2 -1
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -199,7 +199,8 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
|
|
199
199
|
if (typeof onClickCapture === 'function') {
|
200
200
|
onClickCapture(event);
|
201
201
|
}
|
202
|
-
|
202
|
+
// do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
|
203
|
+
requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));
|
203
204
|
};
|
204
205
|
const handleClick = event => {
|
205
206
|
if (typeof onClick === 'function') {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { focusableSelector } from '../../util/editing';\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isCurrentRow,\n 'data-selected': props.row.getIsSelected(),\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} />;\n\n if (tableMeta.editing.isEditing && (isCurrentRow || (isHovered && !tableMeta.hoverState.isPaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isLastRow={props.isLastRow}\n setCurrentRowIndex={tableMeta.currentRow.setCurrentRowIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(() => ({ isHovered, setIsHovered, rowIndex: props.index }), [isHovered, props.index]);\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nlet lastIndex;\n\nfunction getColumnIndex(focusedElement: Element) {\n if (focusedElement) {\n return focusedElement.closest('[role=cell]')?.getAttribute('data-column-index');\n }\n\n return null;\n}\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isLastRow, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const focusManagerOptions = { tabbable: true };\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastIndex = getColumnIndex(event.target);\n };\n\n const handleArrowLeftKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus previous focusable element, if there is one\n focusedElement = focusManager.focusPrevious(focusManagerOptions);\n\n // Should move to prevoius row and select last focusable element in that row,\n // if there is no previous focusable element in current row\n if (props.index !== 0 && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(focusManagerOptions);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus next focusable element, if there is one\n focusedElement = focusManager.focusNext(focusManagerOptions);\n\n // Should move to next row and select first focusable element in that row,\n // if there is no next focusable element in current row\n if (!isLastRow && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n // Need to update lastIndex when row got changed and first element got selected.\n\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.hoverState.isPaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.hoverState.isPaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing) {\n return;\n }\n\n handleArrowLeftKey(event);\n handleArrowRightKey(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n if (tableMeta.currentRow.currentRowIndex === props.index) {\n if (lastIndex !== undefined) {\n const lastIndexCell = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastIndex}\"]`\n );\n lastIndexCell?.querySelector(focusableSelector)?.focus();\n } else {\n focusManager.focusFirst(focusManagerOptions);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.currentRow.currentRowIndex]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = RowProps<TType> & {\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const { index, isLastRow: _1, onClick, onClickCapture, onDrop, row, table, tableRef, ...attributes } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n tableMeta.currentRow.setCurrentRowIndex(index);\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(row.original);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["Row","props","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isHovered","setIsHovered","React","useState","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","editing","isEditing","hoverState","isPaused","EditingRow","isLastRow","setCurrentRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","focusedElement","closest","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","focusManager","useFocusManager","focusManagerOptions","tabbable","handleClickCapture","event","target","handleArrowLeftKey","key","shiftKey","stopPropagation","preventDefault","ctrlKey","metaKey","blur","focusFirst","focusPrevious","currentTarget","contains","pause","setTimeout","focusLast","handleArrowRightKey","focusNext","useEffect","handleKeyDown","isDefaultPrevented","isPropagationStopped","detailModeEditing","lastIndexCell","focusableSelector","focus","onClickCapture","onKeyDown","clickableElements","memo","_1","ref","useRef","useRowContext","clickedElement","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;SAmBgBA,GAAG,CA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BAANA,MAAM,CAAG2C,KAAK,EAAEzD,GAAG,CAACmG,QAAQ,CAAC,CAAC;EAEjF,MAAMK,SAAS,GAAGC,EAAE,CAChB,oBAAoB;;;EAGpB,8DAA8D,EAC9D;IACI,sBAAsB,EAAE,OAAO9F,OAAO,KAAK;GAC9C,CACJ;EAED,oBACIP,sDACQ+C,UAAU,EACTrC,MAAM,GAAGwF,eAAe,GAAG9F,SAAS;IACzCgG,SAAS,EAAEA,SAAS;sBACJ5G,KAAK;IACrBe,OAAO,EAAEE,WAAW;IACpBuE,cAAc,EAAE5B,kBAAkB;IAClCkD,YAAY,EAAEN,gBAAgB;IAC9BO,YAAY,EAAEN,gBAAgB;IAC9BO,IAAI,EAAC,KAAK;IACVnB,GAAG,EAAEA;KACP;AAEV,CAAC,CAAmE;;;;"}
|
1
|
+
{"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table3/components/rows/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { Row as RTRow, Table as RTable, TableMeta } from '@tanstack/react-table';\nimport cn from 'classnames';\nimport { RowContext, useRowContext } from './RowContext';\nimport { useDropTarget } from '../../../../utils/hooks/useDropTarget';\nimport { Table3RowClickHandler, Table3RowDropHandler } from '../../types';\nimport { useFocusManager } from '@react-aria/focus';\nimport { focusableSelector } from '../../util/editing';\n\ntype RowProps<TType = unknown> = Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick' | 'onDrop'> & {\n index: number;\n isLastRow: boolean;\n onClick?: Table3RowClickHandler<TType>;\n onDrop?: Table3RowDropHandler<TType>;\n row: RTRow<TType>;\n table: RTable<TType>;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport function Row<TType = unknown>(props: RowProps<TType>) {\n const tableMeta = props.table.options.meta as TableMeta<TType>;\n const isCurrentRow = tableMeta.currentRow.currentRowIndex === props.index;\n const isDraggingRow = tableMeta.rowDrag.dragging[props.row.id];\n // we use non-css hovered state to determine whether to render actions or not, for performance\n const [isHovered, setIsHovered] = React.useState(false);\n\n // rows are heavily memoized because performance in our table is critical\n // be careful and selective about props that you pass to the row\n const memoedProps = {\n // aria-grabbed is being deprecated but there is no current alternative api, we use it until there is\n 'aria-grabbed': isDraggingRow ? true : tableMeta.rowDrag.isEnabled ? false : undefined,\n 'data-current': isCurrentRow,\n 'data-selected': props.row.getIsSelected(),\n draggable: tableMeta.rowDrag.isEnabled,\n index: props.index,\n onClick: tableMeta.rowClick.handleClick,\n onDrop: tableMeta.rowDrop.isEnabled ? tableMeta.rowDrop.handleDrop : undefined,\n };\n\n let output = <MemoedRow<TType> {...props} {...memoedProps} />;\n\n if (tableMeta.editing.isEditing && (isCurrentRow || (isHovered && !tableMeta.hoverState.isPaused))) {\n output = (\n <EditingRow\n {...props}\n {...memoedProps}\n isLastRow={props.isLastRow}\n setCurrentRowIndex={tableMeta.currentRow.setCurrentRowIndex}\n />\n );\n }\n\n // we store the row index in context because in a virtualised table the row index and the\n // react table row index do not match when, for example, sorting is applied\n const contextValue = React.useMemo(() => ({ isHovered, setIsHovered, rowIndex: props.index }), [isHovered, props.index]);\n\n return <RowContext.Provider value={contextValue}>{output}</RowContext.Provider>;\n}\n\n// turns out we might need some kind of \"state\" for the focused column, but it doesn't need to be react state that re-renders\nlet lastIndex;\n\nfunction getColumnIndex(focusedElement: Element) {\n if (focusedElement) {\n return focusedElement.closest('[role=cell]')?.getAttribute('data-column-index');\n }\n\n return null;\n}\n\n// This code is needed to avoid multiple rows being hovered at the same time (it happens since we use non-css hovering)\nlet previouslyHoveredIndex: number | undefined;\nconst unhoverPreviousRow = (tableRef: React.RefObject<HTMLDivElement>) => {\n if (previouslyHoveredIndex !== undefined) {\n const mouseoutEvent = new MouseEvent('mouseout', { view: window, bubbles: true, cancelable: true });\n const previouslyHovered = tableRef?.current?.querySelector(`[data-row-index=\"${previouslyHoveredIndex}\"]`);\n previouslyHovered?.dispatchEvent(mouseoutEvent);\n }\n};\n\nfunction EditingRow(props) {\n const { isLastRow, setCurrentRowIndex, virtualiser, ...attributes } = props;\n const focusManager = useFocusManager();\n const focusManagerOptions = { tabbable: true };\n const tableMeta = props.table.options.meta as TableMeta<unknown>;\n\n const handleClickCapture = (event: React.FocusEvent) => {\n lastIndex = getColumnIndex(event.target);\n };\n\n const handleArrowLeftKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowLeft' || (event.key === 'Tab' && event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowLeft\" or \"META + ArrowLeft\" should focus first focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus previous focusable element, if there is one\n focusedElement = focusManager.focusPrevious(focusManagerOptions);\n\n // Should move to prevoius row and select last focusable element in that row,\n // if there is no previous focusable element in current row\n if (props.index !== 0 && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index - 1);\n setTimeout(() => {\n focusedElement = focusManager.focusLast(focusManagerOptions);\n // Need to update lastIndex when row got changed and last element got selected.\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n const handleArrowRightKey = event => {\n let focusedElement: Element;\n if (event.key === 'ArrowRight' || (event.key === 'Tab' && !event.shiftKey)) {\n // Need to stop propagation because \"Tab\" will be handled twice(default browser and programmatic one)\n // and will lead to looping focus. Also we still need to perform special behaviour when focus reaches the end of the row,\n // so we don't need default browser behaviour.\n event.stopPropagation();\n event.preventDefault();\n\n // \"CTRL + ArrowRight\" or \"META + ArrowRight\" should focus last focusable element of the row\n if (event.ctrlKey || event.metaKey) {\n event.target.blur();\n focusedElement = focusManager.focusLast(focusManagerOptions);\n lastIndex = getColumnIndex(focusedElement);\n } else {\n // Should focus next focusable element, if there is one\n focusedElement = focusManager.focusNext(focusManagerOptions);\n\n // Should move to next row and select first focusable element in that row,\n // if there is no next focusable element in current row\n if (!isLastRow && (!focusedElement || !event.currentTarget.contains(focusedElement))) {\n tableMeta.hoverState.pause(true);\n setCurrentRowIndex(props.index + 1);\n setTimeout(() => {\n focusedElement = focusManager.focusFirst(focusManagerOptions);\n // Need to update lastIndex when row got changed and first element got selected.\n\n lastIndex = getColumnIndex(focusedElement);\n }, 1);\n } else {\n lastIndex = getColumnIndex(focusedElement);\n }\n }\n }\n };\n\n React.useEffect(() => {\n // if some row stuck in hovered state, we heed to unhover it when hover state is paused\n if (tableMeta.hoverState.isPaused) {\n unhoverPreviousRow(props.tableRef);\n }\n }, [tableMeta.hoverState.isPaused]);\n\n const handleKeyDown = (event: React.KeyboardEvent) => {\n if (event.isDefaultPrevented() || event.isPropagationStopped() || tableMeta.editing.detailModeEditing) {\n return;\n }\n\n handleArrowLeftKey(event);\n handleArrowRightKey(event);\n };\n\n // this ensures we focus either on a field or on the same column when keyboard navigating up/down\n React.useEffect(() => {\n if (tableMeta.currentRow.currentRowIndex === props.index) {\n if (lastIndex !== undefined) {\n const lastIndexCell = props.tableRef.current?.querySelector(\n `[role=\"row\"][data-current=\"true\"] [data-column-index=\"${lastIndex}\"]`\n );\n lastIndexCell?.querySelector(focusableSelector)?.focus();\n } else {\n focusManager.focusFirst(focusManagerOptions);\n }\n }\n // Need to subscribe to current row index and check is it a current row,\n // for a situation where hovered row is the next row after current row...\n // In this case row will not be re-rendered if user switch to next row, because hovered row also renders EditingRow.\n }, [tableMeta.currentRow.currentRowIndex]);\n\n return <MemoedRow {...attributes} onClickCapture={handleClickCapture} onKeyDown={handleKeyDown} />;\n}\n\n// Memoization\n\nexport type MemoedRowProps<TType = unknown> = RowProps<TType> & {\n 'aria-grabbed'?: boolean;\n 'data-current': boolean;\n 'data-selected': boolean;\n draggable: boolean;\n index: number;\n};\n\nconst clickableElements = ['input', 'button', 'a', 'select', 'option', 'label', 'textarea'];\n\nconst MemoedRow = React.memo(function MemoedRow<TType = unknown>(props: MemoedRowProps<TType>) {\n const { index, isLastRow: _1, onClick, onClickCapture, onDrop, row, table, tableRef, ...attributes } = props;\n const ref = React.useRef<HTMLDivElement | null>(null);\n const tableMeta = table.options.meta as TableMeta<TType>;\n const { setIsHovered } = useRowContext();\n\n // we use capture because it also picks up clicks on e.g. select checkboxes\n const handleClickCapture = (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {\n if (typeof onClickCapture === 'function') {\n onClickCapture(event);\n }\n\n // do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable\n requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));\n };\n\n const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {\n if (typeof onClick === 'function') {\n const clickedElement = event.target as HTMLElement;\n\n if (\n !ref.current?.contains(event.target as HTMLElement) ||\n clickableElements.includes(clickedElement.tagName.toLowerCase()) ||\n clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))\n ) {\n return;\n }\n\n onClick(row.original);\n }\n };\n\n const handleMouseEnter = () => {\n // When user moving mouse to fast, then some of the rows are getting stuck in hover state,\n // because mouseleave event never got triggered, to avoid this to happen we're saving the index of last hovered row,\n // so that we can unhover it when new row got hovered, and saving it in a variable outside of react to save in performance,\n // since it would be very performance heavy to use state which is bound to mouse events.\n if (previouslyHoveredIndex !== undefined) {\n if (previouslyHoveredIndex !== index) {\n unhoverPreviousRow(tableRef);\n previouslyHoveredIndex = index;\n }\n } else {\n previouslyHoveredIndex = index;\n }\n setIsHovered(true);\n };\n const handleMouseLeave = () => {\n if (previouslyHoveredIndex === index) {\n previouslyHoveredIndex = undefined;\n }\n setIsHovered(false);\n };\n\n const [, dropTargetProps] = useDropTarget(event => onDrop?.(event, row.original));\n\n const className = cn(\n 'group/row contents',\n // resizing column requires dragging, which means the mouse might (on rare occasions) move over rows and trigger hover state\n // that in turn triggers rendering of e.g. row actions, which could cause janky ui - so don't allow mouse interaction when resizing\n '[[role=\"table\"][data-resizing=\"true\"]_&]:pointer-events-none',\n {\n 'hover:cursor-pointer': typeof onClick === 'function',\n }\n );\n\n return (\n <div\n {...attributes}\n {...(onDrop ? dropTargetProps : undefined)}\n className={className}\n data-row-index={index}\n onClick={handleClick}\n onClickCapture={handleClickCapture}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n role=\"row\"\n ref={ref}\n />\n );\n}) as <TType = unknown>(props: MemoedRowProps<TType>) => JSX.Element;\n"],"names":["Row","props","tableMeta","table","options","meta","isCurrentRow","currentRow","currentRowIndex","index","isDraggingRow","rowDrag","dragging","row","id","isHovered","setIsHovered","React","useState","memoedProps","isEnabled","undefined","getIsSelected","draggable","onClick","rowClick","handleClick","onDrop","rowDrop","handleDrop","output","MemoedRow","editing","isEditing","hoverState","isPaused","EditingRow","isLastRow","setCurrentRowIndex","contextValue","useMemo","rowIndex","RowContext","Provider","value","lastIndex","getColumnIndex","focusedElement","closest","getAttribute","previouslyHoveredIndex","unhoverPreviousRow","tableRef","mouseoutEvent","MouseEvent","view","window","bubbles","cancelable","previouslyHovered","current","querySelector","dispatchEvent","virtualiser","attributes","focusManager","useFocusManager","focusManagerOptions","tabbable","handleClickCapture","event","target","handleArrowLeftKey","key","shiftKey","stopPropagation","preventDefault","ctrlKey","metaKey","blur","focusFirst","focusPrevious","currentTarget","contains","pause","setTimeout","focusLast","handleArrowRightKey","focusNext","useEffect","handleKeyDown","isDefaultPrevented","isPropagationStopped","detailModeEditing","lastIndexCell","focusableSelector","focus","onClickCapture","onKeyDown","clickableElements","memo","_1","ref","useRef","useRowContext","requestAnimationFrame","clickedElement","includes","tagName","toLowerCase","map","tag","join","original","handleMouseEnter","handleMouseLeave","dropTargetProps","useDropTarget","className","cn","onMouseEnter","onMouseLeave","role"],"mappings":";;;;;;;SAmBgBA,GAAG,CAAkBC,KAAsB;EACvD,MAAMC,SAAS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,uBAANA,MAAM,CAAG2C,KAAK,EAAEzD,GAAG,CAACoG,QAAQ,CAAC,CAAC;EAEjF,MAAMK,SAAS,GAAGC,EAAE,CAChB,oBAAoB;;;EAGpB,8DAA8D,EAC9D;IACI,sBAAsB,EAAE,OAAO/F,OAAO,KAAK;GAC9C,CACJ;EAED,oBACIP,sDACQ+C,UAAU,EACTrC,MAAM,GAAGyF,eAAe,GAAG/F,SAAS;IACzCiG,SAAS,EAAEA,SAAS;sBACJ7G,KAAK;IACrBe,OAAO,EAAEE,WAAW;IACpBuE,cAAc,EAAE5B,kBAAkB;IAClCmD,YAAY,EAAEN,gBAAgB;IAC9BO,YAAY,EAAEN,gBAAgB;IAC9BO,IAAI,EAAC,KAAK;IACVpB,GAAG,EAAEA;KACP;AAEV,CAAC,CAAmE;;;;"}
|
@@ -18442,7 +18442,8 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
|
|
18442
18442
|
if (typeof onClickCapture === 'function') {
|
18443
18443
|
onClickCapture(event);
|
18444
18444
|
}
|
18445
|
-
|
18445
|
+
// do this in the next frame, otherwise it remounts the row and prevents row actions on hover from being clickable
|
18446
|
+
requestAnimationFrame(() => tableMeta.currentRow.setCurrentRowIndex(index));
|
18446
18447
|
};
|
18447
18448
|
const handleClick = event => {
|
18448
18449
|
if (typeof onClick === 'function') {
|