@ai-matrx/records-ui 0.116.45 → 0.116.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -1
- package/dist/{SaveToTable-SL5DUNI4.js → SaveToTable-SWB2ZN5X.js} +3 -3
- package/dist/{chunk-XKI6S5KF.js → chunk-UTMV5ES2.js} +2 -2
- package/dist/{chunk-F4SAKQKQ.js → chunk-Y5QOV3XA.js} +79 -76
- package/dist/chunk-Y5QOV3XA.js.map +1 -0
- package/dist/{chunk-NKZBAIU4.js → chunk-ZUQUZOL5.js} +7 -5
- package/dist/chunk-ZUQUZOL5.js.map +1 -0
- package/dist/helpers.cjs +6 -4
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.js +6 -4
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +109 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -12
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +83 -79
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -2
- package/package.json +5 -5
- package/dist/chunk-F4SAKQKQ.js.map +0 -1
- package/dist/chunk-NKZBAIU4.js.map +0 -1
- /package/dist/{SaveToTable-SL5DUNI4.js.map → SaveToTable-SWB2ZN5X.js.map} +0 -0
- /package/dist/{chunk-XKI6S5KF.js.map → chunk-UTMV5ES2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -391,21 +391,22 @@ function exampleOf(error) {
|
|
|
391
391
|
}
|
|
392
392
|
function refusalForAPerson(error) {
|
|
393
393
|
const code = error.code ?? "internal";
|
|
394
|
+
const timedOut = code === "timed_out" || error.sqlstate === "57014" || /canceling statement due to statement timeout/i.test(String(error.message ?? ""));
|
|
394
395
|
const ours = error.ours === true;
|
|
395
396
|
const hint = plainSentence(String(error.hint ?? ""));
|
|
396
397
|
const message = ours ? plainSentence(String(error.message ?? "")) : peopleSentence(String(error.message ?? ""));
|
|
397
|
-
const title = TITLE[code] ?? "That was refused";
|
|
398
|
+
const title = timedOut ? TITLE["timed_out"] : TITLE[code] ?? "That was refused";
|
|
398
399
|
const hintIsForEngineers = isDeveloperHint(String(error.hint ?? ""));
|
|
399
400
|
const example = exampleOf(error);
|
|
400
|
-
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? REMEDY[code] ?? REMEDY["internal"];
|
|
401
|
+
const remedy = (example ? `Enter it like ${example}.` : null) ?? (hintIsForEngineers ? null : hint.kept) ?? (timedOut ? REMEDY["timed_out"] : REMEDY[code]) ?? REMEDY["internal"];
|
|
401
402
|
const messageIsForEngineers = isEngineerText(String(error.message ?? ""));
|
|
402
|
-
const said2 = (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
403
|
+
const said2 = timedOut ? TIMED_OUT_SAID : (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
403
404
|
const forEngineers = [
|
|
404
405
|
error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
|
|
405
406
|
// The client's own note about a class it did not recognize, or a call that
|
|
406
407
|
// never reached the store. It is rendered out of sight, never as a sentence.
|
|
407
408
|
error.diagnostic ? error.diagnostic : null,
|
|
408
|
-
messageIsForEngineers ? `Message: ${error.message}` : null,
|
|
409
|
+
messageIsForEngineers || timedOut ? `Message: ${error.message}` : null,
|
|
409
410
|
error.hint && (hintIsForEngineers || hint.kept !== error.hint) ? `Hint: ${error.hint}` : null,
|
|
410
411
|
message.dropped.length > 0 || hint.dropped.length > 0 ? `Dropped from the person's view: ${[...message.dropped, ...hint.dropped].join(" | ")}` : null
|
|
411
412
|
].filter(Boolean).join(" ");
|
|
@@ -432,7 +433,7 @@ function refusalIsMissingInput(error) {
|
|
|
432
433
|
function withoutInternalCodes(text) {
|
|
433
434
|
return text.replace(/\s*\((?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+)(?:\s*\/\s*(?:[A-Z]{2,}-\d+[A-Za-z]?|T\d+))*\)/g, "").replace(/\s+([.,;])/g, "$1").trim();
|
|
434
435
|
}
|
|
435
|
-
var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT;
|
|
436
|
+
var MACHINE_IDENTITY, TITLE, REMEDY, ENGINEER_TEXT, TIMED_OUT_SAID;
|
|
436
437
|
var init_plainWords = __esm({
|
|
437
438
|
"src/plainWords.ts"() {
|
|
438
439
|
"use strict";
|
|
@@ -515,6 +516,7 @@ var init_plainWords = __esm({
|
|
|
515
516
|
// the app, arriving on the screen of somebody who cannot act on it.
|
|
516
517
|
/\bbind\s+[`'"A-Za-z]/i
|
|
517
518
|
];
|
|
519
|
+
TIMED_OUT_SAID = "This took too long. Please try again.";
|
|
518
520
|
}
|
|
519
521
|
});
|
|
520
522
|
|
|
@@ -11810,6 +11812,7 @@ var READS = /* @__PURE__ */ new Set([
|
|
|
11810
11812
|
"cell-history",
|
|
11811
11813
|
"cell-filter",
|
|
11812
11814
|
"row-open",
|
|
11815
|
+
"row-print-layout",
|
|
11813
11816
|
"row-history",
|
|
11814
11817
|
"row-copy",
|
|
11815
11818
|
"col-sort-asc",
|
|
@@ -14778,12 +14781,63 @@ init_choiceLooks();
|
|
|
14778
14781
|
var import_field_formats8 = require("@ai-matrx/design-system/field-formats");
|
|
14779
14782
|
|
|
14780
14783
|
// src/formattedValue.tsx
|
|
14781
|
-
var
|
|
14784
|
+
var import_react48 = require("react");
|
|
14782
14785
|
var import_data_table3 = require("@ai-matrx/design-system/data-table");
|
|
14783
14786
|
var import_field_formats6 = require("@ai-matrx/design-system/field-formats");
|
|
14784
|
-
var
|
|
14787
|
+
var import_design_system26 = require("@ai-matrx/design-system");
|
|
14785
14788
|
var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
|
|
14789
|
+
|
|
14790
|
+
// src/LinkPreviewCard.tsx
|
|
14791
|
+
var import_react47 = require("react");
|
|
14792
|
+
var import_design_system25 = require("@ai-matrx/design-system");
|
|
14793
|
+
init_host();
|
|
14786
14794
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
14795
|
+
var answers = /* @__PURE__ */ new Map();
|
|
14796
|
+
function LinkPreviewCard({ url, children }) {
|
|
14797
|
+
const port = useRecordsUi().linkPreview;
|
|
14798
|
+
const [preview, setPreview] = (0, import_react47.useState)(void 0);
|
|
14799
|
+
const [open, setOpen] = (0, import_react47.useState)(false);
|
|
14800
|
+
const timer = (0, import_react47.useRef)(null);
|
|
14801
|
+
(0, import_react47.useEffect)(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
14802
|
+
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children });
|
|
14803
|
+
const ask2 = () => {
|
|
14804
|
+
if (preview !== void 0) return;
|
|
14805
|
+
let pending = answers.get(url);
|
|
14806
|
+
if (!pending) {
|
|
14807
|
+
pending = port.read(url).catch(() => null);
|
|
14808
|
+
answers.set(url, pending);
|
|
14809
|
+
}
|
|
14810
|
+
void pending.then((found) => setPreview(found));
|
|
14811
|
+
};
|
|
14812
|
+
const enter = () => {
|
|
14813
|
+
ask2();
|
|
14814
|
+
if (timer.current) clearTimeout(timer.current);
|
|
14815
|
+
timer.current = setTimeout(() => setOpen(true), 350);
|
|
14816
|
+
};
|
|
14817
|
+
const leave = () => {
|
|
14818
|
+
if (timer.current) clearTimeout(timer.current);
|
|
14819
|
+
setOpen(false);
|
|
14820
|
+
};
|
|
14821
|
+
const shown5 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
14822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system25.HoverCard, { open: open && shown5 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
14823
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system25.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
14824
|
+
shown5 ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_design_system25.HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
14825
|
+
shown5.imageUrl ? (
|
|
14826
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
14827
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("img", { src: shown5.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
14828
|
+
) : null,
|
|
14829
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
14830
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system25.SiteIcon, { site: url, iconUrl: shown5.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
14831
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "truncate text-muted-foreground", children: shown5.siteName ?? "" })
|
|
14832
|
+
] }),
|
|
14833
|
+
shown5.title ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "line-clamp-2 font-medium", children: shown5.title }) : null,
|
|
14834
|
+
shown5.description ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown5.description }) : null
|
|
14835
|
+
] }) : null
|
|
14836
|
+
] });
|
|
14837
|
+
}
|
|
14838
|
+
|
|
14839
|
+
// src/formattedValue.tsx
|
|
14840
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14787
14841
|
var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
|
|
14788
14842
|
var own2 = (event) => event.stopPropagation();
|
|
14789
14843
|
function numberOf3(value) {
|
|
@@ -14801,11 +14855,11 @@ function RatingStars({
|
|
|
14801
14855
|
label,
|
|
14802
14856
|
selectFirst
|
|
14803
14857
|
}) {
|
|
14804
|
-
const armed = (0,
|
|
14858
|
+
const armed = (0, import_react48.useRef)(true);
|
|
14805
14859
|
const score = numberOf3(value) ?? 0;
|
|
14806
14860
|
const shown5 = Math.round(score);
|
|
14807
14861
|
const said2 = `${shown5} out of ${max}`;
|
|
14808
|
-
return /* @__PURE__ */ (0,
|
|
14862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
14809
14863
|
"span",
|
|
14810
14864
|
{
|
|
14811
14865
|
"data-records-rating": "",
|
|
@@ -14817,8 +14871,8 @@ function RatingStars({
|
|
|
14817
14871
|
children: Array.from({ length: max }, (_, i) => {
|
|
14818
14872
|
const n = i + 1;
|
|
14819
14873
|
const lit = n <= shown5;
|
|
14820
|
-
const star = /* @__PURE__ */ (0,
|
|
14821
|
-
return onRate ? /* @__PURE__ */ (0,
|
|
14874
|
+
const star = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { "aria-hidden": true, className: (0, import_design_system26.cn)("text-sm leading-none", lit ? "text-amber-400" : "text-muted-foreground/40"), children: "\u2605" });
|
|
14875
|
+
return onRate ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
14822
14876
|
"button",
|
|
14823
14877
|
{
|
|
14824
14878
|
type: "button",
|
|
@@ -14843,7 +14897,7 @@ function RatingStars({
|
|
|
14843
14897
|
children: star
|
|
14844
14898
|
},
|
|
14845
14899
|
n
|
|
14846
|
-
) : /* @__PURE__ */ (0,
|
|
14900
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { children: star }, n);
|
|
14847
14901
|
})
|
|
14848
14902
|
}
|
|
14849
14903
|
);
|
|
@@ -14851,20 +14905,20 @@ function RatingStars({
|
|
|
14851
14905
|
function rich(id, text, raw, format) {
|
|
14852
14906
|
switch (id) {
|
|
14853
14907
|
case "email":
|
|
14854
|
-
return /* @__PURE__ */ (0,
|
|
14908
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate", children: readableLink(text) }) });
|
|
14855
14909
|
case "url":
|
|
14856
|
-
return /* @__PURE__ */ (0,
|
|
14910
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(LinkPreviewCard, { url: text.includes("://") ? text : `https://${text}`, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_outbound_react3.OutboundLink, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate", children: text }) }) });
|
|
14857
14911
|
case "phone":
|
|
14858
|
-
return /* @__PURE__ */ (0,
|
|
14912
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats6.formatPhone)(text) }) });
|
|
14859
14913
|
case "address":
|
|
14860
|
-
return /* @__PURE__ */ (0,
|
|
14914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
14861
14915
|
import_outbound_react3.OutboundLink,
|
|
14862
14916
|
{
|
|
14863
14917
|
href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
|
|
14864
14918
|
className: LINK,
|
|
14865
14919
|
title: "Open in maps",
|
|
14866
14920
|
onClick: own2,
|
|
14867
|
-
children: /* @__PURE__ */ (0,
|
|
14921
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate", children: text })
|
|
14868
14922
|
}
|
|
14869
14923
|
);
|
|
14870
14924
|
case "progress": {
|
|
@@ -14872,8 +14926,8 @@ function rich(id, text, raw, format) {
|
|
|
14872
14926
|
if (n === null) return void 0;
|
|
14873
14927
|
const pct = format.options?.percentScale === "fraction" ? n * 100 : n;
|
|
14874
14928
|
const clamped = Math.max(0, Math.min(100, pct));
|
|
14875
|
-
return /* @__PURE__ */ (0,
|
|
14876
|
-
/* @__PURE__ */ (0,
|
|
14929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "inline-flex w-full min-w-0 items-center gap-2", title: text, children: [
|
|
14930
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
14877
14931
|
"span",
|
|
14878
14932
|
{
|
|
14879
14933
|
role: "progressbar",
|
|
@@ -14881,24 +14935,24 @@ function rich(id, text, raw, format) {
|
|
|
14881
14935
|
"aria-valuemax": 100,
|
|
14882
14936
|
"aria-valuenow": Math.round(clamped),
|
|
14883
14937
|
className: "h-1.5 min-w-8 flex-1 overflow-hidden rounded-full bg-muted",
|
|
14884
|
-
children: /* @__PURE__ */ (0,
|
|
14938
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: (0, import_design_system26.cn)("block h-full rounded-full", pct >= 100 ? "bg-emerald-500" : "bg-primary"), style: { width: `${clamped}%` } })
|
|
14885
14939
|
}
|
|
14886
14940
|
),
|
|
14887
|
-
/* @__PURE__ */ (0,
|
|
14941
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: text })
|
|
14888
14942
|
] });
|
|
14889
14943
|
}
|
|
14890
14944
|
case "color":
|
|
14891
|
-
return /* @__PURE__ */ (0,
|
|
14892
|
-
/* @__PURE__ */ (0,
|
|
14893
|
-
/* @__PURE__ */ (0,
|
|
14945
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
14946
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "h-4 w-4 shrink-0 rounded border border-border", style: { backgroundColor: text } }),
|
|
14947
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("code", { className: "font-mono text-xs", children: text })
|
|
14894
14948
|
] });
|
|
14895
14949
|
case "tags": {
|
|
14896
14950
|
const items = Array.isArray(raw) ? raw.map(String) : text.split(",").map((s) => s.trim()).filter(Boolean);
|
|
14897
14951
|
if (items.length === 0) return void 0;
|
|
14898
|
-
return /* @__PURE__ */ (0,
|
|
14952
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "flex flex-wrap items-center gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex items-center rounded-md border border-border bg-muted px-1.5 py-0.5 text-xs", children: item }, `${item}-${i}`)) });
|
|
14899
14953
|
}
|
|
14900
14954
|
case "rating":
|
|
14901
|
-
return numberOf3(raw) === null ? void 0 : /* @__PURE__ */ (0,
|
|
14955
|
+
return numberOf3(raw) === null ? void 0 : /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RatingStars, { value: raw, max: format.options?.ratingMax ?? 5 });
|
|
14902
14956
|
default:
|
|
14903
14957
|
return void 0;
|
|
14904
14958
|
}
|
|
@@ -14913,16 +14967,16 @@ function FormattedValue({
|
|
|
14913
14967
|
const score = numberOf3(value);
|
|
14914
14968
|
const max = format.options?.ratingMax ?? 5;
|
|
14915
14969
|
if (def?.id === "rating" && onRate && (value === null || value === void 0 || value === "" || score !== null && score >= 0 && score <= max)) {
|
|
14916
|
-
return /* @__PURE__ */ (0,
|
|
14970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
|
|
14917
14971
|
}
|
|
14918
14972
|
const result = (0, import_field_formats6.formatFieldValue)(value, format);
|
|
14919
|
-
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0,
|
|
14973
|
+
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_data_table3.FormattedCell, { result });
|
|
14920
14974
|
const look = fieldLookFor(def.id);
|
|
14921
14975
|
if (look) {
|
|
14922
14976
|
const View = look.View;
|
|
14923
|
-
return /* @__PURE__ */ (0,
|
|
14977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(View, { value, format });
|
|
14924
14978
|
}
|
|
14925
|
-
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0,
|
|
14979
|
+
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_data_table3.FormattedCell, { result });
|
|
14926
14980
|
}
|
|
14927
14981
|
function linkChipText(raw) {
|
|
14928
14982
|
try {
|
|
@@ -14938,55 +14992,6 @@ function linkChipText(raw) {
|
|
|
14938
14992
|
// src/values.tsx
|
|
14939
14993
|
init_host();
|
|
14940
14994
|
|
|
14941
|
-
// src/LinkPreviewCard.tsx
|
|
14942
|
-
var import_react48 = require("react");
|
|
14943
|
-
var import_design_system26 = require("@ai-matrx/design-system");
|
|
14944
|
-
init_host();
|
|
14945
|
-
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
14946
|
-
var answers = /* @__PURE__ */ new Map();
|
|
14947
|
-
function LinkPreviewCard({ url, children }) {
|
|
14948
|
-
const port = useRecordsUi().linkPreview;
|
|
14949
|
-
const [preview, setPreview] = (0, import_react48.useState)(void 0);
|
|
14950
|
-
const [open, setOpen] = (0, import_react48.useState)(false);
|
|
14951
|
-
const timer = (0, import_react48.useRef)(null);
|
|
14952
|
-
(0, import_react48.useEffect)(() => () => void (timer.current && clearTimeout(timer.current)), []);
|
|
14953
|
-
if (!port) return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children });
|
|
14954
|
-
const ask2 = () => {
|
|
14955
|
-
if (preview !== void 0) return;
|
|
14956
|
-
let pending = answers.get(url);
|
|
14957
|
-
if (!pending) {
|
|
14958
|
-
pending = port.read(url).catch(() => null);
|
|
14959
|
-
answers.set(url, pending);
|
|
14960
|
-
}
|
|
14961
|
-
void pending.then((found) => setPreview(found));
|
|
14962
|
-
};
|
|
14963
|
-
const enter = () => {
|
|
14964
|
-
ask2();
|
|
14965
|
-
if (timer.current) clearTimeout(timer.current);
|
|
14966
|
-
timer.current = setTimeout(() => setOpen(true), 350);
|
|
14967
|
-
};
|
|
14968
|
-
const leave = () => {
|
|
14969
|
-
if (timer.current) clearTimeout(timer.current);
|
|
14970
|
-
setOpen(false);
|
|
14971
|
-
};
|
|
14972
|
-
const shown5 = preview && (preview.title || preview.description || preview.imageUrl) ? preview : null;
|
|
14973
|
-
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system26.HoverCard, { open: open && shown5 !== null, onOpenChange: (next) => next ? void 0 : setOpen(false), children: [
|
|
14974
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system26.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "inline-flex min-w-0 max-w-full", onMouseEnter: enter, onMouseLeave: leave, onFocus: enter, onBlur: leave, children }) }),
|
|
14975
|
-
shown5 ? /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_design_system26.HoverCardContent, { align: "start", className: "w-72 space-y-1.5 p-2 text-xs", "data-records-link-preview": "", children: [
|
|
14976
|
-
shown5.imageUrl ? (
|
|
14977
|
-
// eslint-disable-next-line @next/next/no-img-element
|
|
14978
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("img", { src: shown5.imageUrl, alt: "", className: "h-28 w-full rounded object-cover", referrerPolicy: "no-referrer" })
|
|
14979
|
-
) : null,
|
|
14980
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
14981
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_design_system26.SiteIcon, { site: url, iconUrl: shown5.faviconUrl, className: "h-3.5 w-3.5" }),
|
|
14982
|
-
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { className: "truncate text-muted-foreground", children: shown5.siteName ?? "" })
|
|
14983
|
-
] }),
|
|
14984
|
-
shown5.title ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "line-clamp-2 font-medium", children: shown5.title }) : null,
|
|
14985
|
-
shown5.description ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "line-clamp-3 text-muted-foreground", children: shown5.description }) : null
|
|
14986
|
-
] }) : null
|
|
14987
|
-
] });
|
|
14988
|
-
}
|
|
14989
|
-
|
|
14990
14995
|
// src/gridAttachments.tsx
|
|
14991
14996
|
var import_react50 = require("react");
|
|
14992
14997
|
var import_react51 = require("@ai-matrx/records/react");
|
|
@@ -32397,6 +32402,7 @@ function BulkActions({
|
|
|
32397
32402
|
noun,
|
|
32398
32403
|
nounPlural,
|
|
32399
32404
|
titleKey = null,
|
|
32405
|
+
mayWrite = true,
|
|
32400
32406
|
onDone
|
|
32401
32407
|
}) {
|
|
32402
32408
|
const typeable = (0, import_react175.useMemo)(() => fields.filter(fieldIsEditable), [fields]);
|
|
@@ -32420,12 +32426,12 @@ function BulkActions({
|
|
|
32420
32426
|
if (ok) onDone();
|
|
32421
32427
|
};
|
|
32422
32428
|
return /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
32423
|
-
typeable.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
32429
|
+
mayWrite && typeable.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [
|
|
32424
32430
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "set", disabled: bulk.busy, onClick: () => open("set"), children: "Set a column" }),
|
|
32425
32431
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "clear", disabled: bulk.busy, onClick: () => open("clear"), children: "Clear a column" }),
|
|
32426
32432
|
ids.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "fill", disabled: bulk.busy, onClick: () => open("fill"), children: "Fill down" }) : null
|
|
32427
32433
|
] }) : null,
|
|
32428
|
-
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
32434
|
+
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
32429
32435
|
import_design_system90.Button,
|
|
32430
32436
|
{
|
|
32431
32437
|
size: "sm",
|
|
@@ -32436,9 +32442,9 @@ function BulkActions({
|
|
|
32436
32442
|
onClick: () => void bulk.duplicate(ids).then((ok) => ok ? onDone() : void 0),
|
|
32437
32443
|
children: "Duplicate"
|
|
32438
32444
|
}
|
|
32439
|
-
),
|
|
32445
|
+
) : null,
|
|
32440
32446
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "print", disabled: bulk.busy, onClick: () => setPrinting(true), children: "Print with layout\u2026" }),
|
|
32441
|
-
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }),
|
|
32447
|
+
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Button, { size: "sm", variant: "outline", className: "h-7 px-2", "data-records-bulk": "delete", disabled: bulk.busy, onClick: () => setConfirmDelete(true), children: "Delete" }) : null,
|
|
32442
32448
|
printing ? /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(PrintWithLayoutDialog, { tableId, recordIds: ids, names: printNames(ids, rows, titleKey), open: true, onOpenChange: setPrinting }) : null,
|
|
32443
32449
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsx)(import_design_system90.Dialog, { open: asking !== null, onOpenChange: (next) => !next ? setAsking(null) : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_design_system90.DialogContent, { className: "sm:max-w-md", children: [
|
|
32444
32450
|
/* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_design_system90.DialogHeader, { children: [
|
|
@@ -33393,7 +33399,7 @@ function GridBody({
|
|
|
33393
33399
|
versions
|
|
33394
33400
|
});
|
|
33395
33401
|
const [selectedIds, setSelectedIds] = (0, import_react182.useState)([]);
|
|
33396
|
-
const offerSelection = !embedded && !readOnly &&
|
|
33402
|
+
const offerSelection = !embedded && !readOnly && (merged || canWrite && tableActions2.runnable.length > 0);
|
|
33397
33403
|
const [reordering, setReordering] = (0, import_react182.useState)(false);
|
|
33398
33404
|
const chosenSummaries = localSummaries ?? presentation.summaries ?? NO_SUMMARIES;
|
|
33399
33405
|
const summaryVersion = (0, import_react182.useMemo)(
|
|
@@ -35009,10 +35015,11 @@ function GridBody({
|
|
|
35009
35015
|
noun,
|
|
35010
35016
|
nounPlural,
|
|
35011
35017
|
titleKey,
|
|
35018
|
+
mayWrite: canWrite,
|
|
35012
35019
|
onDone: () => setSelectedIds([])
|
|
35013
35020
|
}
|
|
35014
35021
|
) : null,
|
|
35015
|
-
tableActions2.runnable.map((action3) => /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
35022
|
+
canWrite ? tableActions2.runnable.map((action3) => /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
35016
35023
|
ActionButton,
|
|
35017
35024
|
{
|
|
35018
35025
|
action: action3,
|
|
@@ -35021,7 +35028,7 @@ function GridBody({
|
|
|
35021
35028
|
onPress: () => runner.press(action3, ids)
|
|
35022
35029
|
},
|
|
35023
35030
|
action3.id
|
|
35024
|
-
))
|
|
35031
|
+
)) : null
|
|
35025
35032
|
] })
|
|
35026
35033
|
}
|
|
35027
35034
|
} : embedded ? { selection: false } : {},
|
|
@@ -61298,6 +61305,20 @@ function TablePage({
|
|
|
61298
61305
|
const [duplicateOpen, setDuplicateOpen] = (0, import_react346.useState)(false);
|
|
61299
61306
|
const [referenceOpen, setReferenceOpen] = (0, import_react346.useState)(false);
|
|
61300
61307
|
const [subscribeOpen, setSubscribeOpen] = (0, import_react346.useState)(false);
|
|
61308
|
+
const subscribeDateKey = shown5?.dateField ?? (shown5?.layout === "calendar" && allFields.data ? eligibleFieldFor("date", allFields.data, null).field?.key ?? null : null);
|
|
61309
|
+
const subscribeInCalendar = async () => {
|
|
61310
|
+
const current = view;
|
|
61311
|
+
if (!current || !subscribeDateKey) return;
|
|
61312
|
+
if (current.dateField !== subscribeDateKey) {
|
|
61313
|
+
const written = await saveViewPatch(client, tableId, current.id, { dateField: subscribeDateKey });
|
|
61314
|
+
if (!written.ok) {
|
|
61315
|
+
recordsUi.notify?.error(refusalSentence(written.error));
|
|
61316
|
+
return;
|
|
61317
|
+
}
|
|
61318
|
+
setView({ ...current, dateField: subscribeDateKey });
|
|
61319
|
+
}
|
|
61320
|
+
setSubscribeOpen(true);
|
|
61321
|
+
};
|
|
61301
61322
|
const [breakDownOpen, setBreakDownOpen] = (0, import_react346.useState)(false);
|
|
61302
61323
|
const canGetReference = useCanGetReference();
|
|
61303
61324
|
const [toolbarSlot, setToolbarSlot] = (0, import_react346.useState)(null);
|
|
@@ -61756,8 +61777,8 @@ function TablePage({
|
|
|
61756
61777
|
// THE PRIVATE CALENDAR LINK (CAL-FEED-UI): only where the host bound the doors.
|
|
61757
61778
|
...recordsUi.calendarFeed && organizationId ? [
|
|
61758
61779
|
subscribeCalendarAction({
|
|
61759
|
-
...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !
|
|
61760
|
-
run: () => void window.setTimeout(() =>
|
|
61780
|
+
...mayDo.known && !mayDo.read ? { disabledReason: "Needs Viewer access" } : !view ? { disabledReason: NO_VIEW_REASON } : !subscribeDateKey ? { disabledReason: shown5?.layout === "calendar" ? "This table has no date column" : "Switch this view to Calendar to subscribe" } : {},
|
|
61781
|
+
run: () => void window.setTimeout(() => void subscribeInCalendar(), 0)
|
|
61761
61782
|
})
|
|
61762
61783
|
] : [],
|
|
61763
61784
|
...actionHost?.extend ? actionHost.extend(subject, mayDo) : []
|