@economic/taco 2.20.2 → 2.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. package/dist/components/Report/components/Body/Body.d.ts +1 -0
  2. package/dist/components/Report/components/Body/util.d.ts +6 -0
  3. package/dist/components/Report/components/Cell/Cell.d.ts +7 -1
  4. package/dist/components/Report/components/Cell/DisplayCell.d.ts +3 -2
  5. package/dist/components/Report/components/Cell/GroupedCell.d.ts +3 -2
  6. package/dist/components/Report/components/Row/Row.d.ts +2 -1
  7. package/dist/components/Report/components/Row/RowContext.d.ts +0 -1
  8. package/dist/components/Table3/hooks/features/useEditing.d.ts +2 -2
  9. package/dist/esm/packages/taco/src/components/Table3/Table3.js +4 -2
  10. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +10 -1
  12. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js +16 -1
  14. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useEditing.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +1 -1
  16. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  17. package/dist/esm/packages/taco/src/utils/dom.js +12 -3
  18. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  19. package/dist/taco.cjs.development.js +42 -8
  20. package/dist/taco.cjs.development.js.map +1 -1
  21. package/dist/taco.cjs.production.min.js +1 -1
  22. package/dist/taco.cjs.production.min.js.map +1 -1
  23. package/package.json +2 -2
  24. package/types.json +4054 -3906
@@ -1 +1 @@
1
- {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table3/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport {\n getCoreRowModel,\n useReactTable,\n Row as RTRow,\n RowData,\n Column as RTColumn,\n TableOptions as RTableOptions,\n TableState,\n getSortedRowModel,\n getFilteredRowModel,\n ColumnMeta,\n} from '@tanstack/react-table';\nimport {\n Table3ColumnAlignment,\n Table3ColumnRenderer,\n Table3Props,\n Table3ColumnHeaderMenu,\n Table3ColumnControlRenderer,\n Table3ColumnDataType,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n TableStrategy,\n Table3FilterComparator,\n Table3Settings,\n Table3Options,\n Table3Ref,\n} from '../types';\nimport { useTableRowActive } from '../../../primitives/Table/useTable/features/useTableRowActive';\nimport { useTablePreset } from './useTablePreset';\nimport { useTableRowHeight } from '../../../primitives/Table/useTable/features/useTableRowHeight';\nimport { useTableFontSize } from '../../../primitives/Table/useTable/features/useTableFontSize';\nimport { useTableRowSelectionListener } from '../../../primitives/Table/useTable/listeners/useTableRowSelectionListener';\nimport { useRowDrag } from './features/useRowDrag';\nimport { useSettingsStateListener } from './listeners/useSettingsStateListener';\nimport { columnFilterFn, globalFilterFn } from '../util/filtering';\nimport { useTableSortingListener } from '../../../primitives/Table/useTable/listeners/useTableSortingListener';\nimport { useTableFilterListener } from '../../../primitives/Table/useTable/listeners/useTableFilterListener';\nimport { useTableDataListener } from '../../../primitives/Table/useTable/listeners/useTableDataListener';\nimport { useColumnFreezing } from './features/useColumnFreezing';\nimport { useTableRowSelection } from '../../../primitives/Table/useTable/features/useTableRowSelection';\nimport { useTableServerLoading } from '../../../primitives/Table/useTable/features/useTableServerLoading';\nimport { useTableRowClick } from '../../../primitives/Table/useTable/features/useTableRowClick';\nimport { useTableColumnOrdering } from '../../../primitives/Table/useTable/features/useTableColumnOrdering';\nimport { useRowDrop } from './features/useRowDrop';\nimport { useConvertChildrenToColumns } from './useConvertChildrenToColumns';\nimport { useEditing } from './features/useEditing';\nimport { usePrinting } from './features/usePrinting';\nimport { useTableShortcutsListener } from '../../../primitives/Table/useTable/listeners/useTableShortcutsListener';\nimport { useTableRowGoto } from '../../../primitives/Table/useTable/features/useTableRowGoto';\nimport { useTableServerLoadingListener } from '../../../primitives/Table/useTable/listeners/useTableServerLoadingListener';\nimport { useEditingStateListener } from './listeners/useEditingStateListener';\nimport { useSearch } from './features/useSearch';\nimport { useRowActions } from './features/useRowActions';\nimport { useSettings } from './features/useSettings';\nimport { getCellValueAsString } from '../util/columns';\nimport { Table3Validation, useValidation } from './features/useValidation';\nimport { usePauseShortcuts } from './features/usePauseShortcuts';\nimport { useTableFontSizeListener } from '../../../primitives/Table/useTable/listeners/useTableFontSizeListener';\nimport { ensureOrdering } from '../../../primitives/Table/useTable/util/columns';\nimport { COLUMN_ID as ACTIONS_COLUMN_ID } from '../components/columns/internal/Actions';\nimport { COLUMN_ID as EDITING_ACTIONS_COLUMN_ID } from '../components/columns/internal/EditingActions';\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n editing: ReturnType<typeof useEditing>;\n enableFooter: boolean;\n fontSize: ReturnType<typeof useTableFontSize>;\n getSettings: () => Table3Settings;\n isPrinting: boolean;\n isUsingServer: boolean;\n printing: ReturnType<typeof usePrinting>;\n rowActions: ReturnType<typeof useRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useRowDrag>;\n rowDrop: ReturnType<typeof useRowDrop>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n shortcutsState: ReturnType<typeof usePauseShortcuts>;\n tableRef: React.RefObject<Table3Ref>;\n validation: Table3Validation<TData>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: Table3ColumnAlignment;\n className?: Table3ColumnClassNameHandler<TData>;\n control?: Table3ColumnControlRenderer<TData>;\n dataType?: Table3ColumnDataType;\n defaultWidth?: number;\n enableOrdering?: boolean;\n enableSearch: boolean;\n enableTruncate?: boolean;\n filters?: Table3FilterComparator[];\n footer?: Table3ColumnFooterRenderer;\n header: string;\n headerClassName?: string;\n menu?: Table3ColumnHeaderMenu;\n renderer?: Table3ColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n\n interface CellContext<TData extends RowData, TValue> {\n index: number;\n tableRef: React.RefObject<HTMLDivElement>;\n }\n\n interface HeaderContext<TData extends RowData, TValue> {\n scrollToIndex: TableStrategy['scrollToIndex'];\n }\n}\n\nexport function useTable<TType = unknown>(props: Table3Props<TType>, ref: React.RefObject<Table3Ref>) {\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);\n\n // configure table3 options\n const options = useTablePreset(props);\n\n // configure react-table built-in features\n const tableOptions = configureReactTableOptions(props, options);\n\n // configure custom features\n const columnFreezing = useColumnFreezing(settings.columnFreezingIndex ?? props.defaultColumnFreezingIndex, options);\n // can't change due to rename to \"active row\"\n const validation = useValidation<TType>(props.onCellValidate, props.onRowValidate);\n // not relevant to common table\n const editing = useEditing<TType>(options.enableEditing, validation, props.onSave);\n // we changed how printing works, so this shouldn't be migrated\n const printing = usePrinting(options.enablePrinting, settings.showWarningWhenPrintingLargeDataset, props.id);\n // needs to be moved\n const rowActions = useRowActions<TType>(props.actionsForRow, props.actionsForRowLength);\n // not relevant to common table\n const rowDrag = useRowDrag(options.enableRowDrag);\n // not relevant to common table\n const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);\n // haven't migrated load all/server loading yet\n const search = useSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const shortcutsState = usePauseShortcuts();\n\n // custom features - shared/migrated\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const rowActive = useTableRowActive(true, props.defaultCurrentRowIndex);\n const rowClick = useTableRowClick<TType>(true, props.onRowClick);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const server = useTableServerLoading(props.loadPage, props.loadAll);\n\n // columns\n const { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting } = useConvertChildrenToColumns<TType>(\n props,\n options,\n editing\n );\n\n // built-in features\n const initialState: Partial<TableState> = React.useMemo(() => {\n const sanitizeSortedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const state: Partial<TableState> = {\n columnOrder: ensureOrdering<TType>(columns, settings.columnOrder, [ACTIONS_COLUMN_ID, EDITING_ACTIONS_COLUMN_ID]),\n columnSizing: settings.columnSizing ?? defaultColumnSizing,\n columnVisibility: settings.columnVisibility ?? defaultColumnVisibility,\n sorting: settings.sorting ? settings.sorting.filter(sanitizeSortedColumns) : defaultSorting,\n };\n\n // we don't save these outside the table, but they need to be here for print to inherit them - see PrintButton.tsx\n if ((props.defaultSettings as any)?.columnFilters) {\n state.columnFilters = (props.defaultSettings as any)?.columnFilters;\n }\n\n if ((props.defaultSettings as any)?.globalFilter) {\n state.globalFilter = (props.defaultSettings as any)?.globalFilter;\n }\n\n return state;\n }, []);\n\n const getSettings = () => {\n const state = table.getState();\n return {\n columnFreezingIndex: columnFreezing.frozenColumnIndex,\n columnOrder: columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnSizing: table.options.enableColumnResizing ? state.columnSizing : undefined,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: search.excludeUnmatchedResults,\n fontSize: fontSize.isEnabled ? fontSize.size : undefined,\n rowHeight: rowHeight.isEnabled ? rowHeight.height : undefined,\n showWarningWhenPrintingLargeDataset: printing.isWarningVisibleForLargeDatasets,\n sorting: state.sorting,\n };\n };\n\n const table = useReactTable<TType>({\n data: props.data,\n columns,\n getCoreRowModel: getCoreRowModel(),\n initialState,\n ...tableOptions,\n //debugAll: true,\n meta: {\n columnFreezing,\n columnOrdering,\n editing,\n enableFooter: options.enableFooter,\n fontSize,\n getSettings,\n isPrinting: props.id.endsWith('_print'),\n isUsingServer: !!props.loadPage,\n printing,\n rowActions: rowActions as any,\n rowActive,\n rowClick: rowClick as any,\n rowDrag,\n rowDrop,\n rowGoto,\n rowHeight,\n rowSelection,\n search,\n server,\n shortcutsState,\n tableRef: ref,\n validation,\n },\n });\n\n // listeners\n useEditingStateListener(table);\n useSettingsStateListener(table, setSettings);\n // listeners - shared/migrated\n useTableDataListener(table);\n useTableFilterListener(table, props.onFilter);\n useTableFontSizeListener(table);\n useTableRowSelectionListener(table, props.onRowSelect);\n useTableServerLoadingListener(table, props.loadPage);\n useTableShortcutsListener(table, props.shortcuts);\n useTableSortingListener(table, props.onSort);\n\n return { table, length: props.length ?? props.data.length };\n}\n\nfunction configureReactTableOptions<TType = unknown>(props: Table3Props<TType>, options: Table3Options) {\n const tableOptions: Partial<RTableOptions<TType>> = {\n enableColumnFilters: options.enableFiltering,\n enableColumnResizing: options.enableColumnResizing,\n enableExpanding: options.enableRowExpansion,\n enableGlobalFilter: options.enableSearch,\n enableHiding: options.enableColumnHiding,\n enableRowSelection: options.enableRowSelection,\n enableMultiRowSelection: !options.enableRowSelectionSingle,\n enableSorting: options.enableSorting,\n };\n\n // resizing\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n // filtering\n if (tableOptions.enableColumnFilters) {\n if (!props.onFilter) {\n tableOptions.filterFns = {\n tacoFilter: (row: RTRow<TType>, columnId: string, filter: any) => columnFilterFn(row.getValue(columnId), filter),\n };\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n }\n\n // we don't tableOptions.manualFiltering = true; because it breaks global filtering, server filtering still works :shrug:\n }\n\n // search\n if (tableOptions.enableGlobalFilter) {\n // search is always client side, since we call loadAll when searching\n tableOptions.globalFilterFn = (row: RTRow<TType>, columnId: string, searchQuery: string) => {\n try {\n if (row.original) {\n const cell = row.getAllCells().find(cell => cell.column.id === columnId);\n const columnMeta = cell?.column.columnDef.meta;\n\n if (cell && cell.column.getIsVisible() && columnMeta?.enableSearch) {\n const cellValue = getCellValueAsString(row.original[columnId], columnMeta?.dataType);\n\n if (cellValue !== undefined) {\n return globalFilterFn(cellValue, searchQuery);\n }\n }\n return false;\n }\n } catch {\n //\n }\n\n return false;\n };\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n tableOptions.getColumnCanGlobalFilter = (column: RTColumn<TType>) =>\n (column.columnDef.meta as ColumnMeta<TType, unknown>).enableSearch ?? true;\n }\n\n // sorting\n if (options.enableSorting) {\n if (props.onSort) {\n tableOptions.manualSorting = true;\n // onSort is called as a listener to let the consumer update their data, so we don't use onSortingChange\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n"],"names":["useTable","props","ref","settings","setSettings","useSettings","id","defaultSettings","onChangeSettings","options","useTablePreset","tableOptions","configureReactTableOptions","columnFreezing","useColumnFreezing","_settings$columnFreez","columnFreezingIndex","defaultColumnFreezingIndex","validation","useValidation","onCellValidate","onRowValidate","editing","useEditing","enableEditing","onSave","printing","usePrinting","enablePrinting","showWarningWhenPrintingLargeDataset","rowActions","useRowActions","actionsForRow","actionsForRowLength","rowDrag","useRowDrag","enableRowDrag","rowDrop","useRowDrop","enableRowDrop","onRowDrop","search","useSearch","enableSearch","excludeUnmatchedRecordsInSearch","shortcutsState","usePauseShortcuts","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","rowActive","useTableRowActive","defaultCurrentRowIndex","rowClick","useTableRowClick","onRowClick","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","server","useTableServerLoading","loadPage","loadAll","columns","defaultColumnSizing","defaultColumnVisibility","defaultSorting","useConvertChildrenToColumns","initialState","React","useMemo","sanitizeSortedColumns","column","find","definedColumn","state","columnOrder","ensureOrdering","ACTIONS_COLUMN_ID","EDITING_ACTIONS_COLUMN_ID","columnSizing","_settings$columnSizin","columnVisibility","_settings$columnVisib","sorting","filter","_props$defaultSetting","columnFilters","_props$defaultSetting2","_props$defaultSetting3","globalFilter","_props$defaultSetting4","getSettings","table","getState","frozenColumnIndex","isEnabled","undefined","enableColumnResizing","enableHiding","excludeUnmatchedResults","size","height","isWarningVisibleForLargeDatasets","useReactTable","data","getCoreRowModel","meta","enableFooter","isPrinting","endsWith","isUsingServer","tableRef","useEditingStateListener","useSettingsStateListener","useTableDataListener","useTableFilterListener","onFilter","useTableFontSizeListener","useTableRowSelectionListener","onRowSelect","useTableServerLoadingListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onSort","length","_props$length","enableColumnFilters","enableFiltering","enableExpanding","enableRowExpansion","enableGlobalFilter","enableColumnHiding","enableMultiRowSelection","enableRowSelectionSingle","enableSorting","columnResizeMode","filterFns","tacoFilter","row","columnId","columnFilterFn","getValue","getFilteredRowModel","globalFilterFn","searchQuery","original","cell","getAllCells","columnMeta","columnDef","getIsVisible","cellValue","getCellValueAsString","dataType","getColumnCanGlobalFilter","_column$columnDef$met","manualSorting","getSortedRowModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHgBA,QAAQA,CAAkBC,KAAyB,EAAEC,GAA+B;;;EAEhG,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGC,WAAW,CAACJ,KAAK,CAACK,EAAE,EAAEL,KAAK,CAACM,eAAe,EAAEN,KAAK,CAACO,gBAAgB,CAAC;;EAGpG,MAAMC,OAAO,GAAGC,cAAc,CAACT,KAAK,CAAC;;EAGrC,MAAMU,YAAY,GAAGC,0BAA0B,CAACX,KAAK,EAAEQ,OAAO,CAAC;;EAG/D,MAAMI,cAAc,GAAGC,iBAAiB,EAAAC,qBAAA,GAACZ,QAAQ,CAACa,mBAAmB,cAAAD,qBAAA,cAAAA,qBAAA,GAAId,KAAK,CAACgB,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Y,EAAE,IAAIF,UAAU,aAAVA,UAAU,eAAVA,UAAU,CAAErH,YAAY,EAAE;YAChE,MAAMwH,SAAS,GAAGC,oBAAoB,CAACd,GAAG,CAACO,QAAQ,CAACN,QAAQ,CAAC,EAAES,UAAU,aAAVA,UAAU,uBAAVA,UAAU,CAAEK,QAAQ,CAAC;YAEpF,IAAIF,SAAS,KAAKxD,SAAS,EAAE;cACzB,OAAOgD,cAAc,CAACQ,SAAS,EAAEP,WAAW,CAAC;;;UAGrD,OAAO,KAAK;;OAEnB,CAAC,MAAM;;;MAIR,OAAO,KAAK;KACf;IACDjJ,YAAY,CAAC+I,mBAAmB,GAAGA,mBAAmB,EAAE;IACxD/I,YAAY,CAAC2J,wBAAwB,GAAIpF,MAAuB;MAAA,IAAAqF,qBAAA;MAAA,QAAAA,qBAAA,GAC3DrF,MAAM,CAAC+E,SAAS,CAAC5C,IAAmC,CAAC1E,YAAY,cAAA4H,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;;;EAIlF,IAAI9J,OAAO,CAACyI,aAAa,EAAE;IACvB,IAAIjJ,KAAK,CAACsI,MAAM,EAAE;MACd5H,YAAY,CAAC6J,aAAa,GAAG,IAAI;;KAEpC,MAAM;MACH7J,YAAY,CAAC8J,iBAAiB,GAAGA,iBAAiB,EAAE;;;EAI5D,OAAO9J,YAAY;AACvB;;;;"}
1
+ {"version":3,"file":"useTable.js","sources":["../../../../../../../../src/components/Table3/hooks/useTable.tsx"],"sourcesContent":["import React from 'react';\nimport {\n getCoreRowModel,\n useReactTable,\n Row as RTRow,\n RowData,\n Column as RTColumn,\n TableOptions as RTableOptions,\n TableState,\n getSortedRowModel,\n getFilteredRowModel,\n ColumnMeta,\n} from '@tanstack/react-table';\nimport {\n Table3ColumnAlignment,\n Table3ColumnRenderer,\n Table3Props,\n Table3ColumnHeaderMenu,\n Table3ColumnControlRenderer,\n Table3ColumnDataType,\n Table3ColumnClassNameHandler,\n Table3ColumnFooterRenderer,\n TableStrategy,\n Table3FilterComparator,\n Table3Settings,\n Table3Options,\n Table3Ref,\n} from '../types';\nimport { useTableRowActive } from '../../../primitives/Table/useTable/features/useTableRowActive';\nimport { useTablePreset } from './useTablePreset';\nimport { useTableRowHeight } from '../../../primitives/Table/useTable/features/useTableRowHeight';\nimport { useTableFontSize } from '../../../primitives/Table/useTable/features/useTableFontSize';\nimport { useTableRowSelectionListener } from '../../../primitives/Table/useTable/listeners/useTableRowSelectionListener';\nimport { useRowDrag } from './features/useRowDrag';\nimport { useSettingsStateListener } from './listeners/useSettingsStateListener';\nimport { columnFilterFn, globalFilterFn } from '../util/filtering';\nimport { useTableSortingListener } from '../../../primitives/Table/useTable/listeners/useTableSortingListener';\nimport { useTableFilterListener } from '../../../primitives/Table/useTable/listeners/useTableFilterListener';\nimport { useTableDataListener } from '../../../primitives/Table/useTable/listeners/useTableDataListener';\nimport { useColumnFreezing } from './features/useColumnFreezing';\nimport { useTableRowSelection } from '../../../primitives/Table/useTable/features/useTableRowSelection';\nimport { useTableServerLoading } from '../../../primitives/Table/useTable/features/useTableServerLoading';\nimport { useTableRowClick } from '../../../primitives/Table/useTable/features/useTableRowClick';\nimport { useTableColumnOrdering } from '../../../primitives/Table/useTable/features/useTableColumnOrdering';\nimport { useRowDrop } from './features/useRowDrop';\nimport { useConvertChildrenToColumns } from './useConvertChildrenToColumns';\nimport { useEditing } from './features/useEditing';\nimport { usePrinting } from './features/usePrinting';\nimport { useTableShortcutsListener } from '../../../primitives/Table/useTable/listeners/useTableShortcutsListener';\nimport { useTableRowGoto } from '../../../primitives/Table/useTable/features/useTableRowGoto';\nimport { useTableServerLoadingListener } from '../../../primitives/Table/useTable/listeners/useTableServerLoadingListener';\nimport { useEditingStateListener } from './listeners/useEditingStateListener';\nimport { useSearch } from './features/useSearch';\nimport { useRowActions } from './features/useRowActions';\nimport { useSettings } from './features/useSettings';\nimport { getCellValueAsString } from '../util/columns';\nimport { Table3Validation, useValidation } from './features/useValidation';\nimport { usePauseShortcuts } from './features/usePauseShortcuts';\nimport { useTableFontSizeListener } from '../../../primitives/Table/useTable/listeners/useTableFontSizeListener';\nimport { ensureOrdering } from '../../../primitives/Table/useTable/util/columns';\nimport { COLUMN_ID as ACTIONS_COLUMN_ID } from '../components/columns/internal/Actions';\nimport { COLUMN_ID as EDITING_ACTIONS_COLUMN_ID } from '../components/columns/internal/EditingActions';\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useColumnFreezing>;\n columnOrdering: ReturnType<typeof useTableColumnOrdering>;\n editing: ReturnType<typeof useEditing>;\n enableFooter: boolean;\n fontSize: ReturnType<typeof useTableFontSize>;\n getSettings: () => Table3Settings;\n isPrinting: boolean;\n isUsingServer: boolean;\n printing: ReturnType<typeof usePrinting>;\n rowActions: ReturnType<typeof useRowActions>;\n rowActive: ReturnType<typeof useTableRowActive>;\n rowClick: ReturnType<typeof useTableRowClick>;\n rowDrag: ReturnType<typeof useRowDrag>;\n rowDrop: ReturnType<typeof useRowDrop>;\n rowGoto: ReturnType<typeof useTableRowGoto>;\n rowHeight: ReturnType<typeof useTableRowHeight>;\n rowSelection: ReturnType<typeof useTableRowSelection>;\n search: ReturnType<typeof useSearch>;\n server: ReturnType<typeof useTableServerLoading>;\n shortcutsState: ReturnType<typeof usePauseShortcuts>;\n tableRef: React.RefObject<Table3Ref>;\n validation: Table3Validation<TData>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: Table3ColumnAlignment;\n className?: Table3ColumnClassNameHandler<TData>;\n control?: Table3ColumnControlRenderer<TData>;\n dataType?: Table3ColumnDataType;\n defaultWidth?: number;\n enableOrdering?: boolean;\n enableSearch: boolean;\n enableTruncate?: boolean;\n filters?: Table3FilterComparator[];\n footer?: Table3ColumnFooterRenderer;\n header: string;\n headerClassName?: string;\n menu?: Table3ColumnHeaderMenu;\n renderer?: Table3ColumnRenderer<TValue, TData>;\n tooltip?: string;\n }\n\n interface CellContext<TData extends RowData, TValue> {\n index: number;\n tableRef: React.RefObject<HTMLDivElement>;\n }\n\n interface HeaderContext<TData extends RowData, TValue> {\n scrollToIndex: TableStrategy['scrollToIndex'];\n }\n}\n\nexport function useTable<TType = unknown>(props: Table3Props<TType>, ref: React.RefObject<Table3Ref>) {\n // load any persisted table settings and merge them with any defaults\n const [settings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);\n\n // configure table3 options\n const options = useTablePreset(props);\n\n // configure react-table built-in features\n const tableOptions = configureReactTableOptions(props, options);\n\n // configure custom features\n const columnFreezing = useColumnFreezing(settings.columnFreezingIndex ?? props.defaultColumnFreezingIndex, options);\n // can't change due to rename to \"active row\"\n const validation = useValidation<TType>(props.onCellValidate, props.onRowValidate);\n // not relevant to common table\n const editing = useEditing<TType>(options.enableEditing, ref, validation, props.onSave);\n // we changed how printing works, so this shouldn't be migrated\n const printing = usePrinting(options.enablePrinting, settings.showWarningWhenPrintingLargeDataset, props.id);\n // needs to be moved\n const rowActions = useRowActions<TType>(props.actionsForRow, props.actionsForRowLength);\n // not relevant to common table\n const rowDrag = useRowDrag(options.enableRowDrag);\n // not relevant to common table\n const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);\n // haven't migrated load all/server loading yet\n const search = useSearch(options.enableSearch, settings.excludeUnmatchedRecordsInSearch);\n const shortcutsState = usePauseShortcuts();\n\n // custom features - shared/migrated\n const columnOrdering = useTableColumnOrdering(options.enableColumnOrdering);\n const fontSize = useTableFontSize(options.enableFontSize, settings.fontSize);\n const rowActive = useTableRowActive(true, props.defaultCurrentRowIndex);\n const rowClick = useTableRowClick<TType>(true, props.onRowClick);\n const rowGoto = useTableRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);\n const rowSelection = useTableRowSelection(options.enableRowSelection);\n const server = useTableServerLoading(props.loadPage, props.loadAll);\n\n // columns\n const { columns, defaultColumnSizing, defaultColumnVisibility, defaultSorting } = useConvertChildrenToColumns<TType>(\n props,\n options,\n editing\n );\n\n // built-in features\n const initialState: Partial<TableState> = React.useMemo(() => {\n const sanitizeSortedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);\n\n const state: Partial<TableState> = {\n columnOrder: ensureOrdering<TType>(columns, settings.columnOrder, [ACTIONS_COLUMN_ID, EDITING_ACTIONS_COLUMN_ID]),\n columnSizing: settings.columnSizing ?? defaultColumnSizing,\n columnVisibility: settings.columnVisibility ?? defaultColumnVisibility,\n sorting: settings.sorting ? settings.sorting.filter(sanitizeSortedColumns) : defaultSorting,\n };\n\n // we don't save these outside the table, but they need to be here for print to inherit them - see PrintButton.tsx\n if ((props.defaultSettings as any)?.columnFilters) {\n state.columnFilters = (props.defaultSettings as any)?.columnFilters;\n }\n\n if ((props.defaultSettings as any)?.globalFilter) {\n state.globalFilter = (props.defaultSettings as any)?.globalFilter;\n }\n\n return state;\n }, []);\n\n const getSettings = () => {\n const state = table.getState();\n return {\n columnFreezingIndex: columnFreezing.frozenColumnIndex,\n columnOrder: columnOrdering.isEnabled ? state.columnOrder : undefined,\n columnSizing: table.options.enableColumnResizing ? state.columnSizing : undefined,\n columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,\n excludeUnmatchedRecordsInSearch: search.excludeUnmatchedResults,\n fontSize: fontSize.isEnabled ? fontSize.size : undefined,\n rowHeight: rowHeight.isEnabled ? rowHeight.height : undefined,\n showWarningWhenPrintingLargeDataset: printing.isWarningVisibleForLargeDatasets,\n sorting: state.sorting,\n };\n };\n\n const table = useReactTable<TType>({\n data: props.data,\n columns,\n getCoreRowModel: getCoreRowModel(),\n initialState,\n ...tableOptions,\n //debugAll: true,\n meta: {\n columnFreezing,\n columnOrdering,\n editing,\n enableFooter: options.enableFooter,\n fontSize,\n getSettings,\n isPrinting: props.id.endsWith('_print'),\n isUsingServer: !!props.loadPage,\n printing,\n rowActions: rowActions as any,\n rowActive,\n rowClick: rowClick as any,\n rowDrag,\n rowDrop,\n rowGoto,\n rowHeight,\n rowSelection,\n search,\n server,\n shortcutsState,\n tableRef: ref,\n validation,\n },\n });\n\n // listeners\n useEditingStateListener(table);\n useSettingsStateListener(table, setSettings);\n // listeners - shared/migrated\n useTableDataListener(table);\n useTableFilterListener(table, props.onFilter);\n useTableFontSizeListener(table);\n useTableRowSelectionListener(table, props.onRowSelect);\n useTableServerLoadingListener(table, props.loadPage);\n useTableShortcutsListener(table, props.shortcuts);\n useTableSortingListener(table, props.onSort);\n\n return { table, length: props.length ?? props.data.length };\n}\n\nfunction configureReactTableOptions<TType = unknown>(props: Table3Props<TType>, options: Table3Options) {\n const tableOptions: Partial<RTableOptions<TType>> = {\n enableColumnFilters: options.enableFiltering,\n enableColumnResizing: options.enableColumnResizing,\n enableExpanding: options.enableRowExpansion,\n enableGlobalFilter: options.enableSearch,\n enableHiding: options.enableColumnHiding,\n enableRowSelection: options.enableRowSelection,\n enableMultiRowSelection: !options.enableRowSelectionSingle,\n enableSorting: options.enableSorting,\n };\n\n // resizing\n if (tableOptions.enableColumnResizing) {\n tableOptions.columnResizeMode = 'onChange';\n }\n\n // filtering\n if (tableOptions.enableColumnFilters) {\n if (!props.onFilter) {\n tableOptions.filterFns = {\n tacoFilter: (row: RTRow<TType>, columnId: string, filter: any) => columnFilterFn(row.getValue(columnId), filter),\n };\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n }\n\n // we don't tableOptions.manualFiltering = true; because it breaks global filtering, server filtering still works :shrug:\n }\n\n // search\n if (tableOptions.enableGlobalFilter) {\n // search is always client side, since we call loadAll when searching\n tableOptions.globalFilterFn = (row: RTRow<TType>, columnId: string, searchQuery: string) => {\n try {\n if (row.original) {\n const cell = row.getAllCells().find(cell => cell.column.id === columnId);\n const columnMeta = cell?.column.columnDef.meta;\n\n if (cell && cell.column.getIsVisible() && columnMeta?.enableSearch) {\n const cellValue = getCellValueAsString(row.original[columnId], columnMeta?.dataType);\n\n if (cellValue !== undefined) {\n return globalFilterFn(cellValue, searchQuery);\n }\n }\n return false;\n }\n } catch {\n //\n }\n\n return false;\n };\n tableOptions.getFilteredRowModel = getFilteredRowModel();\n tableOptions.getColumnCanGlobalFilter = (column: RTColumn<TType>) =>\n (column.columnDef.meta as ColumnMeta<TType, unknown>).enableSearch ?? true;\n }\n\n // sorting\n if (options.enableSorting) {\n if (props.onSort) {\n tableOptions.manualSorting = true;\n // onSort is called as a listener to let the consumer update their data, so we don't use onSortingChange\n } else {\n tableOptions.getSortedRowModel = getSortedRowModel();\n }\n }\n\n return tableOptions;\n}\n"],"names":["useTable","props","ref","settings","setSettings","useSettings","id","defaultSettings","onChangeSettings","options","useTablePreset","tableOptions","configureReactTableOptions","columnFreezing","useColumnFreezing","_settings$columnFreez","columnFreezingIndex","defaultColumnFreezingIndex","validation","useValidation","onCellValidate","onRowValidate","editing","useEditing","enableEditing","onSave","printing","usePrinting","enablePrinting","showWarningWhenPrintingLargeDataset","rowActions","useRowActions","actionsForRow","actionsForRowLength","rowDrag","useRowDrag","enableRowDrag","rowDrop","useRowDrop","enableRowDrop","onRowDrop","search","useSearch","enableSearch","excludeUnmatchedRecordsInSearch","shortcutsState","usePauseShortcuts","columnOrdering","useTableColumnOrdering","enableColumnOrdering","fontSize","useTableFontSize","enableFontSize","rowActive","useTableRowActive","defaultCurrentRowIndex","rowClick","useTableRowClick","onRowClick","rowGoto","useTableRowGoto","enableRowGoto","onRowGoto","rowHeight","useTableRowHeight","enableRowHeight","rowSelection","useTableRowSelection","enableRowSelection","server","useTableServerLoading","loadPage","loadAll","columns","defaultColumnSizing","defaultColumnVisibility","defaultSorting","useConvertChildrenToColumns","initialState","React","useMemo","sanitizeSortedColumns","column","find","definedColumn","state","columnOrder","ensureOrdering","ACTIONS_COLUMN_ID","EDITING_ACTIONS_COLUMN_ID","columnSizing","_settings$columnSizin","columnVisibility","_settings$columnVisib","sorting","filter","_props$defaultSetting","columnFilters","_props$defaultSetting2","_props$defaultSetting3","globalFilter","_props$defaultSetting4","getSettings","table","getState","frozenColumnIndex","isEnabled","undefined","enableColumnResizing","enableHiding","excludeUnmatchedResults","size","height","isWarningVisibleForLargeDatasets","useReactTable","data","getCoreRowModel","meta","enableFooter","isPrinting","endsWith","isUsingServer","tableRef","useEditingStateListener","useSettingsStateListener","useTableDataListener","useTableFilterListener","onFilter","useTableFontSizeListener","useTableRowSelectionListener","onRowSelect","useTableServerLoadingListener","useTableShortcutsListener","shortcuts","useTableSortingListener","onSort","length","_props$length","enableColumnFilters","enableFiltering","enableExpanding","enableRowExpansion","enableGlobalFilter","enableColumnHiding","enableMultiRowSelection","enableRowSelectionSingle","enableSorting","columnResizeMode","filterFns","tacoFilter","row","columnId","columnFilterFn","getValue","getFilteredRowModel","globalFilterFn","searchQuery","original","cell","getAllCells","columnMeta","columnDef","getIsVisible","cellValue","getCellValueAsString","dataType","getColumnCanGlobalFilter","_column$columnDef$met","manualSorting","getSortedRowModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqHgBA,QAAQA,CAAkBC,KAAyB,EAAEC,GAA+B;;;EAEhG,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGC,WAAW,CAACJ,KAAK,CAACK,EAAE,EAAEL,KAAK,CAACM,eAAe,EAAEN,KAAK,CAACO,gBAAgB,CAAC;;EAGpG,MAAMC,OAAO,GAAGC,cAAc,CAACT,KAAK,CAAC;;EAGrC,MAAMU,YAAY,GAAGC,0BAA0B,CAACX,KAAK,EAAEQ,OAAO,CAAC;;EAG/D,MAAMI,cAAc,GAAGC,iBAAiB,EAAAC,qBAAA,GAACZ,QAAQ,CAACa,mBAAmB,cAAAD,qBAAA,cAAAA,qBAAA,GAAId,KAAK,CAACgB,0BAA0B,EAAER,OAAO,CAAC;;EAEnH,MAAMS,UAAU,GAAGC,aAAa,CAAQlB,KAAK,CAACmB,cAAc,EAAEnB,KAAK,CAACoB,aAAa,CAAC;;EAElF,MAAMC,OAAO,GAAGC,UAAU,CAAQd,OAAO,CAACe,aAAa,EAAEtB,GAAG,EAAEgB,UAAU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K,QAAQ,CAAC;YAEpF,IAAIF,SAAS,KAAKxD,SAAS,EAAE;cACzB,OAAOgD,cAAc,CAACQ,SAAS,EAAEP,WAAW,CAAC;;;UAGrD,OAAO,KAAK;;OAEnB,CAAC,MAAM;;;MAIR,OAAO,KAAK;KACf;IACDjJ,YAAY,CAAC+I,mBAAmB,GAAGA,mBAAmB,EAAE;IACxD/I,YAAY,CAAC2J,wBAAwB,GAAIpF,MAAuB;MAAA,IAAAqF,qBAAA;MAAA,QAAAA,qBAAA,GAC3DrF,MAAM,CAAC+E,SAAS,CAAC5C,IAAmC,CAAC1E,YAAY,cAAA4H,qBAAA,cAAAA,qBAAA,GAAI,IAAI;;;;EAIlF,IAAI9J,OAAO,CAACyI,aAAa,EAAE;IACvB,IAAIjJ,KAAK,CAACsI,MAAM,EAAE;MACd5H,YAAY,CAAC6J,aAAa,GAAG,IAAI;;KAEpC,MAAM;MACH7J,YAAY,CAAC8J,iBAAiB,GAAGA,iBAAiB,EAAE;;;EAI5D,OAAO9J,YAAY;AACvB;;;;"}
@@ -25,12 +25,21 @@ const getNextFocussableElement = currentElement => {
25
25
  }
26
26
  return focussableElements[currentElementIndex + 1];
27
27
  };
28
- function isElementInsideOrTriggeredFromContainer(element, container) {
28
+ const getOverlaySelector = element => {
29
29
  switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
30
30
  case 'dialog':
31
- return !!(container !== null && container !== void 0 && container.querySelector(`[aria-controls='${element.id}']`));
31
+ return `[aria-controls='${element.id}']`;
32
32
  case 'menu':
33
- return !!(container !== null && container !== void 0 && container.querySelector(`#${element.getAttribute('aria-labelledby')}`));
33
+ return `#${element.getAttribute('aria-labelledby')}`;
34
+ default:
35
+ return undefined;
36
+ }
37
+ };
38
+ function isElementInsideOrTriggeredFromContainer(element, container) {
39
+ var _getOverlaySelector, _element$closest;
40
+ const selector = (_getOverlaySelector = getOverlaySelector(element)) !== null && _getOverlaySelector !== void 0 ? _getOverlaySelector : getOverlaySelector((_element$closest = element === null || element === void 0 ? void 0 : element.closest('[role=dialog],[role=menu]')) !== null && _element$closest !== void 0 ? _element$closest : null);
41
+ if (selector) {
42
+ return !!(container !== null && container !== void 0 && container.querySelector(selector));
34
43
  }
35
44
  return !!(container !== null && container !== void 0 && container.contains(element));
36
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return !!container?.querySelector(`[aria-controls='${element.id}']`);\n\n case 'menu':\n return !!container?.querySelector(`#${element.getAttribute('aria-labelledby')}`);\n }\n\n return !!container?.contains(element);\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","isElementInsideOrTriggeredFromContainer","container","getAttribute","querySelector","id","contains"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC,EAAE;IACrF,OAAO,IAAI;;EAGf,OAAOL,kBAAkB,CAACG,mBAAmB,GAAG,CAAC,CAAC;AACtD;SAEgBG,uCAAuCA,CAACrB,OAAuB,EAAEsB,SAAyB;EACtG,QAAQtB,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEuB,YAAY,CAAC,MAAM,CAAC;IACjC,KAAK,QAAQ;MACT,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEE,aAAa,oBAAoBxB,OAAO,CAACyB,MAAM,CAAC;IAExE,KAAK,MAAM;MACP,OAAO,CAAC,EAACH,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEE,aAAa,KAAKxB,OAAO,CAACuB,YAAY,CAAC,iBAAiB,GAAG,CAAC;;EAGxF,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEI,QAAQ,CAAC1B,OAAO,CAAC;AACzC;;;;"}
1
+ {"version":3,"file":"dom.js","sources":["../../../../../../src/utils/dom.ts"],"sourcesContent":["export const isOverflowing = (element: HTMLElement | null) =>\n element !== null ? element.scrollWidth > element.offsetWidth : false;\n\nexport const getIndexOfFirstChildOverflowingParent = (element: HTMLElement, overscan = 0) => {\n let index = 0;\n let boundaryChildIndex: number | null = null;\n const clientRect = element.getBoundingClientRect();\n\n for (const child of Array.from(element.children)) {\n const right = child.getBoundingClientRect().right - clientRect.left;\n const width = clientRect.width - overscan;\n\n if (right > width) {\n boundaryChildIndex = index;\n break;\n }\n index++;\n }\n\n return boundaryChildIndex;\n};\n\nexport const getNextFocussableElement = (currentElement: HTMLElement | null) => {\n if (!currentElement) {\n return null;\n }\n\n const focussableElements = [\n ...document.querySelectorAll<HTMLElement>(\n 'button:not([disabled]), [href]:not(link):not(script), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"]):not([disabled]), details:not([disabled]), summary:not(:disabled)'\n ),\n ];\n const currentElementIndex = focussableElements.indexOf(currentElement);\n\n // If the currentElement is not in the focussable elements list or it is the last element\n if (currentElementIndex !== -1 && currentElementIndex === focussableElements.length - 1) {\n return null;\n }\n\n return focussableElements[currentElementIndex + 1];\n};\n\nconst getOverlaySelector = (element: Element | null) => {\n switch (element?.getAttribute('role')) {\n case 'dialog':\n return `[aria-controls='${element.id}']`;\n\n case 'menu':\n return `#${element.getAttribute('aria-labelledby')}`;\n\n default:\n return undefined;\n }\n};\n\nexport function isElementInsideOrTriggeredFromContainer(element: Element | null, container: Element | null) {\n const selector = getOverlaySelector(element) ?? getOverlaySelector(element?.closest('[role=dialog],[role=menu]') ?? null);\n\n if (selector) {\n return !!container?.querySelector(selector);\n }\n\n return !!container?.contains(element);\n}\n"],"names":["getIndexOfFirstChildOverflowingParent","element","overscan","index","boundaryChildIndex","clientRect","getBoundingClientRect","child","Array","from","children","right","left","width","getNextFocussableElement","currentElement","focussableElements","document","querySelectorAll","currentElementIndex","indexOf","length","getOverlaySelector","getAttribute","id","undefined","isElementInsideOrTriggeredFromContainer","container","selector","_getOverlaySelector","_element$closest","closest","querySelector","contains"],"mappings":"MAGaA,qCAAqC,GAAGA,CAACC,OAAoB,EAAEC,QAAQ,GAAG,CAAC;EACpF,IAAIC,KAAK,GAAG,CAAC;EACb,IAAIC,kBAAkB,GAAkB,IAAI;EAC5C,MAAMC,UAAU,GAAGJ,OAAO,CAACK,qBAAqB,EAAE;EAElD,KAAK,MAAMC,KAAK,IAAIC,KAAK,CAACC,IAAI,CAACR,OAAO,CAACS,QAAQ,CAAC,EAAE;IAC9C,MAAMC,KAAK,GAAGJ,KAAK,CAACD,qBAAqB,EAAE,CAACK,KAAK,GAAGN,UAAU,CAACO,IAAI;IACnE,MAAMC,KAAK,GAAGR,UAAU,CAACQ,KAAK,GAAGX,QAAQ;IAEzC,IAAIS,KAAK,GAAGE,KAAK,EAAE;MACfT,kBAAkB,GAAGD,KAAK;MAC1B;;IAEJA,KAAK,EAAE;;EAGX,OAAOC,kBAAkB;AAC7B;MAEaU,wBAAwB,GAAIC,cAAkC;EACvE,IAAI,CAACA,cAAc,EAAE;IACjB,OAAO,IAAI;;EAGf,MAAMC,kBAAkB,GAAG,CACvB,GAAGC,QAAQ,CAACC,gBAAgB,CACxB,iOAAiO,CACpO,CACJ;EACD,MAAMC,mBAAmB,GAAGH,kBAAkB,CAACI,OAAO,CAACL,cAAc,CAAC;;EAGtE,IAAII,mBAAmB,KAAK,CAAC,CAAC,IAAIA,mBAAmB,KAAKH,kBAAkB,CAACK,MAAM,GAAG,CAAC,EAAE;IACrF,OAAO,IAAI;;EAGf,OAAOL,kBAAkB,CAACG,mBAAmB,GAAG,CAAC,CAAC;AACtD;AAEA,MAAMG,kBAAkB,GAAIrB,OAAuB;EAC/C,QAAQA,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEsB,YAAY,CAAC,MAAM,CAAC;IACjC,KAAK,QAAQ;MACT,0BAA0BtB,OAAO,CAACuB,MAAM;IAE5C,KAAK,MAAM;MACP,WAAWvB,OAAO,CAACsB,YAAY,CAAC,iBAAiB,GAAG;IAExD;MACI,OAAOE,SAAS;;AAE5B,CAAC;SAEeC,uCAAuCA,CAACzB,OAAuB,EAAE0B,SAAyB;;EACtG,MAAMC,QAAQ,IAAAC,mBAAA,GAAGP,kBAAkB,CAACrB,OAAO,CAAC,cAAA4B,mBAAA,cAAAA,mBAAA,GAAIP,kBAAkB,EAAAQ,gBAAA,GAAC7B,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAE8B,OAAO,CAAC,2BAA2B,CAAC,cAAAD,gBAAA,cAAAA,gBAAA,GAAI,IAAI,CAAC;EAEzH,IAAIF,QAAQ,EAAE;IACV,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEK,aAAa,CAACJ,QAAQ,CAAC;;EAG/C,OAAO,CAAC,EAACD,SAAS,aAATA,SAAS,eAATA,SAAS,CAAEM,QAAQ,CAAChC,OAAO,CAAC;AACzC;;;;"}
@@ -10081,12 +10081,21 @@ const getNextFocussableElement = currentElement => {
10081
10081
  }
10082
10082
  return focussableElements[currentElementIndex + 1];
10083
10083
  };
10084
- function isElementInsideOrTriggeredFromContainer(element, container) {
10084
+ const getOverlaySelector = element => {
10085
10085
  switch (element === null || element === void 0 ? void 0 : element.getAttribute('role')) {
10086
10086
  case 'dialog':
10087
- return !!(container !== null && container !== void 0 && container.querySelector(`[aria-controls='${element.id}']`));
10087
+ return `[aria-controls='${element.id}']`;
10088
10088
  case 'menu':
10089
- return !!(container !== null && container !== void 0 && container.querySelector(`#${element.getAttribute('aria-labelledby')}`));
10089
+ return `#${element.getAttribute('aria-labelledby')}`;
10090
+ default:
10091
+ return undefined;
10092
+ }
10093
+ };
10094
+ function isElementInsideOrTriggeredFromContainer(element, container) {
10095
+ var _getOverlaySelector, _element$closest;
10096
+ const selector = (_getOverlaySelector = getOverlaySelector(element)) !== null && _getOverlaySelector !== void 0 ? _getOverlaySelector : getOverlaySelector((_element$closest = element === null || element === void 0 ? void 0 : element.closest('[role=dialog],[role=menu]')) !== null && _element$closest !== void 0 ? _element$closest : null);
10097
+ if (selector) {
10098
+ return !!(container !== null && container !== void 0 && container.querySelector(selector));
10090
10099
  }
10091
10100
  return !!(container !== null && container !== void 0 && container.contains(element));
10092
10101
  }
@@ -14471,7 +14480,7 @@ var SavingStatusValue;
14471
14480
  SavingStatusValue["Saved"] = "saved";
14472
14481
  SavingStatusValue["Error"] = "error";
14473
14482
  })(SavingStatusValue || (SavingStatusValue = {}));
14474
- function useEditing(isEnabled, validation, onSave) {
14483
+ function useEditing(isEnabled, tableRef, validation, onSave) {
14475
14484
  // used to switch the table into editing mode
14476
14485
  const [isEditing, setIsEditing] = React__default.useState(false);
14477
14486
  // Saving indicator need to show saving status per row, saving status can have at least two states 'saving', 'saved',
@@ -14638,6 +14647,20 @@ function useEditing(isEnabled, validation, onSave) {
14638
14647
  }
14639
14648
  return false;
14640
14649
  }, [isEditing, editingState]);
14650
+ React__default.useEffect(() => {
14651
+ const handleClickOutside = event => {
14652
+ const target = event.target;
14653
+ const closestPopup = target.closest('[role="dialog"], [role="menu"]');
14654
+ // Need to check that neither target itself nor closest popup is inside or triggetred from the table.
14655
+ if (!isElementInsideOrTriggeredFromContainer(target, tableRef.current) && !isElementInsideOrTriggeredFromContainer(closestPopup, tableRef.current)) {
14656
+ saveChangesIfNeeded();
14657
+ }
14658
+ };
14659
+ document.addEventListener('click', handleClickOutside);
14660
+ return () => {
14661
+ document.removeEventListener('click', handleClickOutside);
14662
+ };
14663
+ }, [saveChangesIfNeeded]);
14641
14664
  function getSavingStatus(rowId) {
14642
14665
  return savingStatuses && savingStatuses[rowId];
14643
14666
  }
@@ -14949,6 +14972,7 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
14949
14972
  onKeyDown: handleKeyDown,
14950
14973
  onChange: handleChange,
14951
14974
  onBlur,
14975
+ onFocus,
14952
14976
  column,
14953
14977
  isCellInDetailMode,
14954
14978
  align,
@@ -15022,6 +15046,13 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
15022
15046
  }
15023
15047
  onBlur(event);
15024
15048
  };
15049
+ const handleFocus = event => {
15050
+ const textareaElement = ref === null || ref === void 0 ? void 0 : ref.current;
15051
+ if (textareaElement) {
15052
+ resizeTextArea(textareaElement);
15053
+ }
15054
+ onFocus(event);
15055
+ };
15025
15056
  return /*#__PURE__*/React__default.createElement("div", {
15026
15057
  "data-taco": "input-container"
15027
15058
  }, /*#__PURE__*/React__default.createElement("div", {
@@ -15041,7 +15072,8 @@ const TextareaControl = /*#__PURE__*/React__default.forwardRef(function Textarea
15041
15072
  handleTextareaKeyDown(e);
15042
15073
  },
15043
15074
  onBlur: handleBlur,
15044
- className: cn(getCellAlignmentClasses(align), `h-fit resize-none [&:not(:focus)]:whitespace-nowrap`, {
15075
+ onFocus: handleFocus,
15076
+ className: cn(getCellAlignmentClasses(align), `h-fit resize-none overflow-y-hidden focus:overflow-y-auto [&:not(:focus)]:whitespace-nowrap`, {
15045
15077
  [`!min-h-[${minMaxHeight.min}px]`]: columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate,
15046
15078
  '!yt-focus-dark': isCellInDetailMode,
15047
15079
  [`h-[${minMaxHeight.min}px]`]: !isCellInDetailMode && (columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.enableTruncate),
@@ -16394,7 +16426,7 @@ function useTable$1(props, ref) {
16394
16426
  // can't change due to rename to "active row"
16395
16427
  const validation = useValidation(props.onCellValidate, props.onRowValidate);
16396
16428
  // not relevant to common table
16397
- const editing = useEditing(options.enableEditing, validation, props.onSave);
16429
+ const editing = useEditing(options.enableEditing, ref, validation, props.onSave);
16398
16430
  // we changed how printing works, so this shouldn't be migrated
16399
16431
  const printing = usePrinting(options.enablePrinting, settings.showWarningWhenPrintingLargeDataset, props.id);
16400
16432
  // needs to be moved
@@ -18964,7 +18996,9 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
18964
18996
  role: "rowgroup",
18965
18997
  ref: bodyRef
18966
18998
  }, renderBody())), /*#__PURE__*/React__default.createElement("div", {
18967
- className: "border-grey-300 col-span-full translate-y-px border-t"
18999
+ className: cn('border-grey-300 col-span-full border-t', {
19000
+ 'translate-y-px': tableMeta.enableFooter
19001
+ })
18968
19002
  }), tableMeta.enableFooter ? ( /*#__PURE__*/React__default.createElement("div", {
18969
19003
  className: "group/footer contents",
18970
19004
  "data-taco": "table2-footer",
@@ -18982,7 +19016,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
18982
19016
  length: length,
18983
19017
  table: table
18984
19018
  })) : null)) : null)) : ( /*#__PURE__*/React__default.createElement("div", {
18985
- className: "col-span-full min-h-[theme(spacing.8)]"
19019
+ className: "col-span-full box-border min-h-[theme(spacing.8)]"
18986
19020
  }, EmptyState ? /*#__PURE__*/React__default.createElement(EmptyState, null) : null))));
18987
19021
  });
18988
19022
  const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {