@economic/taco 2.9.2 → 2.10.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/IconButton/IconButton.d.ts +2 -2
- package/dist/components/Provider/Localization.d.ts +6 -0
- package/dist/components/Table3/components/columns/header/Header.d.ts +6 -1
- package/dist/components/Table3/components/columns/header/Menu.d.ts +4 -0
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +6 -5
- package/dist/components/Table3/hooks/useCssVars.d.ts +2 -1
- package/dist/components/Table3/hooks/useTable.d.ts +1 -0
- package/dist/components/Table3/types.d.ts +7 -0
- package/dist/esm/index.css +92 -16
- package/dist/esm/packages/taco/src/components/Button/util.js +5 -1
- package/dist/esm/packages/taco/src/components/Button/util.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js +1 -1
- package/dist/esm/packages/taco/src/components/Menu/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +7 -1
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +13 -6
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/Cell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +5 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js +5 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingCell.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js +0 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/EditingControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/controls/TextareaControl.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +30 -6
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +36 -10
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +3 -3
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/EditingActions.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +2 -2
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +87 -40
- package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js +10 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +28 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowClick.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js +5 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowSelection.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useCurrentRowListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js +8 -4
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useEditingStateListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useShortcutsListener.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +2 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js +15 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssVars.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/index.css +92 -16
- package/dist/taco.cjs.development.js +272 -96
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
- package/types.json +5803 -5242
@@ -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} from '../types';\nimport { useCurrentRow } from './features/useCurrentRow';\nimport { usePauseHoverState } from './features/usePauseHoverState';\nimport { useTablePreset } from './useTablePreset';\nimport { useRowHeight } from './features/useRowHeight';\nimport { useFontSize } from './features/useFontSize';\nimport { useRowSelectionListener } from './listeners/useRowSelectionListener';\nimport { useRowDrag } from './features/useRowDrag';\nimport { useSettingsStateListener } from './listeners/useSettingsStateListener';\nimport { columnFilterFn, globalFilterFn } from '../util/filtering';\nimport { useSortingStateListener } from './listeners/useSortingStateListener';\nimport { useFilteringStateListener } from './listeners/useFilteringStateListener';\nimport { useCurrentRowListener } from './listeners/useCurrentRowListener';\nimport { useColumnFreezing } from './features/useColumnFreezing';\nimport { useRowSelection } from './features/useRowSelection';\nimport { useRowClick } from './features/useRowClick';\nimport { ensureOrdering, useColumnOrdering } from './features/useColumnOrdering';\nimport { useRowDrop } from './features/useRowDrop';\nimport { useConvertChildrenToColumns } from './useConvertChildrenToColumns';\nimport { useEditing } from './features/useEditing';\nimport { usePrinting } from './features/usePrinting';\nimport { useShortcutsListener } from './listeners/useShortcutsListener';\nimport { useRowGoto } from './features/useRowGoto';\nimport { useServerLoadingListener } from './listeners/useServerLoadingListener';\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';\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useColumnFreezing>;\n columnOrdering: ReturnType<typeof useColumnOrdering>;\n currentRow: ReturnType<typeof useCurrentRow>;\n editing: ReturnType<typeof useEditing>;\n enableFooter: boolean;\n fontSize: ReturnType<typeof useFontSize>;\n hoverState: ReturnType<typeof usePauseHoverState>;\n isUsingServer: boolean;\n printing: ReturnType<typeof usePrinting>;\n rowActions: ReturnType<typeof useRowActions>;\n rowClick: ReturnType<typeof useRowClick>;\n rowDrag: ReturnType<typeof useRowDrag>;\n rowDrop: ReturnType<typeof useRowDrop>;\n rowGoto: ReturnType<typeof useRowGoto>;\n rowHeight: ReturnType<typeof useRowHeight>;\n rowSelection: ReturnType<typeof useRowSelection>;\n search: ReturnType<typeof useSearch>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: Table3ColumnAlignment;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n className?: Table3ColumnClassNameHandler<TData>;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n control?: Table3ColumnControlRenderer<TData>;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n dataType?: Table3ColumnDataType;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\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>) {\n // options\n const options = useTablePreset(props);\n\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 const [defaultSettings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);\n\n // custom features\n const columnFreezing = useColumnFreezing(\n // temporarily see if deprecated frozenColumnCount is there\n defaultSettings.columnFreezingIndex ?? (defaultSettings as any)?.frozenColumnCount ?? props.defaultColumnFreezingIndex,\n options\n );\n const columnOrdering = useColumnOrdering(options);\n const currentRow = useCurrentRow(props.defaultCurrentRowIndex);\n const editing = useEditing(options.enableEditing, props.onSave);\n const fontSize = useFontSize(options.enableFontSize, defaultSettings.fontSize);\n const hoverState = usePauseHoverState();\n const printing = usePrinting(options.enablePrinting, props.loadAll, defaultSettings.showWarningWhenPrintingLargeDataset);\n const rowActions = useRowActions<TType>(props.actionsForRow, props.actionsForRowLength);\n const rowClick = useRowClick<TType>(props.onRowClick);\n const rowDrag = useRowDrag(options.enableRowDrag);\n const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);\n const rowGoto = useRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowHeight = useRowHeight(\n options.enableRowHeight,\n // temporarily see if deprecated rowDensity is there\n defaultSettings.rowHeight ?? (defaultSettings as any)?.rowDensity\n );\n const rowSelection = useRowSelection();\n const search = useSearch(options.enableSearch, defaultSettings.excludeUnmatchedRecordsInSearch, 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, defaultSettings.columnOrder),\n columnSizing: defaultSettings.columnSizing ?? defaultColumnSizing,\n columnVisibility: defaultSettings.columnVisibility ?? defaultColumnVisibility,\n sorting: defaultSettings.sorting ? defaultSettings.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 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 currentRow,\n editing,\n enableFooter: options.enableFooter,\n fontSize,\n hoverState,\n isUsingServer: !!props.loadPage,\n printing,\n rowActions: rowActions as any,\n rowClick: rowClick as any,\n rowDrag,\n rowDrop,\n rowGoto,\n rowHeight,\n rowSelection,\n search,\n },\n });\n\n // listeners\n useCurrentRowListener(table);\n useEditingStateListener(table);\n useFilteringStateListener(table, props.onFilter);\n useRowSelectionListener(table, props.onRowSelect);\n useSettingsStateListener(table, setSettings);\n useShortcutsListener(table, props.shortcuts);\n useServerLoadingListener(table, props.loadPage);\n useSortingStateListener(table, props.onSort);\n\n return { table, length: props.length ?? props.data.length };\n}\n"],"names":["useTable","props","options","useTablePreset","tableOptions","enableColumnFilters","enableFiltering","enableColumnResizing","enableExpanding","enableRowExpansion","enableGlobalFilter","enableSearch","enableHiding","enableColumnHiding","enableRowSelection","enableMultiRowSelection","enableRowSelectionSingle","enableSorting","columnResizeMode","onFilter","filterFns","tacoFilter","row","columnId","filter","columnFilterFn","getValue","getFilteredRowModel","globalFilterFn","searchQuery","original","cell","getAllCells","find","column","id","columnMeta","columnDef","meta","getIsVisible","cellValue","getCellValueAsString","dataType","undefined","getColumnCanGlobalFilter","_column$columnDef$met","onSort","manualSorting","getSortedRowModel","defaultSettings","setSettings","useSettings","onChangeSettings","columnFreezing","useColumnFreezing","_ref","_defaultSettings$colu","columnFreezingIndex","frozenColumnCount","defaultColumnFreezingIndex","columnOrdering","useColumnOrdering","currentRow","useCurrentRow","defaultCurrentRowIndex","editing","useEditing","enableEditing","onSave","fontSize","useFontSize","enableFontSize","hoverState","usePauseHoverState","printing","usePrinting","enablePrinting","loadAll","showWarningWhenPrintingLargeDataset","rowActions","useRowActions","actionsForRow","actionsForRowLength","rowClick","useRowClick","onRowClick","rowDrag","useRowDrag","enableRowDrag","rowDrop","useRowDrop","enableRowDrop","onRowDrop","rowGoto","useRowGoto","enableRowGoto","onRowGoto","rowHeight","useRowHeight","enableRowHeight","_defaultSettings$rowH","rowDensity","rowSelection","useRowSelection","search","useSearch","excludeUnmatchedRecordsInSearch","columns","defaultColumnSizing","defaultColumnVisibility","defaultSorting","useConvertChildrenToColumns","initialState","React","useMemo","sanitizeSortedColumns","definedColumn","state","columnOrder","ensureOrdering","columnSizing","_defaultSettings$colu2","columnVisibility","_defaultSettings$colu3","sorting","_props$defaultSetting","columnFilters","_props$defaultSetting2","_props$defaultSetting3","globalFilter","_props$defaultSetting4","table","useReactTable","data","getCoreRowModel","enableFooter","isUsingServer","loadPage","useCurrentRowListener","useEditingStateListener","useFilteringStateListener","useRowSelectionListener","onRowSelect","useSettingsStateListener","useShortcutsListener","shortcuts","useServerLoadingListener","useSortingStateListener","length","_props$length"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SA2GgBA,QAAQA,CAAkBC,KAAyB;;;EAE/D,MAAMC,OAAO,GAAGC,cAAc,CAACF,KAAK,CAAC;EAErC,MAAMG,YAAY,GAAkC;IAChDC,mBAAmB,EAAEH,OAAO,CAACI,eAAe;IAC5CC,oBAAoB,EAAEL,OAAO,CAACK,oBAAoB;IAClDC,eAAe,EAAEN,OAAO,CAACO,kBAAkB;IAC3CC,kBAAkB,EAAER,OAAO,CAACS,YAAY;IACxCC,YAAY,EAAEV,OAAO,CAACW,kBAAkB;IACxCC,kBAAkB,EAAEZ,OAAO,CAACY,kBAAkB;IAC9CC,uBAAuB,EAAE,CAACb,OAAO,CAACc,wBAAwB;IAC1DC,aAAa,EAAEf,OAAO,CAACe;GAC1B;;EAGD,IAAIb,YAAY,CAACG,oBAAoB,EAAE;IACnCH,YAAY,CAACc,gBAAgB,GAAG,UAAU;;;EAI9C,IAAId,YAAY,CAACC,mBAAmB,EAAE;IAClC,IAAI,CAACJ,KAAK,CAACkB,QAAQ,EAAE;MACjBf,YAAY,CAACgB,SAAS,GAAG;QACrBC,UAAU,EAAEA,CAACC,GAAiB,EAAEC,QAAgB,EAAEC,MAAW,KAAKC,cAAc,CAACH,GAAG,CAACI,QAAQ,CAACH,QAAQ,C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CAAC;EAChD0H,uBAAuB,CAACV,KAAK,EAAElI,KAAK,CAAC6I,WAAW,CAAC;EACjDC,wBAAwB,CAACZ,KAAK,EAAEjF,WAAW,CAAC;EAC5C8F,oBAAoB,CAACb,KAAK,EAAElI,KAAK,CAACgJ,SAAS,CAAC;EAC5CC,wBAAwB,CAACf,KAAK,EAAElI,KAAK,CAACwI,QAAQ,CAAC;EAC/CU,uBAAuB,CAAChB,KAAK,EAAElI,KAAK,CAAC6C,MAAM,CAAC;EAE5C,OAAO;IAAEqF,KAAK;IAAEiB,MAAM,GAAAC,aAAA,GAAEpJ,KAAK,CAACmJ,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAIpJ,KAAK,CAACoI,IAAI,CAACe;GAAQ;AAC/D;;;;"}
|
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} from '../types';\nimport { useCurrentRow } from './features/useCurrentRow';\nimport { usePauseHoverState } from './features/usePauseHoverState';\nimport { useTablePreset } from './useTablePreset';\nimport { useRowHeight } from './features/useRowHeight';\nimport { useFontSize } from './features/useFontSize';\nimport { useRowSelectionListener } from './listeners/useRowSelectionListener';\nimport { useRowDrag } from './features/useRowDrag';\nimport { useSettingsStateListener } from './listeners/useSettingsStateListener';\nimport { columnFilterFn, globalFilterFn } from '../util/filtering';\nimport { useSortingStateListener } from './listeners/useSortingStateListener';\nimport { useFilteringStateListener } from './listeners/useFilteringStateListener';\nimport { useCurrentRowListener } from './listeners/useCurrentRowListener';\nimport { useColumnFreezing } from './features/useColumnFreezing';\nimport { useRowSelection } from './features/useRowSelection';\nimport { useRowClick } from './features/useRowClick';\nimport { ensureOrdering, useColumnOrdering } from './features/useColumnOrdering';\nimport { useRowDrop } from './features/useRowDrop';\nimport { useConvertChildrenToColumns } from './useConvertChildrenToColumns';\nimport { useEditing } from './features/useEditing';\nimport { usePrinting } from './features/usePrinting';\nimport { useShortcutsListener } from './listeners/useShortcutsListener';\nimport { useRowGoto } from './features/useRowGoto';\nimport { useServerLoadingListener } from './listeners/useServerLoadingListener';\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';\n\ndeclare module '@tanstack/table-core' {\n interface TableMeta<TData extends RowData> {\n columnFreezing: ReturnType<typeof useColumnFreezing>;\n columnOrdering: ReturnType<typeof useColumnOrdering>;\n currentRow: ReturnType<typeof useCurrentRow>;\n editing: ReturnType<typeof useEditing>;\n enableFooter: boolean;\n fontSize: ReturnType<typeof useFontSize>;\n hoverState: ReturnType<typeof usePauseHoverState>;\n isPrinting: boolean;\n isUsingServer: boolean;\n printing: ReturnType<typeof usePrinting>;\n rowActions: ReturnType<typeof useRowActions>;\n rowClick: ReturnType<typeof useRowClick>;\n rowDrag: ReturnType<typeof useRowDrag>;\n rowDrop: ReturnType<typeof useRowDrop>;\n rowGoto: ReturnType<typeof useRowGoto>;\n rowHeight: ReturnType<typeof useRowHeight>;\n rowSelection: ReturnType<typeof useRowSelection>;\n search: ReturnType<typeof useSearch>;\n }\n\n interface ColumnMeta<TData extends RowData, TValue> {\n align?: Table3ColumnAlignment;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n className?: Table3ColumnClassNameHandler<TData>;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n control?: Table3ColumnControlRenderer<TData>;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\n dataType?: Table3ColumnDataType;\n // @ts-expect-error -- we ignore it because it conflicts with Table2 also overridding ColumnMeta\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>) {\n // options\n const options = useTablePreset(props);\n\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 const [defaultSettings, setSettings] = useSettings(props.id, props.defaultSettings, props.onChangeSettings);\n\n // custom features\n const columnFreezing = useColumnFreezing(\n // temporarily see if deprecated frozenColumnCount is there\n defaultSettings.columnFreezingIndex ?? (defaultSettings as any)?.frozenColumnCount ?? props.defaultColumnFreezingIndex,\n options\n );\n const columnOrdering = useColumnOrdering(options);\n const currentRow = useCurrentRow(props.defaultCurrentRowIndex);\n const editing = useEditing(options.enableEditing, props.onSave);\n const fontSize = useFontSize(options.enableFontSize, defaultSettings.fontSize);\n const hoverState = usePauseHoverState();\n const printing = usePrinting(options.enablePrinting, props.loadAll, defaultSettings.showWarningWhenPrintingLargeDataset);\n const rowActions = useRowActions<TType>(props.actionsForRow, props.actionsForRowLength);\n const rowClick = useRowClick<TType>(props.onRowClick);\n const rowDrag = useRowDrag(options.enableRowDrag);\n const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);\n const rowGoto = useRowGoto(options.enableRowGoto, props.onRowGoto);\n const rowHeight = useRowHeight(\n options.enableRowHeight,\n // temporarily see if deprecated rowDensity is there\n defaultSettings.rowHeight ?? (defaultSettings as any)?.rowDensity\n );\n const rowSelection = useRowSelection();\n const search = useSearch(options.enableSearch, defaultSettings.excludeUnmatchedRecordsInSearch, 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, defaultSettings.columnOrder),\n columnSizing: defaultSettings.columnSizing ?? defaultColumnSizing,\n columnVisibility: defaultSettings.columnVisibility ?? defaultColumnVisibility,\n sorting: defaultSettings.sorting ? defaultSettings.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 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 currentRow,\n editing,\n enableFooter: options.enableFooter,\n fontSize,\n hoverState,\n isPrinting: props.id.endsWith('_print'),\n isUsingServer: !!props.loadPage,\n printing,\n rowActions: rowActions as any,\n rowClick: rowClick as any,\n rowDrag,\n rowDrop,\n rowGoto,\n rowHeight,\n rowSelection,\n search,\n },\n });\n\n // listeners\n useCurrentRowListener(table);\n useEditingStateListener(table);\n useFilteringStateListener(table, props.onFilter);\n useRowSelectionListener(table, props.onRowSelect);\n useSettingsStateListener(table, setSettings);\n useShortcutsListener(table, props.shortcuts);\n useServerLoadingListener(table, props.loadPage);\n useSortingStateListener(table, props.onSort);\n\n return { table, length: props.length ?? props.data.length };\n}\n"],"names":["useTable","props","options","useTablePreset","tableOptions","enableColumnFilters","enableFiltering","enableColumnResizing","enableExpanding","enableRowExpansion","enableGlobalFilter","enableSearch","enableHiding","enableColumnHiding","enableRowSelection","enableMultiRowSelection","enableRowSelectionSingle","enableSorting","columnResizeMode","onFilter","filterFns","tacoFilter","row","columnId","filter","columnFilterFn","getValue","getFilteredRowModel","globalFilterFn","searchQuery","original","cell","getAllCells","find","column","id","columnMeta","columnDef","meta","getIsVisible","cellValue","getCellValueAsString","dataType","undefined","getColumnCanGlobalFilter","_column$columnDef$met","onSort","manualSorting","getSortedRowModel","defaultSettings","setSettings","useSettings","onChangeSettings","columnFreezing","useColumnFreezing","_ref","_defaultSettings$colu","columnFreezingIndex","frozenColumnCount","defaultColumnFreezingIndex","columnOrdering","useColumnOrdering","currentRow","useCurrentRow","defaultCurrentRowIndex","editing","useEditing","enableEditing","onSave","fontSize","useFontSize","enableFontSize","hoverState","usePauseHoverState","printing","usePrinting","enablePrinting","loadAll","showWarningWhenPrintingLargeDataset","rowActions","useRowActions","actionsForRow","actionsForRowLength","rowClick","useRowClick","onRowClick","rowDrag","useRowDrag","enableRowDrag","rowDrop","useRowDrop","enableRowDrop","onRowDrop","rowGoto","useRowGoto","enableRowGoto","onRowGoto","rowHeight","useRowHeight","enableRowHeight","_defaultSettings$rowH","rowDensity","rowSelection","useRowSelection","search","useSearch","excludeUnmatchedRecordsInSearch","columns","defaultColumnSizing","defaultColumnVisibility","defaultSorting","useConvertChildrenToColumns","initialState","React","useMemo","sanitizeSortedColumns","definedColumn","state","columnOrder","ensureOrdering","columnSizing","_defaultSettings$colu2","columnVisibility","_defaultSettings$colu3","sorting","_props$defaultSetting","columnFilters","_props$defaultSetting2","_props$defaultSetting3","globalFilter","_props$defaultSetting4","table","useReactTable","data","getCoreRowModel","enableFooter","isPrinting","endsWith","isUsingServer","loadPage","useCurrentRowListener","useEditingStateListener","useFilteringStateListener","useRowSelectionListener","onRowSelect","useSettingsStateListener","useShortcutsListener","shortcuts","useServerLoadingListener","useSortingStateListener","length","_props$length"],"mappings":";;;;;;;;;;;;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A,GAAEtJ,KAAK,CAACqJ,MAAM,cAAAC,aAAA,cAAAA,aAAA,GAAItJ,KAAK,CAACoI,IAAI,CAACiB;GAAQ;AAC/D;;;;"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../../../../../../src/components/Table3/types.ts"],"sourcesContent":["import {\n ColumnFilter as RTColumnFilter,\n ColumnOrderState,\n ColumnSizingState,\n ColumnSort as RTTableColumnSort,\n SortingState,\n VisibilityState,\n BuiltInSortingFn,\n} from '@tanstack/react-table';\nimport { MenuProps } from '../Menu/Menu';\n\nexport type Table3SortDirection = 'asc' | 'desc';\nexport type Table3SortFn<TType = unknown> =\n | ((rowA: TType, rowB: TType, columnId: string) => -1 | 0 | 1)\n | BuiltInSortingFn\n | 'auto';\n\n// columns\nexport type Table3ColumnRenderer<TValue = unknown, TType = unknown> = (\n value: TValue,\n row: TType\n) => JSX.Element | string | number | null;\nexport type Table3ColumnFooterRenderer<TValue = unknown> = (values: TValue[]) => JSX.Element | string | number | null;\nexport type Table3ColumnClassNameHandler<TType = unknown> = string | ((row: TType) => string | undefined);\nexport type Table3ColumnAlignment = 'left' | 'center' | 'right';\nexport type Table3ColumnDataType = 'auto' | 'number' | 'alphanumeric' | 'alphanumericCaseSensitive' | 'datetime' | 'boolean';\nexport type Table3ColumnHeaderMenu = (props: Partial<MenuProps>) => JSX.Element;\n\nexport type Table3ColumnControlProps = {\n className?: string;\n disabled?: boolean;\n invalid?: boolean;\n onBlur?: (value: any) => void;\n onFocus?: React.FocusEventHandler;\n readOnly?: boolean;\n ref: React.RefObject<HTMLElement>;\n setValue: (value: any) => void;\n value: any;\n};\nexport type Table3ColumnControlRenderer<TType = unknown> =\n | ((props: Table3ColumnControlProps, row?: TType) => JSX.Element)\n | 'datepicker'\n | 'input'\n | 'switch'\n | 'textarea';\n\ntype ValueOf<T> = T[keyof T];\n\nexport type Table3ColumnProps<TType = unknown> = ValueOf<{\n [K in keyof TType]: {\n accessor: K;\n } & {\n align?: Table3ColumnAlignment;\n className?: Table3ColumnClassNameHandler<TType>;\n control?: Table3ColumnControlRenderer<TType>;\n dataType?: Table3ColumnDataType;\n defaultHidden?: boolean;\n defaultWidth?: number | 'grow';\n enableFiltering?: boolean;\n enableHiding?: boolean;\n enableOrdering?: boolean;\n enableResizing?: boolean;\n enableSearch?: boolean;\n enableSorting?: boolean;\n enableTruncate?: boolean;\n filters?: Table3FilterComparator[];\n footer?: Table3ColumnFooterRenderer;\n header: string;\n headerClassName?: string;\n menu?: Table3ColumnHeaderMenu;\n minWidth?: number;\n renderer?: Table3ColumnRenderer<TType[K], TType>;\n sort?: Table3SortDirection;\n sortFn?: Table3SortFn<TType>;\n tooltip?: string;\n };\n}>;\n\n// rows\nexport type DeprecatedRowDensity = 'compact' | 'normal' | 'comfortable' | 'spacious';\nexport type Table3RowHeight = 'short' | 'medium' | 'tall' | 'extra-tall';\nexport type Table3FontSize = 'small' | 'medium' | 'large';\nexport type Table3RowClickHandler<TType = unknown> = (row: TType) => void;\nexport type Table3RowDragHandler<TType = unknown> = (\n rows: TType[],\n showPlaceholder: (string) => void,\n setDataTransfer: (data: string) => void\n) => void;\nexport type Table3RowDropHandler<TType = any> = (event: React.DragEvent, row: TType) => void;\nexport type Table3RowExpansionRenderer<TType = unknown> = (row: TType) => (() => JSX.Element) | null;\nexport type Table3RowSelectionHandler<TType = unknown> = (rows: TType[]) => void;\nexport type Table3RowActionRenderer<TType = unknown> = (row: TType) => JSX.Element | null;\n\n// table\nexport type Table3Preset = 'display' | 'editable';\nexport type Table3Settings = {\n columnFreezingIndex?: number;\n columnOrder?: ColumnOrderState;\n columnSizing?: ColumnSizingState;\n columnVisibility?: VisibilityState;\n excludeUnmatchedRecordsInSearch?: boolean;\n fontSize?: Table3FontSize;\n rowHeight?: Table3RowHeight;\n showWarningWhenPrintingLargeDataset?: boolean;\n sorting?: SortingState;\n};\nexport type Table3SettingsHandler = (settings: Table3Settings) => void | Promise<void>;\n\nexport enum Table3FilterComparator {\n Contains,\n DoesNotContain,\n IsEqualTo,\n IsNotEqualTo,\n IsGreaterThan,\n IsLessThan,\n IsBetween,\n IsEmpty,\n IsNotEmpty,\n IsLessThanOrEqualTo,\n IsGreaterThanOrEqualTo,\n HasAnyOf,\n HasAllOf,\n HasNoneOf,\n}\n\nexport type Table3FilterValue = {\n comparator: Table3FilterComparator;\n value: any;\n};\n\nexport type Table3Filter = { id: string; value: Table3FilterValue };\n\nexport type ColumnFilter = RTColumnFilter;\nexport type Table3FilterHandler = (filters: ColumnFilter[]) => void;\nexport type Table3LoadPageHandler = (\n pageIndex: number,\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type Table3LoadAllHandler = (\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type Table3RowGotoHandler = (\n column: string,\n query: string,\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<number>;\nexport type Table3ColumnSort = RTTableColumnSort;\nexport type Table3SortHandler = (sorting: Table3ColumnSort[]) => void;\nexport type TableStrategy = {\n renderBody: () => JSX.Element | JSX.Element[] | null;\n scrollToIndex: (index: number, options?: { align: 'start' | 'center' | 'end' | 'auto' }) => void;\n};\nexport type Table3ShortcutHandlerFn<TType = unknown> = (row: TType) => void;\nexport type Table3ShortcutHandlerObject<TType = unknown> = {\n handler: Table3ShortcutHandlerFn<TType>;\n meta?: boolean;\n shift?: boolean;\n};\nexport type Table3Shortcuts<TType = unknown> = Record<\n string,\n Table3ShortcutHandlerFn<TType> | Table3ShortcutHandlerObject<TType>\n>;\nexport type Table3SaveHandler<TType = unknown> = (data: TType) => Promise<void>;\n\nexport type Table3Options = {\n enableColumnFreezing: boolean;\n enableColumnHiding: boolean;\n enableColumnOrdering: boolean;\n enableColumnResizing: boolean;\n enableFontSize: boolean;\n enableFooter: boolean;\n enablePrinting: boolean;\n enableRowDrag: boolean;\n enableRowDrop: boolean;\n enableRowExpansion: boolean;\n enableRowGoto: boolean;\n enableRowHeight: boolean;\n enableRowSelection: boolean;\n enableRowSelectionSingle: boolean;\n enableEditing: boolean;\n enableFiltering: boolean;\n enableSearch: boolean;\n enableSorting: boolean;\n};\n\nexport type Table3CommonProps<TType = unknown> = Partial<Table3Options> & {\n actionsForRow?: Table3RowActionRenderer<TType>[];\n actionsForRowLength?: number;\n autoFocus?: boolean;\n children: (JSX.Element | boolean | null | undefined)[];\n data: TType[];\n defaultColumnFreezingIndex?: number;\n defaultCurrentRowIndex?: number;\n defaultSettings?: Table3Settings;\n emptyState?: () => JSX.Element | null;\n expandedRowRenderer?: Table3RowExpansionRenderer<TType>;\n id: string;\n onChangeSettings?: Table3SettingsHandler;\n onRowClick?: Table3RowClickHandler<TType>;\n onRowDrag?: Table3RowDragHandler<TType>;\n onRowDrop?: Table3RowDropHandler<TType>;\n onRowGoto?: Table3RowGotoHandler;\n onRowSelect?: Table3RowSelectionHandler<TType>;\n onFilter?: Table3FilterHandler;\n onSave?: Table3SaveHandler<TType>;\n onSort?: Table3SortHandler;\n preset?: Table3Preset;\n shortcuts?: Table3Shortcuts<TType>;\n toolbarLeft?: JSX.Element;\n toolbarRight?: JSX.Element;\n};\n\ninterface Table3ClientProps<TType = unknown> extends Table3CommonProps<TType> {\n length?: never;\n loadPage?: never;\n loadAll?: never;\n pageSize?: never;\n}\n\ninterface Table3ServerProps<TType = unknown> extends Table3CommonProps<TType> {\n length: number | undefined;\n loadPage: Table3LoadPageHandler;\n loadAll: Table3LoadAllHandler;\n pageSize?: number;\n}\n\nexport type Table3Props<TType = unknown> = Table3ClientProps<TType> | Table3ServerProps<TType>;\n\nexport type Table3Ref = HTMLDivElement & {\n instance: {\n resetFiltering: () => void;\n resetRowExpansion: () => void;\n resetRowSelection: () => void;\n resetSorting: () => void;\n toggleEditing: (enabled: boolean | undefined) => void;\n };\n};\n\nexport type Table3Texts = {\n columns: {\n actions: {\n tooltip: string;\n };\n drag: {\n tooltip: string;\n };\n expansion: {\n collapse: string;\n collapseAll: string;\n expand: string;\n expandAll: string;\n };\n menu: {\n freezeFirstColumn: string;\n freezeUptoColumn: string;\n gotoRow: string;\n hideColumn: string;\n unfreezeColumns: string;\n };\n resize: {\n tooltip: string;\n };\n select: {\n deselect: string;\n deselectAll: string;\n select: string;\n selectAll: string;\n };\n };\n columnSettings: {\n button: string;\n noResults: string;\n search: string;\n tooltip: string;\n };\n editing: {\n actions: {\n tooltip: string;\n save: string;\n clear: string;\n exit: string;\n };\n buttons: {\n edit: {\n text: string;\n tooltip: string;\n };\n };\n rowIndicator: {\n rowWillMove: string;\n rowWillBeHidden: string;\n rowWillMoveReasonSearch: string;\n rowWillMoveReasonFilter: string;\n rowWillMoveReasonSorting: string;\n };\n saving: {\n progress: string;\n complete: string;\n };\n };\n filters: {\n button: string;\n buttons: {\n addFilter: string;\n clearFilters: string;\n };\n comparators: {\n contains: string;\n doesNotContain: string;\n isEqualTo: string;\n isNotEqualTo: string;\n isGreaterThan: string;\n isLessThan: string;\n isBetween: string;\n isEmpty: string;\n isNotEmpty: string;\n isBefore: string;\n isAfter: string;\n isLessThanOrEqualTo: string;\n isGreaterThanOrEqualTo: string;\n isOnOrBefore: string;\n isOnOrAfter: string;\n hasAnyOf: string;\n hasAllOf: string;\n hasNoneOf: string;\n };\n conditions: {\n and: string;\n where: string;\n };\n emptyFilter: {\n condition: string;\n value: string;\n };\n tooltip: string;\n total: string;\n };\n fontSize: {\n tooltip: string;\n sizes: {\n small: string;\n medium: string;\n large: string;\n };\n };\n footer: {\n summary: {\n count: string;\n records: string;\n selected: string;\n };\n };\n print: {\n error: string;\n loading: string;\n tooltip: string;\n warningDialog: {\n title: string;\n description: string;\n checkboxVisibilityLabel: string;\n cancelButtonText: string;\n printButtonText: string;\n };\n };\n rowHeight: {\n tooltip: string;\n sizes: {\n short: string;\n medium: string;\n tall: string;\n extraTall: string;\n };\n };\n search: {\n excludeUnmatchedResults: string;\n placeholder: string;\n };\n otherOptions: {\n tooltip: string;\n };\n};\n"],"names":["Table3FilterComparator"],"mappings":"IA4GYA;AAAZ,WAAYA,sBAAsB;EAC9BA,2EAAQ;EACRA,uFAAc;EACdA,6EAAS;EACTA,mFAAY;EACZA,qFAAa;EACbA,+EAAU;EACVA,6EAAS;EACTA,yEAAO;EACPA,+EAAU;EACVA,iGAAmB;EACnBA,wGAAsB;EACtBA,4EAAQ;EACRA,4EAAQ;EACRA,8EAAS;AACb,CAAC,EAfWA,sBAAsB,KAAtBA,sBAAsB;;;;"}
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../../../../../src/components/Table3/types.ts"],"sourcesContent":["import {\n ColumnFilter as RTColumnFilter,\n ColumnOrderState,\n ColumnSizingState,\n ColumnSort as RTTableColumnSort,\n SortingState,\n VisibilityState,\n BuiltInSortingFn,\n} from '@tanstack/react-table';\nimport { MenuProps } from '../Menu/Menu';\n\nexport type Table3SortDirection = 'asc' | 'desc';\nexport type Table3SortFn<TType = unknown> =\n | ((rowA: TType, rowB: TType, columnId: string) => -1 | 0 | 1)\n | BuiltInSortingFn\n | 'auto';\n\n// columns\nexport type Table3ColumnRenderer<TValue = unknown, TType = unknown> = (\n value: TValue,\n row: TType\n) => JSX.Element | string | number | null;\nexport type Table3ColumnFooterRenderer<TValue = unknown> = (values: TValue[]) => JSX.Element | string | number | null;\nexport type Table3ColumnClassNameHandler<TType = unknown> = string | ((row: TType) => string | undefined);\nexport type Table3ColumnAlignment = 'left' | 'center' | 'right';\nexport type Table3ColumnDataType = 'auto' | 'number' | 'alphanumeric' | 'alphanumericCaseSensitive' | 'datetime' | 'boolean';\nexport type Table3ColumnHeaderMenu = (props: Partial<MenuProps>) => JSX.Element;\n\nexport type Table3ColumnControlProps = {\n className?: string;\n disabled?: boolean;\n invalid?: boolean;\n onBlur?: (value: any) => void;\n onFocus?: React.FocusEventHandler;\n readOnly?: boolean;\n ref: React.RefObject<HTMLElement>;\n setValue: (value: any) => void;\n value: any;\n};\nexport type Table3ColumnControlRenderer<TType = unknown> =\n | ((props: Table3ColumnControlProps, row?: TType) => JSX.Element)\n | 'datepicker'\n | 'input'\n | 'switch'\n | 'textarea';\n\ntype ValueOf<T> = T[keyof T];\n\nexport type Table3ColumnProps<TType = unknown> = ValueOf<{\n [K in keyof TType]: {\n accessor: K;\n } & {\n align?: Table3ColumnAlignment;\n className?: Table3ColumnClassNameHandler<TType>;\n control?: Table3ColumnControlRenderer<TType>;\n dataType?: Table3ColumnDataType;\n defaultHidden?: boolean;\n defaultWidth?: number | 'grow';\n enableFiltering?: boolean;\n enableHiding?: boolean;\n enableOrdering?: boolean;\n enablePrinting?: boolean;\n enableResizing?: boolean;\n enableSearch?: boolean;\n enableSorting?: boolean;\n enableTruncate?: boolean;\n filters?: Table3FilterComparator[];\n footer?: Table3ColumnFooterRenderer;\n header: string;\n headerClassName?: string;\n menu?: Table3ColumnHeaderMenu;\n minWidth?: number;\n renderer?: Table3ColumnRenderer<TType[K], TType>;\n sort?: Table3SortDirection;\n sortFn?: Table3SortFn<TType>;\n tooltip?: string;\n };\n}>;\n\n// rows\nexport type DeprecatedRowDensity = 'compact' | 'normal' | 'comfortable' | 'spacious';\nexport type Table3RowHeight = 'short' | 'medium' | 'tall' | 'extra-tall';\nexport type Table3FontSize = 'small' | 'medium' | 'large';\nexport type Table3RowClickHandler<TType = unknown> = (row: TType) => void;\nexport type Table3RowDragHandler<TType = unknown> = (\n rows: TType[],\n showPlaceholder: (string) => void,\n setDataTransfer: (data: string) => void\n) => void;\nexport type Table3RowDropHandler<TType = any> = (event: React.DragEvent, row: TType) => void;\nexport type Table3RowExpansionRenderer<TType = unknown> = (row: TType) => (() => JSX.Element) | null;\nexport type Table3RowSelectionHandler<TType = unknown> = (rows: TType[]) => void;\nexport type Table3RowActionRenderer<TType = unknown> = (row: TType) => JSX.Element | null;\n\n// table\nexport type Table3Preset = 'display' | 'editable';\nexport type Table3Settings = {\n columnFreezingIndex?: number;\n columnOrder?: ColumnOrderState;\n columnSizing?: ColumnSizingState;\n columnVisibility?: VisibilityState;\n excludeUnmatchedRecordsInSearch?: boolean;\n fontSize?: Table3FontSize;\n rowHeight?: Table3RowHeight;\n showWarningWhenPrintingLargeDataset?: boolean;\n sorting?: SortingState;\n};\nexport type Table3SettingsHandler = (settings: Table3Settings) => void | Promise<void>;\n\nexport enum Table3FilterComparator {\n Contains,\n DoesNotContain,\n IsEqualTo,\n IsNotEqualTo,\n IsGreaterThan,\n IsLessThan,\n IsBetween,\n IsEmpty,\n IsNotEmpty,\n IsLessThanOrEqualTo,\n IsGreaterThanOrEqualTo,\n HasAnyOf,\n HasAllOf,\n HasNoneOf,\n}\n\nexport type Table3FilterValue = {\n comparator: Table3FilterComparator;\n value: any;\n};\n\nexport type Table3Filter = { id: string; value: Table3FilterValue };\n\nexport type ColumnFilter = RTColumnFilter;\nexport type Table3FilterHandler = (filters: ColumnFilter[]) => void;\nexport type Table3LoadPageHandler = (\n pageIndex: number,\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type Table3LoadAllHandler = (\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<void>;\nexport type Table3RowGotoHandler = (\n column: string,\n query: string,\n sorting: Table3ColumnSort[],\n filters: ColumnFilter[],\n search: string | undefined\n) => Promise<number>;\nexport type Table3ColumnSort = RTTableColumnSort;\nexport type Table3SortHandler = (sorting: Table3ColumnSort[]) => void;\nexport type TableStrategy = {\n renderBody: () => JSX.Element | JSX.Element[] | null;\n scrollToIndex: (index: number, options?: { align: 'start' | 'center' | 'end' | 'auto' }) => void;\n};\nexport type Table3ShortcutHandlerFn<TType = unknown> = (row: TType) => void;\nexport type Table3ShortcutHandlerObject<TType = unknown> = {\n handler: Table3ShortcutHandlerFn<TType>;\n meta?: boolean;\n shift?: boolean;\n};\nexport type Table3Shortcuts<TType = unknown> = Record<\n string,\n Table3ShortcutHandlerFn<TType> | Table3ShortcutHandlerObject<TType>\n>;\nexport type Table3SaveHandler<TType = unknown> = (data: TType) => Promise<void>;\n\nexport type Table3Options = {\n enableColumnFreezing: boolean;\n enableColumnHiding: boolean;\n enableColumnOrdering: boolean;\n enableColumnResizing: boolean;\n enableFontSize: boolean;\n enableFooter: boolean;\n enablePrinting: boolean;\n enableRowDrag: boolean;\n enableRowDrop: boolean;\n enableRowExpansion: boolean;\n enableRowGoto: boolean;\n enableRowHeight: boolean;\n enableRowSelection: boolean;\n enableRowSelectionSingle: boolean;\n enableEditing: boolean;\n enableFiltering: boolean;\n enableSearch: boolean;\n enableSorting: boolean;\n};\n\nexport type Table3CommonProps<TType = unknown> = Partial<Table3Options> & {\n actionsForRow?: Table3RowActionRenderer<TType>[];\n actionsForRowLength?: number;\n autoFocus?: boolean;\n children: (JSX.Element | boolean | null | undefined)[];\n data: TType[];\n defaultColumnFreezingIndex?: number;\n defaultCurrentRowIndex?: number;\n defaultSettings?: Table3Settings;\n emptyState?: () => JSX.Element | null;\n expandedRowRenderer?: Table3RowExpansionRenderer<TType>;\n id: string;\n onChangeSettings?: Table3SettingsHandler;\n onRowClick?: Table3RowClickHandler<TType>;\n onRowDrag?: Table3RowDragHandler<TType>;\n onRowDrop?: Table3RowDropHandler<TType>;\n onRowGoto?: Table3RowGotoHandler;\n onRowSelect?: Table3RowSelectionHandler<TType>;\n onFilter?: Table3FilterHandler;\n onSave?: Table3SaveHandler<TType>;\n onSort?: Table3SortHandler;\n preset?: Table3Preset;\n shortcuts?: Table3Shortcuts<TType>;\n toolbarLeft?: JSX.Element;\n toolbarRight?: JSX.Element;\n};\n\ninterface Table3ClientProps<TType = unknown> extends Table3CommonProps<TType> {\n length?: never;\n loadPage?: never;\n loadAll?: never;\n pageSize?: never;\n}\n\ninterface Table3ServerProps<TType = unknown> extends Table3CommonProps<TType> {\n length: number | undefined;\n loadPage: Table3LoadPageHandler;\n loadAll: Table3LoadAllHandler;\n pageSize?: number;\n}\n\nexport type Table3Props<TType = unknown> = Table3ClientProps<TType> | Table3ServerProps<TType>;\n\nexport type Table3Ref = HTMLDivElement & {\n instance: {\n resetFiltering: () => void;\n resetRowExpansion: () => void;\n resetRowSelection: () => void;\n resetSorting: () => void;\n toggleEditing: (enabled: boolean | undefined) => void;\n };\n};\n\nexport type Table3Texts = {\n columns: {\n actions: {\n tooltip: string;\n };\n drag: {\n tooltip: string;\n };\n expansion: {\n collapse: string;\n collapseAll: string;\n expand: string;\n expandAll: string;\n };\n menu: {\n freezeFirstColumn: string;\n freezeUptoColumn: string;\n gotoRow: string;\n hideColumn: string;\n unfreezeColumns: string;\n sorting: string;\n sortingOrder: {\n ascending: string;\n descending: string;\n unsorted: string;\n };\n };\n resize: {\n tooltip: string;\n };\n select: {\n deselect: string;\n deselectAll: string;\n select: string;\n selectAll: string;\n };\n };\n columnSettings: {\n button: string;\n noResults: string;\n search: string;\n tooltip: string;\n };\n editing: {\n actions: {\n tooltip: string;\n save: string;\n clear: string;\n exit: string;\n };\n buttons: {\n edit: {\n text: string;\n tooltip: string;\n };\n };\n rowIndicator: {\n rowWillMove: string;\n rowWillBeHidden: string;\n rowWillMoveReasonSearch: string;\n rowWillMoveReasonFilter: string;\n rowWillMoveReasonSorting: string;\n };\n saving: {\n progress: string;\n complete: string;\n };\n };\n filters: {\n button: string;\n buttons: {\n addFilter: string;\n clearFilters: string;\n };\n comparators: {\n contains: string;\n doesNotContain: string;\n isEqualTo: string;\n isNotEqualTo: string;\n isGreaterThan: string;\n isLessThan: string;\n isBetween: string;\n isEmpty: string;\n isNotEmpty: string;\n isBefore: string;\n isAfter: string;\n isLessThanOrEqualTo: string;\n isGreaterThanOrEqualTo: string;\n isOnOrBefore: string;\n isOnOrAfter: string;\n hasAnyOf: string;\n hasAllOf: string;\n hasNoneOf: string;\n };\n conditions: {\n and: string;\n where: string;\n };\n emptyFilter: {\n condition: string;\n value: string;\n };\n tooltip: string;\n total: string;\n };\n fontSize: {\n tooltip: string;\n sizes: {\n small: string;\n medium: string;\n large: string;\n };\n };\n footer: {\n summary: {\n count: string;\n records: string;\n selected: string;\n };\n };\n print: {\n error: string;\n loading: string;\n tooltip: string;\n warningDialog: {\n title: string;\n description: string;\n checkboxVisibilityLabel: string;\n cancelButtonText: string;\n printButtonText: string;\n };\n };\n rowHeight: {\n tooltip: string;\n sizes: {\n short: string;\n medium: string;\n tall: string;\n extraTall: string;\n };\n };\n search: {\n excludeUnmatchedResults: string;\n placeholder: string;\n };\n otherOptions: {\n tooltip: string;\n };\n};\n"],"names":["Table3FilterComparator"],"mappings":"IA6GYA;AAAZ,WAAYA,sBAAsB;EAC9BA,2EAAQ;EACRA,uFAAc;EACdA,6EAAS;EACTA,mFAAY;EACZA,qFAAa;EACbA,+EAAU;EACVA,6EAAS;EACTA,yEAAO;EACPA,+EAAU;EACVA,iGAAmB;EACnBA,wGAAsB;EACtBA,4EAAQ;EACRA,4EAAQ;EACRA,8EAAS;AACb,CAAC,EAfWA,sBAAsB,KAAtBA,sBAAsB;;;;"}
|
package/dist/index.css
CHANGED
@@ -647,7 +647,7 @@
|
|
647
647
|
|
648
648
|
[role='cell']:not([data-highlighted='true']),
|
649
649
|
[role='columnheader'] {
|
650
|
-
@apply flex
|
650
|
+
@apply flex;
|
651
651
|
}
|
652
652
|
|
653
653
|
/* In cases where row height might differ from default one (example: textarea without truncate or changing of font size or row height),
|
@@ -696,13 +696,20 @@
|
|
696
696
|
@apply bg-grey-100;
|
697
697
|
}
|
698
698
|
[role='row']:not([data-selected='true']):not([data-error='true'])[data-current='true'] [role='cell'] {
|
699
|
-
--table3-row-actions-shadow: theme(colors.grey.
|
700
|
-
@apply bg-grey-
|
699
|
+
--table3-row-actions-shadow: theme(colors.grey.100);
|
700
|
+
@apply bg-grey-100;
|
701
701
|
}
|
702
702
|
[role='row']:not([data-selected='true']):not([data-error='true'])[data-current='true']:hover [role='cell'] {
|
703
703
|
--table3-row-actions-shadow: theme(colors.grey.100);
|
704
704
|
@apply bg-grey-100;
|
705
705
|
}
|
706
|
+
/* normal rows when focus is inside the table */
|
707
|
+
[data-taco='table2']:focus-within
|
708
|
+
[role='row'][data-current='true']:not([data-selected='true']):not([data-error='true'])
|
709
|
+
[role='cell'] {
|
710
|
+
--table3-row-actions-shadow: theme(colors.grey.200);
|
711
|
+
@apply bg-grey-200;
|
712
|
+
}
|
706
713
|
/* normal rows when hover is paused */
|
707
714
|
[data-pause-hover='true'] [role='row']:not([data-selected='true']):not([data-error='true']):hover:not([data-current='true']) [role='cell'] {
|
708
715
|
--table3-row-actions-shadow: theme(colors.white);
|
@@ -721,14 +728,17 @@
|
|
721
728
|
--table3-row-actions-shadow: #d6e3f6;
|
722
729
|
@apply bg-[#D6E3F6];
|
723
730
|
}
|
724
|
-
[role='row'][data-selected='true']:not([data-error='true'])[data-current='true'] [role='cell']
|
725
|
-
|
726
|
-
|
727
|
-
}
|
728
|
-
[role='row'][data-selected='true']:not([data-error='true'])[data-current='true']:hover [role='cell'] {
|
731
|
+
[role='row'][data-selected='true']:not([data-error='true'])[data-current='true']:hover [role='cell'],
|
732
|
+
|
733
|
+
[role='row'][data-selected='true']:not([data-error='true'])[data-current='true'] [role='cell'] {
|
729
734
|
--table3-row-actions-shadow: #d6e3f6;
|
730
735
|
@apply bg-[#D6E3F6];
|
731
736
|
}
|
737
|
+
/* selected rows when focus is inside the table */
|
738
|
+
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-selected='true']:not([data-error='true']) [role='cell'] {
|
739
|
+
--table3-row-actions-shadow: #ccd8eb;
|
740
|
+
@apply bg-[#CCD8EB];
|
741
|
+
}
|
732
742
|
/* selected rows when hover is paused */
|
733
743
|
[data-pause-hover='true'] [role='row'][data-selected='true']:not([data-error='true']):hover:not([data-current='true']) [role='cell'] {
|
734
744
|
--table3-row-actions-shadow: theme(colors.blue.100);
|
@@ -755,6 +765,11 @@
|
|
755
765
|
--table3-row-actions-shadow: #ffe4de;
|
756
766
|
@apply bg-[#FFE4DE];
|
757
767
|
}
|
768
|
+
/* error rows when focus is inside the table */
|
769
|
+
[data-taco='table2']:focus-within [role='row'][data-current='true'][data-error='true'] [role='cell'] {
|
770
|
+
--table3-row-actions-shadow: theme(colors.red.100);
|
771
|
+
@apply bg-red-100;
|
772
|
+
}
|
758
773
|
/* error rows when hover is paused */
|
759
774
|
[data-pause-hover='true'] [role='row'][data-error='true']:hover:not([data-current='true']) [role='cell'] {
|
760
775
|
--table3-row-actions-shadow: #ffede9;
|
@@ -777,17 +792,27 @@
|
|
777
792
|
/* cell component overrides */
|
778
793
|
|
779
794
|
/* small font size */
|
795
|
+
[data-font-size='small'] [role='cell'] > [data-taco='button'],
|
796
|
+
[data-font-size='small'] [role='cell'] > [data-taco='icon-button'] {
|
797
|
+
@apply !-my-2;
|
798
|
+
}
|
799
|
+
|
800
|
+
[data-font-size='small'] [role='cell'] > [data-taco='icon'] {
|
801
|
+
@apply !-my-[3px];
|
802
|
+
}
|
803
|
+
|
780
804
|
[data-font-size='small'] [role='cell'] [data-taco='badge'],
|
781
|
-
[data-font-size='small'] [role='cell'] [data-taco='badge-icon']
|
782
|
-
[data-font-size='small'] [role='cell'] [data-taco='icon'] {
|
805
|
+
[data-font-size='small'] [role='cell'] [data-taco='badge-icon'] {
|
783
806
|
@apply !-my-0.5 !text-xs;
|
784
807
|
}
|
785
808
|
|
786
|
-
[data-font-size='small'] [role='cell'] [data-taco='tag']
|
787
|
-
|
809
|
+
[data-font-size='small'] [role='cell'] [data-taco='tag'] {
|
810
|
+
@apply !-my-1;
|
811
|
+
}
|
812
|
+
|
788
813
|
[data-font-size='small'] [role='cell'] [data-taco='input-container'],
|
789
814
|
[data-font-size='small'] [role='cell'] [data-taco='Select2'] {
|
790
|
-
@apply !-my-
|
815
|
+
@apply !-my-[3px];
|
791
816
|
}
|
792
817
|
|
793
818
|
[data-font-size='small'] [role='cell'] [data-taco='input'],
|
@@ -816,30 +841,70 @@
|
|
816
841
|
@apply !my-0;
|
817
842
|
}
|
818
843
|
|
844
|
+
[data-font-size='small'] [role='cell'][data-editable] {
|
845
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_7px)];
|
846
|
+
}
|
847
|
+
|
848
|
+
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox'],
|
849
|
+
[data-font-size='small'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
850
|
+
[data-font-size='small'] [role='cell'][data-editable] [data-taco='switch'],
|
851
|
+
[data-font-size='small'] [role='cell'][data-editable] [data-taco='switch-container'] {
|
852
|
+
@apply !mx-[calc(var(--table3-cell-padding-x)_-_1px)] !-mt-px;
|
853
|
+
}
|
854
|
+
|
819
855
|
/* medium font size */
|
856
|
+
[data-font-size='medium'] [role='cell'] > [data-taco='button'],
|
857
|
+
[data-font-size='medium'] [role='cell'] > [data-taco='icon-button'] {
|
858
|
+
@apply !-my-1.5;
|
859
|
+
}
|
860
|
+
|
861
|
+
[data-font-size='medium'] [role='cell'] > [data-taco='icon'] {
|
862
|
+
@apply !-my-0.5;
|
863
|
+
}
|
864
|
+
|
820
865
|
[data-font-size='medium'] [role='cell'] [data-taco='tag'] {
|
821
866
|
@apply !-my-0.5;
|
822
867
|
}
|
823
868
|
|
824
869
|
[data-font-size='medium'] [role='cell'] [data-taco='Select2'],
|
825
870
|
[data-font-size='medium'] [role='cell'] [data-taco='input-container'] {
|
826
|
-
@apply !-my-
|
871
|
+
@apply !-my-[5px];
|
872
|
+
}
|
873
|
+
|
874
|
+
[data-font-size='medium'] [role='cell'][data-editable] {
|
875
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_9px)];
|
876
|
+
}
|
877
|
+
|
878
|
+
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox'],
|
879
|
+
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
880
|
+
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='switch'],
|
881
|
+
[data-font-size='medium'] [role='cell'][data-editable] [data-taco='switch-container'] {
|
882
|
+
@apply !mx-[calc(var(--table3-cell-padding-x)_-_3px)] !mt-px;
|
827
883
|
}
|
828
884
|
|
829
885
|
/* large font size */
|
886
|
+
[data-font-size='large'] [role='cell'] > [data-taco='button'],
|
887
|
+
[data-font-size='large'] [role='cell'] > [data-taco='icon-button'] {
|
888
|
+
@apply !-my-1;
|
889
|
+
}
|
890
|
+
|
891
|
+
[data-font-size='large'] [role='cell'] > [data-taco='icon'] {
|
892
|
+
@apply !-my-0.5;
|
893
|
+
}
|
894
|
+
|
830
895
|
[data-font-size='large'] [role='cell'] [data-taco='tag'] {
|
831
896
|
@apply !-my-0.5;
|
832
897
|
}
|
833
898
|
|
834
899
|
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
835
900
|
[data-font-size='large'] [role='cell'] [data-taco='input-container'] {
|
836
|
-
@apply !-my-
|
901
|
+
@apply !-my-[7.5px];
|
837
902
|
}
|
838
903
|
|
839
904
|
[data-font-size='large'] [role='cell'] [data-taco='input'],
|
840
905
|
[data-font-size='large'] [role='cell'] [data-taco='Select2'],
|
841
906
|
[data-font-size='large'] [role='cell'] [data-taco='textarea'] {
|
842
|
-
@apply h-10 px-2.5 text-
|
907
|
+
@apply h-10 px-2.5 text-base;
|
843
908
|
}
|
844
909
|
|
845
910
|
[data-font-size='large'] [role='cell'] [data-taco='input-container'] [data-affix-type='postfix'] button {
|
@@ -849,3 +914,14 @@
|
|
849
914
|
[data-font-size='large'] [role='cell'] [data-taco='input-container'] [data-affix-type='postfix'] [data-taco='icon'] {
|
850
915
|
@apply !h-6 !w-6;
|
851
916
|
}
|
917
|
+
|
918
|
+
[data-font-size='large'] [role='cell'][data-editable] {
|
919
|
+
@apply px-[calc(var(--table3-cell-padding-x)_-_11px)];
|
920
|
+
}
|
921
|
+
|
922
|
+
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox'],
|
923
|
+
[data-font-size='large'] [role='cell'][data-editable] [data-taco='checkbox-container'],
|
924
|
+
[data-font-size='large'] [role='cell'][data-editable] [data-taco='switch'],
|
925
|
+
[data-font-size='large'] [role='cell'][data-editable] [data-taco='switch-container'] {
|
926
|
+
@apply !mx-[calc(var(--table3-cell-padding-x)_-_5px)] !mt-px;
|
927
|
+
}
|