@economic/taco 1.21.6 → 1.21.7

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.
Files changed (27) hide show
  1. package/dist/components/Table2/components/column/Indicator.d.ts +2 -1
  2. package/dist/components/Table2/components/row/Context.d.ts +17 -11
  3. package/dist/components/Table2/components/row/Row.d.ts +1 -6
  4. package/dist/components/Table2/hooks/useShouldPauseHoverState.d.ts +2 -0
  5. package/dist/components/Table2/hooks/useTable.d.ts +3 -2
  6. package/dist/esm/packages/taco/src/components/Table2/Table2.js +7 -3
  7. package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
  8. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js +21 -15
  9. package/dist/esm/packages/taco/src/components/Table2/components/column/Cell.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js +2 -5
  11. package/dist/esm/packages/taco/src/components/Table2/components/column/Indicator.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js +44 -15
  13. package/dist/esm/packages/taco/src/components/Table2/components/row/Context.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +23 -44
  15. package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Table2/hooks/useShouldPauseHoverState.js +19 -0
  17. package/dist/esm/packages/taco/src/components/Table2/hooks/useShouldPauseHoverState.js.map +1 -0
  18. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js +5 -3
  19. package/dist/esm/packages/taco/src/components/Table2/hooks/useTable.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js +8 -0
  21. package/dist/esm/packages/taco/src/components/Table2/utilities/columns.js.map +1 -1
  22. package/dist/taco.cjs.development.js +129 -90
  23. package/dist/taco.cjs.development.js.map +1 -1
  24. package/dist/taco.cjs.production.min.js +1 -1
  25. package/dist/taco.cjs.production.min.js.map +1 -1
  26. package/package.json +2 -2
  27. package/types.json +7 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.js","sources":["../../../../../../../../../src/components/Table2/components/column/Cell.tsx"],"sourcesContent":["import React, { RefObject } from 'react';\nimport cn from 'classnames';\nimport { flexRender, Cell as RTCell, Row as RTRow, Table as RTTable, TableMeta } from '@tanstack/react-table';\n\nimport { Input } from '../../../Input/Input';\nimport { ColumnBase, ColumnBaseProps } from './Base';\nimport { getCellAlignmentClasses, getCellSizingClasses, isKeyboardFocusableElement } from '../../utilities/cell';\nimport { isInternalColumn } from '../../utilities/columns';\nimport { Datepicker } from '../../../Datepicker/Datepicker';\nimport { Switch } from '../../../Switch/Switch';\nimport { SaveHandler, SaveHandlerErrorResponse, Table2Filter } from '../../types';\nimport { columnFilterFn, globalFilterFn } from '../../utilities/filterFn';\nimport { MOVE_DIR } from '../../hooks/useEditMode';\nimport { useRowContext } from '../row/Context';\nimport { Indicator, IndicatorReason } from './Indicator';\nimport { ValidationError } from './ValidationError';\nimport { hasChanged, willRowMoveAfterSorting } from './utils';\nimport { useMergedRef } from '../../../../hooks/useMergedRef';\n\ntype CellProps<TType = unknown> = Omit<ColumnBaseProps<TType>, 'column' | 'isEditing'> & {\n cell: RTCell<TType, unknown>;\n index: number;\n isLastRow: boolean;\n rowIndex: number;\n rows: RTRow<TType>[];\n scrollToIndex: (index: number, options?: any) => void;\n scrollToOffset: (index: number, options?: any) => void;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport const Cell = function Cell<TType = unknown>(props: CellProps<TType>) {\n const { cell, index, isLastRow, rowIndex, rows, scrollToIndex, scrollToOffset, table, tableRef, ...columnProps } = props;\n const meta = table.options.meta as TableMeta<any>;\n\n const { addFocussableColumnIndex, focussableColumnIndexes: allFocussableColumnIndexes } = meta;\n\n const { validationErrors, rowMoveReason } = useRowContext();\n const hasValidationErrorsInRow = !!validationErrors;\n\n const internalRef = React.useRef<HTMLDivElement>(null);\n const controlRef = React.useRef<HTMLElement>(null);\n const disableTruncation = cell.column.columnDef.meta?.disableTruncation;\n const cellClassName = cell.column.columnDef.meta?.className;\n\n const isActiveRow = meta.activeRowIndex === rowIndex;\n const isHoveredRow = meta.hoveredRowIndex === rowIndex;\n const isPinned = !!cell.column.getIsPinned();\n const isDragging = meta.dragging[cell.row.id];\n const isSelected = cell.row.getIsSelected();\n const isDataColumn = !isInternalColumn(cell.column.id);\n const hasCellControl = !!cell.column.columnDef.meta?.control;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n\n // editing\n const isEditingThisRow = meta.editMode.isEditing && isActiveRow;\n const canEditThisCell = isEditingThisRow && isDataColumn;\n const isEditingThisCell = canEditThisCell && meta.editMode.columnIndex === index;\n const isHoveringThisRowWhileEditing = meta.editMode.isEditing && isHoveredRow;\n\n const isIndicatorVisible = Object.keys(rowMoveReason).length > 0;\n\n React.useEffect(() => {\n // Adds padding to the table so that indicator doesn't get cropped\n if (isIndicatorVisible && isLastRow) {\n tableRef.current?.classList.add('pb-4');\n }\n\n return () => tableRef.current?.classList.remove('pb-4');\n }, [isIndicatorVisible, isLastRow]);\n\n const className = cn(\n {\n 'border-b': !isLastRow,\n 'sticky z-[1]': isPinned,\n // use isHoveredRow rather than css group-hover/row because we want to hide hover state when keyboard navigating\n 'bg-white': !isActiveRow && !isSelected && !isHoveredRow,\n 'bg-grey-100': !isActiveRow && !isSelected && isHoveredRow,\n 'bg-grey-200 group-hover/row:bg-grey-200': isActiveRow && !isSelected,\n 'bg-blue-100': isSelected,\n '!wcag-blue-500': isDragging,\n '[&>*]:!grayscale [&_.bg-white]:!bg-grey-100': !isEditingThisRow && isHoveringThisRowWhileEditing,\n '!bg-red-100': hasValidationErrorsInRow,\n 'z-[1]': isPinned && isActiveRow,\n // First column should have higher z-index so that row indicator always show on top of the cell\n // control components.\n 'z-[2]': isPinned && isActiveRow && index === 0,\n 'border-blue !border-y-2 border-x-0': isIndicatorVisible,\n 'border-l-2 rounded-l': isIndicatorVisible && index === 0,\n 'border-r-2 rounded-r': isIndicatorVisible && index === lastColumnIndex,\n },\n getCellSizingClasses(\n table.options.meta?.rowDensity,\n (isEditingThisRow || isHoveringThisRowWhileEditing) && hasCellControl\n ),\n typeof cellClassName === 'function' ? cellClassName(cell.row) : cellClassName\n );\n\n const handleMouseDown = (event: React.MouseEvent<HTMLElement>) => {\n // only detect left clicks\n if (event.button === 0) {\n const activeElement = document.activeElement;\n const isActiveElementControl = activeElement?.closest('[role=\"cell\"]');\n const hasActiveRowChanged = meta.activeRowIndex !== rowIndex;\n\n // When user clicks on a cell that is not in the active row, for some reason blur event is not called on the cell\n // previous cell control element so we need to manually call it in order to save the changes in that cell\n if (isActiveElementControl && hasActiveRowChanged) {\n (activeElement as HTMLElement).blur();\n }\n\n meta.setActiveRowIndex(rowIndex);\n\n if (meta.editMode.isEditing) {\n if (allFocussableColumnIndexes.includes(index)) {\n meta.editMode.setColumn(index);\n } else {\n meta.editMode.setColumn(allFocussableColumnIndexes[0]);\n }\n }\n }\n };\n\n const attributes = {\n ...columnProps,\n // base props,\n column: cell.column,\n table,\n // dom attributes\n className,\n 'data-column-index': index,\n 'data-row-index': rowIndex,\n onMouseDown: handleMouseDown,\n ref: internalRef,\n role: 'cell',\n };\n\n const [detailModeEditing, setDetailModeEditing] = React.useState(false);\n\n const detailModeClassName = cn({\n '!shadow-[0_0_0_4px_rgba(0,99,255,0.25)]': detailModeEditing,\n });\n\n // reset the editing state when we move column\n React.useEffect(() => {\n if (meta.editMode.columnIndex !== index) {\n setDetailModeEditing(false);\n }\n }, [meta.editMode.columnIndex]);\n\n React.useEffect(() => {\n if (isEditingThisRow && controlRef.current && isKeyboardFocusableElement(controlRef.current)) {\n addFocussableColumnIndex(index);\n }\n }, [isEditingThisRow, allFocussableColumnIndexes, addFocussableColumnIndex, index]);\n\n const moveRow = (moveDirection: MOVE_DIR) => {\n if (moveDirection === MOVE_DIR.PREV) {\n meta.moveToPreviousRow(rows, nextIndex => scrollToIndex(nextIndex - 1));\n } else if (moveDirection === MOVE_DIR.NEXT) {\n meta.moveToNextRow(rows, nextIndex => scrollToIndex(nextIndex + 2));\n }\n };\n\n if (meta.editMode.onSave && hasCellControl && (canEditThisCell || (isHoveringThisRowWhileEditing && isDataColumn))) {\n attributes.onMouseDown = event => {\n handleMouseDown(event);\n\n const target = event.target;\n const isTargetInput = target !== null && (target as HTMLElement).nodeName === 'INPUT';\n\n // event.target?.select is only truthy for input elements\n // if event.target is active element, then that means we should select the text\n if (isTargetInput && target !== document.activeElement) {\n event.preventDefault();\n\n setTimeout(() => {\n (target as HTMLInputElement).select();\n }, 1);\n } else if (isTargetInput && target === document.activeElement) {\n // if user left clicks on the input then we are into edit mode\n // only detect left clicks\n if (event.button === 0) {\n setDetailModeEditing(true);\n }\n }\n };\n\n if (canEditThisCell) {\n const firstDataColumnIndex = allFocussableColumnIndexes.at(0) ?? 0;\n const lastDataColumnIndex = allFocussableColumnIndexes.at(-1) ?? 0;\n\n attributes.onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const control = event.target as HTMLElement;\n const isControlInput =\n control.nodeName === 'INPUT' && control?.getAttribute('data-inline-editing-component') === 'true';\n\n // For some reason, Taco Input keyboard event always return true when \"event.isDefaultPrevented()\" is\n // called. So we need to check if the control is input or not so that we don't return early.\n if (!isControlInput && (event.isDefaultPrevented() || event.isPropagationStopped())) {\n return;\n }\n\n if (control.tagName === 'INPUT') {\n if (event.key === 'Enter') {\n event.preventDefault();\n const input = control as HTMLInputElement;\n\n if (!detailModeEditing) {\n input.setSelectionRange?.(input.value?.length, input.value?.length);\n setDetailModeEditing(true);\n }\n\n return;\n }\n }\n\n // Don't exit edit mode if the target of the escape isn't a child of the cell (e.g. if its a popover).\n if (event.key === 'Escape' && event.currentTarget.contains(control)) {\n event.preventDefault();\n const input = control as HTMLInputElement;\n\n if (detailModeEditing) {\n input?.select?.();\n setDetailModeEditing(false);\n } else {\n meta.editMode.toggleEditing(false);\n tableRef.current?.focus();\n }\n\n return;\n }\n\n if ((!detailModeEditing && event.key === 'ArrowLeft') || (event.key === 'Tab' && event.shiftKey)) {\n event.preventDefault();\n\n const isFirstRow = rowIndex === 0;\n const isFirstColumn = index === firstDataColumnIndex;\n\n if (event.ctrlKey || event.metaKey) {\n // If the current active column is the first column then we don't do any thing so that focus\n // remains on the first column.\n if (!isFirstColumn) {\n control.blur();\n meta.editMode.moveToFirstColumn(allFocussableColumnIndexes);\n }\n } else {\n // If it is first row and first column, then don't move column.\n if (!isFirstRow || !isFirstColumn) {\n control.blur();\n meta.editMode.moveToPreviousColumn(allFocussableColumnIndexes, moveRow);\n }\n }\n\n return;\n }\n\n if ((!detailModeEditing && event.key === 'ArrowRight') || (event.key === 'Tab' && !event.shiftKey)) {\n event.preventDefault();\n\n const isLastColumn = index === lastDataColumnIndex;\n\n if (event.ctrlKey || event.metaKey) {\n // If the current active column is the last column then we don't do any thing so that focus\n // remains on the last column.\n if (!isLastColumn) {\n control.blur();\n meta.editMode.moveToLastColumn(allFocussableColumnIndexes);\n }\n } else {\n // If it is last row and last column, then don't move column.\n if (!isLastRow || !isLastColumn) {\n control.blur();\n meta.editMode.moveToNextColumn(allFocussableColumnIndexes, moveRow);\n }\n }\n\n return;\n }\n\n if (!detailModeEditing && event.key === 'ArrowUp') {\n event.preventDefault();\n\n // if it is the first row then return early, so that focus on the cell is not lost\n if (rowIndex === 0) {\n return;\n }\n\n control.blur();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(0);\n\n scrollToOffset(0);\n } else {\n moveRow(MOVE_DIR.PREV);\n }\n\n meta.setHoveredRowIndex(undefined);\n return;\n }\n\n if (!detailModeEditing && event.key === 'ArrowDown') {\n event.preventDefault();\n\n // if it is the last row then return early, so that focus on the cell is not lost\n if (rowIndex === rows.length - 1) {\n return;\n }\n\n control.blur();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(rows.length - 1);\n scrollToIndex(rows.length + 20);\n } else {\n moveRow(MOVE_DIR.NEXT);\n }\n\n meta.setHoveredRowIndex(undefined);\n return;\n }\n };\n }\n\n return (\n <ColumnBase {...attributes}>\n <EditingCell\n detailModeClassName={detailModeClassName}\n cell={cell}\n cellRef={internalRef}\n columnIndex={index}\n isEditingThisCell={isEditingThisCell}\n onSave={meta.editMode.onSave}\n rowIndex={rowIndex}\n table={table}\n ref={controlRef}\n rowValues={rows[rowIndex].original}\n rowsLength={rows.length}\n />\n </ColumnBase>\n );\n } else {\n if (meta.onRowClick) {\n attributes.onClick = event => {\n if (event.target !== internalRef.current) {\n return;\n }\n\n meta.onRowClick?.(cell.row.original);\n };\n }\n }\n\n return (\n <ColumnBase {...attributes}>\n <div className={disableTruncation ? '-my-[0.45rem]' : 'truncate'}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </ColumnBase>\n );\n};\n\ntype EditingCellProps = {\n cell: RTCell<any, unknown>;\n cellRef: React.RefObject<HTMLDivElement>;\n columnIndex: number;\n isEditingThisCell: boolean;\n onSave: SaveHandler<any>;\n rowIndex: number;\n table: RTTable<any>;\n rowValues: Record<string, any>;\n rowsLength: number;\n detailModeClassName?: string;\n};\n\nconst EditingCell = React.memo(\n React.forwardRef<HTMLElement, EditingCellProps>((props, ref) => {\n const {\n cell,\n cellRef,\n columnIndex,\n detailModeClassName,\n isEditingThisCell = false,\n onSave: handleSave,\n rowIndex,\n rowValues,\n table,\n } = props;\n const { validationErrors, setValidationErrors, rowMoveReason, setRowMoveReason } = useRowContext();\n\n const controlRef = useMergedRef(ref);\n const cellId = cell.column.id;\n const cellValidationError = validationErrors?.[cellId];\n\n const value = cell.getValue();\n const ariaLabel = cell.column.columnDef.header as string | undefined;\n const meta = table.options.meta as TableMeta<any>;\n const { globalFilter } = table.getState();\n\n const [state, setState] = React.useState(value);\n\n const isHoveringAnotherRowWhileEditing =\n meta.editMode.isEditing && meta.activeRowIndex !== rowIndex && meta.hoveredRowIndex === rowIndex;\n const hasValidationError = !isHoveringAnotherRowWhileEditing && !!cellValidationError;\n // On each save, the initialValue will be set to the new value of the cell\n const initialValue = React.useRef<any>(value);\n\n // It is important that we let consumers pass a newValue as an argument because when setState is called before\n // onBlur then saveIfChanged method gets the stale state value. This happens because the rerender hasn't happened\n // before the saveIfChanged method is called.\n const saveIfChanged = async (eventOrNewValue?: any) => {\n let newValue = state;\n\n // if eventOrNewValue is not an event object\n if (!eventOrNewValue.target) {\n newValue = eventOrNewValue;\n }\n\n if (hasChanged(value, newValue)) {\n try {\n const updatedRow = { ...cell.row.original, [cellId]: newValue };\n\n await handleSave(updatedRow, cellId);\n\n // If sorting is paused then update the last sorted or filtered rows to store the newly updated row\n if (meta.shouldPauseSortingAndFiltering) {\n meta.lastSortedOrFilteredRows.current = meta.lastSortedOrFilteredRows.current.map(row => {\n if (row.id === cell.row.id) {\n row.original = updatedRow;\n }\n\n return row;\n });\n }\n\n // Reset error if save was successful\n setValidationErrors(null);\n } catch (error) {\n setValidationErrors({ ...validationErrors, ...(error as SaveHandlerErrorResponse) });\n }\n }\n };\n\n // Ensures we \"auto focus\" the field if the cell is being edited.\n React.useEffect(() => {\n const isFocusInsideTable = meta.tableRef.current?.contains(document.activeElement);\n // When control is blurred then body gets the focus that's why we have to make sure if activeElement\n // is body then we focus the cell if it is being edited.\n const isBodyFocussed = document.body === document.activeElement;\n\n // Don't focus cell if any table popup(filter popup, column settings popup) is open.\n if (isEditingThisCell && (isFocusInsideTable || isBodyFocussed)) {\n (controlRef.current as HTMLElement)?.focus?.();\n }\n }, [isEditingThisCell, controlRef.current]);\n\n // make sure the cell becomes active if the field is focused\n const handleFocus = event => {\n meta.editMode.setColumn(columnIndex);\n\n if (event.target?.select) {\n event.target?.select();\n }\n };\n\n React.useEffect(() => {\n if (hasChanged(initialValue.current, state)) {\n showIndicator();\n } else {\n hideIndicator();\n }\n\n return hideIndicator;\n }, [state]);\n\n const showIndicator = () => {\n let willRowMoveReason: IndicatorReason | null = null;\n\n const isFilteredByGlobalFilter = Object.values<unknown>({ ...rowValues, [cellId]: state }).some(cellValue =>\n // Global filter can be undefined when there is no text being searched so we pass an empty string to\n // globalFilterFn as query in that case.\n globalFilterFn(String(cellValue), globalFilter ? String(globalFilter) : '')\n );\n\n if (!isFilteredByGlobalFilter) {\n willRowMoveReason = IndicatorReason.SEARCH;\n } else if (cell.column.getIsFiltered() && !columnFilterFn(state, cell.column.getFilterValue() as Table2Filter)) {\n willRowMoveReason = IndicatorReason.FILTER;\n } else if (\n !willRowMoveReason &&\n cell.column.getIsSorted() &&\n willRowMoveAfterSorting(\n state,\n cell,\n rowIndex,\n table.getRowModel().rows,\n !!table.getState().sorting.find(s => s.id === cell.column.id)?.desc\n )\n ) {\n willRowMoveReason = IndicatorReason.SORTING;\n }\n\n if (willRowMoveReason !== null) {\n meta.setShouldPauseSortingAndFiltering(true);\n setRowMoveReason({ [cellId]: willRowMoveReason });\n }\n };\n\n const hideIndicator = () => {\n setRowMoveReason(prevState => {\n const newState = { ...prevState };\n delete newState[cellId];\n\n return newState;\n });\n };\n\n const cellControl = cell.column.columnDef.meta?.control;\n\n const attributes = {\n 'aria-label': ariaLabel,\n onBlur: saveIfChanged,\n onFocus: handleFocus,\n ref,\n // This is a temporary fix to enable up/down arrow key shortcuts on input in quick mode. For some reason,\n // the preventDefault is true on Taco Input, so the keyboard shortcuts doesn't work. By adding this\n // data attribute we make sure the event is coming from a control component, and then we can make sure\n // keyboard shortcut works as expected.\n 'data-inline-editing-component': 'true',\n };\n\n const className = cn(getCellAlignmentClasses(cell.column.columnDef.meta?.align));\n const indicatorMountNode = cellRef.current?.parentElement?.querySelector(':first-child') as Element | null;\n\n let controlComponent;\n\n if (cellControl) {\n if (typeof cellControl === 'function') {\n controlComponent = cellControl(\n {\n invalid: hasValidationError,\n onBlur: saveIfChanged,\n onFocus: handleFocus,\n ref: controlRef,\n setValue: setState,\n value: state,\n 'data-inline-editing-component': 'true',\n className: detailModeClassName,\n },\n cell.row.original\n );\n } else {\n switch (cellControl) {\n case 'datepicker':\n controlComponent = (\n <Datepicker\n {...attributes}\n className={detailModeClassName}\n invalid={hasValidationError}\n onBlur={event => {\n const newDate = (event as any).detail;\n saveIfChanged(newDate);\n }}\n onChange={event => {\n setState((event as any).detail);\n }}\n ref={controlRef as RefObject<HTMLInputElement>}\n value={state as Date}\n />\n );\n break;\n\n case 'switch':\n controlComponent = (\n <Switch\n {...attributes}\n className={cn('mx-2 mt-1.5', detailModeClassName)}\n checked={Boolean(state)}\n onChange={setState}\n ref={controlRef as RefObject<HTMLButtonElement>}\n />\n );\n break;\n default:\n controlComponent = (\n <Input\n {...attributes}\n className={cn(className, detailModeClassName)}\n invalid={hasValidationError}\n onChange={event => {\n setState(event.target.value);\n }}\n ref={controlRef as RefObject<HTMLInputElement>}\n value={String(state ?? '')}\n />\n );\n break;\n }\n }\n }\n\n const indicatorReason = rowMoveReason[cellId] ?? null;\n\n return (\n <>\n {indicatorReason !== null && (\n <Indicator\n reason={indicatorReason}\n columnName={String(cell.column.columnDef.header)}\n mountNode={indicatorMountNode}\n />\n )}\n <span className=\"relative flex-grow\">\n {controlComponent}\n {hasValidationError && <ValidationError>{String(cellValidationError)}</ValidationError>}\n </span>\n </>\n );\n })\n);\n"],"names":["Cell","props","cell","index","isLastRow","rowIndex","rows","scrollToIndex","scrollToOffset","table","tableRef","columnProps","meta","options","addFocussableColumnIndex","focussableColumnIndexes","allFocussableColumnIndexes","validationErrors","rowMoveReason","useRowContext","hasValidationErrorsInRow","internalRef","React","useRef","controlRef","disableTruncation","column","columnDef","cellClassName","className","isActiveRow","activeRowIndex","isHoveredRow","hoveredRowIndex","isPinned","getIsPinned","isDragging","dragging","row","id","isSelected","getIsSelected","isDataColumn","isInternalColumn","hasCellControl","control","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","length","isEditingThisRow","editMode","isEditing","canEditThisCell","isEditingThisCell","columnIndex","isHoveringThisRowWhileEditing","isIndicatorVisible","Object","keys","useEffect","current","classList","add","remove","cn","getCellSizingClasses","rowDensity","handleMouseDown","event","button","activeElement","document","isActiveElementControl","closest","hasActiveRowChanged","blur","setActiveRowIndex","includes","setColumn","attributes","onMouseDown","ref","role","detailModeEditing","setDetailModeEditing","useState","detailModeClassName","isKeyboardFocusableElement","moveRow","moveDirection","MOVE_DIR","PREV","moveToPreviousRow","nextIndex","NEXT","moveToNextRow","onSave","target","isTargetInput","nodeName","preventDefault","setTimeout","select","firstDataColumnIndex","at","lastDataColumnIndex","onKeyDown","isControlInput","getAttribute","isDefaultPrevented","isPropagationStopped","tagName","key","input","setSelectionRange","value","currentTarget","contains","toggleEditing","focus","shiftKey","isFirstRow","isFirstColumn","ctrlKey","metaKey","moveToFirstColumn","moveToPreviousColumn","isLastColumn","moveToLastColumn","moveToNextColumn","setHoveredRowIndex","undefined","ColumnBase","EditingCell","cellRef","rowValues","original","rowsLength","onRowClick","onClick","flexRender","getContext","memo","forwardRef","handleSave","setValidationErrors","setRowMoveReason","useMergedRef","cellId","cellValidationError","getValue","ariaLabel","header","globalFilter","getState","state","setState","isHoveringAnotherRowWhileEditing","hasValidationError","initialValue","saveIfChanged","eventOrNewValue","newValue","hasChanged","updatedRow","shouldPauseSortingAndFiltering","lastSortedOrFilteredRows","map","error","isFocusInsideTable","isBodyFocussed","body","handleFocus","showIndicator","hideIndicator","willRowMoveReason","isFilteredByGlobalFilter","values","some","cellValue","globalFilterFn","String","IndicatorReason","SEARCH","getIsFiltered","columnFilterFn","getFilterValue","FILTER","getIsSorted","willRowMoveAfterSorting","getRowModel","sorting","find","s","desc","SORTING","setShouldPauseSortingAndFiltering","prevState","newState","cellControl","onBlur","onFocus","getCellAlignmentClasses","align","indicatorMountNode","parentElement","querySelector","controlComponent","invalid","setValue","Datepicker","newDate","detail","onChange","Switch","checked","Boolean","Input","indicatorReason","Indicator","reason","columnName","mountNode","ValidationError"],"mappings":";;;;;;;;;;;;;;;;;;MA8BaA,IAAI,GAAG,SAASA,IAAI,CA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AkB,iBAAIzI,6BAAC0M,eAAe,QAAE1C,MAAM,CAAChC,mBAAmB,CAAC,CAAmB,CACpF,CACR;AAEX,CAAC,CAAC,CACL;;;;"}
1
+ {"version":3,"file":"Cell.js","sources":["../../../../../../../../../src/components/Table2/components/column/Cell.tsx"],"sourcesContent":["import React, { RefObject } from 'react';\nimport cn from 'classnames';\nimport { flexRender, Cell as RTCell, Row as RTRow, Table as RTTable, TableMeta } from '@tanstack/react-table';\nimport { Input } from '../../../Input/Input';\nimport { ColumnBase, ColumnBaseProps } from './Base';\nimport { getCellAlignmentClasses, getCellSizingClasses, isKeyboardFocusableElement } from '../../utilities/cell';\nimport { isInternalColumn } from '../../utilities/columns';\nimport { Datepicker } from '../../../Datepicker/Datepicker';\nimport { Switch } from '../../../Switch/Switch';\nimport { SaveHandler, SaveHandlerErrorResponse, Table2Filter } from '../../types';\nimport { columnFilterFn, globalFilterFn } from '../../utilities/filterFn';\nimport { MOVE_DIR } from '../../hooks/useEditMode';\nimport { useRowContext } from '../row/Context';\nimport { Indicator, IndicatorReason } from './Indicator';\nimport { ValidationError } from './ValidationError';\nimport { hasChanged, willRowMoveAfterSorting } from './utils';\nimport { useMergedRef } from '../../../../hooks/useMergedRef';\n\ntype CellProps<TType = unknown> = Omit<ColumnBaseProps<TType>, 'column' | 'isEditing'> & {\n cell: RTCell<TType, unknown>;\n index: number;\n isLastRow: boolean;\n rowIndex: number;\n rows: RTRow<TType>[];\n scrollToIndex: (index: number, options?: any) => void;\n scrollToOffset: (index: number, options?: any) => void;\n tableRef: React.RefObject<HTMLDivElement>;\n};\n\nexport const Cell = function Cell<TType = unknown>(props: CellProps<TType>) {\n const { cell, index, isLastRow, rowIndex, rows, scrollToIndex, scrollToOffset, table, tableRef, ...columnProps } = props;\n const meta = table.options.meta as TableMeta<any>;\n\n const { addFocussableColumnIndex, focussableColumnIndexes: allFocussableColumnIndexes } = meta;\n\n const {\n editMode: { validationErrors, rowMoveReason },\n isHovered: isHoveredRow,\n } = useRowContext();\n const hasValidationErrorsInRow = !!validationErrors;\n\n const internalRef = React.useRef<HTMLDivElement>(null);\n const controlRef = React.useRef<HTMLElement>(null);\n const disableTruncation = cell.column.columnDef.meta?.disableTruncation;\n const cellClassName = cell.column.columnDef.meta?.className;\n\n const isActiveRow = meta.activeRowIndex === rowIndex;\n const isPinned = !!cell.column.getIsPinned();\n const isDragging = meta.dragging[cell.row.id];\n const isSelected = cell.row.getIsSelected();\n const isDataColumn = !isInternalColumn(cell.column.id);\n const hasCellControl = !!cell.column.columnDef.meta?.control;\n const allVisibleColumns = table.getVisibleLeafColumns();\n const lastColumnIndex = allVisibleColumns.length > 0 ? allVisibleColumns.length - 1 : 0;\n\n // editing\n const isEditingThisRow = meta.editMode.isEditing && isActiveRow;\n const canEditThisCell = isEditingThisRow && isDataColumn;\n const isEditingThisCell = canEditThisCell && meta.editMode.columnIndex === index;\n const isHoveringThisRowWhileEditing = meta.editMode.isEditing && isHoveredRow && !meta.shouldPauseHoverState;\n\n const isIndicatorVisible = Object.keys(rowMoveReason).length > 0;\n\n React.useEffect(() => {\n // Adds padding to the table so that indicator doesn't get cropped\n if (isIndicatorVisible && isLastRow) {\n tableRef.current?.classList.add('pb-4');\n }\n\n return () => tableRef.current?.classList.remove('pb-4');\n }, [isIndicatorVisible, isLastRow]);\n\n const className = cn(\n {\n 'border-b': !isLastRow,\n 'sticky z-[1]': isPinned,\n // use isHoveredRow rather than css group-hover/row because we want to hide hover state when keyboard navigating\n 'bg-white': !isActiveRow && !isSelected,\n 'group-hover/row:bg-grey-100': !isActiveRow && !isSelected && !meta.shouldPauseHoverState,\n 'bg-grey-200 group-hover/row:bg-grey-200': isActiveRow && !isSelected,\n 'bg-blue-100': isSelected,\n '!wcag-blue-500': isDragging,\n '[&>*]:!grayscale [&_.bg-white]:!bg-grey-100': !isEditingThisRow && isHoveringThisRowWhileEditing,\n '!bg-red-100': hasValidationErrorsInRow,\n 'z-[1]': isPinned && isActiveRow,\n // First column should have higher z-index so that row indicator always show on top of the cell\n // control components.\n 'z-[2]': isPinned && isActiveRow && index === 0,\n 'border-blue !border-y-2 border-x-0': isIndicatorVisible,\n 'border-l-2 rounded-l': isIndicatorVisible && index === 0,\n 'border-r-2 rounded-r': isIndicatorVisible && index === lastColumnIndex,\n },\n getCellSizingClasses(\n table.options.meta?.rowDensity,\n (isEditingThisRow || isHoveringThisRowWhileEditing) && hasCellControl\n ),\n typeof cellClassName === 'function' ? cellClassName(cell.row) : cellClassName\n );\n\n const handleMouseDown = (event: React.MouseEvent<HTMLElement>) => {\n // only detect left clicks\n if (event.button === 0) {\n const activeElement = document.activeElement;\n const isActiveElementControl = activeElement?.closest('[role=\"cell\"]');\n const hasActiveRowChanged = meta.activeRowIndex !== rowIndex;\n\n // When user clicks on a cell that is not in the active row, for some reason blur event is not called on the cell\n // previous cell control element so we need to manually call it in order to save the changes in that cell\n if (isActiveElementControl && hasActiveRowChanged) {\n (activeElement as HTMLElement).blur();\n }\n\n meta.setActiveRowIndex(rowIndex);\n\n if (meta.editMode.isEditing) {\n if (allFocussableColumnIndexes.includes(index)) {\n meta.editMode.setColumn(index);\n } else {\n meta.editMode.setColumn(allFocussableColumnIndexes[0]);\n }\n }\n }\n };\n\n const attributes = {\n ...columnProps,\n // base props,\n column: cell.column,\n table,\n // dom attributes\n className,\n 'data-column-index': index,\n 'data-row-index': rowIndex,\n onMouseDown: handleMouseDown,\n ref: internalRef,\n role: 'cell',\n };\n\n const [detailModeEditing, setDetailModeEditing] = React.useState(false);\n\n const detailModeClassName = cn({\n '!shadow-[0_0_0_4px_rgba(0,99,255,0.25)]': detailModeEditing,\n });\n\n // reset the editing state when we move column\n React.useEffect(() => {\n if (meta.editMode.columnIndex !== index) {\n setDetailModeEditing(false);\n }\n }, [meta.editMode.columnIndex]);\n\n React.useEffect(() => {\n if (isEditingThisRow && controlRef.current && isKeyboardFocusableElement(controlRef.current)) {\n addFocussableColumnIndex(index);\n }\n }, [isEditingThisRow, allFocussableColumnIndexes, addFocussableColumnIndex, index]);\n\n const moveRow = (moveDirection: MOVE_DIR) => {\n if (moveDirection === MOVE_DIR.PREV) {\n meta.moveToPreviousRow(rows, nextIndex => scrollToIndex(nextIndex - 1));\n } else if (moveDirection === MOVE_DIR.NEXT) {\n meta.moveToNextRow(rows, nextIndex => scrollToIndex(nextIndex + 2));\n }\n };\n\n if (meta.editMode.onSave && hasCellControl && (canEditThisCell || (isHoveringThisRowWhileEditing && isDataColumn))) {\n attributes.onMouseDown = event => {\n handleMouseDown(event);\n\n const target = event.target;\n const isTargetInput = target !== null && (target as HTMLElement).nodeName === 'INPUT';\n\n // event.target?.select is only truthy for input elements\n // if event.target is active element, then that means we should select the text\n if (isTargetInput && target !== document.activeElement) {\n event.preventDefault();\n\n setTimeout(() => {\n (target as HTMLInputElement).select();\n }, 1);\n } else if (isTargetInput && target === document.activeElement) {\n // if user left clicks on the input then we are into edit mode\n // only detect left clicks\n if (event.button === 0) {\n setDetailModeEditing(true);\n }\n }\n };\n\n if (canEditThisCell) {\n const firstDataColumnIndex = allFocussableColumnIndexes.at(0) ?? 0;\n const lastDataColumnIndex = allFocussableColumnIndexes.at(-1) ?? 0;\n\n attributes.onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const control = event.target as HTMLElement;\n const isControlInput =\n control.nodeName === 'INPUT' && control?.getAttribute('data-inline-editing-component') === 'true';\n\n // For some reason, Taco Input keyboard event always return true when \"event.isDefaultPrevented()\" is\n // called. So we need to check if the control is input or not so that we don't return early.\n if (!isControlInput && (event.isDefaultPrevented() || event.isPropagationStopped())) {\n return;\n }\n\n if (control.tagName === 'INPUT') {\n if (event.key === 'Enter') {\n event.preventDefault();\n const input = control as HTMLInputElement;\n\n if (!detailModeEditing) {\n input.setSelectionRange?.(input.value?.length, input.value?.length);\n setDetailModeEditing(true);\n }\n\n return;\n }\n }\n\n // Don't exit edit mode if the target of the escape isn't a child of the cell (e.g. if its a popover).\n if (event.key === 'Escape' && event.currentTarget.contains(control)) {\n event.preventDefault();\n const input = control as HTMLInputElement;\n\n if (detailModeEditing) {\n input?.select?.();\n setDetailModeEditing(false);\n } else {\n meta.editMode.toggleEditing(false);\n tableRef.current?.focus();\n }\n\n return;\n }\n\n if ((!detailModeEditing && event.key === 'ArrowLeft') || (event.key === 'Tab' && event.shiftKey)) {\n event.preventDefault();\n\n const isFirstRow = rowIndex === 0;\n const isFirstColumn = index === firstDataColumnIndex;\n\n if (event.ctrlKey || event.metaKey) {\n // If the current active column is the first column then we don't do any thing so that focus\n // remains on the first column.\n if (!isFirstColumn) {\n control.blur();\n meta.editMode.moveToFirstColumn(allFocussableColumnIndexes);\n }\n } else {\n // If it is first row and first column, then don't move column.\n if (!isFirstRow || !isFirstColumn) {\n control.blur();\n meta.editMode.moveToPreviousColumn(allFocussableColumnIndexes, moveRow);\n }\n }\n\n return;\n }\n\n if ((!detailModeEditing && event.key === 'ArrowRight') || (event.key === 'Tab' && !event.shiftKey)) {\n event.preventDefault();\n\n const isLastColumn = index === lastDataColumnIndex;\n\n if (event.ctrlKey || event.metaKey) {\n // If the current active column is the last column then we don't do any thing so that focus\n // remains on the last column.\n if (!isLastColumn) {\n control.blur();\n meta.editMode.moveToLastColumn(allFocussableColumnIndexes);\n }\n } else {\n // If it is last row and last column, then don't move column.\n if (!isLastRow || !isLastColumn) {\n control.blur();\n meta.editMode.moveToNextColumn(allFocussableColumnIndexes, moveRow);\n }\n }\n\n return;\n }\n\n if (!detailModeEditing && event.key === 'ArrowUp') {\n event.preventDefault();\n\n // if it is the first row then return early, so that focus on the cell is not lost\n if (rowIndex === 0) {\n return;\n }\n\n control.blur();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(0);\n\n scrollToOffset(0);\n } else {\n moveRow(MOVE_DIR.PREV);\n }\n\n meta.setShouldPauseHoverState(true);\n return;\n }\n\n if (!detailModeEditing && event.key === 'ArrowDown') {\n event.preventDefault();\n\n // if it is the last row then return early, so that focus on the cell is not lost\n if (rowIndex === rows.length - 1) {\n return;\n }\n\n control.blur();\n\n if (event.ctrlKey || event.metaKey) {\n meta.setActiveRowIndex(rows.length - 1);\n scrollToIndex(rows.length + 20);\n } else {\n moveRow(MOVE_DIR.NEXT);\n }\n\n meta.setShouldPauseHoverState(true);\n return;\n }\n };\n }\n\n return (\n <ColumnBase {...attributes}>\n <EditingCell\n detailModeClassName={detailModeClassName}\n cell={cell}\n cellRef={internalRef}\n columnIndex={index}\n isEditingThisCell={isEditingThisCell}\n onSave={meta.editMode.onSave}\n rowIndex={rowIndex}\n table={table}\n ref={controlRef}\n rowValues={rows[rowIndex].original}\n rowsLength={rows.length}\n />\n </ColumnBase>\n );\n } else {\n if (meta.onRowClick) {\n attributes.onClick = event => {\n if (event.target !== internalRef.current) {\n return;\n }\n\n meta.onRowClick?.(cell.row.original);\n };\n }\n }\n\n return (\n <ColumnBase {...attributes}>\n <div className={disableTruncation ? '-my-[0.45rem]' : 'truncate'}>\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </div>\n </ColumnBase>\n );\n};\n\ntype EditingCellProps = {\n cell: RTCell<any, unknown>;\n cellRef: React.RefObject<HTMLDivElement>;\n columnIndex: number;\n isEditingThisCell: boolean;\n onSave: SaveHandler<any>;\n rowIndex: number;\n table: RTTable<any>;\n rowValues: Record<string, any>;\n rowsLength: number;\n detailModeClassName?: string;\n};\n\nconst EditingCell = React.memo(\n React.forwardRef<HTMLElement, EditingCellProps>((props, ref) => {\n const {\n cell,\n cellRef,\n columnIndex,\n detailModeClassName,\n isEditingThisCell = false,\n onSave: handleSave,\n rowIndex,\n rowValues,\n table,\n } = props;\n const {\n editMode: { validationErrors, setValidationErrors, rowMoveReason, setRowMoveReason },\n isHovered,\n } = useRowContext();\n\n const controlRef = useMergedRef(ref);\n const cellId = cell.column.id;\n const cellValidationError = validationErrors?.[cellId];\n\n const value = cell.getValue();\n const ariaLabel = cell.column.columnDef.header as string | undefined;\n const meta = table.options.meta as TableMeta<any>;\n const { globalFilter } = table.getState();\n\n const [state, setState] = React.useState(value);\n\n const isHoveringAnotherRowWhileEditing = meta.editMode.isEditing && meta.activeRowIndex !== rowIndex && isHovered;\n const hasValidationError = !isHoveringAnotherRowWhileEditing && !!cellValidationError;\n // On each save, the initialValue will be set to the new value of the cell\n const initialValue = React.useRef<any>(value);\n\n // It is important that we let consumers pass a newValue as an argument because when setState is called before\n // onBlur then saveIfChanged method gets the stale state value. This happens because the rerender hasn't happened\n // before the saveIfChanged method is called.\n const saveIfChanged = async (eventOrNewValue?: any) => {\n let newValue = state;\n\n // if eventOrNewValue is not an event object\n if (!eventOrNewValue.target) {\n newValue = eventOrNewValue;\n }\n\n if (hasChanged(value, newValue)) {\n try {\n const updatedRow = { ...cell.row.original, [cellId]: newValue };\n\n await handleSave(updatedRow, cellId);\n\n // If sorting is paused then update the last sorted or filtered rows to store the newly updated row\n if (meta.shouldPauseSortingAndFiltering) {\n meta.lastSortedOrFilteredRows.current = meta.lastSortedOrFilteredRows.current.map(row => {\n if (row.id === cell.row.id) {\n row.original = updatedRow;\n }\n\n return row;\n });\n }\n\n // Reset error if save was successful\n setValidationErrors(null);\n } catch (error) {\n setValidationErrors({ ...validationErrors, ...(error as SaveHandlerErrorResponse) });\n }\n }\n };\n\n // Ensures we \"auto focus\" the field if the cell is being edited.\n React.useEffect(() => {\n const isFocusInsideTable = meta.tableRef.current?.contains(document.activeElement);\n // When control is blurred then body gets the focus that's why we have to make sure if activeElement\n // is body then we focus the cell if it is being edited.\n const isBodyFocussed = document.body === document.activeElement;\n\n // Don't focus cell if any table popup(filter popup, column settings popup) is open.\n if (isEditingThisCell && (isFocusInsideTable || isBodyFocussed)) {\n (controlRef.current as HTMLElement)?.focus?.();\n }\n }, [isEditingThisCell, controlRef.current]);\n\n // make sure the cell becomes active if the field is focused\n const handleFocus = event => {\n meta.editMode.setColumn(columnIndex);\n\n if (event.target?.select) {\n event.target?.select();\n }\n };\n\n React.useEffect(() => {\n if (hasChanged(initialValue.current, state)) {\n showIndicator();\n } else {\n hideIndicator();\n }\n\n return hideIndicator;\n }, [state]);\n\n const showIndicator = () => {\n let willRowMoveReason: IndicatorReason | null = null;\n\n const isFilteredByGlobalFilter = Object.values<unknown>({ ...rowValues, [cellId]: state }).some(cellValue =>\n // Global filter can be undefined when there is no text being searched so we pass an empty string to\n // globalFilterFn as query in that case.\n globalFilterFn(String(cellValue), globalFilter ? String(globalFilter) : '')\n );\n\n if (!isFilteredByGlobalFilter) {\n willRowMoveReason = IndicatorReason.SEARCH;\n } else if (cell.column.getIsFiltered() && !columnFilterFn(state, cell.column.getFilterValue() as Table2Filter)) {\n willRowMoveReason = IndicatorReason.FILTER;\n } else if (\n !willRowMoveReason &&\n cell.column.getIsSorted() &&\n willRowMoveAfterSorting(\n state,\n cell,\n rowIndex,\n table.getRowModel().rows,\n !!table.getState().sorting.find(s => s.id === cell.column.id)?.desc\n )\n ) {\n willRowMoveReason = IndicatorReason.SORTING;\n }\n\n if (willRowMoveReason !== null) {\n meta.setShouldPauseSortingAndFiltering(true);\n setRowMoveReason({ [cellId]: willRowMoveReason });\n }\n };\n\n const hideIndicator = () => {\n setRowMoveReason(prevState => {\n const newState = { ...prevState };\n delete newState[cellId];\n\n return newState;\n });\n };\n\n const cellControl = cell.column.columnDef.meta?.control;\n\n const attributes = {\n 'aria-label': ariaLabel,\n onBlur: saveIfChanged,\n onFocus: handleFocus,\n ref,\n // This is a temporary fix to enable up/down arrow key shortcuts on input in quick mode. For some reason,\n // the preventDefault is true on Taco Input, so the keyboard shortcuts doesn't work. By adding this\n // data attribute we make sure the event is coming from a control component, and then we can make sure\n // keyboard shortcut works as expected.\n 'data-inline-editing-component': 'true',\n };\n\n const className = cn(getCellAlignmentClasses(cell.column.columnDef.meta?.align));\n const indicatorMountNode = cellRef.current?.parentElement?.querySelector(':first-child') as Element | null;\n\n let controlComponent;\n\n if (cellControl) {\n if (typeof cellControl === 'function') {\n controlComponent = cellControl(\n {\n invalid: hasValidationError,\n onBlur: saveIfChanged,\n onFocus: handleFocus,\n ref: controlRef,\n setValue: setState,\n value: state,\n 'data-inline-editing-component': 'true',\n className: detailModeClassName,\n },\n cell.row.original\n );\n } else {\n switch (cellControl) {\n case 'datepicker':\n controlComponent = (\n <Datepicker\n {...attributes}\n className={detailModeClassName}\n invalid={hasValidationError}\n onBlur={event => {\n const newDate = (event as any).detail;\n saveIfChanged(newDate);\n }}\n onChange={event => {\n setState((event as any).detail);\n }}\n ref={controlRef as RefObject<HTMLInputElement>}\n value={state as Date}\n />\n );\n break;\n\n case 'switch':\n controlComponent = (\n <Switch\n {...attributes}\n className={cn('mx-2 mt-1.5', detailModeClassName)}\n checked={Boolean(state)}\n onChange={setState}\n ref={controlRef as RefObject<HTMLButtonElement>}\n />\n );\n break;\n default:\n controlComponent = (\n <Input\n {...attributes}\n className={cn(className, detailModeClassName)}\n invalid={hasValidationError}\n onChange={event => {\n setState(event.target.value);\n }}\n ref={controlRef as RefObject<HTMLInputElement>}\n value={String(state ?? '')}\n />\n );\n break;\n }\n }\n }\n\n const indicatorReason = rowMoveReason[cellId] ?? null;\n\n return (\n <>\n {indicatorReason !== null && (\n <Indicator\n reason={indicatorReason}\n columnName={String(cell.column.columnDef.header)}\n mountNode={indicatorMountNode}\n validationErrors={validationErrors}\n />\n )}\n <span className=\"relative flex-grow\">\n {controlComponent}\n {hasValidationError && <ValidationError>{String(cellValidationError)}</ValidationError>}\n </span>\n </>\n );\n })\n);\n"],"names":["Cell","props","cell","index","isLastRow","rowIndex","rows","scrollToIndex","scrollToOffset","table","tableRef","columnProps","meta","options","addFocussableColumnIndex","focussableColumnIndexes","allFocussableColumnIndexes","editMode","validationErrors","rowMoveReason","isHovered","isHoveredRow","useRowContext","hasValidationErrorsInRow","internalRef","React","useRef","controlRef","disableTruncation","column","columnDef","cellClassName","className","isActiveRow","activeRowIndex","isPinned","getIsPinned","isDragging","dragging","row","id","isSelected","getIsSelected","isDataColumn","isInternalColumn","hasCellControl","control","allVisibleColumns","getVisibleLeafColumns","lastColumnIndex","length","isEditingThisRow","isEditing","canEditThisCell","isEditingThisCell","columnIndex","isHoveringThisRowWhileEditing","shouldPauseHoverState","isIndicatorVisible","Object","keys","useEffect","current","classList","add","remove","cn","getCellSizingClasses","rowDensity","handleMouseDown","event","button","activeElement","document","isActiveElementControl","closest","hasActiveRowChanged","blur","setActiveRowIndex","includes","setColumn","attributes","onMouseDown","ref","role","detailModeEditing","setDetailModeEditing","useState","detailModeClassName","isKeyboardFocusableElement","moveRow","moveDirection","MOVE_DIR","PREV","moveToPreviousRow","nextIndex","NEXT","moveToNextRow","onSave","target","isTargetInput","nodeName","preventDefault","setTimeout","select","firstDataColumnIndex","at","lastDataColumnIndex","onKeyDown","isControlInput","getAttribute","isDefaultPrevented","isPropagationStopped","tagName","key","input","setSelectionRange","value","currentTarget","contains","toggleEditing","focus","shiftKey","isFirstRow","isFirstColumn","ctrlKey","metaKey","moveToFirstColumn","moveToPreviousColumn","isLastColumn","moveToLastColumn","moveToNextColumn","setShouldPauseHoverState","ColumnBase","EditingCell","cellRef","rowValues","original","rowsLength","onRowClick","onClick","flexRender","getContext","memo","forwardRef","handleSave","setValidationErrors","setRowMoveReason","useMergedRef","cellId","cellValidationError","getValue","ariaLabel","header","globalFilter","getState","state","setState","isHoveringAnotherRowWhileEditing","hasValidationError","initialValue","saveIfChanged","eventOrNewValue","newValue","hasChanged","updatedRow","shouldPauseSortingAndFiltering","lastSortedOrFilteredRows","map","error","isFocusInsideTable","isBodyFocussed","body","handleFocus","showIndicator","hideIndicator","willRowMoveReason","isFilteredByGlobalFilter","values","some","cellValue","globalFilterFn","String","IndicatorReason","SEARCH","getIsFiltered","columnFilterFn","getFilterValue","FILTER","getIsSorted","willRowMoveAfterSorting","getRowModel","sorting","find","s","desc","SORTING","setShouldPauseSortingAndFiltering","prevState","newState","cellControl","onBlur","onFocus","getCellAlignmentClasses","align","indicatorMountNode","parentElement","querySelector","controlComponent","invalid","setValue","Datepicker","newDate","detail","onChange","Switch","checked","Boolean","Input","indicatorReason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,IAAI,CAAC2B,MAAM,CAACC,SAAS,CAAC2H,MAAM,CAAC;IAChDsE,SAAS,EAAElB,kBAAkB;IAC7B3L,gBAAgB,EAAEA;IAEzB,eACDO;IAAMO,SAAS,EAAC;KACXgL,gBAAgB,EAChBjD,kBAAkB,iBAAItI,6BAACuM,eAAe,QAAE1C,MAAM,CAAChC,mBAAmB,CAAC,CAAmB,CACpF,CACR;AAEX,CAAC,CAAC,CACL;;;;"}
@@ -2,7 +2,6 @@ import React__default from 'react';
2
2
  import { Icon } from '../../../Icon/Icon.js';
3
3
  import { Tooltip } from '../../../Tooltip/Tooltip.js';
4
4
  import { useLocalization } from '../../../Provider/Localization.js';
5
- import { useRowContext } from '../row/Context.js';
6
5
  import ReactDOM from 'react-dom';
7
6
 
8
7
  var IndicatorReason;
@@ -39,7 +38,8 @@ const useIndicatorText = reason => {
39
38
  const Indicator = ({
40
39
  reason,
41
40
  columnName,
42
- mountNode
41
+ mountNode,
42
+ validationErrors
43
43
  }) => {
44
44
  const container = React__default.useMemo(() => {
45
45
  const element = document.createElement('div');
@@ -47,9 +47,6 @@ const Indicator = ({
47
47
  return element;
48
48
  }, []);
49
49
  const indicatorText = useIndicatorText(reason);
50
- const {
51
- validationErrors
52
- } = useRowContext();
53
50
  const hasValidationErrorsInRow = !!validationErrors;
54
51
  React__default.useEffect(() => {
55
52
  // mountNode could be null when rows are filtered
@@ -1 +1 @@
1
- {"version":3,"file":"Indicator.js","sources":["../../../../../../../../../src/components/Table2/components/column/Indicator.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Icon } from '../../../Icon/Icon';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\nimport { useRowContext } from '../row/Context';\n\nexport enum IndicatorReason {\n SEARCH = 'SEARCH',\n SORTING = 'SORTING',\n FILTER = 'FILTER',\n}\n\nexport const useIndicatorText = reason => {\n let title = '';\n let description = '';\n\n const { texts } = useLocalization();\n\n switch (reason) {\n case IndicatorReason.FILTER:\n title = texts.table2.editing.rowIndicator.rowWillBeHidden;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonFilter;\n break;\n case IndicatorReason.SEARCH:\n title = texts.table2.editing.rowIndicator.rowWillBeHidden;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonSearch;\n break;\n case IndicatorReason.SORTING:\n title = texts.table2.editing.rowIndicator.rowWillMove;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonSorting;\n break;\n }\n\n return { title, description };\n};\n\nexport type IndicatorProps = {\n reason: IndicatorReason;\n columnName: string;\n mountNode: Element | null;\n};\nexport const Indicator = ({ reason, columnName, mountNode }: IndicatorProps) => {\n const container = React.useMemo(() => {\n const element = document.createElement('div');\n element.className +=\n 'z-[3] rounded-b-md items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';\n\n return element;\n }, []);\n\n const indicatorText = useIndicatorText(reason);\n\n const { validationErrors } = useRowContext();\n const hasValidationErrorsInRow = !!validationErrors;\n\n React.useEffect(() => {\n // mountNode could be null when rows are filtered\n mountNode?.classList.add('relative');\n mountNode?.appendChild(container);\n\n return () => {\n mountNode?.classList.remove('relative');\n mountNode?.removeChild(container);\n };\n }, [hasValidationErrorsInRow]);\n\n // Using react portal inside a react tree component is an unorthodox way, but in order to avoid much code refactoring\n // and being able to use Taco Tooltip component in side the visual indicator, portal is used.\n return ReactDOM.createPortal(\n <Tooltip title={indicatorText.description.replace('[COLUMN]', columnName)}>\n <span className=\"flex gap-1 hover:cursor-pointer\">\n <Icon name=\"info\" className=\"!h-4 !w-4 rounded-full bg-white !p-0 text-blue-500\" />\n {indicatorText.title}\n </span>\n </Tooltip>,\n container\n );\n};\n"],"names":["IndicatorReason","useIndicatorText","reason","title","description","texts","useLocalization","FILTER","table2","editing","rowIndicator","rowWillBeHidden","rowWillMoveReasonFilter","SEARCH","rowWillMoveReasonSearch","SORTING","rowWillMove","rowWillMoveReasonSorting","Indicator","columnName","mountNode","container","React","useMemo","element","document","createElement","className","indicatorText","validationErrors","useRowContext","hasValidationErrorsInRow","useEffect","classList","add","appendChild","remove","removeChild","ReactDOM","createPortal","Tooltip","replace","Icon","name"],"mappings":";;;;;;;IAQYA;AAAZ,WAAYA,eAAe;EACvBA,oCAAiB;EACjBA,sCAAmB;EACnBA,oCAAiB;AACrB,CAAC,EAJWA,eAAe,KAAfA,eAAe;MAMdC,gBAAgB,GAAGC,MAAM;EAClC,IAAIC,KAAK,GAAG,EAAE;EACd,IAAIC,WAAW,GAAG,EAAE;EAEpB,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,QAAQJ,MAAM;IACV,KAAKF,eAAe,CAACO,MAAM;MACvBJ,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACC,eAAe;MACzDP,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACE,uBAAuB;MACvE;IACJ,KAAKZ,eAAe,CAACa,MAAM;MACvBV,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACC,eAAe;MACzDP,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACI,uBAAuB;MACvE;IACJ,KAAKd,eAAe,CAACe,OAAO;MACxBZ,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACM,WAAW;MACrDZ,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACO,wBAAwB;MACxE;;EAGR,OAAO;IAAEd,KAAK;IAAEC;GAAa;AACjC;MAOac,SAAS,GAAG,CAAC;EAAEhB,MAAM;EAAEiB,UAAU;EAAEC;CAA2B;EACvE,MAAMC,SAAS,GAAGC,cAAK,CAACC,OAAO,CAAC;IAC5B,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAC7CF,OAAO,CAACG,SAAS,IACb,uIAAuI;IAE3I,OAAOH,OAAO;GACjB,EAAE,EAAE,CAAC;EAEN,MAAMI,aAAa,GAAG3B,gBAAgB,CAACC,MAAM,CAAC;EAE9C,MAAM;IAAE2B;GAAkB,GAAGC,aAAa,EAAE;EAC5C,MAAMC,wBAAwB,GAAG,CAAC,CAACF,gBAAgB;EAEnDP,cAAK,CAACU,SAAS,CAAC;;IAEZZ,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEa,SAAS,CAACC,GAAG,CAAC,UAAU,CAAC;IACpCd,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEe,WAAW,CAACd,SAAS,CAAC;IAEjC,OAAO;MACHD,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEa,SAAS,CAACG,MAAM,CAAC,UAAU,CAAC;MACvChB,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEiB,WAAW,CAAChB,SAAS,CAAC;KACpC;GACJ,EAAE,CAACU,wBAAwB,CAAC,CAAC;;;EAI9B,oBAAOO,QAAQ,CAACC,YAAY,eACxBjB,6BAACkB,OAAO;IAACrC,KAAK,EAAEyB,aAAa,CAACxB,WAAW,CAACqC,OAAO,CAAC,UAAU,EAAEtB,UAAU;kBACpEG;IAAMK,SAAS,EAAC;kBACZL,6BAACoB,IAAI;IAACC,IAAI,EAAC,MAAM;IAAChB,SAAS,EAAC;IAAuD,EAClFC,aAAa,CAACzB,KAAK,CACjB,CACD,EACVkB,SAAS,CACZ;AACL;;;;"}
1
+ {"version":3,"file":"Indicator.js","sources":["../../../../../../../../../src/components/Table2/components/column/Indicator.tsx"],"sourcesContent":["import React from 'react';\nimport ReactDOM from 'react-dom';\n\nimport { Icon } from '../../../Icon/Icon';\nimport { useLocalization } from '../../../Provider/Localization';\nimport { Tooltip } from '../../../Tooltip/Tooltip';\n\nexport enum IndicatorReason {\n SEARCH = 'SEARCH',\n SORTING = 'SORTING',\n FILTER = 'FILTER',\n}\n\nexport const useIndicatorText = reason => {\n let title = '';\n let description = '';\n\n const { texts } = useLocalization();\n\n switch (reason) {\n case IndicatorReason.FILTER:\n title = texts.table2.editing.rowIndicator.rowWillBeHidden;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonFilter;\n break;\n case IndicatorReason.SEARCH:\n title = texts.table2.editing.rowIndicator.rowWillBeHidden;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonSearch;\n break;\n case IndicatorReason.SORTING:\n title = texts.table2.editing.rowIndicator.rowWillMove;\n description = texts.table2.editing.rowIndicator.rowWillMoveReasonSorting;\n break;\n }\n\n return { title, description };\n};\n\nexport type IndicatorProps = {\n reason: IndicatorReason;\n columnName: string;\n mountNode: Element | null;\n validationErrors: any;\n};\nexport const Indicator = ({ reason, columnName, mountNode, validationErrors }: IndicatorProps) => {\n const container = React.useMemo(() => {\n const element = document.createElement('div');\n element.className +=\n 'z-[3] rounded-b-md items-center wcag-blue-500 absolute left-0 top-full ml-1 whitespace-nowrap px-1 py-0.5 text-xs font-bold shadow-sm';\n\n return element;\n }, []);\n\n const indicatorText = useIndicatorText(reason);\n\n const hasValidationErrorsInRow = !!validationErrors;\n\n React.useEffect(() => {\n // mountNode could be null when rows are filtered\n mountNode?.classList.add('relative');\n mountNode?.appendChild(container);\n\n return () => {\n mountNode?.classList.remove('relative');\n mountNode?.removeChild(container);\n };\n }, [hasValidationErrorsInRow]);\n\n // Using react portal inside a react tree component is an unorthodox way, but in order to avoid much code refactoring\n // and being able to use Taco Tooltip component in side the visual indicator, portal is used.\n return ReactDOM.createPortal(\n <Tooltip title={indicatorText.description.replace('[COLUMN]', columnName)}>\n <span className=\"flex gap-1 hover:cursor-pointer\">\n <Icon name=\"info\" className=\"!h-4 !w-4 rounded-full bg-white !p-0 text-blue-500\" />\n {indicatorText.title}\n </span>\n </Tooltip>,\n container\n );\n};\n"],"names":["IndicatorReason","useIndicatorText","reason","title","description","texts","useLocalization","FILTER","table2","editing","rowIndicator","rowWillBeHidden","rowWillMoveReasonFilter","SEARCH","rowWillMoveReasonSearch","SORTING","rowWillMove","rowWillMoveReasonSorting","Indicator","columnName","mountNode","validationErrors","container","React","useMemo","element","document","createElement","className","indicatorText","hasValidationErrorsInRow","useEffect","classList","add","appendChild","remove","removeChild","ReactDOM","createPortal","Tooltip","replace","Icon","name"],"mappings":";;;;;;IAOYA;AAAZ,WAAYA,eAAe;EACvBA,oCAAiB;EACjBA,sCAAmB;EACnBA,oCAAiB;AACrB,CAAC,EAJWA,eAAe,KAAfA,eAAe;MAMdC,gBAAgB,GAAGC,MAAM;EAClC,IAAIC,KAAK,GAAG,EAAE;EACd,IAAIC,WAAW,GAAG,EAAE;EAEpB,MAAM;IAAEC;GAAO,GAAGC,eAAe,EAAE;EAEnC,QAAQJ,MAAM;IACV,KAAKF,eAAe,CAACO,MAAM;MACvBJ,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACC,eAAe;MACzDP,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACE,uBAAuB;MACvE;IACJ,KAAKZ,eAAe,CAACa,MAAM;MACvBV,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACC,eAAe;MACzDP,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACI,uBAAuB;MACvE;IACJ,KAAKd,eAAe,CAACe,OAAO;MACxBZ,KAAK,GAAGE,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACM,WAAW;MACrDZ,WAAW,GAAGC,KAAK,CAACG,MAAM,CAACC,OAAO,CAACC,YAAY,CAACO,wBAAwB;MACxE;;EAGR,OAAO;IAAEd,KAAK;IAAEC;GAAa;AACjC;MAQac,SAAS,GAAG,CAAC;EAAEhB,MAAM;EAAEiB,UAAU;EAAEC,SAAS;EAAEC;CAAkC;EACzF,MAAMC,SAAS,GAAGC,cAAK,CAACC,OAAO,CAAC;IAC5B,MAAMC,OAAO,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;IAC7CF,OAAO,CAACG,SAAS,IACb,uIAAuI;IAE3I,OAAOH,OAAO;GACjB,EAAE,EAAE,CAAC;EAEN,MAAMI,aAAa,GAAG5B,gBAAgB,CAACC,MAAM,CAAC;EAE9C,MAAM4B,wBAAwB,GAAG,CAAC,CAACT,gBAAgB;EAEnDE,cAAK,CAACQ,SAAS,CAAC;;IAEZX,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEY,SAAS,CAACC,GAAG,CAAC,UAAU,CAAC;IACpCb,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEc,WAAW,CAACZ,SAAS,CAAC;IAEjC,OAAO;MACHF,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEY,SAAS,CAACG,MAAM,CAAC,UAAU,CAAC;MACvCf,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAEgB,WAAW,CAACd,SAAS,CAAC;KACpC;GACJ,EAAE,CAACQ,wBAAwB,CAAC,CAAC;;;EAI9B,oBAAOO,QAAQ,CAACC,YAAY,eACxBf,6BAACgB,OAAO;IAACpC,KAAK,EAAE0B,aAAa,CAACzB,WAAW,CAACoC,OAAO,CAAC,UAAU,EAAErB,UAAU;kBACpEI;IAAMK,SAAS,EAAC;kBACZL,6BAACkB,IAAI;IAACC,IAAI,EAAC,MAAM;IAACd,SAAS,EAAC;IAAuD,EAClFC,aAAa,CAAC1B,KAAK,CACjB,CACD,EACVmB,SAAS,CACZ;AACL;;;;"}
@@ -1,26 +1,55 @@
1
1
  import React__default from 'react';
2
2
 
3
3
  const RowContext = /*#__PURE__*/React__default.createContext({
4
- validationErrors: null,
5
- setValidationErrors: () => undefined,
6
- rowMoveReason: {},
7
- setRowMoveReason: () => undefined
4
+ isActive: false,
5
+ editMode: {
6
+ validationErrors: null,
7
+ setValidationErrors: () => {},
8
+ rowMoveReason: {},
9
+ setRowMoveReason: () => {}
10
+ },
11
+ isHovered: false,
12
+ setIsHovered: () => {}
8
13
  });
9
- const useRowContext = () => {
10
- const context = React__default.useContext(RowContext);
11
- if (context === undefined) {
12
- throw new Error('useRowContext must be used within a RowProvider');
13
- }
14
- return context;
15
- };
16
- const RowProvider = ({
14
+ const RowContextProvider = ({
15
+ isActiveRow,
17
16
  children,
18
- ...providerProps
17
+ meta
19
18
  }) => {
19
+ // we use non-css hovered state to determine whether to render actions or not, for performance
20
+ const [isHovered, setIsHovered] = React__default.useState(false);
21
+ // editing specific functionality
22
+ const [validationErrors, setValidationErrors] = React__default.useState(null);
23
+ const [rowMoveReason, setRowMoveReason] = React__default.useState({});
24
+ // This effect aims to focus the first focussable cell when edit mode is turned on.
25
+ React__default.useEffect(() => {
26
+ var _meta$tableRef$curren;
27
+ const isFocusInsideTable = (_meta$tableRef$curren = meta.tableRef.current) === null || _meta$tableRef$curren === void 0 ? void 0 : _meta$tableRef$curren.contains(document.activeElement);
28
+ // If the foucs is outside the table i.e., table action popups, search etc., then don't focus the first cell.
29
+ if (isActiveRow && isFocusInsideTable) {
30
+ meta.editMode.moveToFirstColumn(meta.focussableColumnIndexes);
31
+ }
32
+ // We are intentionally not adding activeRow to the depency variable so that everytime active row is changed,
33
+ // first focussable cell is not focussed.
34
+ }, [meta.editMode.isEditing, meta.focussableColumnIndexes]);
35
+ const context = React__default.useMemo(() => {
36
+ return {
37
+ isActive: isActiveRow,
38
+ editMode: {
39
+ validationErrors,
40
+ setValidationErrors,
41
+ rowMoveReason,
42
+ setRowMoveReason
43
+ },
44
+ isHovered,
45
+ setIsHovered
46
+ };
47
+ }, [isActiveRow, isHovered, rowMoveReason, validationErrors]);
20
48
  return /*#__PURE__*/React__default.createElement(RowContext.Provider, {
21
- value: providerProps
49
+ value: context
22
50
  }, children);
23
51
  };
52
+ const useRowContext = () => React__default.useContext(RowContext);
24
53
 
25
- export { RowProvider, useRowContext };
54
+ export { RowContext, RowContextProvider, useRowContext };
26
55
  //# sourceMappingURL=Context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Context.js","sources":["../../../../../../../../../src/components/Table2/components/row/Context.tsx"],"sourcesContent":["import React from 'react';\nimport { SaveHandlerErrorResponse } from '../../types';\nimport { IndicatorReason } from '../column/Indicator';\n\ntype RowContext = {\n validationErrors: SaveHandlerErrorResponse;\n setValidationErrors: React.Dispatch<React.SetStateAction<SaveHandlerErrorResponse>>;\n rowMoveReason: Record<string, IndicatorReason | null>;\n setRowMoveReason: React.Dispatch<React.SetStateAction<Record<string, IndicatorReason | null>>>;\n};\n\nconst RowContext = React.createContext<RowContext>({\n validationErrors: null,\n setValidationErrors: () => undefined,\n rowMoveReason: {},\n setRowMoveReason: () => undefined,\n});\n\nexport const useRowContext = () => {\n const context = React.useContext(RowContext);\n\n if (context === undefined) {\n throw new Error('useRowContext must be used within a RowProvider');\n }\n\n return context;\n};\n\ntype RowProviderProps = RowContext & { children: React.ReactNode };\n\nexport const RowProvider = ({ children, ...providerProps }: RowProviderProps) => {\n return <RowContext.Provider value={providerProps}>{children}</RowContext.Provider>;\n};\n"],"names":["RowContext","React","createContext","validationErrors","setValidationErrors","undefined","rowMoveReason","setRowMoveReason","useRowContext","context","useContext","Error","RowProvider","children","providerProps","Provider","value"],"mappings":";;AAWA,MAAMA,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAa;EAC/CC,gBAAgB,EAAE,IAAI;EACtBC,mBAAmB,EAAE,MAAMC,SAAS;EACpCC,aAAa,EAAE,EAAE;EACjBC,gBAAgB,EAAE,MAAMF;CAC3B,CAAC;MAEWG,aAAa,GAAG;EACzB,MAAMC,OAAO,GAAGR,cAAK,CAACS,UAAU,CAACV,UAAU,CAAC;EAE5C,IAAIS,OAAO,KAAKJ,SAAS,EAAE;IACvB,MAAM,IAAIM,KAAK,CAAC,iDAAiD,CAAC;;EAGtE,OAAOF,OAAO;AAClB;MAIaG,WAAW,GAAG,CAAC;EAAEC,QAAQ;EAAE,GAAGC;CAAiC;EACxE,oBAAOb,6BAACD,UAAU,CAACe,QAAQ;IAACC,KAAK,EAAEF;KAAgBD,QAAQ,CAAuB;AACtF;;;;"}
1
+ {"version":3,"file":"Context.js","sources":["../../../../../../../../../src/components/Table2/components/row/Context.tsx"],"sourcesContent":["import React from 'react';\nimport { SaveHandlerErrorResponse } from '../../types';\nimport { IndicatorReason } from '../column/Indicator';\n\ntype RowContextValue = {\n // we store this here because the \"real\" row index comes from the virtualiser,\n // and that isn't accessible in some places we need it - like the row actions column\n isActive: boolean;\n editMode: {\n validationErrors: SaveHandlerErrorResponse;\n setValidationErrors: React.Dispatch<React.SetStateAction<SaveHandlerErrorResponse>>;\n rowMoveReason: Record<string, IndicatorReason | null>;\n setRowMoveReason: React.Dispatch<React.SetStateAction<Record<string, IndicatorReason | null>>>;\n };\n isHovered: boolean;\n setIsHovered: React.Dispatch<React.SetStateAction<boolean>>;\n};\n\nexport const RowContext = React.createContext<RowContextValue>({\n isActive: false,\n editMode: {\n validationErrors: null,\n setValidationErrors: () => {},\n rowMoveReason: {},\n setRowMoveReason: () => {},\n },\n isHovered: false,\n setIsHovered: () => {},\n});\n\nexport const RowContextProvider = ({ isActiveRow, children, meta }) => {\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 // editing specific functionality\n const [validationErrors, setValidationErrors] = React.useState<SaveHandlerErrorResponse | null>(null);\n const [rowMoveReason, setRowMoveReason] = React.useState<Record<string, IndicatorReason | null>>({});\n\n // This effect aims to focus the first focussable cell when edit mode is turned on.\n React.useEffect(() => {\n const isFocusInsideTable = meta.tableRef.current?.contains(document.activeElement);\n\n // If the foucs is outside the table i.e., table action popups, search etc., then don't focus the first cell.\n if (isActiveRow && isFocusInsideTable) {\n meta.editMode.moveToFirstColumn(meta.focussableColumnIndexes);\n }\n // We are intentionally not adding activeRow to the depency variable so that everytime active row is changed,\n // first focussable cell is not focussed.\n }, [meta.editMode.isEditing, meta.focussableColumnIndexes]);\n\n const context = React.useMemo(() => {\n return {\n isActive: isActiveRow,\n editMode: {\n validationErrors,\n setValidationErrors,\n rowMoveReason,\n setRowMoveReason,\n },\n isHovered,\n setIsHovered,\n };\n }, [isActiveRow, isHovered, rowMoveReason, validationErrors]);\n\n return <RowContext.Provider value={context}>{children}</RowContext.Provider>;\n};\n\nexport const useRowContext = () => React.useContext(RowContext);\n"],"names":["RowContext","React","createContext","isActive","editMode","validationErrors","setValidationErrors","rowMoveReason","setRowMoveReason","isHovered","setIsHovered","RowContextProvider","isActiveRow","children","meta","useState","useEffect","isFocusInsideTable","tableRef","current","contains","document","activeElement","moveToFirstColumn","focussableColumnIndexes","isEditing","context","useMemo","Provider","value","useRowContext","useContext"],"mappings":";;MAkBaA,UAAU,gBAAGC,cAAK,CAACC,aAAa,CAAkB;EAC3DC,QAAQ,EAAE,KAAK;EACfC,QAAQ,EAAE;IACNC,gBAAgB,EAAE,IAAI;IACtBC,mBAAmB,EAAE,QAAQ;IAC7BC,aAAa,EAAE,EAAE;IACjBC,gBAAgB,EAAE;GACrB;EACDC,SAAS,EAAE,KAAK;EAChBC,YAAY,EAAE;CACjB;MAEYC,kBAAkB,GAAG,CAAC;EAAEC,WAAW;EAAEC,QAAQ;EAAEC;CAAM;;EAE9D,MAAM,CAACL,SAAS,EAAEC,YAAY,CAAC,GAAGT,cAAK,CAACc,QAAQ,CAAC,KAAK,CAAC;;EAGvD,MAAM,CAACV,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGL,cAAK,CAACc,QAAQ,CAAkC,IAAI,CAAC;EACrG,MAAM,CAACR,aAAa,EAAEC,gBAAgB,CAAC,GAAGP,cAAK,CAACc,QAAQ,CAAyC,EAAE,CAAC;;EAGpGd,cAAK,CAACe,SAAS,CAAC;;IACZ,MAAMC,kBAAkB,4BAAGH,IAAI,CAACI,QAAQ,CAACC,OAAO,0DAArB,sBAAuBC,QAAQ,CAACC,QAAQ,CAACC,aAAa,CAAC;;IAGlF,IAAIV,WAAW,IAAIK,kBAAkB,EAAE;MACnCH,IAAI,CAACV,QAAQ,CAACmB,iBAAiB,CAACT,IAAI,CAACU,uBAAuB,CAAC;;;;GAIpE,EAAE,CAACV,IAAI,CAACV,QAAQ,CAACqB,SAAS,EAAEX,IAAI,CAACU,uBAAuB,CAAC,CAAC;EAE3D,MAAME,OAAO,GAAGzB,cAAK,CAAC0B,OAAO,CAAC;IAC1B,OAAO;MACHxB,QAAQ,EAAES,WAAW;MACrBR,QAAQ,EAAE;QACNC,gBAAgB;QAChBC,mBAAmB;QACnBC,aAAa;QACbC;OACH;MACDC,SAAS;MACTC;KACH;GACJ,EAAE,CAACE,WAAW,EAAEH,SAAS,EAAEF,aAAa,EAAEF,gBAAgB,CAAC,CAAC;EAE7D,oBAAOJ,6BAACD,UAAU,CAAC4B,QAAQ;IAACC,KAAK,EAAEH;KAAUb,QAAQ,CAAuB;AAChF;MAEaiB,aAAa,GAAG,MAAM7B,cAAK,CAAC8B,UAAU,CAAC/B,UAAU;;;;"}
@@ -1,58 +1,37 @@
1
1
  import React__default from 'react';
2
- import { RowProvider } from './Context.js';
2
+ import { RowContextProvider, useRowContext } from './Context.js';
3
3
 
4
- const HOVER_THRESHOLD_MS = 50;
5
- const Row = ({
4
+ const InternalRow = ({
6
5
  row,
7
6
  rowIndex,
8
7
  table,
9
8
  ...props
10
9
  }) => {
10
+ const {
11
+ setIsHovered
12
+ } = useRowContext();
11
13
  const meta = table.options.meta;
12
14
  const isActiveRow = meta.activeRowIndex === rowIndex;
13
15
  const isDragging = meta.dragging[row.id];
14
- const [validationErrors, setValidationErrors] = React__default.useState(null);
15
- const [rowMoveReason, setRowMoveReason] = React__default.useState({});
16
- // This effect aims to focus the first focussable cell when edit mode is turned on.
17
- React__default.useEffect(() => {
18
- var _meta$tableRef$curren;
19
- const isFocusInsideTable = (_meta$tableRef$curren = meta.tableRef.current) === null || _meta$tableRef$curren === void 0 ? void 0 : _meta$tableRef$curren.contains(document.activeElement);
20
- // If the foucs is outside the table i.e., table action popups, search etc., then don't focus the first cell.
21
- if (meta.editMode.isEditing && isActiveRow && isFocusInsideTable) {
22
- meta.editMode.moveToFirstColumn(meta.focussableColumnIndexes);
23
- }
24
- // We are intentionally not adding activeRow to the depency variable so that everytime active row is changed,
25
- // first focussable cell is not focussed.
26
- }, [meta.editMode.isEditing, meta.focussableColumnIndexes]);
27
- const handleSetValidationErrors = errors => {
28
- if (errors !== null) {
29
- meta.setShouldDisableTableActions(true);
30
- }
31
- setValidationErrors(errors);
16
+ const attributes = {
17
+ ...props,
18
+ 'aria-current': isActiveRow ? true : undefined,
19
+ 'aria-grabbed': isDragging ? true : undefined,
20
+ 'data-row-index': rowIndex,
21
+ draggable: meta.enableRowDragging ? true : undefined,
22
+ onMouseEnter: () => setIsHovered(true),
23
+ onMouseLeave: () => setIsHovered(false),
24
+ role: 'row'
32
25
  };
33
- const hoverTimerRef = React__default.useRef();
34
- const handleEnter = () => {
35
- hoverTimerRef.current = setTimeout(() => meta.setHoveredRowIndex(rowIndex), HOVER_THRESHOLD_MS);
36
- };
37
- const handleLeave = () => {
38
- clearTimeout(hoverTimerRef.current);
39
- hoverTimerRef.current = undefined;
40
- meta.setHoveredRowIndex(undefined);
41
- };
42
- return /*#__PURE__*/React__default.createElement(RowProvider, {
43
- validationErrors: validationErrors,
44
- setValidationErrors: handleSetValidationErrors,
45
- rowMoveReason: rowMoveReason,
46
- setRowMoveReason: setRowMoveReason
47
- }, /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
48
- "aria-current": isActiveRow ? 'true' : undefined,
49
- "aria-grabbed": isDragging ? 'true' : undefined,
50
- "data-row-index": rowIndex,
51
- draggable: true,
52
- onMouseEnter: handleEnter,
53
- onMouseLeave: handleLeave,
54
- role: "row"
55
- })));
26
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes));
27
+ };
28
+ const Row = props => {
29
+ const meta = props.table.options.meta;
30
+ const isActiveRow = meta.activeRowIndex === props.rowIndex;
31
+ return /*#__PURE__*/React__default.createElement(RowContextProvider, {
32
+ isActiveRow: isActiveRow,
33
+ meta: props.table.options.meta
34
+ }, /*#__PURE__*/React__default.createElement(InternalRow, Object.assign({}, props)));
56
35
  };
57
36
 
58
37
  export { Row };
@@ -1 +1 @@
1
- {"version":3,"file":"Row.js","sources":["../../../../../../../../../src/components/Table2/components/row/Row.tsx"],"sourcesContent":["import { TableMeta } from '@tanstack/react-table';\nimport React from 'react';\nimport { SaveHandlerErrorResponse } from '../../types';\nimport { IndicatorReason } from '../column/Indicator';\nimport { RowProvider } from './Context';\n\nconst HOVER_THRESHOLD_MS = 50;\n\nexport const Row = ({ row, rowIndex, table, ...props }) => {\n const meta = table.options.meta as TableMeta<any>;\n const isActiveRow = meta.activeRowIndex === rowIndex;\n const isDragging = meta.dragging[row.id];\n\n const [validationErrors, setValidationErrors] = React.useState<SaveHandlerErrorResponse | null>(null);\n const [rowMoveReason, setRowMoveReason] = React.useState<Record<string, IndicatorReason | null>>({});\n\n // This effect aims to focus the first focussable cell when edit mode is turned on.\n React.useEffect(() => {\n const isFocusInsideTable = meta.tableRef.current?.contains(document.activeElement);\n\n // If the foucs is outside the table i.e., table action popups, search etc., then don't focus the first cell.\n if (meta.editMode.isEditing && isActiveRow && isFocusInsideTable) {\n meta.editMode.moveToFirstColumn(meta.focussableColumnIndexes);\n }\n // We are intentionally not adding activeRow to the depency variable so that everytime active row is changed,\n // first focussable cell is not focussed.\n }, [meta.editMode.isEditing, meta.focussableColumnIndexes]);\n\n const handleSetValidationErrors = (errors: React.SetStateAction<SaveHandlerErrorResponse>) => {\n if (errors !== null) {\n meta.setShouldDisableTableActions(true);\n }\n\n setValidationErrors(errors);\n };\n\n const hoverTimerRef = React.useRef<ReturnType<typeof setTimeout>>();\n\n const handleEnter = () => {\n hoverTimerRef.current = setTimeout(() => meta.setHoveredRowIndex(rowIndex), HOVER_THRESHOLD_MS);\n };\n const handleLeave = () => {\n clearTimeout(hoverTimerRef.current);\n hoverTimerRef.current = undefined;\n meta.setHoveredRowIndex(undefined);\n };\n\n return (\n <RowProvider\n validationErrors={validationErrors}\n setValidationErrors={handleSetValidationErrors}\n rowMoveReason={rowMoveReason}\n setRowMoveReason={setRowMoveReason}>\n <div\n {...props}\n aria-current={isActiveRow ? 'true' : undefined}\n aria-grabbed={isDragging ? 'true' : undefined}\n data-row-index={rowIndex}\n draggable\n onMouseEnter={handleEnter}\n onMouseLeave={handleLeave}\n role=\"row\"\n />\n </RowProvider>\n );\n};\n"],"names":["HOVER_THRESHOLD_MS","Row","row","rowIndex","table","props","meta","options","isActiveRow","activeRowIndex","isDragging","dragging","id","validationErrors","setValidationErrors","React","useState","rowMoveReason","setRowMoveReason","useEffect","isFocusInsideTable","tableRef","current","contains","document","activeElement","editMode","isEditing","moveToFirstColumn","focussableColumnIndexes","handleSetValidationErrors","errors","setShouldDisableTableActions","hoverTimerRef","useRef","handleEnter","setTimeout","setHoveredRowIndex","handleLeave","clearTimeout","undefined","RowProvider","draggable","onMouseEnter","onMouseLeave","role"],"mappings":";;;AAMA,MAAMA,kBAAkB,GAAG,EAAE;MAEhBC,GAAG,GAAG,CAAC;EAAEC,GAAG;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;CAAO;EAClD,MAAMC,IAAI,GAAGF,KAAK,CAACG,OAAO,CAACD,IAAsB;EACjD,MAAME,WAAW,GAAGF,IAAI,CAACG,cAAc,KAAKN,QAAQ;EACpD,MAAMO,UAAU,GAAGJ,IAAI,CAACK,QAAQ,CAACT,GAAG,CAACU,EAAE,CAAC;EAExC,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAkC,IAAI,CAAC;EACrG,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGH,cAAK,CAACC,QAAQ,CAAyC,EAAE,CAAC;;EAGpGD,cAAK,CAACI,SAAS,CAAC;;IACZ,MAAMC,kBAAkB,4BAAGd,IAAI,CAACe,QAAQ,CAACC,OAAO,0DAArB,sBAAuBC,QAAQ,CAACC,QAAQ,C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table2/components/row/Row.tsx"],"sourcesContent":["import React from 'react';\nimport { TableMeta } from '@tanstack/react-table';\nimport { RowContextProvider, useRowContext } from './Context';\n\nconst InternalRow = ({ row, rowIndex, table, ...props }) => {\n const { setIsHovered } = useRowContext();\n\n const meta = table.options.meta as TableMeta<any>;\n const isActiveRow = meta.activeRowIndex === rowIndex;\n const isDragging = meta.dragging[row.id];\n\n const attributes = {\n ...props,\n 'aria-current': isActiveRow ? true : undefined,\n 'aria-grabbed': isDragging ? true : undefined,\n 'data-row-index': rowIndex,\n draggable: meta.enableRowDragging ? true : undefined,\n onMouseEnter: () => setIsHovered(true),\n onMouseLeave: () => setIsHovered(false),\n role: 'row',\n };\n\n return <div {...attributes} />;\n};\n\nexport const Row = props => {\n const meta = props.table.options.meta as TableMeta<any>;\n const isActiveRow = meta.activeRowIndex === props.rowIndex;\n\n return (\n <RowContextProvider isActiveRow={isActiveRow} meta={props.table.options.meta}>\n <InternalRow {...props} />\n </RowContextProvider>\n );\n};\n"],"names":["InternalRow","row","rowIndex","table","props","setIsHovered","useRowContext","meta","options","isActiveRow","activeRowIndex","isDragging","dragging","id","attributes","undefined","draggable","enableRowDragging","onMouseEnter","onMouseLeave","role","React","Row","RowContextProvider"],"mappings":";;;AAIA,MAAMA,WAAW,GAAG,CAAC;EAAEC,GAAG;EAAEC,QAAQ;EAAEC,KAAK;EAAE,GAAGC;CAAO;EACnD,MAAM;IAAEC;GAAc,GAAGC,aAAa,EAAE;EAExC,MAAMC,IAAI,GAAGJ,KAAK,CAACK,OAAO,CAACD,IAAsB;EACjD,MAAME,WAAW,GAAGF,IAAI,CAACG,cAAc,KAAKR,QAAQ;EACpD,MAAMS,UAAU,GAAGJ,IAAI,CAACK,QAAQ,CAACX,GAAG,CAACY,EAAE,CAAC;EAExC,MAAMC,UAAU,GAAG;IACf,GAAGV,KAAK;IACR,cAAc,EAAEK,WAAW,GAAG,IAAI,GAAGM,SAAS;IAC9C,cAAc,EAAEJ,UAAU,GAAG,IAAI,GAAGI,SAAS;IAC7C,gBAAgB,EAAEb,QAAQ;IAC1Bc,SAAS,EAAET,IAAI,CAACU,iBAAiB,GAAG,IAAI,GAAGF,SAAS;IACpDG,YAAY,EAAE,MAAMb,YAAY,CAAC,IAAI,CAAC;IACtCc,YAAY,EAAE,MAAMd,YAAY,CAAC,KAAK,CAAC;IACvCe,IAAI,EAAE;GACT;EAED,oBAAOC,sDAASP,UAAU,EAAI;AAClC,CAAC;MAEYQ,GAAG,GAAGlB,KAAK;EACpB,MAAMG,IAAI,GAAGH,KAAK,CAACD,KAAK,CAACK,OAAO,CAACD,IAAsB;EACvD,MAAME,WAAW,GAAGF,IAAI,CAACG,cAAc,KAAKN,KAAK,CAACF,QAAQ;EAE1D,oBACImB,6BAACE,kBAAkB;IAACd,WAAW,EAAEA,WAAW;IAAEF,IAAI,EAAEH,KAAK,CAACD,KAAK,CAACK,OAAO,CAACD;kBACpEc,6BAACrB,WAAW,oBAAKI,KAAK,EAAI,CACT;AAE7B;;;;"}
@@ -0,0 +1,19 @@
1
+ import React__default from 'react';
2
+
3
+ const useShouldPauseHoverState = () => {
4
+ const [shouldPauseHoverState, setShouldPauseHoverState] = React__default.useState(false);
5
+ // as soon as the mouse starts moving again, unpause hover state
6
+ React__default.useEffect(() => {
7
+ const move = () => setShouldPauseHoverState(false);
8
+ if (shouldPauseHoverState) {
9
+ document.addEventListener('mousemove', move);
10
+ }
11
+ return () => {
12
+ document.removeEventListener('mousemove', move);
13
+ };
14
+ }, [shouldPauseHoverState]);
15
+ return [shouldPauseHoverState, setShouldPauseHoverState];
16
+ };
17
+
18
+ export { useShouldPauseHoverState };
19
+ //# sourceMappingURL=useShouldPauseHoverState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useShouldPauseHoverState.js","sources":["../../../../../../../../src/components/Table2/hooks/useShouldPauseHoverState.ts"],"sourcesContent":["import { OnChangeFn } from '@tanstack/react-table';\nimport React from 'react';\n\nexport const useShouldPauseHoverState = (): [boolean, OnChangeFn<boolean>] => {\n const [shouldPauseHoverState, setShouldPauseHoverState] = React.useState<boolean>(false);\n\n // as soon as the mouse starts moving again, unpause hover state\n React.useEffect(() => {\n const move = () => setShouldPauseHoverState(false);\n\n if (shouldPauseHoverState) {\n document.addEventListener('mousemove', move);\n }\n\n return () => {\n document.removeEventListener('mousemove', move);\n };\n }, [shouldPauseHoverState]);\n\n return [shouldPauseHoverState, setShouldPauseHoverState];\n};\n"],"names":["useShouldPauseHoverState","shouldPauseHoverState","setShouldPauseHoverState","React","useState","useEffect","move","document","addEventListener","removeEventListener"],"mappings":";;MAGaA,wBAAwB,GAAG;EACpC,MAAM,CAACC,qBAAqB,EAAEC,wBAAwB,CAAC,GAAGC,cAAK,CAACC,QAAQ,CAAU,KAAK,CAAC;;EAGxFD,cAAK,CAACE,SAAS,CAAC;IACZ,MAAMC,IAAI,GAAG,MAAMJ,wBAAwB,CAAC,KAAK,CAAC;IAElD,IAAID,qBAAqB,EAAE;MACvBM,QAAQ,CAACC,gBAAgB,CAAC,WAAW,EAAEF,IAAI,CAAC;;IAGhD,OAAO;MACHC,QAAQ,CAACE,mBAAmB,CAAC,WAAW,EAAEH,IAAI,CAAC;KAClD;GACJ,EAAE,CAACL,qBAAqB,CAAC,CAAC;EAE3B,OAAO,CAACA,qBAAqB,EAAEC,wBAAwB,CAAC;AAC5D;;;;"}
@@ -8,6 +8,7 @@ import { useRowSelectionListener } from './listeners/useRowSelectionListener.js'
8
8
  import { useSettingsStateListener } from './listeners/useSettingsStateListener.js';
9
9
  import { useActiveRow } from './useActiveRow.js';
10
10
  import { useActiveRowStateListener } from './listeners/useActiveRowStateListener.js';
11
+ import { useShouldPauseHoverState } from './useShouldPauseHoverState.js';
11
12
 
12
13
  function useTable(children, props, ref) {
13
14
  var _settings$columnOrder, _ref, _settings$columnPinni, _settings$columnPinni2, _settings$columnSizin, _settings$columnVisib, _settings$rowDensity;
@@ -75,7 +76,7 @@ function useTable(children, props, ref) {
75
76
  const dataColumnEndOffset = actionsForRow.length ? 1 : 0;
76
77
  // custom
77
78
  const activeRow = useActiveRow(defaultActiveRowIndex);
78
- const [hoveredRowIndex, setHoveredRowIndex] = React__default.useState(undefined);
79
+ const [shouldPauseHoverState, setShouldPauseHoverState] = useShouldPauseHoverState();
79
80
  const editMode = useEditMode(onSave);
80
81
  const [columnOffsets, setColumnOffsets] = React__default.useState(getOffsetsFromSize(initialState.columnPinning, initialState.columnVisibility, initialState.columnSizing));
81
82
  const [rowDensity, setRowDensity] = React__default.useState((_settings$rowDensity = settings === null || settings === void 0 ? void 0 : settings.rowDensity) !== null && _settings$rowDensity !== void 0 ? _settings$rowDensity : 'normal');
@@ -148,17 +149,18 @@ function useTable(children, props, ref) {
148
149
  rowDensity,
149
150
  setRowDensity,
150
151
  // dragging
152
+ enableRowDragging: !!onRowDrag,
151
153
  dragging,
152
154
  setDragging,
153
155
  // computed
154
156
  enableColumnReordering: !disableColumnReordering,
157
+ shouldPauseHoverState,
158
+ setShouldPauseHoverState,
155
159
  // resorting
156
160
  shouldPauseSortingAndFiltering,
157
161
  setShouldPauseSortingAndFiltering,
158
162
  // other
159
163
  onRowClick,
160
- hoveredRowIndex,
161
- setHoveredRowIndex,
162
164
  // data column positions
163
165
  dataColumnStartOffset,
164
166
  dataColumnEndOffset,