@ai-matrx/records-ui 0.116.45 → 0.116.46

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
@@ -182,7 +182,7 @@ import {
182
182
  withoutAddition,
183
183
  withoutLeadingBlank,
184
184
  workedOutErrorFor
185
- } from "./chunk-F4SAKQKQ.js";
185
+ } from "./chunk-Y5QOV3XA.js";
186
186
  import {
187
187
  CHART_PLOT_PX,
188
188
  EMBEDDED_ROW_PX,
@@ -293,7 +293,7 @@ import {
293
293
  visibilityLaneFor,
294
294
  whyNotAskable,
295
295
  writeOnTheWinningVersion_exports
296
- } from "./chunk-XKI6S5KF.js";
296
+ } from "./chunk-UTMV5ES2.js";
297
297
  import {
298
298
  ACTION_CHECKING_ACCESS_REASON,
299
299
  ACTION_NOT_HERE_REASON,
@@ -402,7 +402,7 @@ import {
402
402
  useRowRights,
403
403
  useTableRights,
404
404
  withoutInternalCodes
405
- } from "./chunk-NKZBAIU4.js";
405
+ } from "./chunk-ZUQUZOL5.js";
406
406
  import {
407
407
  FEWEST_KEY_VALUE_PAIRS,
408
408
  FEWEST_LIST_ITEMS,
@@ -11772,6 +11772,7 @@ function BulkActions({
11772
11772
  noun,
11773
11773
  nounPlural,
11774
11774
  titleKey = null,
11775
+ mayWrite = true,
11775
11776
  onDone
11776
11777
  }) {
11777
11778
  const typeable = useMemo24(() => fields.filter(fieldIsEditable), [fields]);
@@ -11795,12 +11796,12 @@ function BulkActions({
11795
11796
  if (ok) onDone();
11796
11797
  };
11797
11798
  return /* @__PURE__ */ jsxs36(Fragment14, { children: [
11798
- typeable.length > 0 ? /* @__PURE__ */ jsxs36(Fragment14, { children: [
11799
+ mayWrite && typeable.length > 0 ? /* @__PURE__ */ jsxs36(Fragment14, { children: [
11799
11800
  /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "set", disabled: bulk.busy, onClick: () => open("set"), children: "Set a column" }),
11800
11801
  /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "clear", disabled: bulk.busy, onClick: () => open("clear"), children: "Clear a column" }),
11801
11802
  ids.length > 1 ? /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "fill", disabled: bulk.busy, onClick: () => open("fill"), children: "Fill down" }) : null
11802
11803
  ] }) : null,
11803
- /* @__PURE__ */ jsx40(
11804
+ mayWrite ? /* @__PURE__ */ jsx40(
11804
11805
  Button30,
11805
11806
  {
11806
11807
  size: "sm",
@@ -11811,9 +11812,9 @@ function BulkActions({
11811
11812
  onClick: () => void bulk.duplicate(ids).then((ok) => ok ? onDone() : void 0),
11812
11813
  children: "Duplicate"
11813
11814
  }
11814
- ),
11815
+ ) : null,
11815
11816
  /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "print", disabled: bulk.busy, onClick: () => setPrinting(true), children: "Print with layout\u2026" }),
11816
- /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }),
11817
+ mayWrite ? /* @__PURE__ */ jsx40(Button30, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }) : null,
11817
11818
  printing ? /* @__PURE__ */ jsx40(PrintWithLayoutDialog, { tableId, recordIds: ids, names: printNames(ids, rows, titleKey), open: true, onOpenChange: setPrinting }) : null,
11818
11819
  /* @__PURE__ */ jsx40(Dialog14, { open: asking !== null, onOpenChange: (next) => !next ? setAsking(null) : void 0, children: /* @__PURE__ */ jsxs36(DialogContent14, { className: "sm:max-w-md", children: [
11819
11820
  /* @__PURE__ */ jsxs36(DialogHeader14, { children: [
@@ -12783,7 +12784,7 @@ function GridBody({
12783
12784
  versions
12784
12785
  });
12785
12786
  const [selectedIds, setSelectedIds] = useState41([]);
12786
- const offerSelection = !embedded && !readOnly && canWrite && (merged || tableActions2.runnable.length > 0);
12787
+ const offerSelection = !embedded && !readOnly && (merged || canWrite && tableActions2.runnable.length > 0);
12787
12788
  const [reordering, setReordering] = useState41(false);
12788
12789
  const chosenSummaries = localSummaries ?? presentation.summaries ?? NO_SUMMARIES;
12789
12790
  const summaryVersion = useMemo26(
@@ -14399,10 +14400,11 @@ function GridBody({
14399
14400
  noun,
14400
14401
  nounPlural,
14401
14402
  titleKey,
14403
+ mayWrite: canWrite,
14402
14404
  onDone: () => setSelectedIds([])
14403
14405
  }
14404
14406
  ) : null,
14405
- tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
14407
+ canWrite ? tableActions2.runnable.map((action2) => /* @__PURE__ */ jsx44(
14406
14408
  ActionButton,
14407
14409
  {
14408
14410
  action: action2,
@@ -14411,7 +14413,7 @@ function GridBody({
14411
14413
  onPress: () => runner.press(action2, ids)
14412
14414
  },
14413
14415
  action2.id
14414
- ))
14416
+ )) : null
14415
14417
  ] })
14416
14418
  }
14417
14419
  } : embedded ? { selection: false } : {},
@@ -40599,6 +40601,20 @@ function TablePage({
40599
40601
  const [duplicateOpen, setDuplicateOpen] = useState120(false);
40600
40602
  const [referenceOpen, setReferenceOpen] = useState120(false);
40601
40603
  const [subscribeOpen, setSubscribeOpen] = useState120(false);
40604
+ const subscribeDateKey = shown4?.dateField ?? (shown4?.layout === "calendar" && allFields.data ? eligibleFieldFor("date", allFields.data, null).field?.key ?? null : null);
40605
+ const subscribeInCalendar = async () => {
40606
+ const current = view;
40607
+ if (!current || !subscribeDateKey) return;
40608
+ if (current.dateField !== subscribeDateKey) {
40609
+ const written = await saveViewPatch(client, tableId, current.id, { dateField: subscribeDateKey });
40610
+ if (!written.ok) {
40611
+ recordsUi.notify?.error(refusalSentence(written.error));
40612
+ return;
40613
+ }
40614
+ setView({ ...current, dateField: subscribeDateKey });
40615
+ }
40616
+ setSubscribeOpen(true);
40617
+ };
40602
40618
  const [breakDownOpen, setBreakDownOpen] = useState120(false);
40603
40619
  const canGetReference = useCanGetReference();
40604
40620
  const [toolbarSlot, setToolbarSlot] = useState120(null);
@@ -41057,8 +41073,8 @@ function TablePage({
41057
41073
  // THE PRIVATE CALENDAR LINK (CAL-FEED-UI): only where the host bound the doors.
41058
41074
  ...recordsUi.calendarFeed && organizationId ? [
41059
41075
  subscribeCalendarAction({
41060
- ...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !shown4?.dateField ? { disabledReason: "This view has no date field" } : {},
41061
- run: () => void window.setTimeout(() => setSubscribeOpen(true), 0)
41076
+ ...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !subscribeDateKey ? { disabledReason: shown4?.layout === "calendar" ? "This table has no date column" : "Switch this view to Calendar to subscribe" } : {},
41077
+ run: () => void window.setTimeout(() => void subscribeInCalendar(), 0)
41062
41078
  })
41063
41079
  ] : [],
41064
41080
  ...actionHost?.extend ? actionHost.extend(subject, mayDo) : []