@ai-matrx/records-ui 0.101.21 → 0.101.23

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
@@ -12522,6 +12522,9 @@ function storedValueAgrees(field2, stored, written, options) {
12522
12522
  }
12523
12523
  return JSON.stringify(stored) === JSON.stringify(written);
12524
12524
  }
12525
+ function refusalsBeyondTheHeader(refusals, headerRowId) {
12526
+ return headerRowId === void 0 ? [...refusals] : refusals.filter((r) => r.rowId !== headerRowId);
12527
+ }
12525
12528
  function columnsTheGridTurnedAway(turnedAway, columnKeys, columnName, already) {
12526
12529
  const said = /* @__PURE__ */ new Map();
12527
12530
  for (const refused of turnedAway) {
@@ -14452,7 +14455,8 @@ function useDrillAnswers(args) {
14452
14455
  const groups = {};
14453
14456
  for (const ref of request.by) {
14454
14457
  const k = ref === time && t ? t.key : ref;
14455
- groups[ref] = row.groups[k] ?? null;
14458
+ const g = row.groups[k];
14459
+ groups[ref] = g === null || g === void 0 ? null : String(g);
14456
14460
  }
14457
14461
  return {
14458
14462
  groups,
@@ -21479,7 +21483,12 @@ function GridBody({
21479
21483
  ...headed ? { header: { unmatched: headed.unmatched } } : {}
21480
21484
  });
21481
21485
  built.refusals.push(
21482
- ...columnsTheGridTurnedAway(sheetPlan.refusals, columnKeys, (id) => columnLabel(fieldList, id), built.refusals)
21486
+ ...columnsTheGridTurnedAway(
21487
+ refusalsBeyondTheHeader(sheetPlan.refusals, headed ? touched[0] : void 0),
21488
+ columnKeys,
21489
+ (id) => columnLabel(fieldList, id),
21490
+ built.refusals
21491
+ )
21483
21492
  );
21484
21493
  if (merged && built.cells > 0 && built.creates === 0 && built.refusals.length === 0 && built.pastRightEdge === 0 && (built.header?.unmatched.length ?? 0) === 0 && built.unmatchedOptions.length === 0) {
21485
21494
  const outcome = await pasteAtOnce.current(built);
@@ -22985,7 +22994,8 @@ function useEntitySource(token, options = {}) {
22985
22994
  rows: [],
22986
22995
  total: 0,
22987
22996
  loading: true,
22988
- error: null
22997
+ error: null,
22998
+ creatable: false
22989
22999
  });
22990
23000
  useEffect48(() => {
22991
23001
  let cancelled = false;
@@ -23004,7 +23014,8 @@ function useEntitySource(token, options = {}) {
23004
23014
  rows: page.data.rows ?? [],
23005
23015
  total: Number(page.data.total ?? 0),
23006
23016
  loading: false,
23007
- error: null
23017
+ error: null,
23018
+ creatable: api?.create_via === "insert" && !!entityNameColumn(api?.columns ?? [])?.writable
23008
23019
  });
23009
23020
  },
23010
23021
  (thrown) => {
@@ -23031,7 +23042,24 @@ function useEntitySource(token, options = {}) {
23031
23042
  },
23032
23043
  [client, token, state.rows]
23033
23044
  );
23034
- return { ...state, write, reload };
23045
+ const create = useCallback26(
23046
+ async (columns) => {
23047
+ const done = await client.entityRowWrite({ token, record_id: null, columns });
23048
+ if (!done.ok) return { refused: refusalSentence(done.error) || "That row was not added." };
23049
+ setTick((t) => t + 1);
23050
+ return { id: String(done.data.id) };
23051
+ },
23052
+ [client, token]
23053
+ );
23054
+ return { ...state, write, create, reload };
23055
+ }
23056
+ var NAME_KEYS = ["name", "display_name", "title", "subject"];
23057
+ function entityNameColumn(columns) {
23058
+ for (const key of NAME_KEYS) {
23059
+ const hit = columns.find((c) => c.api_name === key);
23060
+ if (hit) return hit;
23061
+ }
23062
+ return columns.find((c) => c.type === "text" && !c.lookup) ?? columns[0] ?? null;
23035
23063
  }
23036
23064
  function entityTableColumns(columns) {
23037
23065
  return columns.map((c) => ({
@@ -39282,8 +39310,9 @@ function linkIdsOf(value) {
39282
39310
  return t ? [t] : [];
39283
39311
  }
39284
39312
  function groupLabel(groups, named) {
39285
- const parts = Object.entries(groups).map(([key, v]) => {
39286
- if (v === null || v === "") return "\u2014";
39313
+ const parts = Object.entries(groups).map(([key, raw]) => {
39314
+ if (raw === null || raw === void 0 || raw === "") return "\u2014";
39315
+ const v = String(raw);
39287
39316
  const name = named?.(key, v);
39288
39317
  if (name !== void 0) return name ?? "\u2014";
39289
39318
  const grain = BUCKET_SUFFIX.exec(key)?.[1];
@@ -41807,7 +41836,8 @@ function rowsOf2(rows, groupKey, keys) {
41807
41836
  }
41808
41837
  const withheld = {};
41809
41838
  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) };
41839
+ const g = groupKey ? (r.groups ?? {})[groupKey] : null;
41840
+ return { group: g === null || g === void 0 ? null : String(g), values, withheld, n: Number(r.row_count ?? 0) };
41811
41841
  });
41812
41842
  }
41813
41843
  function sortAndCut(rows, spec, keys) {
@@ -46911,17 +46941,10 @@ function TablePage({
46911
46941
 
46912
46942
  // src/entityViews.tsx
46913
46943
  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";
46944
+ import { Button as Button106, ErrorBox as ErrorBox9, Input as Input12, cn as cn93 } from "@ai-matrx/design-system";
46915
46945
  import { useRecordsClient as useRecordsClient96 } from "@ai-matrx/records/react";
46916
46946
  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
- }
46947
+ var entityTitleColumn = entityNameColumn;
46925
46948
  function entityChoiceColumns(columns) {
46926
46949
  return columns.filter((c) => c.type === "choice" && Array.isArray(c.choices) && c.choices.length > 0);
46927
46950
  }
@@ -47076,6 +47099,21 @@ function EntityTablePage({
47076
47099
  onLayoutChange?.(next);
47077
47100
  };
47078
47101
  const boardable = entityChoiceColumns(entity.columns).length > 0;
47102
+ const nameColumn = entityNameColumn(entity.columns);
47103
+ const [naming, setNaming] = useState132(null);
47104
+ const [adding, setAdding] = useState132(false);
47105
+ const [addRefused, setAddRefused] = useState132(null);
47106
+ const add = async () => {
47107
+ const name = (naming ?? "").trim();
47108
+ if (!name || !nameColumn || adding) return;
47109
+ setAdding(true);
47110
+ setAddRefused(null);
47111
+ const made = await entity.create({ [nameColumn.api_name]: name });
47112
+ setAdding(false);
47113
+ if ("refused" in made) return setAddRefused(made.refused);
47114
+ setNaming(null);
47115
+ onOpenRecord?.(made.id);
47116
+ };
47079
47117
  const [question, setQuestion] = useState132(() => questionFromGrouping(void 0));
47080
47118
  const { config: drill } = useDrill({
47081
47119
  source,
@@ -47086,7 +47124,7 @@ function EntityTablePage({
47086
47124
  enabled: layout === "grid"
47087
47125
  });
47088
47126
  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: [
47127
+ presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ jsxs141("div", { className: "flex min-w-0 items-center gap-2", children: [
47090
47128
  presentation === "page" ? /* @__PURE__ */ jsx153("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
47091
47129
  presentation === "page" ? /* @__PURE__ */ jsx153("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading ? "" : entity.total.toLocaleString() }) : null,
47092
47130
  /* @__PURE__ */ jsxs141("span", { className: "ml-auto flex items-center gap-1", children: [
@@ -47094,9 +47132,41 @@ function EntityTablePage({
47094
47132
  /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
47095
47133
  /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: layout === "board" ? "secondary" : "ghost", "aria-pressed": layout === "board", onClick: () => choose("board"), children: "Board" })
47096
47134
  ] }) : null,
47135
+ entity.creatable && naming === null ? /* @__PURE__ */ jsx153(Button106, { size: "sm", variant: "ghost", onClick: () => {
47136
+ setAddRefused(null);
47137
+ setNaming("");
47138
+ }, children: "New page" }) : null,
47139
+ entity.creatable && naming !== null ? /* @__PURE__ */ jsx153(
47140
+ Input12,
47141
+ {
47142
+ autoFocus: true,
47143
+ "data-records-entity-new": source.token,
47144
+ "aria-label": nameColumn?.name ?? "Name",
47145
+ placeholder: nameColumn?.name ?? "Name",
47146
+ value: naming,
47147
+ disabled: adding,
47148
+ className: "h-7 w-56 text-xs",
47149
+ onChange: (e) => setNaming(e.target.value),
47150
+ onKeyDown: (e) => {
47151
+ if (e.key === "Enter") {
47152
+ e.preventDefault();
47153
+ void add();
47154
+ }
47155
+ if (e.key === "Escape") {
47156
+ e.preventDefault();
47157
+ setNaming(null);
47158
+ setAddRefused(null);
47159
+ }
47160
+ },
47161
+ onBlur: () => {
47162
+ if (!adding && !(naming ?? "").trim()) setNaming(null);
47163
+ }
47164
+ }
47165
+ ) : null,
47097
47166
  actions
47098
47167
  ] })
47099
47168
  ] }) : null,
47169
+ 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
47170
  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
47171
  ] });
47102
47172
  }