@lablup/ui-common 0.2.0-alpha.17 → 0.2.0-alpha.18
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/README.md +1 -0
- package/astryx/components/Board.doc.mjs +122 -0
- package/astryx/components/Board.tsx +3 -0
- package/astryx/docs/ui-common.doc.mjs +1 -1
- package/dist/assets/components/Board/Board.css +2 -0
- package/dist/components/Board/Board.d.ts +102 -0
- package/dist/components/Board/Board.messages.d.ts +62 -0
- package/dist/components/Board/Board.messages.js +68 -0
- package/dist/components/Board/Board.messages.js.map +1 -0
- package/dist/components/Board/Board2.js +607 -0
- package/dist/components/Board/Board2.js.map +1 -0
- package/dist/components/Board/engine.d.ts +60 -0
- package/dist/components/Board/engine.js +397 -0
- package/dist/components/Board/engine.js.map +1 -0
- package/dist/components/Board/index.d.ts +4 -0
- package/dist/components/Board/index.js +3 -0
- package/dist/components/Board/layout.d.ts +81 -0
- package/dist/components/Board/layout.js +67 -0
- package/dist/components/Board/layout.js.map +1 -0
- package/dist/components/Board/scroll.d.ts +38 -0
- package/dist/components/Board/scroll.js +42 -0
- package/dist/components/Board/scroll.js.map +1 -0
- package/dist/components/DataGrid/DataGrid2.js +128 -128
- package/dist/components/DataGrid/DataGrid2.js.map +1 -1
- package/dist/components/Form/FormItem.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader2.js +4 -4
- package/dist/components/PagedSelector/PagedSelector2.js +37 -37
- package/dist/components/PagedSelector/PagedSelector2.js.map +1 -1
- package/dist/components/SelectionLabel/SelectionLabel.js +4 -4
- package/dist/i18n/catalog.js +27 -25
- package/dist/i18n/catalog.js.map +1 -1
- package/dist/i18n/locales/de-DE.js +60 -0
- package/dist/i18n/locales/de-DE.js.map +1 -1
- package/dist/i18n/locales/el-GR.js +60 -0
- package/dist/i18n/locales/el-GR.js.map +1 -1
- package/dist/i18n/locales/es-ES.js +60 -0
- package/dist/i18n/locales/es-ES.js.map +1 -1
- package/dist/i18n/locales/fi-FI.js +60 -0
- package/dist/i18n/locales/fi-FI.js.map +1 -1
- package/dist/i18n/locales/fr-FR.js +60 -0
- package/dist/i18n/locales/fr-FR.js.map +1 -1
- package/dist/i18n/locales/id-ID.js +60 -0
- package/dist/i18n/locales/id-ID.js.map +1 -1
- package/dist/i18n/locales/it-IT.js +60 -0
- package/dist/i18n/locales/it-IT.js.map +1 -1
- package/dist/i18n/locales/ja-JP.js +60 -0
- package/dist/i18n/locales/ja-JP.js.map +1 -1
- package/dist/i18n/locales/ko-KR.js +60 -0
- package/dist/i18n/locales/ko-KR.js.map +1 -1
- package/dist/i18n/locales/mn-MN.js +60 -0
- package/dist/i18n/locales/mn-MN.js.map +1 -1
- package/dist/i18n/locales/ms-MY.js +60 -0
- package/dist/i18n/locales/ms-MY.js.map +1 -1
- package/dist/i18n/locales/pl-PL.js +60 -0
- package/dist/i18n/locales/pl-PL.js.map +1 -1
- package/dist/i18n/locales/pt-BR.js +60 -0
- package/dist/i18n/locales/pt-BR.js.map +1 -1
- package/dist/i18n/locales/pt-PT.js +60 -0
- package/dist/i18n/locales/pt-PT.js.map +1 -1
- package/dist/i18n/locales/ru-RU.js +60 -0
- package/dist/i18n/locales/ru-RU.js.map +1 -1
- package/dist/i18n/locales/th-TH.js +60 -0
- package/dist/i18n/locales/th-TH.js.map +1 -1
- package/dist/i18n/locales/tr-TR.js +60 -0
- package/dist/i18n/locales/tr-TR.js.map +1 -1
- package/dist/i18n/locales/vi-VN.js +60 -0
- package/dist/i18n/locales/vi-VN.js.map +1 -1
- package/dist/i18n/locales/zh-CN.js +60 -0
- package/dist/i18n/locales/zh-CN.js.map +1 -1
- package/dist/i18n/locales/zh-TW.js +60 -0
- package/dist/i18n/locales/zh-TW.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +61 -59
- package/dist/instance.js +1 -1
- package/dist/ui-common-locales/de-DE.json +60 -0
- package/dist/ui-common-locales/el-GR.json +60 -0
- package/dist/ui-common-locales/en.json +60 -0
- package/dist/ui-common-locales/es-ES.json +60 -0
- package/dist/ui-common-locales/fi-FI.json +60 -0
- package/dist/ui-common-locales/fr-FR.json +60 -0
- package/dist/ui-common-locales/id-ID.json +60 -0
- package/dist/ui-common-locales/it-IT.json +60 -0
- package/dist/ui-common-locales/ja-JP.json +60 -0
- package/dist/ui-common-locales/ko-KR.json +60 -0
- package/dist/ui-common-locales/mn-MN.json +60 -0
- package/dist/ui-common-locales/ms-MY.json +60 -0
- package/dist/ui-common-locales/pl-PL.json +60 -0
- package/dist/ui-common-locales/pt-BR.json +60 -0
- package/dist/ui-common-locales/pt-PT.json +60 -0
- package/dist/ui-common-locales/ru-RU.json +60 -0
- package/dist/ui-common-locales/th-TH.json +60 -0
- package/dist/ui-common-locales/tr-TR.json +60 -0
- package/dist/ui-common-locales/vi-VN.json +60 -0
- package/dist/ui-common-locales/zh-CN.json +60 -0
- package/dist/ui-common-locales/zh-TW.json +60 -0
- package/exports.customs.json +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGrid2.js","names":[],"sources":["../../../src/components/DataGrid/DataGrid.tsx"],"sourcesContent":["/**\n * DataGrid\n *\n * Astryx `Table` with the pieces a list page needs around it: a page bar with\n * a range line, client or server sorting, row selection by key, resizable\n * and pinnable columns, expandable rows, per-user column settings (visibility,\n * order, width) and a CSV export picker.\n *\n * Rows are sliced to the page unless `pagination.totalItems` says the caller\n * already sliced them. Sorting is client-side for columns with `compare`,\n * otherwise it only reports `onSortChange`. Column settings live in one\n * overrides record (`hidden`, `order`, `width` per column key) that a product\n * persists as it likes.\n *\n * Plugin order matters: Astryx runs columnSettings, sort, selection, then\n * unknown names in insertion order. `resize` / `sticky` / `scrollX` /\n * `scrollY` / `cellRow` / `expansion` read the final column list, and\n * `scrollY` runs before `cellRow` so a column's `getCellProps` wins.\n *\n * @example\n * <DataGrid\n * data={users}\n * idKey=\"id\"\n * columns={[\n * { key: \"name\", header: \"Name\", renderCell: (u) => u.name, sortKey: \"name\" },\n * { key: \"email\", header: \"Email\", renderCell: (u) => u.email },\n * ]}\n * sort={sort}\n * onSortChange={setSort}\n * pagination={{ page, pageSize, totalItems, onChange: setPage }}\n * />\n */\nimport {\n isValidElement,\n type Key,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type TdHTMLAttributes,\n} from \"react\";\nimport { EmptyState } from \"@astryxdesign/core/EmptyState\";\nimport { Button } from \"@astryxdesign/core/Button\";\nimport { Icon } from \"@astryxdesign/core/Icon\";\nimport { IconButton } from \"@astryxdesign/core/IconButton\";\nimport { Pagination, type PaginationProps } from \"@astryxdesign/core/Pagination\";\nimport { HStack, VStack } from \"@astryxdesign/core/Stack\";\nimport {\n Table,\n pixel,\n proportional,\n useTableColumnResize,\n useTableColumnSettings,\n useTableSelection,\n useTableSortable,\n useTableStickyColumns,\n type TableColumn,\n type TablePlugin,\n type TableProps,\n type TableSortState,\n} from \"@astryxdesign/core/Table\";\nimport { Text } from \"@astryxdesign/core/Text\";\nimport { ChevronDown, ChevronRight, FileDown, Inbox, Settings } from \"lucide-react\";\n\nimport { useUicTranslator } from \"../../i18n/useUicTranslator\";\nimport {\n DataGridExportModal,\n type DataGridExportModalProps,\n} from \"./DataGridExportModal\";\nimport {\n DataGridSettingsModal,\n type DataGridSettingsModalProps,\n type DataGridSettingsResult,\n} from \"./DataGridSettingsModal\";\nimport { nodeToPlainText } from \"./nodeToPlainText\";\nimport \"./DataGrid.css\";\n\n/** A row identity, as `idKey` returns it. */\nexport type DataGridKey = Key;\n\nexport type DataGridSortDirection = \"ascending\" | \"descending\";\n\n/** The active sort: one column, by its `sortKey`. */\nexport interface DataGridSort {\n sortKey: string;\n direction: DataGridSortDirection;\n}\n\nexport interface DataGridColumn<T> {\n /** Stable identity: column settings, widths and pinning use it. */\n key: string;\n /** Header content. It is clipped to the column width. */\n header?: ReactNode;\n /** Caption above the header, for a column that belongs to a group. */\n groupHeader?: ReactNode;\n /**\n * Plain-text name in the settings and export dialogs. Default: the text of\n * `groupHeader` and `header` joined with \" / \", else the key.\n */\n label?: string;\n /** Cell content. `index` is the row's position on the current page. */\n renderCell?: (item: T, index: number) => ReactNode;\n /** Width in pixels. A resized width replaces it. Without one the column flexes. */\n width?: number;\n /** Lower bound, in pixels, of a flexing column. */\n minWidth?: number;\n align?: \"start\" | \"center\" | \"end\";\n /** Makes the column sortable. The sort state names it by this key. */\n sortKey?: string;\n /**\n * Sorts the rows on the client when this column is sorted. Compare in\n * ascending order; the grid reverses the result for descending.\n */\n compare?: (a: T, b: T, direction: DataGridSortDirection) => number;\n /**\n * Pins the column to an edge. Only the contiguous run of pinned columns at\n * each edge of the displayed order is pinned.\n */\n pin?: \"start\" | \"end\";\n /** Column settings cannot hide it. */\n isAlwaysVisible?: boolean;\n /** Hidden until the user shows it in the column settings. */\n isHiddenByDefault?: boolean;\n /** Fields this column exports as. Without them it cannot be exported. */\n exportKeys?: ReadonlyArray<string>;\n /** Extra attributes for this column's body cells. */\n getCellProps?: (item: T, index: number) => TdHTMLAttributes<HTMLTableCellElement>;\n}\n\n/** Per-column settings a user changed, keyed by column key. */\nexport interface DataGridColumnOverride {\n hidden?: boolean;\n /** Display position. Lower comes first. Set only after a reorder. */\n order?: number;\n /** Resized width in pixels. */\n width?: number;\n}\n\nexport type DataGridColumnOverrides = Record<string, DataGridColumnOverride>;\n\nexport interface DataGridColumnSettings {\n /** Controlled overrides. */\n overrides?: DataGridColumnOverrides;\n /** Initial overrides when uncontrolled; always merged under `overrides`. */\n defaultOverrides?: DataGridColumnOverrides;\n onOverridesChange?: (overrides: DataGridColumnOverrides) => void;\n /** Whether the settings dialog lets the user reorder columns. Default: true */\n isReorderable?: boolean;\n /** Strings of the settings dialog. */\n modalProps?: Pick<\n DataGridSettingsModalProps,\n \"title\" | \"subtitle\" | \"searchLabel\" | \"noMatchText\" | \"applyLabel\" | \"cancelLabel\"\n >;\n}\n\nexport interface DataGridCsvExport {\n /** Export keys the backend can produce. Columns asking for others are disabled. */\n supportedKeys: ReadonlyArray<string>;\n /** Runs the export with the chosen keys. The dialog closes when it resolves. */\n onExport: (keys: string[]) => Promise<void>;\n /** A warning above the column list, e.g. that the export is truncated. */\n notice?: ReactNode;\n /** Strings of the export dialog. */\n modalProps?: Pick<\n DataGridExportModalProps,\n \"title\" | \"subtitle\" | \"searchLabel\" | \"noMatchText\" | \"exportLabel\" | \"cancelLabel\"\n >;\n}\n\nexport interface DataGridSelection<T> {\n /** The selected row keys. Selection is controlled. */\n selectedKeys?: ReadonlyArray<DataGridKey>;\n onChange?: (keys: string[], items: T[]) => void;\n /** Whether a row's checkbox is enabled. Select-all leaves a disabled row as it is. */\n getIsItemEnabled?: (item: T) => boolean;\n /** Accessible name of a row's checkbox. Default: the row key. */\n getRowLabel?: (item: T) => string;\n /** Select-all keeps keys of rows on other pages. Default: false */\n isPreservingOtherPages?: boolean;\n}\n\nexport interface DataGridExpansion<T> {\n renderExpandedRow: (item: T, index: number) => ReactNode;\n getIsRowExpandable?: (item: T) => boolean;\n /** Controlled expanded row keys. */\n expandedKeys?: ReadonlyArray<DataGridKey>;\n defaultExpandedKeys?: ReadonlyArray<DataGridKey>;\n onExpandedKeysChange?: (keys: ReadonlyArray<DataGridKey>) => void;\n /** Header content of the expand-button column. */\n columnHeader?: ReactNode;\n /** Width in pixels of the expand-button column. */\n columnWidth?: number;\n}\n\nexport interface DataGridPagination extends Omit<\n PaginationProps,\n | \"page\"\n | \"totalItems\"\n | \"onChange\"\n | \"onPageSizeChange\"\n | \"label\"\n | \"ref\"\n | \"totalPages\"\n | \"hasMore\"\n> {\n /** Controlled page, 1-based. */\n page?: number;\n defaultPage?: number;\n defaultPageSize?: number;\n /**\n * Total row count. Without it the grid pages `data` itself; a total larger\n * than `data` declares the rows already sliced to the page.\n */\n totalItems?: number;\n onChange?: (page: number, pageSize: number) => void;\n /** Whether the bar offers a page-size choice. Default: true */\n hasPageSizeSelector?: boolean;\n /** Hides the page bar while every row fits on one page. Default: false */\n isHiddenOnSinglePage?: boolean;\n /** Content at the end of the bar. */\n endContent?: ReactNode;\n}\n\ntype AnyRow = Record<string, unknown>;\n\nexport interface DataGridProps<T extends object = AnyRow> extends Omit<\n TableProps<AnyRow>,\n | \"data\"\n | \"columns\"\n | \"idKey\"\n | \"rowIndexStart\"\n | \"rowCount\"\n | \"children\"\n | \"scrollWrapper\"\n | \"ref\"\n | \"emptyState\"\n | \"className\"\n | \"style\"\n | \"plugins\"\n | \"onChange\"\n> {\n data?: ReadonlyArray<T>;\n columns?: ReadonlyArray<DataGridColumn<T>>;\n /**\n * Row identity: a field name or a function. A missing field falls back to\n * the row's `key`, then its `id`, then its position.\n */\n idKey?: string | ((item: T) => DataGridKey);\n /** Dims the rows and blocks input while data is refetched. */\n isLoading?: boolean;\n /** Drag-to-resize column borders. Default: true */\n isResizable?: boolean;\n /** Controlled sort; `null` for none. */\n sort?: DataGridSort | null;\n defaultSort?: DataGridSort | null;\n onSortChange?: (sort: DataGridSort | null) => void;\n selection?: DataGridSelection<T>;\n /** The page bar. `false` shows every row and no bar. */\n pagination?: false | DataGridPagination;\n /** Enables the column settings button and persists resized widths. */\n columnSettings?: DataGridColumnSettings;\n /** Enables the CSV export button. */\n csvExport?: DataGridCsvExport;\n expansion?: DataGridExpansion<T>;\n /**\n * Shown in place of the rows when there are none. A string gets the default\n * icon and layout, a node is rendered as is, `false` shows nothing. Default:\n * the catalog's `uic.DataGrid.noData`.\n */\n emptyState?: ReactNode | false;\n /** Extra attributes for a body row. */\n getRowProps?: (\n item: T,\n index: number | undefined,\n ) => HTMLAttributes<HTMLTableRowElement>;\n /**\n * Scrolls horizontally with the table at this width (at least the\n * container's). Columns without a width then size to their content.\n */\n scrollWidth?: number | string;\n /** Caps the rows' height and makes the header sticky. */\n maxHeight?: number | string;\n /** Hides the header row, and with it sorting and select-all. */\n isHeaderHidden?: boolean;\n /** Accessible name of the expand buttons. Default: the catalog's `uic.DataGrid.expandRow` */\n expandRowLabel?: string;\n /** Shown when the page lies past the last one. Default: the catalog's `uic.DataGrid.invalidPage` */\n invalidPageText?: string;\n /** Default: the catalog's `uic.DataGrid.goToFirstPage` */\n goToFirstPageLabel?: string;\n /** Accessible name of the page navigation. Default: the catalog's `uic.DataGrid.pagination` */\n paginationLabel?: string;\n /** The range line beside the page navigation. Default: the catalog's `uic.DataGrid.range` */\n renderRange?: (range: { start: number; end: number; total: number }) => ReactNode;\n /** Default: the catalog's `uic.DataGrid.settings` */\n settingsLabel?: string;\n /** Default: the catalog's `uic.DataGrid.exportCsv` */\n exportLabel?: string;\n className?: string;\n style?: CSSProperties;\n}\n\nconst EXPAND_COLUMN_KEY = \"__uic_expand__\";\n/** Key of the checkbox column Astryx's selection plugin injects; not exported by Astryx. */\nconst SELECTION_COLUMN_KEY = \"__xds_selection\";\n/**\n * Measured column widths, in pixels. Selection: Astryx's 24px first-column\n * inset + the 20px checkbox + an 8px trailing pad (the plugin's own 36 lets\n * the checkbox overhang its cell). Expand: the same inset + the 24px button +\n * 8px, or an 8px lead-in instead of the inset behind a selection column.\n */\nconst SELECTION_COLUMN_WIDTH = 52;\nconst EXPAND_COLUMN_WIDTH_FIRST = 56;\nconst EXPAND_COLUMN_WIDTH_AFTER_SELECTION = 40;\nconst MIN_COLUMN_WIDTH = 60;\nconst DETAIL_ROW_MARKER = \"__uic_detail_for__\";\nconst DEFAULT_PAGE_SIZE = 10;\nconst DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50];\n\nconst EMPTY_STATE_ICON = <Icon icon={Inbox} size=\"lg\" color=\"secondary\" />;\n\nconst X_HEADER_RELEASE: CSSProperties = { width: \"auto\", maxWidth: \"none\" };\nconst X_BODY_RELEASE: CSSProperties = { maxWidth: \"none\" };\n// Inline beats the sticky-header rule's z 2 for pinned header cells.\nconst Y_PINNED_HEADER_STACK: CSSProperties = { zIndex: 3 };\n\nconst isDetailRow = (item: unknown): item is AnyRow =>\n !!item && typeof item === \"object\" && DETAIL_ROW_MARKER in item;\n\nconst toCssLength = (value: number | string): string =>\n typeof value === \"number\" ? `${value}px` : value;\n\nfunction mergeCellStyle<P extends { htmlProps: { style?: CSSProperties } }>(\n props: P,\n extra: CSSProperties,\n): P {\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n style: props.htmlProps.style ? { ...props.htmlProps.style, ...extra } : extra,\n },\n };\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/** The label a column carries in the settings and export dialogs. */\nexport function dataGridColumnLabel<T>(column: DataGridColumn<T>): string {\n if (column.label) return column.label;\n const own = nodeToPlainText(column.header).trim();\n const group = nodeToPlainText(column.groupHeader).trim();\n const label = group && own ? `${group} / ${own}` : own || group;\n return label || column.key;\n}\n\n/** Whether a column shows, given the user's overrides. */\n/**\n * The overrides record a settings dialog result writes. `defaultOverrides`\n * stays merged under it key by key, and a key it holds replaces the default's\n * entry whole. So a column is left out only while its default (natural, then\n * `defaultOverrides`) already renders what the user chose, and an entry that\n * is written states everything that differs from the natural column:\n * otherwise re-showing a column the defaults hide, or restoring the natural\n * order over a reordering default, would bring the default back.\n *\n * @internal Exported for tests.\n */\nexport function dataGridSettingsToOverrides({\n columns,\n result,\n defaultOverrides = {},\n overrides,\n isReorderable,\n}: {\n columns: ReadonlyArray<Pick<DataGridColumn<never>, \"key\" | \"isHiddenByDefault\">>;\n result: DataGridSettingsResult;\n defaultOverrides?: DataGridColumnOverrides;\n /** The overrides in effect, defaults merged; their widths are kept. */\n overrides: DataGridColumnOverrides;\n isReorderable: boolean;\n}): DataGridColumnOverrides {\n const naturalOrder = columns.map((column) => column.key);\n // A default order is only undone by stating every column's position.\n const writesOrder =\n isReorderable &&\n (result.columnOrder.length !== naturalOrder.length ||\n result.columnOrder.some((key, index) => key !== naturalOrder[index]) ||\n columns.some((column) => defaultOverrides[column.key]?.order !== undefined));\n const next: DataGridColumnOverrides = {};\n for (const column of columns) {\n const fallback = defaultOverrides[column.key];\n const naturalHidden = !!column.isHiddenByDefault;\n const defaultHidden = fallback?.hidden ?? naturalHidden;\n const hidden = !result.selectedColumnKeys.includes(column.key);\n const override: DataGridColumnOverride = {};\n if (hidden !== naturalHidden || hidden !== defaultHidden) override.hidden = hidden;\n if (writesOrder) {\n const orderIndex = result.columnOrder.indexOf(column.key);\n if (orderIndex !== -1) override.order = orderIndex;\n }\n // A settings change must not reset resized widths.\n const width = overrides[column.key]?.width;\n if (typeof width === \"number\") override.width = width;\n const matchesDefault =\n hidden === defaultHidden &&\n override.order === fallback?.order &&\n override.width === fallback?.width;\n if (!matchesDefault && Object.keys(override).length > 0)\n next[column.key] = override;\n }\n return next;\n}\n\nexport function isDataGridColumnVisible<T>(\n column: Pick<DataGridColumn<T>, \"key\" | \"isAlwaysVisible\" | \"isHiddenByDefault\">,\n overrides?: DataGridColumnOverrides,\n): boolean {\n if (column.isAlwaysVisible) return true;\n const hidden = overrides?.[column.key]?.hidden;\n return hidden !== undefined ? !hidden : !column.isHiddenByDefault;\n}\n\n/** Controlled when `value` is not undefined; the setter writes state only when uncontrolled. */\nfunction useControllableState<V>(value: V | undefined, initial: () => V) {\n const [state, setState] = useState<V>(initial);\n const isControlled = value !== undefined;\n const current = isControlled ? value : state;\n const set = (next: V) => {\n if (!isControlled) setState(next);\n };\n return [current, set] as const;\n}\n\nexport function DataGrid<T extends object = AnyRow>({\n data,\n columns = [],\n idKey = \"id\",\n isLoading = false,\n isResizable = true,\n sort: sortProp,\n defaultSort,\n onSortChange,\n selection,\n pagination,\n columnSettings,\n csvExport,\n expansion,\n emptyState,\n getRowProps,\n scrollWidth,\n maxHeight,\n isHeaderHidden = false,\n expandRowLabel,\n invalidPageText,\n goToFirstPageLabel,\n paginationLabel,\n renderRange,\n settingsLabel,\n exportLabel,\n density = \"compact\",\n dividers = \"rows\",\n hasHover = true,\n textOverflow = \"truncate\",\n className,\n style,\n ...tableProps\n}: DataGridProps<T>): ReactElement {\n const t = useUicTranslator();\n\n const isScrollX = scrollWidth !== undefined;\n const isScrollY = maxHeight !== undefined;\n\n const [isSettingsOpen, setIsSettingsOpen] = useState(false);\n const [isExportOpen, setIsExportOpen] = useState(false);\n\n /* ---- column overrides (visibility / order / width) ------------------- */\n\n const [storedOverrides, setStoredOverrides] = useState<DataGridColumnOverrides>(\n () => columnSettings?.defaultOverrides ?? {},\n );\n const isOverridesControlled = columnSettings?.overrides !== undefined;\n const ownOverrides = isOverridesControlled\n ? (columnSettings?.overrides ?? {})\n : storedOverrides;\n const setOverrides = (next: DataGridColumnOverrides) => {\n if (!isOverridesControlled) setStoredOverrides(next);\n columnSettings?.onOverridesChange?.(next);\n };\n const overrides: DataGridColumnOverrides = {\n ...(columnSettings?.defaultOverrides ?? {}),\n ...ownOverrides,\n };\n const isReorderable = !!columnSettings && columnSettings.isReorderable !== false;\n\n /* ---- resized widths ---------------------------------------------------- */\n\n // With columnSettings a width rides in the overrides record, so a resize\n // persists like a visibility change; without it the width is local state.\n const [localWidths, setLocalWidths] = useState<Record<string, number>>({});\n const columnWidths: Record<string, number> = {};\n if (columnSettings) {\n for (const [key, override] of Object.entries(overrides)) {\n if (typeof override?.width === \"number\") columnWidths[key] = override.width;\n }\n } else {\n Object.assign(columnWidths, localWidths);\n }\n\n const handleResizeEnd = (updates: Record<string, number>) => {\n if (!columnSettings) {\n setLocalWidths((prev) => ({ ...prev, ...updates }));\n return;\n }\n const next: DataGridColumnOverrides = { ...ownOverrides };\n for (const [key, width] of Object.entries(updates)) {\n if (key === EXPAND_COLUMN_KEY) continue;\n next[key] = { ...next[key], width };\n }\n setOverrides(next);\n };\n\n /* ---- row keys ---------------------------------------------------------- */\n\n const getRowKey = (item: T): string => {\n if (typeof idKey === \"function\") return String(idKey(item));\n const row = item as AnyRow;\n const direct = row[idKey];\n if (direct != null) return String(direct);\n const fallback = row.key ?? row.id;\n if (fallback != null) return String(fallback);\n return `__row_${data ? data.indexOf(item) : -1}`;\n };\n\n /* ---- sort -------------------------------------------------------------- */\n\n const [activeSort, setActiveSort] = useControllableState<DataGridSort | null>(\n sortProp,\n () => defaultSort ?? null,\n );\n\n const sortedRows = ((): T[] => {\n const source = data ? [...data] : [];\n if (!activeSort) return source;\n const compare = columns.find(\n (column) => column.sortKey === activeSort.sortKey && column.compare,\n )?.compare;\n if (!compare) return source;\n const { direction } = activeSort;\n return source.sort((a, b) =>\n direction === \"descending\" ? -compare(a, b, direction) : compare(a, b, direction),\n );\n })();\n\n /* ---- pagination -------------------------------------------------------- */\n\n const pager = pagination === false ? undefined : (pagination ?? {});\n const [currentPage, setCurrentPage] = useControllableState<number>(\n pager?.page,\n () => pager?.defaultPage ?? 1,\n );\n const [pageSize, setPageSize] = useControllableState<number>(\n pager?.pageSize,\n () => pager?.defaultPageSize ?? DEFAULT_PAGE_SIZE,\n );\n\n // Astryx's Pagination answers a page-size pick with onPageSizeChange(size)\n // and then onChange(1) in the same event, still closing over the old size.\n // Forwarding the second call would undo the pick on a controlled grid, so it\n // is dropped; a microtask clears the flag.\n const isPageSizeChangingRef = useRef(false);\n\n const total = pager?.totalItems ?? sortedRows.length;\n const lastPage = Math.max(1, Math.ceil(total / pageSize));\n const activePage = clamp(currentPage, 1, lastPage);\n const isPageOutOfRange =\n !!pager && total > 0 && (currentPage < 1 || currentPage > lastPage);\n // A total above the rows in hand means they are already one page.\n const isServerSliced = total > sortedRows.length;\n const pagedRows =\n pager && !isServerSliced && sortedRows.length > pageSize\n ? sortedRows.slice((activePage - 1) * pageSize, activePage * pageSize)\n : sortedRows;\n const rows = isPageOutOfRange ? [] : pagedRows;\n\n /* ---- expansion --------------------------------------------------------- */\n\n const [storedExpandedKeys, setStoredExpandedKeys] = useState<DataGridKey[]>(() => [\n ...(expansion?.defaultExpandedKeys ?? []),\n ]);\n const expandedKeys = expansion?.expandedKeys ?? storedExpandedKeys;\n const expandedKeySet = new Set(expandedKeys.map(String));\n const hasExpansion = !!expansion;\n const expandColumnWidth =\n expansion?.columnWidth ??\n (selection ? EXPAND_COLUMN_WIDTH_AFTER_SELECTION : EXPAND_COLUMN_WIDTH_FIRST);\n const detailInsetStart = (selection ? SELECTION_COLUMN_WIDTH : 0) + expandColumnWidth;\n\n const toggleExpanded = (key: string) => {\n const next = expandedKeySet.has(key)\n ? expandedKeys.filter((k) => String(k) !== key)\n : [...expandedKeys, key];\n if (!expansion?.expandedKeys) setStoredExpandedKeys(next);\n expansion?.onExpandedKeysChange?.(next);\n };\n\n const rowIndexByKey = new Map<string, number>();\n rows.forEach((item, index) => rowIndexByKey.set(getRowKey(item), index));\n\n // Each expanded row is followed by a marker row the expansion plugin turns\n // into one full-width cell.\n const tableData: AnyRow[] = [];\n for (const item of rows) {\n tableData.push(item as AnyRow);\n if (!hasExpansion) continue;\n const key = getRowKey(item);\n if (expandedKeySet.has(key) && (expansion?.getIsRowExpandable?.(item) ?? true)) {\n tableData.push({ [DETAIL_ROW_MARKER]: key, id: `${key}__detail` });\n }\n }\n\n // From every row, not the page: selection resolves keys on other pages too.\n const itemByKey = new Map<string, T>();\n sortedRows.forEach((item) => itemByKey.set(getRowKey(item), item));\n\n /* ---- Astryx columns ---------------------------------------------------- */\n\n const tableColumns: TableColumn<AnyRow>[] = [];\n if (hasExpansion) {\n tableColumns.push({\n key: EXPAND_COLUMN_KEY,\n header: expansion?.columnHeader ?? \"\",\n width: pixel(expandColumnWidth),\n resizable: false,\n renderCell: (row) => {\n if (isDetailRow(row)) return null;\n const item = row as T;\n if (!(expansion?.getIsRowExpandable?.(item) ?? true)) return null;\n const key = getRowKey(item);\n return (\n <IconButton\n label={expandRowLabel ?? t(\"uic.DataGrid.expandRow\")}\n icon={expandedKeySet.has(key) ? <ChevronDown /> : <ChevronRight />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => toggleExpanded(key)}\n />\n );\n },\n });\n }\n\n for (const column of columns) {\n const width = columnWidths[column.key] ?? column.width;\n const header = (\n <span className=\"uic-data-grid__clip\">\n {column.groupHeader == null ? (\n column.header\n ) : (\n <VStack gap={0} align=\"start\">\n <Text type=\"supporting\" color=\"secondary\">\n {column.groupHeader}\n </Text>\n <span>{column.header}</span>\n </VStack>\n )}\n </span>\n );\n tableColumns.push({\n key: column.key,\n header,\n align: column.align === \"start\" ? undefined : column.align,\n sortable: column.sortKey ? { sortKey: column.sortKey } : false,\n resizable: isResizable,\n // In scroll-x mode a width-less column takes no width, so its content sizes it.\n width:\n width != null\n ? pixel(width)\n : isScrollX\n ? undefined\n : proportional(\n 1,\n typeof column.minWidth === \"number\"\n ? { minWidth: column.minWidth }\n : undefined,\n ),\n renderCell: (row) => {\n if (isDetailRow(row)) return null;\n const item = row as T;\n const content = column.renderCell\n ? column.renderCell(item, rowIndexByKey.get(getRowKey(item)) ?? 0)\n : defaultCell(row[column.key]);\n if (textOverflow !== \"truncate\" || content == null) return content;\n return <span className=\"uic-data-grid__clip\">{content}</span>;\n },\n });\n }\n\n /* ---- visibility + order ------------------------------------------------ */\n\n const visibleColumns = columnSettings\n ? columns.filter((column) => isDataGridColumnVisible(column, overrides))\n : [...columns];\n const orderedColumns = isReorderable\n ? visibleColumns\n .map((column, index) => ({ column, index }))\n .sort(\n (a, b) =>\n (overrides[a.column.key]?.order ?? Number.MAX_SAFE_INTEGER) -\n (overrides[b.column.key]?.order ?? Number.MAX_SAFE_INTEGER) ||\n a.index - b.index,\n )\n .map(({ column }) => column)\n : visibleColumns;\n const activeColumnKeys = [\n ...(hasExpansion ? [EXPAND_COLUMN_KEY] : []),\n ...orderedColumns.map((column) => column.key),\n ];\n\n const columnSettingsPlugin = useTableColumnSettings<AnyRow>({\n columns: [\n ...(hasExpansion\n ? [{ key: EXPAND_COLUMN_KEY, label: \"\", isAlwaysVisible: true }]\n : []),\n ...columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n isAlwaysVisible: !!column.isAlwaysVisible,\n })),\n ],\n activeColumnKeys,\n // The settings dialog owns the write path (it keeps `order` and `width`).\n onChangeActiveColumnKeys: () => {},\n });\n\n /* ---- pinning ----------------------------------------------------------- */\n\n const startKeys: string[] = [];\n for (const column of orderedColumns) {\n if (column.pin === \"start\") startKeys.push(column.key);\n else break;\n }\n const endKeys: string[] = [];\n for (const column of [...orderedColumns].reverse()) {\n if (column.pin === \"end\") endKeys.unshift(column.key);\n else break;\n }\n const stickyConfig = {\n startKeys:\n startKeys.length === 0\n ? undefined\n : [\n ...(selection ? [SELECTION_COLUMN_KEY] : []),\n ...(hasExpansion ? [EXPAND_COLUMN_KEY] : []),\n ...startKeys,\n ],\n endKeys: endKeys.length === 0 ? undefined : endKeys,\n };\n const stickyPlugin = useTableStickyColumns<AnyRow>(\n stickyConfig.startKeys || stickyConfig.endKeys ? stickyConfig : {},\n );\n\n /* ---- per-cell / per-row attributes -------------------------------------- */\n\n const columnByKey = new Map(columns.map((column) => [column.key, column]));\n\n const cellRowPlugin: TablePlugin<AnyRow> = {\n transformBodyCell: (props, column, row) => {\n if (isDetailRow(row)) return props;\n const item = row as T;\n const extra = columnByKey\n .get(column.key)\n ?.getCellProps?.(item, rowIndexByKey.get(getRowKey(item)) ?? 0);\n if (!extra) return props;\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n ...extra,\n style: { ...props.htmlProps.style, ...extra.style },\n },\n };\n },\n transformBodyRow: (props, row) => {\n if (!getRowProps || isDetailRow(row)) return props;\n const item = row as T;\n const extra = getRowProps(item, rowIndexByKey.get(getRowKey(item)));\n if (!extra) return props;\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n ...extra,\n style: { ...props.htmlProps.style, ...extra.style },\n },\n };\n },\n };\n\n // Astryx clips cells with `max-width: 0`; scroll-x releases width-less columns only.\n const scrollXPlugin: TablePlugin<AnyRow> = {\n transformHeaderCell: (props, column) =>\n column.width != null ? props : mergeCellStyle(props, X_HEADER_RELEASE),\n transformBodyCell: (props, column) =>\n column.width != null ? props : mergeCellStyle(props, X_BODY_RELEASE),\n };\n\n const pinnedKeys = new Set([\n ...(stickyConfig.startKeys ?? []),\n ...(stickyConfig.endKeys ?? []),\n ]);\n const scrollYPlugin: TablePlugin<AnyRow> = {\n transformHeaderCell: (props, column) =>\n pinnedKeys.has(column.key) ? mergeCellStyle(props, Y_PINNED_HEADER_STACK) : props,\n };\n\n /* ---- sorting ----------------------------------------------------------- */\n\n const sortState: TableSortState = activeSort\n ? [{ sortKey: activeSort.sortKey, direction: activeSort.direction }]\n : [];\n\n const sortPlugin = useTableSortable<AnyRow>({\n sort: sortState,\n allowUnsortedState: true,\n onSortChange: (next) => {\n const first = next[0];\n const nextSort: DataGridSort | null = first\n ? { sortKey: first.sortKey, direction: first.direction }\n : null;\n setActiveSort(nextSort);\n onSortChange?.(nextSort);\n },\n });\n\n /* ---- selection --------------------------------------------------------- */\n\n const selectedKeySet = new Set((selection?.selectedKeys ?? []).map(String));\n const emitSelection = (keys: string[]) => {\n const items = keys\n .map((key) => itemByKey.get(key))\n .filter((item) => item !== undefined);\n selection?.onChange?.(keys, items);\n };\n const isRowSelected = (item: T) => selectedKeySet.has(getRowKey(item));\n const isRowEnabled = (item: T) => selection?.getIsItemEnabled?.(item) ?? true;\n // Select-all acts on the enabled rows only; a disabled row keeps its state.\n const enabledRows = rows.filter(isRowEnabled);\n\n const selectionPlugin = useTableSelection<AnyRow>({\n getIsItemSelectable: (row) => !isDetailRow(row),\n getIsItemSelected: (row) => !isDetailRow(row) && isRowSelected(row as T),\n getIsItemEnabled: (row) => !isDetailRow(row) && isRowEnabled(row as T),\n getRowLabel: (row) =>\n isDetailRow(row)\n ? \"\"\n : (selection?.getRowLabel?.(row as T) ?? getRowKey(row as T)),\n getIsAllSelected: () => enabledRows.length > 0 && enabledRows.every(isRowSelected),\n getIsIndeterminate: () =>\n enabledRows.some(isRowSelected) && !enabledRows.every(isRowSelected),\n onSelectItem: ({ item, isSelected }) => {\n if (isDetailRow(item)) return;\n const key = getRowKey(item as T);\n const next = new Set(selectedKeySet);\n if (isSelected) next.add(key);\n else next.delete(key);\n emitSelection([...next]);\n },\n onSelectAll: ({ isAllSelected }) => {\n const next = new Set(selection?.isPreservingOtherPages ? selectedKeySet : []);\n for (const item of rows) {\n const key = getRowKey(item);\n const isSelected = isRowEnabled(item) ? isAllSelected : isRowSelected(item);\n if (isSelected) next.add(key);\n else next.delete(key);\n }\n emitSelection([...next]);\n },\n });\n\n const selectionWidthPlugin: TablePlugin<AnyRow> = {\n transformColumns: (cols) =>\n cols.map((column) =>\n column.key === SELECTION_COLUMN_KEY\n ? { ...column, width: pixel(SELECTION_COLUMN_WIDTH) }\n : column,\n ),\n };\n\n /* ---- resize ------------------------------------------------------------ */\n\n const resizePlugin = useTableColumnResize<AnyRow>({\n columns: tableColumns,\n columnWidths,\n minWidth: MIN_COLUMN_WIDTH,\n onColumnResizeEnd: handleResizeEnd,\n });\n\n /* ---- expansion --------------------------------------------------------- */\n\n const renderedColumnCount = activeColumnKeys.length + (selection ? 1 : 0);\n const expansionPlugin: TablePlugin<AnyRow> = {\n transformBodyRow: (props, row) => {\n if (!isDetailRow(row)) return props;\n const parentKey = String(row[DETAIL_ROW_MARKER]);\n const item = itemByKey.get(parentKey);\n if (!item) return props;\n return {\n ...props,\n children: (\n <td\n colSpan={renderedColumnCount}\n className=\"uic-data-grid__detail\"\n style={{ paddingInlineStart: detailInsetStart }}\n >\n {expansion?.renderExpandedRow(item, rowIndexByKey.get(parentKey) ?? 0)}\n </td>\n ),\n };\n },\n };\n\n const plugins: Record<string, TablePlugin<AnyRow>> = {\n columnSettings: columnSettingsPlugin,\n sort: sortPlugin,\n };\n if (selection) {\n plugins.selection = selectionPlugin;\n plugins.selectionWidth = selectionWidthPlugin;\n }\n if (isResizable) plugins.resize = resizePlugin;\n plugins.sticky = stickyPlugin;\n if (isScrollX) plugins.scrollX = scrollXPlugin;\n // Without pinned columns the sticky header is pure CSS.\n if (isScrollY && pinnedKeys.size > 0) plugins.scrollY = scrollYPlugin;\n plugins.cellRow = cellRowPlugin;\n if (hasExpansion) plugins.expansion = expansionPlugin;\n\n /* ---- bottom bar -------------------------------------------------------- */\n\n const {\n page: _page,\n defaultPage: _defaultPage,\n defaultPageSize: _defaultPageSize,\n totalItems: _totalItems,\n onChange: _onChange,\n hasPageSizeSelector = true,\n isHiddenOnSinglePage = false,\n endContent,\n pageSizeOptions,\n size: pagerSize = \"sm\",\n ...paginationRest\n } = pager ?? {};\n\n const rangeStart = total === 0 ? 0 : (activePage - 1) * pageSize + 1;\n const rangeEnd = Math.min(activePage * pageSize, total);\n const isPagerVisible = !!pager && !(isHiddenOnSinglePage && total <= pageSize);\n const hasBottomBar = isPagerVisible || !!columnSettings || !!csvExport;\n\n const emptyStateNode = isPageOutOfRange ? (\n // The way back outranks any empty state the caller gave.\n <EmptyState\n isCompact\n icon={EMPTY_STATE_ICON}\n title={invalidPageText ?? t(\"uic.DataGrid.invalidPage\")}\n actions={\n <Button\n variant=\"primary\"\n label={goToFirstPageLabel ?? t(\"uic.DataGrid.goToFirstPage\")}\n onClick={() => {\n setCurrentPage(1);\n pager?.onChange?.(1, pageSize);\n }}\n />\n }\n />\n ) : emptyState === false ? (\n false\n ) : emptyState == null || typeof emptyState === \"string\" ? (\n <EmptyState\n isCompact\n icon={EMPTY_STATE_ICON}\n title={emptyState ?? t(\"uic.DataGrid.noData\")}\n />\n ) : (\n emptyState\n );\n\n const applySettings = (result: DataGridSettingsResult) => {\n setIsSettingsOpen(false);\n setOverrides(\n dataGridSettingsToOverrides({\n columns,\n result,\n defaultOverrides: columnSettings?.defaultOverrides,\n overrides,\n isReorderable,\n }),\n );\n };\n\n return (\n <div\n className={[\"uic-data-grid\", className].filter(Boolean).join(\" \")}\n style={style}\n >\n <div\n aria-busy={isLoading || undefined}\n className={[\n \"uic-data-grid__body\",\n isLoading && \"uic-data-grid__body--loading\",\n isHeaderHidden && \"uic-data-grid__body--no-header\",\n dividers !== \"grid\" && \"uic-data-grid__body--header-split\",\n isScrollX && \"uic-data-grid__body--scroll-x\",\n isScrollY && \"uic-data-grid__body--scroll-y\",\n ]\n .filter(Boolean)\n .join(\" \")}\n style={\n {\n ...(isScrollX\n ? { \"--data-grid-scroll-width\": toCssLength(scrollWidth) }\n : null),\n ...(isScrollY\n ? { \"--data-grid-max-height\": toCssLength(maxHeight) }\n : null),\n } as CSSProperties\n }\n >\n <Table<AnyRow>\n {...tableProps}\n data={tableData}\n columns={tableColumns}\n idKey={(row: AnyRow) =>\n isDetailRow(row)\n ? `${String(row[DETAIL_ROW_MARKER])}__detail`\n : getRowKey(row as T)\n }\n density={density}\n dividers={dividers}\n hasHover={hasHover}\n textOverflow={textOverflow}\n emptyState={emptyStateNode}\n rowCount={total || undefined}\n rowIndexStart={pager ? (activePage - 1) * pageSize + 1 : undefined}\n plugins={plugins}\n />\n </div>\n\n {hasBottomBar ? (\n <HStack justify=\"end\" align=\"center\" gap={2} className=\"uic-data-grid__footer\">\n {isPagerVisible ? (\n <>\n <Text type=\"supporting\" color=\"secondary\">\n {renderRange\n ? renderRange({ start: rangeStart, end: rangeEnd, total })\n : t(\"uic.DataGrid.range\", {\n start: rangeStart,\n end: rangeEnd,\n total,\n })}\n </Text>\n <Pagination\n variant=\"pages\"\n {...paginationRest}\n page={activePage}\n pageSize={pageSize}\n totalItems={total}\n // Astryx shows the size choice exactly when options are passed.\n pageSizeOptions={\n hasPageSizeSelector\n ? (pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS)\n : undefined\n }\n size={pagerSize}\n label={paginationLabel ?? t(\"uic.DataGrid.pagination\")}\n onChange={(page) => {\n if (isPageSizeChangingRef.current) return;\n setCurrentPage(page);\n pager?.onChange?.(page, pageSize);\n }}\n onPageSizeChange={(nextSize) => {\n isPageSizeChangingRef.current = true;\n queueMicrotask(() => {\n isPageSizeChangingRef.current = false;\n });\n setCurrentPage(1);\n setPageSize(nextSize);\n pager?.onChange?.(1, nextSize);\n }}\n />\n </>\n ) : null}\n {columnSettings ? (\n <IconButton\n label={settingsLabel ?? t(\"uic.DataGrid.settings\")}\n icon={<Settings />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsSettingsOpen(true)}\n />\n ) : null}\n {csvExport ? (\n <IconButton\n label={exportLabel ?? t(\"uic.DataGrid.exportCsv\")}\n icon={<FileDown />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsExportOpen(true)}\n />\n ) : null}\n {pager ? endContent : null}\n </HStack>\n ) : null}\n\n {columnSettings ? (\n <DataGridSettingsModal\n {...columnSettings.modalProps}\n isOpen={isSettingsOpen}\n onOpenChange={setIsSettingsOpen}\n columns={columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n isAlwaysVisible: !!column.isAlwaysVisible,\n }))}\n visibleColumnKeys={orderedColumns.map((column) => column.key)}\n isReorderable={isReorderable}\n onApply={applySettings}\n />\n ) : null}\n\n {csvExport ? (\n <DataGridExportModal\n {...csvExport.modalProps}\n isOpen={isExportOpen}\n onOpenChange={setIsExportOpen}\n columns={columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n exportKeys: column.exportKeys ?? [],\n }))}\n supportedKeys={csvExport.supportedKeys}\n notice={csvExport.notice}\n onExport={async (keys) => {\n await csvExport.onExport(keys);\n setIsExportOpen(false);\n }}\n />\n ) : null}\n </div>\n );\n}\n\nfunction defaultCell(value: unknown): ReactNode {\n if (value == null || value === \"\") return null;\n if (isValidElement(value)) return value;\n return String(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgTA,IAAM,IAAoB,kBAEpB,KAAuB,mBAOvB,KAAyB,IACzB,KAA4B,IAC5B,KAAsC,IACtC,KAAmB,IACnB,IAAoB,sBACpB,KAAoB,IACpB,KAA4B;CAAC;CAAI;CAAI;AAAE,GAEvC,KAAmB,kBAAC,GAAD;CAAM,MAAM;CAAO,MAAK;CAAK,OAAM;AAAa,CAAA,GAEnE,KAAkC;CAAE,OAAO;CAAQ,UAAU;AAAO,GACpE,KAAgC,EAAE,UAAU,OAAO,GAEnD,KAAuC,EAAE,QAAQ,EAAE,GAEnD,KAAe,MACnB,CAAC,CAAC,KAAQ,OAAO,KAAS,YAAY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SAAS,GAAY,GAA2B;CAG9C,OAFI,KAAS,QAAQ,MAAU,KAAW,OACtC,EAAe,CAAK,IAAU,IAC3B,OAAO,CAAK;AACrB"}
|
|
1
|
+
{"version":3,"file":"DataGrid2.js","names":[],"sources":["../../../src/components/DataGrid/DataGrid.tsx"],"sourcesContent":["/**\n * DataGrid\n *\n * Astryx `Table` with the pieces a list page needs around it: a page bar with\n * a range line, client or server sorting, row selection by key, resizable\n * and pinnable columns, expandable rows, per-user column settings (visibility,\n * order, width) and a CSV export picker.\n *\n * Rows are sliced to the page unless `pagination.totalItems` says the caller\n * already sliced them. Sorting is client-side for columns with `compare`,\n * otherwise it only reports `onSortChange`. Column settings live in one\n * overrides record (`hidden`, `order`, `width` per column key) that a product\n * persists as it likes.\n *\n * Plugin order matters: Astryx runs columnSettings, sort, selection, then\n * unknown names in insertion order. `resize` / `sticky` / `scrollX` /\n * `scrollY` / `cellRow` / `expansion` read the final column list, and\n * `scrollY` runs before `cellRow` so a column's `getCellProps` wins.\n *\n * @example\n * <DataGrid\n * data={users}\n * idKey=\"id\"\n * columns={[\n * { key: \"name\", header: \"Name\", renderCell: (u) => u.name, sortKey: \"name\" },\n * { key: \"email\", header: \"Email\", renderCell: (u) => u.email },\n * ]}\n * sort={sort}\n * onSortChange={setSort}\n * pagination={{ page, pageSize, totalItems, onChange: setPage }}\n * />\n */\nimport {\n isValidElement,\n type Key,\n useRef,\n useState,\n type CSSProperties,\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type TdHTMLAttributes,\n} from \"react\";\nimport { EmptyState } from \"@astryxdesign/core/EmptyState\";\nimport { Button } from \"@astryxdesign/core/Button\";\nimport { Icon } from \"@astryxdesign/core/Icon\";\nimport { IconButton } from \"@astryxdesign/core/IconButton\";\nimport { Pagination, type PaginationProps } from \"@astryxdesign/core/Pagination\";\nimport { HStack, VStack } from \"@astryxdesign/core/Stack\";\nimport {\n Table,\n pixel,\n proportional,\n useTableColumnResize,\n useTableColumnSettings,\n useTableSelection,\n useTableSortable,\n useTableStickyColumns,\n type TableColumn,\n type TablePlugin,\n type TableProps,\n type TableSortState,\n} from \"@astryxdesign/core/Table\";\nimport { Text } from \"@astryxdesign/core/Text\";\nimport { ChevronDown, ChevronRight, FileDown, Inbox, Settings } from \"lucide-react\";\n\nimport { useUicTranslator } from \"../../i18n/useUicTranslator\";\nimport {\n DataGridExportModal,\n type DataGridExportModalProps,\n} from \"./DataGridExportModal\";\nimport {\n DataGridSettingsModal,\n type DataGridSettingsModalProps,\n type DataGridSettingsResult,\n} from \"./DataGridSettingsModal\";\nimport { nodeToPlainText } from \"./nodeToPlainText\";\nimport \"./DataGrid.css\";\n\n/** A row identity, as `idKey` returns it. */\nexport type DataGridKey = Key;\n\nexport type DataGridSortDirection = \"ascending\" | \"descending\";\n\n/** The active sort: one column, by its `sortKey`. */\nexport interface DataGridSort {\n sortKey: string;\n direction: DataGridSortDirection;\n}\n\nexport interface DataGridColumn<T> {\n /** Stable identity: column settings, widths and pinning use it. */\n key: string;\n /** Header content. It is clipped to the column width. */\n header?: ReactNode;\n /** Caption above the header, for a column that belongs to a group. */\n groupHeader?: ReactNode;\n /**\n * Plain-text name in the settings and export dialogs. Default: the text of\n * `groupHeader` and `header` joined with \" / \", else the key.\n */\n label?: string;\n /** Cell content. `index` is the row's position on the current page. */\n renderCell?: (item: T, index: number) => ReactNode;\n /** Width in pixels. A resized width replaces it. Without one the column flexes. */\n width?: number;\n /** Lower bound, in pixels, of a flexing column. */\n minWidth?: number;\n align?: \"start\" | \"center\" | \"end\";\n /** Makes the column sortable. The sort state names it by this key. */\n sortKey?: string;\n /**\n * Sorts the rows on the client when this column is sorted. Compare in\n * ascending order; the grid reverses the result for descending.\n */\n compare?: (a: T, b: T, direction: DataGridSortDirection) => number;\n /**\n * Pins the column to an edge. Only the contiguous run of pinned columns at\n * each edge of the displayed order is pinned.\n */\n pin?: \"start\" | \"end\";\n /** Column settings cannot hide it. */\n isAlwaysVisible?: boolean;\n /** Hidden until the user shows it in the column settings. */\n isHiddenByDefault?: boolean;\n /** Fields this column exports as. Without them it cannot be exported. */\n exportKeys?: ReadonlyArray<string>;\n /** Extra attributes for this column's body cells. */\n getCellProps?: (item: T, index: number) => TdHTMLAttributes<HTMLTableCellElement>;\n}\n\n/** Per-column settings a user changed, keyed by column key. */\nexport interface DataGridColumnOverride {\n hidden?: boolean;\n /** Display position. Lower comes first. Set only after a reorder. */\n order?: number;\n /** Resized width in pixels. */\n width?: number;\n}\n\nexport type DataGridColumnOverrides = Record<string, DataGridColumnOverride>;\n\nexport interface DataGridColumnSettings {\n /** Controlled overrides. */\n overrides?: DataGridColumnOverrides;\n /** Initial overrides when uncontrolled; always merged under `overrides`. */\n defaultOverrides?: DataGridColumnOverrides;\n onOverridesChange?: (overrides: DataGridColumnOverrides) => void;\n /** Whether the settings dialog lets the user reorder columns. Default: true */\n isReorderable?: boolean;\n /** Strings of the settings dialog. */\n modalProps?: Pick<\n DataGridSettingsModalProps,\n \"title\" | \"subtitle\" | \"searchLabel\" | \"noMatchText\" | \"applyLabel\" | \"cancelLabel\"\n >;\n}\n\nexport interface DataGridCsvExport {\n /** Export keys the backend can produce. Columns asking for others are disabled. */\n supportedKeys: ReadonlyArray<string>;\n /** Runs the export with the chosen keys. The dialog closes when it resolves. */\n onExport: (keys: string[]) => Promise<void>;\n /** A warning above the column list, e.g. that the export is truncated. */\n notice?: ReactNode;\n /** Strings of the export dialog. */\n modalProps?: Pick<\n DataGridExportModalProps,\n \"title\" | \"subtitle\" | \"searchLabel\" | \"noMatchText\" | \"exportLabel\" | \"cancelLabel\"\n >;\n}\n\nexport interface DataGridSelection<T> {\n /** The selected row keys. Selection is controlled. */\n selectedKeys?: ReadonlyArray<DataGridKey>;\n onChange?: (keys: string[], items: T[]) => void;\n /** Whether a row's checkbox is enabled. Select-all leaves a disabled row as it is. */\n getIsItemEnabled?: (item: T) => boolean;\n /** Accessible name of a row's checkbox. Default: the row key. */\n getRowLabel?: (item: T) => string;\n /** Select-all keeps keys of rows on other pages. Default: false */\n isPreservingOtherPages?: boolean;\n}\n\nexport interface DataGridExpansion<T> {\n renderExpandedRow: (item: T, index: number) => ReactNode;\n getIsRowExpandable?: (item: T) => boolean;\n /** Controlled expanded row keys. */\n expandedKeys?: ReadonlyArray<DataGridKey>;\n defaultExpandedKeys?: ReadonlyArray<DataGridKey>;\n onExpandedKeysChange?: (keys: ReadonlyArray<DataGridKey>) => void;\n /** Header content of the expand-button column. */\n columnHeader?: ReactNode;\n /** Width in pixels of the expand-button column. */\n columnWidth?: number;\n}\n\nexport interface DataGridPagination extends Omit<\n PaginationProps,\n | \"page\"\n | \"totalItems\"\n | \"onChange\"\n | \"onPageSizeChange\"\n | \"label\"\n | \"ref\"\n | \"totalPages\"\n | \"hasMore\"\n> {\n /** Controlled page, 1-based. */\n page?: number;\n defaultPage?: number;\n defaultPageSize?: number;\n /**\n * Total row count. Without it the grid pages `data` itself; a total larger\n * than `data` declares the rows already sliced to the page.\n */\n totalItems?: number;\n onChange?: (page: number, pageSize: number) => void;\n /** Whether the bar offers a page-size choice. Default: true */\n hasPageSizeSelector?: boolean;\n /** Hides the page bar while every row fits on one page. Default: false */\n isHiddenOnSinglePage?: boolean;\n /** Content at the end of the bar. */\n endContent?: ReactNode;\n}\n\ntype AnyRow = Record<string, unknown>;\n\nexport interface DataGridProps<T extends object = AnyRow> extends Omit<\n TableProps<AnyRow>,\n | \"data\"\n | \"columns\"\n | \"idKey\"\n | \"rowIndexStart\"\n | \"rowCount\"\n | \"children\"\n | \"scrollWrapper\"\n | \"ref\"\n | \"emptyState\"\n | \"className\"\n | \"style\"\n | \"plugins\"\n | \"onChange\"\n> {\n data?: ReadonlyArray<T>;\n columns?: ReadonlyArray<DataGridColumn<T>>;\n /**\n * Row identity: a field name or a function. A missing field falls back to\n * the row's `key`, then its `id`, then its position.\n */\n idKey?: string | ((item: T) => DataGridKey);\n /** Dims the rows and blocks input while data is refetched. */\n isLoading?: boolean;\n /** Drag-to-resize column borders. Default: true */\n isResizable?: boolean;\n /** Controlled sort; `null` for none. */\n sort?: DataGridSort | null;\n defaultSort?: DataGridSort | null;\n onSortChange?: (sort: DataGridSort | null) => void;\n selection?: DataGridSelection<T>;\n /** The page bar. `false` shows every row and no bar. */\n pagination?: false | DataGridPagination;\n /** Enables the column settings button and persists resized widths. */\n columnSettings?: DataGridColumnSettings;\n /** Enables the CSV export button. */\n csvExport?: DataGridCsvExport;\n expansion?: DataGridExpansion<T>;\n /**\n * Shown in place of the rows when there are none. A string gets the default\n * icon and layout, a node is rendered as is, `false` shows nothing. Default:\n * the catalog's `uic.DataGrid.noData`.\n */\n emptyState?: ReactNode | false;\n /** Extra attributes for a body row. */\n getRowProps?: (\n item: T,\n index: number | undefined,\n ) => HTMLAttributes<HTMLTableRowElement>;\n /**\n * Scrolls horizontally with the table at this width (at least the\n * container's). Columns without a width then size to their content.\n */\n scrollWidth?: number | string;\n /** Caps the rows' height and makes the header sticky. */\n maxHeight?: number | string;\n /** Hides the header row, and with it sorting and select-all. */\n isHeaderHidden?: boolean;\n /** Accessible name of the expand buttons. Default: the catalog's `uic.DataGrid.expandRow` */\n expandRowLabel?: string;\n /** Shown when the page lies past the last one. Default: the catalog's `uic.DataGrid.invalidPage` */\n invalidPageText?: string;\n /** Default: the catalog's `uic.DataGrid.goToFirstPage` */\n goToFirstPageLabel?: string;\n /** Accessible name of the page navigation. Default: the catalog's `uic.DataGrid.pagination` */\n paginationLabel?: string;\n /** The range line beside the page navigation. Default: the catalog's `uic.DataGrid.range` */\n renderRange?: (range: { start: number; end: number; total: number }) => ReactNode;\n /** Default: the catalog's `uic.DataGrid.settings` */\n settingsLabel?: string;\n /** Default: the catalog's `uic.DataGrid.exportCsv` */\n exportLabel?: string;\n className?: string;\n style?: CSSProperties;\n}\n\nconst EXPAND_COLUMN_KEY = \"__uic_expand__\";\n/** Key of the checkbox column Astryx's selection plugin injects; not exported by Astryx. */\nconst SELECTION_COLUMN_KEY = \"__xds_selection\";\n/**\n * Measured column widths, in pixels. Selection: Astryx's 24px first-column\n * inset + the 20px checkbox + an 8px trailing pad (the plugin's own 36 lets\n * the checkbox overhang its cell). Expand: the same inset + the 24px button +\n * 8px, or an 8px lead-in instead of the inset behind a selection column.\n */\nconst SELECTION_COLUMN_WIDTH = 52;\nconst EXPAND_COLUMN_WIDTH_FIRST = 56;\nconst EXPAND_COLUMN_WIDTH_AFTER_SELECTION = 40;\nconst MIN_COLUMN_WIDTH = 60;\nconst DETAIL_ROW_MARKER = \"__uic_detail_for__\";\nconst DEFAULT_PAGE_SIZE = 10;\nconst DEFAULT_PAGE_SIZE_OPTIONS = [10, 20, 50];\n\nconst EMPTY_STATE_ICON = <Icon icon={Inbox} size=\"lg\" color=\"secondary\" />;\n\nconst X_HEADER_RELEASE: CSSProperties = { width: \"auto\", maxWidth: \"none\" };\nconst X_BODY_RELEASE: CSSProperties = { maxWidth: \"none\" };\n// Inline beats the sticky-header rule's z 2 for pinned header cells.\nconst Y_PINNED_HEADER_STACK: CSSProperties = { zIndex: 3 };\n\nconst isDetailRow = (item: unknown): item is AnyRow =>\n !!item && typeof item === \"object\" && DETAIL_ROW_MARKER in item;\n\nconst toCssLength = (value: number | string): string =>\n typeof value === \"number\" ? `${value}px` : value;\n\nfunction mergeCellStyle<P extends { htmlProps: { style?: CSSProperties } }>(\n props: P,\n extra: CSSProperties,\n): P {\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n style: props.htmlProps.style ? { ...props.htmlProps.style, ...extra } : extra,\n },\n };\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n\n/** The label a column carries in the settings and export dialogs. */\nexport function dataGridColumnLabel<T>(column: DataGridColumn<T>): string {\n if (column.label) return column.label;\n const own = nodeToPlainText(column.header).trim();\n const group = nodeToPlainText(column.groupHeader).trim();\n const label = group && own ? `${group} / ${own}` : own || group;\n return label || column.key;\n}\n\n/** Whether a column shows, given the user's overrides. */\n/**\n * The overrides record a settings dialog result writes. `defaultOverrides`\n * stays merged under it key by key, and a key it holds replaces the default's\n * entry whole. So a column is left out only while its default (natural, then\n * `defaultOverrides`) already renders what the user chose, and an entry that\n * is written states everything that differs from the natural column:\n * otherwise re-showing a column the defaults hide, or restoring the natural\n * order over a reordering default, would bring the default back.\n *\n * @internal Exported for tests.\n */\nexport function dataGridSettingsToOverrides({\n columns,\n result,\n defaultOverrides = {},\n overrides,\n isReorderable,\n}: {\n columns: ReadonlyArray<Pick<DataGridColumn<never>, \"key\" | \"isHiddenByDefault\">>;\n result: DataGridSettingsResult;\n defaultOverrides?: DataGridColumnOverrides;\n /** The overrides in effect, defaults merged; their widths are kept. */\n overrides: DataGridColumnOverrides;\n isReorderable: boolean;\n}): DataGridColumnOverrides {\n const naturalOrder = columns.map((column) => column.key);\n // A default order is only undone by stating every column's position.\n const writesOrder =\n isReorderable &&\n (result.columnOrder.length !== naturalOrder.length ||\n result.columnOrder.some((key, index) => key !== naturalOrder[index]) ||\n columns.some((column) => defaultOverrides[column.key]?.order !== undefined));\n const next: DataGridColumnOverrides = {};\n for (const column of columns) {\n const fallback = defaultOverrides[column.key];\n const naturalHidden = !!column.isHiddenByDefault;\n const defaultHidden = fallback?.hidden ?? naturalHidden;\n const hidden = !result.selectedColumnKeys.includes(column.key);\n const override: DataGridColumnOverride = {};\n if (hidden !== naturalHidden || hidden !== defaultHidden) override.hidden = hidden;\n if (writesOrder) {\n const orderIndex = result.columnOrder.indexOf(column.key);\n if (orderIndex !== -1) override.order = orderIndex;\n }\n // A settings change must not reset resized widths.\n const width = overrides[column.key]?.width;\n if (typeof width === \"number\") override.width = width;\n const matchesDefault =\n hidden === defaultHidden &&\n override.order === fallback?.order &&\n override.width === fallback?.width;\n if (!matchesDefault && Object.keys(override).length > 0)\n next[column.key] = override;\n }\n return next;\n}\n\nexport function isDataGridColumnVisible<T>(\n column: Pick<DataGridColumn<T>, \"key\" | \"isAlwaysVisible\" | \"isHiddenByDefault\">,\n overrides?: DataGridColumnOverrides,\n): boolean {\n if (column.isAlwaysVisible) return true;\n const hidden = overrides?.[column.key]?.hidden;\n return hidden !== undefined ? !hidden : !column.isHiddenByDefault;\n}\n\n/** Controlled when `value` is not undefined; the setter writes state only when uncontrolled. */\nfunction useControllableState<V>(value: V | undefined, initial: () => V) {\n const [state, setState] = useState<V>(initial);\n const isControlled = value !== undefined;\n const current = isControlled ? value : state;\n const set = (next: V) => {\n if (!isControlled) setState(next);\n };\n return [current, set] as const;\n}\n\nexport function DataGrid<T extends object = AnyRow>({\n data,\n columns = [],\n idKey = \"id\",\n isLoading = false,\n isResizable = true,\n sort: sortProp,\n defaultSort,\n onSortChange,\n selection,\n pagination,\n columnSettings,\n csvExport,\n expansion,\n emptyState,\n getRowProps,\n scrollWidth,\n maxHeight,\n isHeaderHidden = false,\n expandRowLabel,\n invalidPageText,\n goToFirstPageLabel,\n paginationLabel,\n renderRange,\n settingsLabel,\n exportLabel,\n density = \"compact\",\n dividers = \"rows\",\n hasHover = true,\n textOverflow = \"truncate\",\n className,\n style,\n ...tableProps\n}: DataGridProps<T>): ReactElement {\n const t = useUicTranslator();\n\n const isScrollX = scrollWidth !== undefined;\n const isScrollY = maxHeight !== undefined;\n\n const [isSettingsOpen, setIsSettingsOpen] = useState(false);\n const [isExportOpen, setIsExportOpen] = useState(false);\n\n /* ---- column overrides (visibility / order / width) ------------------- */\n\n const [storedOverrides, setStoredOverrides] = useState<DataGridColumnOverrides>(\n () => columnSettings?.defaultOverrides ?? {},\n );\n const isOverridesControlled = columnSettings?.overrides !== undefined;\n const ownOverrides = isOverridesControlled\n ? (columnSettings?.overrides ?? {})\n : storedOverrides;\n const setOverrides = (next: DataGridColumnOverrides) => {\n if (!isOverridesControlled) setStoredOverrides(next);\n columnSettings?.onOverridesChange?.(next);\n };\n const overrides: DataGridColumnOverrides = {\n ...(columnSettings?.defaultOverrides ?? {}),\n ...ownOverrides,\n };\n const isReorderable = !!columnSettings && columnSettings.isReorderable !== false;\n\n /* ---- resized widths ---------------------------------------------------- */\n\n // With columnSettings a width rides in the overrides record, so a resize\n // persists like a visibility change; without it the width is local state.\n const [localWidths, setLocalWidths] = useState<Record<string, number>>({});\n const columnWidths: Record<string, number> = {};\n if (columnSettings) {\n for (const [key, override] of Object.entries(overrides)) {\n if (typeof override?.width === \"number\") columnWidths[key] = override.width;\n }\n } else {\n Object.assign(columnWidths, localWidths);\n }\n\n const handleResizeEnd = (updates: Record<string, number>) => {\n if (!columnSettings) {\n setLocalWidths((prev) => ({ ...prev, ...updates }));\n return;\n }\n const next: DataGridColumnOverrides = { ...ownOverrides };\n for (const [key, width] of Object.entries(updates)) {\n if (key === EXPAND_COLUMN_KEY) continue;\n next[key] = { ...next[key], width };\n }\n setOverrides(next);\n };\n\n /* ---- row keys ---------------------------------------------------------- */\n\n const getRowKey = (item: T): string => {\n if (typeof idKey === \"function\") return String(idKey(item));\n const row = item as AnyRow;\n const direct = row[idKey];\n if (direct != null) return String(direct);\n const fallback = row.key ?? row.id;\n if (fallback != null) return String(fallback);\n return `__row_${data ? data.indexOf(item) : -1}`;\n };\n\n /* ---- sort -------------------------------------------------------------- */\n\n const [activeSort, setActiveSort] = useControllableState<DataGridSort | null>(\n sortProp,\n () => defaultSort ?? null,\n );\n\n const sortedRows = ((): T[] => {\n const source = data ? [...data] : [];\n if (!activeSort) return source;\n const compare = columns.find(\n (column) => column.sortKey === activeSort.sortKey && column.compare,\n )?.compare;\n if (!compare) return source;\n const { direction } = activeSort;\n return source.sort((a, b) =>\n direction === \"descending\" ? -compare(a, b, direction) : compare(a, b, direction),\n );\n })();\n\n /* ---- pagination -------------------------------------------------------- */\n\n const pager = pagination === false ? undefined : (pagination ?? {});\n const [currentPage, setCurrentPage] = useControllableState<number>(\n pager?.page,\n () => pager?.defaultPage ?? 1,\n );\n const [pageSize, setPageSize] = useControllableState<number>(\n pager?.pageSize,\n () => pager?.defaultPageSize ?? DEFAULT_PAGE_SIZE,\n );\n\n // Astryx's Pagination answers a page-size pick with onPageSizeChange(size)\n // and then onChange(1) in the same event, still closing over the old size.\n // Forwarding the second call would undo the pick on a controlled grid, so it\n // is dropped; a microtask clears the flag.\n const isPageSizeChangingRef = useRef(false);\n\n const total = pager?.totalItems ?? sortedRows.length;\n const lastPage = Math.max(1, Math.ceil(total / pageSize));\n const activePage = clamp(currentPage, 1, lastPage);\n const isPageOutOfRange =\n !!pager && total > 0 && (currentPage < 1 || currentPage > lastPage);\n // A total above the rows in hand means they are already one page.\n const isServerSliced = total > sortedRows.length;\n const pagedRows =\n pager && !isServerSliced && sortedRows.length > pageSize\n ? sortedRows.slice((activePage - 1) * pageSize, activePage * pageSize)\n : sortedRows;\n const rows = isPageOutOfRange ? [] : pagedRows;\n\n /* ---- expansion --------------------------------------------------------- */\n\n const [storedExpandedKeys, setStoredExpandedKeys] = useState<DataGridKey[]>(() => [\n ...(expansion?.defaultExpandedKeys ?? []),\n ]);\n const expandedKeys = expansion?.expandedKeys ?? storedExpandedKeys;\n const expandedKeySet = new Set(expandedKeys.map(String));\n const hasExpansion = !!expansion;\n const expandColumnWidth =\n expansion?.columnWidth ??\n (selection ? EXPAND_COLUMN_WIDTH_AFTER_SELECTION : EXPAND_COLUMN_WIDTH_FIRST);\n const detailInsetStart = (selection ? SELECTION_COLUMN_WIDTH : 0) + expandColumnWidth;\n\n const toggleExpanded = (key: string) => {\n const next = expandedKeySet.has(key)\n ? expandedKeys.filter((k) => String(k) !== key)\n : [...expandedKeys, key];\n if (!expansion?.expandedKeys) setStoredExpandedKeys(next);\n expansion?.onExpandedKeysChange?.(next);\n };\n\n const rowIndexByKey = new Map<string, number>();\n rows.forEach((item, index) => rowIndexByKey.set(getRowKey(item), index));\n\n // Each expanded row is followed by a marker row the expansion plugin turns\n // into one full-width cell.\n const tableData: AnyRow[] = [];\n for (const item of rows) {\n tableData.push(item as AnyRow);\n if (!hasExpansion) continue;\n const key = getRowKey(item);\n if (expandedKeySet.has(key) && (expansion?.getIsRowExpandable?.(item) ?? true)) {\n tableData.push({ [DETAIL_ROW_MARKER]: key, id: `${key}__detail` });\n }\n }\n\n // From every row, not the page: selection resolves keys on other pages too.\n const itemByKey = new Map<string, T>();\n sortedRows.forEach((item) => itemByKey.set(getRowKey(item), item));\n\n /* ---- Astryx columns ---------------------------------------------------- */\n\n const tableColumns: TableColumn<AnyRow>[] = [];\n if (hasExpansion) {\n tableColumns.push({\n key: EXPAND_COLUMN_KEY,\n header: expansion?.columnHeader ?? \"\",\n width: pixel(expandColumnWidth),\n resizable: false,\n renderCell: (row) => {\n if (isDetailRow(row)) return null;\n const item = row as T;\n if (!(expansion?.getIsRowExpandable?.(item) ?? true)) return null;\n const key = getRowKey(item);\n return (\n <IconButton\n label={expandRowLabel ?? t(\"uic.DataGrid.expandRow\")}\n icon={expandedKeySet.has(key) ? <ChevronDown /> : <ChevronRight />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => toggleExpanded(key)}\n />\n );\n },\n });\n }\n\n for (const column of columns) {\n const width = columnWidths[column.key] ?? column.width;\n const header = (\n <span className=\"uic-data-grid__clip\">\n {column.groupHeader == null ? (\n column.header\n ) : (\n <VStack gap={0} align=\"start\">\n <Text type=\"supporting\" color=\"secondary\">\n {column.groupHeader}\n </Text>\n <span>{column.header}</span>\n </VStack>\n )}\n </span>\n );\n tableColumns.push({\n key: column.key,\n header,\n align: column.align === \"start\" ? undefined : column.align,\n sortable: column.sortKey ? { sortKey: column.sortKey } : false,\n resizable: isResizable,\n // In scroll-x mode a width-less column takes no width, so its content sizes it.\n width:\n width != null\n ? pixel(width)\n : isScrollX\n ? undefined\n : proportional(\n 1,\n typeof column.minWidth === \"number\"\n ? { minWidth: column.minWidth }\n : undefined,\n ),\n renderCell: (row) => {\n if (isDetailRow(row)) return null;\n const item = row as T;\n const content = column.renderCell\n ? column.renderCell(item, rowIndexByKey.get(getRowKey(item)) ?? 0)\n : defaultCell(row[column.key]);\n if (textOverflow !== \"truncate\" || content == null) return content;\n return <span className=\"uic-data-grid__clip\">{content}</span>;\n },\n });\n }\n\n /* ---- visibility + order ------------------------------------------------ */\n\n const visibleColumns = columnSettings\n ? columns.filter((column) => isDataGridColumnVisible(column, overrides))\n : [...columns];\n const orderedColumns = isReorderable\n ? visibleColumns\n .map((column, index) => ({ column, index }))\n .sort(\n (a, b) =>\n (overrides[a.column.key]?.order ?? Number.MAX_SAFE_INTEGER) -\n (overrides[b.column.key]?.order ?? Number.MAX_SAFE_INTEGER) ||\n a.index - b.index,\n )\n .map(({ column }) => column)\n : visibleColumns;\n const activeColumnKeys = [\n ...(hasExpansion ? [EXPAND_COLUMN_KEY] : []),\n ...orderedColumns.map((column) => column.key),\n ];\n\n const columnSettingsPlugin = useTableColumnSettings<AnyRow>({\n columns: [\n ...(hasExpansion\n ? [{ key: EXPAND_COLUMN_KEY, label: \"\", isAlwaysVisible: true }]\n : []),\n ...columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n isAlwaysVisible: !!column.isAlwaysVisible,\n })),\n ],\n activeColumnKeys,\n // The settings dialog owns the write path (it keeps `order` and `width`).\n onChangeActiveColumnKeys: () => {},\n });\n\n /* ---- pinning ----------------------------------------------------------- */\n\n const startKeys: string[] = [];\n for (const column of orderedColumns) {\n if (column.pin === \"start\") startKeys.push(column.key);\n else break;\n }\n const endKeys: string[] = [];\n for (const column of [...orderedColumns].reverse()) {\n if (column.pin === \"end\") endKeys.unshift(column.key);\n else break;\n }\n const stickyConfig = {\n startKeys:\n startKeys.length === 0\n ? undefined\n : [\n ...(selection ? [SELECTION_COLUMN_KEY] : []),\n ...(hasExpansion ? [EXPAND_COLUMN_KEY] : []),\n ...startKeys,\n ],\n endKeys: endKeys.length === 0 ? undefined : endKeys,\n };\n const stickyPlugin = useTableStickyColumns<AnyRow>(\n stickyConfig.startKeys || stickyConfig.endKeys ? stickyConfig : {},\n );\n\n /* ---- per-cell / per-row attributes -------------------------------------- */\n\n const columnByKey = new Map(columns.map((column) => [column.key, column]));\n\n const cellRowPlugin: TablePlugin<AnyRow> = {\n transformBodyCell: (props, column, row) => {\n if (isDetailRow(row)) return props;\n const item = row as T;\n const extra = columnByKey\n .get(column.key)\n ?.getCellProps?.(item, rowIndexByKey.get(getRowKey(item)) ?? 0);\n if (!extra) return props;\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n ...extra,\n style: { ...props.htmlProps.style, ...extra.style },\n },\n };\n },\n transformBodyRow: (props, row) => {\n if (!getRowProps || isDetailRow(row)) return props;\n const item = row as T;\n const extra = getRowProps(item, rowIndexByKey.get(getRowKey(item)));\n if (!extra) return props;\n return {\n ...props,\n htmlProps: {\n ...props.htmlProps,\n ...extra,\n style: { ...props.htmlProps.style, ...extra.style },\n },\n };\n },\n };\n\n // Astryx clips cells with `max-width: 0`; scroll-x releases width-less columns only.\n const scrollXPlugin: TablePlugin<AnyRow> = {\n transformHeaderCell: (props, column) =>\n column.width != null ? props : mergeCellStyle(props, X_HEADER_RELEASE),\n transformBodyCell: (props, column) =>\n column.width != null ? props : mergeCellStyle(props, X_BODY_RELEASE),\n };\n\n const pinnedKeys = new Set([\n ...(stickyConfig.startKeys ?? []),\n ...(stickyConfig.endKeys ?? []),\n ]);\n const scrollYPlugin: TablePlugin<AnyRow> = {\n transformHeaderCell: (props, column) =>\n pinnedKeys.has(column.key) ? mergeCellStyle(props, Y_PINNED_HEADER_STACK) : props,\n };\n\n /* ---- sorting ----------------------------------------------------------- */\n\n const sortState: TableSortState = activeSort\n ? [{ sortKey: activeSort.sortKey, direction: activeSort.direction }]\n : [];\n\n const sortPlugin = useTableSortable<AnyRow>({\n sort: sortState,\n allowUnsortedState: true,\n onSortChange: (next) => {\n const first = next[0];\n const nextSort: DataGridSort | null = first\n ? { sortKey: first.sortKey, direction: first.direction }\n : null;\n setActiveSort(nextSort);\n onSortChange?.(nextSort);\n },\n });\n\n /* ---- selection --------------------------------------------------------- */\n\n const selectedKeySet = new Set((selection?.selectedKeys ?? []).map(String));\n const emitSelection = (keys: string[]) => {\n const items = keys\n .map((key) => itemByKey.get(key))\n .filter((item) => item !== undefined);\n selection?.onChange?.(keys, items);\n };\n const isRowSelected = (item: T) => selectedKeySet.has(getRowKey(item));\n const isRowEnabled = (item: T) => selection?.getIsItemEnabled?.(item) ?? true;\n // Select-all acts on the enabled rows only; a disabled row keeps its state.\n const enabledRows = rows.filter(isRowEnabled);\n\n const selectionPlugin = useTableSelection<AnyRow>({\n getIsItemSelectable: (row) => !isDetailRow(row),\n getIsItemSelected: (row) => !isDetailRow(row) && isRowSelected(row as T),\n getIsItemEnabled: (row) => !isDetailRow(row) && isRowEnabled(row as T),\n getRowLabel: (row) =>\n isDetailRow(row)\n ? \"\"\n : (selection?.getRowLabel?.(row as T) ?? getRowKey(row as T)),\n getIsAllSelected: () => enabledRows.length > 0 && enabledRows.every(isRowSelected),\n getIsIndeterminate: () =>\n enabledRows.some(isRowSelected) && !enabledRows.every(isRowSelected),\n onSelectItem: ({ item, isSelected }) => {\n if (isDetailRow(item)) return;\n const key = getRowKey(item as T);\n const next = new Set(selectedKeySet);\n if (isSelected) next.add(key);\n else next.delete(key);\n emitSelection([...next]);\n },\n onSelectAll: ({ isAllSelected }) => {\n const next = new Set(selection?.isPreservingOtherPages ? selectedKeySet : []);\n for (const item of rows) {\n const key = getRowKey(item);\n const isSelected = isRowEnabled(item) ? isAllSelected : isRowSelected(item);\n if (isSelected) next.add(key);\n else next.delete(key);\n }\n emitSelection([...next]);\n },\n });\n\n const selectionWidthPlugin: TablePlugin<AnyRow> = {\n transformColumns: (cols) =>\n cols.map((column) =>\n column.key === SELECTION_COLUMN_KEY\n ? { ...column, width: pixel(SELECTION_COLUMN_WIDTH) }\n : column,\n ),\n };\n\n /* ---- resize ------------------------------------------------------------ */\n\n const resizePlugin = useTableColumnResize<AnyRow>({\n columns: tableColumns,\n columnWidths,\n minWidth: MIN_COLUMN_WIDTH,\n onColumnResizeEnd: handleResizeEnd,\n });\n\n /* ---- expansion --------------------------------------------------------- */\n\n const renderedColumnCount = activeColumnKeys.length + (selection ? 1 : 0);\n const expansionPlugin: TablePlugin<AnyRow> = {\n transformBodyRow: (props, row) => {\n if (!isDetailRow(row)) return props;\n const parentKey = String(row[DETAIL_ROW_MARKER]);\n const item = itemByKey.get(parentKey);\n if (!item) return props;\n return {\n ...props,\n children: (\n <td\n colSpan={renderedColumnCount}\n className=\"uic-data-grid__detail\"\n style={{ paddingInlineStart: detailInsetStart }}\n >\n {expansion?.renderExpandedRow(item, rowIndexByKey.get(parentKey) ?? 0)}\n </td>\n ),\n };\n },\n };\n\n const plugins: Record<string, TablePlugin<AnyRow>> = {\n columnSettings: columnSettingsPlugin,\n sort: sortPlugin,\n };\n if (selection) {\n plugins.selection = selectionPlugin;\n plugins.selectionWidth = selectionWidthPlugin;\n }\n if (isResizable) plugins.resize = resizePlugin;\n plugins.sticky = stickyPlugin;\n if (isScrollX) plugins.scrollX = scrollXPlugin;\n // Without pinned columns the sticky header is pure CSS.\n if (isScrollY && pinnedKeys.size > 0) plugins.scrollY = scrollYPlugin;\n plugins.cellRow = cellRowPlugin;\n if (hasExpansion) plugins.expansion = expansionPlugin;\n\n /* ---- bottom bar -------------------------------------------------------- */\n\n const {\n page: _page,\n defaultPage: _defaultPage,\n defaultPageSize: _defaultPageSize,\n totalItems: _totalItems,\n onChange: _onChange,\n hasPageSizeSelector = true,\n isHiddenOnSinglePage = false,\n endContent,\n pageSizeOptions,\n size: pagerSize = \"sm\",\n ...paginationRest\n } = pager ?? {};\n\n const rangeStart = total === 0 ? 0 : (activePage - 1) * pageSize + 1;\n const rangeEnd = Math.min(activePage * pageSize, total);\n const isPagerVisible = !!pager && !(isHiddenOnSinglePage && total <= pageSize);\n const hasBottomBar = isPagerVisible || !!columnSettings || !!csvExport;\n\n const emptyStateNode = isPageOutOfRange ? (\n // The way back outranks any empty state the caller gave.\n <EmptyState\n isCompact\n icon={EMPTY_STATE_ICON}\n title={invalidPageText ?? t(\"uic.DataGrid.invalidPage\")}\n actions={\n <Button\n variant=\"primary\"\n label={goToFirstPageLabel ?? t(\"uic.DataGrid.goToFirstPage\")}\n onClick={() => {\n setCurrentPage(1);\n pager?.onChange?.(1, pageSize);\n }}\n />\n }\n />\n ) : emptyState === false ? (\n false\n ) : emptyState == null || typeof emptyState === \"string\" ? (\n <EmptyState\n isCompact\n icon={EMPTY_STATE_ICON}\n title={emptyState ?? t(\"uic.DataGrid.noData\")}\n />\n ) : (\n emptyState\n );\n\n const applySettings = (result: DataGridSettingsResult) => {\n setIsSettingsOpen(false);\n setOverrides(\n dataGridSettingsToOverrides({\n columns,\n result,\n defaultOverrides: columnSettings?.defaultOverrides,\n overrides,\n isReorderable,\n }),\n );\n };\n\n return (\n <div\n className={[\"uic-data-grid\", className].filter(Boolean).join(\" \")}\n style={style}\n >\n <div\n aria-busy={isLoading || undefined}\n className={[\n \"uic-data-grid__body\",\n isLoading && \"uic-data-grid__body--loading\",\n isHeaderHidden && \"uic-data-grid__body--no-header\",\n dividers !== \"grid\" && \"uic-data-grid__body--header-split\",\n isScrollX && \"uic-data-grid__body--scroll-x\",\n isScrollY && \"uic-data-grid__body--scroll-y\",\n ]\n .filter(Boolean)\n .join(\" \")}\n style={\n {\n ...(isScrollX\n ? { \"--data-grid-scroll-width\": toCssLength(scrollWidth) }\n : null),\n ...(isScrollY\n ? { \"--data-grid-max-height\": toCssLength(maxHeight) }\n : null),\n } as CSSProperties\n }\n >\n <Table<AnyRow>\n {...tableProps}\n data={tableData}\n columns={tableColumns}\n idKey={(row: AnyRow) =>\n isDetailRow(row)\n ? `${String(row[DETAIL_ROW_MARKER])}__detail`\n : getRowKey(row as T)\n }\n density={density}\n dividers={dividers}\n hasHover={hasHover}\n textOverflow={textOverflow}\n emptyState={emptyStateNode}\n rowCount={total || undefined}\n rowIndexStart={pager ? (activePage - 1) * pageSize + 1 : undefined}\n plugins={plugins}\n />\n </div>\n\n {hasBottomBar ? (\n <HStack justify=\"end\" align=\"center\" gap={2} className=\"uic-data-grid__footer\">\n {isPagerVisible ? (\n <>\n <Text type=\"supporting\" color=\"secondary\">\n {renderRange\n ? renderRange({ start: rangeStart, end: rangeEnd, total })\n : t(\"uic.DataGrid.range\", {\n start: rangeStart,\n end: rangeEnd,\n total,\n })}\n </Text>\n <Pagination\n variant=\"pages\"\n {...paginationRest}\n page={activePage}\n pageSize={pageSize}\n totalItems={total}\n // Astryx shows the size choice exactly when options are passed.\n pageSizeOptions={\n hasPageSizeSelector\n ? (pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS)\n : undefined\n }\n size={pagerSize}\n label={paginationLabel ?? t(\"uic.DataGrid.pagination\")}\n onChange={(page) => {\n if (isPageSizeChangingRef.current) return;\n setCurrentPage(page);\n pager?.onChange?.(page, pageSize);\n }}\n onPageSizeChange={(nextSize) => {\n isPageSizeChangingRef.current = true;\n queueMicrotask(() => {\n isPageSizeChangingRef.current = false;\n });\n setCurrentPage(1);\n setPageSize(nextSize);\n pager?.onChange?.(1, nextSize);\n }}\n />\n </>\n ) : null}\n {columnSettings ? (\n <IconButton\n label={settingsLabel ?? t(\"uic.DataGrid.settings\")}\n icon={<Settings />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsSettingsOpen(true)}\n />\n ) : null}\n {csvExport ? (\n <IconButton\n label={exportLabel ?? t(\"uic.DataGrid.exportCsv\")}\n icon={<FileDown />}\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsExportOpen(true)}\n />\n ) : null}\n {pager ? endContent : null}\n </HStack>\n ) : null}\n\n {columnSettings ? (\n <DataGridSettingsModal\n {...columnSettings.modalProps}\n isOpen={isSettingsOpen}\n onOpenChange={setIsSettingsOpen}\n columns={columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n isAlwaysVisible: !!column.isAlwaysVisible,\n }))}\n visibleColumnKeys={orderedColumns.map((column) => column.key)}\n isReorderable={isReorderable}\n onApply={applySettings}\n />\n ) : null}\n\n {csvExport ? (\n <DataGridExportModal\n {...csvExport.modalProps}\n isOpen={isExportOpen}\n onOpenChange={setIsExportOpen}\n columns={columns.map((column) => ({\n key: column.key,\n label: dataGridColumnLabel(column),\n exportKeys: column.exportKeys ?? [],\n }))}\n supportedKeys={csvExport.supportedKeys}\n notice={csvExport.notice}\n onExport={async (keys) => {\n await csvExport.onExport(keys);\n setIsExportOpen(false);\n }}\n />\n ) : null}\n </div>\n );\n}\n\nfunction defaultCell(value: unknown): ReactNode {\n if (value == null || value === \"\") return null;\n if (isValidElement(value)) return value;\n return String(value);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgTA,IAAM,IAAoB,kBAEpB,KAAuB,mBAOvB,KAAyB,IACzB,KAA4B,IAC5B,KAAsC,IACtC,KAAmB,IACnB,IAAoB,sBACpB,KAAoB,IACpB,KAA4B;CAAC;CAAI;CAAI;AAAE,GAEvC,KAAmB,kBAAC,GAAD;CAAM,MAAM;CAAO,MAAK;CAAK,OAAM;AAAa,CAAA,GAEnE,KAAkC;CAAE,OAAO;CAAQ,UAAU;AAAO,GACpE,KAAgC,EAAE,UAAU,OAAO,GAEnD,KAAuC,EAAE,QAAQ,EAAE,GAEnD,KAAe,MACnB,CAAC,CAAC,KAAQ,OAAO,KAAS,YAAY,KAAqB,GAEvD,MAAe,MACnB,OAAO,KAAU,WAAW,GAAG,EAAM,MAAM;AAE7C,SAAS,EACP,GACA,GACG;CACH,OAAO;EACL,GAAG;EACH,WAAW;GACT,GAAG,EAAM;GACT,OAAO,EAAM,UAAU,QAAQ;IAAE,GAAG,EAAM,UAAU;IAAO,GAAG;GAAM,IAAI;EAC1E;CACF;AACF;AAEA,SAAS,GAAM,GAAe,GAAa,GAAqB;CAC9D,OAAO,KAAK,IAAI,KAAK,IAAI,GAAO,CAAG,GAAG,CAAG;AAC3C;AAGA,SAAgB,EAAuB,GAAmC;CACxE,IAAI,EAAO,OAAO,OAAO,EAAO;CAChC,IAAM,IAAM,EAAgB,EAAO,MAAM,CAAC,CAAC,KAAK,GAC1C,IAAQ,EAAgB,EAAO,WAAW,CAAC,CAAC,KAAK;CAEvD,QADc,KA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CAAA;MACjB,SAAQ;MACR,MAAK;MACL,eAAe,GAAgB,EAAI;KACpC,CAAA,IACC;KACH,IAAQ,KAAa;IAChB;GACN,CAAA,IAAA;GAEH,IACC,kBAAC,GAAD;IACE,GAAI,EAAe;IACnB,QAAQ;IACR,cAAc;IACd,SAAS,EAAQ,KAAK,OAAY;KAChC,KAAK,EAAO;KACZ,OAAO,EAAoB,CAAM;KACjC,iBAAiB,CAAC,CAAC,EAAO;IAC5B,EAAE;IACF,mBAAmB,EAAe,KAAK,MAAW,EAAO,GAAG;IAC7C;IACf,SAAS;GACV,CAAA,IACC;GAEH,IACC,kBAAC,GAAD;IACE,GAAI,EAAU;IACd,QAAQ;IACR,cAAc;IACd,SAAS,EAAQ,KAAK,OAAY;KAChC,KAAK,EAAO;KACZ,OAAO,EAAoB,CAAM;KACjC,YAAY,EAAO,cAAc,CAAC;IACpC,EAAE;IACF,eAAe,EAAU;IACzB,QAAQ,EAAU;IAClB,UAAU,OAAO,MAAS;KAExB,AADA,MAAM,EAAU,SAAS,CAAI,GAC7B,GAAgB,EAAK;IACvB;GACD,CAAA,IACC;EACD;;AAET;AAEA,SAAS,GAAY,GAA2B;CAG9C,OAFI,KAAS,QAAQ,MAAU,KAAW,OACtC,EAAe,CAAK,IAAU,IAC3B,OAAO,CAAK;AACrB"}
|
|
@@ -47,7 +47,7 @@ export interface FormItemTooltipConfig {
|
|
|
47
47
|
declare const FormItem: <Values>(props: FormItemProps<Values>) => React.JSX.Element;
|
|
48
48
|
/** Errors/warnings of the nearest enclosing `Form.Item`. */
|
|
49
49
|
export declare const useFormItemStatus: () => {
|
|
50
|
-
status: "" | "
|
|
50
|
+
status: "" | "error" | "success" | "warning" | "validating" | undefined;
|
|
51
51
|
errors: React.ReactNode[];
|
|
52
52
|
warnings: React.ReactNode[];
|
|
53
53
|
};
|
|
@@ -4,8 +4,8 @@ import { Button as t } from "@astryxdesign/core/Button";
|
|
|
4
4
|
import { Heading as n } from "@astryxdesign/core/Heading";
|
|
5
5
|
import { Text as r } from "@astryxdesign/core/Text";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { IconButton as o } from "@astryxdesign/core/IconButton";
|
|
8
|
+
import { Icon as s } from "@astryxdesign/core/Icon";
|
|
9
9
|
//#region src/components/PageHeader/PageHeader.tsx
|
|
10
10
|
function c({ title: c, description: l, actions: u, error: d, onErrorDismiss: f, className: p = "", errorDetail: m, onRetry: h, retryLabel: g, dismissErrorLabel: _ }) {
|
|
11
11
|
let v = e(), y = ["uic-page-header", p].filter(Boolean).join(" ");
|
|
@@ -51,12 +51,12 @@ function c({ title: c, description: l, actions: u, error: d, onErrorDismiss: f,
|
|
|
51
51
|
className: "uic-page-header__error-retry",
|
|
52
52
|
label: g ?? v("uic.common.retry"),
|
|
53
53
|
onClick: h
|
|
54
|
-
}), f && /* @__PURE__ */ i(
|
|
54
|
+
}), f && /* @__PURE__ */ i(o, {
|
|
55
55
|
variant: "ghost",
|
|
56
56
|
size: "sm",
|
|
57
57
|
className: "uic-page-header__error-dismiss",
|
|
58
58
|
label: _ ?? v("uic.PageHeader.dismissError"),
|
|
59
|
-
icon: /* @__PURE__ */ i(
|
|
59
|
+
icon: /* @__PURE__ */ i(s, { icon: "close" }),
|
|
60
60
|
onClick: f
|
|
61
61
|
})]
|
|
62
62
|
})]
|
|
@@ -8,28 +8,28 @@ import { HStack as s } from "@astryxdesign/core/Stack";
|
|
|
8
8
|
import { Text as c } from "@astryxdesign/core/Text";
|
|
9
9
|
import { themeProps as te } from "@astryxdesign/core/utils";
|
|
10
10
|
import { Fragment as ne, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { VisuallyHidden as d } from "@astryxdesign/core/VisuallyHidden";
|
|
12
|
+
import { Token as f } from "@astryxdesign/core/Token";
|
|
13
|
+
import { Spinner as p } from "@astryxdesign/core/Spinner";
|
|
13
14
|
import { Divider as re } from "@astryxdesign/core/Divider";
|
|
14
|
-
import { useIndicator as
|
|
15
|
-
import { SelectorOption as
|
|
16
|
-
import { VisuallyHidden as m } from "@astryxdesign/core/VisuallyHidden";
|
|
15
|
+
import { useIndicator as m } from "@astryxdesign/core/Indicator";
|
|
16
|
+
import { SelectorOption as h } from "@astryxdesign/core/Selector";
|
|
17
17
|
//#region src/components/PagedSelector/PagedSelector.tsx
|
|
18
|
-
var
|
|
19
|
-
kmVPX3:
|
|
18
|
+
var g = { padding: "x1717udv" }, _ = t({ reset: {
|
|
19
|
+
kmVPX3: g.padding,
|
|
20
20
|
$$css: !0
|
|
21
21
|
} });
|
|
22
|
-
function
|
|
23
|
-
let { label:
|
|
24
|
-
for (let e of
|
|
25
|
-
let B = (e) =>
|
|
22
|
+
function v(t) {
|
|
23
|
+
let { label: g, options: v, labels: ie, placeholder: ae, hasSearch: y = !0, searchValue: oe, onSearchChange: se, searchPlaceholder: ce, searchLabel: b, clearSearchLabel: le, onEndReached: x, endReachedThreshold: ue = 30, onAtEndChange: S, isLoadingMore: C, totalCount: w, formatTotalCount: de, emptyText: T, header: fe, footer: E, listMaxHeight: pe = 260, triggerDisplay: me = "labels", maxTriggerItems: he = 3, selectionIndicator: D = "check", hasClear: ge, onClear: O, onOpenChange: k, isLoading: A, size: j, isMultiple: M, value: _e, onChange: ve, ...N } = t, P = e(), F = m("check"), I = m("checkbox"), L = i(), ye = i(), R = t.isMultiple ? [...t.value ?? []] : t.value == null ? [] : [t.value], z = a(/* @__PURE__ */ new Map());
|
|
24
|
+
for (let e of v) z.current.set(e.value, e.label);
|
|
25
|
+
let B = (e) => ie?.[e] ?? v.find((t) => t.value === e)?.label ?? z.current.get(e) ?? e, V = (e) => {
|
|
26
26
|
let n = e.map((e) => ({
|
|
27
27
|
value: e,
|
|
28
28
|
label: B(e)
|
|
29
29
|
}));
|
|
30
30
|
t.isMultiple ? t.onChange?.(e, n) : t.onChange?.(e[0] ?? null, n[0] ?? null);
|
|
31
|
-
}, [H, U] = o(-1), [be, xe] = o(""), Se =
|
|
32
|
-
for (let n = e; n >= 0 && n <
|
|
31
|
+
}, [H, U] = o(-1), [be, xe] = o(""), Se = oe ?? be, W = a(!1), G = (e) => `${ye}-option-${e}`, K = v.length === 0 || H < 0 ? -1 : Math.min(H, v.length - 1), q = K >= 0 && v[K]?.isDisabled ? -1 : K, J = (e, t) => {
|
|
32
|
+
for (let n = e; n >= 0 && n < v.length; n += t) if (!v[n]?.isDisabled) return n;
|
|
33
33
|
return -1;
|
|
34
34
|
};
|
|
35
35
|
ee(() => {
|
|
@@ -46,7 +46,7 @@ function _(t) {
|
|
|
46
46
|
}
|
|
47
47
|
V(Y(e.value) ? R.filter((t) => t !== e.value) : [...R, e.value]);
|
|
48
48
|
}, Z = (e, t, n) => {
|
|
49
|
-
if (
|
|
49
|
+
if (v.length === 0) return;
|
|
50
50
|
let r = (e) => {
|
|
51
51
|
e >= 0 && U(e);
|
|
52
52
|
};
|
|
@@ -61,12 +61,12 @@ function _(t) {
|
|
|
61
61
|
e.preventDefault(), r(J(0, 1));
|
|
62
62
|
break;
|
|
63
63
|
case "End":
|
|
64
|
-
e.preventDefault(), r(J(
|
|
64
|
+
e.preventDefault(), r(J(v.length - 1, -1));
|
|
65
65
|
break;
|
|
66
66
|
case " ":
|
|
67
67
|
case "Enter": {
|
|
68
68
|
if (e.key === " " && !n) break;
|
|
69
|
-
let r =
|
|
69
|
+
let r = v[q];
|
|
70
70
|
if (!r || r.isDisabled) break;
|
|
71
71
|
e.preventDefault(), X(r, t);
|
|
72
72
|
break;
|
|
@@ -80,7 +80,7 @@ function _(t) {
|
|
|
80
80
|
gap: .5,
|
|
81
81
|
vAlign: "center",
|
|
82
82
|
wrap: "wrap",
|
|
83
|
-
children: [e.map((e) => /* @__PURE__ */ l(
|
|
83
|
+
children: [e.map((e) => /* @__PURE__ */ l(f, {
|
|
84
84
|
label: B(e),
|
|
85
85
|
size: "sm"
|
|
86
86
|
}, e)), t > 0 ? /* @__PURE__ */ l(c, {
|
|
@@ -93,11 +93,11 @@ function _(t) {
|
|
|
93
93
|
})(), Q = (e) => de?.(e) ?? P("uic.PagedSelector.totalItems", { total: e }), $ = P("uic.PagedSelector.loading");
|
|
94
94
|
return /* @__PURE__ */ l(n, {
|
|
95
95
|
...N,
|
|
96
|
-
label:
|
|
96
|
+
label: g,
|
|
97
97
|
value: R,
|
|
98
98
|
onChange: V,
|
|
99
99
|
triggerLabel: we,
|
|
100
|
-
placeholder:
|
|
100
|
+
placeholder: ae ?? P("uic.PagedSelector.placeholder", { label: g }),
|
|
101
101
|
isLoading: A,
|
|
102
102
|
size: j,
|
|
103
103
|
hasClear: ge,
|
|
@@ -105,15 +105,15 @@ function _(t) {
|
|
|
105
105
|
onOpenChange: (e) => {
|
|
106
106
|
e || U(-1), k?.(e);
|
|
107
107
|
},
|
|
108
|
-
contentXstyle:
|
|
108
|
+
contentXstyle: _.reset,
|
|
109
109
|
children: (e, t, n) => /* @__PURE__ */ u("div", { children: [
|
|
110
|
-
|
|
111
|
-
label:
|
|
112
|
-
clearLabel:
|
|
113
|
-
placeholder:
|
|
110
|
+
y ? /* @__PURE__ */ u(ne, { children: [/* @__PURE__ */ l(r, {
|
|
111
|
+
label: b ?? P("uic.PagedSelector.searchOptions"),
|
|
112
|
+
clearLabel: le ?? P("uic.PagedSelector.clearSearch"),
|
|
113
|
+
placeholder: ce ?? P("uic.PagedSelector.searchPlaceholder"),
|
|
114
114
|
value: Se,
|
|
115
115
|
onValueChange: (e) => {
|
|
116
|
-
xe(e), U(J(0, 1)),
|
|
116
|
+
xe(e), U(J(0, 1)), se?.(e);
|
|
117
117
|
},
|
|
118
118
|
onKeyDown: (e) => Z(e, n, !1),
|
|
119
119
|
"aria-controls": L,
|
|
@@ -123,21 +123,21 @@ function _(t) {
|
|
|
123
123
|
/* @__PURE__ */ l("div", {
|
|
124
124
|
id: L,
|
|
125
125
|
role: "listbox",
|
|
126
|
-
"aria-label":
|
|
126
|
+
"aria-label": g,
|
|
127
127
|
"aria-multiselectable": M || void 0,
|
|
128
|
-
tabIndex:
|
|
129
|
-
"aria-activedescendant": !
|
|
130
|
-
onKeyDown:
|
|
128
|
+
tabIndex: y ? void 0 : 0,
|
|
129
|
+
"aria-activedescendant": !y && q >= 0 ? G(q) : void 0,
|
|
130
|
+
onKeyDown: y ? void 0 : (e) => Z(e, n, !0),
|
|
131
131
|
onScroll: Ce,
|
|
132
132
|
className: "uic-paged-selector__listbox",
|
|
133
133
|
style: { maxHeight: pe },
|
|
134
|
-
children:
|
|
134
|
+
children: v.length === 0 ? /* @__PURE__ */ l("div", {
|
|
135
135
|
className: "uic-paged-selector__empty",
|
|
136
136
|
children: T === void 0 ? A ? /* @__PURE__ */ u(s, {
|
|
137
137
|
gap: 1,
|
|
138
138
|
vAlign: "center",
|
|
139
139
|
hAlign: "center",
|
|
140
|
-
children: [/* @__PURE__ */ l(
|
|
140
|
+
children: [/* @__PURE__ */ l(p, { size: "sm" }), /* @__PURE__ */ l(c, {
|
|
141
141
|
color: "secondary",
|
|
142
142
|
children: $
|
|
143
143
|
})]
|
|
@@ -145,7 +145,7 @@ function _(t) {
|
|
|
145
145
|
color: "secondary",
|
|
146
146
|
children: P("uic.PagedSelector.noResults")
|
|
147
147
|
}) : T
|
|
148
|
-
}) :
|
|
148
|
+
}) : v.map((e, t) => {
|
|
149
149
|
let r = Y(e.value), i = e.isDisabled ?? !1;
|
|
150
150
|
return /* @__PURE__ */ u("div", {
|
|
151
151
|
id: G(t),
|
|
@@ -174,7 +174,7 @@ function _(t) {
|
|
|
174
174
|
}),
|
|
175
175
|
/* @__PURE__ */ l("span", {
|
|
176
176
|
className: "uic-paged-selector__option-content",
|
|
177
|
-
children: /* @__PURE__ */ l(
|
|
177
|
+
children: /* @__PURE__ */ l(h, {
|
|
178
178
|
icon: e.icon,
|
|
179
179
|
label: e.labelContent ?? e.label,
|
|
180
180
|
description: e.description,
|
|
@@ -199,22 +199,22 @@ function _(t) {
|
|
|
199
199
|
vAlign: "center",
|
|
200
200
|
hAlign: "end",
|
|
201
201
|
className: "uic-paged-selector__foot",
|
|
202
|
-
children: [C ? /* @__PURE__ */ l(
|
|
202
|
+
children: [C ? /* @__PURE__ */ l(p, { size: "sm" }) : null, /* @__PURE__ */ l(c, {
|
|
203
203
|
color: "secondary",
|
|
204
204
|
size: "sm",
|
|
205
205
|
children: Q(w)
|
|
206
206
|
})]
|
|
207
207
|
}) : null),
|
|
208
|
-
/* @__PURE__ */ l(
|
|
208
|
+
/* @__PURE__ */ l(d, {
|
|
209
209
|
as: "div",
|
|
210
210
|
"aria-live": "polite",
|
|
211
|
-
children:
|
|
211
|
+
children: v.length === 0 && A ? $ : Q(v.length)
|
|
212
212
|
})
|
|
213
213
|
] })
|
|
214
214
|
});
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
|
-
export {
|
|
217
|
+
export { g as CONTENT_RESET, v as PagedSelector };
|
|
218
218
|
|
|
219
219
|
//# sourceMappingURL=PagedSelector2.js.map
|
|
220
220
|
import "../../assets/components/PagedSelector/PagedSelector.css";
|