@ai-matrx/records-ui 0.115.93 → 0.115.95
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 +17 -0
- package/dist/index.cjs +109 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +682 -625
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +98 -47
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +122 -71
- package/dist/pickers.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog — @ai-matrx/records-ui
|
|
2
2
|
|
|
3
|
+
## 0.115.95
|
|
4
|
+
|
|
5
|
+
UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
|
|
6
|
+
Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui/src`.
|
|
7
|
+
|
|
8
|
+
## 0.115.94
|
|
9
|
+
|
|
10
|
+
SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
|
|
11
|
+
so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
|
|
12
|
+
Diff: `git diff 84cf41cf37 c127354b27 -- apps/shared/records-ui/src`
|
|
13
|
+
|
|
14
|
+
Changed shipped source files (4):
|
|
15
|
+
- `apps/shared/records-ui/src/InterfaceScreen.tsx`
|
|
16
|
+
- `apps/shared/records-ui/src/PageCanvas.tsx`
|
|
17
|
+
- `apps/shared/records-ui/src/index.ts`
|
|
18
|
+
- `apps/shared/records-ui/src/interfaces.ts`
|
|
19
|
+
|
|
3
20
|
## 0.115.93
|
|
4
21
|
### Unreleased
|
|
5
22
|
|
package/dist/index.cjs
CHANGED
|
@@ -551,7 +551,7 @@ __export(src_exports, {
|
|
|
551
551
|
renderValue: () => renderValue,
|
|
552
552
|
rescheduledValue: () => rescheduledValue,
|
|
553
553
|
resolveTableStyle: () => resolveTableStyle,
|
|
554
|
-
|
|
554
|
+
restoreInterfaceVersion: () => restoreInterfaceVersion,
|
|
555
555
|
revokeConsequence: () => revokeConsequence,
|
|
556
556
|
rightsReason: () => rightsReason,
|
|
557
557
|
rowActionFromAgent: () => rowActionFromAgent,
|
|
@@ -11133,6 +11133,15 @@ function buttonPressWords(label, pressed) {
|
|
|
11133
11133
|
const status = pressed.status ?? "ran";
|
|
11134
11134
|
return [`${pressed.automation ?? label}: ${status}.`, pressed.says].filter(Boolean).join(" ");
|
|
11135
11135
|
}
|
|
11136
|
+
var POLL_EVERY_MS = 1200;
|
|
11137
|
+
var POLL_FOR_MS = 12e4;
|
|
11138
|
+
function runAnswerWords(label, run) {
|
|
11139
|
+
const steps = run.steps ?? [];
|
|
11140
|
+
const failedStep = [...steps].reverse().find((s) => s.status === "failed");
|
|
11141
|
+
if (run.status === "failed") return [failedStep?.output_text ?? failedStep?.says, run.says].filter((t, i, all) => t && all.indexOf(t) === i).join(" ") || `${label} failed.`;
|
|
11142
|
+
const answered = [...steps].reverse().find((s) => s.output_text && s.output_text.trim() !== "");
|
|
11143
|
+
return answered?.output_text?.trim() || run.says || `${label} ran.`;
|
|
11144
|
+
}
|
|
11136
11145
|
var stop = (event) => event.stopPropagation();
|
|
11137
11146
|
function ButtonValue({ field: field2, recordId, inCell }) {
|
|
11138
11147
|
const client = (0, import_react59.useOptionalRecordsClient)();
|
|
@@ -11140,6 +11149,8 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
11140
11149
|
const [busy, setBusy] = (0, import_react58.useState)(false);
|
|
11141
11150
|
const [said2, setSaid] = (0, import_react58.useState)(null);
|
|
11142
11151
|
const [settingUp, setSettingUp] = (0, import_react58.useState)(false);
|
|
11152
|
+
const waitingOn = (0, import_react58.useRef)(0);
|
|
11153
|
+
(0, import_react58.useEffect)(() => () => void (waitingOn.current += 1), []);
|
|
11143
11154
|
if (!b) return null;
|
|
11144
11155
|
const color = (0, import_data_table7.isStyleColor)(b.color) ? import_data_table7.CHOICE_CHIP_CLASS[b.color] : import_data_table7.NEUTRAL_CHIP_CLASS;
|
|
11145
11156
|
const needs = (0, import_records29.buttonNeeds)(b);
|
|
@@ -11156,60 +11167,100 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
11156
11167
|
const opened = typeof window !== "undefined" ? (0, import_outbound.openOutbound)(pressed.url, "_blank", "noopener") : null;
|
|
11157
11168
|
return setSaid({ kind: "ran", says: opened ? `${b.label} opened.` : `${b.label} is ready:`, link: pressed.url });
|
|
11158
11169
|
}
|
|
11159
|
-
|
|
11170
|
+
const words2 = buttonPressWords(b.label, pressed);
|
|
11171
|
+
if (pressed.do === "run_automation" && pressed.status === "waiting" && pressed.run_id && b.automation_id) {
|
|
11172
|
+
const mine = waitingOn.current += 1;
|
|
11173
|
+
setBusy(true);
|
|
11174
|
+
setSaid({ kind: "waiting", says: `${b.label} is running` });
|
|
11175
|
+
const until = Date.now() + POLL_FOR_MS;
|
|
11176
|
+
while (waitingOn.current === mine) {
|
|
11177
|
+
await new Promise((r) => setTimeout(r, POLL_EVERY_MS));
|
|
11178
|
+
if (waitingOn.current !== mine) return;
|
|
11179
|
+
const runs = await client.automationRuns({ automation_id: b.automation_id, limit: 10 });
|
|
11180
|
+
if (!runs.ok) {
|
|
11181
|
+
setBusy(false);
|
|
11182
|
+
return setSaid({ kind: "refused", error: runs.error });
|
|
11183
|
+
}
|
|
11184
|
+
const run = runs.data.runs.find((r) => r.run_id === pressed.run_id);
|
|
11185
|
+
if (run && run.status !== "waiting") {
|
|
11186
|
+
setBusy(false);
|
|
11187
|
+
return setSaid(run.status === "ran" ? { kind: "ran", says: runAnswerWords(b.label, run) } : { kind: "failed", says: runAnswerWords(b.label, run) });
|
|
11188
|
+
}
|
|
11189
|
+
if (Date.now() > until) {
|
|
11190
|
+
setBusy(false);
|
|
11191
|
+
return setSaid({ kind: "ran", says: `${b.label} is still running. Its answer will be in the automation's runs.` });
|
|
11192
|
+
}
|
|
11193
|
+
}
|
|
11194
|
+
return;
|
|
11195
|
+
}
|
|
11196
|
+
setSaid({ kind: "ran", says: words2 });
|
|
11160
11197
|
};
|
|
11161
11198
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11162
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11163
|
-
|
|
11164
|
-
|
|
11165
|
-
|
|
11166
|
-
|
|
11167
|
-
|
|
11168
|
-
|
|
11169
|
-
|
|
11170
|
-
|
|
11171
|
-
|
|
11172
|
-
|
|
11173
|
-
|
|
11174
|
-
onPointerDown: stop,
|
|
11175
|
-
onDoubleClick: stop,
|
|
11176
|
-
onClick: (event) => {
|
|
11177
|
-
event.stopPropagation();
|
|
11178
|
-
event.preventDefault();
|
|
11179
|
-
void press();
|
|
11180
|
-
},
|
|
11181
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "truncate", children: b.label })
|
|
11182
|
-
}
|
|
11183
|
-
) }),
|
|
11184
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system35.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
|
|
11185
|
-
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
11186
|
-
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
11187
|
-
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { className: "break-words", children: [
|
|
11188
|
-
said2.says,
|
|
11189
|
-
" ",
|
|
11190
|
-
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_outbound_react6.OutboundLink, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
11191
|
-
] }) : null,
|
|
11192
|
-
said2?.kind === "needs" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11193
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: said2.says }),
|
|
11194
|
-
tableId ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11199
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11200
|
+
import_design_system35.Popover,
|
|
11201
|
+
{
|
|
11202
|
+
open: said2 !== null,
|
|
11203
|
+
onOpenChange: (open) => {
|
|
11204
|
+
if (open) return;
|
|
11205
|
+
waitingOn.current += 1;
|
|
11206
|
+
setBusy(false);
|
|
11207
|
+
setSaid(null);
|
|
11208
|
+
},
|
|
11209
|
+
children: [
|
|
11210
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system35.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
11195
11211
|
import_design_system35.Button,
|
|
11196
11212
|
{
|
|
11197
11213
|
type: "button",
|
|
11198
|
-
size: "
|
|
11199
|
-
|
|
11200
|
-
|
|
11201
|
-
|
|
11202
|
-
|
|
11214
|
+
size: "xs",
|
|
11215
|
+
variant: "outline",
|
|
11216
|
+
"data-records-button": field2.key,
|
|
11217
|
+
"data-records-button-unset": needs ? "" : void 0,
|
|
11218
|
+
"aria-busy": busy || void 0,
|
|
11219
|
+
disabled: busy,
|
|
11220
|
+
className: (0, import_design_system35.cn)("max-w-full gap-1 border px-2 font-medium", inCell ? "h-5" : "h-6", color, needs && "border-dashed opacity-80"),
|
|
11221
|
+
onPointerDown: stop,
|
|
11222
|
+
onDoubleClick: stop,
|
|
11223
|
+
onClick: (event) => {
|
|
11224
|
+
event.stopPropagation();
|
|
11225
|
+
event.preventDefault();
|
|
11226
|
+
void press();
|
|
11203
11227
|
},
|
|
11204
|
-
children:
|
|
11205
|
-
"Set up ",
|
|
11206
|
-
b.label
|
|
11207
|
-
]
|
|
11228
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "truncate", children: b.label })
|
|
11208
11229
|
}
|
|
11209
|
-
)
|
|
11210
|
-
|
|
11211
|
-
|
|
11212
|
-
|
|
11230
|
+
) }),
|
|
11231
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system35.PopoverContent, { className: "w-72 space-y-2 p-3 text-sm", onClick: stop, onPointerDown: stop, "data-records-button-said": said2?.kind, children: [
|
|
11232
|
+
said2?.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RefusalLine, { error: said2.error }) : null,
|
|
11233
|
+
said2?.kind === "waiting" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "matrx-shimmer rounded px-1 py-0.5", role: "status", "aria-live": "polite", children: said2.says }) : null,
|
|
11234
|
+
said2?.kind === "failed" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "break-words text-destructive", role: "alert", children: said2.says }) : null,
|
|
11235
|
+
said2?.kind === "public" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: "Buttons run for signed-in people." }) : null,
|
|
11236
|
+
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("p", { className: "break-words", children: [
|
|
11237
|
+
said2.says,
|
|
11238
|
+
" ",
|
|
11239
|
+
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_outbound_react6.OutboundLink, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
11240
|
+
] }) : null,
|
|
11241
|
+
said2?.kind === "needs" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
11242
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { children: said2.says }),
|
|
11243
|
+
tableId ? /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
11244
|
+
import_design_system35.Button,
|
|
11245
|
+
{
|
|
11246
|
+
type: "button",
|
|
11247
|
+
size: "sm",
|
|
11248
|
+
"data-records-button-set-up": "",
|
|
11249
|
+
onClick: () => {
|
|
11250
|
+
setSaid(null);
|
|
11251
|
+
setSettingUp(true);
|
|
11252
|
+
},
|
|
11253
|
+
children: [
|
|
11254
|
+
"Set up ",
|
|
11255
|
+
b.label
|
|
11256
|
+
]
|
|
11257
|
+
}
|
|
11258
|
+
) : null
|
|
11259
|
+
] }) : null
|
|
11260
|
+
] })
|
|
11261
|
+
]
|
|
11262
|
+
}
|
|
11263
|
+
),
|
|
11213
11264
|
settingUp && tableId ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system35.Dialog, { open: true, onOpenChange: (open) => open ? null : setSettingUp(false), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system35.DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl", onClick: stop, onPointerDown: stop, children: [
|
|
11214
11265
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_design_system35.DialogHeader, { children: [
|
|
11215
11266
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_design_system35.DialogTitle, { children: `Column settings \xB7 ${fieldName(field2)}` }),
|
|
@@ -49572,7 +49623,7 @@ function clearUnpublished(shape) {
|
|
|
49572
49623
|
if (!shape.published) return shape;
|
|
49573
49624
|
return { ...shape, draft: { pages: shape.published.pages } };
|
|
49574
49625
|
}
|
|
49575
|
-
function
|
|
49626
|
+
function restoreInterfaceVersion(shape, version2) {
|
|
49576
49627
|
const found = shape.versions.find((v) => v.version === version2);
|
|
49577
49628
|
return found ? { ...shape, draft: { pages: found.pages } } : shape;
|
|
49578
49629
|
}
|
|
@@ -51880,7 +51931,7 @@ function DoorLayoutView({ block, door }) {
|
|
|
51880
51931
|
"data-records-page-card": row.id,
|
|
51881
51932
|
children: [
|
|
51882
51933
|
block.image_field && typeof (row.document ?? {})[block.image_field] === "string" ? /* @__PURE__ */ (0, import_jsx_runtime164.jsx)("img", { src: (row.document ?? {})[block.image_field], alt: "", className: "h-28 w-full rounded object-cover" }) : null,
|
|
51883
|
-
columns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime164.jsx)("span", { className: (0, import_design_system145.cn)("min-w-0 truncate", f.key === title?.key ? "text-sm font-medium" : "text-xs"), children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(RecordValue, { field: f, value: (row.document ?? {})[f.key], document: row.document, recordId: row.id, inCell: true }) }, f.key))
|
|
51934
|
+
columns.map((f) => /* @__PURE__ */ (0, import_jsx_runtime164.jsx)("span", { className: (0, import_design_system145.cn)("min-w-0 truncate", f.key === title?.key ? "text-sm font-medium" : "text-xs"), children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(RecordValue, { field: f, value: (row.document ?? {})[f.key], document: row.document, withheld: row.hidden?.[f.key] ?? null, recordId: row.id, inCell: true }) }, f.key))
|
|
51884
51935
|
]
|
|
51885
51936
|
},
|
|
51886
51937
|
row.id
|
|
@@ -52705,7 +52756,7 @@ function InterfaceScreen({
|
|
|
52705
52756
|
const builder = !!read && BUILDER_LEVELS.has(read.level);
|
|
52706
52757
|
const showDraft = builder && (editing || !shape?.published);
|
|
52707
52758
|
const pages = shape ? showDraft ? shape.draft.pages : shape.published?.pages ?? [] : [];
|
|
52708
|
-
const page = pageById(pages,
|
|
52759
|
+
const page = pageById(pages, localPage ?? pageId);
|
|
52709
52760
|
const charts = (0, import_react297.useMemo)(() => shape ? interfaceCharts(shape) : [], [shape]);
|
|
52710
52761
|
const through = !!read && !read.member;
|
|
52711
52762
|
const chartKey = read ? `${read.id}:${read.version}:${charts.length}` : "";
|
|
@@ -52768,7 +52819,7 @@ function InterfaceScreen({
|
|
|
52768
52819
|
value: "",
|
|
52769
52820
|
options: shape.versions.map((v) => ({ value: String(v.version), label: `Version ${v.version}${v.at ? ` \xB7 ${v.at.slice(0, 10)}` : ""}` })),
|
|
52770
52821
|
onChange: (v) => {
|
|
52771
|
-
if (v) void save(
|
|
52822
|
+
if (v) void save(restoreInterfaceVersion(shape, Number(v)));
|
|
52772
52823
|
},
|
|
52773
52824
|
attrs: { "data-records-interface-history": "" },
|
|
52774
52825
|
className: "h-8 w-32"
|
|
@@ -52838,6 +52889,9 @@ function InterfaceScreen({
|
|
|
52838
52889
|
onBlur: (e) => {
|
|
52839
52890
|
const name = e.currentTarget.value.trim();
|
|
52840
52891
|
if (name && name !== read.name) void save(shape, name);
|
|
52892
|
+
},
|
|
52893
|
+
onKeyDown: (e) => {
|
|
52894
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
52841
52895
|
}
|
|
52842
52896
|
},
|
|
52843
52897
|
`name-${read.version}`
|
|
@@ -52862,6 +52916,9 @@ function InterfaceScreen({
|
|
|
52862
52916
|
onBlur: (e) => {
|
|
52863
52917
|
const name = e.currentTarget.value.trim();
|
|
52864
52918
|
if (name && name !== page.name) savePage({ ...page, name });
|
|
52919
|
+
},
|
|
52920
|
+
onKeyDown: (e) => {
|
|
52921
|
+
if (e.key === "Enter") e.currentTarget.blur();
|
|
52865
52922
|
}
|
|
52866
52923
|
},
|
|
52867
52924
|
`page-${page.id}-${page.name}`
|