@ai-matrx/design-system 0.15.2 → 0.17.0
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/CHANGELOG.md +36 -0
- package/README.md +6 -0
- package/dist/data-table/copy-helpers.d.cts +1 -1
- package/dist/data-table/copy-helpers.d.ts +1 -1
- package/dist/data-table/filter-engine.d.cts +1 -1
- package/dist/data-table/filter-engine.d.ts +1 -1
- package/dist/data-table/index.cjs +303 -68
- package/dist/data-table/index.cjs.map +1 -1
- package/dist/data-table/index.d.cts +2 -2
- package/dist/data-table/index.d.ts +2 -2
- package/dist/data-table/index.js +299 -64
- package/dist/data-table/index.js.map +1 -1
- package/dist/data-table/infer-filter.d.cts +1 -1
- package/dist/data-table/infer-filter.d.ts +1 -1
- package/dist/data-table/layered-filters.d.cts +1 -1
- package/dist/data-table/layered-filters.d.ts +1 -1
- package/dist/data-table/query-control.d.cts +1 -1
- package/dist/data-table/query-control.d.ts +1 -1
- package/dist/data-table/types.cjs.map +1 -1
- package/dist/data-table/types.d.cts +1 -1
- package/dist/data-table/types.d.ts +1 -1
- package/dist/data-table/url-state.d.cts +1 -1
- package/dist/data-table/url-state.d.ts +1 -1
- package/dist/data-table/xlsx.d.cts +1 -1
- package/dist/data-table/xlsx.d.ts +1 -1
- package/dist/index.cjs +12 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +41 -67
- package/dist/index.js.map +1 -1
- package/dist/{types-XXbVB1sh.d.cts → types-4fmLG5AN.d.cts} +16 -1
- package/dist/{types-ClaxTaXq.d.ts → types-pZ95iFk5.d.ts} +16 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { z as LAYERED_FILTER_OPERATORS, B as LAYERED_FILTER_OPERATOR_LABELS, D as LayeredFilterField, E as LayeredFilterOperator, L as LayeredFilterRule, F as columnFiltersToLayeredRules, G as completeLayeredFilterRules, H as decodeLayeredFilterRules, I as encodeLayeredFilterRules, J as isCompleteLayeredFilterRule, K as isLayeredFilterOperator, N as layeredFilterMatchesValue, O as layeredFilterNeedsValue, P as layeredFilterRuleSummary, Q as operatorsForLayeredField } from '../types-
|
|
1
|
+
export { z as LAYERED_FILTER_OPERATORS, B as LAYERED_FILTER_OPERATOR_LABELS, D as LayeredFilterField, E as LayeredFilterOperator, L as LayeredFilterRule, F as columnFiltersToLayeredRules, G as completeLayeredFilterRules, H as decodeLayeredFilterRules, I as encodeLayeredFilterRules, J as isCompleteLayeredFilterRule, K as isLayeredFilterOperator, N as layeredFilterMatchesValue, O as layeredFilterNeedsValue, P as layeredFilterRuleSummary, Q as operatorsForLayeredField } from '../types-4fmLG5AN.cjs';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './copy-types.cjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { z as LAYERED_FILTER_OPERATORS, B as LAYERED_FILTER_OPERATOR_LABELS, D as LayeredFilterField, E as LayeredFilterOperator, L as LayeredFilterRule, F as columnFiltersToLayeredRules, G as completeLayeredFilterRules, H as decodeLayeredFilterRules, I as encodeLayeredFilterRules, J as isCompleteLayeredFilterRule, K as isLayeredFilterOperator, N as layeredFilterMatchesValue, O as layeredFilterNeedsValue, P as layeredFilterRuleSummary, Q as operatorsForLayeredField } from '../types-
|
|
1
|
+
export { z as LAYERED_FILTER_OPERATORS, B as LAYERED_FILTER_OPERATOR_LABELS, D as LayeredFilterField, E as LayeredFilterOperator, L as LayeredFilterRule, F as columnFiltersToLayeredRules, G as completeLayeredFilterRules, H as decodeLayeredFilterRules, I as encodeLayeredFilterRules, J as isCompleteLayeredFilterRule, K as isLayeredFilterOperator, N as layeredFilterMatchesValue, O as layeredFilterNeedsValue, P as layeredFilterRuleSummary, Q as operatorsForLayeredField } from '../types-pZ95iFk5.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import './copy-types.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedFilterKind } from './infer-filter.cjs';
|
|
2
|
-
import { o as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-
|
|
2
|
+
import { o as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-4fmLG5AN.cjs';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './copy-types.cjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResolvedFilterKind } from './infer-filter.js';
|
|
2
|
-
import { o as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-
|
|
2
|
+
import { o as MatrxDataTableQueryState, M as MatrxColumnDef } from '../types-pZ95iFk5.js';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './copy-types.js';
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data-table/types.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { AgentPayloadInput } from \"./copy\";\nimport type {\n AiCustomSource,\n AiVariant,\n} from \"./copy\";\nimport type { LayeredFilterField, LayeredFilterRule } from \"./layered-filters\";\n\n/** How a column's filter UI behaves. `auto` infers from sample values. */\nexport type ColumnFilterKind =\n \"auto\" | \"text\" | \"select\" | \"boolean\" | \"number\" | false;\n\nexport type SortDirection = \"asc\" | \"desc\";\n\n/** How the table's primary search text is matched. */\nexport type TableSearchMatchMode = \"contains\" | \"whole_words\";\n\n/** Cell value type for typed inline editors (Supabase-style popovers for non-strings). */\nexport type CellEditType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"select\"\n /** Free-text multi-value chips (string[] cells: tags, labels, aliases). */\n | \"tags\"\n | \"date\"\n | false;\n\nexport interface MatrxColumnDef<T> {\n /** Stable id used for sort/filter state. Defaults to `accessorKey` when set. */\n id?: string;\n /** Dot-free key on the row for default value access + auto filter. */\n accessorKey?: keyof T & string;\n /** Custom value for sort/filter when `accessorKey` is insufficient. */\n accessorFn?: (row: T) => unknown;\n /** Value used only for local sort. Falls back to `accessorFn` / `accessorKey`. */\n sortValue?: (row: T) => unknown;\n /** Value used only for local filters. Falls back to `accessorFn` / `accessorKey`. */\n filterValue?: (row: T) => unknown;\n header: ReactNode;\n /** Plain-text name used for header controls when `header` is visual-only. */\n label?: string;\n /** Cell renderer. Defaults to stringified accessor value. */\n cell?: (row: T, index: number) => ReactNode;\n /** Sortable unless explicitly false. Default true. */\n sortable?: boolean;\n /** Direction used by the first header-click sort. Default `\"asc\"`. */\n defaultSortDirection?: SortDirection;\n /**\n * Filter kind. Default `\"auto\"` — every column gets a filter.\n * Pass `false` only when a column truly must not filter (e.g. actions).\n */\n filter?: ColumnFilterKind;\n /** Explicit select options (when filter is `\"select\"` or auto-detected). */\n filterOptions?: Array<{ value: string; label: string }>;\n /**\n * Single-choice select filter. The default select filter is a multi-select\n * that APPENDS (OR semantics) — correct for a status column, wrong for a\n * column whose options are mutually exclusive VIEWS of the list (a\n * record-class scope, a relative-date bucket). There, appending makes the\n * filter inert: the consumer reads one value, the popover accumulates a set,\n * and the first-selected value wins forever (D218). With `filterSingle`,\n * choosing an option REPLACES the selection, and choosing the active option\n * again clears it.\n */\n filterSingle?: boolean;\n /**\n * Inline edit. Default false. `\"string\"` edits in-cell; other types open a\n * small popover (Supabase-style). Edits stay local until Save on the dirty pill.\n */\n editable?: CellEditType;\n /**\n * Per-row edit gate for an `editable` column. Return false to render the\n * plain cell (no pencil, no click-to-edit) for that row — for heterogeneous\n * lists where some kinds cannot take the write (e.g. a transcripts row of\n * kind \"unsorted\" has no user-facing title). Default: every row editable.\n */\n editableIf?: (row: T) => boolean;\n /**\n * How inline edit starts. Default `\"click\"` (click the cell body). `\"pencil\"`\n * shows a hover/focus pencil; the cell body no longer starts edit — so a\n * whole-row click can own that gesture. Forced to `\"pencil\"` when `href` is\n * set (D112 — the body is a real link).\n */\n editTrigger?: \"click\" | \"pencil\";\n /**\n * Options when `editable === \"select\"`. Also used by `\"tags\"` as the\n * suggestion list (existing values), while still allowing new entries.\n */\n editOptions?: Array<{ value: string; label: string }>;\n /**\n * Row link for the primary/title cell (D112): renders the cell content as a\n * real `next/link` anchor, so the row is reachable by keyboard, announced as\n * a link by screen readers, and cmd/middle-clickable into a new tab. The\n * whole-row `onRowOpen` click stays as a mouse convenience; clicks on the\n * anchor never double-fire it. Combine with `editable` and the link renders\n * with a hover/focus pencil that opens the inline editor instead of\n * click-text-to-edit.\n */\n href?: (row: T) => string | undefined;\n /**\n * Canonical entity token for the record this column NAMES. When set, the cell\n * renders through `EntityRef`, so the name carries the full door set — Open,\n * new tab, and Peek — instead of the Open-only `<Link>` that `href` alone\n * produces.\n *\n * THE INVENTORY LAW, applied to this component: the table grew its own door\n * (`href`) beside the platform's (`EntityRef`), and every column that named a\n * record picked one and silently lost the other half. This field collapses\n * them — `href` still works and still forces the pencil trigger, and it\n * OVERRIDES the registry route when both are set (for an admin-side route on\n * a satellite deployment).\n *\n * Needs the record's id: `entityToken` is paired with `entityId`, defaulting\n * to the table's own `getRowId`.\n *\n * **PER ROW, not per column** — a hub can be heterogeneous. `/transcripts`\n * lists transcripts, studio sessions, cleanup runs and an \"unsorted\" bucket\n * in one table, each with its own destination; a constant token would have\n * sent a session id to the transcript processor route and opened the\n * transcript peek on a record that is not one. Return `undefined` for a row\n * that names no entity — it falls back to the plain `href` link, or to inert\n * text. Pair with a per-row `href` when the kinds diverge.\n */\n entityToken?: string | ((row: T) => string | undefined);\n /**\n * NOTE: give the column a `cell` when you set this. Without one, a\n * UUID-shaped value renders the default `MatrxUuidCell`, which has its own\n * controls — wrapping those in the door's anchor would nest interactive\n * elements inside a link, and is redundant besides. The shell detects that\n * combination, skips the door, and screams once per column.\n */\n /** The id `entityToken` refers to. Defaults to the table's `getRowId(row)`. */\n entityId?: (row: T) => string | undefined;\n /**\n * Drop this column below `sm` (the phone breakpoint).\n *\n * A wide table on a phone becomes a horizontal scroller: the frozen\n * identity column stays, and everything after the second column sits off\n * the right edge where a reviewer will never find it. Marking the columns\n * that do NOT earn their width on a phone is how a surface declares an\n * INTENTIONAL mobile column set instead of an accidental one.\n *\n * The column is still fully sortable/filterable from the toolbar and still\n * rides every copy/export payload — this hides the CELL, not the data.\n * Default `false` = today's behavior everywhere.\n */\n mobileHidden?: boolean;\n /**\n * Built-in cell kinds. `\"uuid\"` / `\"fk\"` use MatrxUuidCell (short + copy +\n * optional open). `\"auto\"` (default) detects UUID-shaped strings.\n */\n cellKind?: \"auto\" | \"uuid\" | \"fk\" | \"text\";\n /**\n * FK / UUID navigation. Prefer `onOpen` → WindowPanel of the target.\n * Return `\"forbidden\"` when the caller lacks access.\n */\n fk?: {\n label?: string;\n /**\n * Canonical entity token this column's ids point at (`agent`, `note`, …).\n * THE DOOR LAW made declarative: the cell resolves route + new tab + peek\n * from the registries, so a column of ids stops being a dead end without\n * hand-wiring a link. `href` / `onOpen` still win when both are set.\n * A function form resolves the token per row (an audit log whose target\n * type varies by row).\n *\n * `\"auto\"` derives the token from the COLUMN NAME (`task_id` → `task`).\n * It is opt-in on purpose: the guess is only correct when you have checked\n * the actual FK. `scheduler.sch_run.task_id` references `scheduler.sch_task`,\n * not the workspace `task` the name implies, and `app_id` /\n * `conversation_id` / `file_id` / `workflow_id` each have several candidate\n * tables. A wrong door opens a DIFFERENT record — worse than no door.\n */\n token?: string | null | \"auto\" | ((row: T) => string | null | undefined);\n href?: (id: string, row: T) => string | null | undefined;\n onOpen?: (\n id: string,\n row: T,\n ) => void | \"forbidden\" | Promise<void | \"forbidden\">;\n /** Force non-navigable for this column. */\n forbidden?: boolean | ((id: string, row: T) => boolean);\n };\n className?: string;\n headerClassName?: string;\n width?: string | number;\n align?: \"left\" | \"center\" | \"right\";\n /**\n * ICON COLUMN. A column whose whole content is one glyph — a star, a lock, a\n * status dot — and whose `width` is therefore a lie without this flag.\n *\n * `width` is only a hint on a table cell: min-content wins. A 40px star column\n * still rendered ~70px wide because the HEADER carried three separate\n * controls beside the glyph (the sort button, its arrow, the filter funnel),\n * and the cell carried the default `px-2` on both sides. Every surface that\n * wanted a tight icon column was paying for chrome it never used.\n *\n * `compact` fixes it AT THE PRIMITIVE, and does NOT cost the column anything:\n * horizontal padding drops to `px-1`, and the header collapses its three\n * controls into ONE popover trigger that still offers Sort ascending / Sort\n * descending / Clear sort / the full filter body. The column stays fully\n * sortable and filterable — the affordances moved into the menu, they did not\n * disappear. Active sort/filter still show, as a 2px dot on the trigger.\n *\n * Pair it with `width` and `align: \"center\"`.\n */\n compact?: boolean;\n /** Hide from the table (still available in column picker when we add it). */\n hidden?: boolean;\n /** Whether the package-owned Columns dialog may hide this column. Default true. */\n hideable?: boolean;\n}\n\n/** How a text filter matches. Default `\"contains\"`. */\nexport type TextFilterMode = \"contains\" | \"empty\" | \"not_empty\" | \"null\" | \"not_null\";\n\n/** Active per-column filter value. Shape depends on filter kind. */\nexport type ColumnFilterValue =\n | { kind: \"text\"; value: string; mode?: TextFilterMode; negated?: boolean }\n | {\n kind: \"select\";\n /** Single-choice value (legacy writers). Ignored when `values` is set. */\n value: string;\n /** Multi-choice OR set — a row passes if it matches ANY entry. */\n values?: string[];\n /** Exclude matching values instead of including them. */\n negated?: boolean;\n }\n | { kind: \"boolean\"; value: boolean; negated?: boolean }\n | { kind: \"number\"; min?: number | undefined; max?: number | undefined; negated?: boolean };\n\nexport type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;\n\nexport interface SortState {\n id: string;\n direction: SortDirection;\n}\n\n/**\n * Opt-in durable URL state for a local table.\n *\n * Every table gets an explicit stable id, producing namespaced parameters such\n * as `table.accounts.q` and `table.accounts.sort`. This prevents collisions\n * with page-owned parameters and with sibling tables on the same route.\n */\nexport interface MatrxDataTableUrlStateConfig {\n /** Stable lowercase identifier: letters, numbers, and hyphens; max 64 chars. */\n id: string;\n /** Initial sort when the URL carries none. Default: none. */\n defaultSort?: SortState | null | undefined;\n /** Browser history behavior for table transitions. Default: `push`. */\n history?: \"push\" | \"replace\" | undefined;\n /**\n * History behavior while typing search/any-of text. `session` pushes the\n * first edit, then replaces rapid keystrokes. Default: `session`.\n */\n textHistory?: \"session\" | \"push\" | \"replace\" | undefined;\n /** Persist the open side-panel row. Default true. */\n selectedRow?: boolean;\n /** Persist the open table-owned window row. Default true. */\n windowRow?: boolean;\n /** Persist checkbox selection. Opt-in because large selections lengthen URLs. */\n selection?: boolean;\n}\n\n/**\n * Complete view state for a remotely queried table page. The table owns none\n * of this state in controlled mode: callers may mirror it to URL search params\n * and use it as part of a direct database-query cache key.\n */\nexport interface MatrxDataTableQueryState {\n /** One-based page number, matching the table's pagination UI. */\n page: number;\n pageSize: number;\n search: string;\n /** Defaults to `contains` when omitted, preserving every existing table. */\n searchMatchMode?: TableSearchMatchMode;\n anyOf: string;\n /** Ordered AND rules from the compact advanced-filter builder. */\n layeredFilters?: LayeredFilterRule[];\n columnFilters: ColumnFiltersState;\n sort: SortState | null;\n}\n\n/**\n * Optional data-processing contract. Omit it (or use `local`) to preserve the\n * original in-memory filter/sort/pagination behavior. In controlled mode,\n * `data` is already the current page and the caller performs all querying.\n */\n/** Structural match for @ai-matrx/data/react usePaginatedData. */\nexport interface MatrxTablePagination<T> {\n queryKey: string;\n rows: T[];\n loading: boolean;\n isFetchingNextPage: boolean;\n error: Error | null;\n hasNextPage: boolean;\n loadNextPage: () => Promise<void>;\n refresh: () => void;\n totalItems: number | undefined;\n}\n\n/**\n * A controlled-local table can retain local search/pagination while its source\n * owns column filters and/or sorting. `sourceTotal` is display metadata only:\n * it never changes local page slicing, because the loaded rows remain local.\n */\nexport interface MatrxDataTableSourceProcessing {\n columnFilters?: \"local\" | \"source\";\n sort?: \"local\" | \"source\";\n sourceTotal?: number;\n}\n\nexport type MatrxDataTableQueryControl<T = unknown> =\n | { mode: \"local\" }\n | {\n /** Accumulated server rows; page stays 1 and sort/filter remain server-owned. */\n mode: \"controlled-append\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n pagination: MatrxTablePagination<T>;\n /** Source-connected tables append on user scroll by default. */\n scroll?: { mode?: \"scroll\" | \"manual\"; thresholdPx?: number; intentTimeoutMs?: number };\n }\n | {\n /** Local rows, but every query control is owned by the caller (for URL state). */\n mode: \"controlled-local\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n }\n | {\n mode: \"controlled\";\n state: MatrxDataTableQueryState;\n /** Total rows matching the controlled query, not just `data.length`. */\n totalItems: number;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n };\n\n/**\n * Toolbar facets — first-class, Mars-extensible filter controls above the grid.\n * Start with button-group; add radio / switch / complex later without forking.\n */\nexport type ToolbarFacet =\n | {\n type: \"button-group\";\n id: string;\n label?: string;\n value: string;\n /** Reset target for per-facet + global clear. Default: first option value. */\n defaultValue?: string;\n options: Array<{\n value: string;\n label: string;\n icon?: ReactNode;\n }>;\n onChange: (value: string) => void;\n }\n | {\n type: \"custom\";\n id: string;\n render: () => ReactNode;\n };\n\n/**\n * Cross-column OR search — matches if ANY listed column contains the query.\n * Relationships use case: filter by entity type without picking source vs target.\n */\nexport interface AnyOfColumnSearch {\n columnIds: string[];\n placeholder?: string;\n /** Controlled value. Uncontrolled if omitted. */\n value?: string;\n onChange?: (value: string) => void;\n}\n\nexport interface MatrxDataTableToolbar {\n /** Global search across all accessor values. Default true. */\n search?: boolean;\n searchPlaceholder?: string;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n /**\n * Show a compact, visible choice between substring and whole-word search.\n * Omit it when a data source cannot honor both modes server-side.\n */\n searchMatch?: {\n defaultMode?: TableSearchMatchMode;\n };\n /**\n * OR-search across specific columns (e.g. source_type OR target_type).\n * Shown as its own input beside global search when set.\n */\n anyOf?: AnyOfColumnSearch;\n /**\n * Optional compact advanced-filter builder beside the regular search. In\n * controlled mode rules live in `query.state.layeredFilters`; local tables\n * evaluate them against matching column ids.\n */\n layeredFilters?: {\n fields: readonly LayeredFilterField[];\n maxRules?: number;\n label?: string;\n };\n /** Extensible facet strip (button groups, later radios/switches/…). */\n facets?: ToolbarFacet[];\n /** Left-side extra nodes (after search / facets). */\n leading?: ReactNode;\n /** Right-side actions (create, refresh, …). */\n actions?: ReactNode;\n}\n\n/** Optional deferred-apply copy for column filter popovers. */\nexport interface MatrxDataTableFilterUi {\n /** Enables the Include/Exclude control. Default false for remote-safe filters. */\n allowNegation?: boolean;\n /** Enables null/not-null text modes. Default false for remote-safe filters. */\n allowNullModes?: boolean;\n applyLabel?: string;\n showCancel?: boolean;\n footerHint?: ReactNode;\n}\n\nexport interface MatrxDataTableCopyConfig<T> {\n /** Toast / tooltip label base, e.g. \"Relationship rule\". */\n label: string;\n listLabel?: string;\n location: string;\n rowKind: string;\n listKind: string;\n rowDescription?: string;\n listDescription?: string;\n humanRow: (row: T) => string;\n /** Project row for agent JSON. Default: full row. */\n agentRow?: (row: T) => unknown;\n rowAttributes?: (\n row: T,\n ) => Record<string, string | number | boolean | null | undefined>;\n listAttributes?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Live view state rendered inside the list payload's <context>. Unlike\n * per-row data, this remains present when the current view has zero rows.\n */\n listContext?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Additional row-scoped AI actions. Use this to fold a domain action such\n * as a paste-ready repair brief into the table-owned row copy menu instead\n * of rendering a separate third control. Builders run at click time.\n */\n rowAiVariants?: (row: T) => AiVariant[];\n /**\n * Graded AI variants for the toolbar's view copy (e.g. \"Top 25\", \"Summary\n * only\"). When set, the toolbar's Copy-for-AI upgrades to a dropdown with\n * these variants + the full-view payload as the automatic \"Everything\"\n * escape hatch. Receives (visible, all) rows at render; builders run at\n * click time.\n */\n aiVariants?: (visible: T[], all: T[]) => AiVariant[];\n /** Custom-preview source (options dialog + live size counts) for the view. */\n aiCustom?: (visible: T[], all: T[]) => AiCustomSource;\n /** Show toolbar copy (this view). Default true when copy is set. */\n showToolbar?: boolean;\n /** Show per-row copy. Default true when copy is set. */\n showRow?: boolean;\n}\n\nexport interface MatrxDataTableDetailConfig<T> {\n /** Side-panel title. Default: first string column or \"Details\". */\n title?: (row: T) => ReactNode;\n description?: (row: T) => ReactNode | undefined;\n /** Override the default key/value inspector. */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Header actions inside the side panel. */\n headerActions?: (row: T) => ReactNode;\n defaultWidth?: number;\n enabled?: boolean;\n /**\n * Maps a field name to the entity token its id points at, turning that field\n * into a door (route + peek) in the default inspector — side panel AND row\n * window.\n *\n * There is no default guess: this inspector renders whatever columns the row\n * has, and a wrong door opens a DIFFERENT record (`sch_run.task_id` is a\n * SCHEDULED task, not a workspace `task`). A table whose FKs you HAVE checked\n * can pass `tokenFromColumnName` (`components/official/entity-ref/doors`) to\n * open every `<token>_id` field at once.\n *\n * The ROW is passed too, because a table whose target type varies per row (an\n * audit log, an exposure report) cannot answer from the column name alone.\n */\n tokenForField?: (key: string, row: T) => string | null;\n}\n\n/** Actions a record-owned control can use without reaching into table state. */\nexport interface MatrxDataTableRecordControls {\n /** Close the row's side-panel detail, if open. */\n closeDetail: () => void;\n /** Open the row in the canonical adjustable side panel. */\n openDetail: () => void;\n /** Open the row in its canonical table-owned WindowPanel. */\n openWindow: () => void;\n /** Close the row's table-owned WindowPanel, if open. */\n closeWindow: () => void;\n /** Whether this row currently has visible, unpersisted inline edits. */\n hasPendingEdits: boolean;\n /**\n * Discard this row's pending inline edits.\n *\n * Row actions that persist the already-merged visible row (for example an\n * explicit Confirm action) call this only after that write succeeds. This\n * prevents the floating Save pill from later replaying the same draft as a\n * different, weaker write.\n */\n discardPendingEdits: () => void;\n}\n\nexport interface MatrxDataTableWindowConfig<T> {\n /** Window title. */\n title?: (row: T) => string;\n /**\n * @deprecated Prefer `renderView` + `renderEdit` so the window stays editable.\n * Full-body override with no View/Edit tabs.\n */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** View tab body. Defaults to DataRowInspector. */\n renderView?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /**\n * Edit tab body. When set, the WindowPanel shows View / Edit sidebar tabs\n * (WindowPanel built-in sidebar). Defaults to `detail.render` when present.\n * Pass `false` to keep a view-only window even when `detail.render` exists.\n */\n renderEdit?:\n ((row: T, controls: MatrxDataTableRecordControls) => ReactNode) | false;\n /**\n * Called when the panel icon opens the window — hydrate edit state here\n * without opening the side panel (prefer this over `onRowOpen` for windows).\n */\n onOpen?: (row: T) => void;\n /**\n * Make full-row click open the WindowPanel instead of the side panel.\n * The trailing row action and the window header then expose the side panel\n * as the explicit secondary presentation. Default false.\n */\n openOnRowClick?: boolean;\n /** Which tab to open. Default: `\"edit\"` when an edit body exists. */\n defaultTab?: \"view\" | \"edit\";\n /** Show the panel-icon that opens the window. Default true when detail enabled. */\n enabled?: boolean;\n width?: number;\n height?: number;\n}\n\nexport interface MatrxDataTableEmptyState {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n}\n\n/** Pending cell edits keyed by row id → partial field map. */\nexport type CellEditsMap = Record<string, Record<string, unknown>>;\n\nexport interface MatrxDataTableEditConfig<T> {\n /** Enable inline editing for columns with `editable` set. */\n enabled?: boolean;\n /**\n * Persist all pending edits. Called when the user clicks Save on the dirty pill.\n * Return resolved when done; throw/reject to keep the draft (with toast).\n */\n onSave: (edits: CellEditsMap, rows: T[]) => void | Promise<void>;\n /** Persist each committed cell immediately. Failed writes remain in the\n * dirty pill so the user can retry or cancel them. */\n autoSave?: boolean;\n /** Optional cancel hook (draft already discarded). */\n onCancel?: () => void;\n}\n\nexport interface MatrxDataTableHierarchyConfig<T> {\n /** Complete hierarchy when `data` is only the current controlled page. */\n rows?: T[];\n getParentId: (row: T) => string | null;\n /** Persist the exact structural intent represented by the drop shadow. */\n onMove: (row: T, move: MatrxDataTableHierarchyMove) => void | Promise<void>;\n /** Enables sibling insertion shadows in addition to parent/root drops. */\n manualOrder?: boolean;\n canReparent?: (row: T) => boolean;\n itemLabel?: (row: T) => string;\n rootDropLabel?: string;\n}\n\nexport interface MatrxDataTableHierarchyMove {\n parentId: string | null;\n /**\n * Insert immediately before this sibling. Null means first child for\n * \"inside\"/\"root\", and LAST sibling for \"after\" (target had no successor).\n */\n beforeId: string | null;\n position: \"before\" | \"after\" | \"inside\" | \"root\";\n targetId: string | null;\n}\n\n/**\n * Multi-row selection — a leading checkbox column plus a bulk bar that appears\n * only while rows are checked.\n *\n * OPT-IN and fully CONTROLLED: the consumer owns the id set, so selection\n * survives (or is deliberately cleared by) a re-fetch, a filter change, or an\n * optimistic list update — the table never holds hidden selection state that\n * can disagree with the surface around it.\n *\n * Why this is a primitive and not a per-surface checkbox column: a register\n * the user cannot clear in bulk is a register they stop reading, and the fifth\n * hand-rolled selection column — each with its own shift-click, its own\n * select-all semantics, its own bar — is exactly the fork `components/official/`\n * exists to prevent.\n *\n * Selection does not alter mobile horizontal scrolling. The complete row moves\n * as one surface below `sm`; no leading column is allowed to pin over the data.\n */\nexport interface MatrxDataTableSelectionConfig<T> {\n /** Selected row ids (`getRowId`). Ids not on the current page are kept. */\n selectedIds: string[];\n onSelectedIdsChange: (ids: string[]) => void;\n /**\n * The bulk bar's actions, given the currently-selected rows THAT ARE LOADED.\n * Selection can outlive a page change, so also take `selectedIds` when an\n * action only needs ids.\n */\n actions?: (selected: T[], selectedIds: string[]) => ReactNode;\n /**\n * Rows that cannot be acted on in bulk render NO checkbox at all — the cell\n * stays for alignment, the control is absent from the DOM. A greyed control\n * still advertises a choice the surface underneath would refuse.\n */\n isRowSelectable?: (row: T) => boolean;\n /** Singular noun for the bar's count (\"finding\" → \"3 findings selected\"). */\n noun?: string;\n}\n\n/** Table-owned state and actions exposed to an opt-in phone card renderer. */\nexport interface MatrxDataTableMobileCardControls {\n /** Whether this row is in the canonical selection set. */\n selected: boolean;\n /** Whether the consumer allows this row to be selected. */\n selectable: boolean;\n /** Update selection through the table's controlled/URL-backed contract. */\n onSelectedChange: (selected: boolean) => void;\n /**\n * The table's canonical per-row copy controls plus consumer row actions.\n * Render this instead of rebuilding either action path inside the card.\n */\n actions: ReactNode;\n}\n\nexport interface MatrxDataTableProps<T> {\n data: T[];\n columns: MatrxColumnDef<T>[];\n getRowId: (row: T) => string;\n /**\n * Additional row identity included in local global search without becoming\n * a visible/sortable/filterable column. Use for canonical composite keys or\n * aliases whose displayed parts live in separate columns.\n *\n * Ignored in remote controlled mode, where the query owner applies search.\n */\n searchText?: (row: T) => string;\n /**\n * Hierarchy-aware local processing seam. The canonical table still owns the\n * toolbar, URL state, headers, pagination, editing, copy, and rendering; the\n * consumer only preserves domain ordering that a flat sort would destroy.\n *\n * The processor must honor every active query control in `state` and return\n * the complete filtered/sorted local result before pagination. It is ignored\n * in remote controlled mode, where `data` is already the queried page.\n */\n processLocalRows?: (rows: T[], state: MatrxDataTableQueryState) => T[];\n /** Initial local sort when neither URL state nor a controlled query owns it. */\n defaultSort?: SortState | null;\n isLoading?: boolean;\n /**\n * Background refresh state. Unlike `isLoading`, this preserves rendered rows\n * and shows only the table's non-blocking refresh indicator.\n */\n isFetching?: boolean;\n /**\n * Controlled query state for direct remote data sources. The component never\n * fetches data itself; it only emits state changes to the caller.\n */\n query?: MatrxDataTableQueryControl<T>;\n /**\n * Persist local query and record-view state in namespaced URL parameters.\n * This is intentionally opt-in and cannot be combined with controlled query\n * mode; remote tables use `useTableUrlState({ tableId })` in their query owner.\n */\n urlState?: MatrxDataTableUrlStateConfig;\n\n toolbar?: MatrxDataTableToolbar;\n /** Hide the package toolbar while retaining table-owned query behavior. */\n hideToolbar?: boolean;\n /** Hide numbered pagination; local rows remain available to the caller. */\n hidePagination?: boolean;\n /** Optional deferred Apply/Cancel copy for column filter popovers. */\n filterUi?: MatrxDataTableFilterUi;\n /** Row click opens the side panel unless `window.openOnRowClick` is true. */\n detail?: MatrxDataTableDetailConfig<T>;\n /** Panel icon opens a WindowPanel (page-local; supports ReactNode override). */\n window?: MatrxDataTableWindowConfig<T>;\n /** Copy + Copy for AI (rows + this view). */\n copy?: MatrxDataTableCopyConfig<T>;\n /** Inline edit session with floating Save/Cancel pill. */\n edit?: MatrxDataTableEditConfig<T>;\n /** Opt-in tree reparenting owned by the canonical row renderer. */\n hierarchy?: MatrxDataTableHierarchyConfig<T>;\n\n /** Controlled selection (selected row id for highlight). */\n selectedId?: string | null | undefined;\n onSelectedIdChange?: ((id: string | null) => void) | undefined;\n\n /** Controlled table-owned window row (normally supplied by URL state). */\n windowRowId?: string | null | undefined;\n onWindowRowIdChange?: ((id: string | null) => void) | undefined;\n\n /** Opt-in multi-row checkbox selection + a bulk action bar. */\n selection?: MatrxDataTableSelectionConfig<T>;\n\n /** Extra row actions rendered in a trailing Actions column. */\n rowActions?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Extra rows rendered in the table footer with the same columns as data rows. */\n footerRows?: T[];\n /** Per-row presentation class, after canonical selection/highlight state. */\n rowClassName?: (row: T, index: number) => string | undefined;\n /** Highlight an index in the currently rendered page without selecting it. */\n highlightedIndex?: number | undefined;\n /** Receives the complete visible local view after local processing, before paging. */\n onViewChange?: (rows: T[]) => void;\n /**\n * Wrap the whole `<tr>`. Return `children` unchanged for no-op.\n *\n * `rowActions` only reaches the actions CELL, so anything that must own the\n * entire row — a right-click menu, a drag handle, a drop target — had no\n * seam and would have forced a surface to fork the table. THE INVENTORY LAW:\n * the fork is the defect, so the seam exists instead.\n *\n * Whatever you return must render `children` as a direct `<tbody>` child, so\n * the wrapper has to be a component that emits the `<tr>` unchanged\n * (`ItemContextMenu` does — it renders a Radix trigger with `asChild`).\n */\n rowWrapper?: (row: T, children: ReactNode) => ReactNode;\n\n emptyState?: MatrxDataTableEmptyState;\n /** Default 25. Pass 0 to show all. */\n pageSize?: number;\n pageSizeOptions?: number[];\n zebra?: boolean;\n className?: string;\n tableClassName?: string;\n /**\n * Optional compact row presentation rendered below `mobileCardsBreakpoint`\n * in place of the horizontal table. The caller supplies the record summary\n * because only the product surface knows which values and actions are\n * essential at narrow widths; MatrxDataTable still owns query state,\n * loading/empty states, and pagination.\n *\n * `controls.actions` carries the table-owned copy controls and consumer row\n * actions, so a card does not fork them. Prefer the default horizontal table\n * unless the product explicitly requires every essential value/action to be\n * discoverable without horizontal scrolling.\n */\n mobileCards?: (\n row: T,\n index: number,\n controls: MatrxDataTableMobileCardControls,\n ) => ReactNode;\n /** Card/table handoff. `sm` is phone-only; `lg` includes portrait tablets. */\n mobileCardsBreakpoint?: \"sm\" | \"lg\";\n /** Called after a row is selected for detail (in addition to opening the panel). */\n onRowOpen?: (row: T) => void;\n}\n\n/** Re-export for callers building custom agent payloads. */\nexport type { AgentPayloadInput };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/data-table/types.ts"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport type { AgentPayloadInput } from \"./copy\";\nimport type {\n AiCustomSource,\n AiVariant,\n} from \"./copy\";\nimport type { LayeredFilterField, LayeredFilterRule } from \"./layered-filters\";\n\n/** How a column's filter UI behaves. `auto` infers from sample values. */\nexport type ColumnFilterKind =\n \"auto\" | \"text\" | \"select\" | \"boolean\" | \"number\" | false;\n\nexport type SortDirection = \"asc\" | \"desc\";\n\n/** How the table's primary search text is matched. */\nexport type TableSearchMatchMode = \"contains\" | \"whole_words\";\n\n/** Cell value type for typed inline editors (Supabase-style popovers for non-strings). */\nexport type CellEditType =\n | \"string\"\n | \"number\"\n | \"boolean\"\n | \"select\"\n /** Free-text multi-value chips (string[] cells: tags, labels, aliases). */\n | \"tags\"\n | \"date\"\n | false;\n\nexport interface MatrxColumnDef<T> {\n /** Stable id used for sort/filter state. Defaults to `accessorKey` when set. */\n id?: string;\n /** Dot-free key on the row for default value access + auto filter. */\n accessorKey?: keyof T & string;\n /** Custom value for sort/filter when `accessorKey` is insufficient. */\n accessorFn?: (row: T) => unknown;\n /** Value used only for local sort. Falls back to `accessorFn` / `accessorKey`. */\n sortValue?: (row: T) => unknown;\n /** Value used only for local filters. Falls back to `accessorFn` / `accessorKey`. */\n filterValue?: (row: T) => unknown;\n header: ReactNode;\n /** Plain-text name used for header controls when `header` is visual-only. */\n label?: string;\n /** Cell renderer. Defaults to stringified accessor value. */\n cell?: (row: T, index: number) => ReactNode;\n /** Sortable unless explicitly false. Default true. */\n sortable?: boolean;\n /** Direction used by the first header-click sort. Default `\"asc\"`. */\n defaultSortDirection?: SortDirection;\n /**\n * Filter kind. Default `\"auto\"` — every column gets a filter.\n * Pass `false` only when a column truly must not filter (e.g. actions).\n */\n filter?: ColumnFilterKind;\n /** Explicit select options (when filter is `\"select\"` or auto-detected). */\n filterOptions?: Array<{ value: string; label: string }>;\n /**\n * Single-choice select filter. The default select filter is a multi-select\n * that APPENDS (OR semantics) — correct for a status column, wrong for a\n * column whose options are mutually exclusive VIEWS of the list (a\n * record-class scope, a relative-date bucket). There, appending makes the\n * filter inert: the consumer reads one value, the popover accumulates a set,\n * and the first-selected value wins forever (D218). With `filterSingle`,\n * choosing an option REPLACES the selection, and choosing the active option\n * again clears it.\n */\n filterSingle?: boolean;\n /**\n * Inline edit. Default false. `\"string\"` edits in-cell; other types open a\n * small popover (Supabase-style). Edits stay local until Save on the dirty pill.\n */\n editable?: CellEditType;\n /**\n * Per-row edit gate for an `editable` column. Return false to render the\n * plain cell (no pencil, no click-to-edit) for that row — for heterogeneous\n * lists where some kinds cannot take the write (e.g. a transcripts row of\n * kind \"unsorted\" has no user-facing title). Default: every row editable.\n */\n editableIf?: (row: T) => boolean;\n /**\n * How inline edit starts. Default `\"click\"` (click the cell body). `\"pencil\"`\n * shows a hover/focus pencil; the cell body no longer starts edit — so a\n * whole-row click can own that gesture. Forced to `\"pencil\"` when `href` is\n * set (D112 — the body is a real link).\n */\n editTrigger?: \"click\" | \"pencil\";\n /**\n * Options when `editable === \"select\"`. Also used by `\"tags\"` as the\n * suggestion list (existing values), while still allowing new entries.\n */\n editOptions?: Array<{ value: string; label: string }>;\n /**\n * Row link for the primary/title cell (D112): renders the cell content as a\n * real `next/link` anchor, so the row is reachable by keyboard, announced as\n * a link by screen readers, and cmd/middle-clickable into a new tab. The\n * whole-row `onRowOpen` click stays as a mouse convenience; clicks on the\n * anchor never double-fire it. Combine with `editable` and the link renders\n * with a hover/focus pencil that opens the inline editor instead of\n * click-text-to-edit.\n */\n href?: (row: T) => string | undefined;\n /**\n * Canonical entity token for the record this column NAMES. When set, the cell\n * renders through `EntityRef`, so the name carries the full door set — Open,\n * new tab, and Peek — instead of the Open-only `<Link>` that `href` alone\n * produces.\n *\n * THE INVENTORY LAW, applied to this component: the table grew its own door\n * (`href`) beside the platform's (`EntityRef`), and every column that named a\n * record picked one and silently lost the other half. This field collapses\n * them — `href` still works and still forces the pencil trigger, and it\n * OVERRIDES the registry route when both are set (for an admin-side route on\n * a satellite deployment).\n *\n * Needs the record's id: `entityToken` is paired with `entityId`, defaulting\n * to the table's own `getRowId`.\n *\n * **PER ROW, not per column** — a hub can be heterogeneous. `/transcripts`\n * lists transcripts, studio sessions, cleanup runs and an \"unsorted\" bucket\n * in one table, each with its own destination; a constant token would have\n * sent a session id to the transcript processor route and opened the\n * transcript peek on a record that is not one. Return `undefined` for a row\n * that names no entity — it falls back to the plain `href` link, or to inert\n * text. Pair with a per-row `href` when the kinds diverge.\n */\n entityToken?: string | ((row: T) => string | undefined);\n /**\n * NOTE: give the column a `cell` when you set this. Without one, a\n * UUID-shaped value renders the default `MatrxUuidCell`, which has its own\n * controls — wrapping those in the door's anchor would nest interactive\n * elements inside a link, and is redundant besides. The shell detects that\n * combination, skips the door, and screams once per column.\n */\n /** The id `entityToken` refers to. Defaults to the table's `getRowId(row)`. */\n entityId?: (row: T) => string | undefined;\n /**\n * Drop this column below `sm` (the phone breakpoint).\n *\n * A wide table on a phone becomes a horizontal scroller: the frozen\n * identity column stays, and everything after the second column sits off\n * the right edge where a reviewer will never find it. Marking the columns\n * that do NOT earn their width on a phone is how a surface declares an\n * INTENTIONAL mobile column set instead of an accidental one.\n *\n * The column is still fully sortable/filterable from the toolbar and still\n * rides every copy/export payload — this hides the CELL, not the data.\n * Default `false` = today's behavior everywhere.\n */\n mobileHidden?: boolean;\n /**\n * Built-in cell kinds. `\"uuid\"` / `\"fk\"` use MatrxUuidCell (short + copy +\n * optional open). `\"auto\"` (default) detects UUID-shaped strings.\n */\n cellKind?: \"auto\" | \"uuid\" | \"fk\" | \"text\";\n /**\n * FK / UUID navigation. Prefer `onOpen` → WindowPanel of the target.\n * Return `\"forbidden\"` when the caller lacks access.\n */\n fk?: {\n label?: string;\n /**\n * Canonical entity token this column's ids point at (`agent`, `note`, …).\n * THE DOOR LAW made declarative: the cell resolves route + new tab + peek\n * from the registries, so a column of ids stops being a dead end without\n * hand-wiring a link. `href` / `onOpen` still win when both are set.\n * A function form resolves the token per row (an audit log whose target\n * type varies by row).\n *\n * `\"auto\"` derives the token from the COLUMN NAME (`task_id` → `task`).\n * It is opt-in on purpose: the guess is only correct when you have checked\n * the actual FK. `scheduler.sch_run.task_id` references `scheduler.sch_task`,\n * not the workspace `task` the name implies, and `app_id` /\n * `conversation_id` / `file_id` / `workflow_id` each have several candidate\n * tables. A wrong door opens a DIFFERENT record — worse than no door.\n */\n token?: string | null | \"auto\" | ((row: T) => string | null | undefined);\n href?: (id: string, row: T) => string | null | undefined;\n onOpen?: (\n id: string,\n row: T,\n ) => void | \"forbidden\" | Promise<void | \"forbidden\">;\n /** Force non-navigable for this column. */\n forbidden?: boolean | ((id: string, row: T) => boolean);\n };\n className?: string;\n headerClassName?: string;\n width?: string | number;\n align?: \"left\" | \"center\" | \"right\";\n /**\n * ICON COLUMN. A column whose whole content is one glyph — a star, a lock, a\n * status dot — and whose `width` is therefore a lie without this flag.\n *\n * `width` is only a hint on a table cell: min-content wins. A 40px star column\n * still rendered ~70px wide because the HEADER carried three separate\n * controls beside the glyph (the sort button, its arrow, the filter funnel),\n * and the cell carried the default `px-2` on both sides. Every surface that\n * wanted a tight icon column was paying for chrome it never used.\n *\n * `compact` fixes it AT THE PRIMITIVE, and does NOT cost the column anything:\n * horizontal padding drops to `px-1`, and the header collapses its three\n * controls into ONE popover trigger that still offers Sort ascending / Sort\n * descending / Clear sort / the full filter body. The column stays fully\n * sortable and filterable — the affordances moved into the menu, they did not\n * disappear. Active sort/filter still show, as a 2px dot on the trigger.\n *\n * Pair it with `width` and `align: \"center\"`.\n */\n compact?: boolean;\n /** Hide from the table (still available in column picker when we add it). */\n hidden?: boolean;\n /** Whether the package-owned Columns dialog may hide this column. Default true. */\n hideable?: boolean;\n}\n\n/** How a text filter matches. Default `\"contains\"`. */\nexport type TextFilterMode = \"contains\" | \"empty\" | \"not_empty\" | \"null\" | \"not_null\";\n\n/** Active per-column filter value. Shape depends on filter kind. */\nexport type ColumnFilterValue =\n | { kind: \"text\"; value: string; mode?: TextFilterMode; negated?: boolean }\n | {\n kind: \"select\";\n /** Single-choice value (legacy writers). Ignored when `values` is set. */\n value: string;\n /** Multi-choice OR set — a row passes if it matches ANY entry. */\n values?: string[];\n /** Exclude matching values instead of including them. */\n negated?: boolean;\n }\n | { kind: \"boolean\"; value: boolean; negated?: boolean }\n | { kind: \"number\"; min?: number | undefined; max?: number | undefined; negated?: boolean };\n\nexport type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;\n\nexport interface SortState {\n id: string;\n direction: SortDirection;\n}\n\n/**\n * Opt-in durable URL state for a local table.\n *\n * Every table gets an explicit stable id, producing namespaced parameters such\n * as `table.accounts.q` and `table.accounts.sort`. This prevents collisions\n * with page-owned parameters and with sibling tables on the same route.\n */\nexport interface MatrxDataTableUrlStateConfig {\n /** Stable lowercase identifier: letters, numbers, and hyphens; max 64 chars. */\n id: string;\n /** Initial sort when the URL carries none. Default: none. */\n defaultSort?: SortState | null | undefined;\n /** Browser history behavior for table transitions. Default: `push`. */\n history?: \"push\" | \"replace\" | undefined;\n /**\n * History behavior while typing search/any-of text. `session` pushes the\n * first edit, then replaces rapid keystrokes. Default: `session`.\n */\n textHistory?: \"session\" | \"push\" | \"replace\" | undefined;\n /** Persist the open side-panel row. Default true. */\n selectedRow?: boolean;\n /** Persist the open table-owned window row. Default true. */\n windowRow?: boolean;\n /** Persist checkbox selection. Opt-in because large selections lengthen URLs. */\n selection?: boolean;\n}\n\n/**\n * Complete view state for a remotely queried table page. The table owns none\n * of this state in controlled mode: callers may mirror it to URL search params\n * and use it as part of a direct database-query cache key.\n */\nexport interface MatrxDataTableQueryState {\n /** One-based page number, matching the table's pagination UI. */\n page: number;\n pageSize: number;\n search: string;\n /** Defaults to `contains` when omitted, preserving every existing table. */\n searchMatchMode?: TableSearchMatchMode;\n anyOf: string;\n /** Ordered AND rules from the compact advanced-filter builder. */\n layeredFilters?: LayeredFilterRule[];\n columnFilters: ColumnFiltersState;\n sort: SortState | null;\n}\n\n/**\n * Optional data-processing contract. Omit it (or use `local`) to preserve the\n * original in-memory filter/sort/pagination behavior. In controlled mode,\n * `data` is already the current page and the caller performs all querying.\n */\n/** Structural match for @ai-matrx/data/react usePaginatedData. */\nexport interface MatrxTablePagination<T> {\n queryKey: string;\n rows: T[];\n loading: boolean;\n isFetchingNextPage: boolean;\n error: Error | null;\n hasNextPage: boolean;\n loadNextPage: () => Promise<void>;\n refresh: () => void;\n totalItems: number | undefined;\n}\n\n/**\n * A controlled-local table can retain local search/pagination while its source\n * owns column filters and/or sorting. `sourceTotal` is display metadata only:\n * it never changes local page slicing, because the loaded rows remain local.\n */\nexport interface MatrxDataTableSourceProcessing {\n columnFilters?: \"local\" | \"source\";\n sort?: \"local\" | \"source\";\n sourceTotal?: number;\n}\n\nexport type MatrxDataTableQueryControl<T = unknown> =\n | { mode: \"local\" }\n | {\n /** Accumulated server rows; page stays 1 and sort/filter remain server-owned. */\n mode: \"controlled-append\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n pagination: MatrxTablePagination<T>;\n /** Source-connected tables append on user scroll by default. */\n scroll?: { mode?: \"scroll\" | \"manual\"; thresholdPx?: number; intentTimeoutMs?: number };\n }\n | {\n /** Local rows, but every query control is owned by the caller (for URL state). */\n mode: \"controlled-local\";\n state: MatrxDataTableQueryState;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n sourceProcessing?: MatrxDataTableSourceProcessing;\n }\n | {\n mode: \"controlled\";\n state: MatrxDataTableQueryState;\n /** Total rows matching the controlled query, not just `data.length`. */\n totalItems: number;\n onStateChange: (next: MatrxDataTableQueryState) => void;\n };\n\n/**\n * Toolbar facets — first-class, Mars-extensible filter controls above the grid.\n * Start with button-group; add radio / switch / complex later without forking.\n */\nexport type ToolbarFacet =\n | {\n type: \"button-group\";\n id: string;\n label?: string;\n value: string;\n /** Reset target for per-facet + global clear. Default: first option value. */\n defaultValue?: string;\n options: Array<{\n value: string;\n label: string;\n icon?: ReactNode;\n }>;\n onChange: (value: string) => void;\n }\n | {\n type: \"custom\";\n id: string;\n render: () => ReactNode;\n };\n\n/**\n * Cross-column OR search — matches if ANY listed column contains the query.\n * Relationships use case: filter by entity type without picking source vs target.\n */\nexport interface AnyOfColumnSearch {\n columnIds: string[];\n placeholder?: string;\n /** Controlled value. Uncontrolled if omitted. */\n value?: string;\n onChange?: (value: string) => void;\n}\n\nexport interface MatrxDataTableToolbar {\n /** Global search across all accessor values. Default true. */\n search?: boolean;\n searchPlaceholder?: string;\n searchValue?: string;\n onSearchChange?: (value: string) => void;\n /**\n * Show a compact, visible choice between substring and whole-word search.\n * Omit it when a data source cannot honor both modes server-side.\n */\n searchMatch?: {\n defaultMode?: TableSearchMatchMode;\n };\n /**\n * OR-search across specific columns (e.g. source_type OR target_type).\n * Shown as its own input beside global search when set.\n */\n anyOf?: AnyOfColumnSearch;\n /**\n * Optional compact advanced-filter builder beside the regular search. In\n * controlled mode rules live in `query.state.layeredFilters`; local tables\n * evaluate them against matching column ids.\n */\n layeredFilters?: {\n fields: readonly LayeredFilterField[];\n maxRules?: number;\n label?: string;\n };\n /** Extensible facet strip (button groups, later radios/switches/…). */\n facets?: ToolbarFacet[];\n /** Left-side extra nodes (after search / facets). */\n leading?: ReactNode;\n /** Right-side actions (create, refresh, …). */\n actions?: ReactNode;\n}\n\n/** Optional deferred-apply copy for column filter popovers. */\nexport interface MatrxDataTableFilterUi {\n /** Enables the Include/Exclude control. Default false for remote-safe filters. */\n allowNegation?: boolean;\n /** Enables null/not-null text modes. Default false for remote-safe filters. */\n allowNullModes?: boolean;\n applyLabel?: string;\n showCancel?: boolean;\n footerHint?: ReactNode;\n}\n\nexport interface MatrxDataTableCopyConfig<T> {\n /** Toast / tooltip label base, e.g. \"Relationship rule\". */\n label: string;\n listLabel?: string;\n location: string;\n rowKind: string;\n listKind: string;\n rowDescription?: string;\n listDescription?: string;\n humanRow: (row: T) => string;\n /** Project row for agent JSON. Default: full row. */\n agentRow?: (row: T) => unknown;\n rowAttributes?: (\n row: T,\n ) => Record<string, string | number | boolean | null | undefined>;\n listAttributes?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Live view state rendered inside the list payload's <context>. Unlike\n * per-row data, this remains present when the current view has zero rows.\n */\n listContext?: (\n visible: T[],\n all: T[],\n ) => Record<string, string | number | boolean | null | undefined>;\n /**\n * Additional row-scoped AI actions. Use this to fold a domain action such\n * as a paste-ready repair brief into the table-owned row copy menu instead\n * of rendering a separate third control. Builders run at click time.\n */\n rowAiVariants?: (row: T) => AiVariant[];\n /**\n * Graded AI variants for the toolbar's view copy (e.g. \"Top 25\", \"Summary\n * only\"). When set, the toolbar's Copy-for-AI upgrades to a dropdown with\n * these variants + the full-view payload as the automatic \"Everything\"\n * escape hatch. Receives (visible, all) rows at render; builders run at\n * click time.\n */\n aiVariants?: (visible: T[], all: T[]) => AiVariant[];\n /** Custom-preview source (options dialog + live size counts) for the view. */\n aiCustom?: (visible: T[], all: T[]) => AiCustomSource;\n /** Show toolbar copy (this view). Default true when copy is set. */\n showToolbar?: boolean;\n /** Show per-row copy. Default true when copy is set. */\n showRow?: boolean;\n}\n\nexport interface MatrxDataTableDetailConfig<T> {\n /** Side-panel title. Default: first string column or \"Details\". */\n title?: (row: T) => ReactNode;\n description?: (row: T) => ReactNode | undefined;\n /** Override the default key/value inspector. */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Header actions inside the side panel. */\n headerActions?: (row: T) => ReactNode;\n defaultWidth?: number;\n enabled?: boolean;\n /**\n * Maps a field name to the entity token its id points at, turning that field\n * into a door (route + peek) in the default inspector — side panel AND row\n * window.\n *\n * There is no default guess: this inspector renders whatever columns the row\n * has, and a wrong door opens a DIFFERENT record (`sch_run.task_id` is a\n * SCHEDULED task, not a workspace `task`). A table whose FKs you HAVE checked\n * can pass `tokenFromColumnName` (`components/official/entity-ref/doors`) to\n * open every `<token>_id` field at once.\n *\n * The ROW is passed too, because a table whose target type varies per row (an\n * audit log, an exposure report) cannot answer from the column name alone.\n */\n tokenForField?: (key: string, row: T) => string | null;\n}\n\n/** Actions a record-owned control can use without reaching into table state. */\nexport interface MatrxDataTableRecordControls {\n /** Close the row's side-panel detail, if open. */\n closeDetail: () => void;\n /** Open the row in the canonical adjustable side panel. */\n openDetail: () => void;\n /** Open the row in its canonical table-owned WindowPanel. */\n openWindow: () => void;\n /** Close the row's table-owned WindowPanel, if open. */\n closeWindow: () => void;\n /** Whether this row currently has visible, unpersisted inline edits. */\n hasPendingEdits: boolean;\n /**\n * Discard this row's pending inline edits.\n *\n * Row actions that persist the already-merged visible row (for example an\n * explicit Confirm action) call this only after that write succeeds. This\n * prevents the floating Save pill from later replaying the same draft as a\n * different, weaker write.\n */\n discardPendingEdits: () => void;\n}\n\nexport interface MatrxDataTableWindowConfig<T> {\n /** Window title. */\n title?: (row: T) => string;\n /**\n * @deprecated Prefer `renderView` + `renderEdit` so the window stays editable.\n * Full-body override with no View/Edit tabs.\n */\n render?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** View tab body. Defaults to DataRowInspector. */\n renderView?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /**\n * Edit tab body. When set, the WindowPanel shows View / Edit sidebar tabs\n * (WindowPanel built-in sidebar). Defaults to `detail.render` when present.\n * Pass `false` to keep a view-only window even when `detail.render` exists.\n */\n renderEdit?:\n ((row: T, controls: MatrxDataTableRecordControls) => ReactNode) | false;\n /**\n * Called when the panel icon opens the window — hydrate edit state here\n * without opening the side panel (prefer this over `onRowOpen` for windows).\n */\n onOpen?: (row: T) => void;\n /**\n * Make full-row click open the WindowPanel instead of the side panel.\n * The trailing row action and the window header then expose the side panel\n * as the explicit secondary presentation. Default false.\n */\n openOnRowClick?: boolean;\n /** Which tab to open. Default: `\"edit\"` when an edit body exists. */\n defaultTab?: \"view\" | \"edit\";\n /** Show the panel-icon that opens the window. Default true when detail enabled. */\n enabled?: boolean;\n width?: number;\n height?: number;\n}\n\nexport interface MatrxDataTableEmptyState {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n}\n\n/** Pending cell edits keyed by row id → partial field map. */\nexport type CellEditsMap = Record<string, Record<string, unknown>>;\n\nexport interface MatrxDataTableEditConfig<T> {\n /** Enable inline editing for columns with `editable` set. */\n enabled?: boolean;\n /**\n * Persist all pending edits. Called when the user clicks Save on the dirty pill.\n * Return resolved when done; throw/reject to keep the draft (with toast).\n */\n onSave: (edits: CellEditsMap, rows: T[]) => void | Promise<void>;\n /** Persist each committed cell immediately. Failed writes remain in the\n * dirty pill so the user can retry or cancel them. */\n autoSave?: boolean;\n /** Optional cancel hook (draft already discarded). */\n onCancel?: () => void;\n}\n\nexport interface MatrxDataTableHierarchyConfig<T> {\n /** Complete hierarchy when `data` is only the current controlled page. */\n rows?: T[];\n getParentId: (row: T) => string | null;\n /** Persist the exact structural intent represented by the drop shadow. */\n onMove: (row: T, move: MatrxDataTableHierarchyMove) => void | Promise<void>;\n /** Enables sibling insertion shadows in addition to parent/root drops. */\n manualOrder?: boolean;\n canReparent?: (row: T) => boolean;\n itemLabel?: (row: T) => string;\n rootDropLabel?: string;\n}\n\nexport interface MatrxDataTableHierarchyMove {\n parentId: string | null;\n /**\n * Insert immediately before this sibling. Null means first child for\n * \"inside\"/\"root\", and LAST sibling for \"after\" (target had no successor).\n */\n beforeId: string | null;\n position: \"before\" | \"after\" | \"inside\" | \"root\";\n targetId: string | null;\n}\n\n/**\n * Multi-row selection — a leading checkbox column plus a bulk bar that appears\n * only while rows are checked.\n *\n * OPT-IN and fully CONTROLLED: the consumer owns the id set, so selection\n * survives (or is deliberately cleared by) a re-fetch, a filter change, or an\n * optimistic list update — the table never holds hidden selection state that\n * can disagree with the surface around it.\n *\n * Why this is a primitive and not a per-surface checkbox column: a register\n * the user cannot clear in bulk is a register they stop reading, and the fifth\n * hand-rolled selection column — each with its own shift-click, its own\n * select-all semantics, its own bar — is exactly the fork `components/official/`\n * exists to prevent.\n *\n * Selection does not alter mobile horizontal scrolling. The complete row moves\n * as one surface below `sm`; no leading column is allowed to pin over the data.\n */\nexport interface MatrxDataTableSelectionConfig<T> {\n /** Selected row ids (`getRowId`). Ids not on the current page are kept. */\n selectedIds: string[];\n onSelectedIdsChange: (ids: string[]) => void;\n /**\n * The bulk bar's actions, given the currently-selected rows THAT ARE LOADED.\n * Selection can outlive a page change, so also take `selectedIds` when an\n * action only needs ids.\n */\n actions?: (selected: T[], selectedIds: string[]) => ReactNode;\n /**\n * Rows that cannot be acted on in bulk render NO checkbox at all — the cell\n * stays for alignment, the control is absent from the DOM. A greyed control\n * still advertises a choice the surface underneath would refuse.\n */\n isRowSelectable?: (row: T) => boolean;\n /** Singular noun for the bar's count (\"finding\" → \"3 findings selected\"). */\n noun?: string;\n}\n\n/** Table-owned state and actions exposed to an opt-in phone card renderer. */\nexport interface MatrxDataTableMobileCardControls {\n /** Whether this row is in the canonical selection set. */\n selected: boolean;\n /** Whether the consumer allows this row to be selected. */\n selectable: boolean;\n /** Update selection through the table's controlled/URL-backed contract. */\n onSelectedChange: (selected: boolean) => void;\n /**\n * The table's canonical per-row copy controls plus consumer row actions.\n * Render this instead of rebuilding either action path inside the card.\n */\n actions: ReactNode;\n}\n\nexport interface MatrxDataTableProps<T> {\n data: T[];\n columns: MatrxColumnDef<T>[];\n /** Optional URL/source-owned column order and visibility. */\n columnState?: {\n order: string[];\n hidden: string[];\n onChange: (next: { order: string[]; hidden: string[] }) => void;\n };\n /** Enables package-owned drag reordering in table headers. */\n reorderableColumns?: boolean;\n columnManager?: { open: boolean; onOpenChange: (open: boolean) => void };\n getRowId: (row: T) => string;\n /**\n * Additional row identity included in local global search without becoming\n * a visible/sortable/filterable column. Use for canonical composite keys or\n * aliases whose displayed parts live in separate columns.\n *\n * Ignored in remote controlled mode, where the query owner applies search.\n */\n searchText?: (row: T) => string;\n /**\n * Hierarchy-aware local processing seam. The canonical table still owns the\n * toolbar, URL state, headers, pagination, editing, copy, and rendering; the\n * consumer only preserves domain ordering that a flat sort would destroy.\n *\n * The processor must honor every active query control in `state` and return\n * the complete filtered/sorted local result before pagination. It is ignored\n * in remote controlled mode, where `data` is already the queried page.\n */\n processLocalRows?: (rows: T[], state: MatrxDataTableQueryState) => T[];\n /** Initial local sort when neither URL state nor a controlled query owns it. */\n defaultSort?: SortState | null;\n isLoading?: boolean;\n /**\n * Background refresh state. Unlike `isLoading`, this preserves rendered rows\n * and shows only the table's non-blocking refresh indicator.\n */\n isFetching?: boolean;\n /**\n * Controlled query state for direct remote data sources. The component never\n * fetches data itself; it only emits state changes to the caller.\n */\n query?: MatrxDataTableQueryControl<T>;\n /**\n * Persist local query and record-view state in namespaced URL parameters.\n * This is intentionally opt-in and cannot be combined with controlled query\n * mode; remote tables use `useTableUrlState({ tableId })` in their query owner.\n */\n urlState?: MatrxDataTableUrlStateConfig;\n\n toolbar?: MatrxDataTableToolbar;\n /** Hide the package toolbar while retaining table-owned query behavior. */\n hideToolbar?: boolean;\n /** Hide numbered pagination; local rows remain available to the caller. */\n hidePagination?: boolean;\n /** Optional deferred Apply/Cancel copy for column filter popovers. */\n filterUi?: MatrxDataTableFilterUi;\n /** Row click opens the side panel unless `window.openOnRowClick` is true. */\n detail?: MatrxDataTableDetailConfig<T>;\n /** Panel icon opens a WindowPanel (page-local; supports ReactNode override). */\n window?: MatrxDataTableWindowConfig<T>;\n /** Copy + Copy for AI (rows + this view). */\n copy?: MatrxDataTableCopyConfig<T>;\n /** Inline edit session with floating Save/Cancel pill. */\n edit?: MatrxDataTableEditConfig<T>;\n /** Opt-in tree reparenting owned by the canonical row renderer. */\n hierarchy?: MatrxDataTableHierarchyConfig<T>;\n\n /** Controlled selection (selected row id for highlight). */\n selectedId?: string | null | undefined;\n onSelectedIdChange?: ((id: string | null) => void) | undefined;\n\n /** Controlled table-owned window row (normally supplied by URL state). */\n windowRowId?: string | null | undefined;\n onWindowRowIdChange?: ((id: string | null) => void) | undefined;\n\n /** Opt-in multi-row checkbox selection + a bulk action bar. */\n selection?: MatrxDataTableSelectionConfig<T>;\n\n /** Extra row actions rendered in a trailing Actions column. */\n rowActions?: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;\n /** Extra rows rendered in the table footer with the same columns as data rows. */\n footerRows?: T[];\n /** Per-row presentation class, after canonical selection/highlight state. */\n rowClassName?: (row: T, index: number) => string | undefined;\n /** Highlight an index in the currently rendered page without selecting it. */\n highlightedIndex?: number | undefined;\n /** Receives the complete visible local view after local processing, before paging. Attaching after absence receives one snapshot; callback identity changes alone do not notify. */\n onViewChange?: (rows: T[]) => void;\n /**\n * Wrap the whole `<tr>`. Return `children` unchanged for no-op.\n *\n * `rowActions` only reaches the actions CELL, so anything that must own the\n * entire row — a right-click menu, a drag handle, a drop target — had no\n * seam and would have forced a surface to fork the table. THE INVENTORY LAW:\n * the fork is the defect, so the seam exists instead.\n *\n * Whatever you return must render `children` as a direct `<tbody>` child, so\n * the wrapper has to be a component that emits the `<tr>` unchanged\n * (`ItemContextMenu` does — it renders a Radix trigger with `asChild`).\n */\n rowWrapper?: (row: T, children: ReactNode) => ReactNode;\n\n emptyState?: MatrxDataTableEmptyState;\n /** Default 25. Pass 0 to show all. */\n pageSize?: number;\n pageSizeOptions?: number[];\n zebra?: boolean;\n className?: string;\n tableClassName?: string;\n /**\n * Optional compact row presentation rendered below `mobileCardsBreakpoint`\n * in place of the horizontal table. The caller supplies the record summary\n * because only the product surface knows which values and actions are\n * essential at narrow widths; MatrxDataTable still owns query state,\n * loading/empty states, and pagination.\n *\n * `controls.actions` carries the table-owned copy controls and consumer row\n * actions, so a card does not fork them. Prefer the default horizontal table\n * unless the product explicitly requires every essential value/action to be\n * discoverable without horizontal scrolling.\n */\n mobileCards?: (\n row: T,\n index: number,\n controls: MatrxDataTableMobileCardControls,\n ) => ReactNode;\n /** Card/table handoff. `sm` is phone-only; `lg` includes portrait tablets. */\n mobileCardsBreakpoint?: \"sm\" | \"lg\";\n /** Called after a row is selected for detail (in addition to opening the panel). */\n onRowOpen?: (row: T) => void;\n}\n\n/** Re-export for callers building custom agent payloads. */\nexport type { AgentPayloadInput };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
export { AgentPayloadInput } from './copy-types.cjs';
|
|
3
|
-
export { A as AnyOfColumnSearch, c as CellEditType, d as CellEditsMap, e as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, f as MatrxDataTableCopyConfig, g as MatrxDataTableDetailConfig, h as MatrxDataTableEditConfig, i as MatrxDataTableEmptyState, j as MatrxDataTableFilterUi, k as MatrxDataTableHierarchyConfig, l as MatrxDataTableHierarchyMove, m as MatrxDataTableMobileCardControls, b as MatrxDataTableProps, n as MatrxDataTableQueryControl, o as MatrxDataTableQueryState, p as MatrxDataTableRecordControls, q as MatrxDataTableSelectionConfig, r as MatrxDataTableSourceProcessing, s as MatrxDataTableToolbar, t as MatrxDataTableUrlStateConfig, u as MatrxDataTableWindowConfig, v as MatrxTablePagination, w as SortDirection, S as SortState, T as TableSearchMatchMode, x as TextFilterMode, y as ToolbarFacet } from '../types-
|
|
3
|
+
export { A as AnyOfColumnSearch, c as CellEditType, d as CellEditsMap, e as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, f as MatrxDataTableCopyConfig, g as MatrxDataTableDetailConfig, h as MatrxDataTableEditConfig, i as MatrxDataTableEmptyState, j as MatrxDataTableFilterUi, k as MatrxDataTableHierarchyConfig, l as MatrxDataTableHierarchyMove, m as MatrxDataTableMobileCardControls, b as MatrxDataTableProps, n as MatrxDataTableQueryControl, o as MatrxDataTableQueryState, p as MatrxDataTableRecordControls, q as MatrxDataTableSelectionConfig, r as MatrxDataTableSourceProcessing, s as MatrxDataTableToolbar, t as MatrxDataTableUrlStateConfig, u as MatrxDataTableWindowConfig, v as MatrxTablePagination, w as SortDirection, S as SortState, T as TableSearchMatchMode, x as TextFilterMode, y as ToolbarFacet } from '../types-4fmLG5AN.cjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'react';
|
|
2
2
|
export { AgentPayloadInput } from './copy-types.js';
|
|
3
|
-
export { A as AnyOfColumnSearch, c as CellEditType, d as CellEditsMap, e as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, f as MatrxDataTableCopyConfig, g as MatrxDataTableDetailConfig, h as MatrxDataTableEditConfig, i as MatrxDataTableEmptyState, j as MatrxDataTableFilterUi, k as MatrxDataTableHierarchyConfig, l as MatrxDataTableHierarchyMove, m as MatrxDataTableMobileCardControls, b as MatrxDataTableProps, n as MatrxDataTableQueryControl, o as MatrxDataTableQueryState, p as MatrxDataTableRecordControls, q as MatrxDataTableSelectionConfig, r as MatrxDataTableSourceProcessing, s as MatrxDataTableToolbar, t as MatrxDataTableUrlStateConfig, u as MatrxDataTableWindowConfig, v as MatrxTablePagination, w as SortDirection, S as SortState, T as TableSearchMatchMode, x as TextFilterMode, y as ToolbarFacet } from '../types-
|
|
3
|
+
export { A as AnyOfColumnSearch, c as CellEditType, d as CellEditsMap, e as ColumnFilterKind, a as ColumnFilterValue, C as ColumnFiltersState, M as MatrxColumnDef, f as MatrxDataTableCopyConfig, g as MatrxDataTableDetailConfig, h as MatrxDataTableEditConfig, i as MatrxDataTableEmptyState, j as MatrxDataTableFilterUi, k as MatrxDataTableHierarchyConfig, l as MatrxDataTableHierarchyMove, m as MatrxDataTableMobileCardControls, b as MatrxDataTableProps, n as MatrxDataTableQueryControl, o as MatrxDataTableQueryState, p as MatrxDataTableRecordControls, q as MatrxDataTableSelectionConfig, r as MatrxDataTableSourceProcessing, s as MatrxDataTableToolbar, t as MatrxDataTableUrlStateConfig, u as MatrxDataTableWindowConfig, v as MatrxTablePagination, w as SortDirection, S as SortState, T as TableSearchMatchMode, x as TextFilterMode, y as ToolbarFacet } from '../types-pZ95iFk5.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SortState, o as MatrxDataTableQueryState } from '../types-
|
|
1
|
+
import { S as SortState, o as MatrxDataTableQueryState } from '../types-4fmLG5AN.cjs';
|
|
2
2
|
import { UrlHistoryMode } from '@ai-matrx/kit/url-state';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './copy-types.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as SortState, o as MatrxDataTableQueryState } from '../types-
|
|
1
|
+
import { S as SortState, o as MatrxDataTableQueryState } from '../types-pZ95iFk5.js';
|
|
2
2
|
import { UrlHistoryMode } from '@ai-matrx/kit/url-state';
|
|
3
3
|
import 'react';
|
|
4
4
|
import './copy-types.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1650,51 +1650,28 @@ function ConfirmDialog({
|
|
|
1650
1650
|
|
|
1651
1651
|
// src/confirm-host.tsx
|
|
1652
1652
|
var import_confirm_opener = require("@ai-matrx/kit/confirm-opener");
|
|
1653
|
+
var import_opener_react = require("@ai-matrx/kit/opener-react");
|
|
1653
1654
|
var React14 = __toESM(require("react"), 1);
|
|
1654
1655
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1655
1656
|
function ConfirmDialogHost() {
|
|
1656
|
-
const
|
|
1657
|
-
const
|
|
1658
|
-
const queueRef = React14.useRef([]);
|
|
1659
|
-
React14.useEffect(() => {
|
|
1660
|
-
const controller = {
|
|
1661
|
-
show: (opts, resolve) => {
|
|
1662
|
-
queueRef.current.push({ opts, resolve });
|
|
1663
|
-
setTick((n) => n + 1);
|
|
1664
|
-
}
|
|
1665
|
-
};
|
|
1666
|
-
(0, import_confirm_opener._registerHost)(controller);
|
|
1667
|
-
return () => (0, import_confirm_opener._unregisterHost)(controller);
|
|
1668
|
-
}, []);
|
|
1669
|
-
React14.useEffect(() => {
|
|
1670
|
-
if (active === null && queueRef.current.length > 0) {
|
|
1671
|
-
setActive(queueRef.current.shift());
|
|
1672
|
-
}
|
|
1673
|
-
}, [active, tick]);
|
|
1674
|
-
const handleConfirm = React14.useCallback(() => {
|
|
1675
|
-
if (!active) return;
|
|
1676
|
-
active.resolve(true);
|
|
1677
|
-
setActive(null);
|
|
1678
|
-
}, [active]);
|
|
1657
|
+
const { request, open, settle } = (0, import_opener_react.useOpenerHost)(import_confirm_opener.confirmOpener);
|
|
1658
|
+
const handleConfirm = React14.useCallback(() => settle(true), [settle]);
|
|
1679
1659
|
const handleOpenChange = React14.useCallback(
|
|
1680
|
-
(
|
|
1681
|
-
if (!
|
|
1682
|
-
active.resolve(false);
|
|
1683
|
-
setActive(null);
|
|
1684
|
-
}
|
|
1660
|
+
(next) => {
|
|
1661
|
+
if (!next) settle(false);
|
|
1685
1662
|
},
|
|
1686
|
-
[
|
|
1663
|
+
[settle]
|
|
1687
1664
|
);
|
|
1688
1665
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1689
1666
|
ConfirmDialog,
|
|
1690
1667
|
{
|
|
1691
|
-
open
|
|
1668
|
+
open,
|
|
1692
1669
|
onOpenChange: handleOpenChange,
|
|
1693
|
-
title:
|
|
1694
|
-
description:
|
|
1695
|
-
confirmLabel:
|
|
1696
|
-
cancelLabel:
|
|
1697
|
-
variant:
|
|
1670
|
+
title: request?.title ?? "",
|
|
1671
|
+
description: request?.description,
|
|
1672
|
+
confirmLabel: request?.confirmLabel,
|
|
1673
|
+
cancelLabel: request?.cancelLabel,
|
|
1674
|
+
variant: request?.variant,
|
|
1698
1675
|
onConfirm: handleConfirm
|
|
1699
1676
|
}
|
|
1700
1677
|
);
|