@ai-matrx/records-ui 0.101.21 → 0.101.22

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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, KeyboardEvent, ReactElement, ComponentType, RefObject, SVGAttributes } from 'react';
3
3
  import * as _ai_matrx_records from '@ai-matrx/records';
4
- import { RecordScopeContext, EnrichCell, RecordsError, Field, TableDecorations, Uuid as Uuid$1, RowAction, RecordDocument, Table, ReadRow, StoreFilter, RecordRead, PermissionLevel, AggregateFilter, RelationDisplay, WriteConflict, RecordsErrorCode, RecordFilter, RuleExpression, RecordsResult, SavedViewRow, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalAccent, FormSummary, PortalCard, PortalPrincipal, PortalPreviewRow, PublicPicture, PortalStyle, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
4
+ import { RecordScopeContext, EnrichCell, RecordsError, Field, TableDecorations, Uuid as Uuid$1, RowAction, RecordDocument, Table, ReadRow, StoreFilter, RecordRead, PermissionLevel, AggregateFilter, RelationDisplay, WriteConflict, RecordsErrorCode, RecordFilter, RuleExpression, RecordsResult, SavedViewRow, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalAccent, FormSummary, PortalCard, PortalPrincipal, PortalPreviewRow, PublicPicture, PortalStyle, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, AggregateGroupValue, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
5
5
  import { ReversibleAnnouncement } from '@ai-matrx/kit/reversible';
6
6
  import { W as WhatYouMayDo, T as TableActionHost, O as ObjectAction, a as ObjectActionIcon } from './objectActions-XkhxU-DP.cjs';
7
7
  export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-XkhxU-DP.cjs';
@@ -4956,7 +4956,7 @@ declare const SERIES_COLORS: readonly ["hsl(var(--primary))", "hsl(var(--info))"
4956
4956
  */
4957
4957
  type GroupNamer = (key: string, value: string) => string | null | undefined;
4958
4958
  /** The label one aggregate row carries — its groups, joined the way a person reads them. */
4959
- declare function groupLabel(groups: Record<string, string | null>, named?: GroupNamer): string;
4959
+ declare function groupLabel(groups: Record<string, AggregateGroupValue>, named?: GroupNamer): string;
4960
4960
 
4961
4961
  /** The same shape `components/ui/chart.tsx` takes: one entry per series key. */
4962
4962
  type ChartConfig = Record<string, {
@@ -6346,14 +6346,30 @@ interface EntitySourceState {
6346
6346
  total: number;
6347
6347
  loading: boolean;
6348
6348
  error: string | null;
6349
+ /**
6350
+ * The door adds rows here: the token's API facts say `create_via: "insert"` (task, project) —
6351
+ * `drill_describe(...).api.create_via` — and the row's name column is one it writes.
6352
+ */
6353
+ creatable: boolean;
6349
6354
  /** Change one column of one row by its words (a choice by its name); re-reads on success. */
6350
6355
  write: (rowId: string, apiName: string, value: unknown) => Promise<string | null>;
6356
+ /**
6357
+ * Add one row through the same write door (`custom.entity_row_write` with no record id, as the
6358
+ * person, into the client's organization); re-reads on success. Its id, or the door's refusal.
6359
+ */
6360
+ create: (columns: Record<string, unknown>) => Promise<{
6361
+ id: string;
6362
+ } | {
6363
+ refused: string;
6364
+ }>;
6351
6365
  reload: () => void;
6352
6366
  }
6353
6367
  /** A standard source's presented columns and one page of its rows, read as the person. */
6354
6368
  declare function useEntitySource(token: string, options?: {
6355
6369
  limit?: number;
6356
6370
  }): EntitySourceState;
6371
+ /** The column that names a row: the door's first of name / display_name / title / subject, else its first text column. */
6372
+ declare function entityNameColumn(columns: readonly EntityColumn[]): EntityColumn | null;
6357
6373
  /** The columns of the one table, from the door's presented columns. */
6358
6374
  declare function entityTableColumns(columns: readonly EntityColumn[]): MatrxColumnDef$1<EntityRow>[];
6359
6375
  /** A standard source in the one table. */
@@ -6368,8 +6384,8 @@ type EntitySource = {
6368
6384
  kind: "entity";
6369
6385
  token: string;
6370
6386
  };
6371
- /** The column that names a row: the door's first of name / display_name / title, else its first text column. */
6372
- declare function entityTitleColumn(columns: readonly EntityColumn[]): EntityColumn | null;
6387
+ /** The column that names a row (the door's first of name / display_name / title / subject, else its first text column). */
6388
+ declare const entityTitleColumn: typeof entityNameColumn;
6373
6389
  /** The choice columns a board can be grouped by (a deal's Stage, a task's Status). */
6374
6390
  declare function entityChoiceColumns(columns: readonly EntityColumn[]): EntityColumn[];
6375
6391
  interface EntityBoardProps {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, KeyboardEvent, ReactElement, ComponentType, RefObject, SVGAttributes } from 'react';
3
3
  import * as _ai_matrx_records from '@ai-matrx/records';
4
- import { RecordScopeContext, EnrichCell, RecordsError, Field, TableDecorations, Uuid as Uuid$1, RowAction, RecordDocument, Table, ReadRow, StoreFilter, RecordRead, PermissionLevel, AggregateFilter, RelationDisplay, WriteConflict, RecordsErrorCode, RecordFilter, RuleExpression, RecordsResult, SavedViewRow, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalAccent, FormSummary, PortalCard, PortalPrincipal, PortalPreviewRow, PublicPicture, PortalStyle, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
4
+ import { RecordScopeContext, EnrichCell, RecordsError, Field, TableDecorations, Uuid as Uuid$1, RowAction, RecordDocument, Table, ReadRow, StoreFilter, RecordRead, PermissionLevel, AggregateFilter, RelationDisplay, WriteConflict, RecordsErrorCode, RecordFilter, RuleExpression, RecordsResult, SavedViewRow, ImportRun, DeclarableFieldKind, NewerFieldKind, ParityFieldType, NewFieldDeclaration, ChoiceRehome, FieldOptionEdit, StoredRecord, ChoiceNudge, HiddenFieldNotice, ValueEnvelope, ChecklistRequirementKind, ContextPolicy, WorkDueState, FieldSensitivity, StageRuleOnFail, SubscriptionCadence, WorkApprovalState, WorkInboxKind, FieldKind, ArchiveLane, ArchivedRow, WorkInboxView, WorkInboxItem, PortalAccent, FormSummary, PortalCard, PortalPrincipal, PortalPreviewRow, PublicPicture, PortalStyle, MySubscription, DashboardBlockKind, AggregateBucket, AggregateMeasure, AggregateCompare, DashboardTarget, DashboardBlock, DashboardSummary, AggregateGroupValue, DocTemplateRow, DocRenderRow, QuietHours, DashboardBlockResult, ChecklistRunStep, BookingSummary, CaptureSheetFace, CaptureField, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource, TableDuplicated, HistoryActor, FieldHistoryEntry, DrillDefinition, DrillSource, TableDuplicateProgress, TableArchiveProgress } from '@ai-matrx/records';
5
5
  import { ReversibleAnnouncement } from '@ai-matrx/kit/reversible';
6
6
  import { W as WhatYouMayDo, T as TableActionHost, O as ObjectAction, a as ObjectActionIcon } from './objectActions-XkhxU-DP.js';
7
7
  export { A as ACTION_CHECKING_ACCESS_REASON, b as ACTION_NOT_HERE_REASON, c as ACTION_NO_ACCESS_REASON, d as ACTION_PLATFORM_TABLE_REASON, B as BuiltOnDestination, C as Capability, D as DEFAULT_ACTION_ORIGIN, K as KERNEL_REASON, L as LEVEL_WORD, N as NOT_ANSWERED_YET, e as OBJECT_ACTION_GROUPS, f as ObjectActionDropdownEntry, g as ObjectActionGroup, h as ObjectActionGroupDef, i as ObjectActionSection, S as STANDARD_VERBS, j as STRIP_FEATURE_ROWS, k as StandardVerbId, l as StripAndRows, m as TableActionSubject, n as TableActionsInput, o as dropdownActionIds, p as dropdownActions, q as groupObjectActions, r as levelNeededFor, s as rightsReason, t as tableActions, u as tableLink, v as toDropdownEntries, w as toStripAndRows, x as whatYouMayDo, y as whatYouMayDoWithTable, z as withExtensions } from './objectActions-XkhxU-DP.js';
@@ -4956,7 +4956,7 @@ declare const SERIES_COLORS: readonly ["hsl(var(--primary))", "hsl(var(--info))"
4956
4956
  */
4957
4957
  type GroupNamer = (key: string, value: string) => string | null | undefined;
4958
4958
  /** The label one aggregate row carries — its groups, joined the way a person reads them. */
4959
- declare function groupLabel(groups: Record<string, string | null>, named?: GroupNamer): string;
4959
+ declare function groupLabel(groups: Record<string, AggregateGroupValue>, named?: GroupNamer): string;
4960
4960
 
4961
4961
  /** The same shape `components/ui/chart.tsx` takes: one entry per series key. */
4962
4962
  type ChartConfig = Record<string, {
@@ -6346,14 +6346,30 @@ interface EntitySourceState {
6346
6346
  total: number;
6347
6347
  loading: boolean;
6348
6348
  error: string | null;
6349
+ /**
6350
+ * The door adds rows here: the token's API facts say `create_via: "insert"` (task, project) —
6351
+ * `drill_describe(...).api.create_via` — and the row's name column is one it writes.
6352
+ */
6353
+ creatable: boolean;
6349
6354
  /** Change one column of one row by its words (a choice by its name); re-reads on success. */
6350
6355
  write: (rowId: string, apiName: string, value: unknown) => Promise<string | null>;
6356
+ /**
6357
+ * Add one row through the same write door (`custom.entity_row_write` with no record id, as the
6358
+ * person, into the client's organization); re-reads on success. Its id, or the door's refusal.
6359
+ */
6360
+ create: (columns: Record<string, unknown>) => Promise<{
6361
+ id: string;
6362
+ } | {
6363
+ refused: string;
6364
+ }>;
6351
6365
  reload: () => void;
6352
6366
  }
6353
6367
  /** A standard source's presented columns and one page of its rows, read as the person. */
6354
6368
  declare function useEntitySource(token: string, options?: {
6355
6369
  limit?: number;
6356
6370
  }): EntitySourceState;
6371
+ /** The column that names a row: the door's first of name / display_name / title / subject, else its first text column. */
6372
+ declare function entityNameColumn(columns: readonly EntityColumn[]): EntityColumn | null;
6357
6373
  /** The columns of the one table, from the door's presented columns. */
6358
6374
  declare function entityTableColumns(columns: readonly EntityColumn[]): MatrxColumnDef$1<EntityRow>[];
6359
6375
  /** A standard source in the one table. */
@@ -6368,8 +6384,8 @@ type EntitySource = {
6368
6384
  kind: "entity";
6369
6385
  token: string;
6370
6386
  };
6371
- /** The column that names a row: the door's first of name / display_name / title, else its first text column. */
6372
- declare function entityTitleColumn(columns: readonly EntityColumn[]): EntityColumn | null;
6387
+ /** The column that names a row (the door's first of name / display_name / title / subject, else its first text column). */
6388
+ declare const entityTitleColumn: typeof entityNameColumn;
6373
6389
  /** The choice columns a board can be grouped by (a deal's Stage, a task's Status). */
6374
6390
  declare function entityChoiceColumns(columns: readonly EntityColumn[]): EntityColumn[];
6375
6391
  interface EntityBoardProps {
package/dist/index.js CHANGED
@@ -14452,7 +14452,8 @@ function useDrillAnswers(args) {
14452
14452
  const groups = {};
14453
14453
  for (const ref of request.by) {
14454
14454
  const k = ref === time && t ? t.key : ref;
14455
- groups[ref] = row.groups[k] ?? null;
14455
+ const g = row.groups[k];
14456
+ groups[ref] = g === null || g === void 0 ? null : String(g);
14456
14457
  }
14457
14458
  return {
14458
14459
  groups,
@@ -22985,7 +22986,8 @@ function useEntitySource(token, options = {}) {
22985
22986
  rows: [],
22986
22987
  total: 0,
22987
22988
  loading: true,
22988
- error: null
22989
+ error: null,
22990
+ creatable: false
22989
22991
  });
22990
22992
  useEffect48(() => {
22991
22993
  let cancelled = false;
@@ -23004,7 +23006,8 @@ function useEntitySource(token, options = {}) {
23004
23006
  rows: page.data.rows ?? [],
23005
23007
  total: Number(page.data.total ?? 0),
23006
23008
  loading: false,
23007
- error: null
23009
+ error: null,
23010
+ creatable: api?.create_via === "insert" && !!entityNameColumn(api?.columns ?? [])?.writable
23008
23011
  });
23009
23012
  },
23010
23013
  (thrown) => {
@@ -23031,7 +23034,24 @@ function useEntitySource(token, options = {}) {
23031
23034
  },
23032
23035
  [client, token, state.rows]
23033
23036
  );
23034
- return { ...state, write, reload };
23037
+ const create = useCallback26(
23038
+ async (columns) => {
23039
+ const done = await client.entityRowWrite({ token, record_id: null, columns });
23040
+ if (!done.ok) return { refused: refusalSentence(done.error) || "That row was not added." };
23041
+ setTick((t) => t + 1);
23042
+ return { id: String(done.data.id) };
23043
+ },
23044
+ [client, token]
23045
+ );
23046
+ return { ...state, write, create, reload };
23047
+ }
23048
+ var NAME_KEYS = ["name", "display_name", "title", "subject"];
23049
+ function entityNameColumn(columns) {
23050
+ for (const key of NAME_KEYS) {
23051
+ const hit = columns.find((c) => c.api_name === key);
23052
+ if (hit) return hit;
23053
+ }
23054
+ return columns.find((c) => c.type === "text" && !c.lookup) ?? columns[0] ?? null;
23035
23055
  }
23036
23056
  function entityTableColumns(columns) {
23037
23057
  return columns.map((c) => ({
@@ -39282,8 +39302,9 @@ function linkIdsOf(value) {
39282
39302
  return t ? [t] : [];
39283
39303
  }
39284
39304
  function groupLabel(groups, named) {
39285
- const parts = Object.entries(groups).map(([key, v]) => {
39286
- if (v === null || v === "") return "\u2014";
39305
+ const parts = Object.entries(groups).map(([key, raw]) => {
39306
+ if (raw === null || raw === void 0 || raw === "") return "\u2014";
39307
+ const v = String(raw);
39287
39308
  const name = named?.(key, v);
39288
39309
  if (name !== void 0) return name ?? "\u2014";
39289
39310
  const grain = BUCKET_SUFFIX.exec(key)?.[1];
@@ -41807,7 +41828,8 @@ function rowsOf2(rows, groupKey, keys) {
41807
41828
  }
41808
41829
  const withheld = {};
41809
41830
  for (const [name, notice] of Object.entries(r.withheld ?? {})) if (keys.includes(name)) withheld[name] = notice;
41810
- return { group: groupKey ? (r.groups ?? {})[groupKey] ?? null : null, values, withheld, n: Number(r.row_count ?? 0) };
41831
+ const g = groupKey ? (r.groups ?? {})[groupKey] : null;
41832
+ return { group: g === null || g === void 0 ? null : String(g), values, withheld, n: Number(r.row_count ?? 0) };
41811
41833
  });
41812
41834
  }
41813
41835
  function sortAndCut(rows, spec, keys) {
@@ -46911,17 +46933,10 @@ function TablePage({
46911
46933
 
46912
46934
  // src/entityViews.tsx
46913
46935
  import { useEffect as useEffect110, useMemo as useMemo75, useState as useState132 } from "react";
46914
- import { Button as Button106, ErrorBox as ErrorBox9, cn as cn93 } from "@ai-matrx/design-system";
46936
+ import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn93 } from "@ai-matrx/design-system";
46915
46937
  import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
46916
46938
  import { Fragment as Fragment62, jsx as jsx153, jsxs as jsxs141 } from "react/jsx-runtime";
46917
- var TITLE_KEYS = ["name", "display_name", "title", "subject"];
46918
- function entityTitleColumn(columns) {
46919
- for (const key of TITLE_KEYS) {
46920
- const hit = columns.find((c) => c.api_name === key);
46921
- if (hit) return hit;
46922
- }
46923
- return columns.find((c) => c.type === "text" && !c.lookup) ?? columns[0] ?? null;
46924
- }
46939
+ var entityTitleColumn = entityNameColumn;
46925
46940
  function entityChoiceColumns(columns) {
46926
46941
  return columns.filter((c) => c.type === "choice" && Array.isArray(c.choices) && c.choices.length > 0);
46927
46942
  }
@@ -47076,6 +47091,21 @@ function EntityTablePage({
47076
47091
  onLayoutChange?.(next);
47077
47092
  };
47078
47093
  const boardable = entityChoiceColumns(entity.columns).length > 0;
47094
+ const nameColumn = entityNameColumn(entity.columns);
47095
+ const [naming, setNaming] = useState132(null);
47096
+ const [adding, setAdding] = useState132(false);
47097
+ const [addRefused, setAddRefused] = useState132(null);
47098
+ const add = async () => {
47099
+ const name = (naming ?? "").trim();
47100
+ if (!name || !nameColumn || adding) return;
47101
+ setAdding(true);
47102
+ setAddRefused(null);
47103
+ const made = await entity.create({ [nameColumn.api_name]: name });
47104
+ setAdding(false);
47105
+ if ("refused" in made) return setAddRefused(made.refused);
47106
+ setNaming(null);
47107
+ onOpenRecord?.(made.id);
47108
+ };
47079
47109
  const [question, setQuestion] = useState132(() => questionFromGrouping(void 0));
47080
47110
  const { config: drill } = useDrill({
47081
47111
  source,
@@ -47086,7 +47116,7 @@ function EntityTablePage({
47086
47116
  enabled: layout === "grid"
47087
47117
  });
47088
47118
  return /* @__PURE__ */ jsxs141("div", { className: cn93("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
47089
- presentation === "page" || boardable ? /* @__PURE__ */ jsxs141("div", { className: "flex min-w-0 items-center gap-2", children: [
47119
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs141("div", { className: "flex min-w-0 items-center gap-2", children: [
47090
47120
  presentation === "page" ? /* @__PURE__ */ jsx153("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
47091
47121
  presentation === "page" ? /* @__PURE__ */ jsx153("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading ? "" : entity.total.toLocaleString() }) : null,
47092
47122
  /* @__PURE__ */ jsxs141("span", { className: "ml-auto flex items-center gap-1", children: [
@@ -47094,9 +47124,41 @@ function EntityTablePage({
47094
47124
  /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
47095
47125
  /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
47096
47126
  ] }) : null,
47127
+ entity.creatable && naming === null ? /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: "ghost", onClick: () => {
47128
+ setAddRefused(null);
47129
+ setNaming("");
47130
+ }, children: "New page" }) : null,
47131
+ entity.creatable && naming !== null ? /* @__PURE__ */ jsx153(
47132
+ Input12,
47133
+ {
47134
+ autoFocus: true,
47135
+ "data-records-entity-new": source.token,
47136
+ "aria-label": nameColumn?.name ?? "Name",
47137
+ placeholder: nameColumn?.name ?? "Name",
47138
+ value: naming,
47139
+ disabled: adding,
47140
+ className: "h-7 w-56 text-xs",
47141
+ onChange: (e) => setNaming(e.target.value),
47142
+ onKeyDown: (e) => {
47143
+ if (e.key === "Enter") {
47144
+ e.preventDefault();
47145
+ void add();
47146
+ }
47147
+ if (e.key === "Escape") {
47148
+ e.preventDefault();
47149
+ setNaming(null);
47150
+ setAddRefused(null);
47151
+ }
47152
+ },
47153
+ onBlur: () => {
47154
+ if (!adding && !(naming ?? "").trim()) setNaming(null);
47155
+ }
47156
+ }
47157
+ ) : null,
47097
47158
  actions
47098
47159
  ] })
47099
47160
  ] }) : null,
47161
+ addRefused ? /* @__PURE__ */ jsx153(ErrorBox9, { className: "rounded border border-destructive/40 px-1.5 py-1 text-xs text-destructive", message: addRefused, operation: "Add a row", origin: "records-ui/entityViews" }) : null,
47100
47162
  entity.error ? /* @__PURE__ */ jsx153("p", { className: "px-1 py-3 text-xs text-muted-foreground", children: `This table could not be read: ${entity.error}` }) : layout === "board" && boardable ? /* @__PURE__ */ jsx153(EntityBoard, { entity, groupBy, onOpenRecord }) : /* @__PURE__ */ jsx153(EntityGrid, { entity, pageSize, ...drill ? { drill } : {} })
47101
47163
  ] });
47102
47164
  }