@ai-matrx/records-ui 0.116.45 → 0.116.47
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 +29 -1
- package/dist/{SaveToTable-SL5DUNI4.js → SaveToTable-HG3HQMAQ.js} +5 -5
- package/dist/{chunk-KQR2RA4V.js → chunk-ABIUJCNS.js} +3 -3
- package/dist/chunk-ABIUJCNS.js.map +1 -0
- package/dist/{chunk-F4SAKQKQ.js → chunk-K3B5IRXY.js} +79 -76
- package/dist/chunk-K3B5IRXY.js.map +1 -0
- package/dist/{chunk-OV6QBL5R.js → chunk-LBZZDHV6.js} +8 -8
- package/dist/chunk-LBZZDHV6.js.map +1 -0
- package/dist/{chunk-NKZBAIU4.js → chunk-MDXDJVDB.js} +8 -6
- package/dist/chunk-MDXDJVDB.js.map +1 -0
- package/dist/{chunk-XKI6S5KF.js → chunk-VJDJQDDI.js} +7 -7
- package/dist/{chunk-XKI6S5KF.js.map → chunk-VJDJQDDI.js.map} +1 -1
- package/dist/helpers.cjs +14 -12
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +14 -12
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +137 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +46 -30
- package/dist/index.js.map +1 -1
- package/dist/object-actions.cjs +8 -8
- package/dist/object-actions.cjs.map +1 -1
- package/dist/object-actions.d.cts +1 -1
- package/dist/object-actions.d.ts +1 -1
- package/dist/object-actions.js +2 -2
- package/dist/{objectActions-Be9sBGvW.d.cts → objectActions-DK-qa5zC.d.cts} +1 -1
- package/dist/{objectActions-Be9sBGvW.d.ts → objectActions-DK-qa5zC.d.ts} +1 -1
- package/dist/pickers.cjs +90 -86
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +3 -3
- package/package.json +5 -5
- package/dist/chunk-F4SAKQKQ.js.map +0 -1
- package/dist/chunk-KQR2RA4V.js.map +0 -1
- package/dist/chunk-NKZBAIU4.js.map +0 -1
- package/dist/chunk-OV6QBL5R.js.map +0 -1
- /package/dist/{SaveToTable-SL5DUNI4.js.map → SaveToTable-HG3HQMAQ.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -29,11 +29,39 @@
|
|
|
29
29
|
- Tests: `vitest.setup.ts` gives jsdom a no-op `performance.mark` / `measure`.
|
|
30
30
|
- **New subpath `@ai-matrx/records-ui/data-source`:** `recordsDataSource`, `personActor` and the who-changed words (`whenWords`, `actorWords`, `actorBadge`, `lastChangeSentence`, `SOMEBODY`, `THE_SYSTEM`) alone. `/helpers` also carries the field-type words, the colour resolver and the table builders, which read `@ai-matrx/records/core`; this entry reaches `@ai-matrx/kit` only, and shares the one data-source cache with `/helpers` and the root. Additive. Consumer action: a shell-reachable service that only binds its supabase client or says when imports from `/data-source`.
|
|
31
31
|
|
|
32
|
-
## 0.116.
|
|
32
|
+
## 0.116.47
|
|
33
33
|
|
|
34
34
|
UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
|
|
35
35
|
Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
|
|
36
36
|
|
|
37
|
+
## 0.116.46
|
|
38
|
+
|
|
39
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
40
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
41
|
+
Diff: `git diff 6903c71965 be963e798f -- apps/shared/records-ui/src`
|
|
42
|
+
|
|
43
|
+
Changed shipped source files (6):
|
|
44
|
+
- `apps/shared/records-ui/src/Grid.tsx`
|
|
45
|
+
- `apps/shared/records-ui/src/TablePage.tsx`
|
|
46
|
+
- `apps/shared/records-ui/src/formattedValue.tsx`
|
|
47
|
+
- `apps/shared/records-ui/src/gridBulk.tsx`
|
|
48
|
+
- `apps/shared/records-ui/src/gridMenus.ts`
|
|
49
|
+
- `apps/shared/records-ui/src/plainWords.ts`
|
|
50
|
+
|
|
51
|
+
## 0.116.45
|
|
52
|
+
|
|
53
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
54
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
55
|
+
Diff: `git diff 3b2b1c9db5 6903c71965 -- apps/shared/records-ui/src`
|
|
56
|
+
|
|
57
|
+
Changed shipped source files (6):
|
|
58
|
+
- `apps/shared/records-ui/src/ExportMenu.tsx`
|
|
59
|
+
- `apps/shared/records-ui/src/Refusal.tsx`
|
|
60
|
+
- `apps/shared/records-ui/src/TableDuplicate.tsx`
|
|
61
|
+
- `apps/shared/records-ui/src/TableSettings.tsx`
|
|
62
|
+
- `apps/shared/records-ui/src/WhereItLives.tsx`
|
|
63
|
+
- `apps/shared/records-ui/src/refusalSaid.ts`
|
|
64
|
+
|
|
37
65
|
## 0.116.44
|
|
38
66
|
|
|
39
67
|
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
@@ -4,11 +4,11 @@ import {
|
|
|
4
4
|
SAVE_TO_TABLE_TYPES,
|
|
5
5
|
SaveToTable,
|
|
6
6
|
shapesOfSource
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-VJDJQDDI.js";
|
|
8
|
+
import "./chunk-ABIUJCNS.js";
|
|
9
|
+
import "./chunk-MDXDJVDB.js";
|
|
10
10
|
import "./chunk-6Z537SLG.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-LBZZDHV6.js";
|
|
12
12
|
import "./chunk-4ZS4WEEE.js";
|
|
13
13
|
import "./chunk-WCQSJPLS.js";
|
|
14
14
|
import "./chunk-HKYEHBQT.js";
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
SaveToTable,
|
|
18
18
|
shapesOfSource
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=SaveToTable-
|
|
20
|
+
//# sourceMappingURL=SaveToTable-HG3HQMAQ.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
LEVEL_WORD,
|
|
4
4
|
levelNeededFor
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LBZZDHV6.js";
|
|
6
6
|
import {
|
|
7
7
|
ADD_FIELD_OPEN_LABEL
|
|
8
8
|
} from "./chunk-WCQSJPLS.js";
|
|
@@ -49,7 +49,7 @@ function rightsReason(rights, what, table) {
|
|
|
49
49
|
if (what === "structure" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;
|
|
50
50
|
if (rights[what]) return null;
|
|
51
51
|
if (rights.level === null) return ACTION_NO_ACCESS_REASON;
|
|
52
|
-
return `Needs ${LEVEL_WORD[levelNeededFor(what)]}
|
|
52
|
+
return `Needs ${LEVEL_WORD[levelNeededFor(what)]}`;
|
|
53
53
|
}
|
|
54
54
|
var BUILT_ON = [
|
|
55
55
|
{ destination: "forms", label: "Forms", icon: "file-text", rank: 2 },
|
|
@@ -245,4 +245,4 @@ export {
|
|
|
245
245
|
STRIP_FEATURE_ROWS,
|
|
246
246
|
toStripAndRows
|
|
247
247
|
};
|
|
248
|
-
//# sourceMappingURL=chunk-
|
|
248
|
+
//# sourceMappingURL=chunk-ABIUJCNS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/objectActions.ts"],"sourcesContent":["// src/objectActions.ts — @ai-matrx/records-ui\n//\n// THE ONE ACTION LIST FOR A RECORD-STORE TABLE (lane TABLE-ACTIONS, v6 lane 1).\n//\n// Every menu a person meets on a table — the header ⋯, a row ⋯ on the Data\n// home, right-click, a card, the phone sheet, later ⌘K — is drawn from the\n// array `tableActions()` returns. Before this there were three hand-made lists\n// (`TABLE_MENU` in TablePage, `dataHomeRowActions` in matrx-frontend, the\n// Sheet's own v3 sections) and they drifted: no Archive, no Copy link, no\n// Duplicate, Rename and Share only as hand JSX beside the list.\n//\n// THE SHAPE IS COPIED, NOT INVENTED. It is the in-house registry pattern of\n// `features/agents/browse/agentActionRegistry.tsx` and `conversationActionRegistry.tsx`\n// in matrx-frontend: a context of HOST HANDLERS in, one ordered list out, every\n// renderer reading the same list. The one difference is deliberate: those two\n// build matrx-frontend's `ItemMenuConfig` directly, which this package cannot\n// import, so the list here is renderer-neutral (`ObjectAction[]`) and each\n// renderer has a pure adapter (`toDropdownEntries` / `toStripAndRows` here;\n// `toItemMenuConfig` and `toExtraSections` in matrx-frontend\n// `features/unified-data/actions/`).\n//\n// TWO INVARIANTS, each with a guard (`one-table-action-list-*.test.tsx`,\n// `rights-never-change-the-table-menus-shape.test.tsx`):\n// G1 — every renderer draws the same ids — none hidden, none added, disabled ones\n// drawn disabled with their reason — for every seat and with handlers missing.\n// G2 — rights change only `disabledReason`, never which ids appear, their order,\n// their verb or their rank (Airtable hides items from members; we beat it).\n// A missing host handler is the same: the action stays, disabled, with its reason.\n//\n// THE ORDER (handoff §4, the same everywhere):\n// Open · Open in new tab · Copy link | Rename · Duplicate · Move to… · Favorite |\n// Share… · Export… · Import… | Add column · Settings · History · Make … the default |\n// Built on it ▸ (Forms, Bookings, Checklists, Notifications, Portals, Inbox,\n// Dashboards, Archived records) | Archive table (last, destructive).\n// \"Add column\" and \"Make … the default\" are the header ⋯'s own entries before the\n// registry (TABLE_MENU and the designate item); they sit with Settings.\n//\n// VERB AND RANK — for the icon-strip menu. An action with a `verb` is one of the\n// platform's standard verbs (a strip icon); every other action has a `rank`, its\n// place among the feature rows. Neither changes the list's order: `toStripAndRows`\n// is a renderer that splits the same list, and G1 holds it to the same ids.\n//\n// No JSX here: this file is the `./object-actions` subpath, light enough for a\n// list row's menu to import without pulling every screen of the package.\n\nimport type { Table } from \"@ai-matrx/records\";\nimport { formatTapShortcut } from \"@ai-matrx/design-system/tap-target\";\nimport { ADD_FIELD_OPEN_LABEL } from \"./fieldTypes\";\nimport { LEVEL_WORD, levelNeededFor, type Capability, type WhatYouMayDo } from \"./rights\";\n\n/**\n * A Lucide icon NAME, kebab-case — the same currency `Table.icon` already uses.\n * Closed on purpose: each renderer maps every member to its own glyph, and a\n * new member fails that renderer's typecheck until it is mapped.\n */\nexport type ObjectActionIcon =\n | \"folder-open\"\n | \"external-link\"\n | \"link\"\n | \"pencil\"\n | \"copy\"\n | \"folder-input\"\n | \"star\"\n | \"star-off\"\n | \"share-2\"\n | \"download\"\n | \"upload\"\n | \"columns-3\"\n | \"settings\"\n | \"history\"\n | \"blocks\"\n | \"file-text\"\n | \"calendar-clock\"\n | \"list-checks\"\n | \"bell\"\n | \"door-open\"\n | \"inbox\"\n | \"layout-dashboard\"\n | \"archive-restore\"\n | \"archive\"\n | \"link-2\"\n | \"layout-grid\"\n | \"git-merge\"\n | \"split\"\n | \"arrow-up-from-line\"\n | \"lock\"\n | \"lock-open\"\n | \"eraser\"\n | \"printer\";\n\n/** The groups, in their one order. Separators fall out of group boundaries. */\nexport type ObjectActionGroup = \"open\" | \"organize\" | \"share\" | \"manage\" | \"built-on\" | \"danger\";\n\n/**\n * THE STANDARD VERBS every object's menu shares — what the icon strip draws. One\n * per meaning; an object maps its action onto the verb, never a second \"share\".\n */\nexport type StandardVerbId =\n | \"open\"\n | \"open-new-tab\"\n | \"copy-link\"\n | \"rename\"\n | \"duplicate\"\n | \"move\"\n | \"favorite\"\n | \"share\"\n | \"export\"\n | \"import\"\n | \"settings\"\n | \"history\"\n | \"archive\";\n\nexport const STANDARD_VERBS: readonly StandardVerbId[] = [\n \"open\",\n \"open-new-tab\",\n \"copy-link\",\n \"rename\",\n \"duplicate\",\n \"move\",\n \"favorite\",\n \"share\",\n \"export\",\n \"import\",\n \"settings\",\n \"history\",\n \"archive\",\n];\n\nexport interface ObjectActionGroupDef {\n id: ObjectActionGroup;\n /** Present only on a group that renders as a submenu. */\n label?: string;\n icon?: ObjectActionIcon;\n /** Rendered as ONE submenu entry holding the group's actions. */\n submenu: boolean;\n}\n\nexport const OBJECT_ACTION_GROUPS: readonly ObjectActionGroupDef[] = [\n { id: \"open\", submenu: false },\n { id: \"organize\", submenu: false },\n { id: \"share\", submenu: false },\n { id: \"manage\", submenu: false },\n { id: \"built-on\", label: \"Built on it\", icon: \"blocks\", submenu: true },\n { id: \"danger\", submenu: false },\n];\n\nconst GROUP_IDS = new Set<string>(OBJECT_ACTION_GROUPS.map((g) => g.id));\n\n/** One thing a person can do to an object, for any renderer. */\nexport interface ObjectAction {\n /** Stable within the object's list. React key, test handle, future ⌘K id. */\n id: string;\n label: string;\n icon: ObjectActionIcon;\n group: ObjectActionGroup;\n /** The standard verb this action IS (a strip icon). Absent = a feature row. */\n verb?: StandardVerbId;\n /** A feature row's place among the rows, 1 first. Ignored when `verb` is set. */\n rank?: number;\n /** Display-only hint (\"⌘D\"). */\n shortcut?: string;\n destructive?: boolean;\n /** Present = shown disabled with this line (≤ 60 chars). Absent = enabled. */\n disabledReason?: string;\n /** Called only when enabled. The host owns the side effect and its feedback. */\n run: () => void | Promise<void>;\n}\n\n/** What the list needs to know about the table. A full `Table` satisfies it. */\nexport type TableActionSubject = Pick<Table, \"id\" | \"name\"> & Partial<Pick<Table, \"is_kernel\">>;\n\n/** The places built on a table, in their one order. */\nexport type BuiltOnDestination =\n | \"forms\"\n | \"bookings\"\n | \"checklists\"\n | \"notifications\"\n | \"portals\"\n | \"inbox\"\n | \"dashboards\"\n | \"archived\";\n\ntype Handler = (table: TableActionSubject) => void | Promise<void>;\n\n/**\n * THE SIDE EFFECTS THIS PACKAGE CANNOT OWN. Every handler is optional: one the\n * host leaves out keeps its action in the list, disabled, saying so.\n */\nexport interface TableActionHost {\n /** Origin for Copy link and Open in new tab. Default `https://www.aimatrx.com`. */\n origin?: string;\n open?: Handler;\n /** Receives the table's link (`<origin>/data/<id>`). */\n openInNewTab?: (url: string, table: TableActionSubject) => void;\n /** Receives the table's link. Runs inside the click (clipboard needs the gesture). */\n copyText?: (text: string, table: TableActionSubject) => void | Promise<void>;\n rename?: Handler;\n duplicate?: Handler;\n move?: Handler;\n /** Current favorite state; flips the Favorite label. Unknown = \"Add to favorites\". */\n isFavorite?: boolean;\n toggleFavorite?: Handler;\n share?: Handler;\n export?: Handler;\n import?: Handler;\n addColumn?: Handler;\n settings?: Handler;\n history?: Handler;\n /** Make the layout on screen the table's default. Leave out when it already is. */\n makeDefault?: Handler;\n /** The layout on screen, for \"Make Kanban the default\". */\n layoutLabel?: string;\n /** The \"Built on it\" destinations, one handler for all eight. */\n openBuiltOn?: (destination: BuiltOnDestination, table: TableActionSubject) => void;\n archive?: Handler;\n /**\n * Why an action whose handler is left out is unavailable here, by action id\n * (≤ 60 chars) — e.g. `make-default: \"Already the default\"`. Unnamed ids say\n * \"Not available here\". Never used when rights already refuse.\n */\n unavailableReasons?: Readonly<Record<string, string>>;\n /**\n * ANOTHER LANE'S ENTRIES (\"Link a record…\", a hub tile's verbs, a feature's own\n * row such as \"When a row changes, run an agent…\"). Return the same ids whatever\n * `rights` say — express rights as `disabledReason`. Each entry lands at the END\n * of its named group, in the order returned. Refused, loudly: the `danger` group\n * (Archive is always last), a group that does not exist, and an id already in\n * the list.\n */\n extend?: (table: TableActionSubject, rights: WhatYouMayDo) => readonly ObjectAction[];\n}\n\nexport interface TableActionsInput {\n table: TableActionSubject;\n rights: WhatYouMayDo;\n host: TableActionHost;\n}\n\nexport const DEFAULT_ACTION_ORIGIN = \"https://www.aimatrx.com\";\n\n/** The one link to a table: `<origin>/data/<tableId>`. */\nexport function tableLink(tableId: string, origin: string = DEFAULT_ACTION_ORIGIN): string {\n return `${origin.replace(/\\/+$/, \"\")}/data/${encodeURIComponent(tableId)}`;\n}\n\n/** The designate entry's words, matching `makeDefaultLabel` in views.ts. */\nfunction makeDefaultWords(layoutLabel: string | undefined): string {\n return layoutLabel ? `Make ${layoutLabel} the default` : \"Make this the default\";\n}\n\n// Reasons — one line, ≤ 60 characters, said on the action itself.\nexport const ACTION_NOT_HERE_REASON = \"Not available here\";\nexport const ACTION_CHECKING_ACCESS_REASON = \"Checking your access…\";\nexport const ACTION_NO_ACCESS_REASON = \"You don't have access\";\nexport const ACTION_PLATFORM_TABLE_REASON = \"Platform tables can't be changed here\";\n\n/** Why `rights` refuse `what`, in one short line — or null when they allow it. */\nexport function rightsReason(\n rights: WhatYouMayDo,\n what: Capability,\n table?: TableActionSubject,\n): string | null {\n if (!rights.known) return ACTION_CHECKING_ACCESS_REASON;\n if (what === \"structure\" && table?.is_kernel) return ACTION_PLATFORM_TABLE_REASON;\n if (rights[what]) return null;\n if (rights.level === null) return ACTION_NO_ACCESS_REASON;\n return `Needs ${LEVEL_WORD[levelNeededFor(what)]}`;\n}\n\n// Feature rows' ranks: what the strip menu shows as its first rows. Lower is first.\nconst BUILT_ON: ReadonlyArray<{ destination: BuiltOnDestination; label: string; icon: ObjectActionIcon; rank: number }> = [\n { destination: \"forms\", label: \"Forms\", icon: \"file-text\", rank: 2 },\n { destination: \"bookings\", label: \"Bookings\", icon: \"calendar-clock\", rank: 6 },\n { destination: \"checklists\", label: \"Checklists\", icon: \"list-checks\", rank: 7 },\n { destination: \"notifications\", label: \"Notifications\", icon: \"bell\", rank: 8 },\n { destination: \"portals\", label: \"Portals\", icon: \"door-open\", rank: 9 },\n { destination: \"inbox\", label: \"Inbox\", icon: \"inbox\", rank: 10 },\n { destination: \"dashboards\", label: \"Dashboards\", icon: \"layout-dashboard\", rank: 3 },\n { destination: \"archived\", label: \"Archived records\", icon: \"archive-restore\", rank: 5 },\n];\n\nconst NOOP = () => {};\n\n/**\n * THE TABLE'S KEYBOARD CHORDS (lane TABLE-ACTIONS wave 4, item 17): ⌥⇧ + one key, the same on\n * every surface that runs the list. Chosen because nothing else owns them: ⌘D is the browser's\n * bookmark, ⌘S save, ⌘P print, ⌘K the command bar, ⌘⇧K the menu's palette, ⌘Z undo — and the\n * app binds no ⌥⇧ chord. A chord is never taken while the person types in a field\n * (`objectActionForKey`). `code` is the KeyboardEvent.code, so ⌥ on a Mac (which changes\n * `key` to a symbol) still matches.\n */\nexport const TABLE_ACTION_CHORDS: Readonly<Record<string, { code: string; chord: string }>> = {\n \"copy-link\": { code: \"KeyL\", chord: \"alt+shift+l\" },\n rename: { code: \"KeyR\", chord: \"alt+shift+r\" },\n duplicate: { code: \"KeyD\", chord: \"alt+shift+d\" },\n move: { code: \"KeyM\", chord: \"alt+shift+m\" },\n favorite: { code: \"KeyF\", chord: \"alt+shift+f\" },\n share: { code: \"KeyS\", chord: \"alt+shift+s\" },\n export: { code: \"KeyE\", chord: \"alt+shift+e\" },\n import: { code: \"KeyI\", chord: \"alt+shift+i\" },\n settings: { code: \"Comma\", chord: \"alt+shift+,\" },\n history: { code: \"KeyH\", chord: \"alt+shift+h\" },\n archive: { code: \"Backspace\", chord: \"alt+shift+backspace\" },\n};\n\n/**\n * The chords with their LABEL in this platform's words — \"⌥⇧S\" on a Mac, \"Alt+Shift+S\" on Windows\n * and Linux — through the design system's one shortcut formatter (`formatTapShortcut`, the tap\n * button's tooltip), so a menu entry and the ⌘K bar read alike everywhere.\n */\nexport const TABLE_ACTION_KEYS: Readonly<Record<string, { code: string; label: string }>> = Object.fromEntries(\n Object.entries(TABLE_ACTION_CHORDS).map(([id, { code, chord }]) => [id, { code, label: formatTapShortcut(chord) }]),\n);\n\n/** The fields of a keyboard event a chord reads (a DOM KeyboardEvent satisfies it). */\nexport interface ChordEvent {\n code: string;\n altKey: boolean;\n shiftKey: boolean;\n metaKey: boolean;\n ctrlKey: boolean;\n target?: EventTarget | null;\n}\n\nfunction typingIn(target: EventTarget | null | undefined): boolean {\n const el = target as { tagName?: string; isContentEditable?: boolean } | null | undefined;\n if (!el || typeof el.tagName !== \"string\") return false;\n return el.isContentEditable === true || /^(INPUT|TEXTAREA|SELECT)$/.test(el.tagName);\n}\n\n/**\n * The action a key press asks for, or null: ⌥⇧ + its key, no ⌘/Ctrl, never inside a field. A\n * disabled action is still RETURNED (the caller says its reason instead of doing nothing).\n */\nexport function objectActionForKey(actions: readonly ObjectAction[], event: ChordEvent): ObjectAction | null {\n if (!event.altKey || !event.shiftKey || event.metaKey || event.ctrlKey) return null;\n if (typingIn(event.target)) return null;\n const id = Object.keys(TABLE_ACTION_KEYS).find((k) => TABLE_ACTION_KEYS[k]!.code === event.code);\n return id ? (actions.find((a) => a.id === id) ?? null) : null;\n}\n\n/**\n * One action, from its needs: the capability it asks for and the host handler\n * that performs it. Rights speak first; a missing handler second.\n */\nfunction action(\n base: Omit<ObjectAction, \"run\" | \"disabledReason\">,\n needs: Capability,\n input: TableActionsInput,\n perform: (() => void | Promise<void>) | undefined,\n): ObjectAction {\n const chord = TABLE_ACTION_KEYS[base.id];\n if (chord && base.shortcut === undefined) base = { ...base, shortcut: chord.label };\n const refused = rightsReason(input.rights, needs, input.table);\n if (refused !== null) return { ...base, disabledReason: refused, run: NOOP };\n if (perform === undefined) {\n return { ...base, disabledReason: input.host.unavailableReasons?.[base.id] ?? ACTION_NOT_HERE_REASON, run: NOOP };\n }\n return { ...base, run: perform };\n}\n\nfunction bind(handler: Handler | undefined, table: TableActionSubject): (() => void | Promise<void>) | undefined {\n return handler ? () => handler(table) : undefined;\n}\n\n/**\n * THE TABLE'S ACTIONS, in the one order. Same ids, same order, same verbs and\n * ranks, for every seat and every host — only `disabledReason` varies.\n */\nexport function tableActions(input: TableActionsInput): ObjectAction[] {\n const { table, host } = input;\n const url = tableLink(table.id, host.origin);\n const favorite = host.isFavorite === true;\n const openInNewTab = host.openInNewTab;\n const copyText = host.copyText;\n const openBuiltOn = host.openBuiltOn;\n\n const built: ObjectAction[] = [\n action({ id: \"open\", label: \"Open\", icon: \"folder-open\", group: \"open\", verb: \"open\" }, \"read\", input, bind(host.open, table)),\n action(\n { id: \"open-new-tab\", label: \"Open in new tab\", icon: \"external-link\", group: \"open\", verb: \"open-new-tab\" },\n \"read\",\n input,\n openInNewTab ? () => openInNewTab(url, table) : undefined,\n ),\n action(\n { id: \"copy-link\", label: \"Copy link\", icon: \"link\", group: \"open\", verb: \"copy-link\" },\n \"read\",\n input,\n copyText ? () => copyText(url, table) : undefined,\n ),\n action({ id: \"rename\", label: \"Rename…\", icon: \"pencil\", group: \"organize\", verb: \"rename\" }, \"structure\", input, bind(host.rename, table)),\n action({ id: \"duplicate\", label: \"Duplicate\", icon: \"copy\", group: \"organize\", verb: \"duplicate\" }, \"read\", input, bind(host.duplicate, table)),\n action({ id: \"move\", label: \"Move to…\", icon: \"folder-input\", group: \"organize\", verb: \"move\" }, \"structure\", input, bind(host.move, table)),\n action(\n {\n id: \"favorite\",\n label: favorite ? \"Remove from favorites\" : \"Add to favorites\",\n icon: favorite ? \"star-off\" : \"star\",\n group: \"organize\",\n verb: \"favorite\",\n },\n \"read\",\n input,\n bind(host.toggleFavorite, table),\n ),\n action({ id: \"share\", label: \"Share…\", icon: \"share-2\", group: \"share\", verb: \"share\" }, \"share\", input, bind(host.share, table)),\n action({ id: \"export\", label: \"Export…\", icon: \"download\", group: \"share\", verb: \"export\" }, \"read\", input, bind(host.export, table)),\n action({ id: \"import\", label: \"Import…\", icon: \"upload\", group: \"share\", verb: \"import\" }, \"structure\", input, bind(host.import, table)),\n action({ id: \"add-column\", label: ADD_FIELD_OPEN_LABEL, icon: \"columns-3\", group: \"manage\", rank: 1 }, \"structure\", input, bind(host.addColumn, table)),\n action({ id: \"settings\", label: \"Settings\", icon: \"settings\", group: \"manage\", verb: \"settings\" }, \"structure\", input, bind(host.settings, table)),\n action({ id: \"history\", label: \"History\", icon: \"history\", group: \"manage\", verb: \"history\" }, \"read\", input, bind(host.history, table)),\n // custom.view_designate asks editor on the table — `canDesignate` in TablePage.\n action(\n { id: \"make-default\", label: makeDefaultWords(host.layoutLabel), icon: \"layout-grid\", group: \"manage\", rank: 4 },\n \"organise\",\n input,\n bind(host.makeDefault, table),\n ),\n ...BUILT_ON.map(({ destination, label, icon, rank }) =>\n action(\n { id: `built-on.${destination}`, label, icon, group: \"built-on\", rank },\n \"read\",\n input,\n openBuiltOn ? () => openBuiltOn(destination, table) : undefined,\n ),\n ),\n action(\n { id: \"archive\", label: \"Archive table\", icon: \"archive\", group: \"danger\", destructive: true, verb: \"archive\" },\n \"structure\",\n input,\n bind(host.archive, table),\n ),\n ];\n\n return withExtensions(built, host.extend ? host.extend(table, input.rights) : []);\n}\n\n/**\n * Another lane's entries, placed deterministically: each at the end of its\n * group, in the order given. Loud on every mistake that would break the\n * invariants — a `danger` entry (Archive must stay last), a group that does not\n * exist (it would be dropped by every renderer) and a duplicate id.\n */\nexport function withExtensions(base: readonly ObjectAction[], extra: readonly ObjectAction[]): ObjectAction[] {\n if (extra.length === 0) return [...base];\n const seen = new Set(base.map((a) => a.id));\n for (const entry of extra) {\n if (entry.group === \"danger\") {\n throw new Error(`Object action \"${entry.id}\": the danger group is closed to extensions.`);\n }\n if (!GROUP_IDS.has(entry.group)) {\n throw new Error(`Object action \"${entry.id}\": \"${String(entry.group)}\" is not a group.`);\n }\n if (seen.has(entry.id)) {\n throw new Error(`Object action \"${entry.id}\" is already in the list.`);\n }\n seen.add(entry.id);\n }\n const out: ObjectAction[] = [];\n for (const group of OBJECT_ACTION_GROUPS) {\n out.push(...base.filter((a) => a.group === group.id), ...extra.filter((a) => a.group === group.id));\n }\n return out;\n}\n\n/** A run of actions that renders together: a plain section, or one submenu. */\nexport interface ObjectActionSection {\n group: ObjectActionGroupDef;\n actions: ObjectAction[];\n}\n\n/**\n * THE ONE GROUPING every adapter uses: the list cut at group boundaries, in\n * group order, empty groups dropped, the order inside a group kept.\n */\nexport function groupObjectActions(actions: readonly ObjectAction[]): ObjectActionSection[] {\n const sections: ObjectActionSection[] = [];\n for (const group of OBJECT_ACTION_GROUPS) {\n const inGroup = actions.filter((a) => a.group === group.id);\n if (inGroup.length > 0) sections.push({ group, actions: inGroup });\n }\n return sections;\n}\n\n/** The header ⋯ dropdown's entries — records-ui's own renderer reads these. */\nexport type ObjectActionDropdownEntry =\n | { kind: \"separator\"; id: string }\n | { kind: \"item\"; action: ObjectAction }\n | { kind: \"submenu\"; id: string; label: string; icon: ObjectActionIcon | undefined; actions: ObjectAction[] };\n\nexport function toDropdownEntries(actions: readonly ObjectAction[]): ObjectActionDropdownEntry[] {\n const entries: ObjectActionDropdownEntry[] = [];\n groupObjectActions(actions).forEach(({ group, actions: inGroup }, index) => {\n if (index > 0) entries.push({ kind: \"separator\", id: `separator:${group.id}` });\n if (group.submenu) {\n entries.push({ kind: \"submenu\", id: group.id, label: group.label ?? group.id, icon: group.icon, actions: inGroup });\n } else {\n for (const a of inGroup) entries.push({ kind: \"item\", action: a });\n }\n });\n return entries;\n}\n\n/** The actions a dropdown draws, in order — what G1 compares. */\nexport function dropdownActions(entries: readonly ObjectActionDropdownEntry[]): ObjectAction[] {\n return entries.flatMap((e) => (e.kind === \"item\" ? [e.action] : e.kind === \"submenu\" ? e.actions : []));\n}\n\n/** The action ids a dropdown draws, in order. */\nexport function dropdownActionIds(entries: readonly ObjectActionDropdownEntry[]): string[] {\n return dropdownActions(entries).map((a) => a.id);\n}\n\n/** The icon-strip menu: standard verbs as icons, then the first feature rows, then the rest. */\nexport interface StripAndRows {\n /** Every action with a `verb`, in the list's order. */\n strip: ObjectAction[];\n /** The first `rowCount` feature actions by rank (ties keep list order). */\n rows: ObjectAction[];\n /** The remaining feature actions, behind \"More … options\", same ordering. */\n more: ObjectAction[];\n}\n\nexport const STRIP_FEATURE_ROWS = 4;\n\n/**\n * THE STRIP RENDERER'S SPLIT of the same list. Nothing is added or dropped: every\n * id lands in exactly one of strip / rows / more (G1). Unranked feature actions\n * (an extension that gave none) follow every ranked one.\n */\nexport function toStripAndRows(actions: readonly ObjectAction[], rowCount: number = STRIP_FEATURE_ROWS): StripAndRows {\n const strip = actions.filter((a) => a.verb !== undefined);\n const features = actions\n .map((a, index) => ({ a, index }))\n .filter(({ a }) => a.verb === undefined)\n .sort((x, y) => (x.a.rank ?? Infinity) - (y.a.rank ?? Infinity) || x.index - y.index)\n .map(({ a }) => a);\n return { strip, rows: features.slice(0, rowCount), more: features.slice(rowCount) };\n}\n"],"mappings":";;;;;;;;;;AA8CA,SAAS,yBAAyB;AAkE3B,IAAM,iBAA4C;AAAA,EACvD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWO,IAAM,uBAAwD;AAAA,EACnE,EAAE,IAAI,QAAQ,SAAS,MAAM;AAAA,EAC7B,EAAE,IAAI,YAAY,SAAS,MAAM;AAAA,EACjC,EAAE,IAAI,SAAS,SAAS,MAAM;AAAA,EAC9B,EAAE,IAAI,UAAU,SAAS,MAAM;AAAA,EAC/B,EAAE,IAAI,YAAY,OAAO,eAAe,MAAM,UAAU,SAAS,KAAK;AAAA,EACtE,EAAE,IAAI,UAAU,SAAS,MAAM;AACjC;AAEA,IAAM,YAAY,IAAI,IAAY,qBAAqB,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;AA4FhE,IAAM,wBAAwB;AAG9B,SAAS,UAAU,SAAiB,SAAiB,uBAA+B;AACzF,SAAO,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC,SAAS,mBAAmB,OAAO,CAAC;AAC1E;AAGA,SAAS,iBAAiB,aAAyC;AACjE,SAAO,cAAc,QAAQ,WAAW,iBAAiB;AAC3D;AAGO,IAAM,yBAAyB;AAC/B,IAAM,gCAAgC;AACtC,IAAM,0BAA0B;AAChC,IAAM,+BAA+B;AAGrC,SAAS,aACd,QACA,MACA,OACe;AACf,MAAI,CAAC,OAAO,MAAO,QAAO;AAC1B,MAAI,SAAS,eAAe,OAAO,UAAW,QAAO;AACrD,MAAI,OAAO,IAAI,EAAG,QAAO;AACzB,MAAI,OAAO,UAAU,KAAM,QAAO;AAClC,SAAO,SAAS,WAAW,eAAe,IAAI,CAAC,CAAC;AAClD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,EAAE,EAAE,QAAQ,aAAa,EAAE,EAAE,QAAQ,aAAa,EAAE,QAAQ,EAAE,KAAK,EACnF,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC;AACnB,SAAO,EAAE,OAAO,MAAM,SAAS,MAAM,GAAG,QAAQ,GAAG,MAAM,SAAS,MAAM,QAAQ,EAAE;AACpF;","names":[]}
|
|
@@ -54,7 +54,7 @@ import {
|
|
|
54
54
|
useRecordsUi,
|
|
55
55
|
useTableRights,
|
|
56
56
|
withoutInternalCodes
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-MDXDJVDB.js";
|
|
58
58
|
import {
|
|
59
59
|
kindItemWords,
|
|
60
60
|
kindLabel,
|
|
@@ -3587,12 +3587,62 @@ function WholeValueEditor({
|
|
|
3587
3587
|
import { formatPhone as formatPhone2 } from "@ai-matrx/design-system/field-formats";
|
|
3588
3588
|
|
|
3589
3589
|
// src/formattedValue.tsx
|
|
3590
|
-
import { useRef as
|
|
3590
|
+
import { useRef as useRef9 } from "react";
|
|
3591
3591
|
import { FormattedCell } from "@ai-matrx/design-system/data-table";
|
|
3592
3592
|
import { formatFieldValue as formatFieldValue2, formatPhone, getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
3593
3593
|
import { cn as cn10 } from "@ai-matrx/design-system";
|
|
3594
3594
|
import { OutboundLink as OutboundLink3 } from "@ai-matrx/kit/outbound-react";
|
|
3595
|
-
|
|
3595
|
+
|
|
3596
|
+
// src/LinkPreviewCard.tsx
|
|
3597
|
+
import { useEffect as useEffect10, useRef as useRef8, useState as useState15 } from "react";
|
|
3598
|
+
import { HoverCard, HoverCardContent, HoverCardTrigger, SiteIcon } from "@ai-matrx/design-system";
|
|
3599
|
+
import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3600
|
+
var answers = /* @__PURE__ */ new Map();
|
|
3601
|
+
function LinkPreviewCard({ url, children }) {
|
|
3602
|
+
const port = useRecordsUi().linkPreview;
|
|
3603
|
+
const [preview, setPreview] = useState15(void 0);
|
|
3604
|
+
const [open, setOpen] = useState15(false);
|
|
3605
|
+
const timer = useRef8(null);
|
|
3606
|
+
useEffect10(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
3607
|
+
if (!port) return /* @__PURE__ */ jsx19(Fragment9, { children });
|
|
3608
|
+
const ask = () => {
|
|
3609
|
+
if (preview !== void 0) return;
|
|
3610
|
+
let pending = answers.get(url);
|
|
3611
|
+
if (!pending) {
|
|
3612
|
+
pending = port.read(url).catch(() => null);
|
|
3613
|
+
answers.set(url, pending);
|
|
3614
|
+
}
|
|
3615
|
+
void pending.then((found) => setPreview(found));
|
|
3616
|
+
};
|
|
3617
|
+
const enter = () => {
|
|
3618
|
+
ask();
|
|
3619
|
+
if (timer.current) clearTimeout(timer.current);
|
|
3620
|
+
timer.current = setTimeout(() => setOpen(true), 350);
|
|
3621
|
+
};
|
|
3622
|
+
const leave = () => {
|
|
3623
|
+
if (timer.current) clearTimeout(timer.current);
|
|
3624
|
+
setOpen(false);
|
|
3625
|
+
};
|
|
3626
|
+
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
3627
|
+
return /* @__PURE__ */ jsxs16(HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
3628
|
+
/* @__PURE__ */ jsx19(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsx19("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
3629
|
+
shown2 ? /* @__PURE__ */ jsxs16(HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
3630
|
+
shown2.imageUrl ? (
|
|
3631
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
3632
|
+
/* @__PURE__ */ jsx19("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
3633
|
+
) : null,
|
|
3634
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1.5", children: [
|
|
3635
|
+
/* @__PURE__ */ jsx19(SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
3636
|
+
/* @__PURE__ */ jsx19("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
3637
|
+
] }),
|
|
3638
|
+
shown2.title ? /* @__PURE__ */ jsx19("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
3639
|
+
shown2.description ? /* @__PURE__ */ jsx19("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
3640
|
+
] }) : null
|
|
3641
|
+
] });
|
|
3642
|
+
}
|
|
3643
|
+
|
|
3644
|
+
// src/formattedValue.tsx
|
|
3645
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3596
3646
|
var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
|
|
3597
3647
|
var own2 = (event) => event.stopPropagation();
|
|
3598
3648
|
function numberOf3(value) {
|
|
@@ -3610,11 +3660,11 @@ function RatingStars({
|
|
|
3610
3660
|
label,
|
|
3611
3661
|
selectFirst
|
|
3612
3662
|
}) {
|
|
3613
|
-
const armed =
|
|
3663
|
+
const armed = useRef9(true);
|
|
3614
3664
|
const score = numberOf3(value) ?? 0;
|
|
3615
3665
|
const shown2 = Math.round(score);
|
|
3616
3666
|
const said2 = `${shown2} out of ${max}`;
|
|
3617
|
-
return /* @__PURE__ */
|
|
3667
|
+
return /* @__PURE__ */ jsx20(
|
|
3618
3668
|
"span",
|
|
3619
3669
|
{
|
|
3620
3670
|
"data-records-rating": "",
|
|
@@ -3626,8 +3676,8 @@ function RatingStars({
|
|
|
3626
3676
|
children: Array.from({ length: max }, (_, i) => {
|
|
3627
3677
|
const n = i + 1;
|
|
3628
3678
|
const lit = n <= shown2;
|
|
3629
|
-
const star = /* @__PURE__ */
|
|
3630
|
-
return onRate ? /* @__PURE__ */
|
|
3679
|
+
const star = /* @__PURE__ */ jsx20("span", { "aria-hidden": true, className: cn10("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
|
|
3680
|
+
return onRate ? /* @__PURE__ */ jsx20(
|
|
3631
3681
|
"button",
|
|
3632
3682
|
{
|
|
3633
3683
|
type: "button",
|
|
@@ -3652,7 +3702,7 @@ function RatingStars({
|
|
|
3652
3702
|
children: star
|
|
3653
3703
|
},
|
|
3654
3704
|
n
|
|
3655
|
-
) : /* @__PURE__ */
|
|
3705
|
+
) : /* @__PURE__ */ jsx20("span", { children: star }, n);
|
|
3656
3706
|
})
|
|
3657
3707
|
}
|
|
3658
3708
|
);
|
|
@@ -3660,20 +3710,20 @@ function RatingStars({
|
|
|
3660
3710
|
function rich(id, text, raw, format) {
|
|
3661
3711
|
switch (id) {
|
|
3662
3712
|
case "email":
|
|
3663
|
-
return /* @__PURE__ */
|
|
3713
|
+
return /* @__PURE__ */ jsx20("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx20("span", { className: "truncate", children: readableLink(text) }) });
|
|
3664
3714
|
case "url":
|
|
3665
|
-
return /* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ jsx20(LinkPreviewCard, { url: text.includes("://") ? text : `https://${text}`, children: /* @__PURE__ */ jsx20(OutboundLink3, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ jsx20("span", { className: "truncate", children: text }) }) });
|
|
3666
3716
|
case "phone":
|
|
3667
|
-
return /* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ jsx20("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ jsx20("span", { className: "truncate tabular-nums", children: formatPhone(text) }) });
|
|
3668
3718
|
case "address":
|
|
3669
|
-
return /* @__PURE__ */
|
|
3719
|
+
return /* @__PURE__ */ jsx20(
|
|
3670
3720
|
OutboundLink3,
|
|
3671
3721
|
{
|
|
3672
3722
|
href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
|
|
3673
3723
|
className: LINK,
|
|
3674
3724
|
title: "Open in maps",
|
|
3675
3725
|
onClick: own2,
|
|
3676
|
-
children: /* @__PURE__ */
|
|
3726
|
+
children: /* @__PURE__ */ jsx20("span", { className: "truncate", children: text })
|
|
3677
3727
|
}
|
|
3678
3728
|
);
|
|
3679
3729
|
case "progress": {
|
|
@@ -3681,8 +3731,8 @@ function rich(id, text, raw, format) {
|
|
|
3681
3731
|
if (n === null) return void 0;
|
|
3682
3732
|
const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
|
|
3683
3733
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
3684
|
-
return /* @__PURE__ */
|
|
3685
|
-
/* @__PURE__ */
|
|
3734
|
+
return /* @__PURE__ */ jsxs17("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
|
|
3735
|
+
/* @__PURE__ */ jsx20(
|
|
3686
3736
|
"span",
|
|
3687
3737
|
{
|
|
3688
3738
|
role: "progressbar",
|
|
@@ -3690,24 +3740,24 @@ function rich(id, text, raw, format) {
|
|
|
3690
3740
|
"aria-valuemax": 100,
|
|
3691
3741
|
"aria-valuenow": Math.round(clamped),
|
|
3692
3742
|
className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
|
|
3693
|
-
children: /* @__PURE__ */
|
|
3743
|
+
children: /* @__PURE__ */ jsx20("span", { className: cn10("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
|
|
3694
3744
|
}
|
|
3695
3745
|
),
|
|
3696
|
-
/* @__PURE__ */
|
|
3746
|
+
/* @__PURE__ */ jsx20("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
|
|
3697
3747
|
] });
|
|
3698
3748
|
}
|
|
3699
3749
|
case "color":
|
|
3700
|
-
return /* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3702
|
-
/* @__PURE__ */
|
|
3750
|
+
return /* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
3751
|
+
/* @__PURE__ */ jsx20("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
|
|
3752
|
+
/* @__PURE__ */ jsx20("code", { className: "font-mono text-xs", children: text })
|
|
3703
3753
|
] });
|
|
3704
3754
|
case "tags": {
|
|
3705
3755
|
const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
|
|
3706
3756
|
if (items.length === 0) return void 0;
|
|
3707
|
-
return /* @__PURE__ */
|
|
3757
|
+
return /* @__PURE__ */ jsx20("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ jsx20("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
|
|
3708
3758
|
}
|
|
3709
3759
|
case "rating":
|
|
3710
|
-
return numberOf3(raw) === null ? void 0 : /* @__PURE__ */
|
|
3760
|
+
return numberOf3(raw) === null ? void 0 : /* @__PURE__ */ jsx20(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
|
|
3711
3761
|
default:
|
|
3712
3762
|
return void 0;
|
|
3713
3763
|
}
|
|
@@ -3722,16 +3772,16 @@ function FormattedValue({
|
|
|
3722
3772
|
const score = numberOf3(value);
|
|
3723
3773
|
const max = format.options?.ratingMax ?? 5;
|
|
3724
3774
|
if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
|
|
3725
|
-
return /* @__PURE__ */
|
|
3775
|
+
return /* @__PURE__ */ jsx20(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
|
|
3726
3776
|
}
|
|
3727
3777
|
const result = formatFieldValue2(value, format);
|
|
3728
|
-
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */
|
|
3778
|
+
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ jsx20(FormattedCell, { result });
|
|
3729
3779
|
const look = fieldLookFor(def.id);
|
|
3730
3780
|
if (look) {
|
|
3731
3781
|
const View = look.View;
|
|
3732
|
-
return /* @__PURE__ */
|
|
3782
|
+
return /* @__PURE__ */ jsx20(View, { value, format });
|
|
3733
3783
|
}
|
|
3734
|
-
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */
|
|
3784
|
+
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ jsx20(FormattedCell, { result });
|
|
3735
3785
|
}
|
|
3736
3786
|
function linkChipText(raw) {
|
|
3737
3787
|
try {
|
|
@@ -3744,54 +3794,6 @@ function linkChipText(raw) {
|
|
|
3744
3794
|
}
|
|
3745
3795
|
}
|
|
3746
3796
|
|
|
3747
|
-
// src/LinkPreviewCard.tsx
|
|
3748
|
-
import { useEffect as useEffect10, useRef as useRef9, useState as useState15 } from "react";
|
|
3749
|
-
import { HoverCard, HoverCardContent, HoverCardTrigger, SiteIcon } from "@ai-matrx/design-system";
|
|
3750
|
-
import { Fragment as Fragment9, jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3751
|
-
var answers = /* @__PURE__ */ new Map();
|
|
3752
|
-
function LinkPreviewCard({ url, children }) {
|
|
3753
|
-
const port = useRecordsUi().linkPreview;
|
|
3754
|
-
const [preview, setPreview] = useState15(void 0);
|
|
3755
|
-
const [open, setOpen] = useState15(false);
|
|
3756
|
-
const timer = useRef9(null);
|
|
3757
|
-
useEffect10(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
3758
|
-
if (!port) return /* @__PURE__ */ jsx20(Fragment9, { children });
|
|
3759
|
-
const ask = () => {
|
|
3760
|
-
if (preview !== void 0) return;
|
|
3761
|
-
let pending = answers.get(url);
|
|
3762
|
-
if (!pending) {
|
|
3763
|
-
pending = port.read(url).catch(() => null);
|
|
3764
|
-
answers.set(url, pending);
|
|
3765
|
-
}
|
|
3766
|
-
void pending.then((found) => setPreview(found));
|
|
3767
|
-
};
|
|
3768
|
-
const enter = () => {
|
|
3769
|
-
ask();
|
|
3770
|
-
if (timer.current) clearTimeout(timer.current);
|
|
3771
|
-
timer.current = setTimeout(() => setOpen(true), 350);
|
|
3772
|
-
};
|
|
3773
|
-
const leave = () => {
|
|
3774
|
-
if (timer.current) clearTimeout(timer.current);
|
|
3775
|
-
setOpen(false);
|
|
3776
|
-
};
|
|
3777
|
-
const shown2 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
3778
|
-
return /* @__PURE__ */ jsxs17(HoverCard, { open: open && shown2 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
3779
|
-
/* @__PURE__ */ jsx20(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsx20("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
3780
|
-
shown2 ? /* @__PURE__ */ jsxs17(HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
3781
|
-
shown2.imageUrl ? (
|
|
3782
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
3783
|
-
/* @__PURE__ */ jsx20("img", { src: shown2.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
3784
|
-
) : null,
|
|
3785
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1.5", children: [
|
|
3786
|
-
/* @__PURE__ */ jsx20(SiteIcon, { site: url, iconUrl: shown2.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
3787
|
-
/* @__PURE__ */ jsx20("span", { className: "truncate text-muted-foreground", children: shown2.siteName ?? "" })
|
|
3788
|
-
] }),
|
|
3789
|
-
shown2.title ? /* @__PURE__ */ jsx20("div", { className: "line-clamp-2 font-medium", children: shown2.title }) : null,
|
|
3790
|
-
shown2.description ? /* @__PURE__ */ jsx20("div", { className: "line-clamp-3 text-muted-foreground", children: shown2.description }) : null
|
|
3791
|
-
] }) : null
|
|
3792
|
-
] });
|
|
3793
|
-
}
|
|
3794
|
-
|
|
3795
3797
|
// src/gridAttachments.tsx
|
|
3796
3798
|
import { useEffect as useEffect11, useRef as useRef10, useState as useState16 } from "react";
|
|
3797
3799
|
import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
@@ -4784,7 +4786,7 @@ import { AlchemyMenu } from "@ai-matrx/alchemy/react";
|
|
|
4784
4786
|
import { OutboundLink as OutboundLink5 } from "@ai-matrx/kit/outbound-react";
|
|
4785
4787
|
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
4786
4788
|
import { jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
4787
|
-
var SaveToTable = lazy(() => import("./SaveToTable-
|
|
4789
|
+
var SaveToTable = lazy(() => import("./SaveToTable-HG3HQMAQ.js").then((m) => ({ default: m.SaveToTable })));
|
|
4788
4790
|
var LONGEST_READ = 5e5;
|
|
4789
4791
|
var FENCE = /^```(?:json)?[ \t]*\r?\n([\s\S]*?)\r?\n?```$/;
|
|
4790
4792
|
function isPlainObject(v) {
|
|
@@ -7520,6 +7522,7 @@ var READS = /* @__PURE__ */ new Set([
|
|
|
7520
7522
|
"cell-history",
|
|
7521
7523
|
"cell-filter",
|
|
7522
7524
|
"row-open",
|
|
7525
|
+
"row-print-layout",
|
|
7523
7526
|
"row-history",
|
|
7524
7527
|
"row-copy",
|
|
7525
7528
|
"col-sort-asc",
|
|
@@ -12325,4 +12328,4 @@ export {
|
|
|
12325
12328
|
RecordNameText,
|
|
12326
12329
|
HeldChangeDecision
|
|
12327
12330
|
};
|
|
12328
|
-
//# sourceMappingURL=chunk-
|
|
12331
|
+
//# sourceMappingURL=chunk-K3B5IRXY.js.map
|