@ai-matrx/records-ui 0.115.50 → 0.115.51

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.js CHANGED
@@ -2330,15 +2330,13 @@ function cellSection(payload, ctx) {
2330
2330
  { id: "cell-clear", label: "Clear cell", icon: "eraser", destructive: true, disabledReason: why, onSelect: () => a.clearCells([{ rowId, columnId: columnId2 }]) }
2331
2331
  ];
2332
2332
  const cellField = fieldOf(ctx, columnId2);
2333
- if (a.cleanCell && cellField && ctx.cleanable?.(cellField)) {
2334
- items.push({
2335
- id: "cell-clean",
2336
- label: "Clean cell\u2026",
2337
- icon: "paintbrush",
2338
- disabledReason: why,
2339
- onSelect: () => a.cleanCell?.(rowId, columnId2)
2340
- });
2341
- }
2333
+ items.push({
2334
+ id: "cell-clean",
2335
+ label: "Clean cell\u2026",
2336
+ icon: "paintbrush",
2337
+ disabledReason: why ?? (!a.cleanCell ? NOT_HERE : cellField && !ctx.cleanable?.(cellField) ? "Only a text cell can be cleaned." : void 0),
2338
+ onSelect: () => a.cleanCell?.(rowId, columnId2)
2339
+ });
2342
2340
  if (a.askWhoChanged) {
2343
2341
  items.push({ id: "cell-history", label: "Who changed this?", icon: "history", shortcut: "\u2325\u21E7H", onSelect: () => a.askWhoChanged?.(columnId2, rowId) });
2344
2342
  }
@@ -27005,9 +27003,14 @@ function GridBody({
27005
27003
  const editingBusy = editing.busy;
27006
27004
  const addRecord = editing.addRecord;
27007
27005
  const phoneSheetTools = merged && phone ? controls.sheetTools : null;
27006
+ const narrowSearch = merged && !phone && !embedded && searchBox && toolbarFold2 >= 1;
27008
27007
  const tableToolbar = useMemo39(
27009
27008
  () => ({
27010
- search: !embedded,
27009
+ // A NARROW ROW KEEPS ITS SEARCH (member walk 2026-10-10: at 1440 px with the chat panel and the
27010
+ // sidebar open the search field was folded out of sight). Once the row folds anything, the search
27011
+ // becomes the entity-list magnifier that opens into a field, and it rides beside the primary
27012
+ // action — the one place on the row the table never folds away.
27013
+ search: !embedded && !narrowSearch,
27011
27014
  // EMBEDDED: Notion's magnifier — the design system's own search group, a button that
27012
27015
  // opens into a field. It is the same `query.search` the store's read asks.
27013
27016
  ...embedded && searchBox ? {
@@ -27128,18 +27131,29 @@ function GridBody({
27128
27131
  // side chat open it and "From template" both vanished behind the "…"). When the
27129
27132
  // row is short, "From template", undo and the rest ride the "…"; this stays.
27130
27133
  // EMBEDDED: the "+ New page" line under the table is the create action.
27131
- ...!embedded && !readOnly && rights.write ? {
27132
- primary: /* @__PURE__ */ jsx87(
27133
- NewRecordControl,
27134
- {
27135
- tableId,
27136
- noun,
27137
- busy: added.busy,
27138
- onAdd: () => addRowRef.current(),
27139
- onCreated: (id) => formCreatedRef.current(id),
27140
- ask: formAsk
27141
- }
27142
- )
27134
+ ...narrowSearch || !embedded && !readOnly && rights.write ? {
27135
+ primary: /* @__PURE__ */ jsxs77("span", { className: "flex shrink-0 items-center gap-1", "data-records-grid-primary": "", children: [
27136
+ narrowSearch ? /* @__PURE__ */ jsx87("span", { "data-records-grid-narrow-search": "", children: /* @__PURE__ */ jsx87(
27137
+ TapTargetSearchGroup,
27138
+ {
27139
+ surface: "solid",
27140
+ placeholder: "Search records",
27141
+ value: query.search,
27142
+ onValueChange: (term) => setQuery((held) => ({ ...held, search: term, page: 1 }))
27143
+ }
27144
+ ) }) : null,
27145
+ !embedded && !readOnly && rights.write ? /* @__PURE__ */ jsx87(
27146
+ NewRecordControl,
27147
+ {
27148
+ tableId,
27149
+ noun,
27150
+ busy: added.busy,
27151
+ onAdd: () => addRowRef.current(),
27152
+ onCreated: (id) => formCreatedRef.current(id),
27153
+ ask: formAsk
27154
+ }
27155
+ ) : null
27156
+ ] })
27143
27157
  } : {},
27144
27158
  ...phone ? {
27145
27159
  sheetTop: /* @__PURE__ */ jsxs77("div", { className: "flex flex-col gap-1.5 pb-1", "data-records-grid-sheet-top": "", "data-matrx-table-tools-keep-open": "", children: [
@@ -27241,7 +27255,8 @@ function GridBody({
27241
27255
  formAsk,
27242
27256
  searchOverride,
27243
27257
  onSearchChange,
27244
- searchBox
27258
+ searchBox,
27259
+ narrowSearch
27245
27260
  ]
27246
27261
  );
27247
27262
  const labelOfField = useCallback28(
@@ -33109,6 +33124,14 @@ var LOOK_WORDS = {
33109
33124
  folded: "Your look",
33110
33125
  newName: "Name for the new view"
33111
33126
  };
33127
+ var QUESTION_KEYS = ["sorts", "where", "groupField", "swimlaneField"];
33128
+ function lookAfterReset(look) {
33129
+ if (!look) return null;
33130
+ const kept = { ...look };
33131
+ for (const key of QUESTION_KEYS) delete kept[key];
33132
+ for (const key of Object.keys(kept)) if (kept[key] === void 0) delete kept[key];
33133
+ return Object.keys(kept).length > 0 ? kept : null;
33134
+ }
33112
33135
 
33113
33136
  // src/ViewSwitcher.tsx
33114
33137
  import { useEffect as useEffect86, useMemo as useMemo62, useState as useState106 } from "react";
@@ -53505,11 +53528,13 @@ function TablePage({
53505
53528
  setLookRefused(null);
53506
53529
  setViewSaveRefused(null);
53507
53530
  const before = looks?.[current.id];
53531
+ const questionAsked = queryShowing || JSON.stringify(lookAfterReset(before)) !== JSON.stringify(before ?? null);
53532
+ const layoutKept = questionAsked ? lookAfterReset(before) : null;
53508
53533
  setLooks((all) => {
53509
53534
  const { [current.id]: _gone, ...rest } = all ?? {};
53510
- return rest;
53535
+ return layoutKept ? { ...rest, [current.id]: layoutKept } : rest;
53511
53536
  });
53512
- const kept = await keepLook(client, tableId, current.id, null);
53537
+ const kept = await keepLook(client, tableId, current.id, layoutKept);
53513
53538
  if (!kept.ok) {
53514
53539
  setLooks((all) => ({ ...all ?? {}, [current.id]: before ?? {} }));
53515
53540
  setLookRefused(kept.error);