@ai-matrx/records-ui 0.116.1 → 0.116.3
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 +35 -1
- package/dist/{chunk-Z6WTP467.js → chunk-32TUVT57.js} +3 -2
- package/dist/chunk-32TUVT57.js.map +1 -0
- package/dist/{chunk-42VA6SWA.js → chunk-TCRNJVGZ.js} +2 -2
- package/dist/{chunk-42VA6SWA.js.map → chunk-TCRNJVGZ.js.map} +1 -1
- package/dist/helpers.cjs +2 -3
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +2 -3
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +2909 -2877
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +174 -143
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +61 -61
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/dist/skeleton.cjs +31 -30
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-Z6WTP467.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
withoutAddition,
|
|
154
154
|
withoutLeadingBlank,
|
|
155
155
|
workedOutErrorFor
|
|
156
|
-
} from "./chunk-
|
|
156
|
+
} from "./chunk-TCRNJVGZ.js";
|
|
157
157
|
import {
|
|
158
158
|
CHART_PLOT_PX,
|
|
159
159
|
RECORDS_GRID_ROW_PX,
|
|
@@ -167,7 +167,7 @@ import {
|
|
|
167
167
|
rememberedRowCount,
|
|
168
168
|
skeletonLayoutFor,
|
|
169
169
|
useRememberedLayout
|
|
170
|
-
} from "./chunk-
|
|
170
|
+
} from "./chunk-32TUVT57.js";
|
|
171
171
|
import {
|
|
172
172
|
DEFAULT_FOOTER,
|
|
173
173
|
EMBEDDED_LOOK,
|
|
@@ -16297,7 +16297,7 @@ import { Button as Button42, cn as cn21 } from "@ai-matrx/design-system";
|
|
|
16297
16297
|
import { tableShapeChanged as tableShapeChanged8, useFieldMutation as useFieldMutation4, useFields as useFields13, useRecord as useRecord2, useRecordsClient as useRecordsClient46, useTable as useTable14 } from "@ai-matrx/records/react";
|
|
16298
16298
|
|
|
16299
16299
|
// src/bodyField.ts
|
|
16300
|
-
import { newerKindOf } from "@ai-matrx/records";
|
|
16300
|
+
import { newerKindOf } from "@ai-matrx/records/field-kinds";
|
|
16301
16301
|
var BODY_NAMES = /^(notes?|page|body|content|page content|details|description)$/i;
|
|
16302
16302
|
function bodyFieldOf(fields) {
|
|
16303
16303
|
const rich = fields.filter((field) => newerKindOf(field) === "rich_text");
|
|
@@ -16763,7 +16763,7 @@ function lookAfterReset(look) {
|
|
|
16763
16763
|
}
|
|
16764
16764
|
|
|
16765
16765
|
// src/ViewSwitcher.tsx
|
|
16766
|
-
import { useEffect as useEffect60, useMemo as
|
|
16766
|
+
import { useEffect as useEffect60, useMemo as useMemo48, useState as useState67 } from "react";
|
|
16767
16767
|
import { mayDrag as mayDrag4, useFields as useFields16, useRecordPage as useRecordPage2, useRecordsClient as useRecordsClient53, useTable as useTable17 } from "@ai-matrx/records/react";
|
|
16768
16768
|
import { isButtonField as isButtonField2, newerKindOf as newerKindOf2, stableFilterKey as stableFilterKey4 } from "@ai-matrx/records";
|
|
16769
16769
|
import { Button as Button51, Select as Select10, SelectContent as SelectContent9, SelectItem as SelectItem9, SelectTrigger as SelectTrigger9, SelectValue as SelectValue9, cn as cn31 } from "@ai-matrx/design-system";
|
|
@@ -17727,6 +17727,7 @@ function batchSentence(moved, waiting, notMoved, label) {
|
|
|
17727
17727
|
}
|
|
17728
17728
|
|
|
17729
17729
|
// src/cardFields.tsx
|
|
17730
|
+
import { useMemo as useMemo38 } from "react";
|
|
17730
17731
|
import { jsx as jsx62, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
17731
17732
|
function isEmptyOnCard(value) {
|
|
17732
17733
|
return value === null || value === void 0 || value === "" || Array.isArray(value) && value.length === 0;
|
|
@@ -17768,11 +17769,13 @@ function CardFieldsPicker({
|
|
|
17768
17769
|
] });
|
|
17769
17770
|
}
|
|
17770
17771
|
function CardFieldsInline({ row, fields }) {
|
|
17772
|
+
const pointing = useMemo38(() => (fields ?? []).filter(pointsAtRecords), [fields]);
|
|
17773
|
+
const labels = useRecordLabels(pointing);
|
|
17771
17774
|
if (!fields || fields.length === 0) return null;
|
|
17772
17775
|
const doc = row.document ?? {};
|
|
17773
|
-
const parts = fields.filter((f) => !isEmptyOnCard(doc[f.key])).map((f) => structuredWordsFor(f, doc[f.key]) ?? scalarText(f, doc[f.key]));
|
|
17776
|
+
const parts = fields.filter((f) => !isEmptyOnCard(doc[f.key])).map((f) => ({ key: f.key, words: structuredWordsFor(f, doc[f.key]) ?? scalarText(f, doc[f.key], labels) }));
|
|
17774
17777
|
if (parts.length === 0) return null;
|
|
17775
|
-
return /* @__PURE__ */ jsx62("span", { className: "min-w-0
|
|
17778
|
+
return /* @__PURE__ */ jsx62("span", { className: "flex h-4 min-w-0 flex-1 basis-0 flex-wrap overflow-hidden leading-4 opacity-75", "data-card-fields-inline": "", title: parts.map((p) => p.words).join(" \xB7 "), children: parts.map((p) => /* @__PURE__ */ jsx62("span", { className: "shrink-0 whitespace-nowrap", "data-card-field-part": p.key, children: ` \xB7 ${p.words}` }, p.key)) });
|
|
17776
17779
|
}
|
|
17777
17780
|
function structuredWordsFor(field, value) {
|
|
17778
17781
|
const s = structuredValueOf(field, value);
|
|
@@ -17780,7 +17783,7 @@ function structuredWordsFor(field, value) {
|
|
|
17780
17783
|
}
|
|
17781
17784
|
|
|
17782
17785
|
// src/CalendarView.tsx
|
|
17783
|
-
import { useEffect as useEffect50, useMemo as
|
|
17786
|
+
import { useEffect as useEffect50, useMemo as useMemo40, useRef as useRef26, useState as useState57 } from "react";
|
|
17784
17787
|
import { mayDrag as mayDrag2 } from "@ai-matrx/records/react";
|
|
17785
17788
|
import { Button as Button46, Select as Select4, SelectContent as SelectContent3, SelectItem as SelectItem3, SelectTrigger as SelectTrigger3, SelectValue as SelectValue3, cn as cn24 } from "@ai-matrx/design-system";
|
|
17786
17789
|
import { CHOICE_CHIP_CLASS } from "@ai-matrx/design-system/data-table";
|
|
@@ -17820,12 +17823,12 @@ function useReaderWeekStart() {
|
|
|
17820
17823
|
}
|
|
17821
17824
|
|
|
17822
17825
|
// src/rowColorBy.tsx
|
|
17823
|
-
import { useMemo as
|
|
17826
|
+
import { useMemo as useMemo39 } from "react";
|
|
17824
17827
|
import { EMPTY_TABLE_STYLE, resolveRowColor as resolveRowColor2 } from "@ai-matrx/design-system/data-table";
|
|
17825
17828
|
function useRowColorBy(all, colorKey, style) {
|
|
17826
17829
|
const colorField = all.find((f) => f.key === colorKey);
|
|
17827
17830
|
const options = useChoiceOptions(all, colorField && isChoiceField(colorField) ? [colorField.key] : []);
|
|
17828
|
-
return
|
|
17831
|
+
return useMemo39(() => {
|
|
17829
17832
|
const lookup = (key, value) => {
|
|
17830
17833
|
const first = Array.isArray(value) ? value[0] : value;
|
|
17831
17834
|
return optionFor(options.get(key), first)?.color ?? (colorField ? storedChoiceColor(colorField, first) : void 0) ?? colorFromTheValue(key, first);
|
|
@@ -18093,12 +18096,12 @@ function CalendarView({
|
|
|
18093
18096
|
usePersonTimeZone();
|
|
18094
18097
|
const [anchor, setAnchor] = useState57(initialDate ?? dayKey(personWallNow()));
|
|
18095
18098
|
const [openDay, setOpenDay] = useState57(null);
|
|
18096
|
-
const titleFields =
|
|
18099
|
+
const titleFields = useMemo40(() => titleField ? [titleField] : [], [titleField]);
|
|
18097
18100
|
const labels = useRecordLabels(titleFields);
|
|
18098
18101
|
const all = fields ?? [];
|
|
18099
18102
|
const moments = holdsMoments(dateField);
|
|
18100
18103
|
const snap = (minutes) => snapTo(minutes, snapMinutes);
|
|
18101
|
-
const otherDates =
|
|
18104
|
+
const otherDates = useMemo40(
|
|
18102
18105
|
() => eligibleFieldFor("date", all, null, { far: farFields }).eligible.filter((f) => f.key !== dateField.key),
|
|
18103
18106
|
[all, farFields, dateField.key]
|
|
18104
18107
|
);
|
|
@@ -18110,7 +18113,7 @@ function CalendarView({
|
|
|
18110
18113
|
const endWorkedOut = isComputedField(endField);
|
|
18111
18114
|
const canMove = (row) => mayDrag2(row.level) && !startWorkedOut;
|
|
18112
18115
|
const creates = canCreate && !startWorkedOut;
|
|
18113
|
-
const choiceFields =
|
|
18116
|
+
const choiceFields = useMemo40(() => eligibleFieldFor("choice", all).eligible.filter(isChoiceField), [all]);
|
|
18114
18117
|
const [colorPick, setColorPick] = useState57(void 0);
|
|
18115
18118
|
const colorKey = colorPick !== void 0 ? colorPick : style?.colorBy?.field ?? choiceFields[0]?.key ?? null;
|
|
18116
18119
|
const colorOf = useRowColorBy(all, colorKey, style);
|
|
@@ -18122,7 +18125,7 @@ function CalendarView({
|
|
|
18122
18125
|
}, [undoneCount]);
|
|
18123
18126
|
const startOf = (row) => placedOver.has(row.id) ? placedOver.get(row.id).start : (row.document ?? {})[dateField.key];
|
|
18124
18127
|
const endOf = (row) => endField ? placedOver.has(row.id) ? placedOver.get(row.id).end : (row.document ?? {})[endField.key] : null;
|
|
18125
|
-
const { placed, undated } =
|
|
18128
|
+
const { placed, undated } = useMemo40(() => {
|
|
18126
18129
|
const out = [];
|
|
18127
18130
|
const without = [];
|
|
18128
18131
|
for (const row of rows) {
|
|
@@ -18458,7 +18461,7 @@ function CalendarView({
|
|
|
18458
18461
|
if (mode === "month") {
|
|
18459
18462
|
const first = startOfWeek(dayKey(new Date(anchorDate.getFullYear(), anchorDate.getMonth(), 1)), firstDay);
|
|
18460
18463
|
const weeks = Array.from({ length: 6 }, (_, w) => addDays2(first, w * 7));
|
|
18461
|
-
body = /* @__PURE__ */ jsx63("div", { className: "min-w-0 flex-1 overflow-x-auto", children: /* @__PURE__ */ jsxs57("div", { className: "min-w-
|
|
18464
|
+
body = /* @__PURE__ */ jsx63("div", { className: "min-w-0 flex-1 overflow-x-auto", children: /* @__PURE__ */ jsxs57("div", { className: "w-full min-w-0 border-l border-t", role: "grid", "aria-label": heading, "data-calendar-month": "", children: [
|
|
18462
18465
|
/* @__PURE__ */ jsx63("div", { className: "grid grid-cols-7", role: "row", children: Array.from({ length: 7 }, (_, i) => addDays2(first, i)).map((d) => /* @__PURE__ */ jsx63("div", { role: "columnheader", className: "border-b border-r px-1 py-0.5 text-center text-xs text-muted-foreground", children: dayDate(d).toLocaleDateString(void 0, { weekday: "short" }) }, `h${d}`)) }),
|
|
18463
18466
|
weeks.map((ws) => /* @__PURE__ */ jsx63(
|
|
18464
18467
|
MonthWeek,
|
|
@@ -18498,8 +18501,8 @@ function CalendarView({
|
|
|
18498
18501
|
return { p, start, end: Math.min(start + Math.max(minutes, snapMinutes), 24 * 60) };
|
|
18499
18502
|
})
|
|
18500
18503
|
);
|
|
18501
|
-
const columns = `
|
|
18502
|
-
body = /* @__PURE__ */ jsx63("div", { className: "min-w-0 flex-1 overflow-x-auto", children: /* @__PURE__ */ jsxs57("div", { className:
|
|
18504
|
+
const columns = `2.75rem repeat(${days.length}, minmax(0, 1fr))`;
|
|
18505
|
+
body = /* @__PURE__ */ jsx63("div", { className: "min-w-0 flex-1 overflow-x-auto", children: /* @__PURE__ */ jsxs57("div", { className: "w-full min-w-0 border-l border-t", "data-calendar-week": "", "data-calendar-days": days.length, children: [
|
|
18503
18506
|
/* @__PURE__ */ jsxs57("div", { className: "grid", style: { gridTemplateColumns: columns }, children: [
|
|
18504
18507
|
/* @__PURE__ */ jsx63("div", { className: "border-b border-r" }),
|
|
18505
18508
|
days.map((d) => /* @__PURE__ */ jsx63("div", { className: cn24("border-b border-r px-1 py-0.5 text-center text-xs", d === today ? "font-semibold text-primary" : "text-muted-foreground"), children: dayDate(d).toLocaleDateString(void 0, { weekday: "short", day: "numeric" }) }, `h${d}`)),
|
|
@@ -18587,7 +18590,7 @@ function CalendarView({
|
|
|
18587
18590
|
"div",
|
|
18588
18591
|
{
|
|
18589
18592
|
ref: frame,
|
|
18590
|
-
className: cn24("relative flex min-h-0 flex-col gap-2", className),
|
|
18593
|
+
className: cn24("relative flex min-h-0 w-full min-w-0 max-w-full flex-col gap-2", className),
|
|
18591
18594
|
"data-calendar-mode": mode,
|
|
18592
18595
|
onKeyDown: moves.onKeyDown,
|
|
18593
18596
|
onDragLeave: (e) => {
|
|
@@ -18596,7 +18599,7 @@ function CalendarView({
|
|
|
18596
18599
|
children: [
|
|
18597
18600
|
note ? /* @__PURE__ */ jsx63("p", { className: "text-xs text-muted-foreground", children: note }) : null,
|
|
18598
18601
|
toolbar,
|
|
18599
|
-
/* @__PURE__ */ jsxs57("div", { className: "flex min-h-0 flex-col gap-3 sm:flex-row", children: [
|
|
18602
|
+
/* @__PURE__ */ jsxs57("div", { className: "flex min-h-0 min-w-0 max-w-full flex-col gap-3 sm:flex-row", children: [
|
|
18600
18603
|
body,
|
|
18601
18604
|
tray
|
|
18602
18605
|
] }),
|
|
@@ -18652,7 +18655,7 @@ function MonthWeek({
|
|
|
18652
18655
|
"aria-label": calendarDayLabel(d),
|
|
18653
18656
|
"data-calendar-day": d,
|
|
18654
18657
|
className: cn24(
|
|
18655
|
-
"group relative flex min-h-24 flex-col gap-0.5 border-b border-r p-0.5",
|
|
18658
|
+
"group relative flex min-h-24 min-w-0 flex-col gap-0.5 border-b border-r p-0.5",
|
|
18656
18659
|
inMonth ? "" : "bg-muted/40",
|
|
18657
18660
|
ghostDay === d ? "bg-primary/10 ring-2 ring-inset ring-primary" : "",
|
|
18658
18661
|
canCreate ? "cursor-cell" : ""
|
|
@@ -18791,7 +18794,7 @@ function weekHeading(first) {
|
|
|
18791
18794
|
}
|
|
18792
18795
|
|
|
18793
18796
|
// src/TimelineView.tsx
|
|
18794
|
-
import { useEffect as useEffect51, useMemo as
|
|
18797
|
+
import { useEffect as useEffect51, useMemo as useMemo41, useRef as useRef27, useState as useState58 } from "react";
|
|
18795
18798
|
import { mayDrag as mayDrag3 } from "@ai-matrx/records/react";
|
|
18796
18799
|
import { DropdownMenu as DropdownMenu7, DropdownMenuCheckboxItem as DropdownMenuCheckboxItem2, DropdownMenuContent as DropdownMenuContent7, DropdownMenuItem as DropdownMenuItem6, DropdownMenuRadioGroup as DropdownMenuRadioGroup2, DropdownMenuRadioItem as DropdownMenuRadioItem2, DropdownMenuSeparator as DropdownMenuSeparator3, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger as DropdownMenuTrigger7, Button as Button47, Select as Select5, SelectContent as SelectContent4, SelectItem as SelectItem4, SelectTrigger as SelectTrigger4, SelectValue as SelectValue4, cn as cn25 } from "@ai-matrx/design-system";
|
|
18797
18800
|
import { CHOICE_CHIP_CLASS as CHOICE_CHIP_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
@@ -19053,23 +19056,23 @@ function TimelineView({
|
|
|
19053
19056
|
usePersonTimeZone();
|
|
19054
19057
|
const today = dayKeyOf(personWallNow());
|
|
19055
19058
|
const [anchor, setAnchor] = useState58(initialDate ?? today);
|
|
19056
|
-
const dates =
|
|
19059
|
+
const dates = useMemo41(() => offerableFields(fields, "date", { far: farFields }), [fields, farFields]);
|
|
19057
19060
|
const has = (list, key) => key && list.some((f) => f.key === key) ? key : null;
|
|
19058
19061
|
const [picked, setPicked] = useState58({});
|
|
19059
19062
|
useEffect51(() => setPicked({}), [startKey, endKey, groupKey, colorKey]);
|
|
19060
19063
|
const named = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
19061
19064
|
const startChosen = "startKey" in picked ? picked.startKey ?? null : has(dates, startKey) ?? named(startKey) ?? onlyCandidate(dates);
|
|
19062
|
-
const endCandidates =
|
|
19063
|
-
const baselineKeys =
|
|
19064
|
-
const endAutoCandidates =
|
|
19065
|
-
const endAuto =
|
|
19065
|
+
const endCandidates = useMemo41(() => dates.filter((f) => f.key !== startChosen), [dates, startChosen]);
|
|
19066
|
+
const baselineKeys = useMemo41(() => new Set([gantt?.baselineStart ?? "baseline_start", gantt?.baselineEnd ?? "baseline_end"].filter((k) => Boolean(k))), [gantt]);
|
|
19067
|
+
const endAutoCandidates = useMemo41(() => endCandidates.filter((f) => !baselineKeys.has(f.key)), [endCandidates, baselineKeys]);
|
|
19068
|
+
const endAuto = useMemo41(() => {
|
|
19066
19069
|
const only = onlyCandidate(endAutoCandidates);
|
|
19067
19070
|
return only && startChosen && endFollowsStart(rows, startChosen, only) ? only : null;
|
|
19068
19071
|
}, [endAutoCandidates, rows, startChosen]);
|
|
19069
19072
|
const endChosen = "endKey" in picked ? picked.endKey ?? null : has(endCandidates, endKey) ?? (endKey !== startChosen ? named(endKey) : null) ?? (endKey === void 0 ? endAuto : null);
|
|
19070
|
-
const groupCandidates =
|
|
19073
|
+
const groupCandidates = useMemo41(() => groupableFields(fields), [fields]);
|
|
19071
19074
|
const groupChosen = "groupKey" in picked ? picked.groupKey ?? null : has(groupCandidates, groupKey);
|
|
19072
|
-
const choiceFields =
|
|
19075
|
+
const choiceFields = useMemo41(() => fields.filter(isChoiceField), [fields]);
|
|
19073
19076
|
const colorChosen = "colorKey" in picked ? picked.colorKey ?? null : has(choiceFields, colorKey) ?? (colorKey === void 0 ? has(choiceFields, style?.colorBy?.field) ?? onlyCandidate(choiceFields) : null);
|
|
19074
19077
|
const setting = (patch) => {
|
|
19075
19078
|
setPicked((held) => ({ ...held, ...patch }));
|
|
@@ -19092,13 +19095,13 @@ function TimelineView({
|
|
|
19092
19095
|
const endWorkedOut = isComputedField(endField);
|
|
19093
19096
|
const canMove = (row) => mayDrag3(row.level) && !startWorkedOut;
|
|
19094
19097
|
const colorOf = useRowColorBy(fields, colorChosen, style);
|
|
19095
|
-
const depField =
|
|
19098
|
+
const depField = useMemo41(() => dependencyFieldOf(fields, tableId), [fields, tableId]);
|
|
19096
19099
|
const progressField = fields.find((f) => f.key === g.progress);
|
|
19097
19100
|
const milestoneField = fields.find((f) => f.key === g.milestone);
|
|
19098
19101
|
const baseStartField = fields.find((f) => f.key === (g.baselineStart ?? "baseline_start")) ?? null;
|
|
19099
19102
|
const baseEndField = fields.find((f) => f.key === (g.baselineEnd ?? "baseline_end")) ?? null;
|
|
19100
|
-
const progressCandidates =
|
|
19101
|
-
const milestoneCandidates =
|
|
19103
|
+
const progressCandidates = useMemo41(() => fields.filter((f) => PROGRESS_KINDS.has(String(editorKindFor(f))) && !isComputedField(f)), [fields]);
|
|
19104
|
+
const milestoneCandidates = useMemo41(() => fields.filter((f) => String(editorKindFor(f)) === "checkbox" || String(editorKindFor(f)) === "boolean"), [fields]);
|
|
19102
19105
|
const knobClient = useOptionalRecordsClient4();
|
|
19103
19106
|
const [shiftDependents, setShiftDependents] = useState58(true);
|
|
19104
19107
|
useEffect51(() => {
|
|
@@ -19112,7 +19115,7 @@ function TimelineView({
|
|
|
19112
19115
|
};
|
|
19113
19116
|
}, [depField, knobClient]);
|
|
19114
19117
|
const dependents = (id) => depField && shiftDependents ? dependentsOf(rows, depField.key, id) : [];
|
|
19115
|
-
const labelFields =
|
|
19118
|
+
const labelFields = useMemo41(() => [titleField, groupField].filter((f) => Boolean(f)), [titleField, groupField]);
|
|
19116
19119
|
const labels = useRecordLabels(labelFields);
|
|
19117
19120
|
const titleOf = (row) => cardWords(row, titleField, labels).text;
|
|
19118
19121
|
const groupOptions = useChoiceOptions(fields, groupField && isChoiceField(groupField) ? [groupField.key] : []).get(groupField?.key ?? "");
|
|
@@ -19128,7 +19131,7 @@ function TimelineView({
|
|
|
19128
19131
|
const [linking, setLinking] = useState58(null);
|
|
19129
19132
|
const [ganttBusy, setGanttBusy] = useState58(false);
|
|
19130
19133
|
const [linkTarget, setLinkTarget] = useState58(null);
|
|
19131
|
-
const { placed, unscheduled } =
|
|
19134
|
+
const { placed, unscheduled } = useMemo41(() => {
|
|
19132
19135
|
const out = [];
|
|
19133
19136
|
const without = [];
|
|
19134
19137
|
for (const row of rows) {
|
|
@@ -19146,7 +19149,7 @@ function TimelineView({
|
|
|
19146
19149
|
}
|
|
19147
19150
|
return { placed: out, unscheduled: without };
|
|
19148
19151
|
}, [rows, startField?.key, endField?.key, placedOver, ganttOn, milestoneField?.key]);
|
|
19149
|
-
const draggedAlong =
|
|
19152
|
+
const draggedAlong = useMemo41(
|
|
19150
19153
|
() => new Set(dragging && dragging.part === "move" && dragging.days !== 0 ? dependents(dragging.id) : []),
|
|
19151
19154
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19152
19155
|
[dragging?.id, dragging?.part, dragging?.days !== 0, rows, depField, shiftDependents]
|
|
@@ -19163,17 +19166,17 @@ function TimelineView({
|
|
|
19163
19166
|
const last = addDays(p.last, d);
|
|
19164
19167
|
return { first: p.first, last: last < p.first ? p.first : last };
|
|
19165
19168
|
};
|
|
19166
|
-
const waitsOnMap =
|
|
19169
|
+
const waitsOnMap = useMemo41(() => {
|
|
19167
19170
|
const map = /* @__PURE__ */ new Map();
|
|
19168
19171
|
if (depField) for (const row of rows) map.set(row.id, waitsOnIds((row.document ?? {})[depField.key]));
|
|
19169
19172
|
return map;
|
|
19170
19173
|
}, [rows, depField]);
|
|
19171
|
-
const critical =
|
|
19174
|
+
const critical = useMemo41(
|
|
19172
19175
|
() => ganttOn && g.critical && depField ? criticalPath(placed.map((p) => ({ id: p.row.id, first: p.first, last: p.last })), waitsOnMap) : null,
|
|
19173
19176
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
19174
19177
|
[ganttOn, g.critical, depField, placed, waitsOnMap]
|
|
19175
19178
|
);
|
|
19176
|
-
const criticalIds =
|
|
19179
|
+
const criticalIds = useMemo41(() => new Set(critical?.ids ?? []), [critical]);
|
|
19177
19180
|
const baselineOf = (row) => ganttOn && baseStartField ? baselineSpan(calendarDayOf((row.document ?? {})[baseStartField.key]), baseEndField ? calendarDayOf((row.document ?? {})[baseEndField.key]) : null) : null;
|
|
19178
19181
|
const commit = async (row, patch, label) => {
|
|
19179
19182
|
const doc = row.document ?? {};
|
|
@@ -19380,7 +19383,7 @@ function TimelineView({
|
|
|
19380
19383
|
const from = windowStart(anchor, zoom, firstDay);
|
|
19381
19384
|
const days = WINDOW[zoom].days;
|
|
19382
19385
|
const width = days * px;
|
|
19383
|
-
const scale =
|
|
19386
|
+
const scale = useMemo41(() => scaleOf(from, days, zoom, firstDay), [from, days, zoom, firstDay]);
|
|
19384
19387
|
const xOf = (day2) => daysBetween(from, day2) * px;
|
|
19385
19388
|
const scroller = useRef27(null);
|
|
19386
19389
|
const grouped = Boolean(groupField) && !ganttOn;
|
|
@@ -19401,7 +19404,7 @@ function TimelineView({
|
|
|
19401
19404
|
el.scrollLeft = Math.max(0, xOf(anchor) - (el.clientWidth - label) / 4);
|
|
19402
19405
|
setScrollX(el.scrollLeft);
|
|
19403
19406
|
}, [anchor, zoom, hasLabel]);
|
|
19404
|
-
const lanes =
|
|
19407
|
+
const lanes = useMemo41(() => {
|
|
19405
19408
|
if (!groupField || ganttOn) return [{ key: "all", label: "", color: void 0, bars: placed }];
|
|
19406
19409
|
const order = (groupOptions ?? []).map((o) => o.label);
|
|
19407
19410
|
const map = new Map(order.map((name) => [name, []]));
|
|
@@ -19420,14 +19423,14 @@ function TimelineView({
|
|
|
19420
19423
|
}, [groupField, groupOptions, placed, labels, ganttOn]);
|
|
19421
19424
|
const laneChangeAllowed = Boolean(groupField && fieldIsEditable(groupField));
|
|
19422
19425
|
const laneLocked = groupField && !laneChangeAllowed ? `${fieldName(groupField)} is worked out, so a bar keeps its row.` : null;
|
|
19423
|
-
const holdsKeys =
|
|
19426
|
+
const holdsKeys = useMemo41(
|
|
19424
19427
|
() => Boolean(groupField) && (groupOptions ?? []).length > 0 && rows.some((row) => {
|
|
19425
19428
|
const v = (row.document ?? {})[groupField.key];
|
|
19426
19429
|
return (Array.isArray(v) ? v : [v]).some((x) => (groupOptions ?? []).some((o) => o.key === x && o.id !== x));
|
|
19427
19430
|
}),
|
|
19428
19431
|
[rows, groupOptions, groupField]
|
|
19429
19432
|
);
|
|
19430
|
-
const heldIn =
|
|
19433
|
+
const heldIn = useMemo41(() => {
|
|
19431
19434
|
const out = /* @__PURE__ */ new Map();
|
|
19432
19435
|
if (!groupField) return out;
|
|
19433
19436
|
for (const row of rows) {
|
|
@@ -20293,7 +20296,7 @@ function BoardOptions({
|
|
|
20293
20296
|
}
|
|
20294
20297
|
|
|
20295
20298
|
// src/ListView.tsx
|
|
20296
|
-
import { useMemo as
|
|
20299
|
+
import { useMemo as useMemo42 } from "react";
|
|
20297
20300
|
import { Select as Select6, SelectContent as SelectContent5, SelectItem as SelectItem5, SelectTrigger as SelectTrigger5, SelectValue as SelectValue5, cn as cn26 } from "@ai-matrx/design-system";
|
|
20298
20301
|
import { resolveRowColor as resolveRowColor3, ROW_TINT_CLASS as ROW_TINT_CLASS2 } from "@ai-matrx/design-system/data-table";
|
|
20299
20302
|
import { jsx as jsx68, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
@@ -20333,7 +20336,7 @@ function ListView({
|
|
|
20333
20336
|
}) {
|
|
20334
20337
|
const groupField = grouping?.field ? fields.find((f) => f.key === grouping.field) : void 0;
|
|
20335
20338
|
const groupKey = groupField?.key ?? null;
|
|
20336
|
-
const groups =
|
|
20339
|
+
const groups = useMemo42(() => listGroups(rows, groupKey), [rows, groupKey]);
|
|
20337
20340
|
const shown4 = cardFieldsShown(fields, hiddenFields, [titleField?.key, groupKey]);
|
|
20338
20341
|
const chose = hiddenFields !== void 0;
|
|
20339
20342
|
const moves = useRecordMoves({ tableId, rows, ...onMoved ? { onMoved } : {} });
|
|
@@ -20431,7 +20434,7 @@ function ListRow({
|
|
|
20431
20434
|
style,
|
|
20432
20435
|
onOpenRecord
|
|
20433
20436
|
}) {
|
|
20434
|
-
const wanted =
|
|
20437
|
+
const wanted = useMemo42(() => titleField && pointsAtRecords(titleField) ? [titleField] : NO_FIELDS, [titleField]);
|
|
20435
20438
|
const labels = useRecordLabels(wanted);
|
|
20436
20439
|
const { text: title, withheld } = cardWords(row, titleField, labels);
|
|
20437
20440
|
const doc = row.document ?? {};
|
|
@@ -20474,13 +20477,13 @@ function ListRow({
|
|
|
20474
20477
|
}
|
|
20475
20478
|
|
|
20476
20479
|
// src/ChartLayout.tsx
|
|
20477
|
-
import { useEffect as useEffect57, useMemo as
|
|
20480
|
+
import { useEffect as useEffect57, useMemo as useMemo45, useState as useState64 } from "react";
|
|
20478
20481
|
import { useRecordsClient as useRecordsClient52 } from "@ai-matrx/records/react";
|
|
20479
20482
|
import { fieldKindFor, measureKey as measureKey4 } from "@ai-matrx/records";
|
|
20480
20483
|
import { Select as Select7, SelectContent as SelectContent6, SelectItem as SelectItem6, SelectTrigger as SelectTrigger6, SelectValue as SelectValue6 } from "@ai-matrx/design-system";
|
|
20481
20484
|
|
|
20482
20485
|
// src/ChartBlock.tsx
|
|
20483
|
-
import { useMemo as
|
|
20486
|
+
import { useMemo as useMemo44 } from "react";
|
|
20484
20487
|
import {
|
|
20485
20488
|
Bar,
|
|
20486
20489
|
BarChart,
|
|
@@ -20504,7 +20507,7 @@ import { cn as cn28 } from "@ai-matrx/design-system";
|
|
|
20504
20507
|
import { formatCount as formatCount4 } from "@ai-matrx/kit/format";
|
|
20505
20508
|
|
|
20506
20509
|
// src/linkWords.ts
|
|
20507
|
-
import { useEffect as useEffect54, useMemo as
|
|
20510
|
+
import { useEffect as useEffect54, useMemo as useMemo43, useState as useState61 } from "react";
|
|
20508
20511
|
import { useOptionalRecordsClient as useOptionalRecordsClient6 } from "@ai-matrx/records/react";
|
|
20509
20512
|
|
|
20510
20513
|
// src/charts.ts
|
|
@@ -20750,7 +20753,7 @@ function useLinkGroupNamer(block, tableId) {
|
|
|
20750
20753
|
cancelled = true;
|
|
20751
20754
|
};
|
|
20752
20755
|
}, [client, ask2]);
|
|
20753
|
-
return
|
|
20756
|
+
return useMemo43(() => {
|
|
20754
20757
|
if (Object.keys(named).length === 0 && choices.length === 0) return void 0;
|
|
20755
20758
|
return (key, value) => {
|
|
20756
20759
|
const choice = choices.find((f) => f.key === key);
|
|
@@ -20989,7 +20992,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
20989
20992
|
const target = kind2 === "stuck" ? null : block.target ?? null;
|
|
20990
20993
|
const named = useLinkGroupNamer(source ? NO_GROUPS : block, tableId);
|
|
20991
20994
|
const measureName = useMeasureWords(primary, tableId);
|
|
20992
|
-
const points =
|
|
20995
|
+
const points = useMemo44(() => {
|
|
20993
20996
|
if (kind2 === "stuck") return [];
|
|
20994
20997
|
const rows = block.rows ?? [];
|
|
20995
20998
|
return rows.map((row, index) => {
|
|
@@ -21013,7 +21016,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
21013
21016
|
};
|
|
21014
21017
|
});
|
|
21015
21018
|
}, [block.rows, kind2, primary, compared, grain, windows, named]);
|
|
21016
|
-
const config =
|
|
21019
|
+
const config = useMemo44(() => {
|
|
21017
21020
|
const out = {};
|
|
21018
21021
|
out[primary] = {
|
|
21019
21022
|
label: windows ? windowName(windows.window, windows.period) : measureName,
|
|
@@ -21091,7 +21094,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
21091
21094
|
...centerValue ? { center: points.reduce((sum, p) => sum + (p.values[primary] ?? 0), 0) } : {}
|
|
21092
21095
|
}
|
|
21093
21096
|
),
|
|
21094
|
-
/* @__PURE__ */ jsx70(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
|
|
21097
|
+
kind2 === "donut" ? null : /* @__PURE__ */ jsx70(Values, { points, measure: primary, config, onDrill: drill, compared, aimingUp: !!target })
|
|
21095
21098
|
] }) })
|
|
21096
21099
|
]
|
|
21097
21100
|
}
|
|
@@ -21279,6 +21282,17 @@ function WrappedTick(props) {
|
|
|
21279
21282
|
}
|
|
21280
21283
|
);
|
|
21281
21284
|
}
|
|
21285
|
+
function DonutTooltip({ active, payload, total }) {
|
|
21286
|
+
const entry = payload?.[0];
|
|
21287
|
+
if (!active || !entry) return null;
|
|
21288
|
+
const value = typeof entry.value === "number" ? entry.value : Number(entry.value ?? 0);
|
|
21289
|
+
return /* @__PURE__ */ jsxs63("div", { className: "flex items-center gap-2 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", "data-records-donut-tooltip": "", children: [
|
|
21290
|
+
/* @__PURE__ */ jsx70("span", { className: "h-2.5 w-2.5 shrink-0 rounded-[2px]", style: { background: entry.payload?.fill ?? SERIES_COLORS[0] } }),
|
|
21291
|
+
/* @__PURE__ */ jsx70("span", { className: "text-muted-foreground", children: String(entry.name ?? "") }),
|
|
21292
|
+
/* @__PURE__ */ jsx70("span", { className: "ml-auto font-mono font-medium tabular-nums text-foreground", children: pretty(value) }),
|
|
21293
|
+
/* @__PURE__ */ jsx70("span", { className: "font-mono tabular-nums text-muted-foreground", children: total > 0 ? `${Math.round(value / total * 1e3) / 10}%` : "" })
|
|
21294
|
+
] });
|
|
21295
|
+
}
|
|
21282
21296
|
function Drawing({
|
|
21283
21297
|
kind: kind2,
|
|
21284
21298
|
points,
|
|
@@ -21318,34 +21332,51 @@ function Drawing({
|
|
|
21318
21332
|
const tooltip = /* @__PURE__ */ jsx70(Tooltip, { content: /* @__PURE__ */ jsx70(ChartTooltipContent, { config }), cursor: false });
|
|
21319
21333
|
const legend = series.length > 1 ? /* @__PURE__ */ jsx70(Legend, { content: /* @__PURE__ */ jsx70(ChartLegendContent, { config }) }) : null;
|
|
21320
21334
|
if (kind2 === "donut") {
|
|
21321
|
-
const
|
|
21322
|
-
|
|
21335
|
+
const total = points.reduce((sum, p) => sum + (p.values[series[0]] ?? 0), 0);
|
|
21336
|
+
const ring = /* @__PURE__ */ jsx70(ChartFrame, { config, height: HEIGHT, className: "w-[140px] shrink-0", children: (width) => /* @__PURE__ */ jsxs63(PieChart, { width, height: HEIGHT, children: [
|
|
21337
|
+
/* @__PURE__ */ jsx70(Tooltip, { content: /* @__PURE__ */ jsx70(DonutTooltip, { total }) }),
|
|
21323
21338
|
/* @__PURE__ */ jsx70(
|
|
21324
21339
|
Pie,
|
|
21325
21340
|
{
|
|
21326
21341
|
data,
|
|
21327
21342
|
dataKey: series[0],
|
|
21328
21343
|
nameKey: "label",
|
|
21329
|
-
innerRadius:
|
|
21330
|
-
outerRadius:
|
|
21344
|
+
innerRadius: 44,
|
|
21345
|
+
outerRadius: 66,
|
|
21346
|
+
paddingAngle: points.length > 1 ? 1 : 0,
|
|
21331
21347
|
isAnimationActive: false,
|
|
21332
21348
|
...click ? { onClick: click, className: "cursor-pointer" } : {},
|
|
21333
|
-
children: points.map((point, at) => /* @__PURE__ */ jsx70(Cell, { fill: String(config[point.label]?.color ?? SERIES_COLORS[
|
|
21349
|
+
children: points.map((point, at) => /* @__PURE__ */ jsx70(Cell, { fill: String(config[point.label]?.color ?? SERIES_COLORS[at % SERIES_COLORS.length]) }, `${at}:${point.label}`))
|
|
21334
21350
|
}
|
|
21335
21351
|
)
|
|
21336
21352
|
] }) });
|
|
21337
|
-
|
|
21338
|
-
return /* @__PURE__ */ jsxs63("div", { className: "relative", children: [
|
|
21353
|
+
const ringWithCenter = center === void 0 ? ring : /* @__PURE__ */ jsxs63("div", { className: "relative shrink-0", style: { width: 140 }, children: [
|
|
21339
21354
|
ring,
|
|
21340
21355
|
/* @__PURE__ */ jsx70(
|
|
21341
21356
|
"span",
|
|
21342
21357
|
{
|
|
21343
|
-
className: "pointer-events-none absolute inset-0 flex items-center justify-center
|
|
21358
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center px-6 font-semibold tabular-nums",
|
|
21344
21359
|
"data-records-chart-center": "",
|
|
21345
|
-
|
|
21360
|
+
title: pretty(center),
|
|
21361
|
+
style: { fontSize: pretty(center).length > 6 ? 13 : 16 },
|
|
21362
|
+
children: pretty(center).length > 7 ? compactTick(center) : pretty(center)
|
|
21346
21363
|
}
|
|
21347
21364
|
)
|
|
21348
21365
|
] });
|
|
21366
|
+
return /* @__PURE__ */ jsxs63("div", { className: "flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2", "data-records-donut": "", children: [
|
|
21367
|
+
ringWithCenter,
|
|
21368
|
+
/* @__PURE__ */ jsx70("ul", { className: "flex min-w-[8rem] flex-1 basis-40 flex-col gap-0.5 overflow-y-auto", style: { maxHeight: HEIGHT }, "data-records-donut-legend": "", children: points.map((point, at) => {
|
|
21369
|
+
const value = point.values[series[0]] ?? 0;
|
|
21370
|
+
const share = total > 0 ? Math.round(value / total * 1e3) / 10 : 0;
|
|
21371
|
+
const row = /* @__PURE__ */ jsxs63(Fragment27, { children: [
|
|
21372
|
+
/* @__PURE__ */ jsx70("span", { className: "h-2.5 w-2.5 shrink-0 rounded-[2px]", style: { background: String(config[point.label]?.color ?? SERIES_COLORS[at % SERIES_COLORS.length]) } }),
|
|
21373
|
+
/* @__PURE__ */ jsx70("span", { className: "min-w-0 flex-1 truncate", title: point.label, children: point.label }),
|
|
21374
|
+
/* @__PURE__ */ jsx70("span", { className: "tabular-nums", "data-records-donut-value": "", children: pretty(value) }),
|
|
21375
|
+
/* @__PURE__ */ jsx70("span", { className: "w-10 shrink-0 text-right tabular-nums text-muted-foreground", "data-records-donut-share": "", children: `${share}%` })
|
|
21376
|
+
] });
|
|
21377
|
+
return /* @__PURE__ */ jsx70("li", { className: "min-w-0 text-xs", children: onDrill ? /* @__PURE__ */ jsx70("button", { type: "button", className: "flex w-full min-w-0 items-center gap-2 rounded px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", onClick: () => onDrill(point), children: row }) : /* @__PURE__ */ jsx70("span", { className: "flex w-full min-w-0 items-center gap-2 px-1 py-0.5", children: row }) }, `${at}:${point.label}`);
|
|
21378
|
+
}) })
|
|
21379
|
+
] });
|
|
21349
21380
|
}
|
|
21350
21381
|
if (kind2 === "line") {
|
|
21351
21382
|
return /* @__PURE__ */ jsx70(ChartFrame, { config, height: HEIGHT, children: (width) => /* @__PURE__ */ jsxs63(LineChart, { width, height: HEIGHT, data, margin: { top: 6, right: 6, bottom: 0, left: 0 }, children: [
|
|
@@ -21443,7 +21474,7 @@ function chartQuestion(view, fields) {
|
|
|
21443
21474
|
}
|
|
21444
21475
|
function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
21445
21476
|
const client = useRecordsClient52();
|
|
21446
|
-
const q =
|
|
21477
|
+
const q = useMemo45(() => chartQuestion(view, fields), [view, fields]);
|
|
21447
21478
|
const [state, setState] = useState64({ block: null, error: null });
|
|
21448
21479
|
const filterKey = JSON.stringify(filter ?? {});
|
|
21449
21480
|
const qKey = JSON.stringify(q);
|
|
@@ -21517,7 +21548,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
21517
21548
|
}
|
|
21518
21549
|
|
|
21519
21550
|
// src/MapLayout.tsx
|
|
21520
|
-
import { useEffect as useEffect58, useMemo as
|
|
21551
|
+
import { useEffect as useEffect58, useMemo as useMemo46, useRef as useRef29, useState as useState65 } from "react";
|
|
21521
21552
|
import { useFieldMutation as useFieldMutation6, useRecordMutation as useRecordMutation2 } from "@ai-matrx/records/react";
|
|
21522
21553
|
import { Button as Button49, Select as Select8, SelectContent as SelectContent7, SelectItem as SelectItem7, SelectTrigger as SelectTrigger7, SelectValue as SelectValue7, cn as cn29 } from "@ai-matrx/design-system";
|
|
21523
21554
|
|
|
@@ -21656,7 +21687,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
21656
21687
|
};
|
|
21657
21688
|
}, []);
|
|
21658
21689
|
const titleOf = (row) => rowName(row, titleKey);
|
|
21659
|
-
const placed =
|
|
21690
|
+
const placed = useMemo46(
|
|
21660
21691
|
() => chosen ? placeRows({ rows, mapField: chosen, lngKey, saved, found, titleOf }) : { pins: [], toLookUp: [], unplaceable: [] },
|
|
21661
21692
|
// titleOf closes over titleKey only
|
|
21662
21693
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -21777,7 +21808,7 @@ function MapLayout({ view, fields, rows, titleKey, openRecordId, onOpenRecord, o
|
|
|
21777
21808
|
}
|
|
21778
21809
|
|
|
21779
21810
|
// src/OrgChartLayout.tsx
|
|
21780
|
-
import { useCallback as useCallback27, useEffect as useEffect59, useMemo as
|
|
21811
|
+
import { useCallback as useCallback27, useEffect as useEffect59, useMemo as useMemo47, useRef as useRef30, useState as useState66 } from "react";
|
|
21781
21812
|
import { Button as Button50, Select as Select9, SelectContent as SelectContent8, SelectItem as SelectItem8, SelectTrigger as SelectTrigger8, SelectValue as SelectValue8, cn as cn30 } from "@ai-matrx/design-system";
|
|
21782
21813
|
|
|
21783
21814
|
// src/orgTree.ts
|
|
@@ -21938,9 +21969,9 @@ function OrgChartLayout({ view, fields, rows, titleKey, openRecordId, onOpenReco
|
|
|
21938
21969
|
const titleField = cardTitleField(fields, titleKey, [chosen?.key]);
|
|
21939
21970
|
const cardHidden = view.presentation?.cardHidden;
|
|
21940
21971
|
const lines = orgCardFields(fields, cardHidden, [titleField?.key, chosen?.key]);
|
|
21941
|
-
const forest =
|
|
21972
|
+
const forest = useMemo47(() => chosen ? buildOrgForest(rows, chosen.key) : null, [rows, chosen?.key]);
|
|
21942
21973
|
const [collapsed, setCollapsed] = useState66(() => /* @__PURE__ */ new Set());
|
|
21943
|
-
const layout =
|
|
21974
|
+
const layout = useMemo47(() => forest ? layoutOrg(forest.roots, collapsed) : null, [forest, collapsed]);
|
|
21944
21975
|
const box = useRef30(null);
|
|
21945
21976
|
const [view2, setView2] = useState66({ scale: 1, x: 16, y: 16 });
|
|
21946
21977
|
const fitted = useRef30("");
|
|
@@ -22133,7 +22164,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
22133
22164
|
useEffect60(() => {
|
|
22134
22165
|
setLimit(pageSize);
|
|
22135
22166
|
}, [questionKey, pageSize]);
|
|
22136
|
-
const storeSort =
|
|
22167
|
+
const storeSort = useMemo48(
|
|
22137
22168
|
() => (view.sorts ?? []).map((s) => ({ field: s.field, direction: s.direction })),
|
|
22138
22169
|
[view.sorts]
|
|
22139
22170
|
);
|
|
@@ -22164,7 +22195,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
22164
22195
|
}, [client, ruleId, pageSize]);
|
|
22165
22196
|
const asked2 = stableFilterKey4(filter ?? null);
|
|
22166
22197
|
const fromView = asked2 !== "{}" && (asked2 === stableFilterKey4(view.where ?? null) || asked2 === stableFilterKey4(view.filters ?? null));
|
|
22167
|
-
const tableRows =
|
|
22198
|
+
const tableRows = useMemo48(() => table.data?.rows ?? [], [table.data]);
|
|
22168
22199
|
const manual = view.order === "manual" && Boolean(viewId) && !ruleId;
|
|
22169
22200
|
const hand = useHandOrderRows({
|
|
22170
22201
|
viewId: viewId ?? null,
|
|
@@ -22177,7 +22208,7 @@ function useViewRecords(view, pageSize = 200, filter, viewId) {
|
|
|
22177
22208
|
const rows = ruleId ? ruled.rows : manual ? hand.rows ?? NO_ROWS2 : tableRows;
|
|
22178
22209
|
const total = ruleId || manual ? null : table.data?.total ?? null;
|
|
22179
22210
|
const sortsKey = JSON.stringify(view.sorts ?? []);
|
|
22180
|
-
const shown4 =
|
|
22211
|
+
const shown4 = useMemo48(
|
|
22181
22212
|
() => manual || !ruleId ? rows : sortRows(rows, JSON.parse(sortsKey)),
|
|
22182
22213
|
[rows, manual, ruleId, sortsKey]
|
|
22183
22214
|
);
|
|
@@ -22453,7 +22484,7 @@ function Board({
|
|
|
22453
22484
|
const records = useViewRecords(view, pageSize, filter, viewId ?? null);
|
|
22454
22485
|
const stage = useStageField(view.subject);
|
|
22455
22486
|
const decorations = useTableDecorations(view.subject);
|
|
22456
|
-
const style =
|
|
22487
|
+
const style = useMemo48(
|
|
22457
22488
|
() => resolveTableStyle(decorations.data, fields.data ?? [], view.presentation?.style),
|
|
22458
22489
|
[decorations.data, fields.data, view.presentation?.style]
|
|
22459
22490
|
);
|
|
@@ -22643,7 +22674,7 @@ function Board({
|
|
|
22643
22674
|
if (!dateField) {
|
|
22644
22675
|
return offerableFields(all, "date", placing).length > 0 ? /* @__PURE__ */ jsx74(Pick, { layout: "calendar", picker }) : /* @__PURE__ */ jsx74(ViewNeeds, { layout: "calendar", tableId: view.subject, fields: all, onMade: (key) => onChange({ dateField: key }) });
|
|
22645
22676
|
}
|
|
22646
|
-
return /* @__PURE__ */ jsxs67("div", { className: "flex min-h-0 flex-col gap-2", children: [
|
|
22677
|
+
return /* @__PURE__ */ jsxs67("div", { className: "flex min-h-0 w-full min-w-0 max-w-full flex-col gap-2", children: [
|
|
22647
22678
|
/* @__PURE__ */ jsx74(InTableToolbar, { children: picker }),
|
|
22648
22679
|
noRows ?? /* @__PURE__ */ jsx74(
|
|
22649
22680
|
CalendarView,
|
|
@@ -22679,7 +22710,7 @@ function Board({
|
|
|
22679
22710
|
if (offerableFields(all, "date", placing).length === 0) {
|
|
22680
22711
|
return /* @__PURE__ */ jsx74(ViewNeeds, { layout: "timeline", tableId: view.subject, fields: all, onMade: (key) => onChange({ dateField: key }) });
|
|
22681
22712
|
}
|
|
22682
|
-
return /* @__PURE__ */ jsxs67("div", { className: "flex min-h-0 flex-col gap-2", children: [
|
|
22713
|
+
return /* @__PURE__ */ jsxs67("div", { className: "flex min-h-0 w-full min-w-0 max-w-full flex-col gap-2", children: [
|
|
22683
22714
|
noRows ?? /* @__PURE__ */ jsx74(
|
|
22684
22715
|
TimelineView,
|
|
22685
22716
|
{
|
|
@@ -22921,27 +22952,27 @@ function Kanban({
|
|
|
22921
22952
|
parentField,
|
|
22922
22953
|
below
|
|
22923
22954
|
}) {
|
|
22924
|
-
const axisFields =
|
|
22955
|
+
const axisFields = useMemo48(() => laneField ? [groupField, laneField] : [groupField], [groupField, laneField]);
|
|
22925
22956
|
const labels = useRecordLabels(axisFields);
|
|
22926
22957
|
const choiceKeys = axisFields.filter(isChoiceField).map((f) => f.key);
|
|
22927
22958
|
const optionIndex = useChoiceOptions(axisFields, choiceKeys);
|
|
22928
22959
|
const options = optionIndex.get(groupField.key);
|
|
22929
22960
|
const laneOptions = laneField ? optionIndex.get(laneField.key) : void 0;
|
|
22930
|
-
const columnAxis =
|
|
22931
|
-
const laneAxis =
|
|
22961
|
+
const columnAxis = useMemo48(() => buildAxis(groupField, rows, labels, options), [groupField, rows, labels, options]);
|
|
22962
|
+
const laneAxis = useMemo48(() => laneField ? buildAxis(laneField, rows, labels, laneOptions) : null, [laneField, rows, labels, laneOptions]);
|
|
22932
22963
|
const board = look ?? {};
|
|
22933
22964
|
const size = BOARD_SIZE[board.boardSize ?? "medium"];
|
|
22934
22965
|
const colorColumns = board.boardColorColumns !== false;
|
|
22935
22966
|
const showCounts = board.boardCounts !== false;
|
|
22936
22967
|
const hideEmpty = board.boardHideEmpty === true;
|
|
22937
|
-
const cardsOf =
|
|
22968
|
+
const cardsOf = useMemo48(() => {
|
|
22938
22969
|
const map = /* @__PURE__ */ new Map();
|
|
22939
22970
|
for (const name of columnAxis.names) map.set(name, []);
|
|
22940
22971
|
for (const row of rows) for (const key of columnAxis.keysOf(row)) map.get(key)?.push(row);
|
|
22941
22972
|
return map;
|
|
22942
22973
|
}, [rows, columnAxis]);
|
|
22943
22974
|
const columns = columnAxis.names.filter((name) => !hideEmpty || (cardsOf.get(name)?.length ?? 0) > 0);
|
|
22944
|
-
const lanes =
|
|
22975
|
+
const lanes = useMemo48(() => {
|
|
22945
22976
|
if (!laneAxis) return [];
|
|
22946
22977
|
const byLane = new Map(laneAxis.names.map((n) => [n, []]));
|
|
22947
22978
|
for (const row of rows) for (const key of laneAxis.keysOf(row)) byLane.get(key)?.push(row);
|
|
@@ -23186,7 +23217,7 @@ function Gallery({
|
|
|
23186
23217
|
onNew,
|
|
23187
23218
|
newLabel
|
|
23188
23219
|
}) {
|
|
23189
|
-
const hidden =
|
|
23220
|
+
const hidden = useMemo48(() => new Set(hiddenFields ?? []), [hiddenFields]);
|
|
23190
23221
|
const imageField = imageKey ? fields.find((field) => field.key === imageKey) : void 0;
|
|
23191
23222
|
const shown4 = fields.filter((field) => !hidden.has(field.key) && field.key !== imageKey && field.key !== titleKey);
|
|
23192
23223
|
const chose = hiddenFields !== void 0;
|
|
@@ -23289,7 +23320,7 @@ function RecordCard({
|
|
|
23289
23320
|
parentField
|
|
23290
23321
|
}) {
|
|
23291
23322
|
const host = useRecordsUi();
|
|
23292
|
-
const wanted =
|
|
23323
|
+
const wanted = useMemo48(() => {
|
|
23293
23324
|
const asked2 = [field && pointsAtRecords(field) ? field : null, parentField ?? null].filter((f) => f !== null);
|
|
23294
23325
|
return asked2.length > 0 ? asked2 : NO_FIELDS2;
|
|
23295
23326
|
}, [field, parentField]);
|
|
@@ -24449,14 +24480,14 @@ function ProposalRow({
|
|
|
24449
24480
|
}
|
|
24450
24481
|
|
|
24451
24482
|
// src/ActionInbox.tsx
|
|
24452
|
-
import { useCallback as useCallback33, useEffect as useEffect66, useMemo as
|
|
24483
|
+
import { useCallback as useCallback33, useEffect as useEffect66, useMemo as useMemo50, useRef as useRef34, useState as useState73 } from "react";
|
|
24453
24484
|
import { useRecordsClient as useRecordsClient59 } from "@ai-matrx/records/react";
|
|
24454
24485
|
import { Badge as Badge10, Button as Button57, Checkbox as Checkbox6, Skeleton as Skeleton14, cn as cn37 } from "@ai-matrx/design-system";
|
|
24455
24486
|
import { toggleSelection as toggleSelection2 } from "@ai-matrx/design-system/data-table";
|
|
24456
24487
|
import { formatAbsoluteDate, formatDurationMs } from "@ai-matrx/kit/format";
|
|
24457
24488
|
|
|
24458
24489
|
// src/ChecklistRunner.tsx
|
|
24459
|
-
import { useCallback as useCallback32, useEffect as useEffect65, useMemo as
|
|
24490
|
+
import { useCallback as useCallback32, useEffect as useEffect65, useMemo as useMemo49, useState as useState72 } from "react";
|
|
24460
24491
|
import { useRecordsClient as useRecordsClient58, useTable as useTable20 } from "@ai-matrx/records/react";
|
|
24461
24492
|
import { Badge as Badge9, BasicInput as BasicInput8, BasicTextarea as BasicTextarea4, Button as Button56, Skeleton as Skeleton13, cn as cn36 } from "@ai-matrx/design-system";
|
|
24462
24493
|
import { Select as Select11 } from "@ai-matrx/design-system/controls";
|
|
@@ -24593,7 +24624,7 @@ function ChecklistRunner({
|
|
|
24593
24624
|
},
|
|
24594
24625
|
[client, loadSteps]
|
|
24595
24626
|
);
|
|
24596
|
-
const active =
|
|
24627
|
+
const active = useMemo49(
|
|
24597
24628
|
() => runs?.find((r) => r.run_id === activeId) ?? null,
|
|
24598
24629
|
[runs, activeId]
|
|
24599
24630
|
);
|
|
@@ -25073,7 +25104,7 @@ function ChecklistTemplateEditor({
|
|
|
25073
25104
|
cancelled = true;
|
|
25074
25105
|
};
|
|
25075
25106
|
}, [client, templateId]);
|
|
25076
|
-
const spec =
|
|
25107
|
+
const spec = useMemo49(
|
|
25077
25108
|
() => ({
|
|
25078
25109
|
name: name.trim(),
|
|
25079
25110
|
about_table_id: aboutTableId,
|
|
@@ -25381,17 +25412,17 @@ function ActionInbox({
|
|
|
25381
25412
|
useEffect66(() => {
|
|
25382
25413
|
void load();
|
|
25383
25414
|
}, [load]);
|
|
25384
|
-
const narrowed =
|
|
25415
|
+
const narrowed = useMemo50(() => {
|
|
25385
25416
|
const all = (items ?? []).filter((i) => !(view === "inbox" && i.kind === "assignment" && stepIds.has(i.item_id)));
|
|
25386
25417
|
if (!tableId || everyTable) return all;
|
|
25387
25418
|
return all.filter((i) => i.table_id === tableId);
|
|
25388
25419
|
}, [items, tableId, everyTable, view, stepIds]);
|
|
25389
|
-
const waitingIds =
|
|
25420
|
+
const waitingIds = useMemo50(
|
|
25390
25421
|
() => new Set((items ?? []).filter((i) => i.kind === "assignment").map((i) => i.item_id)),
|
|
25391
25422
|
[items]
|
|
25392
25423
|
);
|
|
25393
|
-
const groups =
|
|
25394
|
-
const shown4 =
|
|
25424
|
+
const groups = useMemo50(() => groupInbox(narrowed, groupBy), [narrowed, groupBy]);
|
|
25425
|
+
const shown4 = useMemo50(() => groups.flatMap((g) => g.items), [groups]);
|
|
25395
25426
|
const elsewhere = (items?.length ?? 0) - narrowed.length;
|
|
25396
25427
|
useEffect66(() => {
|
|
25397
25428
|
if (cursor >= shown4.length) setCursor(Math.max(0, shown4.length - 1));
|
|
@@ -26147,7 +26178,7 @@ import { Badge as Badge11, Button as Button60, Skeleton as Skeleton16, cn as cn4
|
|
|
26147
26178
|
import { formatRelativeTime as formatRelativeTime3 } from "@ai-matrx/kit/format";
|
|
26148
26179
|
|
|
26149
26180
|
// src/AsOfReading.tsx
|
|
26150
|
-
import { useEffect as useEffect67, useMemo as
|
|
26181
|
+
import { useEffect as useEffect67, useMemo as useMemo51, useState as useState74 } from "react";
|
|
26151
26182
|
import { readTypedDate, typedDateText } from "@ai-matrx/records";
|
|
26152
26183
|
import { useRecordsClient as useRecordsClient60 } from "@ai-matrx/records/react";
|
|
26153
26184
|
import { Button as Button58, Skeleton as Skeleton15, cn as cn38 } from "@ai-matrx/design-system";
|
|
@@ -26285,7 +26316,7 @@ function AsOfReading({
|
|
|
26285
26316
|
live = false;
|
|
26286
26317
|
};
|
|
26287
26318
|
}, [client, key]);
|
|
26288
|
-
const rows =
|
|
26319
|
+
const rows = useMemo51(() => answer && "doc" in answer && answer.doc ? asOfRows(fields, answer.doc, today) : [], [answer, fields, today]);
|
|
26289
26320
|
const box = cn38("h-[9.25rem] min-h-0 overflow-y-auto rounded border", className);
|
|
26290
26321
|
if (!answer || answer.key !== key) return /* @__PURE__ */ jsx81(Skeleton15, { shape: "block", className: box });
|
|
26291
26322
|
if ("error" in answer) return /* @__PURE__ */ jsx81(RefusalNotice, { error: answer.error, className });
|
|
@@ -26900,7 +26931,7 @@ function say(value, field) {
|
|
|
26900
26931
|
|
|
26901
26932
|
// src/CommentThread.tsx
|
|
26902
26933
|
import { isUuidShape as isUuidShape2 } from "@ai-matrx/kit/uuid";
|
|
26903
|
-
import { useCallback as useCallback36, useEffect as useEffect70, useMemo as
|
|
26934
|
+
import { useCallback as useCallback36, useEffect as useEffect70, useMemo as useMemo52, useRef as useRef36, useState as useState77 } from "react";
|
|
26904
26935
|
import {
|
|
26905
26936
|
useFields as useFields19,
|
|
26906
26937
|
useRecordsClient as useRecordsClient63,
|
|
@@ -26958,7 +26989,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
|
|
|
26958
26989
|
alive = false;
|
|
26959
26990
|
};
|
|
26960
26991
|
}, [host]);
|
|
26961
|
-
const candidates =
|
|
26992
|
+
const candidates = useMemo52(() => {
|
|
26962
26993
|
if (mentionQuery === null) return [];
|
|
26963
26994
|
const q = mentionQuery.trim().toLowerCase();
|
|
26964
26995
|
return people.filter((p) => !picked.some((already) => already.userId === p.userId)).filter((p) => q === "" || (p.name ?? p.email ?? "").toLowerCase().includes(q)).slice(0, 6);
|
|
@@ -27317,7 +27348,7 @@ function FieldHistoryPanel({
|
|
|
27317
27348
|
import { FORM_FLOWS as FORM_FLOWS2, FORM_EMBEDS as FORM_EMBEDS2, formDeclareArgs as formDeclareArgs2, formFromSummary as formFromSummary4, formPresentation, formLookDocument as formLookDocument2, formLookFromDocument, submissionStamp as submissionStamp2, formEmbedSnippet as formEmbedSnippet2, formRoutes as formRoutes2, hiddenFromLink, endingsFromDocument, welcomeFromDocument, themeFromDocument } from "@ai-matrx/records/forms";
|
|
27318
27349
|
|
|
27319
27350
|
// src/FormResultsPanel.tsx
|
|
27320
|
-
import { useEffect as useEffect72, useMemo as
|
|
27351
|
+
import { useEffect as useEffect72, useMemo as useMemo53, useState as useState79 } from "react";
|
|
27321
27352
|
import { useFields as useFields21, useOptionalRecordsClient as useOptionalRecordsClient8 } from "@ai-matrx/records/react";
|
|
27322
27353
|
import { Button as Button63, Skeleton as Skeleton19, cn as cn43 } from "@ai-matrx/design-system";
|
|
27323
27354
|
import { jsx as jsx86, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
@@ -27363,14 +27394,14 @@ function FormResultsPanel({ form, className }) {
|
|
|
27363
27394
|
cancelled = true;
|
|
27364
27395
|
};
|
|
27365
27396
|
}, [client, form.id, round]);
|
|
27366
|
-
const charted =
|
|
27397
|
+
const charted = useMemo53(() => {
|
|
27367
27398
|
const byKey = new Map((fields.data ?? []).map((f) => [f.key, f]));
|
|
27368
27399
|
return (key) => {
|
|
27369
27400
|
const field = byKey.get(key);
|
|
27370
27401
|
return field ? CHARTED_KINDS.has(editorKindFor(field)) : false;
|
|
27371
27402
|
};
|
|
27372
27403
|
}, [fields.data]);
|
|
27373
|
-
const label =
|
|
27404
|
+
const label = useMemo53(() => {
|
|
27374
27405
|
const byKey = new Map((fields.data ?? []).map((f) => [f.key, f]));
|
|
27375
27406
|
const asks = new Map((form.questions ?? []).map((q) => [q.field, q.ask]));
|
|
27376
27407
|
return (key) => asks.get(key)?.trim() || (byKey.get(key) ? fieldName(byKey.get(key)) : key);
|
|
@@ -27444,7 +27475,7 @@ function FormResultsPanel({ form, className }) {
|
|
|
27444
27475
|
}
|
|
27445
27476
|
|
|
27446
27477
|
// src/PortalBuilder.tsx
|
|
27447
|
-
import { useCallback as useCallback38, useEffect as useEffect73, useMemo as
|
|
27478
|
+
import { useCallback as useCallback38, useEffect as useEffect73, useMemo as useMemo54, useRef as useRef38, useState as useState80 } from "react";
|
|
27448
27479
|
import { useRecordsClient as useRecordsClient65, useTables } from "@ai-matrx/records/react";
|
|
27449
27480
|
import { BasicInput as BasicInput9, Button as Button64, Checkbox as Checkbox7, Label as Label8, Separator as Separator8, Skeleton as Skeleton20, cn as cn44 } from "@ai-matrx/design-system";
|
|
27450
27481
|
import { Select as Select12 } from "@ai-matrx/design-system/controls";
|
|
@@ -27513,7 +27544,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
27513
27544
|
return rest;
|
|
27514
27545
|
});
|
|
27515
27546
|
}, [tableId, portalId, clientTableId, cameFromPeople]);
|
|
27516
|
-
const ticked =
|
|
27547
|
+
const ticked = useMemo54(() => Object.values(exposures).filter((e) => e.on), [exposures]);
|
|
27517
27548
|
const tiesTo = useCallback38(
|
|
27518
27549
|
(id) => (fieldsByTable[id] ?? []).filter(
|
|
27519
27550
|
(f) => f.type === "relation" && f.relation_target === clientTableId
|
|
@@ -27599,7 +27630,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
|
|
|
27599
27630
|
setSavedId(answered.data);
|
|
27600
27631
|
onSaved?.(answered.data);
|
|
27601
27632
|
}
|
|
27602
|
-
const inviteField =
|
|
27633
|
+
const inviteField = useMemo54(() => {
|
|
27603
27634
|
for (const e of ticked) {
|
|
27604
27635
|
const tie = tiesTo(e.tableId)[0];
|
|
27605
27636
|
if (tie) return tie;
|
|
@@ -27837,7 +27868,7 @@ function clientNoun(table) {
|
|
|
27837
27868
|
|
|
27838
27869
|
// src/PortalsPanel.tsx
|
|
27839
27870
|
import { copyText as copyText5 } from "@ai-matrx/kit/clipboard";
|
|
27840
|
-
import { useCallback as useCallback39, useEffect as useEffect75, useMemo as
|
|
27871
|
+
import { useCallback as useCallback39, useEffect as useEffect75, useMemo as useMemo56, useState as useState82 } from "react";
|
|
27841
27872
|
import { useRecordsClient as useRecordsClient67 } from "@ai-matrx/records/react";
|
|
27842
27873
|
import {
|
|
27843
27874
|
portalArchiveConsequence,
|
|
@@ -27848,7 +27879,7 @@ import {
|
|
|
27848
27879
|
import { Badge as Badge14, BasicInput as BasicInput11, Button as Button66, Separator as Separator9, Skeleton as Skeleton21, cn as cn47 } from "@ai-matrx/design-system";
|
|
27849
27880
|
|
|
27850
27881
|
// src/PortalLookEditor.tsx
|
|
27851
|
-
import { useEffect as useEffect74, useMemo as
|
|
27882
|
+
import { useEffect as useEffect74, useMemo as useMemo55, useState as useState81 } from "react";
|
|
27852
27883
|
import { useRecordsClient as useRecordsClient66 } from "@ai-matrx/records/react";
|
|
27853
27884
|
import { BasicInput as BasicInput10, Button as Button65, cn as cn46 } from "@ai-matrx/design-system";
|
|
27854
27885
|
|
|
@@ -27956,7 +27987,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
27956
27987
|
cancelled = true;
|
|
27957
27988
|
};
|
|
27958
27989
|
}, [card, client]);
|
|
27959
|
-
const orgName =
|
|
27990
|
+
const orgName = useMemo55(
|
|
27960
27991
|
() => card.style.from_organization.includes("display_name") ? card.style.display_name : null,
|
|
27961
27992
|
[card.style]
|
|
27962
27993
|
);
|
|
@@ -28751,7 +28782,7 @@ function Invite({ card, onInvited }) {
|
|
|
28751
28782
|
cancelled = true;
|
|
28752
28783
|
};
|
|
28753
28784
|
}, [client, card.client_table_id]);
|
|
28754
|
-
const options =
|
|
28785
|
+
const options = useMemo56(() => {
|
|
28755
28786
|
const all = (rows ?? []).map((row) => ({ id: row.id, name: rowNameIn(clientTable, row) }));
|
|
28756
28787
|
const needle = search.trim().toLowerCase();
|
|
28757
28788
|
return needle === "" ? all.slice(0, 25) : all.filter((o) => o.name.toLowerCase().includes(needle)).slice(0, 25);
|
|
@@ -28944,7 +28975,7 @@ function FormLookFrame({ look, title, children, contained = false, showOwnerHead
|
|
|
28944
28975
|
}
|
|
28945
28976
|
|
|
28946
28977
|
// src/DigestScheduler.tsx
|
|
28947
|
-
import { useCallback as useCallback40, useEffect as useEffect76, useMemo as
|
|
28978
|
+
import { useCallback as useCallback40, useEffect as useEffect76, useMemo as useMemo57, useState as useState83 } from "react";
|
|
28948
28979
|
import { useRecordsClient as useRecordsClient68, useTable as useTable24 } from "@ai-matrx/records/react";
|
|
28949
28980
|
import { hasQuietHours } from "@ai-matrx/records";
|
|
28950
28981
|
import { BasicInput as BasicInput12, Button as Button67, Checkbox as Checkbox8, Label as Label9, Separator as Separator10, Skeleton as Skeleton22, cn as cn49 } from "@ai-matrx/design-system";
|
|
@@ -29065,12 +29096,12 @@ function DigestScheduler({
|
|
|
29065
29096
|
useEffect76(() => {
|
|
29066
29097
|
void load();
|
|
29067
29098
|
}, [load]);
|
|
29068
|
-
const schedule =
|
|
29099
|
+
const schedule = useMemo57(() => {
|
|
29069
29100
|
if (cadence === "weekly") return `${weekday} ${time}`;
|
|
29070
29101
|
if (cadence === "daily") return time;
|
|
29071
29102
|
return null;
|
|
29072
29103
|
}, [cadence, weekday, time]);
|
|
29073
|
-
const quietHours =
|
|
29104
|
+
const quietHours = useMemo57(
|
|
29074
29105
|
() => quiet ? { start: quietFrom, end: quietTo, tz: timezone } : { tz: timezone },
|
|
29075
29106
|
[quiet, quietFrom, quietTo, timezone]
|
|
29076
29107
|
);
|
|
@@ -29752,7 +29783,7 @@ function SubscriptionsPanel({ tableId, activeRuleId, className }) {
|
|
|
29752
29783
|
import { copyText as copyText6 } from "@ai-matrx/kit/clipboard";
|
|
29753
29784
|
import { ErrorBox as ErrorBox3 } from "@ai-matrx/design-system";
|
|
29754
29785
|
import { Select as Select14 } from "@ai-matrx/design-system/controls";
|
|
29755
|
-
import { useCallback as useCallback44, useEffect as useEffect80, useMemo as
|
|
29786
|
+
import { useCallback as useCallback44, useEffect as useEffect80, useMemo as useMemo59, useRef as useRef40, useState as useState88 } from "react";
|
|
29756
29787
|
import { DndContext as DndContext2, KeyboardSensor, PointerSensor as PointerSensor2, closestCenter as closestCenter2, useSensor as useSensor2, useSensors as useSensors2 } from "@dnd-kit/core";
|
|
29757
29788
|
import { SortableContext as SortableContext2, arrayMove, sortableKeyboardCoordinates, useSortable as useSortable2, verticalListSortingStrategy as verticalListSortingStrategy2 } from "@dnd-kit/sortable";
|
|
29758
29789
|
import { CSS as CSS3 } from "@dnd-kit/utilities";
|
|
@@ -30025,7 +30056,7 @@ function EmbedSnippets({ url, label }) {
|
|
|
30025
30056
|
}
|
|
30026
30057
|
|
|
30027
30058
|
// src/FormRunner.tsx
|
|
30028
|
-
import { useCallback as useCallback43, useEffect as useEffect79, useMemo as
|
|
30059
|
+
import { useCallback as useCallback43, useEffect as useEffect79, useMemo as useMemo58, useRef as useRef39, useState as useState87 } from "react";
|
|
30029
30060
|
import { useFields as useFields22, useOptionalRecordsClient as useOptionalRecordsClient9 } from "@ai-matrx/records/react";
|
|
30030
30061
|
import { Button as Button71, Label as Label12, Progress, Skeleton as Skeleton25, cn as cn52, formThemeClasses } from "@ai-matrx/design-system";
|
|
30031
30062
|
import { answerRefusal, formRoutes, pipeAnswers, submissionStamp } from "@ai-matrx/records/forms";
|
|
@@ -30148,7 +30179,7 @@ function FormStage({
|
|
|
30148
30179
|
const choose = autoAdvance ?? form.autoAdvance ?? true;
|
|
30149
30180
|
const decoy = useRef39("");
|
|
30150
30181
|
const stage = useRef39(null);
|
|
30151
|
-
const questions =
|
|
30182
|
+
const questions = useMemo58(() => {
|
|
30152
30183
|
const byKey = new Map((fields ?? []).map((f) => [f.key, f]));
|
|
30153
30184
|
return (form.questions ?? []).map((q) => {
|
|
30154
30185
|
const field = byKey.get(q.field) ?? null;
|
|
@@ -30848,12 +30879,12 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
30848
30879
|
}
|
|
30849
30880
|
onActiveForm?.(chosen);
|
|
30850
30881
|
}, [forms, activeFormId, makeOnMount]);
|
|
30851
|
-
const byKey =
|
|
30852
|
-
const conditionFields =
|
|
30882
|
+
const byKey = useMemo59(() => new Map((fields.data ?? []).map((f) => [f.key, f])), [fields.data]);
|
|
30883
|
+
const conditionFields = useMemo59(
|
|
30853
30884
|
() => (fields.data ?? []).map((f) => ({ id: String(f.id), key: f.key, label: f.label || f.key, field: f })),
|
|
30854
30885
|
[fields.data]
|
|
30855
30886
|
);
|
|
30856
|
-
const stored =
|
|
30887
|
+
const stored = useMemo59(() => draft ? (forms ?? []).find((f) => f.id === draft.id) ?? null : null, [draft, forms]);
|
|
30857
30888
|
const dirty = Boolean(draft && stored && !sameForm(draft, stored));
|
|
30858
30889
|
useEffect80(() => {
|
|
30859
30890
|
if (!draft || !stored) return;
|
|
@@ -32460,7 +32491,7 @@ function NotifyRuleEditor({ tableId, seed, chosenRuleId, onChoose, className })
|
|
|
32460
32491
|
}
|
|
32461
32492
|
|
|
32462
32493
|
// src/DashboardCanvas.tsx
|
|
32463
|
-
import { useCallback as useCallback49, useEffect as useEffect85, useMemo as
|
|
32494
|
+
import { useCallback as useCallback49, useEffect as useEffect85, useMemo as useMemo61, useState as useState94 } from "react";
|
|
32464
32495
|
import { useFields as useFields27, useRecordsClient as useRecordsClient77, useTable as useTable30 } from "@ai-matrx/records/react";
|
|
32465
32496
|
import {
|
|
32466
32497
|
BasicInput as BasicInput18,
|
|
@@ -32629,7 +32660,7 @@ function GridCell2({
|
|
|
32629
32660
|
}
|
|
32630
32661
|
|
|
32631
32662
|
// src/AddChart.tsx
|
|
32632
|
-
import { useMemo as
|
|
32663
|
+
import { useMemo as useMemo60, useState as useState93 } from "react";
|
|
32633
32664
|
import { useFields as useFields26, useRecordsClient as useRecordsClient76 } from "@ai-matrx/records/react";
|
|
32634
32665
|
import {
|
|
32635
32666
|
Button as Button77,
|
|
@@ -32681,7 +32712,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
32681
32712
|
const client = useRecordsClient76();
|
|
32682
32713
|
const [tableId, setTableId] = useState93(subject);
|
|
32683
32714
|
const fields = useFields26(tableId);
|
|
32684
|
-
const all =
|
|
32715
|
+
const all = useMemo60(() => onePerKey(fields.data ?? []), [fields.data]);
|
|
32685
32716
|
const labels = useRecordLabels(all);
|
|
32686
32717
|
const wordsFor = (key, value) => {
|
|
32687
32718
|
const field = all.find((f) => f.key === key);
|
|
@@ -32764,7 +32795,7 @@ function AddChart({ subject, onAdd, onClose }) {
|
|
|
32764
32795
|
import { Select as ControlSelect } from "@ai-matrx/design-system/controls";
|
|
32765
32796
|
|
|
32766
32797
|
// src/pages.ts
|
|
32767
|
-
import { isRuleFilter as isRuleFilter2 } from "@ai-matrx/records";
|
|
32798
|
+
import { isRuleFilter as isRuleFilter2 } from "@ai-matrx/records/views";
|
|
32768
32799
|
var PAGE_BLOCK_KINDS = [
|
|
32769
32800
|
"list",
|
|
32770
32801
|
"layout",
|
|
@@ -33094,7 +33125,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, createOnMount, on
|
|
|
33094
33125
|
const chosen = boards.find((d) => d.id === (activeDashboardId ?? activeId)) ?? boards[0];
|
|
33095
33126
|
if (chosen.id !== activeId) setActiveId(chosen.id);
|
|
33096
33127
|
}, [boards, activeDashboardId, madeOnMount]);
|
|
33097
|
-
const board =
|
|
33128
|
+
const board = useMemo61(() => boards?.find((d) => d.id === activeId) ?? null, [boards, activeId]);
|
|
33098
33129
|
const filterKey = JSON.stringify(filter ?? {});
|
|
33099
33130
|
useEffect85(() => {
|
|
33100
33131
|
if (!activeId) {
|
|
@@ -33689,7 +33720,7 @@ function TargetControl({
|
|
|
33689
33720
|
|
|
33690
33721
|
// src/QuestionPanel.tsx
|
|
33691
33722
|
import { copyText as copyText7 } from "@ai-matrx/kit/clipboard";
|
|
33692
|
-
import { useEffect as useEffect86, useMemo as
|
|
33723
|
+
import { useEffect as useEffect86, useMemo as useMemo62, useRef as useRef42, useState as useState95 } from "react";
|
|
33693
33724
|
import { Badge as Badge16, BasicInput as BasicInput19, Button as Button79, Checkbox as Checkbox11, Label as Label15, Skeleton as Skeleton32, cn as cn60 } from "@ai-matrx/design-system";
|
|
33694
33725
|
import { useFields as useFields28, useRecordsClient as useRecordsClient78 } from "@ai-matrx/records/react";
|
|
33695
33726
|
|
|
@@ -33741,7 +33772,7 @@ function fromLocalInput(value) {
|
|
|
33741
33772
|
function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
33742
33773
|
const client = useRecordsClient78();
|
|
33743
33774
|
const fields = useFields28(tableId);
|
|
33744
|
-
const all =
|
|
33775
|
+
const all = useMemo62(() => fields.data ?? [], [fields.data]);
|
|
33745
33776
|
const me = client.config.actor?.user_id ?? null;
|
|
33746
33777
|
const [hidden, setHidden] = useState95(null);
|
|
33747
33778
|
const [related, setRelated] = useState95({});
|
|
@@ -33768,7 +33799,7 @@ function QuestionPanel({ tableId, activeQuestionId, draft, className }) {
|
|
|
33768
33799
|
live = false;
|
|
33769
33800
|
};
|
|
33770
33801
|
}, [client, tableId, all, fields.loading]);
|
|
33771
|
-
const offered =
|
|
33802
|
+
const offered = useMemo62(() => hidden ? all.filter((f) => !hidden.has(f.key)) : [], [all, hidden]);
|
|
33772
33803
|
const [saved, setSaved] = useState95(null);
|
|
33773
33804
|
const [savedEpoch, setSavedEpoch] = useState95(0);
|
|
33774
33805
|
const [current, setCurrent] = useState95(null);
|
|
@@ -34157,7 +34188,7 @@ function formatValue(key, value, fields) {
|
|
|
34157
34188
|
return new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(value);
|
|
34158
34189
|
}
|
|
34159
34190
|
function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATED }) {
|
|
34160
|
-
const block =
|
|
34191
|
+
const block = useMemo62(
|
|
34161
34192
|
() => ({
|
|
34162
34193
|
kind: "table",
|
|
34163
34194
|
group_by: answer.groupKey && spec.group?.kind === "field" ? [answer.groupKey] : [],
|
|
@@ -34663,12 +34694,12 @@ function AgentAnswer({
|
|
|
34663
34694
|
}
|
|
34664
34695
|
|
|
34665
34696
|
// src/PageScreen.tsx
|
|
34666
|
-
import { useCallback as useCallback50, useEffect as useEffect89, useMemo as
|
|
34697
|
+
import { useCallback as useCallback50, useEffect as useEffect89, useMemo as useMemo64, useRef as useRef43, useState as useState98 } from "react";
|
|
34667
34698
|
import { useRecordsClient as useRecordsClient81 } from "@ai-matrx/records/react";
|
|
34668
34699
|
import { BasicInput as BasicInput22, Button as Button83, Skeleton as Skeleton35, cn as cn62 } from "@ai-matrx/design-system";
|
|
34669
34700
|
|
|
34670
34701
|
// src/PageCanvas.tsx
|
|
34671
|
-
import { createContext as createContext7, useContext as useContext7, useEffect as useEffect88, useMemo as
|
|
34702
|
+
import { createContext as createContext7, useContext as useContext7, useEffect as useEffect88, useMemo as useMemo63, useState as useState97 } from "react";
|
|
34672
34703
|
import {
|
|
34673
34704
|
useFields as useFields30,
|
|
34674
34705
|
useRecordPage as useRecordPage3,
|
|
@@ -34799,7 +34830,7 @@ function useDoorRows(door, elementId, recordId) {
|
|
|
34799
34830
|
live = false;
|
|
34800
34831
|
};
|
|
34801
34832
|
}, [client, door, elementId, recordId, tick]);
|
|
34802
|
-
return
|
|
34833
|
+
return useMemo63(
|
|
34803
34834
|
() => ({
|
|
34804
34835
|
rows: (state.data?.rows ?? []).map((r) => ({ id: r.id, document: r.document })),
|
|
34805
34836
|
fields: (state.data?.fields ?? []).map(doorField),
|
|
@@ -34895,7 +34926,7 @@ function PageCanvas({ blocks, charts, run, subject, viewerUserId, editing, canEd
|
|
|
34895
34926
|
function useMemberQuestion(block, viewerUserId, extra, mineOn, enabled = true) {
|
|
34896
34927
|
const client = useRecordsClient80();
|
|
34897
34928
|
const fields = useFields30(enabled ? block.table_id : null);
|
|
34898
|
-
const all =
|
|
34929
|
+
const all = useMemo63(() => onePerKey3(fields.data ?? []), [fields.data]);
|
|
34899
34930
|
const [view, setView] = useState97(block.view_id ? "reading" : null);
|
|
34900
34931
|
useEffect88(() => {
|
|
34901
34932
|
if (!block.view_id || !enabled) {
|
|
@@ -35945,7 +35976,7 @@ function PageScreen({
|
|
|
35945
35976
|
live = false;
|
|
35946
35977
|
};
|
|
35947
35978
|
}, [client, chartKey]);
|
|
35948
|
-
const blocks =
|
|
35979
|
+
const blocks = useMemo64(
|
|
35949
35980
|
() => page ? pageBlocksOf(page.presentation, page.blocks.map((b) => b.id ?? "").filter(Boolean)) : [],
|
|
35950
35981
|
[page]
|
|
35951
35982
|
);
|
|
@@ -36073,7 +36104,7 @@ function PageScreen({
|
|
|
36073
36104
|
}
|
|
36074
36105
|
|
|
36075
36106
|
// src/InterfaceScreen.tsx
|
|
36076
|
-
import { useCallback as useCallback51, useEffect as useEffect90, useMemo as
|
|
36107
|
+
import { useCallback as useCallback51, useEffect as useEffect90, useMemo as useMemo65, useRef as useRef44, useState as useState99 } from "react";
|
|
36077
36108
|
import { useRecordsClient as useRecordsClient82 } from "@ai-matrx/records/react";
|
|
36078
36109
|
import { BasicInput as BasicInput23, Button as Button84, Skeleton as Skeleton36, cn as cn63 } from "@ai-matrx/design-system";
|
|
36079
36110
|
import { Fragment as Fragment47, jsx as jsx110, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
@@ -36145,12 +36176,12 @@ function InterfaceScreen({
|
|
|
36145
36176
|
onCreated?.(made.data);
|
|
36146
36177
|
});
|
|
36147
36178
|
}, [client, newOnTable, interfaceId, making, load, onCreated]);
|
|
36148
|
-
const shape =
|
|
36179
|
+
const shape = useMemo65(() => read ? interfaceOf(read.presentation) : null, [read]);
|
|
36149
36180
|
const builder = !!read && BUILDER_LEVELS.has(read.level);
|
|
36150
36181
|
const showDraft = builder && (editing || !shape?.published);
|
|
36151
36182
|
const pages = shape ? showDraft ? shape.draft.pages : shape.published?.pages ?? [] : [];
|
|
36152
36183
|
const page = pageById(pages, localPage ?? pageId);
|
|
36153
|
-
const charts =
|
|
36184
|
+
const charts = useMemo65(() => shape ? interfaceCharts(shape) : [], [shape]);
|
|
36154
36185
|
const through = !!read && !read.member;
|
|
36155
36186
|
const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
|
|
36156
36187
|
useEffect90(() => {
|
|
@@ -36576,7 +36607,7 @@ import { useFields as useFields31, useRecordsClient as useRecordsClient85, useTa
|
|
|
36576
36607
|
import { Button as Button87, Input as Input8, Skeleton as Skeleton39, Textarea as Textarea7, cn as cn66 } from "@ai-matrx/design-system";
|
|
36577
36608
|
|
|
36578
36609
|
// src/CaptureRun.tsx
|
|
36579
|
-
import { useCallback as useCallback53, useEffect as useEffect92, useMemo as
|
|
36610
|
+
import { useCallback as useCallback53, useEffect as useEffect92, useMemo as useMemo66, useRef as useRef45, useState as useState101 } from "react";
|
|
36580
36611
|
import {
|
|
36581
36612
|
coerceTypedAnswer,
|
|
36582
36613
|
coercionLabel,
|
|
@@ -36685,7 +36716,7 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
36685
36716
|
cancelled = true;
|
|
36686
36717
|
};
|
|
36687
36718
|
}, [client, given, sheetId]);
|
|
36688
|
-
const questions =
|
|
36719
|
+
const questions = useMemo66(() => {
|
|
36689
36720
|
const asked2 = face?.presentation?.questions ?? [];
|
|
36690
36721
|
if (asked2.length > 0) return asked2;
|
|
36691
36722
|
return (face?.fields ?? []).map((f) => ({
|
|
@@ -37545,7 +37576,7 @@ function useEmbedHandshake(args) {
|
|
|
37545
37576
|
|
|
37546
37577
|
// src/TablePage.tsx
|
|
37547
37578
|
import { copyText as copyText13 } from "@ai-matrx/kit/clipboard";
|
|
37548
|
-
import { useCallback as useCallback59, useEffect as useEffect100, useMemo as
|
|
37579
|
+
import { useCallback as useCallback59, useEffect as useEffect100, useMemo as useMemo70, useRef as useRef47, useState as useState114 } from "react";
|
|
37549
37580
|
import { archivedByLine as archivedByLine2 } from "@ai-matrx/records";
|
|
37550
37581
|
import { tableShapeChanged as tableShapeChanged11, useFields as useFields34, useRecordsClient as useRecordsClient90, useSeededAnswer, useTable as useTable36, useTableArchive as useTableArchive2 } from "@ai-matrx/records/react";
|
|
37551
37582
|
import {
|
|
@@ -38022,7 +38053,7 @@ function LinkedLists({ tableId, recordId }) {
|
|
|
38022
38053
|
}
|
|
38023
38054
|
|
|
38024
38055
|
// src/breakDown.tsx
|
|
38025
|
-
import { useMemo as
|
|
38056
|
+
import { useMemo as useMemo67, useState as useState109 } from "react";
|
|
38026
38057
|
import {
|
|
38027
38058
|
Button as Button91,
|
|
38028
38059
|
Dialog as Dialog18,
|
|
@@ -38059,9 +38090,9 @@ function BreakDownDialog({
|
|
|
38059
38090
|
onOpenChange,
|
|
38060
38091
|
onApply
|
|
38061
38092
|
}) {
|
|
38062
|
-
const source =
|
|
38093
|
+
const source = useMemo67(() => ({ kind: "table", id: tableId }), [tableId]);
|
|
38063
38094
|
const { def } = useDrillDefinition(open ? source : null);
|
|
38064
|
-
const dimensions =
|
|
38095
|
+
const dimensions = useMemo67(() => drillDimensionsOf(def, NO_LABELS), [def]);
|
|
38065
38096
|
const [picked, setPicked] = useState109(null);
|
|
38066
38097
|
const key = picked ?? held?.field ?? dimensions[0]?.key ?? "";
|
|
38067
38098
|
return /* @__PURE__ */ jsx120(Dialog18, { open, onOpenChange, children: /* @__PURE__ */ jsxs113(DialogContent18, { "data-break-down": "", className: "max-w-sm", children: [
|
|
@@ -38089,7 +38120,7 @@ function BreakDownDialog({
|
|
|
38089
38120
|
|
|
38090
38121
|
// src/TableReference.tsx
|
|
38091
38122
|
import { copyText as copyText12 } from "@ai-matrx/kit/clipboard";
|
|
38092
|
-
import { useCallback as useCallback58, useMemo as
|
|
38123
|
+
import { useCallback as useCallback58, useMemo as useMemo68, useState as useState110 } from "react";
|
|
38093
38124
|
import { useContentTransferCapabilities as useContentTransferCapabilities2 } from "@ai-matrx/alchemy/react/workspace";
|
|
38094
38125
|
import { Button as Button92, Dialog as Dialog19, DialogContent as DialogContent19, DialogHeader as DialogHeader19, DialogTitle as DialogTitle19 } from "@ai-matrx/design-system";
|
|
38095
38126
|
import { jsx as jsx121, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
@@ -38118,7 +38149,7 @@ function TableReferenceDialog({
|
|
|
38118
38149
|
const port = useContentTransferCapabilities2().reference;
|
|
38119
38150
|
const notify = useRecordsUi().notify;
|
|
38120
38151
|
const [copied, setCopied] = useState110(null);
|
|
38121
|
-
const choices =
|
|
38152
|
+
const choices = useMemo68(
|
|
38122
38153
|
() => tableReferenceChoices(table.id, tableName(table)).filter((c) => port?.supports(c.reference)),
|
|
38123
38154
|
[table, port]
|
|
38124
38155
|
);
|
|
@@ -38249,7 +38280,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
38249
38280
|
}
|
|
38250
38281
|
|
|
38251
38282
|
// src/ViewFilter.tsx
|
|
38252
|
-
import { useEffect as useEffect98, useMemo as
|
|
38283
|
+
import { useEffect as useEffect98, useMemo as useMemo69, useState as useState112 } from "react";
|
|
38253
38284
|
import { Button as Button94, Popover as Popover11, PopoverContent as PopoverContent11, PopoverTrigger as PopoverTrigger11 } from "@ai-matrx/design-system";
|
|
38254
38285
|
import { useFields as useFields33, useOptionalRecordsClient as useOptionalRecordsClient10 } from "@ai-matrx/records/react";
|
|
38255
38286
|
import { jsx as jsx123, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
@@ -38271,7 +38302,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
38271
38302
|
setDraft(saved);
|
|
38272
38303
|
}, [view?.id, savedKey]);
|
|
38273
38304
|
const client = useOptionalRecordsClient10();
|
|
38274
|
-
const relations =
|
|
38305
|
+
const relations = useMemo69(
|
|
38275
38306
|
() => (fields.data ?? []).filter((f) => f.type === "relation" && !!f.relation_target),
|
|
38276
38307
|
[fields.data]
|
|
38277
38308
|
);
|
|
@@ -38290,7 +38321,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
38290
38321
|
cancelled = true;
|
|
38291
38322
|
};
|
|
38292
38323
|
}, [open, client, relations]);
|
|
38293
|
-
const conditionFields =
|
|
38324
|
+
const conditionFields = useMemo69(() => {
|
|
38294
38325
|
const own = (fields.data ?? []).map((f) => ({ id: f.id, key: f.key, label: f.label || f.key, field: f }));
|
|
38295
38326
|
const reached = relations.flatMap(
|
|
38296
38327
|
(rel) => (linkedFields[rel.id] ?? []).filter((inner) => inner.type !== "relation").map((inner) => ({
|
|
@@ -39226,7 +39257,7 @@ function TablePage({
|
|
|
39226
39257
|
const next = { sort: q.sort, filters: q.filters, search: q.search, page: q.page };
|
|
39227
39258
|
setGridQuery((held) => sameViewAddress(held, next) ? held : next);
|
|
39228
39259
|
}, []);
|
|
39229
|
-
const addressPort =
|
|
39260
|
+
const addressPort = useMemo70(
|
|
39230
39261
|
() => ({ initial: arrival.current, report: reportGrid, resetEpoch: addressResetEpoch }),
|
|
39231
39262
|
[reportGrid, addressResetEpoch]
|
|
39232
39263
|
);
|
|
@@ -40187,7 +40218,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
40187
40218
|
import { formatCount as formatCount8 } from "@ai-matrx/kit/format";
|
|
40188
40219
|
import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "@ai-matrx/design-system";
|
|
40189
40220
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
40190
|
-
import { useEffect as useEffect101, useMemo as
|
|
40221
|
+
import { useEffect as useEffect101, useMemo as useMemo71, useRef as useRef48, useState as useState115 } from "react";
|
|
40191
40222
|
import { Button as Button96, ErrorBox as ErrorBox5, Input as Input12, cn as cn72 } from "@ai-matrx/design-system";
|
|
40192
40223
|
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient91, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
40193
40224
|
import { Fragment as Fragment55, jsx as jsx126, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
@@ -40200,7 +40231,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
40200
40231
|
const choiceColumns = entityChoiceColumns(entity.columns);
|
|
40201
40232
|
const column = (groupBy ? choiceColumns.find((c) => c.key === groupBy) : void 0) ?? choiceColumns[0] ?? null;
|
|
40202
40233
|
const title = entityTitleColumn(entity.columns);
|
|
40203
|
-
const extra =
|
|
40234
|
+
const extra = useMemo71(
|
|
40204
40235
|
() => cardFields ? entity.columns.filter((c) => cardFields.includes(c.key)) : entity.columns.filter((c) => c !== title && c !== column && c.type !== "choice").slice(0, 2),
|
|
40205
40236
|
[cardFields, entity.columns, title, column]
|
|
40206
40237
|
);
|
|
@@ -40551,17 +40582,17 @@ function CalendarLinks({ port }) {
|
|
|
40551
40582
|
}
|
|
40552
40583
|
|
|
40553
40584
|
// src/TemplatePreview.tsx
|
|
40554
|
-
import { useEffect as useEffect103, useMemo as
|
|
40585
|
+
import { useEffect as useEffect103, useMemo as useMemo72, useState as useState117 } from "react";
|
|
40555
40586
|
import { templatePreview } from "@ai-matrx/records/memory";
|
|
40556
40587
|
import { useRecordsClient as useRecordsClient92 } from "@ai-matrx/records/react";
|
|
40557
40588
|
import { formFromSummary as formFromSummary3 } from "@ai-matrx/records/forms";
|
|
40558
40589
|
import { jsx as jsx129, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
40559
40590
|
function useTemplatePreview(spec, today) {
|
|
40560
|
-
return
|
|
40591
|
+
return useMemo72(() => templatePreview(spec, today ? { today } : {}), [spec, today]);
|
|
40561
40592
|
}
|
|
40562
40593
|
function TemplatePreview({ spec, today, initialTable, host, aside, booking, className }) {
|
|
40563
40594
|
const preview = useTemplatePreview(spec, today);
|
|
40564
|
-
const bound =
|
|
40595
|
+
const bound = useMemo72(() => ({ ...host, sayLevelNeeded: false }), [host]);
|
|
40565
40596
|
const first = preview.tables.find((t) => t.token === initialTable) ?? preview.tables[0];
|
|
40566
40597
|
const [active, setActive] = useState117(first?.id ?? null);
|
|
40567
40598
|
const table = preview.tables.find((t) => t.id === active) ?? first;
|