@vuu-ui/vuu-table 2.1.0-alpha.10 → 2.1.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/Table.js +4 -0
- package/cjs/Table.js.map +1 -1
- package/cjs/header-cell/HeaderCell.css.js +1 -1
- package/cjs/header-cell/HeaderCell.js +4 -10
- package/cjs/header-cell/HeaderCell.js.map +1 -1
- package/cjs/table-header/TableHeader.js +13 -3
- package/cjs/table-header/TableHeader.js.map +1 -1
- package/esm/Table.js +4 -0
- package/esm/Table.js.map +1 -1
- package/esm/header-cell/HeaderCell.css.js +1 -1
- package/esm/header-cell/HeaderCell.js +4 -10
- package/esm/header-cell/HeaderCell.js.map +1 -1
- package/esm/table-header/TableHeader.js +12 -2
- package/esm/table-header/TableHeader.js.map +1 -1
- package/package.json +10 -10
- package/types/Table.d.ts +11 -1
- package/types/table-header/TableHeader.d.ts +3 -1
package/cjs/Table.js
CHANGED
|
@@ -31,6 +31,7 @@ const RowProxy = react.forwardRef(function RowProxy2({ className = "vuuTableRow"
|
|
|
31
31
|
});
|
|
32
32
|
const TableCore = ({
|
|
33
33
|
EmptyDisplay,
|
|
34
|
+
HeaderCell,
|
|
34
35
|
Row: Row$1 = Row.Row,
|
|
35
36
|
allowCellBlockSelection,
|
|
36
37
|
allowDragColumnHeader = true,
|
|
@@ -193,6 +194,7 @@ const TableCore = ({
|
|
|
193
194
|
showColumnHeaders ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
194
195
|
TableHeader.TableHeader,
|
|
195
196
|
{
|
|
197
|
+
HeaderCell,
|
|
196
198
|
allowDragColumnHeader,
|
|
197
199
|
allowSelectAll,
|
|
198
200
|
allRowsSelected,
|
|
@@ -269,6 +271,7 @@ const TableCore = ({
|
|
|
269
271
|
};
|
|
270
272
|
const Table = react.forwardRef(function Table2({
|
|
271
273
|
EmptyDisplay,
|
|
274
|
+
HeaderCell,
|
|
272
275
|
Row,
|
|
273
276
|
allowCellBlockSelection,
|
|
274
277
|
allowDragColumnHeader,
|
|
@@ -403,6 +406,7 @@ const Table = react.forwardRef(function Table2({
|
|
|
403
406
|
TableCore,
|
|
404
407
|
{
|
|
405
408
|
EmptyDisplay,
|
|
409
|
+
HeaderCell,
|
|
406
410
|
Row,
|
|
407
411
|
allowCellBlockSelection,
|
|
408
412
|
allowDragColumnHeader,
|
package/cjs/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../../../packages/vuu-table/src/Table.tsx"],"sourcesContent":["import { useForkRef } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport type { DataSource, SchemaColumn } from \"@vuu-ui/vuu-data-types\";\nimport { TableProvider } from \"@vuu-ui/vuu-table-extras\";\nimport {\n CustomHeader,\n DataCellEditNotification,\n GroupToggleTarget,\n RowActionHandler,\n RowProps,\n SelectionChangeHandler,\n ShowColumnHeaderMenus,\n TableConfig,\n TableConfigChangeHandler,\n TableRowClickHandler,\n TableRowSelectHandler,\n TableSelectionModel,\n} from \"@vuu-ui/vuu-table-types\";\nimport type { DragDropState } from \"@vuu-ui/vuu-ui-controls\";\nimport {\n DragStartHandler,\n MeasuredContainer,\n MeasuredContainerProps,\n MeasuredSize,\n dragStrategy,\n reduceSizeHeight,\n} from \"@vuu-ui/vuu-ui-controls\";\nimport { lowerCase, useId } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n CSSProperties,\n ComponentType,\n FC,\n ForwardedRef,\n RefObject,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Row as DefaultRow } from \"./Row\";\nimport { TableCellBlock } from \"./cell-block/cellblock-utils\";\nimport { PaginationControl } from \"./pagination\";\nimport { TableHeader } from \"./table-header\";\nimport { useMeasuredHeight } from \"./useMeasuredHeight\";\nimport { useTable } from \"./useTable\";\nimport { ScrollingAPI } from \"./useTableScroll\";\n\nimport tableCss from \"./Table.css\";\n\nconst classBase = \"vuuTable\";\n\nexport type TableNavigationStyle = \"none\" | \"cell\" | \"row\" | \"tree\";\n\n// A dummy Table Row rendered once and not visible. We measure this to\n// determine height of Row(s) and monitor it for size changes (in\n// case of runtime density switch). This allows ListItem height to\n// be controlled purely through CSS.\nconst RowProxy = forwardRef<\n HTMLDivElement,\n { className?: string; height?: number }\n>(function RowProxy({ className = \"vuuTableRow\", height }, forwardedRef) {\n return (\n <div\n aria-hidden\n className={cx(className, `vuuRowProxy`)}\n ref={forwardedRef}\n style={{ height }}\n />\n );\n});\n\nexport interface TableProps\n extends Omit<\n MeasuredContainerProps,\n \"onDragStart\" | \"onDrop\" | \"onSelect\" | \"searchPattern\"\n > {\n /**\n * A react function component that will be rendered if there are no rows to display\n */\n EmptyDisplay?: ComponentType;\n Row?: FC<RowProps>;\n /**\n * Allow a block of cells to be selected. Typically to be copied.\n */\n allowCellBlockSelection?: boolean;\n /**\n * Allow column headers to be dragged to re-arrange\n */\n allowDragColumnHeader?: boolean;\n /**\n * Allow rows to be draggable\n */\n allowDragDrop?: boolean | dragStrategy;\n\n /**\n * Allow all rows be selected, use with checkbox coliumn.\n */\n allowSelectAll?: boolean;\n\n /**\n * If checkbox selection is in effect, can user select row by clicking row. If\n * false, checkbox must be clicked explicitly.\n */\n allowSelectCheckboxRow?: boolean;\n /**\n * if provided, first row of table will be selected on initial render.\n */\n autoSelectFirstRow?: true;\n /**\n * if provided, row with matching key will be selected. If not present, will silently fail.\n */\n autoSelectRowKey?: string;\n\n /**\n * Pixel height of header cells. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n colHeaderRowHeight?: number;\n\n /**\n * Provide configuration settings for Table. At minimun, column\n * descriptors must be provided.\n */\n config: TableConfig;\n dataSource: DataSource;\n\n disableFocus?: boolean;\n /**\n * Allows additional custom element(s) to be embedded immediately below column headers.\n * Could be used to present inline filters for example.\n * Accepts either a React Element or a Function Component or an array of these. If a React\n * Function Component is used, it will be passed the props described in BaseRowProps.\n */\n customHeader?: CustomHeader | CustomHeader[];\n /**\n * When rows are grouped, user can click group row(s) to expand/collapse display of child rows.\n * This allows precise configuration of where user may click to trigger toggle/collapse. When\n * row selection is also supported, clicking outside the region specified here will select or\n * deselect the row.\n * - toggle-icon - the small toggle icon must be clicked directly\n * - group-column (default) - user can click anywhere within the group column, i.e on the icon or the column text\n */\n groupToggleTarget?: GroupToggleTarget;\n\n /**\n * Defined how focus navigation within data cells will be handled by table.\n * Default is cell.\n */\n highlightedIndex?: number;\n\n /**\n * Behaves in most respects like viewportRowLimit except that, when there are fewer\n * rows available than the limit set here, the Table height will reduce. This can be\n * useful where a Table is used in a dropdown control.\n */\n maxViewportRowLimit?: number;\n\n /**\n * Determines bahaviour of keyboard navigation , either row focused or cell focused.\n * `tree` is a specialised navigation behaviour only useful where table is being\n * used to present purely grouped data (see TreeTable)\n */\n navigationStyle?: TableNavigationStyle;\n /**\n * required if a fully featured column picker is to be available.\n * Available columns can be changed by the addition or removal of\n * one or more calculated columns.\n */\n onAvailableColumnsChange?: (columns: SchemaColumn[]) => void;\n /**\n * This callback will be invoked any time a config attribute of TableConfig\n * is changed. By persisting this value and providing it to the Table as a\n * prop, table state can be persisted across sessions.\n */\n onConfigChange?: TableConfigChangeHandler;\n\n /**\n * In a Table with editable cells, this callback will be invoked every time\n * a user performs any edit operation on an editable field.\n */\n // TODO can we scrap this and leavr it to the editTracker ?\n onDataEdited?: DataCellEditNotification;\n\n onDragStart?: DragStartHandler;\n onDrop?: (dragDropState: DragDropState) => void;\n\n onHighlight?: (idx: number) => void;\n /**\n * callback invoked when user 'clicks' a table row. CLick triggered either\n * via mouse click or keyboard (default ENTER);\n */\n onRowClick?: TableRowClickHandler;\n onSelect?: TableRowSelectHandler;\n /**\n * Triggered when a block of cells is selected. CellBlock selection can be\n * effected with either mouse or keyboard.\n * - mouse: hold down mouse and drag over selection area\n * - keyboard: press and hold shift key from start cell, then use arrow keys\n * to extend selection block.\n *\n * This callback is invoked when mouse is released or shift key released.\n */\n onSelectCellBlock?: (cellBlock: TableCellBlock) => void;\n\n onSelectionChange?: SelectionChangeHandler;\n renderBufferSize?: number;\n\n /**\n * Provide functionality for custom row actions. e.g. buttons embedded within row cells.\n * These will be available to any custom renderers via TableContext. e.g. a Row may\n * provide a 'Delete' or 'Cancel' button. Implement this functionality in a rowActionHandler.\n */\n rowActionHandlers?: Record<string, RowActionHandler>;\n\n /**\n * Allows opt-in to a predefined style pattern that renders a border around a row selection block.\n */\n rowSelectionBorder?: boolean;\n\n /**\n * Only applicable to grouped data. If there are selected rows which are not top-level\n * items and group items above are not already expanded, expand all group items in\n * the hierarchy above selected item. Selected items will thus always be visible, initially.\n * This affects items set at load time via autoSelectRowKey as well as items\n * selected programatically (ie not directly by user).\n * Nodes can of course be collapsed by user at runtime which may hide selected rows.\n * Note: this is not supported by all DataSource implementations\n */\n revealSelected?: boolean;\n /**\n * Pixel height of rows. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n rowHeight?: number;\n /**\n * imperative API for scrolling table\n */\n scrollingApiRef?: ForwardedRef<ScrollingAPI>;\n\n /**\n * If a search has been applied against data, this is the search text used.\n * Will be used to highlight matching text.\n */\n searchPattern?: string;\n /**\n * Selection behaviour for Table:\n * `none` selection disabled\n * `single` no more than one row may be selected\n * `single-no-deselect` no more than one row may be selected, one row is always selected, defaults to first visible\n * `extended` (default) multiple rows can be selected\n * `checkbox` same behaviour as extended, with checkbox column for selection\n */\n selectionModel?: TableSelectionModel;\n /**\n * if false, table rendered without headers. Useful when table is being included in a\n * composite component.\n */\n showColumnHeaders?: boolean;\n /**\n * if false, column headers will not display menu icon. If true, all available Column Menu\n * actions will be available via the menu. Alternatively, a map of specific column menu\n * permissions can be provided to allow control over which menu items are presented.\n */\n showColumnHeaderMenus?: ShowColumnHeaderMenus;\n /**\n * if true, pagination will be used to navigate data, scrollbars will not be rendered\n */\n showPaginationControls?: boolean;\n\n /**\n * As an alternative to sizing the Table height via CSS or via an explicit height value,\n * specify the number of rows to be displayed within the Viewport. The actual height\n * will then be the product of viewportRowLimit and rowHeight. Row Height will be\n * determined in the usual way, it can be specified explicitly in a prop or set via\n * CSS. If both explicit height and viewportRowLimit are provided by props, rowHeight\n * will be derived from these. Do not pass props for all three values - height,\n * rowHeight and viewportRowLimit. That will be rejected.\n * Use maxViewportRowLimit rather than viewportRowLimit if the height of the table\n * should be reduced when fewer rows are actually available than the limit specified.\n */\n viewportRowLimit?: number;\n}\n\nconst TableCore = ({\n EmptyDisplay,\n Row = DefaultRow,\n allowCellBlockSelection,\n allowDragColumnHeader = true,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n // colHeaderRowHeight,\n config,\n containerRef,\n customHeader,\n dataSource,\n disableFocus = false,\n groupToggleTarget,\n highlightedIndex: highlightedIndexProp,\n id: idProp,\n lowerCaseSearchPattern,\n navigationStyle = \"cell\",\n // onAvailableColumnsChange,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize = 0,\n revealSelected,\n rowActionHandlers,\n rowHeight,\n scrollingApiRef,\n selectionModel = \"extended\",\n showColumnHeaders = true,\n showColumnHeaderMenus = true,\n showPaginationControls,\n size,\n}: Omit<\n TableProps,\n | \"colHeaderRowHeight\"\n | \"maxViewportRowLimit\"\n | \"resizeStrategy\"\n | \"rowHeight\"\n | \"rowSelectionStyle\"\n | \"searchPattern\"\n | \"viewportRowLimit\"\n> & {\n containerRef: RefObject<HTMLDivElement | null>;\n /**\n * We lowercase this once, on entry, which is the format in which it will be used.\n */\n lowerCaseSearchPattern: Lowercase<string>;\n rowHeight: number;\n size: MeasuredSize;\n}) => {\n const id = useId(idProp);\n const {\n allRowsSelected,\n cellBlock,\n columns,\n dataRows,\n draggableRow,\n focusCellPlaceholderKeyDown,\n focusCellPlaceholderRef,\n getRowOffset,\n handleColumnAction,\n headerState: { height: headerHeight, count: headerCount },\n headings,\n highlightedIndex,\n onCheckBoxColumnHeaderClick,\n onDataEdited,\n onHeaderHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onRowClick,\n onSortColumn,\n onToggleGroup,\n rowClassNameGenerator,\n scrollProps,\n tableAttributes,\n tableBodyRef,\n tableConfig,\n viewportMeasurements,\n ...tableProps\n } = useTable({\n allowCellBlockSelection,\n allowDragDrop,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n config,\n containerRef,\n dataSource,\n disableFocus,\n highlightedIndex: highlightedIndexProp,\n id,\n navigationStyle,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n rowHeight,\n scrollingApiRef,\n selectionModel,\n showColumnHeaders,\n showPaginationControls,\n size,\n });\n\n const { selectionBookendWidth = 4 } = config;\n\n const contentContainerClassName = cx(`${classBase}-contentContainer`, {\n [`${classBase}-colLines`]: tableAttributes.columnSeparators,\n [`${classBase}-rowLines`]: tableAttributes.rowSeparators,\n [`${classBase}-zebra`]: tableAttributes.zebraStripes,\n });\n\n const cssScrollbarSize = {\n \"--horizontal-scrollbar-height\": `${viewportMeasurements.horizontalScrollbarHeight}px`,\n \"--vertical-scrollbar-width\": `${viewportMeasurements.verticalScrollbarWidth}px`,\n } as CSSProperties;\n\n const cssVariables = {\n ...cssScrollbarSize,\n \"--content-height\": `${viewportMeasurements.contentHeight}px`,\n \"--content-width\": `${viewportMeasurements.contentWidth}px`,\n \"--pinned-width-left\": `${viewportMeasurements.pinnedWidthLeft}px`,\n \"--pinned-width-right\": `${viewportMeasurements.pinnedWidthRight}px`,\n \"--total-header-height\": `${headerHeight}px`,\n \"--viewport-body-height\": `${viewportMeasurements.viewportBodyHeight}px`,\n \"--table-selection-bookend-width\": `${selectionBookendWidth}px`,\n } as CSSProperties;\n\n const headersReady = showColumnHeaders === false || headerHeight > 0;\n const readyToRenderTableBody = headersReady && dataRows.length > 0;\n\n return (\n <TableProvider\n dataSource={dataSource}\n menuActionHandler={handleColumnAction}\n rowActionHandlers={rowActionHandlers}\n >\n {showPaginationControls !== true ? (\n <div\n className={`${classBase}-scrollbarContainer`}\n ref={scrollProps.scrollbarContainerRef}\n style={cssVariables}\n tabIndex={-1}\n >\n <div className={`${classBase}-scrollbarContent`} />\n </div>\n ) : null}\n\n {dataSource.size === 0 && EmptyDisplay ? (\n <div className={`${classBase}-emptyDisplay`}>\n <EmptyDisplay />{\" \"}\n </div>\n ) : null}\n\n <div\n className={contentContainerClassName}\n ref={scrollProps.contentContainerRef}\n style={cssVariables}\n >\n <div\n {...tableProps}\n className={`${classBase}-table`}\n role=\"table\"\n tabIndex={disableFocus ? undefined : -1}\n >\n {showColumnHeaders ? (\n <TableHeader\n allowDragColumnHeader={allowDragColumnHeader}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n // columns={scrollProps.columnsWithinViewport}\n columns={columns}\n customHeader={customHeader}\n headings={headings}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onHeightMeasured={onHeaderHeightMeasured}\n onMoveColumn={onMoveColumn}\n onMoveGroupColumn={onMoveGroupColumn}\n onRemoveGroupColumn={onRemoveGroupColumn}\n onResizeColumn={onResizeColumn}\n onSortColumn={onSortColumn}\n showBookends={selectionBookendWidth > 0}\n showColumnHeaderMenus={showColumnHeaderMenus}\n tableConfig={tableConfig}\n tableId={id}\n virtualColSpan={scrollProps.virtualColSpan}\n />\n ) : null}\n {readyToRenderTableBody ? (\n <div className={`${classBase}-body`} ref={tableBodyRef}>\n {dataRows.map((dataRow) => {\n const ariaRowIndex = dataRow.index + headerCount + 1;\n return (\n <Row\n aria-rowindex={ariaRowIndex}\n classNameGenerator={rowClassNameGenerator}\n columns={scrollProps.columnsWithinViewport}\n // This is used for styling selection only.\n data-first-row={dataRow.index === 0 ? \"true\" : undefined}\n dataRow={dataRow}\n groupToggleTarget={groupToggleTarget}\n highlighted={highlightedIndex === ariaRowIndex}\n key={dataRow.renderIndex}\n onClick={onRowClick}\n onDataEdited={onDataEdited}\n offset={showPaginationControls ? 0 : getRowOffset(dataRow)}\n onToggleGroup={onToggleGroup}\n showBookends={selectionBookendWidth > 0}\n searchPattern={lowerCaseSearchPattern}\n virtualColSpan={scrollProps.virtualColSpan}\n zebraStripes={tableAttributes.zebraStripes}\n />\n );\n })}\n {/* \n The focusCellPlaceholder allows us to deal with the situation where a cell \n that has focus is scrolled out of the viewport. That cell, along with the \n containing row, will be recycled to render another DataRow. The html table \n cell must not retain focus once it is re-used but we need to track the \n original focus, in case user uses arrow key to resume navigation. \n The placeholder is fixed in place at the location where the focused cell \n was last rendered. It assumes focus. If we get an arrowkey mousedown event \n on the placeholder, the user has resumed navigation whilst the focused cell \n is offscreen. We scroll back to the focus location and pass focus back to \n the correct target cell.\n */}\n <div\n aria-hidden={true}\n className={`${classBase}-focusCellPlaceholder`}\n onKeyDown={focusCellPlaceholderKeyDown}\n ref={focusCellPlaceholderRef}\n tabIndex={-1}\n />\n\n {cellBlock}\n </div>\n ) : null}\n </div>\n </div>\n {/* \n This keeps the heights of content container and scrollbar container aligned for\n cases where we rely on height: fit-content. (ScrollbarContainer isn't taken into \n account because its absolutely positioned).\n */}\n <div\n className={`${classBase}-scrollbarFiller`}\n style={cssScrollbarSize}\n />\n {draggableRow}\n </TableProvider>\n );\n};\n\nexport const Table = forwardRef(function Table(\n {\n EmptyDisplay,\n Row,\n allowCellBlockSelection,\n allowDragColumnHeader,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n className: classNameProp,\n config,\n customHeader,\n dataSource,\n disableFocus,\n groupToggleTarget,\n colHeaderRowHeight: colHeaderRowHeightProp,\n height,\n highlightedIndex,\n id,\n maxViewportRowLimit,\n navigationStyle,\n onAvailableColumnsChange,\n onConfigChange,\n onDataEdited,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n resizeStrategy,\n rowActionHandlers,\n rowHeight: rowHeightProp,\n rowSelectionBorder,\n scrollingApiRef,\n searchPattern = \"\",\n selectionModel,\n showColumnHeaders,\n showColumnHeaderMenus,\n showPaginationControls,\n style: styleProp,\n viewportRowLimit,\n width,\n ...htmlAttributes\n }: TableProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table\",\n css: tableCss,\n window: targetWindow,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [size, _setSize] = useState<MeasuredSize>();\n\n const { measuredHeight: rowHeight, measuredRef: rowRef } = useMeasuredHeight({\n height: rowHeightProp,\n });\n\n console.log(\n `[Table] measured row height ${rowHeight}, rowHeightProp ${rowHeightProp}`,\n );\n\n const { measuredHeight: footerHeight, measuredRef: footerRef } =\n useMeasuredHeight({});\n\n const rowLimit = maxViewportRowLimit ?? viewportRowLimit;\n\n if (config === undefined) {\n throw Error(\n \"vuu Table requires config prop. Minimum config is list of Column Descriptors\",\n );\n }\n if (dataSource === undefined) {\n throw Error(\"vuu Table requires dataSource prop\");\n }\n\n if (showPaginationControls && renderBufferSize !== undefined) {\n console.warn(\n `Table: When pagination controls are used, renderBufferSize is ignored`,\n );\n }\n\n if (rowLimit && height && rowHeightProp) {\n console.warn(\n `Table: when viewportRowLimit, rowHeight and height are used in combination, height is ignored`,\n );\n height = rowLimit * rowHeightProp;\n } else if (rowLimit && rowHeightProp) {\n height = rowLimit * rowHeightProp;\n } else if (rowLimit) {\n height = rowLimit * rowHeight;\n }\n\n const sizeRef = useRef<MeasuredSize>(undefined);\n const setSize = useCallback(\n (size: MeasuredSize) => {\n if (viewportRowLimit && !rowHeight) {\n sizeRef.current = size;\n } else if (\n size.height !== sizeRef.current?.height ||\n size.width !== sizeRef.current?.width\n ) {\n _setSize(size);\n }\n },\n [rowHeight, viewportRowLimit],\n );\n useMemo(() => {\n if (sizeRef.current && rowHeight) {\n const size = {\n ...sizeRef.current,\n height: rowHeight * (viewportRowLimit as number),\n };\n sizeRef.current = size;\n _setSize(size);\n }\n }, [rowHeight, viewportRowLimit]);\n\n // TODO render TableHeader here and measure before row construction begins\n // TODO we could have MeasuredContainer render a Provider and make size available via a context hook ?\n return (\n <MeasuredContainer\n {...htmlAttributes}\n className={cx(classBase, classNameProp, {\n [`${classBase}-pagination`]: showPaginationControls,\n [`${classBase}-rowSelection-bordered`]: rowSelectionBorder,\n [`${classBase}-maxViewportRowLimit`]: maxViewportRowLimit,\n [`${classBase}-viewportRowLimit`]: viewportRowLimit,\n })}\n height={height}\n id={id}\n onResize={setSize}\n ref={useForkRef(containerRef, forwardedRef)}\n resizeStrategy={resizeStrategy}\n style={\n {\n ...styleProp,\n \"--col-header-row-height-prop\":\n typeof colHeaderRowHeightProp === \"number\"\n ? `${colHeaderRowHeightProp}px`\n : undefined,\n \"--row-height-prop\":\n typeof rowHeightProp === \"number\"\n ? `${rowHeightProp}px`\n : undefined,\n } as CSSProperties\n }\n width={width}\n >\n <RowProxy ref={rowRef} height={rowHeightProp} />\n {size &&\n rowHeight &&\n (footerHeight || showPaginationControls !== true) ? (\n <TableCore\n EmptyDisplay={EmptyDisplay}\n Row={Row}\n allowCellBlockSelection={allowCellBlockSelection}\n allowDragColumnHeader={allowDragColumnHeader}\n allowDragDrop={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allowSelectCheckboxRow={allowSelectCheckboxRow}\n autoSelectFirstRow={autoSelectFirstRow}\n autoSelectRowKey={autoSelectRowKey}\n config={config}\n containerRef={containerRef}\n customHeader={customHeader}\n dataSource={dataSource}\n disableFocus={disableFocus}\n groupToggleTarget={groupToggleTarget}\n highlightedIndex={highlightedIndex}\n id={id}\n navigationStyle={navigationStyle}\n onAvailableColumnsChange={onAvailableColumnsChange}\n onConfigChange={onConfigChange}\n onDataEdited={onDataEdited}\n onDragStart={onDragStart}\n onDrop={onDrop}\n onHighlight={onHighlight}\n onRowClick={onRowClick}\n onSelect={onSelect}\n onSelectCellBlock={onSelectCellBlock}\n onSelectionChange={onSelectionChange}\n renderBufferSize={\n showPaginationControls ? 0 : Math.max(5, renderBufferSize ?? 0)\n }\n revealSelected={revealSelected}\n rowActionHandlers={rowActionHandlers}\n rowHeight={rowHeight}\n scrollingApiRef={scrollingApiRef}\n lowerCaseSearchPattern={lowerCase(searchPattern)}\n selectionModel={selectionModel}\n showColumnHeaders={showColumnHeaders}\n showColumnHeaderMenus={showColumnHeaderMenus}\n showPaginationControls={showPaginationControls}\n size={reduceSizeHeight(size, footerHeight)}\n />\n ) : null}\n {showPaginationControls ? (\n <div className={`${classBase}-footer`} ref={footerRef}>\n <PaginationControl dataSource={dataSource} />\n </div>\n ) : null}\n </MeasuredContainer>\n );\n});\n"],"names":["forwardRef","RowProxy","jsx","Row","DefaultRow","useId","useTable","jsxs","TableProvider","TableHeader","Table","useWindow","useComponentCssInjection","tableCss","useRef","useState","useMeasuredHeight","useCallback","size","useMemo","MeasuredContainer","useForkRef","lowerCase","reduceSizeHeight","PaginationControl"],"mappings":";;;;;;;;;;;;;;;;;;;AAoDA,MAAM,SAAY,GAAA,UAAA;AAQlB,MAAM,QAAA,GAAWA,iBAGf,SAASC,SAAAA,CAAS,EAAE,SAAY,GAAA,aAAA,EAAe,MAAO,EAAA,EAAG,YAAc,EAAA;AACvE,EACE,uBAAAC,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAW,EAAA,IAAA;AAAA,MACX,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,CAAa,WAAA,CAAA,CAAA;AAAA,MACtC,GAAK,EAAA,YAAA;AAAA,MACL,KAAA,EAAO,EAAE,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YACA,YAAA;AAAA,YACA,WAAA;AAAA,YACA,MAAA;AAAA,YACA,WAAA;AAAA,YACA,UAAA;AAAA,YACA,QAAA;AAAA,YACA,iBAAA;AAAA,YACA,iBAAA;AAAA,YACA,kBACE,sBAAyB,GAAA,CAAA,GAAI,KAAK,GAAI,CAAA,CAAA,EAAG,oBAAoB,CAAC,CAAA;AAAA,YAEhE,cAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,eAAA;AAAA,YACA,sBAAA,EAAwBoB,mBAAU,aAAa,CAAA;AAAA,YAC/C,cAAA;AAAA,YACA,iBAAA;AAAA,YACA,qBAAA;AAAA,YACA,sBAAA;AAAA,YACA,IAAA,EAAMC,8BAAiB,CAAA,IAAA,EAAM,YAAY;AAAA;AAAA,SAEzC,GAAA,IAAA;AAAA,QACH,sBACC,mBAAArB,cAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,CAAW,OAAA,CAAA,EAAA,GAAA,EAAK,SAC1C,EAAA,QAAA,kBAAAA,cAAA,CAACsB,mCAAkB,EAAA,EAAA,UAAA,EAAwB,GAC7C,CACE,GAAA;AAAA;AAAA;AAAA,GACN;AAEJ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../packages/vuu-table/src/Table.tsx"],"sourcesContent":["import { useForkRef } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport type { DataSource, SchemaColumn } from \"@vuu-ui/vuu-data-types\";\nimport { TableProvider } from \"@vuu-ui/vuu-table-extras\";\nimport {\n CustomHeader,\n DataCellEditNotification,\n GroupToggleTarget,\n HeaderCellProps,\n RowActionHandler,\n RowProps,\n SelectionChangeHandler,\n ShowColumnHeaderMenus,\n TableConfig,\n TableConfigChangeHandler,\n TableRowClickHandler,\n TableRowSelectHandler,\n TableSelectionModel,\n} from \"@vuu-ui/vuu-table-types\";\nimport type { DragDropState } from \"@vuu-ui/vuu-ui-controls\";\nimport {\n DragStartHandler,\n MeasuredContainer,\n MeasuredContainerProps,\n MeasuredSize,\n dragStrategy,\n reduceSizeHeight,\n} from \"@vuu-ui/vuu-ui-controls\";\nimport { lowerCase, useId } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n CSSProperties,\n ComponentType,\n FC,\n ForwardedRef,\n RefObject,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Row as DefaultRow } from \"./Row\";\nimport { TableCellBlock } from \"./cell-block/cellblock-utils\";\nimport { PaginationControl } from \"./pagination\";\nimport { TableHeader } from \"./table-header\";\nimport { useMeasuredHeight } from \"./useMeasuredHeight\";\nimport { useTable } from \"./useTable\";\nimport { ScrollingAPI } from \"./useTableScroll\";\n\nimport tableCss from \"./Table.css\";\n\nconst classBase = \"vuuTable\";\n\nexport type TableNavigationStyle = \"none\" | \"cell\" | \"row\" | \"tree\";\n\n// A dummy Table Row rendered once and not visible. We measure this to\n// determine height of Row(s) and monitor it for size changes (in\n// case of runtime density switch). This allows ListItem height to\n// be controlled purely through CSS.\nconst RowProxy = forwardRef<\n HTMLDivElement,\n { className?: string; height?: number }\n>(function RowProxy({ className = \"vuuTableRow\", height }, forwardedRef) {\n return (\n <div\n aria-hidden\n className={cx(className, `vuuRowProxy`)}\n ref={forwardedRef}\n style={{ height }}\n />\n );\n});\n\nexport interface TableProps\n extends Omit<\n MeasuredContainerProps,\n \"onDragStart\" | \"onDrop\" | \"onSelect\" | \"searchPattern\"\n > {\n /**\n * A react function component that will be rendered if there are no rows to display\n */\n EmptyDisplay?: ComponentType;\n /**\n * A custom implementation of HeaderCell which will be rendered in place of the\n * default HeaderCell. If provided, custom implementation is responsible for all\n * header behaviour (if required) - sorting, resizing etc.\n */\n HeaderCell?: FC<HeaderCellProps>;\n /**\n * A custom Row implementation that will be rendered in place of the default\n * Row.\n */\n Row?: FC<RowProps>;\n /**\n * Allow a block of cells to be selected. Typically to be copied.\n */\n allowCellBlockSelection?: boolean;\n /**\n * Allow column headers to be dragged to re-arrange\n */\n allowDragColumnHeader?: boolean;\n /**\n * Allow rows to be draggable\n */\n allowDragDrop?: boolean | dragStrategy;\n\n /**\n * Allow all rows be selected, use with checkbox coliumn.\n */\n allowSelectAll?: boolean;\n\n /**\n * If checkbox selection is in effect, can user select row by clicking row. If\n * false, checkbox must be clicked explicitly.\n */\n allowSelectCheckboxRow?: boolean;\n /**\n * if provided, first row of table will be selected on initial render.\n */\n autoSelectFirstRow?: true;\n /**\n * if provided, row with matching key will be selected. If not present, will silently fail.\n */\n autoSelectRowKey?: string;\n\n /**\n * Pixel height of header cells. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n colHeaderRowHeight?: number;\n\n /**\n * Provide configuration settings for Table. At minimun, column\n * descriptors must be provided.\n */\n config: TableConfig;\n dataSource: DataSource;\n\n disableFocus?: boolean;\n /**\n * Allows additional custom element(s) to be embedded immediately below column headers.\n * Could be used to present inline filters for example.\n * Accepts either a React Element or a Function Component or an array of these. If a React\n * Function Component is used, it will be passed the props described in BaseRowProps.\n */\n customHeader?: CustomHeader | CustomHeader[];\n /**\n * When rows are grouped, user can click group row(s) to expand/collapse display of child rows.\n * This allows precise configuration of where user may click to trigger toggle/collapse. When\n * row selection is also supported, clicking outside the region specified here will select or\n * deselect the row.\n * - toggle-icon - the small toggle icon must be clicked directly\n * - group-column (default) - user can click anywhere within the group column, i.e on the icon or the column text\n */\n groupToggleTarget?: GroupToggleTarget;\n\n /**\n * Defined how focus navigation within data cells will be handled by table.\n * Default is cell.\n */\n highlightedIndex?: number;\n\n /**\n * Behaves in most respects like viewportRowLimit except that, when there are fewer\n * rows available than the limit set here, the Table height will reduce. This can be\n * useful where a Table is used in a dropdown control.\n */\n maxViewportRowLimit?: number;\n\n /**\n * Determines bahaviour of keyboard navigation , either row focused or cell focused.\n * `tree` is a specialised navigation behaviour only useful where table is being\n * used to present purely grouped data (see TreeTable)\n */\n navigationStyle?: TableNavigationStyle;\n /**\n * required if a fully featured column picker is to be available.\n * Available columns can be changed by the addition or removal of\n * one or more calculated columns.\n */\n onAvailableColumnsChange?: (columns: SchemaColumn[]) => void;\n /**\n * This callback will be invoked any time a config attribute of TableConfig\n * is changed. By persisting this value and providing it to the Table as a\n * prop, table state can be persisted across sessions.\n */\n onConfigChange?: TableConfigChangeHandler;\n\n /**\n * In a Table with editable cells, this callback will be invoked every time\n * a user performs any edit operation on an editable field.\n */\n // TODO can we scrap this and leavr it to the editTracker ?\n onDataEdited?: DataCellEditNotification;\n\n onDragStart?: DragStartHandler;\n onDrop?: (dragDropState: DragDropState) => void;\n\n onHighlight?: (idx: number) => void;\n /**\n * callback invoked when user 'clicks' a table row. CLick triggered either\n * via mouse click or keyboard (default ENTER);\n */\n onRowClick?: TableRowClickHandler;\n onSelect?: TableRowSelectHandler;\n /**\n * Triggered when a block of cells is selected. CellBlock selection can be\n * effected with either mouse or keyboard.\n * - mouse: hold down mouse and drag over selection area\n * - keyboard: press and hold shift key from start cell, then use arrow keys\n * to extend selection block.\n *\n * This callback is invoked when mouse is released or shift key released.\n */\n onSelectCellBlock?: (cellBlock: TableCellBlock) => void;\n\n onSelectionChange?: SelectionChangeHandler;\n renderBufferSize?: number;\n\n /**\n * Provide functionality for custom row actions. e.g. buttons embedded within row cells.\n * These will be available to any custom renderers via TableContext. e.g. a Row may\n * provide a 'Delete' or 'Cancel' button. Implement this functionality in a rowActionHandler.\n */\n rowActionHandlers?: Record<string, RowActionHandler>;\n\n /**\n * Allows opt-in to a predefined style pattern that renders a border around a row selection block.\n */\n rowSelectionBorder?: boolean;\n\n /**\n * Only applicable to grouped data. If there are selected rows which are not top-level\n * items and group items above are not already expanded, expand all group items in\n * the hierarchy above selected item. Selected items will thus always be visible, initially.\n * This affects items set at load time via autoSelectRowKey as well as items\n * selected programatically (ie not directly by user).\n * Nodes can of course be collapsed by user at runtime which may hide selected rows.\n * Note: this is not supported by all DataSource implementations\n */\n revealSelected?: boolean;\n /**\n * Pixel height of rows. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n rowHeight?: number;\n /**\n * imperative API for scrolling table\n */\n scrollingApiRef?: ForwardedRef<ScrollingAPI>;\n\n /**\n * If a search has been applied against data, this is the search text used.\n * Will be used to highlight matching text.\n */\n searchPattern?: string;\n /**\n * Selection behaviour for Table:\n * `none` selection disabled\n * `single` no more than one row may be selected\n * `single-no-deselect` no more than one row may be selected, one row is always selected, defaults to first visible\n * `extended` (default) multiple rows can be selected\n * `checkbox` same behaviour as extended, with checkbox column for selection\n */\n selectionModel?: TableSelectionModel;\n /**\n * if false, table rendered without headers. Useful when table is being included in a\n * composite component.\n */\n showColumnHeaders?: boolean;\n /**\n * if false, column headers will not display menu icon. If true, all available Column Menu\n * actions will be available via the menu. Alternatively, a map of specific column menu\n * permissions can be provided to allow control over which menu items are presented.\n */\n showColumnHeaderMenus?: ShowColumnHeaderMenus;\n /**\n * if true, pagination will be used to navigate data, scrollbars will not be rendered\n */\n showPaginationControls?: boolean;\n\n /**\n * As an alternative to sizing the Table height via CSS or via an explicit height value,\n * specify the number of rows to be displayed within the Viewport. The actual height\n * will then be the product of viewportRowLimit and rowHeight. Row Height will be\n * determined in the usual way, it can be specified explicitly in a prop or set via\n * CSS. If both explicit height and viewportRowLimit are provided by props, rowHeight\n * will be derived from these. Do not pass props for all three values - height,\n * rowHeight and viewportRowLimit. That will be rejected.\n * Use maxViewportRowLimit rather than viewportRowLimit if the height of the table\n * should be reduced when fewer rows are actually available than the limit specified.\n */\n viewportRowLimit?: number;\n}\n\nconst TableCore = ({\n EmptyDisplay,\n HeaderCell,\n Row = DefaultRow,\n allowCellBlockSelection,\n allowDragColumnHeader = true,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n // colHeaderRowHeight,\n config,\n containerRef,\n customHeader,\n dataSource,\n disableFocus = false,\n groupToggleTarget,\n highlightedIndex: highlightedIndexProp,\n id: idProp,\n lowerCaseSearchPattern,\n navigationStyle = \"cell\",\n // onAvailableColumnsChange,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize = 0,\n revealSelected,\n rowActionHandlers,\n rowHeight,\n scrollingApiRef,\n selectionModel = \"extended\",\n showColumnHeaders = true,\n showColumnHeaderMenus = true,\n showPaginationControls,\n size,\n}: Omit<\n TableProps,\n | \"colHeaderRowHeight\"\n | \"maxViewportRowLimit\"\n | \"resizeStrategy\"\n | \"rowHeight\"\n | \"rowSelectionStyle\"\n | \"searchPattern\"\n | \"viewportRowLimit\"\n> & {\n containerRef: RefObject<HTMLDivElement | null>;\n /**\n * We lowercase this once, on entry, which is the format in which it will be used.\n */\n lowerCaseSearchPattern: Lowercase<string>;\n rowHeight: number;\n size: MeasuredSize;\n}) => {\n const id = useId(idProp);\n const {\n allRowsSelected,\n cellBlock,\n columns,\n dataRows,\n draggableRow,\n focusCellPlaceholderKeyDown,\n focusCellPlaceholderRef,\n getRowOffset,\n handleColumnAction,\n headerState: { height: headerHeight, count: headerCount },\n headings,\n highlightedIndex,\n onCheckBoxColumnHeaderClick,\n onDataEdited,\n onHeaderHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onRowClick,\n onSortColumn,\n onToggleGroup,\n rowClassNameGenerator,\n scrollProps,\n tableAttributes,\n tableBodyRef,\n tableConfig,\n viewportMeasurements,\n ...tableProps\n } = useTable({\n allowCellBlockSelection,\n allowDragDrop,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n config,\n containerRef,\n dataSource,\n disableFocus,\n highlightedIndex: highlightedIndexProp,\n id,\n navigationStyle,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n rowHeight,\n scrollingApiRef,\n selectionModel,\n showColumnHeaders,\n showPaginationControls,\n size,\n });\n\n const { selectionBookendWidth = 4 } = config;\n\n const contentContainerClassName = cx(`${classBase}-contentContainer`, {\n [`${classBase}-colLines`]: tableAttributes.columnSeparators,\n [`${classBase}-rowLines`]: tableAttributes.rowSeparators,\n [`${classBase}-zebra`]: tableAttributes.zebraStripes,\n });\n\n const cssScrollbarSize = {\n \"--horizontal-scrollbar-height\": `${viewportMeasurements.horizontalScrollbarHeight}px`,\n \"--vertical-scrollbar-width\": `${viewportMeasurements.verticalScrollbarWidth}px`,\n } as CSSProperties;\n\n const cssVariables = {\n ...cssScrollbarSize,\n \"--content-height\": `${viewportMeasurements.contentHeight}px`,\n \"--content-width\": `${viewportMeasurements.contentWidth}px`,\n \"--pinned-width-left\": `${viewportMeasurements.pinnedWidthLeft}px`,\n \"--pinned-width-right\": `${viewportMeasurements.pinnedWidthRight}px`,\n \"--total-header-height\": `${headerHeight}px`,\n \"--viewport-body-height\": `${viewportMeasurements.viewportBodyHeight}px`,\n \"--table-selection-bookend-width\": `${selectionBookendWidth}px`,\n } as CSSProperties;\n\n const headersReady = showColumnHeaders === false || headerHeight > 0;\n const readyToRenderTableBody = headersReady && dataRows.length > 0;\n\n return (\n <TableProvider\n dataSource={dataSource}\n menuActionHandler={handleColumnAction}\n rowActionHandlers={rowActionHandlers}\n >\n {showPaginationControls !== true ? (\n <div\n className={`${classBase}-scrollbarContainer`}\n ref={scrollProps.scrollbarContainerRef}\n style={cssVariables}\n tabIndex={-1}\n >\n <div className={`${classBase}-scrollbarContent`} />\n </div>\n ) : null}\n\n {dataSource.size === 0 && EmptyDisplay ? (\n <div className={`${classBase}-emptyDisplay`}>\n <EmptyDisplay />{\" \"}\n </div>\n ) : null}\n\n <div\n className={contentContainerClassName}\n ref={scrollProps.contentContainerRef}\n style={cssVariables}\n >\n <div\n {...tableProps}\n className={`${classBase}-table`}\n role=\"table\"\n tabIndex={disableFocus ? undefined : -1}\n >\n {showColumnHeaders ? (\n <TableHeader\n HeaderCell={HeaderCell}\n allowDragColumnHeader={allowDragColumnHeader}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n // columns={scrollProps.columnsWithinViewport}\n columns={columns}\n customHeader={customHeader}\n headings={headings}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onHeightMeasured={onHeaderHeightMeasured}\n onMoveColumn={onMoveColumn}\n onMoveGroupColumn={onMoveGroupColumn}\n onRemoveGroupColumn={onRemoveGroupColumn}\n onResizeColumn={onResizeColumn}\n onSortColumn={onSortColumn}\n showBookends={selectionBookendWidth > 0}\n showColumnHeaderMenus={showColumnHeaderMenus}\n tableConfig={tableConfig}\n tableId={id}\n virtualColSpan={scrollProps.virtualColSpan}\n />\n ) : null}\n {readyToRenderTableBody ? (\n <div className={`${classBase}-body`} ref={tableBodyRef}>\n {dataRows.map((dataRow) => {\n const ariaRowIndex = dataRow.index + headerCount + 1;\n return (\n <Row\n aria-rowindex={ariaRowIndex}\n classNameGenerator={rowClassNameGenerator}\n columns={scrollProps.columnsWithinViewport}\n // This is used for styling selection only.\n data-first-row={dataRow.index === 0 ? \"true\" : undefined}\n dataRow={dataRow}\n groupToggleTarget={groupToggleTarget}\n highlighted={highlightedIndex === ariaRowIndex}\n key={dataRow.renderIndex}\n onClick={onRowClick}\n onDataEdited={onDataEdited}\n offset={showPaginationControls ? 0 : getRowOffset(dataRow)}\n onToggleGroup={onToggleGroup}\n showBookends={selectionBookendWidth > 0}\n searchPattern={lowerCaseSearchPattern}\n virtualColSpan={scrollProps.virtualColSpan}\n zebraStripes={tableAttributes.zebraStripes}\n />\n );\n })}\n {/* \n The focusCellPlaceholder allows us to deal with the situation where a cell \n that has focus is scrolled out of the viewport. That cell, along with the \n containing row, will be recycled to render another DataRow. The html table \n cell must not retain focus once it is re-used but we need to track the \n original focus, in case user uses arrow key to resume navigation. \n The placeholder is fixed in place at the location where the focused cell \n was last rendered. It assumes focus. If we get an arrowkey mousedown event \n on the placeholder, the user has resumed navigation whilst the focused cell \n is offscreen. We scroll back to the focus location and pass focus back to \n the correct target cell.\n */}\n <div\n aria-hidden={true}\n className={`${classBase}-focusCellPlaceholder`}\n onKeyDown={focusCellPlaceholderKeyDown}\n ref={focusCellPlaceholderRef}\n tabIndex={-1}\n />\n\n {cellBlock}\n </div>\n ) : null}\n </div>\n </div>\n {/* \n This keeps the heights of content container and scrollbar container aligned for\n cases where we rely on height: fit-content. (ScrollbarContainer isn't taken into \n account because its absolutely positioned).\n */}\n <div\n className={`${classBase}-scrollbarFiller`}\n style={cssScrollbarSize}\n />\n {draggableRow}\n </TableProvider>\n );\n};\n\nexport const Table = forwardRef(function Table(\n {\n EmptyDisplay,\n HeaderCell,\n Row,\n allowCellBlockSelection,\n allowDragColumnHeader,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n className: classNameProp,\n config,\n customHeader,\n dataSource,\n disableFocus,\n groupToggleTarget,\n colHeaderRowHeight: colHeaderRowHeightProp,\n height,\n highlightedIndex,\n id,\n maxViewportRowLimit,\n navigationStyle,\n onAvailableColumnsChange,\n onConfigChange,\n onDataEdited,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n resizeStrategy,\n rowActionHandlers,\n rowHeight: rowHeightProp,\n rowSelectionBorder,\n scrollingApiRef,\n searchPattern = \"\",\n selectionModel,\n showColumnHeaders,\n showColumnHeaderMenus,\n showPaginationControls,\n style: styleProp,\n viewportRowLimit,\n width,\n ...htmlAttributes\n }: TableProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table\",\n css: tableCss,\n window: targetWindow,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [size, _setSize] = useState<MeasuredSize>();\n\n const { measuredHeight: rowHeight, measuredRef: rowRef } = useMeasuredHeight({\n height: rowHeightProp,\n });\n\n console.log(\n `[Table] measured row height ${rowHeight}, rowHeightProp ${rowHeightProp}`,\n );\n\n const { measuredHeight: footerHeight, measuredRef: footerRef } =\n useMeasuredHeight({});\n\n const rowLimit = maxViewportRowLimit ?? viewportRowLimit;\n\n if (config === undefined) {\n throw Error(\n \"vuu Table requires config prop. Minimum config is list of Column Descriptors\",\n );\n }\n if (dataSource === undefined) {\n throw Error(\"vuu Table requires dataSource prop\");\n }\n\n if (showPaginationControls && renderBufferSize !== undefined) {\n console.warn(\n `Table: When pagination controls are used, renderBufferSize is ignored`,\n );\n }\n\n if (rowLimit && height && rowHeightProp) {\n console.warn(\n `Table: when viewportRowLimit, rowHeight and height are used in combination, height is ignored`,\n );\n height = rowLimit * rowHeightProp;\n } else if (rowLimit && rowHeightProp) {\n height = rowLimit * rowHeightProp;\n } else if (rowLimit) {\n height = rowLimit * rowHeight;\n }\n\n const sizeRef = useRef<MeasuredSize>(undefined);\n const setSize = useCallback(\n (size: MeasuredSize) => {\n if (viewportRowLimit && !rowHeight) {\n sizeRef.current = size;\n } else if (\n size.height !== sizeRef.current?.height ||\n size.width !== sizeRef.current?.width\n ) {\n _setSize(size);\n }\n },\n [rowHeight, viewportRowLimit],\n );\n useMemo(() => {\n if (sizeRef.current && rowHeight) {\n const size = {\n ...sizeRef.current,\n height: rowHeight * (viewportRowLimit as number),\n };\n sizeRef.current = size;\n _setSize(size);\n }\n }, [rowHeight, viewportRowLimit]);\n\n // TODO render TableHeader here and measure before row construction begins\n // TODO we could have MeasuredContainer render a Provider and make size available via a context hook ?\n return (\n <MeasuredContainer\n {...htmlAttributes}\n className={cx(classBase, classNameProp, {\n [`${classBase}-pagination`]: showPaginationControls,\n [`${classBase}-rowSelection-bordered`]: rowSelectionBorder,\n [`${classBase}-maxViewportRowLimit`]: maxViewportRowLimit,\n [`${classBase}-viewportRowLimit`]: viewportRowLimit,\n })}\n height={height}\n id={id}\n onResize={setSize}\n ref={useForkRef(containerRef, forwardedRef)}\n resizeStrategy={resizeStrategy}\n style={\n {\n ...styleProp,\n \"--col-header-row-height-prop\":\n typeof colHeaderRowHeightProp === \"number\"\n ? `${colHeaderRowHeightProp}px`\n : undefined,\n \"--row-height-prop\":\n typeof rowHeightProp === \"number\"\n ? `${rowHeightProp}px`\n : undefined,\n } as CSSProperties\n }\n width={width}\n >\n <RowProxy ref={rowRef} height={rowHeightProp} />\n {size &&\n rowHeight &&\n (footerHeight || showPaginationControls !== true) ? (\n <TableCore\n EmptyDisplay={EmptyDisplay}\n HeaderCell={HeaderCell}\n Row={Row}\n allowCellBlockSelection={allowCellBlockSelection}\n allowDragColumnHeader={allowDragColumnHeader}\n allowDragDrop={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allowSelectCheckboxRow={allowSelectCheckboxRow}\n autoSelectFirstRow={autoSelectFirstRow}\n autoSelectRowKey={autoSelectRowKey}\n config={config}\n containerRef={containerRef}\n customHeader={customHeader}\n dataSource={dataSource}\n disableFocus={disableFocus}\n groupToggleTarget={groupToggleTarget}\n highlightedIndex={highlightedIndex}\n id={id}\n navigationStyle={navigationStyle}\n onAvailableColumnsChange={onAvailableColumnsChange}\n onConfigChange={onConfigChange}\n onDataEdited={onDataEdited}\n onDragStart={onDragStart}\n onDrop={onDrop}\n onHighlight={onHighlight}\n onRowClick={onRowClick}\n onSelect={onSelect}\n onSelectCellBlock={onSelectCellBlock}\n onSelectionChange={onSelectionChange}\n renderBufferSize={\n showPaginationControls ? 0 : Math.max(5, renderBufferSize ?? 0)\n }\n revealSelected={revealSelected}\n rowActionHandlers={rowActionHandlers}\n rowHeight={rowHeight}\n scrollingApiRef={scrollingApiRef}\n lowerCaseSearchPattern={lowerCase(searchPattern)}\n selectionModel={selectionModel}\n showColumnHeaders={showColumnHeaders}\n showColumnHeaderMenus={showColumnHeaderMenus}\n showPaginationControls={showPaginationControls}\n size={reduceSizeHeight(size, footerHeight)}\n />\n ) : null}\n {showPaginationControls ? (\n <div className={`${classBase}-footer`} ref={footerRef}>\n <PaginationControl dataSource={dataSource} />\n </div>\n ) : null}\n </MeasuredContainer>\n );\n});\n"],"names":["forwardRef","RowProxy","jsx","Row","DefaultRow","useId","useTable","jsxs","TableProvider","TableHeader","Table","useWindow","useComponentCssInjection","tableCss","useRef","useState","useMeasuredHeight","useCallback","size","useMemo","MeasuredContainer","useForkRef","lowerCase","reduceSizeHeight","PaginationControl"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,MAAM,SAAY,GAAA,UAAA;AAQlB,MAAM,QAAA,GAAWA,iBAGf,SAASC,SAAAA,CAAS,EAAE,SAAY,GAAA,aAAA,EAAe,MAAO,EAAA,EAAG,YAAc,EAAA;AACvE,EACE,uBAAAC,cAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAW,EAAA,IAAA;AAAA,MACX,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,CAAa,WAAA,CAAA,CAAA;AAAA,MACtC,GAAK,EAAA,YAAA;AAAA,MACL,KAAA,EAAO,EAAE,MAAO;AAAA;AAAA,GAClB;AAEJ,CAAC,CAAA;AAgOD,MAAM,YAAY,CAAC;AAAA,EACjB,YAAA;AAAA,EACA,UAAA;AAAA,OACAC,KAAM,GAAAC,OAAA;AAAA,EACN,uBAAA;AAAA,EACA,qBAAwB,GAAA,IAAA;AAAA,EACxB,aAAA;AAAA,EACA,cAAA;AAAA,EACA,sBAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA;AAAA,EAEA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAe,GAAA,KAAA;AAAA,EACf,iBAAA;AAAA,EACA,gBAAkB,EAAA,oBAAA;AAAA,EAClB,EAAI,EAAA,MAAA;AAAA,EACJ,sBAAA;AAAA,EACA,eAAkB,GAAA,MAAA;AAAA;AAA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B,CAAA,IAAA,EAAM,YAAY;AAAA;AAAA,SAEzC,GAAA,IAAA;AAAA,QACH,sBACC,mBAAArB,cAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,CAAW,OAAA,CAAA,EAAA,GAAA,EAAK,SAC1C,EAAA,QAAA,kBAAAA,cAAA,CAACsB,mCAAkB,EAAA,EAAA,UAAA,EAAwB,GAC7C,CACE,GAAA;AAAA;AAAA;AAAA,GACN;AAEJ,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var headerCellCss = ".vuuTableHeaderCell {\n --cell-align: \"flex-start\";\n --vuuColumnHeaderPill-margin: 0;\n --vuuColumnHeaderPill-flex: 0 0 24px;\n\n align-items: center;\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n border-bottom: none;\n border-right-color: var(--cell-borderColor);\n border-right-style: solid;\n border-right-width: 1px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n gap: 2px;\n height: 100%;\n padding: 0 4px 0 8px;\n position: relative;\n vertical-align: top;\n\n &.vuuPinLeft,\n &.vuuPinRight {\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n }\n}\n\n.vuuTableHeaderCell.vuuDragging,\n.vuuTableHeaderCell:focus {\n outline: var(\n --vuuTableCell-outline,\n solid var(--salt-focused-outlineColor) 2px\n );\n outline-offset: -3px;\n}\n\n.vuuTableHeaderCell.vuuDragging {\n height: var(--vuu-table-col-header-row-height);\n}\n\n.vuuTableHeaderCell-right {\n --columnResizer-left: 0;\n --vuuTable-columnMenu-margin: 0;\n --column-menu-left: 2px;\n justify-content: flex-end;\n padding: 0 3px 0 12px;\n}\n\n.vuuTableHeaderCell-noMenu {\n padding-left: var(--salt-spacing-300);\n}\n\n.vuuTableHeaderCell-label {\n flex: 1 1 auto;\n line-height: calc(var(--vuu-table-cell-header-height) - 1px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.vuuTableHeaderCell-right .vuuTableHeaderCell-label {\n text-align: right;\n}\n\n.vuuTableHeaderCell-resizing {\n --columnResizeThumb-color: var(--vuu-color-purple-10);\n --columnResizer-color: var(--vuu-color-purple-10);\n --columnResizer-height: var(--table-height);\n}\n\n.vuuTableHeaderCell.vuuPinLeft {\n padding-left: 2px;\n}\n\n.vuuTableHeaderCell.vuuPinLeft.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n 0% 0%,\n 0% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: var(\n --vuuTablePinnedColumn-borderColor,\n var(--salt-container-primary-borderColor)\n );\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: 2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 3px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuPinRight.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n -20% 0%,\n -20% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: #a9aaad;\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: -2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 0px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuDraggable-dragAway {\n display: none;\n}\n\n.vuuTable-headingCell {\n background: var(--dataTable-background);\n border-color: var(--salt-separable-tertiary-borderColor);\n border-style: solid solid solid none;\n border-width: 1px;\n color: var(--salt-content-secondary-foreground);\n display: inline-block;\n height: var(--vuu-table-col-heading-height);\n padding: 0 !important;\n}\n\n.vuuTableHeaderCell:has(.saltCheckbox){\n padding-left: 6px;\n}";
|
|
3
|
+
var headerCellCss = ".vuuTableHeaderCell {\n --selected-column-borderColor: var(--vuuTable-column-selected-borderColor, var(--salt-selectable-borderColor-selected));\n --cell-align: \"flex-start\";\n --vuuColumnHeaderPill-margin: 0;\n --vuuColumnHeaderPill-flex: 0 0 24px;\n\n align-items: center;\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n border-bottom: none;\n border-right-color: var(--cell-borderColor);\n border-right-style: solid;\n border-right-width: 1px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n gap: 2px;\n height: 100%;\n padding: 0 4px 0 8px;\n position: relative;\n vertical-align: top;\n\n &.vuuPinLeft,\n &.vuuPinRight {\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n }\n}\n\n.vuuTableHeaderCell.vuuDragging,\n.vuuTableHeaderCell:focus {\n outline: var(\n --vuuTableCell-outline,\n solid var(--salt-focused-outlineColor) 2px\n );\n outline-offset: -3px;\n}\n\n.vuuTableHeaderCell.vuuDragging {\n height: var(--vuu-table-col-header-row-height);\n}\n\n.vuuTableHeaderCell-right {\n --columnResizer-left: 0;\n --vuuTable-columnMenu-margin: 0;\n --column-menu-left: 2px;\n justify-content: flex-end;\n padding: 0 3px 0 12px;\n}\n\n.vuuTableHeaderCell-noMenu {\n padding-left: var(--salt-spacing-300);\n}\n\n.vuuTableHeaderCell-label {\n flex: 1 1 auto;\n line-height: calc(var(--vuu-table-cell-header-height) - 1px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.vuuTableHeaderCell-right .vuuTableHeaderCell-label {\n text-align: right;\n}\n\n.vuuTableHeaderCell-resizing {\n --columnResizeThumb-color: var(--vuu-color-purple-10);\n --columnResizer-color: var(--vuu-color-purple-10);\n --columnResizer-height: var(--table-height);\n}\n\n.vuuTableHeaderCell.vuuPinLeft {\n padding-left: 2px;\n}\n\n.vuuTableHeaderCell.vuuPinLeft.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n 0% 0%,\n 0% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: var(\n --vuuTablePinnedColumn-borderColor,\n var(--salt-container-primary-borderColor)\n );\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: 2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 3px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuPinRight.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n -20% 0%,\n -20% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: #a9aaad;\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: -2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 0px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuDraggable-dragAway {\n display: none;\n}\n\n.vuuTable-headingCell {\n background: var(--dataTable-background);\n border-color: var(--salt-separable-tertiary-borderColor);\n border-style: solid solid solid none;\n border-width: 1px;\n color: var(--salt-content-secondary-foreground);\n display: inline-block;\n height: var(--vuu-table-col-heading-height);\n padding: 0 !important;\n}\n\n.vuuTableHeaderCell:has(.saltCheckbox){\n padding-left: 6px;\n}\n\n\n.vuuTableHeaderCell.error {\n --selected-column-borderColor: var(--salt-status-error-borderColor);\n}\n.vuuTableHeaderCell.info {\n --selected-column-borderColor: var(--salt-status-info-borderColor);\n}\n.vuuTableHeaderCell.success {\n --selected-column-borderColor: var(--salt-status-success-borderColor);\n}\n.vuuTableHeaderCell.warning {\n --selected-column-borderColor: var(--salt-status-warning-borderColor);\n}\n\n.vuuTableHeaderCell-selected:after {\n background-color: transparent;\n border: solid 1px var(--selected-column-borderColor);\n border-radius: 6px;\n\n clip-path: polygon(\n 0px 0px,\n 0px 100%,\n 100% 100%,\n 100% 0px,\n 0px 0px,\n 2px 2px,\n calc(100% - 2px) 2px,\n calc(100% - 2px) calc(100% - 2px),\n 2px calc(100% - 2px),\n 2px 2px\n );\n box-sizing: border-box;\n content: \"\";\n pointer-events: none;\n position: absolute;\n right: 1px;\n height: calc(var(--table-height) - var(--horizontal-scrollbar-height) - 2px);\n top: 1px;\n width: calc(100% - 2px);\n \n}";
|
|
4
4
|
|
|
5
5
|
module.exports = headerCellCss;
|
|
6
6
|
//# sourceMappingURL=HeaderCell.css.js.map
|
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var core = require('@salt-ds/core');
|
|
5
|
-
var styles = require('@salt-ds/styles');
|
|
6
|
-
var window = require('@salt-ds/window');
|
|
7
5
|
var vuuTableExtras = require('@vuu-ui/vuu-table-extras');
|
|
8
6
|
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
9
7
|
var cx = require('clsx');
|
|
10
8
|
var react = require('react');
|
|
9
|
+
require('@salt-ds/styles');
|
|
10
|
+
require('@salt-ds/window');
|
|
11
11
|
var SortIndicator = require('../column-header-pill/SortIndicator.js');
|
|
12
12
|
var ColumnResizer = require('../column-resizing/ColumnResizer.js');
|
|
13
13
|
var useTableColumnResize = require('../column-resizing/useTableColumnResize.js');
|
|
14
14
|
var useCell = require('../useCell.js');
|
|
15
|
-
var HeaderCell$1 = require('./HeaderCell.css.js');
|
|
16
15
|
|
|
17
16
|
const classBase = "vuuTableHeaderCell";
|
|
18
17
|
const doNothing = () => {
|
|
@@ -32,12 +31,6 @@ const HeaderCell = ({
|
|
|
32
31
|
showColumnHeaderMenus = true,
|
|
33
32
|
...htmlAttributes
|
|
34
33
|
}) => {
|
|
35
|
-
const targetWindow = window.useWindow();
|
|
36
|
-
styles.useComponentCssInjection({
|
|
37
|
-
testId: "vuu-header-cell",
|
|
38
|
-
css: HeaderCell$1,
|
|
39
|
-
window: targetWindow
|
|
40
|
-
});
|
|
41
34
|
const dragDropSortHook = allowDragColumnHeader ? vuuUtils.useSortable : doNothing;
|
|
42
35
|
const { ref: sortableRef } = dragDropSortHook({ id, index });
|
|
43
36
|
const {
|
|
@@ -121,8 +114,9 @@ const HeaderCell = ({
|
|
|
121
114
|
...htmlAttributes,
|
|
122
115
|
"aria-colindex": column.ariaColIndex,
|
|
123
116
|
"aria-label": `${column.label ?? column.name} column header`,
|
|
124
|
-
className: cx(className, classNameProp, {
|
|
117
|
+
className: cx(className, classNameProp, column.status, {
|
|
125
118
|
[`${classBase}-resizing`]: isResizing,
|
|
119
|
+
[`${classBase}-selected`]: column.selected,
|
|
126
120
|
[`${classBase}-noMenu`]: showColumnHeaderMenus === false
|
|
127
121
|
}),
|
|
128
122
|
"data-column-name": column.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderCell.js","sources":["../../../../packages/vuu-table/src/header-cell/HeaderCell.tsx"],"sourcesContent":["import { Checkbox, useForkRef } from \"@salt-ds/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"HeaderCell.js","sources":["../../../../packages/vuu-table/src/header-cell/HeaderCell.tsx"],"sourcesContent":["import { Checkbox, useForkRef } from \"@salt-ds/core\";\nimport { ColumnMenu } from \"@vuu-ui/vuu-table-extras\";\nimport { HeaderCellProps } from \"@vuu-ui/vuu-table-types\";\nimport { isTypeDescriptor, useSortable } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n KeyboardEventHandler,\n MouseEventHandler,\n SyntheticEvent,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { SortIndicator } from \"../column-header-pill\";\nimport { ColumnResizer, useTableColumnResize } from \"../column-resizing\";\nimport { useCell } from \"../useCell\";\n\nconst classBase = \"vuuTableHeaderCell\";\n\nconst doNothing = () => {\n // dummy hook\n return { ref: { current: null } };\n};\n\nexport const HeaderCell = ({\n allowDragColumnHeader = true,\n allowSelectAll,\n allRowsSelected,\n className: classNameProp,\n column,\n id,\n index,\n onCheckBoxColumnHeaderClick,\n onClick,\n onResize,\n showColumnHeaderMenus = true,\n ...htmlAttributes\n}: HeaderCellProps) => {\n const dragDropSortHook = allowDragColumnHeader ? useSortable : doNothing;\n const { ref: sortableRef } = dragDropSortHook({ id, index });\n const {\n allowColumnHeaderMenu = true,\n HeaderCellContentRenderer,\n HeaderCellLabelRenderer,\n } = column;\n const rootRef = useRef<HTMLDivElement>(null);\n const { isResizing, ...resizeProps } = useTableColumnResize({\n column,\n onResize,\n rootRef,\n });\n\n const handleCheckBoxClick = useCallback(\n (e: SyntheticEvent) => {\n e.stopPropagation();\n onCheckBoxColumnHeaderClick?.();\n },\n [onCheckBoxColumnHeaderClick],\n );\n\n const headerItems = useMemo(() => {\n const renderCheckbox =\n allowSelectAll &&\n column.isSystemColumn &&\n isTypeDescriptor(column.type) &&\n column.type.name === \"checkbox\";\n\n if (renderCheckbox) {\n return [\n <Checkbox\n checked={allRowsSelected}\n className=\"vuuCheckboxRowSelector\"\n key=\"checkbox\"\n onClick={handleCheckBoxClick}\n />,\n ];\n } else {\n const sortIndicator = <SortIndicator column={column} />;\n const columnLabel = HeaderCellLabelRenderer ? (\n <HeaderCellLabelRenderer\n className={`${classBase}-label`}\n column={column}\n />\n ) : (\n <div className={`${classBase}-label`}>\n {column.label ?? column.name}\n </div>\n );\n const columnContent = HeaderCellContentRenderer\n ? [<HeaderCellContentRenderer column={column} key=\"content\" />]\n : [];\n\n if (showColumnHeaderMenus && allowColumnHeaderMenu) {\n const menuPermissions =\n showColumnHeaderMenus === true ? undefined : showColumnHeaderMenus;\n const columnMenu = (\n <ColumnMenu column={column} menuPermissions={menuPermissions} />\n );\n\n return [columnLabel, columnContent, sortIndicator, columnMenu];\n } else {\n return [columnLabel, sortIndicator, columnContent];\n }\n }\n }, [\n HeaderCellContentRenderer,\n HeaderCellLabelRenderer,\n allRowsSelected,\n allowColumnHeaderMenu,\n allowSelectAll,\n column,\n handleCheckBoxClick,\n showColumnHeaderMenus,\n ]);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (evt) => {\n !isResizing && onClick?.(evt);\n },\n [isResizing, onClick],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLDivElement>>(\n (evt) => {\n if (evt.key === \"Enter\") {\n onClick?.(evt);\n }\n },\n [onClick],\n );\n\n const { className, style } = useCell(column, classBase, true);\n\n return (\n <div\n {...htmlAttributes}\n aria-colindex={column.ariaColIndex}\n aria-label={`${column.label ?? column.name} column header`}\n className={cx(className, classNameProp, column.status, {\n [`${classBase}-resizing`]: isResizing,\n [`${classBase}-selected`]: column.selected,\n [`${classBase}-noMenu`]: showColumnHeaderMenus === false,\n })}\n data-column-name={column.name}\n data-index={index}\n id={id}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n ref={useForkRef<HTMLDivElement>(rootRef, sortableRef)}\n role=\"columnheader\"\n style={style}\n >\n {...headerItems}\n {column.resizeable !== false ? <ColumnResizer {...resizeProps} /> : null}\n </div>\n );\n};\n"],"names":["useSortable","useRef","useTableColumnResize","useCallback","useMemo","isTypeDescriptor","jsx","Checkbox","SortIndicator","ColumnMenu","useCell","jsxs","useForkRef","ColumnResizer"],"mappings":";;;;;;;;;;;;;;;AAiBA,MAAM,SAAY,GAAA,oBAAA;AAElB,MAAM,YAAY,MAAM;AAEtB,EAAA,OAAO,EAAE,GAAA,EAAK,EAAE,OAAA,EAAS,MAAO,EAAA;AAClC,CAAA;AAEO,MAAM,aAAa,CAAC;AAAA,EACzB,qBAAwB,GAAA,IAAA;AAAA,EACxB,cAAA;AAAA,EACA,eAAA;AAAA,EACA,SAAW,EAAA,aAAA;AAAA,EACX,MAAA;AAAA,EACA,EAAA;AAAA,EACA,KAAA;AAAA,EACA,2BAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,qBAAwB,GAAA,IAAA;AAAA,EACxB,GAAG;AACL,CAAuB,KAAA;AACrB,EAAM,MAAA,gBAAA,GAAmB,wBAAwBA,oBAAc,GAAA,SAAA;AAC/D,EAAM,MAAA,EAAE,KAAK,WAAY,EAAA,GAAI,iBAAiB,EAAE,EAAA,EAAI,OAAO,CAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,qBAAwB,GAAA,IAAA;AAAA,IACxB,yBAAA;AAAA,IACA;AAAA,GACE,GAAA,MAAA;AACJ,EAAM,MAAA,OAAA,GA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,MAAO,CAAA,KAAA,IAAS,OAAO,IAAI,CAAA,cAAA,CAAA;AAAA,MAC1C,SAAW,EAAA,EAAA,CAAG,SAAW,EAAA,aAAA,EAAe,OAAO,MAAQ,EAAA;AAAA,QACrD,CAAC,CAAA,EAAG,SAAS,CAAA,SAAA,CAAW,GAAG,UAAA;AAAA,QAC3B,CAAC,CAAA,EAAG,SAAS,CAAA,SAAA,CAAW,GAAG,MAAO,CAAA,QAAA;AAAA,QAClC,CAAC,CAAA,EAAG,SAAS,CAAA,OAAA,CAAS,GAAG,qBAA0B,KAAA;AAAA,OACpD,CAAA;AAAA,MACD,oBAAkB,MAAO,CAAA,IAAA;AAAA,MACzB,YAAY,EAAA,KAAA;AAAA,MACZ,EAAA;AAAA,MACA,OAAS,EAAA,WAAA;AAAA,MACT,SAAW,EAAA,aAAA;AAAA,MACX,GAAA,EAAKC,eAA2B,CAAA,OAAA,EAAS,WAAW,CAAA;AAAA,MACpD,IAAK,EAAA,cAAA;AAAA,MACL,KAAA;AAAA,MAEC,QAAA,EAAA;AAAA,QAAG,GAAA,WAAA;AAAA,QACH,OAAO,UAAe,KAAA,KAAA,kCAASC,2BAAe,EAAA,EAAA,GAAG,aAAa,CAAK,GAAA;AAAA;AAAA;AAAA,GACtE;AAEJ;;;;"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var styles = require('@salt-ds/styles');
|
|
5
|
+
var window = require('@salt-ds/window');
|
|
4
6
|
var vuuUtils = require('@vuu-ui/vuu-utils');
|
|
5
7
|
var react = require('react');
|
|
6
8
|
var GroupHeaderCell = require('../header-cell/GroupHeaderCell.js');
|
|
7
|
-
var HeaderCell = require('../header-cell/HeaderCell.js');
|
|
9
|
+
var HeaderCell$1 = require('../header-cell/HeaderCell.js');
|
|
8
10
|
var HeaderProvider = require('./HeaderProvider.js');
|
|
9
11
|
var useTableHeader = require('./useTableHeader.js');
|
|
12
|
+
var HeaderCell = require('../header-cell/HeaderCell.css.js');
|
|
10
13
|
|
|
11
14
|
const isHeaderElement = (h) => react.isValidElement(h);
|
|
12
15
|
const classBase = "vuuTableHeader";
|
|
13
16
|
const TableHeader = react.memo(
|
|
14
17
|
({
|
|
18
|
+
HeaderCell: HeaderCell$2 = HeaderCell$1.HeaderCell,
|
|
15
19
|
allowDragColumnHeader,
|
|
16
20
|
allowSelectAll,
|
|
17
21
|
allRowsSelected,
|
|
@@ -31,6 +35,12 @@ const TableHeader = react.memo(
|
|
|
31
35
|
tableId,
|
|
32
36
|
virtualColSpan = 0
|
|
33
37
|
}) => {
|
|
38
|
+
const targetWindow = window.useWindow();
|
|
39
|
+
styles.useComponentCssInjection({
|
|
40
|
+
testId: "vuu-table-header-cell",
|
|
41
|
+
css: HeaderCell,
|
|
42
|
+
window: targetWindow
|
|
43
|
+
});
|
|
34
44
|
const [customHeaders, customHeaderCount] = react.useMemo(() => {
|
|
35
45
|
const offset = headings.length;
|
|
36
46
|
const createElement = (Component, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -128,7 +138,7 @@ const TableHeader = react.memo(
|
|
|
128
138
|
},
|
|
129
139
|
col.name
|
|
130
140
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
131
|
-
HeaderCell
|
|
141
|
+
HeaderCell$2,
|
|
132
142
|
{
|
|
133
143
|
allowDragColumnHeader: allowDragDrop,
|
|
134
144
|
allowSelectAll,
|
|
@@ -149,7 +159,7 @@ const TableHeader = react.memo(
|
|
|
149
159
|
}
|
|
150
160
|
),
|
|
151
161
|
/* @__PURE__ */ jsxRuntime.jsx(vuuUtils.DragOverlay, { children: dragColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { id: dragColumn.id, className: "DragColumn", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
152
|
-
HeaderCell
|
|
162
|
+
HeaderCell$2,
|
|
153
163
|
{
|
|
154
164
|
column: dragColumn.column,
|
|
155
165
|
className: "vuuDragging",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.js","sources":["../../../../packages/vuu-table/src/table-header/TableHeader.tsx"],"sourcesContent":["import { VuuSortType } from \"@vuu-ui/vuu-protocol-types\";\nimport {\n DragDropProvider,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n RestrictToHorizontalAxis,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ColumnDescriptor,\n ColumnMoveHandler,\n CustomHeader,\n CustomHeaderComponent,\n CustomHeaderElement,\n HeaderCellProps,\n RuntimeColumnDescriptor,\n TableColumnResizeHandler,\n TableConfig,\n TableHeadings,\n} from \"@vuu-ui/vuu-table-types\";\nimport { isGroupColumn, isNotHidden } from \"@vuu-ui/vuu-utils\";\nimport {\n cloneElement,\n isValidElement,\n memo,\n ReactElement,\n useMemo,\n} from \"react\";\nimport { GroupHeaderCell, HeaderCell } from \"../header-cell\";\nimport { HeaderProvider } from \"./HeaderProvider\";\nimport { useTableHeader } from \"./useTableHeader\";\n\nexport type ColumnSortHandler = (\n column: ColumnDescriptor,\n addToExistingSort: boolean,\n sortType?: VuuSortType,\n) => void;\n\nconst isHeaderElement = (h: CustomHeader): h is CustomHeaderElement =>\n isValidElement(h);\n\nconst classBase = \"vuuTableHeader\";\n\nexport interface TableHeaderProps\n extends Pick<\n HeaderCellProps,\n | \"allRowsSelected\"\n | \"allowDragColumnHeader\"\n | \"allowSelectAll\"\n | \"onCheckBoxColumnHeaderClick\"\n | \"showColumnHeaderMenus\"\n > {\n columns: RuntimeColumnDescriptor[];\n customHeader?: CustomHeader | CustomHeader[];\n headings: TableHeadings;\n onHeightMeasured: (height: number, count: number) => void;\n onResizeColumn: TableColumnResizeHandler;\n onMoveColumn: ColumnMoveHandler;\n onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;\n onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;\n onSortColumn: ColumnSortHandler;\n showBookends?: boolean;\n tableConfig: TableConfig;\n tableId: string;\n virtualColSpan?: number;\n}\n\nexport const TableHeader = memo(\n ({\n allowDragColumnHeader,\n allowSelectAll,\n allRowsSelected,\n columns,\n customHeader,\n headings,\n onCheckBoxColumnHeaderClick,\n onHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onSortColumn,\n showBookends,\n showColumnHeaderMenus,\n tableConfig,\n tableId,\n virtualColSpan = 0,\n }: TableHeaderProps) => {\n const [customHeaders, customHeaderCount] = useMemo<\n [ReactElement | ReactElement[] | null, number]\n >(() => {\n const offset = headings.length;\n const createElement = (\n Component: CustomHeaderComponent,\n index: number,\n ) => (\n <Component\n ariaRowIndex={offset + index + 2}\n ariaRole=\"row\"\n columns={columns}\n key={index}\n virtualColSpan={virtualColSpan}\n />\n );\n\n const enrichElementWithAria = (el: ReactElement, rowIndex: number) => {\n const offset = headings.length;\n return cloneElement(el, {\n \"aria-rowindex\": rowIndex + offset + 2,\n ariaRole: \"row\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n };\n\n if (customHeader === undefined) {\n return [null, 0];\n } else if (Array.isArray(customHeader)) {\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {customHeader.map((header, i) =>\n isHeaderElement(header)\n ? enrichElementWithAria(header, i)\n : createElement(header, i),\n )}\n </HeaderProvider>\n );\n return [header, customHeader.length];\n } else if (isHeaderElement(customHeader)) {\n // TODO rowIndex and role\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {enrichElementWithAria(customHeader, 0)}\n </HeaderProvider>\n );\n return [header, 1];\n } else {\n return [createElement(customHeader, 0), 1];\n }\n }, [columns, customHeader, headings.length, virtualColSpan]);\n\n const { dragColumn, onClick, onDragEnd, onDragStart, setContainerRef } =\n useTableHeader({\n columns,\n customHeaderCount,\n headings,\n onHeightMeasured,\n onMoveColumn,\n onSortColumn,\n tableConfig,\n });\n\n const visibleColumns = columns.filter(isNotHidden);\n\n return (\n <div className={classBase} ref={setContainerRef} role=\"rowgroup\">\n {headings.map((colHeaders, i) => (\n <div\n className=\"vuuTable-heading\"\n key={i}\n role=\"row\"\n aria-rowindex={i + 1}\n >\n {colHeaders.map(({ label, width }, j) => (\n <div key={j} className=\"vuuTable-headingCell\" style={{ width }}>\n {label}\n </div>\n ))}\n </div>\n ))}\n <DragDropProvider // whats the difference between this and DnDContext\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore typing error from dnd-kit\n modifiers={[RestrictToHorizontalAxis]}\n sensors={[\n KeyboardSensor.configure({\n keyboardCodes: {\n start: [\"Space\"],\n cancel: [\"Escape\"],\n end: [\"Space\", \"Enter\"],\n left: [\"ArrowLeft\"],\n right: [\"ArrowRight\"],\n up: [],\n down: [],\n },\n }),\n PointerSensor,\n ]}\n >\n <div\n className=\"vuuTableColHeaderRow\"\n role=\"row\"\n aria-rowindex={headings.length + 1}\n >\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyLeft\" />\n ) : null}\n\n {visibleColumns.map((col, i) => {\n const allowDragDrop =\n allowDragColumnHeader && !col.pin ? true : false;\n return isGroupColumn(col) ? (\n <GroupHeaderCell\n column={col}\n id={`${tableId}-${col.name}`}\n key={col.name}\n onMoveColumn={onMoveGroupColumn}\n onRemoveColumn={onRemoveGroupColumn}\n onResize={onResizeColumn}\n />\n ) : (\n <HeaderCell\n allowDragColumnHeader={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n column={col}\n index={i}\n id={`${tableId}-${col.name}`}\n key={`${col.name}-${allowDragDrop}`}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onClick={onClick}\n onResize={onResizeColumn}\n showColumnHeaderMenus={showColumnHeaderMenus}\n />\n );\n })}\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyRight\" />\n ) : null}\n </div>\n\n <DragOverlay>\n {dragColumn ? (\n <div id={dragColumn.id} className=\"DragColumn\">\n <HeaderCell\n column={dragColumn.column}\n className=\"vuuDragging\"\n id={`${tableId}-${dragColumn.id}-dragging`}\n index={-1}\n />\n </div>\n ) : null}\n </DragOverlay>\n </DragDropProvider>\n {customHeaders}\n </div>\n );\n },\n);\nTableHeader.displayName = \"TableHeader\";\n"],"names":["isValidElement","memo","useMemo","jsx","offset","cloneElement","HeaderProvider","header","useTableHeader","isNotHidden","jsxs","DragDropProvider","RestrictToHorizontalAxis","KeyboardSensor","PointerSensor","isGroupColumn","GroupHeaderCell","HeaderCell","DragOverlay"],"mappings":";;;;;;;;;;AAsCA,MAAM,eAAkB,GAAA,CAAC,CACvB,KAAAA,oBAAA,CAAe,CAAC,CAAA;AAElB,MAAM,SAAY,GAAA,gBAAA;AA0BX,MAAM,WAAc,GAAAC,UAAA;AAAA,EACzB,CAAC;AAAA,IACC,qBAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,qBAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,cAAiB,GAAA;AAAA,GACK,KAAA;AACtB,IAAA,MAAM,CAAC,aAAA,EAAe,iBAAiB,CAAA,GAAIC,cAEzC,MAAM;AACN,MAAA,MAAM,SAAS,QAAS,CAAA,MAAA;AACxB,MAAM,MAAA,aAAA,GAAgB,CACpB,SAAA,EACA,KAEA,qBAAAC,cAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAc,SAAS,KAAQ,GAAA,CAAA;AAAA,UAC/B,QAAS,EAAA,KAAA;AAAA,UACT,OAAA;AAAA,UAEA;AAAA,SAAA;AAAA,Q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OAAA;AAAA,wBACA,QAAU,EAAA,cAAA;AAAA,wBACV;AAAA,uBAAA;AAAA,sBAJK,CAAG,EAAA,GAAA,CAAI,IAAI,CAAA,CAAA,EAAI,aAAa,CAAA;AAAA,qBAKnC;AAAA,mBAEH,CAAA;AAAA,kBACA,YACC,mBAAAd,cAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAU,wCAAuC,CACpD,GAAA;AAAA;AAAA;AAAA,aACN;AAAA,4BAEAA,cAAA,CAACe,wBACE,QACC,EAAA,UAAA,mBAAAf,cAAA,CAAC,SAAI,EAAI,EAAA,UAAA,CAAW,EAAI,EAAA,SAAA,EAAU,YAChC,EAAA,QAAA,kBAAAA,cAAA;AAAA,cAACc,qBAAA;AAAA,cAAA;AAAA,gBACC,QAAQ,UAAW,CAAA,MAAA;AAAA,gBACnB,SAAU,EAAA,aAAA;AAAA,gBACV,EAAI,EAAA,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,WAAW,EAAE,CAAA,SAAA,CAAA;AAAA,gBAC/B,KAAO,EAAA,CAAA;AAAA;AAAA,aACT,EACF,IACE,IACN,EAAA;AAAA;AAAA;AAAA,OACF;AAAA,MACC;AAAA,KACH,EAAA,CAAA;AAAA;AAGN;AACA,WAAA,CAAY,WAAc,GAAA,aAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TableHeader.js","sources":["../../../../packages/vuu-table/src/table-header/TableHeader.tsx"],"sourcesContent":["import { VuuSortType } from \"@vuu-ui/vuu-protocol-types\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport {\n DragDropProvider,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n RestrictToHorizontalAxis,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ColumnDescriptor,\n ColumnMoveHandler,\n CustomHeader,\n CustomHeaderComponent,\n CustomHeaderElement,\n HeaderCellProps,\n RuntimeColumnDescriptor,\n TableColumnResizeHandler,\n TableConfig,\n TableHeadings,\n} from \"@vuu-ui/vuu-table-types\";\nimport { isGroupColumn, isNotHidden } from \"@vuu-ui/vuu-utils\";\nimport {\n cloneElement,\n FC,\n isValidElement,\n memo,\n ReactElement,\n useMemo,\n} from \"react\";\nimport {\n GroupHeaderCell,\n HeaderCell as DefaultHeaderCell,\n} from \"../header-cell\";\nimport { HeaderProvider } from \"./HeaderProvider\";\nimport { useTableHeader } from \"./useTableHeader\";\n\n// We import headercell css once here so it is available to custom\n// headercell implementations.\nimport headerCellCss from \"../header-cell/HeaderCell.css\";\n\nexport type ColumnSortHandler = (\n column: ColumnDescriptor,\n addToExistingSort: boolean,\n sortType?: VuuSortType,\n) => void;\n\nconst isHeaderElement = (h: CustomHeader): h is CustomHeaderElement =>\n isValidElement(h);\n\nconst classBase = \"vuuTableHeader\";\n\nexport interface TableHeaderProps\n extends Pick<\n HeaderCellProps,\n | \"allRowsSelected\"\n | \"allowDragColumnHeader\"\n | \"allowSelectAll\"\n | \"onCheckBoxColumnHeaderClick\"\n | \"showColumnHeaderMenus\"\n > {\n HeaderCell?: FC<HeaderCellProps>;\n columns: RuntimeColumnDescriptor[];\n customHeader?: CustomHeader | CustomHeader[];\n headings: TableHeadings;\n onHeightMeasured: (height: number, count: number) => void;\n onResizeColumn: TableColumnResizeHandler;\n onMoveColumn: ColumnMoveHandler;\n onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;\n onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;\n onSortColumn: ColumnSortHandler;\n showBookends?: boolean;\n tableConfig: TableConfig;\n tableId: string;\n virtualColSpan?: number;\n}\n\nexport const TableHeader = memo(\n ({\n HeaderCell = DefaultHeaderCell,\n allowDragColumnHeader,\n allowSelectAll,\n allRowsSelected,\n columns,\n customHeader,\n headings,\n onCheckBoxColumnHeaderClick,\n onHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onSortColumn,\n showBookends,\n showColumnHeaderMenus,\n tableConfig,\n tableId,\n virtualColSpan = 0,\n }: TableHeaderProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table-header-cell\",\n css: headerCellCss,\n window: targetWindow,\n });\n\n const [customHeaders, customHeaderCount] = useMemo<\n [ReactElement | ReactElement[] | null, number]\n >(() => {\n const offset = headings.length;\n const createElement = (\n Component: CustomHeaderComponent,\n index: number,\n ) => (\n <Component\n ariaRowIndex={offset + index + 2}\n ariaRole=\"row\"\n columns={columns}\n key={index}\n virtualColSpan={virtualColSpan}\n />\n );\n\n const enrichElementWithAria = (el: ReactElement, rowIndex: number) => {\n const offset = headings.length;\n return cloneElement(el, {\n \"aria-rowindex\": rowIndex + offset + 2,\n ariaRole: \"row\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n };\n\n if (customHeader === undefined) {\n return [null, 0];\n } else if (Array.isArray(customHeader)) {\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {customHeader.map((header, i) =>\n isHeaderElement(header)\n ? enrichElementWithAria(header, i)\n : createElement(header, i),\n )}\n </HeaderProvider>\n );\n return [header, customHeader.length];\n } else if (isHeaderElement(customHeader)) {\n // TODO rowIndex and role\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {enrichElementWithAria(customHeader, 0)}\n </HeaderProvider>\n );\n return [header, 1];\n } else {\n return [createElement(customHeader, 0), 1];\n }\n }, [columns, customHeader, headings.length, virtualColSpan]);\n\n const { dragColumn, onClick, onDragEnd, onDragStart, setContainerRef } =\n useTableHeader({\n columns,\n customHeaderCount,\n headings,\n onHeightMeasured,\n onMoveColumn,\n onSortColumn,\n tableConfig,\n });\n\n const visibleColumns = columns.filter(isNotHidden);\n\n return (\n <div className={classBase} ref={setContainerRef} role=\"rowgroup\">\n {headings.map((colHeaders, i) => (\n <div\n className=\"vuuTable-heading\"\n key={i}\n role=\"row\"\n aria-rowindex={i + 1}\n >\n {colHeaders.map(({ label, width }, j) => (\n <div key={j} className=\"vuuTable-headingCell\" style={{ width }}>\n {label}\n </div>\n ))}\n </div>\n ))}\n <DragDropProvider // whats the difference between this and DnDContext\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore typing error from dnd-kit\n modifiers={[RestrictToHorizontalAxis]}\n sensors={[\n KeyboardSensor.configure({\n keyboardCodes: {\n start: [\"Space\"],\n cancel: [\"Escape\"],\n end: [\"Space\", \"Enter\"],\n left: [\"ArrowLeft\"],\n right: [\"ArrowRight\"],\n up: [],\n down: [],\n },\n }),\n PointerSensor,\n ]}\n >\n <div\n className=\"vuuTableColHeaderRow\"\n role=\"row\"\n aria-rowindex={headings.length + 1}\n >\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyLeft\" />\n ) : null}\n\n {visibleColumns.map((col, i) => {\n const allowDragDrop =\n allowDragColumnHeader && !col.pin ? true : false;\n return isGroupColumn(col) ? (\n <GroupHeaderCell\n column={col}\n id={`${tableId}-${col.name}`}\n key={col.name}\n onMoveColumn={onMoveGroupColumn}\n onRemoveColumn={onRemoveGroupColumn}\n onResize={onResizeColumn}\n />\n ) : (\n <HeaderCell\n allowDragColumnHeader={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n column={col}\n index={i}\n id={`${tableId}-${col.name}`}\n key={`${col.name}-${allowDragDrop}`}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onClick={onClick}\n onResize={onResizeColumn}\n showColumnHeaderMenus={showColumnHeaderMenus}\n />\n );\n })}\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyRight\" />\n ) : null}\n </div>\n\n <DragOverlay>\n {dragColumn ? (\n <div id={dragColumn.id} className=\"DragColumn\">\n <HeaderCell\n column={dragColumn.column}\n className=\"vuuDragging\"\n id={`${tableId}-${dragColumn.id}-dragging`}\n index={-1}\n />\n </div>\n ) : null}\n </DragOverlay>\n </DragDropProvider>\n {customHeaders}\n </div>\n );\n },\n);\nTableHeader.displayName = \"TableHeader\";\n"],"names":["isValidElement","memo","HeaderCell","DefaultHeaderCell","useWindow","useComponentCssInjection","headerCellCss","useMemo","jsx","offset","cloneElement","HeaderProvider","header","useTableHeader","isNotHidden","jsxs","DragDropProvider","RestrictToHorizontalAxis","KeyboardSensor","PointerSensor","isGroupColumn","GroupHeaderCell","DragOverlay"],"mappings":";;;;;;;;;;;;;AAiDA,MAAM,eAAkB,GAAA,CAAC,CACvB,KAAAA,oBAAA,CAAe,CAAC,CAAA;AAElB,MAAM,SAAY,GAAA,gBAAA;AA2BX,MAAM,WAAc,GAAAC,UAAA;AAAA,EACzB,CAAC;AAAA,gBACCC,YAAa,GAAAC,uBAAA;AAAA,IACb,qBAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,qBAAA;AAAA,IACA,WAAA;AAAA,IACA,OAAA;AAAA,IACA,cAAiB,GAAA;AAAA,GACK,KAAA;AACtB,IAAA,MAAM,eAAeC,gBAAU,EAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,uBAAA;AAAA,MACR,GAAK,EAAAC,UAAA;AAAA,MACL,MAAQ,EAAA;AAAA,KACT,CAAA;AAED,IAAA,MAAM,CAAC,aAAA,EAAe,iBAAiB,CAAA,GAAIC,cAEzC,MAAM;AACN,MAAA,MAAM,SAAS,QAAS,CAAA,MAAA;AACxB,MAAM,MAAA,aAAA,GAAgB,CACpB,SAAA,EACA,KAEA,qBAAAC,cAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,YAAA,EAAc,SAAS,KAAQ,GAAA,CAAA;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O,CAAA,CAAA,EAAI,IAAI,IAAI,CAAA,CAAA;AAAA,wBAE1B,2BAAA;AAAA,wBACA,OAAA;AAAA,wBACA,QAAU,EAAA,cAAA;AAAA,wBACV;AAAA,uBAAA;AAAA,sBAJK,CAAG,EAAA,GAAA,CAAI,IAAI,CAAA,CAAA,EAAI,aAAa,CAAA;AAAA,qBAKnC;AAAA,mBAEH,CAAA;AAAA,kBACA,YACC,mBAAAM,cAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAU,wCAAuC,CACpD,GAAA;AAAA;AAAA;AAAA,aACN;AAAA,4BAEAA,cAAA,CAACc,wBACE,QACC,EAAA,UAAA,mBAAAd,cAAA,CAAC,SAAI,EAAI,EAAA,UAAA,CAAW,EAAI,EAAA,SAAA,EAAU,YAChC,EAAA,QAAA,kBAAAA,cAAA;AAAA,cAACN,YAAA;AAAA,cAAA;AAAA,gBACC,QAAQ,UAAW,CAAA,MAAA;AAAA,gBACnB,SAAU,EAAA,aAAA;AAAA,gBACV,EAAI,EAAA,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,WAAW,EAAE,CAAA,SAAA,CAAA;AAAA,gBAC/B,KAAO,EAAA,CAAA;AAAA;AAAA,aACT,EACF,IACE,IACN,EAAA;AAAA;AAAA;AAAA,OACF;AAAA,MACC;AAAA,KACH,EAAA,CAAA;AAAA;AAGN;AACA,WAAA,CAAY,WAAc,GAAA,aAAA;;;;"}
|
package/esm/Table.js
CHANGED
|
@@ -29,6 +29,7 @@ const RowProxy = forwardRef(function RowProxy2({ className = "vuuTableRow", heig
|
|
|
29
29
|
});
|
|
30
30
|
const TableCore = ({
|
|
31
31
|
EmptyDisplay,
|
|
32
|
+
HeaderCell,
|
|
32
33
|
Row: Row$1 = Row,
|
|
33
34
|
allowCellBlockSelection,
|
|
34
35
|
allowDragColumnHeader = true,
|
|
@@ -191,6 +192,7 @@ const TableCore = ({
|
|
|
191
192
|
showColumnHeaders ? /* @__PURE__ */ jsx(
|
|
192
193
|
TableHeader,
|
|
193
194
|
{
|
|
195
|
+
HeaderCell,
|
|
194
196
|
allowDragColumnHeader,
|
|
195
197
|
allowSelectAll,
|
|
196
198
|
allRowsSelected,
|
|
@@ -267,6 +269,7 @@ const TableCore = ({
|
|
|
267
269
|
};
|
|
268
270
|
const Table = forwardRef(function Table2({
|
|
269
271
|
EmptyDisplay,
|
|
272
|
+
HeaderCell,
|
|
270
273
|
Row,
|
|
271
274
|
allowCellBlockSelection,
|
|
272
275
|
allowDragColumnHeader,
|
|
@@ -401,6 +404,7 @@ const Table = forwardRef(function Table2({
|
|
|
401
404
|
TableCore,
|
|
402
405
|
{
|
|
403
406
|
EmptyDisplay,
|
|
407
|
+
HeaderCell,
|
|
404
408
|
Row,
|
|
405
409
|
allowCellBlockSelection,
|
|
406
410
|
allowDragColumnHeader,
|
package/esm/Table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sources":["../../../packages/vuu-table/src/Table.tsx"],"sourcesContent":["import { useForkRef } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport type { DataSource, SchemaColumn } from \"@vuu-ui/vuu-data-types\";\nimport { TableProvider } from \"@vuu-ui/vuu-table-extras\";\nimport {\n CustomHeader,\n DataCellEditNotification,\n GroupToggleTarget,\n RowActionHandler,\n RowProps,\n SelectionChangeHandler,\n ShowColumnHeaderMenus,\n TableConfig,\n TableConfigChangeHandler,\n TableRowClickHandler,\n TableRowSelectHandler,\n TableSelectionModel,\n} from \"@vuu-ui/vuu-table-types\";\nimport type { DragDropState } from \"@vuu-ui/vuu-ui-controls\";\nimport {\n DragStartHandler,\n MeasuredContainer,\n MeasuredContainerProps,\n MeasuredSize,\n dragStrategy,\n reduceSizeHeight,\n} from \"@vuu-ui/vuu-ui-controls\";\nimport { lowerCase, useId } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n CSSProperties,\n ComponentType,\n FC,\n ForwardedRef,\n RefObject,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Row as DefaultRow } from \"./Row\";\nimport { TableCellBlock } from \"./cell-block/cellblock-utils\";\nimport { PaginationControl } from \"./pagination\";\nimport { TableHeader } from \"./table-header\";\nimport { useMeasuredHeight } from \"./useMeasuredHeight\";\nimport { useTable } from \"./useTable\";\nimport { ScrollingAPI } from \"./useTableScroll\";\n\nimport tableCss from \"./Table.css\";\n\nconst classBase = \"vuuTable\";\n\nexport type TableNavigationStyle = \"none\" | \"cell\" | \"row\" | \"tree\";\n\n// A dummy Table Row rendered once and not visible. We measure this to\n// determine height of Row(s) and monitor it for size changes (in\n// case of runtime density switch). This allows ListItem height to\n// be controlled purely through CSS.\nconst RowProxy = forwardRef<\n HTMLDivElement,\n { className?: string; height?: number }\n>(function RowProxy({ className = \"vuuTableRow\", height }, forwardedRef) {\n return (\n <div\n aria-hidden\n className={cx(className, `vuuRowProxy`)}\n ref={forwardedRef}\n style={{ height }}\n />\n );\n});\n\nexport interface TableProps\n extends Omit<\n MeasuredContainerProps,\n \"onDragStart\" | \"onDrop\" | \"onSelect\" | \"searchPattern\"\n > {\n /**\n * A react function component that will be rendered if there are no rows to display\n */\n EmptyDisplay?: ComponentType;\n Row?: FC<RowProps>;\n /**\n * Allow a block of cells to be selected. Typically to be copied.\n */\n allowCellBlockSelection?: boolean;\n /**\n * Allow column headers to be dragged to re-arrange\n */\n allowDragColumnHeader?: boolean;\n /**\n * Allow rows to be draggable\n */\n allowDragDrop?: boolean | dragStrategy;\n\n /**\n * Allow all rows be selected, use with checkbox coliumn.\n */\n allowSelectAll?: boolean;\n\n /**\n * If checkbox selection is in effect, can user select row by clicking row. If\n * false, checkbox must be clicked explicitly.\n */\n allowSelectCheckboxRow?: boolean;\n /**\n * if provided, first row of table will be selected on initial render.\n */\n autoSelectFirstRow?: true;\n /**\n * if provided, row with matching key will be selected. If not present, will silently fail.\n */\n autoSelectRowKey?: string;\n\n /**\n * Pixel height of header cells. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n colHeaderRowHeight?: number;\n\n /**\n * Provide configuration settings for Table. At minimun, column\n * descriptors must be provided.\n */\n config: TableConfig;\n dataSource: DataSource;\n\n disableFocus?: boolean;\n /**\n * Allows additional custom element(s) to be embedded immediately below column headers.\n * Could be used to present inline filters for example.\n * Accepts either a React Element or a Function Component or an array of these. If a React\n * Function Component is used, it will be passed the props described in BaseRowProps.\n */\n customHeader?: CustomHeader | CustomHeader[];\n /**\n * When rows are grouped, user can click group row(s) to expand/collapse display of child rows.\n * This allows precise configuration of where user may click to trigger toggle/collapse. When\n * row selection is also supported, clicking outside the region specified here will select or\n * deselect the row.\n * - toggle-icon - the small toggle icon must be clicked directly\n * - group-column (default) - user can click anywhere within the group column, i.e on the icon or the column text\n */\n groupToggleTarget?: GroupToggleTarget;\n\n /**\n * Defined how focus navigation within data cells will be handled by table.\n * Default is cell.\n */\n highlightedIndex?: number;\n\n /**\n * Behaves in most respects like viewportRowLimit except that, when there are fewer\n * rows available than the limit set here, the Table height will reduce. This can be\n * useful where a Table is used in a dropdown control.\n */\n maxViewportRowLimit?: number;\n\n /**\n * Determines bahaviour of keyboard navigation , either row focused or cell focused.\n * `tree` is a specialised navigation behaviour only useful where table is being\n * used to present purely grouped data (see TreeTable)\n */\n navigationStyle?: TableNavigationStyle;\n /**\n * required if a fully featured column picker is to be available.\n * Available columns can be changed by the addition or removal of\n * one or more calculated columns.\n */\n onAvailableColumnsChange?: (columns: SchemaColumn[]) => void;\n /**\n * This callback will be invoked any time a config attribute of TableConfig\n * is changed. By persisting this value and providing it to the Table as a\n * prop, table state can be persisted across sessions.\n */\n onConfigChange?: TableConfigChangeHandler;\n\n /**\n * In a Table with editable cells, this callback will be invoked every time\n * a user performs any edit operation on an editable field.\n */\n // TODO can we scrap this and leavr it to the editTracker ?\n onDataEdited?: DataCellEditNotification;\n\n onDragStart?: DragStartHandler;\n onDrop?: (dragDropState: DragDropState) => void;\n\n onHighlight?: (idx: number) => void;\n /**\n * callback invoked when user 'clicks' a table row. CLick triggered either\n * via mouse click or keyboard (default ENTER);\n */\n onRowClick?: TableRowClickHandler;\n onSelect?: TableRowSelectHandler;\n /**\n * Triggered when a block of cells is selected. CellBlock selection can be\n * effected with either mouse or keyboard.\n * - mouse: hold down mouse and drag over selection area\n * - keyboard: press and hold shift key from start cell, then use arrow keys\n * to extend selection block.\n *\n * This callback is invoked when mouse is released or shift key released.\n */\n onSelectCellBlock?: (cellBlock: TableCellBlock) => void;\n\n onSelectionChange?: SelectionChangeHandler;\n renderBufferSize?: number;\n\n /**\n * Provide functionality for custom row actions. e.g. buttons embedded within row cells.\n * These will be available to any custom renderers via TableContext. e.g. a Row may\n * provide a 'Delete' or 'Cancel' button. Implement this functionality in a rowActionHandler.\n */\n rowActionHandlers?: Record<string, RowActionHandler>;\n\n /**\n * Allows opt-in to a predefined style pattern that renders a border around a row selection block.\n */\n rowSelectionBorder?: boolean;\n\n /**\n * Only applicable to grouped data. If there are selected rows which are not top-level\n * items and group items above are not already expanded, expand all group items in\n * the hierarchy above selected item. Selected items will thus always be visible, initially.\n * This affects items set at load time via autoSelectRowKey as well as items\n * selected programatically (ie not directly by user).\n * Nodes can of course be collapsed by user at runtime which may hide selected rows.\n * Note: this is not supported by all DataSource implementations\n */\n revealSelected?: boolean;\n /**\n * Pixel height of rows. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n rowHeight?: number;\n /**\n * imperative API for scrolling table\n */\n scrollingApiRef?: ForwardedRef<ScrollingAPI>;\n\n /**\n * If a search has been applied against data, this is the search text used.\n * Will be used to highlight matching text.\n */\n searchPattern?: string;\n /**\n * Selection behaviour for Table:\n * `none` selection disabled\n * `single` no more than one row may be selected\n * `single-no-deselect` no more than one row may be selected, one row is always selected, defaults to first visible\n * `extended` (default) multiple rows can be selected\n * `checkbox` same behaviour as extended, with checkbox column for selection\n */\n selectionModel?: TableSelectionModel;\n /**\n * if false, table rendered without headers. Useful when table is being included in a\n * composite component.\n */\n showColumnHeaders?: boolean;\n /**\n * if false, column headers will not display menu icon. If true, all available Column Menu\n * actions will be available via the menu. Alternatively, a map of specific column menu\n * permissions can be provided to allow control over which menu items are presented.\n */\n showColumnHeaderMenus?: ShowColumnHeaderMenus;\n /**\n * if true, pagination will be used to navigate data, scrollbars will not be rendered\n */\n showPaginationControls?: boolean;\n\n /**\n * As an alternative to sizing the Table height via CSS or via an explicit height value,\n * specify the number of rows to be displayed within the Viewport. The actual height\n * will then be the product of viewportRowLimit and rowHeight. Row Height will be\n * determined in the usual way, it can be specified explicitly in a prop or set via\n * CSS. If both explicit height and viewportRowLimit are provided by props, rowHeight\n * will be derived from these. Do not pass props for all three values - height,\n * rowHeight and viewportRowLimit. That will be rejected.\n * Use maxViewportRowLimit rather than viewportRowLimit if the height of the table\n * should be reduced when fewer rows are actually available than the limit specified.\n */\n viewportRowLimit?: number;\n}\n\nconst TableCore = ({\n EmptyDisplay,\n Row = DefaultRow,\n allowCellBlockSelection,\n allowDragColumnHeader = true,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n // colHeaderRowHeight,\n config,\n containerRef,\n customHeader,\n dataSource,\n disableFocus = false,\n groupToggleTarget,\n highlightedIndex: highlightedIndexProp,\n id: idProp,\n lowerCaseSearchPattern,\n navigationStyle = \"cell\",\n // onAvailableColumnsChange,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize = 0,\n revealSelected,\n rowActionHandlers,\n rowHeight,\n scrollingApiRef,\n selectionModel = \"extended\",\n showColumnHeaders = true,\n showColumnHeaderMenus = true,\n showPaginationControls,\n size,\n}: Omit<\n TableProps,\n | \"colHeaderRowHeight\"\n | \"maxViewportRowLimit\"\n | \"resizeStrategy\"\n | \"rowHeight\"\n | \"rowSelectionStyle\"\n | \"searchPattern\"\n | \"viewportRowLimit\"\n> & {\n containerRef: RefObject<HTMLDivElement | null>;\n /**\n * We lowercase this once, on entry, which is the format in which it will be used.\n */\n lowerCaseSearchPattern: Lowercase<string>;\n rowHeight: number;\n size: MeasuredSize;\n}) => {\n const id = useId(idProp);\n const {\n allRowsSelected,\n cellBlock,\n columns,\n dataRows,\n draggableRow,\n focusCellPlaceholderKeyDown,\n focusCellPlaceholderRef,\n getRowOffset,\n handleColumnAction,\n headerState: { height: headerHeight, count: headerCount },\n headings,\n highlightedIndex,\n onCheckBoxColumnHeaderClick,\n onDataEdited,\n onHeaderHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onRowClick,\n onSortColumn,\n onToggleGroup,\n rowClassNameGenerator,\n scrollProps,\n tableAttributes,\n tableBodyRef,\n tableConfig,\n viewportMeasurements,\n ...tableProps\n } = useTable({\n allowCellBlockSelection,\n allowDragDrop,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n config,\n containerRef,\n dataSource,\n disableFocus,\n highlightedIndex: highlightedIndexProp,\n id,\n navigationStyle,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n rowHeight,\n scrollingApiRef,\n selectionModel,\n showColumnHeaders,\n showPaginationControls,\n size,\n });\n\n const { selectionBookendWidth = 4 } = config;\n\n const contentContainerClassName = cx(`${classBase}-contentContainer`, {\n [`${classBase}-colLines`]: tableAttributes.columnSeparators,\n [`${classBase}-rowLines`]: tableAttributes.rowSeparators,\n [`${classBase}-zebra`]: tableAttributes.zebraStripes,\n });\n\n const cssScrollbarSize = {\n \"--horizontal-scrollbar-height\": `${viewportMeasurements.horizontalScrollbarHeight}px`,\n \"--vertical-scrollbar-width\": `${viewportMeasurements.verticalScrollbarWidth}px`,\n } as CSSProperties;\n\n const cssVariables = {\n ...cssScrollbarSize,\n \"--content-height\": `${viewportMeasurements.contentHeight}px`,\n \"--content-width\": `${viewportMeasurements.contentWidth}px`,\n \"--pinned-width-left\": `${viewportMeasurements.pinnedWidthLeft}px`,\n \"--pinned-width-right\": `${viewportMeasurements.pinnedWidthRight}px`,\n \"--total-header-height\": `${headerHeight}px`,\n \"--viewport-body-height\": `${viewportMeasurements.viewportBodyHeight}px`,\n \"--table-selection-bookend-width\": `${selectionBookendWidth}px`,\n } as CSSProperties;\n\n const headersReady = showColumnHeaders === false || headerHeight > 0;\n const readyToRenderTableBody = headersReady && dataRows.length > 0;\n\n return (\n <TableProvider\n dataSource={dataSource}\n menuActionHandler={handleColumnAction}\n rowActionHandlers={rowActionHandlers}\n >\n {showPaginationControls !== true ? (\n <div\n className={`${classBase}-scrollbarContainer`}\n ref={scrollProps.scrollbarContainerRef}\n style={cssVariables}\n tabIndex={-1}\n >\n <div className={`${classBase}-scrollbarContent`} />\n </div>\n ) : null}\n\n {dataSource.size === 0 && EmptyDisplay ? (\n <div className={`${classBase}-emptyDisplay`}>\n <EmptyDisplay />{\" \"}\n </div>\n ) : null}\n\n <div\n className={contentContainerClassName}\n ref={scrollProps.contentContainerRef}\n style={cssVariables}\n >\n <div\n {...tableProps}\n className={`${classBase}-table`}\n role=\"table\"\n tabIndex={disableFocus ? undefined : -1}\n >\n {showColumnHeaders ? (\n <TableHeader\n allowDragColumnHeader={allowDragColumnHeader}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n // columns={scrollProps.columnsWithinViewport}\n columns={columns}\n customHeader={customHeader}\n headings={headings}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onHeightMeasured={onHeaderHeightMeasured}\n onMoveColumn={onMoveColumn}\n onMoveGroupColumn={onMoveGroupColumn}\n onRemoveGroupColumn={onRemoveGroupColumn}\n onResizeColumn={onResizeColumn}\n onSortColumn={onSortColumn}\n showBookends={selectionBookendWidth > 0}\n showColumnHeaderMenus={showColumnHeaderMenus}\n tableConfig={tableConfig}\n tableId={id}\n virtualColSpan={scrollProps.virtualColSpan}\n />\n ) : null}\n {readyToRenderTableBody ? (\n <div className={`${classBase}-body`} ref={tableBodyRef}>\n {dataRows.map((dataRow) => {\n const ariaRowIndex = dataRow.index + headerCount + 1;\n return (\n <Row\n aria-rowindex={ariaRowIndex}\n classNameGenerator={rowClassNameGenerator}\n columns={scrollProps.columnsWithinViewport}\n // This is used for styling selection only.\n data-first-row={dataRow.index === 0 ? \"true\" : undefined}\n dataRow={dataRow}\n groupToggleTarget={groupToggleTarget}\n highlighted={highlightedIndex === ariaRowIndex}\n key={dataRow.renderIndex}\n onClick={onRowClick}\n onDataEdited={onDataEdited}\n offset={showPaginationControls ? 0 : getRowOffset(dataRow)}\n onToggleGroup={onToggleGroup}\n showBookends={selectionBookendWidth > 0}\n searchPattern={lowerCaseSearchPattern}\n virtualColSpan={scrollProps.virtualColSpan}\n zebraStripes={tableAttributes.zebraStripes}\n />\n );\n })}\n {/* \n The focusCellPlaceholder allows us to deal with the situation where a cell \n that has focus is scrolled out of the viewport. That cell, along with the \n containing row, will be recycled to render another DataRow. The html table \n cell must not retain focus once it is re-used but we need to track the \n original focus, in case user uses arrow key to resume navigation. \n The placeholder is fixed in place at the location where the focused cell \n was last rendered. It assumes focus. If we get an arrowkey mousedown event \n on the placeholder, the user has resumed navigation whilst the focused cell \n is offscreen. We scroll back to the focus location and pass focus back to \n the correct target cell.\n */}\n <div\n aria-hidden={true}\n className={`${classBase}-focusCellPlaceholder`}\n onKeyDown={focusCellPlaceholderKeyDown}\n ref={focusCellPlaceholderRef}\n tabIndex={-1}\n />\n\n {cellBlock}\n </div>\n ) : null}\n </div>\n </div>\n {/* \n This keeps the heights of content container and scrollbar container aligned for\n cases where we rely on height: fit-content. (ScrollbarContainer isn't taken into \n account because its absolutely positioned).\n */}\n <div\n className={`${classBase}-scrollbarFiller`}\n style={cssScrollbarSize}\n />\n {draggableRow}\n </TableProvider>\n );\n};\n\nexport const Table = forwardRef(function Table(\n {\n EmptyDisplay,\n Row,\n allowCellBlockSelection,\n allowDragColumnHeader,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n className: classNameProp,\n config,\n customHeader,\n dataSource,\n disableFocus,\n groupToggleTarget,\n colHeaderRowHeight: colHeaderRowHeightProp,\n height,\n highlightedIndex,\n id,\n maxViewportRowLimit,\n navigationStyle,\n onAvailableColumnsChange,\n onConfigChange,\n onDataEdited,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n resizeStrategy,\n rowActionHandlers,\n rowHeight: rowHeightProp,\n rowSelectionBorder,\n scrollingApiRef,\n searchPattern = \"\",\n selectionModel,\n showColumnHeaders,\n showColumnHeaderMenus,\n showPaginationControls,\n style: styleProp,\n viewportRowLimit,\n width,\n ...htmlAttributes\n }: TableProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table\",\n css: tableCss,\n window: targetWindow,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [size, _setSize] = useState<MeasuredSize>();\n\n const { measuredHeight: rowHeight, measuredRef: rowRef } = useMeasuredHeight({\n height: rowHeightProp,\n });\n\n console.log(\n `[Table] measured row height ${rowHeight}, rowHeightProp ${rowHeightProp}`,\n );\n\n const { measuredHeight: footerHeight, measuredRef: footerRef } =\n useMeasuredHeight({});\n\n const rowLimit = maxViewportRowLimit ?? viewportRowLimit;\n\n if (config === undefined) {\n throw Error(\n \"vuu Table requires config prop. Minimum config is list of Column Descriptors\",\n );\n }\n if (dataSource === undefined) {\n throw Error(\"vuu Table requires dataSource prop\");\n }\n\n if (showPaginationControls && renderBufferSize !== undefined) {\n console.warn(\n `Table: When pagination controls are used, renderBufferSize is ignored`,\n );\n }\n\n if (rowLimit && height && rowHeightProp) {\n console.warn(\n `Table: when viewportRowLimit, rowHeight and height are used in combination, height is ignored`,\n );\n height = rowLimit * rowHeightProp;\n } else if (rowLimit && rowHeightProp) {\n height = rowLimit * rowHeightProp;\n } else if (rowLimit) {\n height = rowLimit * rowHeight;\n }\n\n const sizeRef = useRef<MeasuredSize>(undefined);\n const setSize = useCallback(\n (size: MeasuredSize) => {\n if (viewportRowLimit && !rowHeight) {\n sizeRef.current = size;\n } else if (\n size.height !== sizeRef.current?.height ||\n size.width !== sizeRef.current?.width\n ) {\n _setSize(size);\n }\n },\n [rowHeight, viewportRowLimit],\n );\n useMemo(() => {\n if (sizeRef.current && rowHeight) {\n const size = {\n ...sizeRef.current,\n height: rowHeight * (viewportRowLimit as number),\n };\n sizeRef.current = size;\n _setSize(size);\n }\n }, [rowHeight, viewportRowLimit]);\n\n // TODO render TableHeader here and measure before row construction begins\n // TODO we could have MeasuredContainer render a Provider and make size available via a context hook ?\n return (\n <MeasuredContainer\n {...htmlAttributes}\n className={cx(classBase, classNameProp, {\n [`${classBase}-pagination`]: showPaginationControls,\n [`${classBase}-rowSelection-bordered`]: rowSelectionBorder,\n [`${classBase}-maxViewportRowLimit`]: maxViewportRowLimit,\n [`${classBase}-viewportRowLimit`]: viewportRowLimit,\n })}\n height={height}\n id={id}\n onResize={setSize}\n ref={useForkRef(containerRef, forwardedRef)}\n resizeStrategy={resizeStrategy}\n style={\n {\n ...styleProp,\n \"--col-header-row-height-prop\":\n typeof colHeaderRowHeightProp === \"number\"\n ? `${colHeaderRowHeightProp}px`\n : undefined,\n \"--row-height-prop\":\n typeof rowHeightProp === \"number\"\n ? `${rowHeightProp}px`\n : undefined,\n } as CSSProperties\n }\n width={width}\n >\n <RowProxy ref={rowRef} height={rowHeightProp} />\n {size &&\n rowHeight &&\n (footerHeight || showPaginationControls !== true) ? (\n <TableCore\n EmptyDisplay={EmptyDisplay}\n Row={Row}\n allowCellBlockSelection={allowCellBlockSelection}\n allowDragColumnHeader={allowDragColumnHeader}\n allowDragDrop={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allowSelectCheckboxRow={allowSelectCheckboxRow}\n autoSelectFirstRow={autoSelectFirstRow}\n autoSelectRowKey={autoSelectRowKey}\n config={config}\n containerRef={containerRef}\n customHeader={customHeader}\n dataSource={dataSource}\n disableFocus={disableFocus}\n groupToggleTarget={groupToggleTarget}\n highlightedIndex={highlightedIndex}\n id={id}\n navigationStyle={navigationStyle}\n onAvailableColumnsChange={onAvailableColumnsChange}\n onConfigChange={onConfigChange}\n onDataEdited={onDataEdited}\n onDragStart={onDragStart}\n onDrop={onDrop}\n onHighlight={onHighlight}\n onRowClick={onRowClick}\n onSelect={onSelect}\n onSelectCellBlock={onSelectCellBlock}\n onSelectionChange={onSelectionChange}\n renderBufferSize={\n showPaginationControls ? 0 : Math.max(5, renderBufferSize ?? 0)\n }\n revealSelected={revealSelected}\n rowActionHandlers={rowActionHandlers}\n rowHeight={rowHeight}\n scrollingApiRef={scrollingApiRef}\n lowerCaseSearchPattern={lowerCase(searchPattern)}\n selectionModel={selectionModel}\n showColumnHeaders={showColumnHeaders}\n showColumnHeaderMenus={showColumnHeaderMenus}\n showPaginationControls={showPaginationControls}\n size={reduceSizeHeight(size, footerHeight)}\n />\n ) : null}\n {showPaginationControls ? (\n <div className={`${classBase}-footer`} ref={footerRef}>\n <PaginationControl dataSource={dataSource} />\n </div>\n ) : null}\n </MeasuredContainer>\n );\n});\n"],"names":["RowProxy","Row","DefaultRow","Table","size"],"mappings":";;;;;;;;;;;;;;;;;AAoDA,MAAM,SAAY,GAAA,UAAA;AAQlB,MAAM,QAAA,GAAW,WAGf,SAASA,SAAAA,CAAS,EAAE,SAAY,GAAA,aAAA,EAAe,MAAO,EAAA,EAAG,YAAc,EAAA;AACvE,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAW,EAAA,IAAA;AAAA,MACX,SAA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A;AAAA,YACA,EAAA;AAAA,YACA,eAAA;AAAA,YACA,wBAAA;AAAA,YACA,cAAA;AAAA,YACA,YAAA;AAAA,YACA,WAAA;AAAA,YACA,MAAA;AAAA,YACA,WAAA;AAAA,YACA,UAAA;AAAA,YACA,QAAA;AAAA,YACA,iBAAA;AAAA,YACA,iBAAA;AAAA,YACA,kBACE,sBAAyB,GAAA,CAAA,GAAI,KAAK,GAAI,CAAA,CAAA,EAAG,oBAAoB,CAAC,CAAA;AAAA,YAEhE,cAAA;AAAA,YACA,iBAAA;AAAA,YACA,SAAA;AAAA,YACA,eAAA;AAAA,YACA,sBAAA,EAAwB,UAAU,aAAa,CAAA;AAAA,YAC/C,cAAA;AAAA,YACA,iBAAA;AAAA,YACA,qBAAA;AAAA,YACA,sBAAA;AAAA,YACA,IAAA,EAAM,gBAAiB,CAAA,IAAA,EAAM,YAAY;AAAA;AAAA,SAEzC,GAAA,IAAA;AAAA,QACH,sBACC,mBAAA,GAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,CAAG,EAAA,SAAS,CAAW,OAAA,CAAA,EAAA,GAAA,EAAK,SAC1C,EAAA,QAAA,kBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,UAAA,EAAwB,GAC7C,CACE,GAAA;AAAA;AAAA;AAAA,GACN;AAEJ,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Table.js","sources":["../../../packages/vuu-table/src/Table.tsx"],"sourcesContent":["import { useForkRef } from \"@salt-ds/core\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport type { DataSource, SchemaColumn } from \"@vuu-ui/vuu-data-types\";\nimport { TableProvider } from \"@vuu-ui/vuu-table-extras\";\nimport {\n CustomHeader,\n DataCellEditNotification,\n GroupToggleTarget,\n HeaderCellProps,\n RowActionHandler,\n RowProps,\n SelectionChangeHandler,\n ShowColumnHeaderMenus,\n TableConfig,\n TableConfigChangeHandler,\n TableRowClickHandler,\n TableRowSelectHandler,\n TableSelectionModel,\n} from \"@vuu-ui/vuu-table-types\";\nimport type { DragDropState } from \"@vuu-ui/vuu-ui-controls\";\nimport {\n DragStartHandler,\n MeasuredContainer,\n MeasuredContainerProps,\n MeasuredSize,\n dragStrategy,\n reduceSizeHeight,\n} from \"@vuu-ui/vuu-ui-controls\";\nimport { lowerCase, useId } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n CSSProperties,\n ComponentType,\n FC,\n ForwardedRef,\n RefObject,\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Row as DefaultRow } from \"./Row\";\nimport { TableCellBlock } from \"./cell-block/cellblock-utils\";\nimport { PaginationControl } from \"./pagination\";\nimport { TableHeader } from \"./table-header\";\nimport { useMeasuredHeight } from \"./useMeasuredHeight\";\nimport { useTable } from \"./useTable\";\nimport { ScrollingAPI } from \"./useTableScroll\";\n\nimport tableCss from \"./Table.css\";\n\nconst classBase = \"vuuTable\";\n\nexport type TableNavigationStyle = \"none\" | \"cell\" | \"row\" | \"tree\";\n\n// A dummy Table Row rendered once and not visible. We measure this to\n// determine height of Row(s) and monitor it for size changes (in\n// case of runtime density switch). This allows ListItem height to\n// be controlled purely through CSS.\nconst RowProxy = forwardRef<\n HTMLDivElement,\n { className?: string; height?: number }\n>(function RowProxy({ className = \"vuuTableRow\", height }, forwardedRef) {\n return (\n <div\n aria-hidden\n className={cx(className, `vuuRowProxy`)}\n ref={forwardedRef}\n style={{ height }}\n />\n );\n});\n\nexport interface TableProps\n extends Omit<\n MeasuredContainerProps,\n \"onDragStart\" | \"onDrop\" | \"onSelect\" | \"searchPattern\"\n > {\n /**\n * A react function component that will be rendered if there are no rows to display\n */\n EmptyDisplay?: ComponentType;\n /**\n * A custom implementation of HeaderCell which will be rendered in place of the\n * default HeaderCell. If provided, custom implementation is responsible for all\n * header behaviour (if required) - sorting, resizing etc.\n */\n HeaderCell?: FC<HeaderCellProps>;\n /**\n * A custom Row implementation that will be rendered in place of the default\n * Row.\n */\n Row?: FC<RowProps>;\n /**\n * Allow a block of cells to be selected. Typically to be copied.\n */\n allowCellBlockSelection?: boolean;\n /**\n * Allow column headers to be dragged to re-arrange\n */\n allowDragColumnHeader?: boolean;\n /**\n * Allow rows to be draggable\n */\n allowDragDrop?: boolean | dragStrategy;\n\n /**\n * Allow all rows be selected, use with checkbox coliumn.\n */\n allowSelectAll?: boolean;\n\n /**\n * If checkbox selection is in effect, can user select row by clicking row. If\n * false, checkbox must be clicked explicitly.\n */\n allowSelectCheckboxRow?: boolean;\n /**\n * if provided, first row of table will be selected on initial render.\n */\n autoSelectFirstRow?: true;\n /**\n * if provided, row with matching key will be selected. If not present, will silently fail.\n */\n autoSelectRowKey?: string;\n\n /**\n * Pixel height of header cells. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n colHeaderRowHeight?: number;\n\n /**\n * Provide configuration settings for Table. At minimun, column\n * descriptors must be provided.\n */\n config: TableConfig;\n dataSource: DataSource;\n\n disableFocus?: boolean;\n /**\n * Allows additional custom element(s) to be embedded immediately below column headers.\n * Could be used to present inline filters for example.\n * Accepts either a React Element or a Function Component or an array of these. If a React\n * Function Component is used, it will be passed the props described in BaseRowProps.\n */\n customHeader?: CustomHeader | CustomHeader[];\n /**\n * When rows are grouped, user can click group row(s) to expand/collapse display of child rows.\n * This allows precise configuration of where user may click to trigger toggle/collapse. When\n * row selection is also supported, clicking outside the region specified here will select or\n * deselect the row.\n * - toggle-icon - the small toggle icon must be clicked directly\n * - group-column (default) - user can click anywhere within the group column, i.e on the icon or the column text\n */\n groupToggleTarget?: GroupToggleTarget;\n\n /**\n * Defined how focus navigation within data cells will be handled by table.\n * Default is cell.\n */\n highlightedIndex?: number;\n\n /**\n * Behaves in most respects like viewportRowLimit except that, when there are fewer\n * rows available than the limit set here, the Table height will reduce. This can be\n * useful where a Table is used in a dropdown control.\n */\n maxViewportRowLimit?: number;\n\n /**\n * Determines bahaviour of keyboard navigation , either row focused or cell focused.\n * `tree` is a specialised navigation behaviour only useful where table is being\n * used to present purely grouped data (see TreeTable)\n */\n navigationStyle?: TableNavigationStyle;\n /**\n * required if a fully featured column picker is to be available.\n * Available columns can be changed by the addition or removal of\n * one or more calculated columns.\n */\n onAvailableColumnsChange?: (columns: SchemaColumn[]) => void;\n /**\n * This callback will be invoked any time a config attribute of TableConfig\n * is changed. By persisting this value and providing it to the Table as a\n * prop, table state can be persisted across sessions.\n */\n onConfigChange?: TableConfigChangeHandler;\n\n /**\n * In a Table with editable cells, this callback will be invoked every time\n * a user performs any edit operation on an editable field.\n */\n // TODO can we scrap this and leavr it to the editTracker ?\n onDataEdited?: DataCellEditNotification;\n\n onDragStart?: DragStartHandler;\n onDrop?: (dragDropState: DragDropState) => void;\n\n onHighlight?: (idx: number) => void;\n /**\n * callback invoked when user 'clicks' a table row. CLick triggered either\n * via mouse click or keyboard (default ENTER);\n */\n onRowClick?: TableRowClickHandler;\n onSelect?: TableRowSelectHandler;\n /**\n * Triggered when a block of cells is selected. CellBlock selection can be\n * effected with either mouse or keyboard.\n * - mouse: hold down mouse and drag over selection area\n * - keyboard: press and hold shift key from start cell, then use arrow keys\n * to extend selection block.\n *\n * This callback is invoked when mouse is released or shift key released.\n */\n onSelectCellBlock?: (cellBlock: TableCellBlock) => void;\n\n onSelectionChange?: SelectionChangeHandler;\n renderBufferSize?: number;\n\n /**\n * Provide functionality for custom row actions. e.g. buttons embedded within row cells.\n * These will be available to any custom renderers via TableContext. e.g. a Row may\n * provide a 'Delete' or 'Cancel' button. Implement this functionality in a rowActionHandler.\n */\n rowActionHandlers?: Record<string, RowActionHandler>;\n\n /**\n * Allows opt-in to a predefined style pattern that renders a border around a row selection block.\n */\n rowSelectionBorder?: boolean;\n\n /**\n * Only applicable to grouped data. If there are selected rows which are not top-level\n * items and group items above are not already expanded, expand all group items in\n * the hierarchy above selected item. Selected items will thus always be visible, initially.\n * This affects items set at load time via autoSelectRowKey as well as items\n * selected programatically (ie not directly by user).\n * Nodes can of course be collapsed by user at runtime which may hide selected rows.\n * Note: this is not supported by all DataSource implementations\n */\n revealSelected?: boolean;\n /**\n * Pixel height of rows. If specified here, this will take precedence over CSS\n * values and Table will not respond to density changes.\n */\n rowHeight?: number;\n /**\n * imperative API for scrolling table\n */\n scrollingApiRef?: ForwardedRef<ScrollingAPI>;\n\n /**\n * If a search has been applied against data, this is the search text used.\n * Will be used to highlight matching text.\n */\n searchPattern?: string;\n /**\n * Selection behaviour for Table:\n * `none` selection disabled\n * `single` no more than one row may be selected\n * `single-no-deselect` no more than one row may be selected, one row is always selected, defaults to first visible\n * `extended` (default) multiple rows can be selected\n * `checkbox` same behaviour as extended, with checkbox column for selection\n */\n selectionModel?: TableSelectionModel;\n /**\n * if false, table rendered without headers. Useful when table is being included in a\n * composite component.\n */\n showColumnHeaders?: boolean;\n /**\n * if false, column headers will not display menu icon. If true, all available Column Menu\n * actions will be available via the menu. Alternatively, a map of specific column menu\n * permissions can be provided to allow control over which menu items are presented.\n */\n showColumnHeaderMenus?: ShowColumnHeaderMenus;\n /**\n * if true, pagination will be used to navigate data, scrollbars will not be rendered\n */\n showPaginationControls?: boolean;\n\n /**\n * As an alternative to sizing the Table height via CSS or via an explicit height value,\n * specify the number of rows to be displayed within the Viewport. The actual height\n * will then be the product of viewportRowLimit and rowHeight. Row Height will be\n * determined in the usual way, it can be specified explicitly in a prop or set via\n * CSS. If both explicit height and viewportRowLimit are provided by props, rowHeight\n * will be derived from these. Do not pass props for all three values - height,\n * rowHeight and viewportRowLimit. That will be rejected.\n * Use maxViewportRowLimit rather than viewportRowLimit if the height of the table\n * should be reduced when fewer rows are actually available than the limit specified.\n */\n viewportRowLimit?: number;\n}\n\nconst TableCore = ({\n EmptyDisplay,\n HeaderCell,\n Row = DefaultRow,\n allowCellBlockSelection,\n allowDragColumnHeader = true,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n // colHeaderRowHeight,\n config,\n containerRef,\n customHeader,\n dataSource,\n disableFocus = false,\n groupToggleTarget,\n highlightedIndex: highlightedIndexProp,\n id: idProp,\n lowerCaseSearchPattern,\n navigationStyle = \"cell\",\n // onAvailableColumnsChange,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize = 0,\n revealSelected,\n rowActionHandlers,\n rowHeight,\n scrollingApiRef,\n selectionModel = \"extended\",\n showColumnHeaders = true,\n showColumnHeaderMenus = true,\n showPaginationControls,\n size,\n}: Omit<\n TableProps,\n | \"colHeaderRowHeight\"\n | \"maxViewportRowLimit\"\n | \"resizeStrategy\"\n | \"rowHeight\"\n | \"rowSelectionStyle\"\n | \"searchPattern\"\n | \"viewportRowLimit\"\n> & {\n containerRef: RefObject<HTMLDivElement | null>;\n /**\n * We lowercase this once, on entry, which is the format in which it will be used.\n */\n lowerCaseSearchPattern: Lowercase<string>;\n rowHeight: number;\n size: MeasuredSize;\n}) => {\n const id = useId(idProp);\n const {\n allRowsSelected,\n cellBlock,\n columns,\n dataRows,\n draggableRow,\n focusCellPlaceholderKeyDown,\n focusCellPlaceholderRef,\n getRowOffset,\n handleColumnAction,\n headerState: { height: headerHeight, count: headerCount },\n headings,\n highlightedIndex,\n onCheckBoxColumnHeaderClick,\n onDataEdited,\n onHeaderHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onRowClick,\n onSortColumn,\n onToggleGroup,\n rowClassNameGenerator,\n scrollProps,\n tableAttributes,\n tableBodyRef,\n tableConfig,\n viewportMeasurements,\n ...tableProps\n } = useTable({\n allowCellBlockSelection,\n allowDragDrop,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n config,\n containerRef,\n dataSource,\n disableFocus,\n highlightedIndex: highlightedIndexProp,\n id,\n navigationStyle,\n onConfigChange,\n onDataEdited: onDataEditedProp,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick: onRowClickProp,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n rowHeight,\n scrollingApiRef,\n selectionModel,\n showColumnHeaders,\n showPaginationControls,\n size,\n });\n\n const { selectionBookendWidth = 4 } = config;\n\n const contentContainerClassName = cx(`${classBase}-contentContainer`, {\n [`${classBase}-colLines`]: tableAttributes.columnSeparators,\n [`${classBase}-rowLines`]: tableAttributes.rowSeparators,\n [`${classBase}-zebra`]: tableAttributes.zebraStripes,\n });\n\n const cssScrollbarSize = {\n \"--horizontal-scrollbar-height\": `${viewportMeasurements.horizontalScrollbarHeight}px`,\n \"--vertical-scrollbar-width\": `${viewportMeasurements.verticalScrollbarWidth}px`,\n } as CSSProperties;\n\n const cssVariables = {\n ...cssScrollbarSize,\n \"--content-height\": `${viewportMeasurements.contentHeight}px`,\n \"--content-width\": `${viewportMeasurements.contentWidth}px`,\n \"--pinned-width-left\": `${viewportMeasurements.pinnedWidthLeft}px`,\n \"--pinned-width-right\": `${viewportMeasurements.pinnedWidthRight}px`,\n \"--total-header-height\": `${headerHeight}px`,\n \"--viewport-body-height\": `${viewportMeasurements.viewportBodyHeight}px`,\n \"--table-selection-bookend-width\": `${selectionBookendWidth}px`,\n } as CSSProperties;\n\n const headersReady = showColumnHeaders === false || headerHeight > 0;\n const readyToRenderTableBody = headersReady && dataRows.length > 0;\n\n return (\n <TableProvider\n dataSource={dataSource}\n menuActionHandler={handleColumnAction}\n rowActionHandlers={rowActionHandlers}\n >\n {showPaginationControls !== true ? (\n <div\n className={`${classBase}-scrollbarContainer`}\n ref={scrollProps.scrollbarContainerRef}\n style={cssVariables}\n tabIndex={-1}\n >\n <div className={`${classBase}-scrollbarContent`} />\n </div>\n ) : null}\n\n {dataSource.size === 0 && EmptyDisplay ? (\n <div className={`${classBase}-emptyDisplay`}>\n <EmptyDisplay />{\" \"}\n </div>\n ) : null}\n\n <div\n className={contentContainerClassName}\n ref={scrollProps.contentContainerRef}\n style={cssVariables}\n >\n <div\n {...tableProps}\n className={`${classBase}-table`}\n role=\"table\"\n tabIndex={disableFocus ? undefined : -1}\n >\n {showColumnHeaders ? (\n <TableHeader\n HeaderCell={HeaderCell}\n allowDragColumnHeader={allowDragColumnHeader}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n // columns={scrollProps.columnsWithinViewport}\n columns={columns}\n customHeader={customHeader}\n headings={headings}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onHeightMeasured={onHeaderHeightMeasured}\n onMoveColumn={onMoveColumn}\n onMoveGroupColumn={onMoveGroupColumn}\n onRemoveGroupColumn={onRemoveGroupColumn}\n onResizeColumn={onResizeColumn}\n onSortColumn={onSortColumn}\n showBookends={selectionBookendWidth > 0}\n showColumnHeaderMenus={showColumnHeaderMenus}\n tableConfig={tableConfig}\n tableId={id}\n virtualColSpan={scrollProps.virtualColSpan}\n />\n ) : null}\n {readyToRenderTableBody ? (\n <div className={`${classBase}-body`} ref={tableBodyRef}>\n {dataRows.map((dataRow) => {\n const ariaRowIndex = dataRow.index + headerCount + 1;\n return (\n <Row\n aria-rowindex={ariaRowIndex}\n classNameGenerator={rowClassNameGenerator}\n columns={scrollProps.columnsWithinViewport}\n // This is used for styling selection only.\n data-first-row={dataRow.index === 0 ? \"true\" : undefined}\n dataRow={dataRow}\n groupToggleTarget={groupToggleTarget}\n highlighted={highlightedIndex === ariaRowIndex}\n key={dataRow.renderIndex}\n onClick={onRowClick}\n onDataEdited={onDataEdited}\n offset={showPaginationControls ? 0 : getRowOffset(dataRow)}\n onToggleGroup={onToggleGroup}\n showBookends={selectionBookendWidth > 0}\n searchPattern={lowerCaseSearchPattern}\n virtualColSpan={scrollProps.virtualColSpan}\n zebraStripes={tableAttributes.zebraStripes}\n />\n );\n })}\n {/* \n The focusCellPlaceholder allows us to deal with the situation where a cell \n that has focus is scrolled out of the viewport. That cell, along with the \n containing row, will be recycled to render another DataRow. The html table \n cell must not retain focus once it is re-used but we need to track the \n original focus, in case user uses arrow key to resume navigation. \n The placeholder is fixed in place at the location where the focused cell \n was last rendered. It assumes focus. If we get an arrowkey mousedown event \n on the placeholder, the user has resumed navigation whilst the focused cell \n is offscreen. We scroll back to the focus location and pass focus back to \n the correct target cell.\n */}\n <div\n aria-hidden={true}\n className={`${classBase}-focusCellPlaceholder`}\n onKeyDown={focusCellPlaceholderKeyDown}\n ref={focusCellPlaceholderRef}\n tabIndex={-1}\n />\n\n {cellBlock}\n </div>\n ) : null}\n </div>\n </div>\n {/* \n This keeps the heights of content container and scrollbar container aligned for\n cases where we rely on height: fit-content. (ScrollbarContainer isn't taken into \n account because its absolutely positioned).\n */}\n <div\n className={`${classBase}-scrollbarFiller`}\n style={cssScrollbarSize}\n />\n {draggableRow}\n </TableProvider>\n );\n};\n\nexport const Table = forwardRef(function Table(\n {\n EmptyDisplay,\n HeaderCell,\n Row,\n allowCellBlockSelection,\n allowDragColumnHeader,\n allowDragDrop,\n allowSelectAll,\n allowSelectCheckboxRow,\n autoSelectFirstRow,\n autoSelectRowKey,\n className: classNameProp,\n config,\n customHeader,\n dataSource,\n disableFocus,\n groupToggleTarget,\n colHeaderRowHeight: colHeaderRowHeightProp,\n height,\n highlightedIndex,\n id,\n maxViewportRowLimit,\n navigationStyle,\n onAvailableColumnsChange,\n onConfigChange,\n onDataEdited,\n onDragStart,\n onDrop,\n onHighlight,\n onRowClick,\n onSelect,\n onSelectCellBlock,\n onSelectionChange,\n renderBufferSize,\n revealSelected,\n resizeStrategy,\n rowActionHandlers,\n rowHeight: rowHeightProp,\n rowSelectionBorder,\n scrollingApiRef,\n searchPattern = \"\",\n selectionModel,\n showColumnHeaders,\n showColumnHeaderMenus,\n showPaginationControls,\n style: styleProp,\n viewportRowLimit,\n width,\n ...htmlAttributes\n }: TableProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table\",\n css: tableCss,\n window: targetWindow,\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n\n const [size, _setSize] = useState<MeasuredSize>();\n\n const { measuredHeight: rowHeight, measuredRef: rowRef } = useMeasuredHeight({\n height: rowHeightProp,\n });\n\n console.log(\n `[Table] measured row height ${rowHeight}, rowHeightProp ${rowHeightProp}`,\n );\n\n const { measuredHeight: footerHeight, measuredRef: footerRef } =\n useMeasuredHeight({});\n\n const rowLimit = maxViewportRowLimit ?? viewportRowLimit;\n\n if (config === undefined) {\n throw Error(\n \"vuu Table requires config prop. Minimum config is list of Column Descriptors\",\n );\n }\n if (dataSource === undefined) {\n throw Error(\"vuu Table requires dataSource prop\");\n }\n\n if (showPaginationControls && renderBufferSize !== undefined) {\n console.warn(\n `Table: When pagination controls are used, renderBufferSize is ignored`,\n );\n }\n\n if (rowLimit && height && rowHeightProp) {\n console.warn(\n `Table: when viewportRowLimit, rowHeight and height are used in combination, height is ignored`,\n );\n height = rowLimit * rowHeightProp;\n } else if (rowLimit && rowHeightProp) {\n height = rowLimit * rowHeightProp;\n } else if (rowLimit) {\n height = rowLimit * rowHeight;\n }\n\n const sizeRef = useRef<MeasuredSize>(undefined);\n const setSize = useCallback(\n (size: MeasuredSize) => {\n if (viewportRowLimit && !rowHeight) {\n sizeRef.current = size;\n } else if (\n size.height !== sizeRef.current?.height ||\n size.width !== sizeRef.current?.width\n ) {\n _setSize(size);\n }\n },\n [rowHeight, viewportRowLimit],\n );\n useMemo(() => {\n if (sizeRef.current && rowHeight) {\n const size = {\n ...sizeRef.current,\n height: rowHeight * (viewportRowLimit as number),\n };\n sizeRef.current = size;\n _setSize(size);\n }\n }, [rowHeight, viewportRowLimit]);\n\n // TODO render TableHeader here and measure before row construction begins\n // TODO we could have MeasuredContainer render a Provider and make size available via a context hook ?\n return (\n <MeasuredContainer\n {...htmlAttributes}\n className={cx(classBase, classNameProp, {\n [`${classBase}-pagination`]: showPaginationControls,\n [`${classBase}-rowSelection-bordered`]: rowSelectionBorder,\n [`${classBase}-maxViewportRowLimit`]: maxViewportRowLimit,\n [`${classBase}-viewportRowLimit`]: viewportRowLimit,\n })}\n height={height}\n id={id}\n onResize={setSize}\n ref={useForkRef(containerRef, forwardedRef)}\n resizeStrategy={resizeStrategy}\n style={\n {\n ...styleProp,\n \"--col-header-row-height-prop\":\n typeof colHeaderRowHeightProp === \"number\"\n ? `${colHeaderRowHeightProp}px`\n : undefined,\n \"--row-height-prop\":\n typeof rowHeightProp === \"number\"\n ? `${rowHeightProp}px`\n : undefined,\n } as CSSProperties\n }\n width={width}\n >\n <RowProxy ref={rowRef} height={rowHeightProp} />\n {size &&\n rowHeight &&\n (footerHeight || showPaginationControls !== true) ? (\n <TableCore\n EmptyDisplay={EmptyDisplay}\n HeaderCell={HeaderCell}\n Row={Row}\n allowCellBlockSelection={allowCellBlockSelection}\n allowDragColumnHeader={allowDragColumnHeader}\n allowDragDrop={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allowSelectCheckboxRow={allowSelectCheckboxRow}\n autoSelectFirstRow={autoSelectFirstRow}\n autoSelectRowKey={autoSelectRowKey}\n config={config}\n containerRef={containerRef}\n customHeader={customHeader}\n dataSource={dataSource}\n disableFocus={disableFocus}\n groupToggleTarget={groupToggleTarget}\n highlightedIndex={highlightedIndex}\n id={id}\n navigationStyle={navigationStyle}\n onAvailableColumnsChange={onAvailableColumnsChange}\n onConfigChange={onConfigChange}\n onDataEdited={onDataEdited}\n onDragStart={onDragStart}\n onDrop={onDrop}\n onHighlight={onHighlight}\n onRowClick={onRowClick}\n onSelect={onSelect}\n onSelectCellBlock={onSelectCellBlock}\n onSelectionChange={onSelectionChange}\n renderBufferSize={\n showPaginationControls ? 0 : Math.max(5, renderBufferSize ?? 0)\n }\n revealSelected={revealSelected}\n rowActionHandlers={rowActionHandlers}\n rowHeight={rowHeight}\n scrollingApiRef={scrollingApiRef}\n lowerCaseSearchPattern={lowerCase(searchPattern)}\n selectionModel={selectionModel}\n showColumnHeaders={showColumnHeaders}\n showColumnHeaderMenus={showColumnHeaderMenus}\n showPaginationControls={showPaginationControls}\n size={reduceSizeHeight(size, footerHeight)}\n />\n ) : null}\n {showPaginationControls ? (\n <div className={`${classBase}-footer`} ref={footerRef}>\n <PaginationControl dataSource={dataSource} />\n </div>\n ) : null}\n </MeasuredContainer>\n );\n});\n"],"names":["RowProxy","Row","DefaultRow","Table","size"],"mappings":";;;;;;;;;;;;;;;;;AAqDA,MAAM,SAAY,GAAA,UAAA;AAQlB,MAAM,QAAA,GAAW,WAGf,SAASA,SAAAA,CAAS,EAAE,SAAY,GAAA,aAAA,EAAe,MAAO,EAAA,EAAG,YAAc,EAAA;AACvE,EACE,uBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAW,EAAA,IAAA;AAAA,MACX,SAAA,EAAW,EAAG,CAAA,SAAA,EAAW,CAAa,WAAA,CAAA,CAAA;AAAA,MACtC,GAAK,EAAA,YAAA;AAAA,MACL,KAAA,EAAO,EAAE,MAAO;AAAA;AAAA,GAClB;AAEJ,CAAC,CAAA;AAgOD,MAAM,YAAY,CAAC;AAAA,EACjB,YAAA;AAAA,EACA,UAAA;AAAA,OACAC,KAAM,GAAAC,GAAA;AAAA,EACN,uBAAA;AAAA,EACA,qBAAwB,GAAA,IAAA;AAAA,EACxB,aAAA;AAAA,EACA,cAAA;AAAA,EACA,sBAAA;AAAA,EACA,kBAAA;AAAA,EACA,gBAAA;AAAA;AAAA,EAEA,MAAA;AAAA,EACA,YAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAe,GAAA,KAAA;AAAA,EACf,iBAAA;AAAA,EACA,gBAAkB,EAAA,oBAAA;AAAA,EAClB,EAAI,EAAA,MAAA;AAAA,EACJ,sBAAA;AAAA,EACA,eAAkB,GAAA,MAAA;AAAA;AAAA,EAElB,cAAA;AAAA,EACA,YAAc,EAAA,gBAAA;AAAA,EACd,WAAA;AAAA,EACA,MAAA;AA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CAAG,EAAA,SAAS,CAAW,OAAA,CAAA,EAAA,GAAA,EAAK,SAC1C,EAAA,QAAA,kBAAA,GAAA,CAAC,iBAAkB,EAAA,EAAA,UAAA,EAAwB,GAC7C,CACE,GAAA;AAAA;AAAA;AAAA,GACN;AAEJ,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var headerCellCss = ".vuuTableHeaderCell {\n --cell-align: \"flex-start\";\n --vuuColumnHeaderPill-margin: 0;\n --vuuColumnHeaderPill-flex: 0 0 24px;\n\n align-items: center;\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n border-bottom: none;\n border-right-color: var(--cell-borderColor);\n border-right-style: solid;\n border-right-width: 1px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n gap: 2px;\n height: 100%;\n padding: 0 4px 0 8px;\n position: relative;\n vertical-align: top;\n\n &.vuuPinLeft,\n &.vuuPinRight {\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n }\n}\n\n.vuuTableHeaderCell.vuuDragging,\n.vuuTableHeaderCell:focus {\n outline: var(\n --vuuTableCell-outline,\n solid var(--salt-focused-outlineColor) 2px\n );\n outline-offset: -3px;\n}\n\n.vuuTableHeaderCell.vuuDragging {\n height: var(--vuu-table-col-header-row-height);\n}\n\n.vuuTableHeaderCell-right {\n --columnResizer-left: 0;\n --vuuTable-columnMenu-margin: 0;\n --column-menu-left: 2px;\n justify-content: flex-end;\n padding: 0 3px 0 12px;\n}\n\n.vuuTableHeaderCell-noMenu {\n padding-left: var(--salt-spacing-300);\n}\n\n.vuuTableHeaderCell-label {\n flex: 1 1 auto;\n line-height: calc(var(--vuu-table-cell-header-height) - 1px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.vuuTableHeaderCell-right .vuuTableHeaderCell-label {\n text-align: right;\n}\n\n.vuuTableHeaderCell-resizing {\n --columnResizeThumb-color: var(--vuu-color-purple-10);\n --columnResizer-color: var(--vuu-color-purple-10);\n --columnResizer-height: var(--table-height);\n}\n\n.vuuTableHeaderCell.vuuPinLeft {\n padding-left: 2px;\n}\n\n.vuuTableHeaderCell.vuuPinLeft.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n 0% 0%,\n 0% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: var(\n --vuuTablePinnedColumn-borderColor,\n var(--salt-container-primary-borderColor)\n );\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: 2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 3px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuPinRight.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n -20% 0%,\n -20% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: #a9aaad;\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: -2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 0px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuDraggable-dragAway {\n display: none;\n}\n\n.vuuTable-headingCell {\n background: var(--dataTable-background);\n border-color: var(--salt-separable-tertiary-borderColor);\n border-style: solid solid solid none;\n border-width: 1px;\n color: var(--salt-content-secondary-foreground);\n display: inline-block;\n height: var(--vuu-table-col-heading-height);\n padding: 0 !important;\n}\n\n.vuuTableHeaderCell:has(.saltCheckbox){\n padding-left: 6px;\n}";
|
|
1
|
+
var headerCellCss = ".vuuTableHeaderCell {\n --selected-column-borderColor: var(--vuuTable-column-selected-borderColor, var(--salt-selectable-borderColor-selected));\n --cell-align: \"flex-start\";\n --vuuColumnHeaderPill-margin: 0;\n --vuuColumnHeaderPill-flex: 0 0 24px;\n\n align-items: center;\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n border-bottom: none;\n border-right-color: var(--cell-borderColor);\n border-right-style: solid;\n border-right-width: 1px;\n box-sizing: border-box;\n cursor: default;\n display: inline-flex;\n gap: 2px;\n height: 100%;\n padding: 0 4px 0 8px;\n position: relative;\n vertical-align: top;\n\n &.vuuPinLeft,\n &.vuuPinRight {\n background-color: var(\n --vuuTableHeaderCell-background,\n var(--table-background)\n );\n }\n}\n\n.vuuTableHeaderCell.vuuDragging,\n.vuuTableHeaderCell:focus {\n outline: var(\n --vuuTableCell-outline,\n solid var(--salt-focused-outlineColor) 2px\n );\n outline-offset: -3px;\n}\n\n.vuuTableHeaderCell.vuuDragging {\n height: var(--vuu-table-col-header-row-height);\n}\n\n.vuuTableHeaderCell-right {\n --columnResizer-left: 0;\n --vuuTable-columnMenu-margin: 0;\n --column-menu-left: 2px;\n justify-content: flex-end;\n padding: 0 3px 0 12px;\n}\n\n.vuuTableHeaderCell-noMenu {\n padding-left: var(--salt-spacing-300);\n}\n\n.vuuTableHeaderCell-label {\n flex: 1 1 auto;\n line-height: calc(var(--vuu-table-cell-header-height) - 1px);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.vuuTableHeaderCell-right .vuuTableHeaderCell-label {\n text-align: right;\n}\n\n.vuuTableHeaderCell-resizing {\n --columnResizeThumb-color: var(--vuu-color-purple-10);\n --columnResizer-color: var(--vuu-color-purple-10);\n --columnResizer-height: var(--table-height);\n}\n\n.vuuTableHeaderCell.vuuPinLeft {\n padding-left: 2px;\n}\n\n.vuuTableHeaderCell.vuuPinLeft.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n 0% 0%,\n 0% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: var(\n --vuuTablePinnedColumn-borderColor,\n var(--salt-container-primary-borderColor)\n );\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: 2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 3px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuPinRight.vuuEndPin .vuuColumnResizer:before {\n --height: calc(var(--table-height) - var(--horizontal-scrollbar-height));\n --inset-r: calc(var(--pin-width) - 2px);\n --inset-b: calc(var(--height) - 2px);\n --clip-path: polygon(\n -20% 0%,\n -20% 120%,\n 2px 120%,\n 2px 2px,\n var(--inset-r) 2px,\n var(--inset-r) var(--inset-b),\n 2px var(--inset-b),\n 2px 120%,\n 120% 120%,\n 120% 0%\n );\n background-color: transparent;\n border-color: #a9aaad;\n border-width: 1px;\n border-style: solid solid solid solid;\n /* border-radius: 0 6px 6px 0; */\n border-radius: 4px;\n box-shadow: -2px 1px 4px 0px rgba(0, 0, 0, 0.1);\n /* clip-path: inset(10px 10px 10px 10px); */\n clip-path: var(--clip-path);\n content: \"\";\n position: absolute;\n width: var(--pin-width);\n top: 0;\n bottom: 0;\n right: 0px;\n height: var(--height);\n z-index: -5;\n}\n\n.vuuTableHeaderCell.vuuDraggable-dragAway {\n display: none;\n}\n\n.vuuTable-headingCell {\n background: var(--dataTable-background);\n border-color: var(--salt-separable-tertiary-borderColor);\n border-style: solid solid solid none;\n border-width: 1px;\n color: var(--salt-content-secondary-foreground);\n display: inline-block;\n height: var(--vuu-table-col-heading-height);\n padding: 0 !important;\n}\n\n.vuuTableHeaderCell:has(.saltCheckbox){\n padding-left: 6px;\n}\n\n\n.vuuTableHeaderCell.error {\n --selected-column-borderColor: var(--salt-status-error-borderColor);\n}\n.vuuTableHeaderCell.info {\n --selected-column-borderColor: var(--salt-status-info-borderColor);\n}\n.vuuTableHeaderCell.success {\n --selected-column-borderColor: var(--salt-status-success-borderColor);\n}\n.vuuTableHeaderCell.warning {\n --selected-column-borderColor: var(--salt-status-warning-borderColor);\n}\n\n.vuuTableHeaderCell-selected:after {\n background-color: transparent;\n border: solid 1px var(--selected-column-borderColor);\n border-radius: 6px;\n\n clip-path: polygon(\n 0px 0px,\n 0px 100%,\n 100% 100%,\n 100% 0px,\n 0px 0px,\n 2px 2px,\n calc(100% - 2px) 2px,\n calc(100% - 2px) calc(100% - 2px),\n 2px calc(100% - 2px),\n 2px 2px\n );\n box-sizing: border-box;\n content: \"\";\n pointer-events: none;\n position: absolute;\n right: 1px;\n height: calc(var(--table-height) - var(--horizontal-scrollbar-height) - 2px);\n top: 1px;\n width: calc(100% - 2px);\n \n}";
|
|
2
2
|
|
|
3
3
|
export { headerCellCss as default };
|
|
4
4
|
//# sourceMappingURL=HeaderCell.css.js.map
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { Checkbox, useForkRef } from '@salt-ds/core';
|
|
3
|
-
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
|
-
import { useWindow } from '@salt-ds/window';
|
|
5
3
|
import { ColumnMenu } from '@vuu-ui/vuu-table-extras';
|
|
6
4
|
import { isTypeDescriptor, useSortable } from '@vuu-ui/vuu-utils';
|
|
7
5
|
import cx from 'clsx';
|
|
8
6
|
import { useRef, useCallback, useMemo } from 'react';
|
|
7
|
+
import '@salt-ds/styles';
|
|
8
|
+
import '@salt-ds/window';
|
|
9
9
|
import { SortIndicator } from '../column-header-pill/SortIndicator.js';
|
|
10
10
|
import { ColumnResizer } from '../column-resizing/ColumnResizer.js';
|
|
11
11
|
import { useTableColumnResize } from '../column-resizing/useTableColumnResize.js';
|
|
12
12
|
import { useCell } from '../useCell.js';
|
|
13
|
-
import headerCellCss from './HeaderCell.css.js';
|
|
14
13
|
|
|
15
14
|
const classBase = "vuuTableHeaderCell";
|
|
16
15
|
const doNothing = () => {
|
|
@@ -30,12 +29,6 @@ const HeaderCell = ({
|
|
|
30
29
|
showColumnHeaderMenus = true,
|
|
31
30
|
...htmlAttributes
|
|
32
31
|
}) => {
|
|
33
|
-
const targetWindow = useWindow();
|
|
34
|
-
useComponentCssInjection({
|
|
35
|
-
testId: "vuu-header-cell",
|
|
36
|
-
css: headerCellCss,
|
|
37
|
-
window: targetWindow
|
|
38
|
-
});
|
|
39
32
|
const dragDropSortHook = allowDragColumnHeader ? useSortable : doNothing;
|
|
40
33
|
const { ref: sortableRef } = dragDropSortHook({ id, index });
|
|
41
34
|
const {
|
|
@@ -119,8 +112,9 @@ const HeaderCell = ({
|
|
|
119
112
|
...htmlAttributes,
|
|
120
113
|
"aria-colindex": column.ariaColIndex,
|
|
121
114
|
"aria-label": `${column.label ?? column.name} column header`,
|
|
122
|
-
className: cx(className, classNameProp, {
|
|
115
|
+
className: cx(className, classNameProp, column.status, {
|
|
123
116
|
[`${classBase}-resizing`]: isResizing,
|
|
117
|
+
[`${classBase}-selected`]: column.selected,
|
|
124
118
|
[`${classBase}-noMenu`]: showColumnHeaderMenus === false
|
|
125
119
|
}),
|
|
126
120
|
"data-column-name": column.name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeaderCell.js","sources":["../../../../packages/vuu-table/src/header-cell/HeaderCell.tsx"],"sourcesContent":["import { Checkbox, useForkRef } from \"@salt-ds/core\";\nimport {
|
|
1
|
+
{"version":3,"file":"HeaderCell.js","sources":["../../../../packages/vuu-table/src/header-cell/HeaderCell.tsx"],"sourcesContent":["import { Checkbox, useForkRef } from \"@salt-ds/core\";\nimport { ColumnMenu } from \"@vuu-ui/vuu-table-extras\";\nimport { HeaderCellProps } from \"@vuu-ui/vuu-table-types\";\nimport { isTypeDescriptor, useSortable } from \"@vuu-ui/vuu-utils\";\nimport cx from \"clsx\";\nimport {\n KeyboardEventHandler,\n MouseEventHandler,\n SyntheticEvent,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { SortIndicator } from \"../column-header-pill\";\nimport { ColumnResizer, useTableColumnResize } from \"../column-resizing\";\nimport { useCell } from \"../useCell\";\n\nconst classBase = \"vuuTableHeaderCell\";\n\nconst doNothing = () => {\n // dummy hook\n return { ref: { current: null } };\n};\n\nexport const HeaderCell = ({\n allowDragColumnHeader = true,\n allowSelectAll,\n allRowsSelected,\n className: classNameProp,\n column,\n id,\n index,\n onCheckBoxColumnHeaderClick,\n onClick,\n onResize,\n showColumnHeaderMenus = true,\n ...htmlAttributes\n}: HeaderCellProps) => {\n const dragDropSortHook = allowDragColumnHeader ? useSortable : doNothing;\n const { ref: sortableRef } = dragDropSortHook({ id, index });\n const {\n allowColumnHeaderMenu = true,\n HeaderCellContentRenderer,\n HeaderCellLabelRenderer,\n } = column;\n const rootRef = useRef<HTMLDivElement>(null);\n const { isResizing, ...resizeProps } = useTableColumnResize({\n column,\n onResize,\n rootRef,\n });\n\n const handleCheckBoxClick = useCallback(\n (e: SyntheticEvent) => {\n e.stopPropagation();\n onCheckBoxColumnHeaderClick?.();\n },\n [onCheckBoxColumnHeaderClick],\n );\n\n const headerItems = useMemo(() => {\n const renderCheckbox =\n allowSelectAll &&\n column.isSystemColumn &&\n isTypeDescriptor(column.type) &&\n column.type.name === \"checkbox\";\n\n if (renderCheckbox) {\n return [\n <Checkbox\n checked={allRowsSelected}\n className=\"vuuCheckboxRowSelector\"\n key=\"checkbox\"\n onClick={handleCheckBoxClick}\n />,\n ];\n } else {\n const sortIndicator = <SortIndicator column={column} />;\n const columnLabel = HeaderCellLabelRenderer ? (\n <HeaderCellLabelRenderer\n className={`${classBase}-label`}\n column={column}\n />\n ) : (\n <div className={`${classBase}-label`}>\n {column.label ?? column.name}\n </div>\n );\n const columnContent = HeaderCellContentRenderer\n ? [<HeaderCellContentRenderer column={column} key=\"content\" />]\n : [];\n\n if (showColumnHeaderMenus && allowColumnHeaderMenu) {\n const menuPermissions =\n showColumnHeaderMenus === true ? undefined : showColumnHeaderMenus;\n const columnMenu = (\n <ColumnMenu column={column} menuPermissions={menuPermissions} />\n );\n\n return [columnLabel, columnContent, sortIndicator, columnMenu];\n } else {\n return [columnLabel, sortIndicator, columnContent];\n }\n }\n }, [\n HeaderCellContentRenderer,\n HeaderCellLabelRenderer,\n allRowsSelected,\n allowColumnHeaderMenu,\n allowSelectAll,\n column,\n handleCheckBoxClick,\n showColumnHeaderMenus,\n ]);\n\n const handleClick = useCallback<MouseEventHandler<HTMLDivElement>>(\n (evt) => {\n !isResizing && onClick?.(evt);\n },\n [isResizing, onClick],\n );\n\n const handleKeyDown = useCallback<KeyboardEventHandler<HTMLDivElement>>(\n (evt) => {\n if (evt.key === \"Enter\") {\n onClick?.(evt);\n }\n },\n [onClick],\n );\n\n const { className, style } = useCell(column, classBase, true);\n\n return (\n <div\n {...htmlAttributes}\n aria-colindex={column.ariaColIndex}\n aria-label={`${column.label ?? column.name} column header`}\n className={cx(className, classNameProp, column.status, {\n [`${classBase}-resizing`]: isResizing,\n [`${classBase}-selected`]: column.selected,\n [`${classBase}-noMenu`]: showColumnHeaderMenus === false,\n })}\n data-column-name={column.name}\n data-index={index}\n id={id}\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n ref={useForkRef<HTMLDivElement>(rootRef, sortableRef)}\n role=\"columnheader\"\n style={style}\n >\n {...headerItems}\n {column.resizeable !== false ? <ColumnResizer {...resizeProps} /> : null}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAiBA,MAAM,SAAY,GAAA,oBAAA;AAElB,MAAM,YAAY,MAAM;AAEtB,EAAA,OAAO,EAAE,GAAA,EAAK,EAAE,OAAA,EAAS,MAAO,EAAA;AAClC,CAAA;AAEO,MAAM,aAAa,CAAC;AAAA,EACzB,qBAAwB,GAAA,IAAA;AAAA,EACxB,cAAA;AAAA,EACA,eAAA;AAAA,EACA,SAAW,EAAA,aAAA;AAAA,EACX,MAAA;AAAA,EACA,EAAA;AAAA,EACA,KAAA;AAAA,EACA,2BAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,qBAAwB,GAAA,IAAA;AAAA,EACxB,GAAG;AACL,CAAuB,KAAA;AACrB,EAAM,MAAA,gBAAA,GAAmB,wBAAwB,WAAc,GAAA,SAAA;AAC/D,EAAM,MAAA,EAAE,KAAK,WAAY,EAAA,GAAI,iBAAiB,EAAE,EAAA,EAAI,OAAO,CAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,qBAAwB,GAAA,IAAA;AAAA,IACxB,yBAAA;AAAA,IACA;AAAA,GACE,GAAA,MAAA;AACJ,EAAM,MAAA,OAAA,GAAU,OAAuB,IAAI,CAAA;AAC3C,EAAA,MAAM,EAAE,UAAA,EAAY,GAAG,WAAA,KAAgB,oBAAqB,CAAA;AAAA,IAC1D,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,MAAM,mBAAsB,GAAA,WAAA;AAAA,IAC1B,CAAC,CAAsB,KAAA;AACrB,MAAA,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,MAAO,CAAA,QAAA;AAAA,QAClC,CAAC,CAAA,EAAG,SAAS,CAAA,OAAA,CAAS,GAAG,qBAA0B,KAAA;AAAA,OACpD,CAAA;AAAA,MACD,oBAAkB,MAAO,CAAA,IAAA;AAAA,MACzB,YAAY,EAAA,KAAA;AAAA,MACZ,EAAA;AAAA,MACA,OAAS,EAAA,WAAA;AAAA,MACT,SAAW,EAAA,aAAA;AAAA,MACX,GAAA,EAAK,UAA2B,CAAA,OAAA,EAAS,WAAW,CAAA;AAAA,MACpD,IAAK,EAAA,cAAA;AAAA,MACL,KAAA;AAAA,MAEC,QAAA,EAAA;AAAA,QAAG,GAAA,WAAA;AAAA,QACH,OAAO,UAAe,KAAA,KAAA,uBAAS,aAAe,EAAA,EAAA,GAAG,aAAa,CAAK,GAAA;AAAA;AAAA;AAAA,GACtE;AAEJ;;;;"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
3
|
+
import { useWindow } from '@salt-ds/window';
|
|
2
4
|
import { isNotHidden, DragDropProvider, RestrictToHorizontalAxis, KeyboardSensor, PointerSensor, isGroupColumn, DragOverlay } from '@vuu-ui/vuu-utils';
|
|
3
5
|
import { memo, useMemo, isValidElement, cloneElement } from 'react';
|
|
4
6
|
import { GroupHeaderCell } from '../header-cell/GroupHeaderCell.js';
|
|
5
7
|
import { HeaderCell } from '../header-cell/HeaderCell.js';
|
|
6
8
|
import { HeaderProvider } from './HeaderProvider.js';
|
|
7
9
|
import { useTableHeader } from './useTableHeader.js';
|
|
10
|
+
import headerCellCss from '../header-cell/HeaderCell.css.js';
|
|
8
11
|
|
|
9
12
|
const isHeaderElement = (h) => isValidElement(h);
|
|
10
13
|
const classBase = "vuuTableHeader";
|
|
11
14
|
const TableHeader = memo(
|
|
12
15
|
({
|
|
16
|
+
HeaderCell: HeaderCell$1 = HeaderCell,
|
|
13
17
|
allowDragColumnHeader,
|
|
14
18
|
allowSelectAll,
|
|
15
19
|
allRowsSelected,
|
|
@@ -29,6 +33,12 @@ const TableHeader = memo(
|
|
|
29
33
|
tableId,
|
|
30
34
|
virtualColSpan = 0
|
|
31
35
|
}) => {
|
|
36
|
+
const targetWindow = useWindow();
|
|
37
|
+
useComponentCssInjection({
|
|
38
|
+
testId: "vuu-table-header-cell",
|
|
39
|
+
css: headerCellCss,
|
|
40
|
+
window: targetWindow
|
|
41
|
+
});
|
|
32
42
|
const [customHeaders, customHeaderCount] = useMemo(() => {
|
|
33
43
|
const offset = headings.length;
|
|
34
44
|
const createElement = (Component, index) => /* @__PURE__ */ jsx(
|
|
@@ -126,7 +136,7 @@ const TableHeader = memo(
|
|
|
126
136
|
},
|
|
127
137
|
col.name
|
|
128
138
|
) : /* @__PURE__ */ jsx(
|
|
129
|
-
HeaderCell,
|
|
139
|
+
HeaderCell$1,
|
|
130
140
|
{
|
|
131
141
|
allowDragColumnHeader: allowDragDrop,
|
|
132
142
|
allowSelectAll,
|
|
@@ -147,7 +157,7 @@ const TableHeader = memo(
|
|
|
147
157
|
}
|
|
148
158
|
),
|
|
149
159
|
/* @__PURE__ */ jsx(DragOverlay, { children: dragColumn ? /* @__PURE__ */ jsx("div", { id: dragColumn.id, className: "DragColumn", children: /* @__PURE__ */ jsx(
|
|
150
|
-
HeaderCell,
|
|
160
|
+
HeaderCell$1,
|
|
151
161
|
{
|
|
152
162
|
column: dragColumn.column,
|
|
153
163
|
className: "vuuDragging",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHeader.js","sources":["../../../../packages/vuu-table/src/table-header/TableHeader.tsx"],"sourcesContent":["import { VuuSortType } from \"@vuu-ui/vuu-protocol-types\";\nimport {\n DragDropProvider,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n RestrictToHorizontalAxis,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ColumnDescriptor,\n ColumnMoveHandler,\n CustomHeader,\n CustomHeaderComponent,\n CustomHeaderElement,\n HeaderCellProps,\n RuntimeColumnDescriptor,\n TableColumnResizeHandler,\n TableConfig,\n TableHeadings,\n} from \"@vuu-ui/vuu-table-types\";\nimport { isGroupColumn, isNotHidden } from \"@vuu-ui/vuu-utils\";\nimport {\n cloneElement,\n isValidElement,\n memo,\n ReactElement,\n useMemo,\n} from \"react\";\nimport { GroupHeaderCell, HeaderCell } from \"../header-cell\";\nimport { HeaderProvider } from \"./HeaderProvider\";\nimport { useTableHeader } from \"./useTableHeader\";\n\nexport type ColumnSortHandler = (\n column: ColumnDescriptor,\n addToExistingSort: boolean,\n sortType?: VuuSortType,\n) => void;\n\nconst isHeaderElement = (h: CustomHeader): h is CustomHeaderElement =>\n isValidElement(h);\n\nconst classBase = \"vuuTableHeader\";\n\nexport interface TableHeaderProps\n extends Pick<\n HeaderCellProps,\n | \"allRowsSelected\"\n | \"allowDragColumnHeader\"\n | \"allowSelectAll\"\n | \"onCheckBoxColumnHeaderClick\"\n | \"showColumnHeaderMenus\"\n > {\n columns: RuntimeColumnDescriptor[];\n customHeader?: CustomHeader | CustomHeader[];\n headings: TableHeadings;\n onHeightMeasured: (height: number, count: number) => void;\n onResizeColumn: TableColumnResizeHandler;\n onMoveColumn: ColumnMoveHandler;\n onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;\n onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;\n onSortColumn: ColumnSortHandler;\n showBookends?: boolean;\n tableConfig: TableConfig;\n tableId: string;\n virtualColSpan?: number;\n}\n\nexport const TableHeader = memo(\n ({\n allowDragColumnHeader,\n allowSelectAll,\n allRowsSelected,\n columns,\n customHeader,\n headings,\n onCheckBoxColumnHeaderClick,\n onHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onSortColumn,\n showBookends,\n showColumnHeaderMenus,\n tableConfig,\n tableId,\n virtualColSpan = 0,\n }: TableHeaderProps) => {\n const [customHeaders, customHeaderCount] = useMemo<\n [ReactElement | ReactElement[] | null, number]\n >(() => {\n const offset = headings.length;\n const createElement = (\n Component: CustomHeaderComponent,\n index: number,\n ) => (\n <Component\n ariaRowIndex={offset + index + 2}\n ariaRole=\"row\"\n columns={columns}\n key={index}\n virtualColSpan={virtualColSpan}\n />\n );\n\n const enrichElementWithAria = (el: ReactElement, rowIndex: number) => {\n const offset = headings.length;\n return cloneElement(el, {\n \"aria-rowindex\": rowIndex + offset + 2,\n ariaRole: \"row\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n };\n\n if (customHeader === undefined) {\n return [null, 0];\n } else if (Array.isArray(customHeader)) {\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {customHeader.map((header, i) =>\n isHeaderElement(header)\n ? enrichElementWithAria(header, i)\n : createElement(header, i),\n )}\n </HeaderProvider>\n );\n return [header, customHeader.length];\n } else if (isHeaderElement(customHeader)) {\n // TODO rowIndex and role\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {enrichElementWithAria(customHeader, 0)}\n </HeaderProvider>\n );\n return [header, 1];\n } else {\n return [createElement(customHeader, 0), 1];\n }\n }, [columns, customHeader, headings.length, virtualColSpan]);\n\n const { dragColumn, onClick, onDragEnd, onDragStart, setContainerRef } =\n useTableHeader({\n columns,\n customHeaderCount,\n headings,\n onHeightMeasured,\n onMoveColumn,\n onSortColumn,\n tableConfig,\n });\n\n const visibleColumns = columns.filter(isNotHidden);\n\n return (\n <div className={classBase} ref={setContainerRef} role=\"rowgroup\">\n {headings.map((colHeaders, i) => (\n <div\n className=\"vuuTable-heading\"\n key={i}\n role=\"row\"\n aria-rowindex={i + 1}\n >\n {colHeaders.map(({ label, width }, j) => (\n <div key={j} className=\"vuuTable-headingCell\" style={{ width }}>\n {label}\n </div>\n ))}\n </div>\n ))}\n <DragDropProvider // whats the difference between this and DnDContext\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore typing error from dnd-kit\n modifiers={[RestrictToHorizontalAxis]}\n sensors={[\n KeyboardSensor.configure({\n keyboardCodes: {\n start: [\"Space\"],\n cancel: [\"Escape\"],\n end: [\"Space\", \"Enter\"],\n left: [\"ArrowLeft\"],\n right: [\"ArrowRight\"],\n up: [],\n down: [],\n },\n }),\n PointerSensor,\n ]}\n >\n <div\n className=\"vuuTableColHeaderRow\"\n role=\"row\"\n aria-rowindex={headings.length + 1}\n >\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyLeft\" />\n ) : null}\n\n {visibleColumns.map((col, i) => {\n const allowDragDrop =\n allowDragColumnHeader && !col.pin ? true : false;\n return isGroupColumn(col) ? (\n <GroupHeaderCell\n column={col}\n id={`${tableId}-${col.name}`}\n key={col.name}\n onMoveColumn={onMoveGroupColumn}\n onRemoveColumn={onRemoveGroupColumn}\n onResize={onResizeColumn}\n />\n ) : (\n <HeaderCell\n allowDragColumnHeader={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n column={col}\n index={i}\n id={`${tableId}-${col.name}`}\n key={`${col.name}-${allowDragDrop}`}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onClick={onClick}\n onResize={onResizeColumn}\n showColumnHeaderMenus={showColumnHeaderMenus}\n />\n );\n })}\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyRight\" />\n ) : null}\n </div>\n\n <DragOverlay>\n {dragColumn ? (\n <div id={dragColumn.id} className=\"DragColumn\">\n <HeaderCell\n column={dragColumn.column}\n className=\"vuuDragging\"\n id={`${tableId}-${dragColumn.id}-dragging`}\n index={-1}\n />\n </div>\n ) : null}\n </DragOverlay>\n </DragDropProvider>\n {customHeaders}\n </div>\n );\n },\n);\nTableHeader.displayName = \"TableHeader\";\n"],"names":["offset","header"],"mappings":";;;;;;;;AAsCA,MAAM,eAAkB,GAAA,CAAC,CACvB,KAAA,cAAA,CAAe,CAAC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ACnB,SAAU,EAAA,aAAA;AAAA,gBACV,EAAI,EAAA,CAAA,EAAG,OAAO,CAAA,CAAA,EAAI,WAAW,EAAE,CAAA,SAAA,CAAA;AAAA,gBAC/B,KAAO,EAAA,CAAA;AAAA;AAAA,aACT,EACF,IACE,IACN,EAAA;AAAA;AAAA;AAAA,OACF;AAAA,MACC;AAAA,KACH,EAAA,CAAA;AAAA;AAGN;AACA,WAAA,CAAY,WAAc,GAAA,aAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TableHeader.js","sources":["../../../../packages/vuu-table/src/table-header/TableHeader.tsx"],"sourcesContent":["import { VuuSortType } from \"@vuu-ui/vuu-protocol-types\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\n\nimport {\n DragDropProvider,\n DragOverlay,\n KeyboardSensor,\n PointerSensor,\n RestrictToHorizontalAxis,\n} from \"@vuu-ui/vuu-utils\";\nimport {\n ColumnDescriptor,\n ColumnMoveHandler,\n CustomHeader,\n CustomHeaderComponent,\n CustomHeaderElement,\n HeaderCellProps,\n RuntimeColumnDescriptor,\n TableColumnResizeHandler,\n TableConfig,\n TableHeadings,\n} from \"@vuu-ui/vuu-table-types\";\nimport { isGroupColumn, isNotHidden } from \"@vuu-ui/vuu-utils\";\nimport {\n cloneElement,\n FC,\n isValidElement,\n memo,\n ReactElement,\n useMemo,\n} from \"react\";\nimport {\n GroupHeaderCell,\n HeaderCell as DefaultHeaderCell,\n} from \"../header-cell\";\nimport { HeaderProvider } from \"./HeaderProvider\";\nimport { useTableHeader } from \"./useTableHeader\";\n\n// We import headercell css once here so it is available to custom\n// headercell implementations.\nimport headerCellCss from \"../header-cell/HeaderCell.css\";\n\nexport type ColumnSortHandler = (\n column: ColumnDescriptor,\n addToExistingSort: boolean,\n sortType?: VuuSortType,\n) => void;\n\nconst isHeaderElement = (h: CustomHeader): h is CustomHeaderElement =>\n isValidElement(h);\n\nconst classBase = \"vuuTableHeader\";\n\nexport interface TableHeaderProps\n extends Pick<\n HeaderCellProps,\n | \"allRowsSelected\"\n | \"allowDragColumnHeader\"\n | \"allowSelectAll\"\n | \"onCheckBoxColumnHeaderClick\"\n | \"showColumnHeaderMenus\"\n > {\n HeaderCell?: FC<HeaderCellProps>;\n columns: RuntimeColumnDescriptor[];\n customHeader?: CustomHeader | CustomHeader[];\n headings: TableHeadings;\n onHeightMeasured: (height: number, count: number) => void;\n onResizeColumn: TableColumnResizeHandler;\n onMoveColumn: ColumnMoveHandler;\n onMoveGroupColumn: (columns: ColumnDescriptor[]) => void;\n onRemoveGroupColumn: (column: RuntimeColumnDescriptor) => void;\n onSortColumn: ColumnSortHandler;\n showBookends?: boolean;\n tableConfig: TableConfig;\n tableId: string;\n virtualColSpan?: number;\n}\n\nexport const TableHeader = memo(\n ({\n HeaderCell = DefaultHeaderCell,\n allowDragColumnHeader,\n allowSelectAll,\n allRowsSelected,\n columns,\n customHeader,\n headings,\n onCheckBoxColumnHeaderClick,\n onHeightMeasured,\n onMoveColumn,\n onMoveGroupColumn,\n onRemoveGroupColumn,\n onResizeColumn,\n onSortColumn,\n showBookends,\n showColumnHeaderMenus,\n tableConfig,\n tableId,\n virtualColSpan = 0,\n }: TableHeaderProps) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"vuu-table-header-cell\",\n css: headerCellCss,\n window: targetWindow,\n });\n\n const [customHeaders, customHeaderCount] = useMemo<\n [ReactElement | ReactElement[] | null, number]\n >(() => {\n const offset = headings.length;\n const createElement = (\n Component: CustomHeaderComponent,\n index: number,\n ) => (\n <Component\n ariaRowIndex={offset + index + 2}\n ariaRole=\"row\"\n columns={columns}\n key={index}\n virtualColSpan={virtualColSpan}\n />\n );\n\n const enrichElementWithAria = (el: ReactElement, rowIndex: number) => {\n const offset = headings.length;\n return cloneElement(el, {\n \"aria-rowindex\": rowIndex + offset + 2,\n ariaRole: \"row\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as any);\n };\n\n if (customHeader === undefined) {\n return [null, 0];\n } else if (Array.isArray(customHeader)) {\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {customHeader.map((header, i) =>\n isHeaderElement(header)\n ? enrichElementWithAria(header, i)\n : createElement(header, i),\n )}\n </HeaderProvider>\n );\n return [header, customHeader.length];\n } else if (isHeaderElement(customHeader)) {\n // TODO rowIndex and role\n const header = (\n <HeaderProvider columns={columns} virtualColSpan={virtualColSpan}>\n {enrichElementWithAria(customHeader, 0)}\n </HeaderProvider>\n );\n return [header, 1];\n } else {\n return [createElement(customHeader, 0), 1];\n }\n }, [columns, customHeader, headings.length, virtualColSpan]);\n\n const { dragColumn, onClick, onDragEnd, onDragStart, setContainerRef } =\n useTableHeader({\n columns,\n customHeaderCount,\n headings,\n onHeightMeasured,\n onMoveColumn,\n onSortColumn,\n tableConfig,\n });\n\n const visibleColumns = columns.filter(isNotHidden);\n\n return (\n <div className={classBase} ref={setContainerRef} role=\"rowgroup\">\n {headings.map((colHeaders, i) => (\n <div\n className=\"vuuTable-heading\"\n key={i}\n role=\"row\"\n aria-rowindex={i + 1}\n >\n {colHeaders.map(({ label, width }, j) => (\n <div key={j} className=\"vuuTable-headingCell\" style={{ width }}>\n {label}\n </div>\n ))}\n </div>\n ))}\n <DragDropProvider // whats the difference between this and DnDContext\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n //@ts-ignore typing error from dnd-kit\n modifiers={[RestrictToHorizontalAxis]}\n sensors={[\n KeyboardSensor.configure({\n keyboardCodes: {\n start: [\"Space\"],\n cancel: [\"Escape\"],\n end: [\"Space\", \"Enter\"],\n left: [\"ArrowLeft\"],\n right: [\"ArrowRight\"],\n up: [],\n down: [],\n },\n }),\n PointerSensor,\n ]}\n >\n <div\n className=\"vuuTableColHeaderRow\"\n role=\"row\"\n aria-rowindex={headings.length + 1}\n >\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyLeft\" />\n ) : null}\n\n {visibleColumns.map((col, i) => {\n const allowDragDrop =\n allowDragColumnHeader && !col.pin ? true : false;\n return isGroupColumn(col) ? (\n <GroupHeaderCell\n column={col}\n id={`${tableId}-${col.name}`}\n key={col.name}\n onMoveColumn={onMoveGroupColumn}\n onRemoveColumn={onRemoveGroupColumn}\n onResize={onResizeColumn}\n />\n ) : (\n <HeaderCell\n allowDragColumnHeader={allowDragDrop}\n allowSelectAll={allowSelectAll}\n allRowsSelected={allRowsSelected}\n column={col}\n index={i}\n id={`${tableId}-${col.name}`}\n key={`${col.name}-${allowDragDrop}`}\n onCheckBoxColumnHeaderClick={onCheckBoxColumnHeaderClick}\n onClick={onClick}\n onResize={onResizeColumn}\n showColumnHeaderMenus={showColumnHeaderMenus}\n />\n );\n })}\n {showBookends ? (\n <div className=\"vuuSelectionDecorator vuuStickyRight\" />\n ) : null}\n </div>\n\n <DragOverlay>\n {dragColumn ? (\n <div id={dragColumn.id} className=\"DragColumn\">\n <HeaderCell\n column={dragColumn.column}\n className=\"vuuDragging\"\n id={`${tableId}-${dragColumn.id}-dragging`}\n index={-1}\n />\n </div>\n ) : null}\n </DragOverlay>\n </DragDropProvider>\n {customHeaders}\n </div>\n );\n },\n);\nTableHeader.displayName = \"TableHeader\";\n"],"names":["HeaderCell","DefaultHeaderCell","offset","header"],"mappings":";;;;;;;;;;;AAiDA,MAAM,eAAkB,GAAA,CAAC,CACvB,KAAA,cAAA,CAAe,CAAC,CAAA;AAElB,MAAM,SAAY,GAAA,gBAAA;AA2BX,MAAM,WAAc,GAAA,IAAA;AAAA,EACzB,CAAC;AAAA,gBACCA,YAAa,GAAAC,UAAA;AAAA,IACb,qBAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA;AAAA,IACA,2BAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,mBAAA;AAAA,IACA,cAAA;AAAA,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A,CAAA;AAAA;AAAA,aACT,EACF,IACE,IACN,EAAA;AAAA;AAAA;AAAA,OACF;AAAA,MACC;AAAA,KACH,EAAA,CAAA;AAAA;AAGN;AACA,WAAA,CAAY,WAAc,GAAA,aAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.0-alpha.
|
|
2
|
+
"version": "2.1.0-alpha.12",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-types": "2.1.0-alpha.
|
|
7
|
-
"@vuu-ui/vuu-table-types": "2.1.0-alpha.
|
|
8
|
-
"@vuu-ui/vuu-protocol-types": "2.1.0-alpha.
|
|
6
|
+
"@vuu-ui/vuu-data-types": "2.1.0-alpha.12",
|
|
7
|
+
"@vuu-ui/vuu-table-types": "2.1.0-alpha.12",
|
|
8
|
+
"@vuu-ui/vuu-protocol-types": "2.1.0-alpha.12"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@salt-ds/core": "1.54.1",
|
|
12
12
|
"@salt-ds/styles": "0.2.1",
|
|
13
13
|
"@salt-ds/window": "0.1.1",
|
|
14
|
-
"@vuu-ui/vuu-context-menu": "2.1.0-alpha.
|
|
15
|
-
"@vuu-ui/vuu-data-react": "2.1.0-alpha.
|
|
16
|
-
"@vuu-ui/vuu-popups": "2.1.0-alpha.
|
|
17
|
-
"@vuu-ui/vuu-table-extras": "2.1.0-alpha.
|
|
18
|
-
"@vuu-ui/vuu-ui-controls": "2.1.0-alpha.
|
|
19
|
-
"@vuu-ui/vuu-utils": "2.1.0-alpha.
|
|
14
|
+
"@vuu-ui/vuu-context-menu": "2.1.0-alpha.12",
|
|
15
|
+
"@vuu-ui/vuu-data-react": "2.1.0-alpha.12",
|
|
16
|
+
"@vuu-ui/vuu-popups": "2.1.0-alpha.12",
|
|
17
|
+
"@vuu-ui/vuu-table-extras": "2.1.0-alpha.12",
|
|
18
|
+
"@vuu-ui/vuu-ui-controls": "2.1.0-alpha.12",
|
|
19
|
+
"@vuu-ui/vuu-utils": "2.1.0-alpha.12"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"clsx": "^2.0.0",
|
package/types/Table.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DataSource, SchemaColumn } from "@vuu-ui/vuu-data-types";
|
|
2
|
-
import { CustomHeader, DataCellEditNotification, GroupToggleTarget, RowActionHandler, RowProps, SelectionChangeHandler, ShowColumnHeaderMenus, TableConfig, TableConfigChangeHandler, TableRowClickHandler, TableRowSelectHandler, TableSelectionModel } from "@vuu-ui/vuu-table-types";
|
|
2
|
+
import { CustomHeader, DataCellEditNotification, GroupToggleTarget, HeaderCellProps, RowActionHandler, RowProps, SelectionChangeHandler, ShowColumnHeaderMenus, TableConfig, TableConfigChangeHandler, TableRowClickHandler, TableRowSelectHandler, TableSelectionModel } from "@vuu-ui/vuu-table-types";
|
|
3
3
|
import type { DragDropState } from "@vuu-ui/vuu-ui-controls";
|
|
4
4
|
import { DragStartHandler, MeasuredContainerProps, dragStrategy } from "@vuu-ui/vuu-ui-controls";
|
|
5
5
|
import { ComponentType, FC, ForwardedRef } from "react";
|
|
@@ -11,6 +11,16 @@ export interface TableProps extends Omit<MeasuredContainerProps, "onDragStart" |
|
|
|
11
11
|
* A react function component that will be rendered if there are no rows to display
|
|
12
12
|
*/
|
|
13
13
|
EmptyDisplay?: ComponentType;
|
|
14
|
+
/**
|
|
15
|
+
* A custom implementation of HeaderCell which will be rendered in place of the
|
|
16
|
+
* default HeaderCell. If provided, custom implementation is responsible for all
|
|
17
|
+
* header behaviour (if required) - sorting, resizing etc.
|
|
18
|
+
*/
|
|
19
|
+
HeaderCell?: FC<HeaderCellProps>;
|
|
20
|
+
/**
|
|
21
|
+
* A custom Row implementation that will be rendered in place of the default
|
|
22
|
+
* Row.
|
|
23
|
+
*/
|
|
14
24
|
Row?: FC<RowProps>;
|
|
15
25
|
/**
|
|
16
26
|
* Allow a block of cells to be selected. Typically to be copied.
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { VuuSortType } from "@vuu-ui/vuu-protocol-types";
|
|
2
2
|
import { ColumnDescriptor, ColumnMoveHandler, CustomHeader, HeaderCellProps, RuntimeColumnDescriptor, TableColumnResizeHandler, TableConfig, TableHeadings } from "@vuu-ui/vuu-table-types";
|
|
3
|
+
import { FC } from "react";
|
|
3
4
|
export type ColumnSortHandler = (column: ColumnDescriptor, addToExistingSort: boolean, sortType?: VuuSortType) => void;
|
|
4
5
|
export interface TableHeaderProps extends Pick<HeaderCellProps, "allRowsSelected" | "allowDragColumnHeader" | "allowSelectAll" | "onCheckBoxColumnHeaderClick" | "showColumnHeaderMenus"> {
|
|
6
|
+
HeaderCell?: FC<HeaderCellProps>;
|
|
5
7
|
columns: RuntimeColumnDescriptor[];
|
|
6
8
|
customHeader?: CustomHeader | CustomHeader[];
|
|
7
9
|
headings: TableHeadings;
|
|
@@ -16,4 +18,4 @@ export interface TableHeaderProps extends Pick<HeaderCellProps, "allRowsSelected
|
|
|
16
18
|
tableId: string;
|
|
17
19
|
virtualColSpan?: number;
|
|
18
20
|
}
|
|
19
|
-
export declare const TableHeader: import("react").MemoExoticComponent<({ allowDragColumnHeader, allowSelectAll, allRowsSelected, columns, customHeader, headings, onCheckBoxColumnHeaderClick, onHeightMeasured, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onSortColumn, showBookends, showColumnHeaderMenus, tableConfig, tableId, virtualColSpan, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
21
|
+
export declare const TableHeader: import("react").MemoExoticComponent<({ HeaderCell, allowDragColumnHeader, allowSelectAll, allRowsSelected, columns, customHeader, headings, onCheckBoxColumnHeaderClick, onHeightMeasured, onMoveColumn, onMoveGroupColumn, onRemoveGroupColumn, onResizeColumn, onSortColumn, showBookends, showColumnHeaderMenus, tableConfig, tableId, virtualColSpan, }: TableHeaderProps) => import("react/jsx-runtime").JSX.Element>;
|