@ai-matrx/records-ui 0.115.69 → 0.115.71
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 +11 -0
- package/dist/first-page.cjs +0 -1
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.js +0 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +618 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +1258 -0
- package/dist/helpers.d.ts +1258 -0
- package/dist/helpers.js +559 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.cjs +335 -309
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -4
- package/dist/index.d.ts +10 -4
- package/dist/index.js +208 -188
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +110 -89
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +85 -70
- package/dist/pickers.js.map +1 -1
- package/package.json +13 -3
package/dist/index.cjs
CHANGED
|
@@ -564,6 +564,7 @@ __export(src_exports, {
|
|
|
564
564
|
styleFromDecorations: () => styleFromDecorations,
|
|
565
565
|
submissionStamp: () => import_forms8.submissionStamp,
|
|
566
566
|
subscribeCalendarAction: () => subscribeCalendarAction,
|
|
567
|
+
subscribePersonTimeZone: () => subscribePersonTimeZone,
|
|
567
568
|
surfaceChosen: () => surfaceChosen,
|
|
568
569
|
tableActions: () => tableActions,
|
|
569
570
|
tableLink: () => tableLink,
|
|
@@ -726,8 +727,7 @@ function lockedStructure(base2) {
|
|
|
726
727
|
return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
|
|
727
728
|
}
|
|
728
729
|
|
|
729
|
-
// src/
|
|
730
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
730
|
+
// src/tableRights.ts
|
|
731
731
|
function tableRights(may, overallReason) {
|
|
732
732
|
return {
|
|
733
733
|
...may,
|
|
@@ -739,6 +739,9 @@ var NO_RIGHTS = tableRights(NOT_ANSWERED_YET);
|
|
|
739
739
|
function tableRightsAt(level) {
|
|
740
740
|
return tableRights(whatYouMayDo(level, true));
|
|
741
741
|
}
|
|
742
|
+
|
|
743
|
+
// src/host.tsx
|
|
744
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
742
745
|
var NO_SAVED_VIEWS_REASON = "There are no saved views here yet, so there is nothing to be told about. Save a view of this table first and it will be offered here.";
|
|
743
746
|
var NO_MEMBERS_REASON = "This app cannot offer the people in your organization on this screen yet, so there is nobody to pick. Type the person's name into a text field for now, and tell us \u2014 it is on our list, not yours.";
|
|
744
747
|
var NO_SHARE_REASON = "Sharing is not available on this screen, so there is no Share button here rather than one that opens nothing. Share this table from the tables list instead.";
|
|
@@ -1269,13 +1272,18 @@ var REVERSE_COLUMN_PREFIX = "linked:";
|
|
|
1269
1272
|
|
|
1270
1273
|
// src/gridPage.ts
|
|
1271
1274
|
var import_records6 = require("@ai-matrx/records");
|
|
1272
|
-
var
|
|
1275
|
+
var import_data_table = require("@ai-matrx/design-system/data-table");
|
|
1273
1276
|
|
|
1274
1277
|
// src/personTime.ts
|
|
1275
1278
|
var import_react4 = require("react");
|
|
1279
|
+
|
|
1280
|
+
// src/personZone.ts
|
|
1276
1281
|
var import_table_style = require("@ai-matrx/design-system/data-table/table-style");
|
|
1277
|
-
var
|
|
1278
|
-
var
|
|
1282
|
+
var import_global_slot = require("@ai-matrx/kit/global-slot");
|
|
1283
|
+
var state = (0, import_global_slot.globalSlot)("ai-matrx.records-ui.person-time-zone", () => ({
|
|
1284
|
+
zone: null,
|
|
1285
|
+
listeners: /* @__PURE__ */ new Set()
|
|
1286
|
+
}));
|
|
1279
1287
|
function valid(z) {
|
|
1280
1288
|
if (typeof z !== "string" || !z.trim()) return false;
|
|
1281
1289
|
try {
|
|
@@ -1287,25 +1295,22 @@ function valid(z) {
|
|
|
1287
1295
|
}
|
|
1288
1296
|
function setPersonTimeZone(next) {
|
|
1289
1297
|
const clean = valid(next) ? next : null;
|
|
1290
|
-
if (clean === zone) return;
|
|
1291
|
-
zone = clean;
|
|
1298
|
+
if (clean === state.zone) return;
|
|
1299
|
+
state.zone = clean;
|
|
1292
1300
|
(0, import_table_style.setColorRuleTimeZone)(clean);
|
|
1293
|
-
listeners.forEach((l) => l());
|
|
1301
|
+
state.listeners.forEach((l) => l());
|
|
1294
1302
|
}
|
|
1295
1303
|
function getPersonTimeZone() {
|
|
1296
|
-
return zone;
|
|
1304
|
+
return state.zone;
|
|
1297
1305
|
}
|
|
1298
|
-
function
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
},
|
|
1304
|
-
() => zone,
|
|
1305
|
-
() => null
|
|
1306
|
-
);
|
|
1306
|
+
function subscribePersonTimeZone(listener) {
|
|
1307
|
+
state.listeners.add(listener);
|
|
1308
|
+
return () => {
|
|
1309
|
+
state.listeners.delete(listener);
|
|
1310
|
+
};
|
|
1307
1311
|
}
|
|
1308
1312
|
function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
1313
|
+
const zone = state.zone;
|
|
1309
1314
|
if (!zone) return at;
|
|
1310
1315
|
const parts = new Intl.DateTimeFormat("en-US", {
|
|
1311
1316
|
timeZone: zone,
|
|
@@ -1321,9 +1326,18 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
|
|
|
1321
1326
|
return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
1322
1327
|
}
|
|
1323
1328
|
|
|
1329
|
+
// src/personTime.ts
|
|
1330
|
+
function usePersonTimeZone() {
|
|
1331
|
+
return (0, import_react4.useSyncExternalStore)(
|
|
1332
|
+
subscribePersonTimeZone,
|
|
1333
|
+
getPersonTimeZone,
|
|
1334
|
+
() => null
|
|
1335
|
+
);
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1324
1338
|
// src/choiceLooks.ts
|
|
1325
1339
|
var import_records2 = require("@ai-matrx/records");
|
|
1326
|
-
var
|
|
1340
|
+
var import_table_style2 = require("@ai-matrx/design-system/data-table/table-style");
|
|
1327
1341
|
function displayFormatOf(field2) {
|
|
1328
1342
|
const raw = field2.display_format;
|
|
1329
1343
|
if (!raw || typeof raw !== "object") return null;
|
|
@@ -1333,7 +1347,7 @@ function displayFormatOf(field2) {
|
|
|
1333
1347
|
return { id, options: options && typeof options === "object" ? options : {} };
|
|
1334
1348
|
}
|
|
1335
1349
|
function isStyleColor(v) {
|
|
1336
|
-
return typeof v === "string" &&
|
|
1350
|
+
return typeof v === "string" && import_table_style2.STYLE_COLORS.includes(v);
|
|
1337
1351
|
}
|
|
1338
1352
|
function choiceLooksOf(field2) {
|
|
1339
1353
|
const display = displayFormatOf(field2);
|
|
@@ -1397,9 +1411,9 @@ function nextChoiceColor(worn) {
|
|
|
1397
1411
|
function choiceChipLookOf(field2, ...words2) {
|
|
1398
1412
|
for (const word of words2) {
|
|
1399
1413
|
const color = storedChoiceColor(field2, word);
|
|
1400
|
-
if (color) return { className:
|
|
1414
|
+
if (color) return { className: import_table_style2.CHOICE_CHIP_CLASS[color], color };
|
|
1401
1415
|
}
|
|
1402
|
-
return { className:
|
|
1416
|
+
return { className: import_table_style2.NEUTRAL_CHIP_CLASS, color: null };
|
|
1403
1417
|
}
|
|
1404
1418
|
|
|
1405
1419
|
// src/parity.ts
|
|
@@ -1664,10 +1678,10 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
|
|
|
1664
1678
|
return { rule: value.negated ? not(range) : range };
|
|
1665
1679
|
}
|
|
1666
1680
|
case "date": {
|
|
1667
|
-
const
|
|
1668
|
-
const moments = (0,
|
|
1681
|
+
const zone = getPersonTimeZone() ?? void 0;
|
|
1682
|
+
const moments = (0, import_data_table.dateFilterBounds)(value.preset ? { ...value, anchor: now.toISOString() } : value, now, zone);
|
|
1669
1683
|
const holdsDays = String((f.config ?? {})["kind"] ?? "") === "date";
|
|
1670
|
-
const bounds = holdsDays ? (0,
|
|
1684
|
+
const bounds = holdsDays ? (0, import_data_table.dateFilterDayBounds)(moments, zone) : moments;
|
|
1671
1685
|
if (bounds.since === void 0 && bounds.until === void 0) return null;
|
|
1672
1686
|
return {
|
|
1673
1687
|
flat: {
|
|
@@ -1683,7 +1697,7 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
|
|
|
1683
1697
|
}
|
|
1684
1698
|
}
|
|
1685
1699
|
function dayWindow(day2, holdsDays) {
|
|
1686
|
-
if (!holdsDays) return (0,
|
|
1700
|
+
if (!holdsDays) return (0, import_data_table.dayInstantWindow)(day2, getPersonTimeZone() ?? void 0);
|
|
1687
1701
|
const [y, m, d] = day2.split("-").map(Number);
|
|
1688
1702
|
const ymd = (t) => `${t.getUTCFullYear()}-${String(t.getUTCMonth() + 1).padStart(2, "0")}-${String(t.getUTCDate()).padStart(2, "0")}`;
|
|
1689
1703
|
return { from: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, d ?? 1))), to: ymd(new Date(Date.UTC(y, (m ?? 1) - 1, (d ?? 1) + 1))) };
|
|
@@ -3735,7 +3749,8 @@ var import_react16 = require("react");
|
|
|
3735
3749
|
var import_records10 = require("@ai-matrx/records");
|
|
3736
3750
|
var import_react17 = require("@ai-matrx/records/react");
|
|
3737
3751
|
var import_design_system9 = require("@ai-matrx/design-system");
|
|
3738
|
-
|
|
3752
|
+
|
|
3753
|
+
// src/tablePickerEntries.ts
|
|
3739
3754
|
var PLATFORM_TABLE_PREFIX = "records_ui_";
|
|
3740
3755
|
function keptByPlatform(table) {
|
|
3741
3756
|
return table.platform_owned === true || table.kept_by_the_app === true;
|
|
@@ -3779,6 +3794,9 @@ function madeOn(stamp) {
|
|
|
3779
3794
|
if (Number.isNaN(at.getTime())) return null;
|
|
3780
3795
|
return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
|
|
3781
3796
|
}
|
|
3797
|
+
|
|
3798
|
+
// src/tablePicking.tsx
|
|
3799
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
3782
3800
|
function usePickerTables() {
|
|
3783
3801
|
const client = (0, import_react17.useRecordsClient)();
|
|
3784
3802
|
const tables = (0, import_react17.useTables)();
|
|
@@ -4342,8 +4360,7 @@ var import_react67 = require("@ai-matrx/records/react");
|
|
|
4342
4360
|
var import_design_system38 = require("@ai-matrx/design-system");
|
|
4343
4361
|
|
|
4344
4362
|
// src/presentation.ts
|
|
4345
|
-
var
|
|
4346
|
-
var import_data_table3 = require("@ai-matrx/design-system/data-table");
|
|
4363
|
+
var import_table_style3 = require("@ai-matrx/design-system/data-table/table-style");
|
|
4347
4364
|
var import_field_formats2 = require("@ai-matrx/design-system/field-formats");
|
|
4348
4365
|
var import_records12 = require("@ai-matrx/records");
|
|
4349
4366
|
|
|
@@ -4487,8 +4504,8 @@ function parseGridPresentation(raw) {
|
|
|
4487
4504
|
}
|
|
4488
4505
|
if (!isRecord(value)) return {};
|
|
4489
4506
|
const out = {};
|
|
4490
|
-
const style = (0,
|
|
4491
|
-
if (!(0,
|
|
4507
|
+
const style = (0, import_table_style3.parseTableStyle)(value["style"]);
|
|
4508
|
+
if (!(0, import_table_style3.tableStyleIsEmpty)(style)) out.style = style;
|
|
4492
4509
|
if (isRecord(value["formats"])) {
|
|
4493
4510
|
const formats = {};
|
|
4494
4511
|
for (const [key, cfg] of Object.entries(value["formats"])) {
|
|
@@ -4633,7 +4650,7 @@ function parseGrouping(raw) {
|
|
|
4633
4650
|
return out;
|
|
4634
4651
|
}
|
|
4635
4652
|
function presentationIsEmpty(p) {
|
|
4636
|
-
return (p.style === void 0 || (0,
|
|
4653
|
+
return (p.style === void 0 || (0, import_table_style3.tableStyleIsEmpty)(p.style)) && Object.keys(p.formats ?? {}).length === 0 && (p.frozen?.length ?? 0) === 0 && p.grouping === void 0 && Object.keys(p.widths ?? {}).length === 0 && p.rowHeight === void 0 && (p.hiddenFields?.length ?? 0) === 0 && p.cardHidden === void 0 && (p.columnOrder?.length ?? 0) === 0 && p.gallerySize === void 0 && p.boardSize === void 0 && p.boardPreview === void 0 && p.boardHideEmpty === void 0 && p.boardColorColumns === void 0 && p.boardCounts === void 0 && (p.boardLanesShut?.length ?? 0) === 0 && p.locked === void 0 && p.wrap === void 0 && p.fit === void 0 && p.freezeFirst === void 0 && p.footer === void 0 && Object.keys(p.summaries ?? {}).length === 0 && p.gantt === void 0;
|
|
4637
4654
|
}
|
|
4638
4655
|
function presentationDocument(p) {
|
|
4639
4656
|
return presentationIsEmpty(p) ? "" : JSON.stringify(p);
|
|
@@ -4707,7 +4724,7 @@ var colorFromTheValue = (_fieldKey, value) => {
|
|
|
4707
4724
|
for (let i = 0; i < text.length; i += 1) {
|
|
4708
4725
|
hash = hash * 31 + text.charCodeAt(i) >>> 0;
|
|
4709
4726
|
}
|
|
4710
|
-
return
|
|
4727
|
+
return import_table_style3.COLOR_ROTATION[hash % import_table_style3.COLOR_ROTATION.length];
|
|
4711
4728
|
};
|
|
4712
4729
|
function styleFromDecorations(decorations, fields) {
|
|
4713
4730
|
if (!decorations) return { version: 1 };
|
|
@@ -4781,7 +4798,7 @@ var import_react22 = require("react");
|
|
|
4781
4798
|
var import_records13 = require("@ai-matrx/records");
|
|
4782
4799
|
var import_react23 = require("@ai-matrx/records/react");
|
|
4783
4800
|
var import_design_system12 = require("@ai-matrx/design-system");
|
|
4784
|
-
var
|
|
4801
|
+
var import_data_table2 = require("@ai-matrx/design-system/data-table");
|
|
4785
4802
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4786
4803
|
var rowSeed = 0;
|
|
4787
4804
|
var nextRow = () => `new-${rowSeed += 1}`;
|
|
@@ -4999,12 +5016,12 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
|
|
|
4999
5016
|
"button",
|
|
5000
5017
|
{
|
|
5001
5018
|
type: "button",
|
|
5002
|
-
"aria-label": `Colour for ${words2}: ${color ?
|
|
5003
|
-
title: color ?
|
|
5019
|
+
"aria-label": `Colour for ${words2}: ${color ? import_data_table2.STYLE_COLOR_LABELS[color] : "none"}`,
|
|
5020
|
+
title: color ? import_data_table2.STYLE_COLOR_LABELS[color] : "No colour",
|
|
5004
5021
|
"data-records-choice-swatch": color ?? "none",
|
|
5005
5022
|
className: (0, import_design_system12.cn)(
|
|
5006
5023
|
"h-4 w-4 shrink-0 rounded-full",
|
|
5007
|
-
color ?
|
|
5024
|
+
color ? import_data_table2.SWATCH_CLASS[color] : "border border-border bg-background"
|
|
5008
5025
|
)
|
|
5009
5026
|
}
|
|
5010
5027
|
) }),
|
|
@@ -5021,17 +5038,17 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
|
|
|
5021
5038
|
className: (0, import_design_system12.cn)("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
|
|
5022
5039
|
}
|
|
5023
5040
|
),
|
|
5024
|
-
|
|
5041
|
+
import_data_table2.STYLE_COLORS.map((c) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5025
5042
|
"button",
|
|
5026
5043
|
{
|
|
5027
5044
|
type: "button",
|
|
5028
5045
|
role: "radio",
|
|
5029
5046
|
"aria-checked": color === c,
|
|
5030
|
-
"aria-label":
|
|
5031
|
-
title:
|
|
5047
|
+
"aria-label": import_data_table2.STYLE_COLOR_LABELS[c],
|
|
5048
|
+
title: import_data_table2.STYLE_COLOR_LABELS[c],
|
|
5032
5049
|
"data-records-choice-color": `${words2}:${c}`,
|
|
5033
5050
|
onClick: () => pick(c),
|
|
5034
|
-
className: (0, import_design_system12.cn)("h-5 w-5 rounded-full",
|
|
5051
|
+
className: (0, import_design_system12.cn)("h-5 w-5 rounded-full", import_data_table2.SWATCH_CLASS[c], color === c && "ring-2 ring-ring ring-offset-1")
|
|
5035
5052
|
},
|
|
5036
5053
|
c
|
|
5037
5054
|
))
|
|
@@ -5085,6 +5102,7 @@ var import_react26 = require("react");
|
|
|
5085
5102
|
var import_source = require("@ai-matrx/content-ir/source");
|
|
5086
5103
|
var import_records14 = require("@ai-matrx/records");
|
|
5087
5104
|
var import_design_system14 = require("@ai-matrx/design-system");
|
|
5105
|
+
var import_outbound_react = require("@ai-matrx/kit/outbound-react");
|
|
5088
5106
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5089
5107
|
var own = (event) => event.stopPropagation();
|
|
5090
5108
|
function newerKindValue(field2, value, opts = {}) {
|
|
@@ -5133,11 +5151,9 @@ function AddressLink({ value }) {
|
|
|
5133
5151
|
const href = (0, import_records14.addressMapUrl)(value);
|
|
5134
5152
|
if (!words2 || !href) return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-muted-foreground", children: "\u2014" });
|
|
5135
5153
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
5136
|
-
|
|
5154
|
+
import_outbound_react.OutboundLink,
|
|
5137
5155
|
{
|
|
5138
5156
|
href,
|
|
5139
|
-
target: "_blank",
|
|
5140
|
-
rel: "noopener noreferrer",
|
|
5141
5157
|
className: "inline-flex min-w-0 items-center gap-1 text-primary hover:underline",
|
|
5142
5158
|
title: "Open in maps",
|
|
5143
5159
|
"data-records-address": "",
|
|
@@ -5185,7 +5201,7 @@ function marks(text, key) {
|
|
|
5185
5201
|
const link = /^\[([^\]]+)\]\(([^)\s]+)\)$/.exec(tok);
|
|
5186
5202
|
const href = (0, import_records14.safeLinkHref)(link?.[2] ?? "");
|
|
5187
5203
|
out.push(
|
|
5188
|
-
href ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
5204
|
+
href ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_outbound_react.OutboundLink, { href, className: "text-primary underline-offset-2 hover:underline", onClick: own, children: link?.[1] }, k) : link?.[1] ?? tok
|
|
5189
5205
|
);
|
|
5190
5206
|
} else out.push(/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("em", { children: tok.slice(1, -1) }, k));
|
|
5191
5207
|
last = at + tok.length;
|
|
@@ -5716,7 +5732,7 @@ function RelationPicker({ field: field2, value, onChange, disabled, id, classNam
|
|
|
5716
5732
|
// src/buttonCell.tsx
|
|
5717
5733
|
var import_react54 = require("react");
|
|
5718
5734
|
var import_design_system34 = require("@ai-matrx/design-system");
|
|
5719
|
-
var
|
|
5735
|
+
var import_data_table7 = require("@ai-matrx/design-system/data-table");
|
|
5720
5736
|
var import_records29 = require("@ai-matrx/records");
|
|
5721
5737
|
var import_react55 = require("@ai-matrx/records/react");
|
|
5722
5738
|
|
|
@@ -6054,11 +6070,10 @@ var import_design_system27 = require("@ai-matrx/design-system");
|
|
|
6054
6070
|
var import_react45 = require("@ai-matrx/records/react");
|
|
6055
6071
|
|
|
6056
6072
|
// src/values.tsx
|
|
6057
|
-
var
|
|
6073
|
+
var import_data_table4 = require("@ai-matrx/design-system/data-table");
|
|
6058
6074
|
var import_field_formats4 = require("@ai-matrx/design-system/field-formats");
|
|
6059
6075
|
|
|
6060
|
-
// src/
|
|
6061
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6076
|
+
// src/withheldNotice.ts
|
|
6062
6077
|
var WITHHELD_WORD = "Withheld";
|
|
6063
6078
|
function withheldNoticeOf(hidden, key) {
|
|
6064
6079
|
const notice = hidden?.[key];
|
|
@@ -6076,6 +6091,9 @@ function withheldSentence(field2, notice) {
|
|
|
6076
6091
|
const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
|
|
6077
6092
|
return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
|
|
6078
6093
|
}
|
|
6094
|
+
|
|
6095
|
+
// src/withheld.tsx
|
|
6096
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
6079
6097
|
function WithheldValue({ field: field2, notice }) {
|
|
6080
6098
|
const sentence2 = withheldSentence(field2, notice);
|
|
6081
6099
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
@@ -6441,6 +6459,7 @@ var import_core6 = require("@ai-matrx/records/core");
|
|
|
6441
6459
|
var import_react36 = require("react");
|
|
6442
6460
|
var import_core5 = require("@ai-matrx/records/core");
|
|
6443
6461
|
var import_design_system19 = require("@ai-matrx/design-system");
|
|
6462
|
+
var import_outbound_react2 = require("@ai-matrx/kit/outbound-react");
|
|
6444
6463
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
6445
6464
|
var WHOLE_VALUE_UNBOUND = "The whole text is kept as a file, and this screen has no way to open files yet.";
|
|
6446
6465
|
function wholeValueLine(pointer) {
|
|
@@ -6455,7 +6474,7 @@ function WholeValueCell({ words: words2, pointer }) {
|
|
|
6455
6474
|
words2,
|
|
6456
6475
|
"\u2026"
|
|
6457
6476
|
] }),
|
|
6458
|
-
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
6477
|
+
href ? host.Link ? host.Link({ href, children: line, className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_outbound_react2.OutboundLink, { className: "shrink-0 text-xs text-primary underline-offset-2 hover:underline", href, children: line }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "shrink-0 text-xs italic text-muted-foreground", title: WHOLE_VALUE_UNBOUND, children: `${(0, import_core5.wholeValueSize)(pointer)} in a file` })
|
|
6459
6478
|
] });
|
|
6460
6479
|
}
|
|
6461
6480
|
var WHOLE_VALUE_NOT_EDITABLE_HERE = "The whole text is kept as a file. Open it to read it; this screen cannot load it to edit.";
|
|
@@ -6534,9 +6553,10 @@ var import_field_formats5 = require("@ai-matrx/design-system/field-formats");
|
|
|
6534
6553
|
|
|
6535
6554
|
// src/formattedValue.tsx
|
|
6536
6555
|
var import_react37 = require("react");
|
|
6537
|
-
var
|
|
6556
|
+
var import_data_table3 = require("@ai-matrx/design-system/data-table");
|
|
6538
6557
|
var import_field_formats3 = require("@ai-matrx/design-system/field-formats");
|
|
6539
6558
|
var import_design_system20 = require("@ai-matrx/design-system");
|
|
6559
|
+
var import_outbound_react3 = require("@ai-matrx/kit/outbound-react");
|
|
6540
6560
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
6541
6561
|
var LINK = "inline-flex min-w-0 items-center gap-1 text-primary hover:underline";
|
|
6542
6562
|
var own2 = (event) => event.stopPropagation();
|
|
@@ -6607,16 +6627,14 @@ function rich(id, text, raw, format) {
|
|
|
6607
6627
|
case "email":
|
|
6608
6628
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { href: `mailto:${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: text }) });
|
|
6609
6629
|
case "url":
|
|
6610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_outbound_react3.OutboundLink, { href: text.includes("://") ? text : `https://${text}`, className: LINK, onClick: own2, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate", children: text }) });
|
|
6611
6631
|
case "phone":
|
|
6612
6632
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("a", { href: `tel:${text.replace(/[^\d+]/g, "")}`, className: LINK, onClick: own2, title: text, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate tabular-nums", children: (0, import_field_formats3.formatPhone)(text) }) });
|
|
6613
6633
|
case "address":
|
|
6614
6634
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6615
|
-
|
|
6635
|
+
import_outbound_react3.OutboundLink,
|
|
6616
6636
|
{
|
|
6617
6637
|
href: `https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(text)}`,
|
|
6618
|
-
target: "_blank",
|
|
6619
|
-
rel: "noopener noreferrer",
|
|
6620
6638
|
className: LINK,
|
|
6621
6639
|
title: "Open in maps",
|
|
6622
6640
|
onClick: own2,
|
|
@@ -6672,8 +6690,8 @@ function FormattedValue({
|
|
|
6672
6690
|
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(RatingStars, { value, max: format.options?.ratingMax ?? 5, onRate, selectFirst });
|
|
6673
6691
|
}
|
|
6674
6692
|
const result = (0, import_field_formats3.formatFieldValue)(value, format);
|
|
6675
|
-
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6676
|
-
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
6693
|
+
if (!result.ok || result.empty || !def?.rich) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table3.FormattedCell, { result });
|
|
6694
|
+
return rich(def.id, result.text, value, format) ?? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_data_table3.FormattedCell, { result });
|
|
6677
6695
|
}
|
|
6678
6696
|
function linkChipText(raw) {
|
|
6679
6697
|
try {
|
|
@@ -6786,6 +6804,7 @@ function FilePicker({
|
|
|
6786
6804
|
}
|
|
6787
6805
|
|
|
6788
6806
|
// src/gridAttachments.tsx
|
|
6807
|
+
var import_outbound_react4 = require("@ai-matrx/kit/outbound-react");
|
|
6789
6808
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
6790
6809
|
function attachmentIdsOf(value) {
|
|
6791
6810
|
return idsOf(value);
|
|
@@ -6842,11 +6861,9 @@ function AttachmentChip({ id, onRemove }) {
|
|
|
6842
6861
|
const title = href ? `Open ${words2}` : read?.why ?? FILE_CHIP_NO_PAGE;
|
|
6843
6862
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_design_system22.Badge, { variant: "secondary", className: "max-w-[14rem] gap-1 text-[11px]", "data-records-file-chip": id, title, children: [
|
|
6844
6863
|
href ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
6845
|
-
|
|
6864
|
+
import_outbound_react4.OutboundLink,
|
|
6846
6865
|
{
|
|
6847
6866
|
href,
|
|
6848
|
-
target: "_blank",
|
|
6849
|
-
rel: "noreferrer",
|
|
6850
6867
|
className: "truncate underline-offset-2 hover:underline",
|
|
6851
6868
|
"data-records-file-link": read?.fileId ?? "",
|
|
6852
6869
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -7319,8 +7336,8 @@ function formulaSourceArchived(field2, document2) {
|
|
|
7319
7336
|
const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
|
|
7320
7337
|
if (!Array.isArray(keys) || !document2) return null;
|
|
7321
7338
|
for (const key of keys) {
|
|
7322
|
-
const
|
|
7323
|
-
if (
|
|
7339
|
+
const state2 = (0, import_records19.sourceArchivedOf)(document2[String(key)]);
|
|
7340
|
+
if (state2) return state2;
|
|
7324
7341
|
}
|
|
7325
7342
|
return null;
|
|
7326
7343
|
}
|
|
@@ -7505,6 +7522,7 @@ function WorkedOutError({ field: field2, sentence: sentence2, floated = false })
|
|
|
7505
7522
|
}
|
|
7506
7523
|
|
|
7507
7524
|
// src/values.tsx
|
|
7525
|
+
var import_outbound_react5 = require("@ai-matrx/kit/outbound-react");
|
|
7508
7526
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
7509
7527
|
function statusMark(field2, item, document2) {
|
|
7510
7528
|
const mark = statusMarkOf(field2, item, document2);
|
|
@@ -7549,12 +7567,12 @@ function computedEmptyOf(field2, document2) {
|
|
|
7549
7567
|
return { kind: "formula" };
|
|
7550
7568
|
}
|
|
7551
7569
|
var SOURCE_ARCHIVED_WORDS = "Source archived";
|
|
7552
|
-
function sourceArchivedSentence(
|
|
7553
|
-
if (!
|
|
7554
|
-
return
|
|
7570
|
+
function sourceArchivedSentence(state2) {
|
|
7571
|
+
if (!state2.label) return "A column it reads is archived";
|
|
7572
|
+
return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
|
|
7555
7573
|
}
|
|
7556
|
-
function SourceArchivedValue({ state }) {
|
|
7557
|
-
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(
|
|
7574
|
+
function SourceArchivedValue({ state: state2 }) {
|
|
7575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
|
|
7558
7576
|
}
|
|
7559
7577
|
var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
|
|
7560
7578
|
function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
|
|
@@ -7599,7 +7617,7 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
|
|
|
7599
7617
|
const chosen = kind === "select" || kind === "multi_select";
|
|
7600
7618
|
const chipOf = (item) => {
|
|
7601
7619
|
const chipLook = choiceChipLookOf(field2, item, scalarText(field2, item, labels));
|
|
7602
|
-
return { className: chipLook.className, tinted: chipLook.color !== null, dot:
|
|
7620
|
+
return { className: chipLook.className, tinted: chipLook.color !== null, dot: import_data_table4.SWATCH_CLASS[chipLook.color ?? "gray"] };
|
|
7603
7621
|
};
|
|
7604
7622
|
if (chosen) {
|
|
7605
7623
|
const items = Array.isArray(value) ? value : [value];
|
|
@@ -7629,12 +7647,10 @@ function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
|
|
|
7629
7647
|
if (kind === "url" && typeof value === "string") {
|
|
7630
7648
|
const href = value.includes("://") ? value : `https://${value}`;
|
|
7631
7649
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
|
|
7632
|
-
|
|
7650
|
+
import_outbound_react5.OutboundLink,
|
|
7633
7651
|
{
|
|
7634
7652
|
className: "inline-flex min-w-0 max-w-full items-center gap-1 rounded-md border border-border bg-muted/60 px-1.5 py-0.5 text-[11px] text-foreground hover:bg-accent",
|
|
7635
7653
|
href,
|
|
7636
|
-
target: "_blank",
|
|
7637
|
-
rel: "noreferrer",
|
|
7638
7654
|
title: value,
|
|
7639
7655
|
"data-records-link-chip": "",
|
|
7640
7656
|
onClick: (event) => event.stopPropagation(),
|
|
@@ -7769,7 +7785,7 @@ function RecordValue({
|
|
|
7769
7785
|
const shown5 = format ?? formatForField(field2);
|
|
7770
7786
|
const shape = shown5 && (shown5.id === "date" || shown5.id === "datetime") && isDateField(field2) ? dateFormatFor(field2, value) : void 0;
|
|
7771
7787
|
const dated = shape ? { ...shape, ...shown5?.options ? { options: shown5.options } : {} } : void 0;
|
|
7772
|
-
const formatted = shown5 ? (0,
|
|
7788
|
+
const formatted = shown5 ? (0, import_data_table4.formatColumnValue)({ format: dated ?? shown5 }, value) : null;
|
|
7773
7789
|
if (formatted && !(embeddedLook?.blankEmpty && formatted.empty)) return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(FormattedValue, { value, format: dated ?? shown5 });
|
|
7774
7790
|
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: renderValue(field2, value, document2, labels, stillWaitingFor, embeddedLook) });
|
|
7775
7791
|
}
|
|
@@ -7794,12 +7810,12 @@ function cardWords(record, field2, labels) {
|
|
|
7794
7810
|
|
|
7795
7811
|
// src/SourceArchivedNotice.tsx
|
|
7796
7812
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
7797
|
-
function bringBackLabel(
|
|
7798
|
-
return
|
|
7813
|
+
function bringBackLabel(state2) {
|
|
7814
|
+
return state2.label ? `Bring back ${state2.label}` : "Bring it back";
|
|
7799
7815
|
}
|
|
7800
7816
|
function SourceArchivedNotice({ fieldId, tableId }) {
|
|
7801
7817
|
const client = (0, import_react45.useRecordsClient)();
|
|
7802
|
-
const [
|
|
7818
|
+
const [state2, setState] = (0, import_react44.useState)(null);
|
|
7803
7819
|
const [busy, setBusy] = (0, import_react44.useState)(false);
|
|
7804
7820
|
const [refused, setRefused] = (0, import_react44.useState)(null);
|
|
7805
7821
|
const read = (0, import_react44.useCallback)(async () => {
|
|
@@ -7810,19 +7826,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
7810
7826
|
(0, import_react44.useEffect)(() => {
|
|
7811
7827
|
void read();
|
|
7812
7828
|
}, [read]);
|
|
7813
|
-
if (refused && !
|
|
7814
|
-
if (!
|
|
7829
|
+
if (refused && !state2) return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: refused });
|
|
7830
|
+
if (!state2) return null;
|
|
7815
7831
|
const restore = async () => {
|
|
7816
|
-
if (!
|
|
7832
|
+
if (!state2.field_id) return;
|
|
7817
7833
|
setBusy(true);
|
|
7818
7834
|
setRefused(null);
|
|
7819
|
-
const done = await client.fieldRestore({ field_id:
|
|
7835
|
+
const done = await client.fieldRestore({ field_id: state2.field_id });
|
|
7820
7836
|
setBusy(false);
|
|
7821
7837
|
if (!done.ok) {
|
|
7822
7838
|
setRefused(done.error);
|
|
7823
7839
|
return;
|
|
7824
7840
|
}
|
|
7825
|
-
if (
|
|
7841
|
+
if (state2.table_id) (0, import_react45.tableShapeChanged)(state2.table_id);
|
|
7826
7842
|
(0, import_react45.tableShapeChanged)(tableId);
|
|
7827
7843
|
await read();
|
|
7828
7844
|
};
|
|
@@ -7831,13 +7847,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
|
|
|
7831
7847
|
{
|
|
7832
7848
|
className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
|
|
7833
7849
|
"data-testid": "source-archived-notice",
|
|
7834
|
-
"data-field-id":
|
|
7850
|
+
"data-field-id": state2.field_id ?? "",
|
|
7835
7851
|
children: [
|
|
7836
7852
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
|
|
7837
7853
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
|
|
7838
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(
|
|
7854
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
|
|
7839
7855
|
] }),
|
|
7840
|
-
|
|
7856
|
+
state2.field_id ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_design_system27.Button, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
|
|
7841
7857
|
refused ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(RefusalNotice, { error: refused, className: "basis-full" }) : null
|
|
7842
7858
|
]
|
|
7843
7859
|
}
|
|
@@ -7875,10 +7891,10 @@ var RELATIVE_DAY_TERMS = [
|
|
|
7875
7891
|
{ kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
|
|
7876
7892
|
];
|
|
7877
7893
|
function relativeDayNode(fieldId, kind, days) {
|
|
7878
|
-
const
|
|
7894
|
+
const zone = getPersonTimeZone();
|
|
7879
7895
|
const window2 = { relative: kind };
|
|
7880
7896
|
if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
|
|
7881
|
-
if (
|
|
7897
|
+
if (zone) window2["tz"] = zone;
|
|
7882
7898
|
return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
|
|
7883
7899
|
}
|
|
7884
7900
|
function relativeDayOf(expr) {
|
|
@@ -8907,14 +8923,14 @@ var import_records27 = require("@ai-matrx/records");
|
|
|
8907
8923
|
// src/ButtonSettings.tsx
|
|
8908
8924
|
var import_react50 = require("react");
|
|
8909
8925
|
var import_design_system32 = require("@ai-matrx/design-system");
|
|
8910
|
-
var
|
|
8926
|
+
var import_data_table6 = require("@ai-matrx/design-system/data-table");
|
|
8911
8927
|
var import_records26 = require("@ai-matrx/records");
|
|
8912
8928
|
var import_react51 = require("@ai-matrx/records/react");
|
|
8913
8929
|
|
|
8914
8930
|
// src/AccentSwatches.tsx
|
|
8915
8931
|
var import_records25 = require("@ai-matrx/records");
|
|
8916
8932
|
var import_design_system31 = require("@ai-matrx/design-system");
|
|
8917
|
-
var
|
|
8933
|
+
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
8918
8934
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
8919
8935
|
function AccentSwatches({ value, onChange, options = import_records25.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
8920
8936
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
@@ -8938,10 +8954,10 @@ function AccentSwatches({ value, onChange, options = import_records25.PORTAL_ACC
|
|
|
8938
8954
|
type: "button",
|
|
8939
8955
|
role: "radio",
|
|
8940
8956
|
"aria-checked": value === c,
|
|
8941
|
-
"aria-label":
|
|
8942
|
-
title:
|
|
8957
|
+
"aria-label": import_data_table5.STYLE_COLOR_LABELS[c],
|
|
8958
|
+
title: import_data_table5.STYLE_COLOR_LABELS[c],
|
|
8943
8959
|
onClick: () => onChange(c),
|
|
8944
|
-
className: (0, import_design_system31.cn)("h-7 w-7 rounded-full border-2",
|
|
8960
|
+
className: (0, import_design_system31.cn)("h-7 w-7 rounded-full border-2", import_data_table5.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
|
|
8945
8961
|
},
|
|
8946
8962
|
c
|
|
8947
8963
|
))
|
|
@@ -9021,7 +9037,7 @@ function ButtonSettingsEditor({
|
|
|
9021
9037
|
AccentSwatches,
|
|
9022
9038
|
{
|
|
9023
9039
|
value: value.color ?? "",
|
|
9024
|
-
options:
|
|
9040
|
+
options: import_data_table6.STYLE_COLORS,
|
|
9025
9041
|
noneLabel: "Plain",
|
|
9026
9042
|
onChange: (next) => set({ color: next === "" ? void 0 : next })
|
|
9027
9043
|
}
|
|
@@ -10091,12 +10107,12 @@ function sourceKindOf(field2) {
|
|
|
10091
10107
|
if (kind === "attachment") return "file";
|
|
10092
10108
|
return null;
|
|
10093
10109
|
}
|
|
10094
|
-
function whatIsMissing(
|
|
10095
|
-
const noun =
|
|
10096
|
-
const { type, label, via, pick, agg, of, relations, formulaFields } =
|
|
10097
|
-
const relationTarget =
|
|
10110
|
+
function whatIsMissing(state2) {
|
|
10111
|
+
const noun = state2.noun ?? "column";
|
|
10112
|
+
const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
|
|
10113
|
+
const relationTarget = state2.relationTarget ?? "";
|
|
10098
10114
|
if (label.trim() === "") return `Give the ${noun} a name.`;
|
|
10099
|
-
if (type === "entity_reference") return whatIsMissingForEntityReference(
|
|
10115
|
+
if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
|
|
10100
10116
|
if (type === "relation") {
|
|
10101
10117
|
if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
|
|
10102
10118
|
return null;
|
|
@@ -10451,6 +10467,8 @@ function NewColumnDefault({
|
|
|
10451
10467
|
}
|
|
10452
10468
|
|
|
10453
10469
|
// src/buttonCell.tsx
|
|
10470
|
+
var import_outbound_react6 = require("@ai-matrx/kit/outbound-react");
|
|
10471
|
+
var import_outbound = require("@ai-matrx/kit/outbound");
|
|
10454
10472
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
10455
10473
|
function buttonPressWords(label, pressed) {
|
|
10456
10474
|
if (pressed.do === "open_url") return `${label} opened ${pressed.url}`;
|
|
@@ -10469,7 +10487,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
10469
10487
|
const [said2, setSaid] = (0, import_react54.useState)(null);
|
|
10470
10488
|
const [settingUp, setSettingUp] = (0, import_react54.useState)(false);
|
|
10471
10489
|
if (!b) return null;
|
|
10472
|
-
const color = (0,
|
|
10490
|
+
const color = (0, import_data_table7.isStyleColor)(b.color) ? import_data_table7.CHOICE_CHIP_CLASS[b.color] : import_data_table7.NEUTRAL_CHIP_CLASS;
|
|
10473
10491
|
const needs = (0, import_records29.buttonNeeds)(b);
|
|
10474
10492
|
const tableId = field2.entity_definition_id;
|
|
10475
10493
|
const press = async () => {
|
|
@@ -10481,7 +10499,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
10481
10499
|
if (!answered.ok) return setSaid({ kind: "refused", error: answered.error });
|
|
10482
10500
|
const pressed = answered.data;
|
|
10483
10501
|
if (pressed.do === "open_url") {
|
|
10484
|
-
const opened = typeof window !== "undefined" ?
|
|
10502
|
+
const opened = typeof window !== "undefined" ? (0, import_outbound.openOutbound)(pressed.url, "_blank", "noopener") : null;
|
|
10485
10503
|
return setSaid({ kind: "ran", says: opened ? `${b.label} opened.` : `${b.label} is ready:`, link: pressed.url });
|
|
10486
10504
|
}
|
|
10487
10505
|
setSaid({ kind: "ran", says: buttonPressWords(b.label, pressed) });
|
|
@@ -10515,7 +10533,7 @@ function ButtonValue({ field: field2, recordId, inCell }) {
|
|
|
10515
10533
|
said2?.kind === "ran" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("p", { className: "break-words", children: [
|
|
10516
10534
|
said2.says,
|
|
10517
10535
|
" ",
|
|
10518
|
-
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
10536
|
+
said2.link ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_outbound_react6.OutboundLink, { href: said2.link, className: "text-primary underline", children: said2.link }) : null
|
|
10519
10537
|
] }) : null,
|
|
10520
10538
|
said2?.kind === "needs" ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
10521
10539
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: said2.says }),
|
|
@@ -12817,7 +12835,7 @@ function GridCell({
|
|
|
12817
12835
|
else cancelSinglePress();
|
|
12818
12836
|
};
|
|
12819
12837
|
const value = editing ? editing.valueFor(row, field2) : row.document?.[field2.key];
|
|
12820
|
-
const
|
|
12838
|
+
const state2 = editing ? editing.stateOf(row.id, field2.key) : null;
|
|
12821
12839
|
const refusal3 = editing ? editing.refusalOf(row.id, field2.key) : null;
|
|
12822
12840
|
const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
|
|
12823
12841
|
if (open && editing) {
|
|
@@ -12878,7 +12896,7 @@ function GridCell({
|
|
|
12878
12896
|
disabled: !editable,
|
|
12879
12897
|
"aria-label": editable ? `${fieldName(field2)} \u2014 press Space to ${value === true ? "untick" : "tick"}` : fieldName(field2),
|
|
12880
12898
|
title: editable ? answered ? `${fieldName(field2)} \u2014 press Space to change` : `${fieldName(field2)} \u2014 nobody has answered this yet` : whyNot ?? `${fieldName(field2)} \u2014 you cannot change this record`,
|
|
12881
|
-
className: (0, import_design_system38.cn)(
|
|
12899
|
+
className: (0, import_design_system38.cn)(state2 === "saving" ? "opacity-60" : "", state2 === "refused" ? "ring-1 ring-destructive" : ""),
|
|
12882
12900
|
onCheckedChange: (next) => editing?.setCell(row.id, field2.key, next === true)
|
|
12883
12901
|
}
|
|
12884
12902
|
),
|
|
@@ -12889,7 +12907,7 @@ function GridCell({
|
|
|
12889
12907
|
if (editable && format?.id === "rating") {
|
|
12890
12908
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
|
|
12891
12909
|
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
|
|
12892
|
-
|
|
12910
|
+
state2 === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
|
|
12893
12911
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
|
|
12894
12912
|
] });
|
|
12895
12913
|
}
|
|
@@ -12951,8 +12969,8 @@ function GridCell({
|
|
|
12951
12969
|
// table cell, and a click there is a row click.
|
|
12952
12970
|
"block w-full min-w-0 flex-1 truncate rounded px-1 py-0.5",
|
|
12953
12971
|
editable ? "cursor-text hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : "",
|
|
12954
|
-
|
|
12955
|
-
|
|
12972
|
+
state2 === "saving" ? "opacity-60" : "",
|
|
12973
|
+
state2 === "refused" ? "ring-1 ring-destructive" : ""
|
|
12956
12974
|
),
|
|
12957
12975
|
onMouseDown: onPointerDown,
|
|
12958
12976
|
onClickCapture: onLinkClickCapture,
|
|
@@ -13011,7 +13029,7 @@ function GridCell({
|
|
|
13011
13029
|
}
|
|
13012
13030
|
) : null
|
|
13013
13031
|
] }),
|
|
13014
|
-
|
|
13032
|
+
state2 === "saving" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
|
|
13015
13033
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
|
|
13016
13034
|
]
|
|
13017
13035
|
}
|
|
@@ -13370,7 +13388,7 @@ function rememberLayout(tableId, layout) {
|
|
|
13370
13388
|
// src/RecordsSkeleton.tsx
|
|
13371
13389
|
var import_react68 = require("react");
|
|
13372
13390
|
var import_design_system39 = require("@ai-matrx/design-system");
|
|
13373
|
-
var
|
|
13391
|
+
var import_data_table8 = require("@ai-matrx/design-system/data-table");
|
|
13374
13392
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
13375
13393
|
var NEVER = () => () => {
|
|
13376
13394
|
};
|
|
@@ -13415,7 +13433,7 @@ var PLACEHOLDER_COLUMNS = ["a", "b", "c", "d", "e", "f"].map((id) => ({
|
|
|
13415
13433
|
var NO_ROWS2 = [];
|
|
13416
13434
|
function GridSkeleton({ embedded, rows }) {
|
|
13417
13435
|
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
13418
|
-
|
|
13436
|
+
import_data_table8.MatrxDataTable,
|
|
13419
13437
|
{
|
|
13420
13438
|
...embedded ? {} : { className: "min-h-0 flex-1" },
|
|
13421
13439
|
data: NO_ROWS2,
|
|
@@ -13573,7 +13591,7 @@ var import_react143 = require("react");
|
|
|
13573
13591
|
var import_react144 = require("@ai-matrx/records/react");
|
|
13574
13592
|
var import_records46 = require("@ai-matrx/records");
|
|
13575
13593
|
var import_records47 = require("@ai-matrx/records");
|
|
13576
|
-
var
|
|
13594
|
+
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
13577
13595
|
var import_core18 = require("@ai-matrx/records/core");
|
|
13578
13596
|
|
|
13579
13597
|
// src/tableDecorations.ts
|
|
@@ -13581,7 +13599,7 @@ var import_react71 = require("react");
|
|
|
13581
13599
|
var import_react72 = require("@ai-matrx/records/react");
|
|
13582
13600
|
function useTableDecorations(tableId, revision) {
|
|
13583
13601
|
const client = (0, import_react72.useRecordsClient)();
|
|
13584
|
-
const [
|
|
13602
|
+
const [state2, setState] = (0, import_react71.useState)({ data: null, loading: Boolean(tableId) });
|
|
13585
13603
|
const seen = (0, import_react71.useRef)({ tableId: void 0, revision: void 0 });
|
|
13586
13604
|
const ticket = (0, import_react71.useRef)(0);
|
|
13587
13605
|
(0, import_react71.useEffect)(() => {
|
|
@@ -13607,7 +13625,7 @@ function useTableDecorations(tableId, revision) {
|
|
|
13607
13625
|
ticket.current += 1;
|
|
13608
13626
|
}, []);
|
|
13609
13627
|
const apply = (0, import_react71.useCallback)((next) => setState({ data: next, loading: false }), []);
|
|
13610
|
-
return { ...
|
|
13628
|
+
return { ...state2, apply };
|
|
13611
13629
|
}
|
|
13612
13630
|
|
|
13613
13631
|
// src/emptyState.tsx
|
|
@@ -13718,7 +13736,7 @@ var import_core10 = require("@ai-matrx/records/core");
|
|
|
13718
13736
|
var import_react101 = require("react");
|
|
13719
13737
|
var import_react102 = require("@ai-matrx/records/react");
|
|
13720
13738
|
var import_design_system55 = require("@ai-matrx/design-system");
|
|
13721
|
-
var
|
|
13739
|
+
var import_data_table10 = require("@ai-matrx/design-system/data-table");
|
|
13722
13740
|
var import_format4 = require("@ai-matrx/kit/format");
|
|
13723
13741
|
|
|
13724
13742
|
// src/MergeRecordDialog.tsx
|
|
@@ -14259,42 +14277,13 @@ var import_design_system43 = require("@ai-matrx/design-system");
|
|
|
14259
14277
|
|
|
14260
14278
|
// src/RecordsMount.tsx
|
|
14261
14279
|
var import_react78 = require("react");
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
var
|
|
14265
|
-
function storeDecidesRights(_table) {
|
|
14266
|
-
return NO_RIGHTS;
|
|
14267
|
-
}
|
|
14268
|
-
function RecordsMount({
|
|
14269
|
-
config,
|
|
14270
|
-
host,
|
|
14271
|
-
letTheStoreDecideRights,
|
|
14272
|
-
children
|
|
14273
|
-
}) {
|
|
14274
|
-
const bound2 = useShallowStableHost(host);
|
|
14275
|
-
void letTheStoreDecideRights;
|
|
14276
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react79.RecordsProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordLabelProvider, { children }) }) });
|
|
14277
|
-
}
|
|
14278
|
-
function useShallowStableHost(host) {
|
|
14279
|
-
const held = (0, import_react78.useRef)(null);
|
|
14280
|
-
const next = host ?? {};
|
|
14281
|
-
const previous = held.current;
|
|
14282
|
-
if (previous !== null && sameParts(previous, next)) return previous;
|
|
14283
|
-
const bound2 = { ...next };
|
|
14284
|
-
held.current = bound2;
|
|
14285
|
-
return bound2;
|
|
14286
|
-
}
|
|
14287
|
-
function sameParts(a, b) {
|
|
14288
|
-
const aKeys = Object.keys(a);
|
|
14289
|
-
const bKeys = Object.keys(b);
|
|
14290
|
-
if (aKeys.length !== bKeys.length) return false;
|
|
14291
|
-
for (const key of aKeys) if (a[key] !== b[key]) return false;
|
|
14292
|
-
return true;
|
|
14293
|
-
}
|
|
14280
|
+
|
|
14281
|
+
// src/dataSource.ts
|
|
14282
|
+
var import_global_slot2 = require("@ai-matrx/kit/global-slot");
|
|
14294
14283
|
function personActor(userId) {
|
|
14295
14284
|
return userId ? { actor: "user", user_id: userId } : { actor: "user" };
|
|
14296
14285
|
}
|
|
14297
|
-
var dataSources = /* @__PURE__ */ new WeakMap();
|
|
14286
|
+
var dataSources = (0, import_global_slot2.globalSlot)("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
|
|
14298
14287
|
function recordsDataSource(client, fallbackSchema = "custom") {
|
|
14299
14288
|
let bySchema = dataSources.get(client);
|
|
14300
14289
|
if (!bySchema) {
|
|
@@ -14340,6 +14329,40 @@ async function hasSession(getSession) {
|
|
|
14340
14329
|
}
|
|
14341
14330
|
}
|
|
14342
14331
|
|
|
14332
|
+
// src/RecordsMount.tsx
|
|
14333
|
+
var import_react79 = require("@ai-matrx/records/react");
|
|
14334
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
14335
|
+
var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
|
|
14336
|
+
function storeDecidesRights(_table) {
|
|
14337
|
+
return NO_RIGHTS;
|
|
14338
|
+
}
|
|
14339
|
+
function RecordsMount({
|
|
14340
|
+
config,
|
|
14341
|
+
host,
|
|
14342
|
+
letTheStoreDecideRights,
|
|
14343
|
+
children
|
|
14344
|
+
}) {
|
|
14345
|
+
const bound2 = useShallowStableHost(host);
|
|
14346
|
+
void letTheStoreDecideRights;
|
|
14347
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_react79.RecordsProvider, { config, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(RecordLabelProvider, { children }) }) });
|
|
14348
|
+
}
|
|
14349
|
+
function useShallowStableHost(host) {
|
|
14350
|
+
const held = (0, import_react78.useRef)(null);
|
|
14351
|
+
const next = host ?? {};
|
|
14352
|
+
const previous = held.current;
|
|
14353
|
+
if (previous !== null && sameParts(previous, next)) return previous;
|
|
14354
|
+
const bound2 = { ...next };
|
|
14355
|
+
held.current = bound2;
|
|
14356
|
+
return bound2;
|
|
14357
|
+
}
|
|
14358
|
+
function sameParts(a, b) {
|
|
14359
|
+
const aKeys = Object.keys(a);
|
|
14360
|
+
const bKeys = Object.keys(b);
|
|
14361
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
14362
|
+
for (const key of aKeys) if (a[key] !== b[key]) return false;
|
|
14363
|
+
return true;
|
|
14364
|
+
}
|
|
14365
|
+
|
|
14343
14366
|
// src/TablePickers.tsx
|
|
14344
14367
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
14345
14368
|
var SHARED_FOR_MS = 5e3;
|
|
@@ -14373,7 +14396,7 @@ function readTablesAnywhere(dataSource) {
|
|
|
14373
14396
|
return read;
|
|
14374
14397
|
}
|
|
14375
14398
|
function useTablesAnywhere(dataSource) {
|
|
14376
|
-
const [
|
|
14399
|
+
const [state2, setState] = (0, import_react80.useState)({ loading: true, error: null, rows: [] });
|
|
14377
14400
|
(0, import_react80.useEffect)(() => {
|
|
14378
14401
|
let live = true;
|
|
14379
14402
|
void readTablesAnywhere(dataSource).then((result) => {
|
|
@@ -14383,7 +14406,7 @@ function useTablesAnywhere(dataSource) {
|
|
|
14383
14406
|
live = false;
|
|
14384
14407
|
};
|
|
14385
14408
|
}, [dataSource]);
|
|
14386
|
-
return
|
|
14409
|
+
return state2;
|
|
14387
14410
|
}
|
|
14388
14411
|
function TablePicker({ dataSource, value, onChange, disabled, tables }) {
|
|
14389
14412
|
const own3 = useTablesAnywhere(dataSource);
|
|
@@ -14738,7 +14761,7 @@ var import_react84 = require("react");
|
|
|
14738
14761
|
var import_records34 = require("@ai-matrx/records");
|
|
14739
14762
|
var import_react85 = require("@ai-matrx/records/react");
|
|
14740
14763
|
var import_design_system45 = require("@ai-matrx/design-system");
|
|
14741
|
-
var
|
|
14764
|
+
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
14742
14765
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
14743
14766
|
function isChoiceField(field2) {
|
|
14744
14767
|
const kind = String(editorKindFor(field2));
|
|
@@ -14795,7 +14818,7 @@ function useChoiceOptions(fields, keys) {
|
|
|
14795
14818
|
}
|
|
14796
14819
|
function lookOf(option) {
|
|
14797
14820
|
const raw = option.data?.["color"];
|
|
14798
|
-
const color = typeof raw === "string" &&
|
|
14821
|
+
const color = typeof raw === "string" && import_data_table9.STYLE_COLORS.includes(raw) ? raw : void 0;
|
|
14799
14822
|
return { id: String(option.id), key: (0, import_records34.optionKey)(option), label: (0, import_records34.optionLabel)(option), ...color ? { color } : {} };
|
|
14800
14823
|
}
|
|
14801
14824
|
function paintByOption(style, _fields, index, lookup) {
|
|
@@ -14854,12 +14877,12 @@ function rulesLeaf(drafts, fields) {
|
|
|
14854
14877
|
const out = [];
|
|
14855
14878
|
for (const d of drafts) {
|
|
14856
14879
|
const field2 = fields.find((f) => f.key === d.field);
|
|
14857
|
-
if (!field2 ||
|
|
14880
|
+
if (!field2 || import_data_table9.COLOR_RULE_DATE_OPS.includes(d.op)) continue;
|
|
14858
14881
|
out.push({
|
|
14859
14882
|
...d.id ? { id: d.id } : {},
|
|
14860
14883
|
field: field2.id,
|
|
14861
14884
|
op: d.op,
|
|
14862
|
-
...
|
|
14885
|
+
...import_data_table9.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
|
|
14863
14886
|
color: d.color,
|
|
14864
14887
|
target: d.target
|
|
14865
14888
|
});
|
|
@@ -14874,7 +14897,7 @@ function viewRulesFrom(drafts) {
|
|
|
14874
14897
|
id: d.id ?? `rule-${Date.now().toString(36)}-${i}`,
|
|
14875
14898
|
field: d.field,
|
|
14876
14899
|
op: d.op,
|
|
14877
|
-
...
|
|
14900
|
+
...import_data_table9.OPS_WITH_VALUE.includes(d.op) ? { value: d.value } : {},
|
|
14878
14901
|
color: d.color,
|
|
14879
14902
|
target: d.target
|
|
14880
14903
|
}));
|
|
@@ -14884,9 +14907,9 @@ function isDateField2(field2) {
|
|
|
14884
14907
|
}
|
|
14885
14908
|
function swatches(prefix, current, write) {
|
|
14886
14909
|
return [
|
|
14887
|
-
...
|
|
14910
|
+
...import_data_table9.STYLE_COLORS.map((color) => ({
|
|
14888
14911
|
id: `${prefix}-${color}`,
|
|
14889
|
-
label: color === current ? `${
|
|
14912
|
+
label: color === current ? `${import_data_table9.STYLE_COLOR_LABELS[color]} (now)` : import_data_table9.STYLE_COLOR_LABELS[color],
|
|
14890
14913
|
onSelect: () => write(color)
|
|
14891
14914
|
})),
|
|
14892
14915
|
...current ? [{ id: `${prefix}-none`, label: "No highlight", onSelect: () => write(null) }] : []
|
|
@@ -14952,11 +14975,11 @@ function useGridColours(args) {
|
|
|
14952
14975
|
},
|
|
14953
14976
|
{
|
|
14954
14977
|
id: "col-highlight",
|
|
14955
|
-
label: column ? `Highlight column (${
|
|
14978
|
+
label: column ? `Highlight column (${import_data_table9.STYLE_COLOR_LABELS[column]})` : "Highlight column",
|
|
14956
14979
|
submenu: swatches(
|
|
14957
14980
|
"col-highlight",
|
|
14958
14981
|
column,
|
|
14959
|
-
(color) => void write(["columns", field2.id], color, color ? `${name} is highlighted ${
|
|
14982
|
+
(color) => void write(["columns", field2.id], color, color ? `${name} is highlighted ${import_data_table9.STYLE_COLOR_LABELS[color].toLowerCase()}.` : `${name} is no longer highlighted.`)
|
|
14960
14983
|
)
|
|
14961
14984
|
}
|
|
14962
14985
|
]
|
|
@@ -15085,7 +15108,7 @@ function useGridColours(args) {
|
|
|
15085
15108
|
}
|
|
15086
15109
|
var SELECT2 = "h-8";
|
|
15087
15110
|
var CHOICE_OPS = ["is", "is_not", "is_empty", "not_empty"].filter(
|
|
15088
|
-
(op2) =>
|
|
15111
|
+
(op2) => import_data_table9.COLOR_RULE_OPS.includes(op2)
|
|
15089
15112
|
);
|
|
15090
15113
|
function ColourRulesDialog({
|
|
15091
15114
|
open,
|
|
@@ -15106,7 +15129,7 @@ function ColourRulesDialog({
|
|
|
15106
15129
|
const field2 = fields.find((f) => f.key === key);
|
|
15107
15130
|
if (choicesOf(key)) return CHOICE_OPS;
|
|
15108
15131
|
const dateTests = scope === "view" && isDateField2(field2);
|
|
15109
|
-
return
|
|
15132
|
+
return import_data_table9.COLOR_RULE_OPS.filter((op2) => dateTests || !import_data_table9.COLOR_RULE_DATE_OPS.includes(op2));
|
|
15110
15133
|
};
|
|
15111
15134
|
const rows = drafts ?? held;
|
|
15112
15135
|
const set = (i, patch) => setDrafts(
|
|
@@ -15175,11 +15198,11 @@ function ColourRulesDialog({
|
|
|
15175
15198
|
onChange: (picked) => set(i, { op: picked }),
|
|
15176
15199
|
options: opsFor(rule.field).map((op2) => ({
|
|
15177
15200
|
value: op2,
|
|
15178
|
-
label:
|
|
15201
|
+
label: import_data_table9.COLOR_RULE_OP_LABELS[op2]
|
|
15179
15202
|
}))
|
|
15180
15203
|
}
|
|
15181
15204
|
),
|
|
15182
|
-
|
|
15205
|
+
import_data_table9.OPS_WITH_VALUE.includes(rule.op) && choicesOf(rule.field) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
15183
15206
|
PickOne,
|
|
15184
15207
|
{
|
|
15185
15208
|
label: "Choice",
|
|
@@ -15190,7 +15213,7 @@ function ColourRulesDialog({
|
|
|
15190
15213
|
onChange: (picked) => set(i, { value: picked }),
|
|
15191
15214
|
options: choicesOf(rule.field).map((option) => ({ value: option.id, label: option.label }))
|
|
15192
15215
|
}
|
|
15193
|
-
) :
|
|
15216
|
+
) : import_data_table9.OPS_WITH_VALUE.includes(rule.op) ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
15194
15217
|
"input",
|
|
15195
15218
|
{
|
|
15196
15219
|
"aria-label": "Value",
|
|
@@ -15222,7 +15245,7 @@ function ColourRulesDialog({
|
|
|
15222
15245
|
className: SELECT2,
|
|
15223
15246
|
value: rule.color,
|
|
15224
15247
|
onChange: (picked) => set(i, { color: picked }),
|
|
15225
|
-
options:
|
|
15248
|
+
options: import_data_table9.STYLE_COLORS.map((c) => ({ value: c, label: import_data_table9.STYLE_COLOR_LABELS[c] }))
|
|
15226
15249
|
}
|
|
15227
15250
|
),
|
|
15228
15251
|
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_design_system45.Button, { type: "button", size: "sm", variant: "ghost", onClick: () => setDrafts(rows.filter((_, j) => j !== i)), children: "Remove" })
|
|
@@ -17915,7 +17938,7 @@ function useMergedGridControls(args) {
|
|
|
17915
17938
|
const row = rows.find((r) => r.id === rowId);
|
|
17916
17939
|
if (!row) return null;
|
|
17917
17940
|
const doc = row.document ?? {};
|
|
17918
|
-
return (0,
|
|
17941
|
+
return (0, import_data_table10.gridToTsv)([order.filter((k) => !hidden.includes(k)).map((k) => doc[k])]);
|
|
17919
17942
|
},
|
|
17920
17943
|
[rows, order, hidden]
|
|
17921
17944
|
);
|
|
@@ -18394,7 +18417,7 @@ function CustomFieldsSection({
|
|
|
18394
18417
|
});
|
|
18395
18418
|
(0, import_react103.useEffect)(() => {
|
|
18396
18419
|
if (!agentDoor) return;
|
|
18397
|
-
const
|
|
18420
|
+
const state2 = () => {
|
|
18398
18421
|
const now = live.current;
|
|
18399
18422
|
return {
|
|
18400
18423
|
entityToken,
|
|
@@ -18411,7 +18434,7 @@ function CustomFieldsSection({
|
|
|
18411
18434
|
};
|
|
18412
18435
|
};
|
|
18413
18436
|
const check = (requests) => {
|
|
18414
|
-
const now =
|
|
18437
|
+
const now = state2();
|
|
18415
18438
|
if (now.mayAdd === false) {
|
|
18416
18439
|
return [now.refusal ?? "This person may not add a field here."];
|
|
18417
18440
|
}
|
|
@@ -18476,7 +18499,7 @@ function CustomFieldsSection({
|
|
|
18476
18499
|
live.current.reload();
|
|
18477
18500
|
return { ok: true, written };
|
|
18478
18501
|
};
|
|
18479
|
-
return agentDoor({ entityToken, recordId, state, check, addField, checkValues, setValues });
|
|
18502
|
+
return agentDoor({ entityToken, recordId, state: state2, check, addField, checkValues, setValues });
|
|
18480
18503
|
}, [agentDoor, client, entityToken, recordId]);
|
|
18481
18504
|
if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
|
|
18482
18505
|
const storeReason = rights.data?.reason ?? null;
|
|
@@ -19294,12 +19317,12 @@ function NewRecordControl({
|
|
|
19294
19317
|
var import_react113 = require("react");
|
|
19295
19318
|
var import_react114 = require("@ai-matrx/records/react");
|
|
19296
19319
|
var import_records39 = require("@ai-matrx/records");
|
|
19297
|
-
var
|
|
19320
|
+
var import_data_table12 = require("@ai-matrx/design-system/data-table");
|
|
19298
19321
|
|
|
19299
19322
|
// src/drillLevel.ts
|
|
19300
19323
|
var import_react111 = require("react");
|
|
19301
19324
|
var import_react112 = require("@ai-matrx/records/react");
|
|
19302
|
-
var
|
|
19325
|
+
var import_data_table11 = require("@ai-matrx/design-system/data-table");
|
|
19303
19326
|
var askId = (ask2) => `${ask2.outer ?? ""}|${ask2.fact}`;
|
|
19304
19327
|
function valueOf(v) {
|
|
19305
19328
|
return v === null || v === void 0 || v === "" ? null : String(v);
|
|
@@ -19307,11 +19330,11 @@ function valueOf(v) {
|
|
|
19307
19330
|
function drillLevelAsks(args) {
|
|
19308
19331
|
const { question, dimensions, answers, where } = args;
|
|
19309
19332
|
const known = (k) => dimensions.some((d) => d.key === k);
|
|
19310
|
-
const dim = (ref) => dimensions.find((d) => d.key === (0,
|
|
19333
|
+
const dim = (ref) => dimensions.find((d) => d.key === (0, import_data_table11.parseDimensionRef)(ref).key);
|
|
19311
19334
|
const outer2 = question.by[0] ?? null;
|
|
19312
|
-
const groupsOf2 = (ref) => (answers[(0,
|
|
19335
|
+
const groupsOf2 = (ref) => (answers[(0, import_data_table11.drillRequestKey)(question.by.slice(0, question.by.indexOf(ref) + 1))] ?? []).map((r) => r.groups[ref] ?? null).filter((v) => typeof v === "string" && v !== "");
|
|
19313
19336
|
const attributes = [];
|
|
19314
|
-
if (outer2 && !question.across && !(0,
|
|
19337
|
+
if (outer2 && !question.across && !(0, import_data_table11.parseDimensionRef)(outer2).grain) {
|
|
19315
19338
|
const groups = groupsOf2(outer2);
|
|
19316
19339
|
if (groups.length > 0) {
|
|
19317
19340
|
for (const fact of dim(outer2)?.level?.attributes ?? []) {
|
|
@@ -19320,9 +19343,9 @@ function drillLevelAsks(args) {
|
|
|
19320
19343
|
}
|
|
19321
19344
|
}
|
|
19322
19345
|
const focus = [];
|
|
19323
|
-
const at = (0,
|
|
19324
|
-
if (at && !(0,
|
|
19325
|
-
const filtered = new Set(question.where.map((w) => (0,
|
|
19346
|
+
const at = (0, import_data_table11.drillFocus)(question);
|
|
19347
|
+
if (at && !(0, import_data_table11.parseDimensionRef)(at.dim).grain) {
|
|
19348
|
+
const filtered = new Set(question.where.map((w) => (0, import_data_table11.parseDimensionRef)(w.dim).key));
|
|
19326
19349
|
for (const fact of dim(at.dim)?.level?.attributes ?? []) {
|
|
19327
19350
|
if (!filtered.has(fact) && known(fact)) focus.push({ outer: null, fact, where });
|
|
19328
19351
|
}
|
|
@@ -19330,7 +19353,7 @@ function drillLevelAsks(args) {
|
|
|
19330
19353
|
const names = [];
|
|
19331
19354
|
for (const ref of question.by) {
|
|
19332
19355
|
const d = dim(ref);
|
|
19333
|
-
if (!d?.labelFrom || (0,
|
|
19356
|
+
if (!d?.labelFrom || (0, import_data_table11.parseDimensionRef)(ref).grain || !known(d.labelFrom)) continue;
|
|
19334
19357
|
const groups = groupsOf2(ref);
|
|
19335
19358
|
if (groups.length > 0) names.push({ outer: d.key, fact: d.labelFrom, where: { ...where, [d.key]: groups } });
|
|
19336
19359
|
}
|
|
@@ -19367,7 +19390,7 @@ function useDrillLevelReads(args) {
|
|
|
19367
19390
|
const asks = drillLevelAsks({ question, dimensions, answers, where });
|
|
19368
19391
|
const all = [...asks.attributes, ...asks.focus, ...asks.names];
|
|
19369
19392
|
const key = JSON.stringify({ source, all, window: args.window ?? null, lane: args.lane ?? null });
|
|
19370
|
-
const [
|
|
19393
|
+
const [state2, setState] = (0, import_react111.useState)({ key: "", held: {}, failed: {} });
|
|
19371
19394
|
(0, import_react111.useEffect)(() => {
|
|
19372
19395
|
if (!enabled || !source || all.length === 0) return;
|
|
19373
19396
|
let cancelled = false;
|
|
@@ -19402,12 +19425,12 @@ function useDrillLevelReads(args) {
|
|
|
19402
19425
|
cancelled = true;
|
|
19403
19426
|
};
|
|
19404
19427
|
}, [client, key, enabled]);
|
|
19405
|
-
const ready =
|
|
19428
|
+
const ready = state2.key === key;
|
|
19406
19429
|
const dim = (k) => dimensions.find((d) => d.key === k);
|
|
19407
19430
|
const outer2 = question.by[0] ?? null;
|
|
19408
19431
|
const attributes = asks.attributes.length === 0 || !outer2 ? void 0 : asks.attributes.map((ask2) => {
|
|
19409
19432
|
const d = dim(ask2.fact);
|
|
19410
|
-
const why = ready ?
|
|
19433
|
+
const why = ready ? state2.failed[askId(ask2)] : void 0;
|
|
19411
19434
|
return {
|
|
19412
19435
|
key: ask2.fact,
|
|
19413
19436
|
label: d?.label ?? ask2.fact,
|
|
@@ -19416,17 +19439,17 @@ function useDrillLevelReads(args) {
|
|
|
19416
19439
|
read: (groups) => {
|
|
19417
19440
|
if (!ready) return void 0;
|
|
19418
19441
|
const g = groups[outer2];
|
|
19419
|
-
return g ? drillFactWords(
|
|
19442
|
+
return g ? drillFactWords(state2.held[askId(ask2)]?.[g], d) : null;
|
|
19420
19443
|
}
|
|
19421
19444
|
};
|
|
19422
19445
|
});
|
|
19423
19446
|
const focusAttributes = asks.focus.length === 0 ? void 0 : asks.focus.map((ask2) => {
|
|
19424
19447
|
const d = dim(ask2.fact);
|
|
19425
|
-
const why = ready ?
|
|
19448
|
+
const why = ready ? state2.failed[askId(ask2)] : void 0;
|
|
19426
19449
|
return {
|
|
19427
19450
|
key: ask2.fact,
|
|
19428
19451
|
label: d?.label ?? ask2.fact,
|
|
19429
|
-
value: ready ? drillFactWords(
|
|
19452
|
+
value: ready ? drillFactWords(state2.held[askId(ask2)]?.["\0"], d) : void 0,
|
|
19430
19453
|
...why ? { error: why } : {}
|
|
19431
19454
|
};
|
|
19432
19455
|
});
|
|
@@ -19435,7 +19458,7 @@ function useDrillLevelReads(args) {
|
|
|
19435
19458
|
for (const ask2 of asks.names) {
|
|
19436
19459
|
if (!ask2.outer) continue;
|
|
19437
19460
|
const out = names.get(ask2.outer) ?? /* @__PURE__ */ new Map();
|
|
19438
|
-
for (const [value, facts] of Object.entries(
|
|
19461
|
+
for (const [value, facts] of Object.entries(state2.held[askId(ask2)] ?? {})) {
|
|
19439
19462
|
const words2 = drillFactWords(facts, dim(ask2.fact));
|
|
19440
19463
|
if (words2 && words2 !== "Several") out.set(value, words2);
|
|
19441
19464
|
}
|
|
@@ -19489,7 +19512,7 @@ function definitionOf(raw) {
|
|
|
19489
19512
|
function useDrillDefinition(source) {
|
|
19490
19513
|
const client = (0, import_react114.useRecordsClient)();
|
|
19491
19514
|
const key = source ? JSON.stringify(source) : null;
|
|
19492
|
-
const [
|
|
19515
|
+
const [state2, setState] = (0, import_react113.useState)({ key: null, def: null, error: null });
|
|
19493
19516
|
(0, import_react113.useEffect)(() => {
|
|
19494
19517
|
if (!key) return;
|
|
19495
19518
|
let cancelled = false;
|
|
@@ -19509,12 +19532,12 @@ function useDrillDefinition(source) {
|
|
|
19509
19532
|
cancelled = true;
|
|
19510
19533
|
};
|
|
19511
19534
|
}, [client, key]);
|
|
19512
|
-
return
|
|
19535
|
+
return state2.key === key ? { def: state2.def, error: state2.error } : { def: null, error: null };
|
|
19513
19536
|
}
|
|
19514
19537
|
function drillWhere(base2, trail, booleans) {
|
|
19515
19538
|
const where = { ...base2 ?? {} };
|
|
19516
19539
|
for (const w of trail) {
|
|
19517
|
-
const { key, grain } = (0,
|
|
19540
|
+
const { key, grain } = (0, import_data_table12.parseDimensionRef)(w.dim);
|
|
19518
19541
|
if (grain) where[w.dim] = w.value;
|
|
19519
19542
|
else if (booleans.has(key) && (w.value === "true" || w.value === "false")) where[key] = w.value === "true";
|
|
19520
19543
|
else where[key] = w.value;
|
|
@@ -19569,7 +19592,7 @@ function useDrillAnswers(args) {
|
|
|
19569
19592
|
(0, import_react113.useEffect)(() => {
|
|
19570
19593
|
if (!enabled || !source || question.by.length === 0) return;
|
|
19571
19594
|
const asked3 = JSON.parse(askKey2);
|
|
19572
|
-
const range = asked3.window && asked3.windowKey ? (0,
|
|
19595
|
+
const range = asked3.window && asked3.windowKey ? (0, import_data_table12.drillWindowRange)(asked3.window) : null;
|
|
19573
19596
|
const compare = asked3.compare && range && asked3.windowKey ? {
|
|
19574
19597
|
against: asked3.compare,
|
|
19575
19598
|
from: range.from,
|
|
@@ -19579,12 +19602,12 @@ function useDrillAnswers(args) {
|
|
|
19579
19602
|
let cancelled = false;
|
|
19580
19603
|
setAnswers({});
|
|
19581
19604
|
setError(null);
|
|
19582
|
-
const requests = (0,
|
|
19605
|
+
const requests = (0, import_data_table12.drillRequests)({ by: asked3.by, across: asked3.across, show: asked3.show, where: [] });
|
|
19583
19606
|
void Promise.all(
|
|
19584
19607
|
requests.map(async (request) => {
|
|
19585
19608
|
if (asked3.rule && asked3.source.kind === "table") {
|
|
19586
|
-
const time = request.by.find((ref) => (0,
|
|
19587
|
-
const t = time ? (0,
|
|
19609
|
+
const time = request.by.find((ref) => (0, import_data_table12.parseDimensionRef)(ref).grain !== null) ?? null;
|
|
19610
|
+
const t = time ? (0, import_data_table12.parseDimensionRef)(time) : null;
|
|
19588
19611
|
const measures = asked3.show.map(storeMeasure).filter((m) => m !== null);
|
|
19589
19612
|
if (t?.grain === "hour") return { request, error: "This table's periods start at a day; it cannot be read by the hour." };
|
|
19590
19613
|
const got2 = await client.recordAggregate({
|
|
@@ -19674,7 +19697,7 @@ function useDrillAnswers(args) {
|
|
|
19674
19697
|
}
|
|
19675
19698
|
function drillQuestionFor(question, def) {
|
|
19676
19699
|
if (!def) return question;
|
|
19677
|
-
const known = (ref) => def.dimensions.some((d) => d.key === (0,
|
|
19700
|
+
const known = (ref) => def.dimensions.some((d) => d.key === (0, import_data_table12.parseDimensionRef)(ref).key);
|
|
19678
19701
|
const show = question.show.filter((key) => def.measures.some((m) => m.key === key));
|
|
19679
19702
|
return {
|
|
19680
19703
|
...question,
|
|
@@ -19711,7 +19734,7 @@ function useDrill(args) {
|
|
|
19711
19734
|
});
|
|
19712
19735
|
const hostDims = args.dimensions;
|
|
19713
19736
|
const plain2 = (0, import_react113.useMemo)(() => drillDimensionsOf(def, labels, hostDims), [def, labels, hostDims]);
|
|
19714
|
-
const range = question.window && windowKey ? (0,
|
|
19737
|
+
const range = question.window && windowKey ? (0, import_data_table12.drillWindowRange)(question.window) : null;
|
|
19715
19738
|
const level = useDrillLevelReads({
|
|
19716
19739
|
source: args.source,
|
|
19717
19740
|
question,
|
|
@@ -19780,7 +19803,7 @@ function useAddressDrill(args) {
|
|
|
19780
19803
|
() => ({ by: [], across: null, show: [], where: [], ...startWindow ? { window: startWindow } : {} }),
|
|
19781
19804
|
[startWindow]
|
|
19782
19805
|
);
|
|
19783
|
-
const url = (0,
|
|
19806
|
+
const url = (0, import_data_table12.useDrillUrlState)({ fallback, prefix: prefix ?? "drill" });
|
|
19784
19807
|
const question = (0, import_react113.useMemo)(
|
|
19785
19808
|
() => startWindow && !url.question.window ? { ...url.question, window: startWindow } : url.question,
|
|
19786
19809
|
[url.question, startWindow]
|
|
@@ -19800,7 +19823,7 @@ function questionFromGrouping(grouping) {
|
|
|
19800
19823
|
};
|
|
19801
19824
|
}
|
|
19802
19825
|
function groupingFromQuestion(question, held) {
|
|
19803
|
-
const [first, ...rest] = question.by.map(
|
|
19826
|
+
const [first, ...rest] = question.by.map(import_data_table12.parseDimensionRef);
|
|
19804
19827
|
if (!first) return void 0;
|
|
19805
19828
|
const sameFirst = held?.field === first.key;
|
|
19806
19829
|
return {
|
|
@@ -19815,9 +19838,9 @@ function groupingFromQuestion(question, held) {
|
|
|
19815
19838
|
};
|
|
19816
19839
|
}
|
|
19817
19840
|
function trailClause(fields, w) {
|
|
19818
|
-
const { key, grain } = (0,
|
|
19841
|
+
const { key, grain } = (0, import_data_table12.parseDimensionRef)(w.dim);
|
|
19819
19842
|
const field2 = fields.find((f) => f.key === key);
|
|
19820
|
-
if (grain && w.value !== null) return { key, value: (0,
|
|
19843
|
+
if (grain && w.value !== null) return { key, value: (0, import_data_table12.bucketWindow)(w.value, grain), field: field2 };
|
|
19821
19844
|
if (field2 && String(editorKindFor(field2)) === "checkbox" && (w.value === "true" || w.value === "false")) {
|
|
19822
19845
|
return { key, value: w.value === "true", field: field2 };
|
|
19823
19846
|
}
|
|
@@ -19861,7 +19884,7 @@ function useGridDrillQuestion(args) {
|
|
|
19861
19884
|
const { tableId, fields, presentation, filter } = args;
|
|
19862
19885
|
const source = (0, import_react113.useMemo)(() => ({ kind: "table", id: tableId }), [tableId]);
|
|
19863
19886
|
const saved = (0, import_react113.useMemo)(() => questionFromGrouping(presentation.grouping), [presentation.grouping]);
|
|
19864
|
-
const url = (0,
|
|
19887
|
+
const url = (0, import_data_table12.useDrillUrlState)({ fallback: saved });
|
|
19865
19888
|
const requested = args.enabled && // Up to three levels are ROWS under nested headers on the merged grid (Airtable's group levels).
|
|
19866
19889
|
(url.question.by.length > (args.plainGroupingIsRows ? 3 : 0) || url.question.across !== null || url.question.where.length > 0 || // `!= null`: a question read by a design-system that does not know the window or the comparison
|
|
19867
19890
|
// yet has them UNDEFINED, and `undefined !== null` asked for drill metadata on every plain grid.
|
|
@@ -19872,15 +19895,15 @@ function useGridDrillQuestion(args) {
|
|
|
19872
19895
|
const windowKey = drillWindowDimensionOf(def);
|
|
19873
19896
|
const trailFilter = (0, import_react113.useMemo)(() => {
|
|
19874
19897
|
if (!enabled) return filter;
|
|
19875
|
-
const range = question.window && windowKey ? (0,
|
|
19898
|
+
const range = question.window && windowKey ? (0, import_data_table12.drillWindowRange)(question.window) : null;
|
|
19876
19899
|
const withWindow = range && windowKey ? filterWithWindow(fields, filter, windowKey, range) : filter;
|
|
19877
19900
|
return filterWithTrail(fields, withWindow, question.where);
|
|
19878
19901
|
}, [enabled, fields, filter, question.where, question.window, windowKey]);
|
|
19879
19902
|
return { enabled, source, def, question, setQuestion: url.setQuestion, filter, trailFilter };
|
|
19880
19903
|
}
|
|
19881
19904
|
function useGridDrillConfig(args) {
|
|
19882
|
-
const { state, presentation, onPresentationChange, version } = args;
|
|
19883
|
-
const { setQuestion } =
|
|
19905
|
+
const { state: state2, presentation, onPresentationChange, version } = args;
|
|
19906
|
+
const { setQuestion } = state2;
|
|
19884
19907
|
const onQuestionChange = (0, import_react113.useMemo)(
|
|
19885
19908
|
() => (next) => {
|
|
19886
19909
|
setQuestion(next);
|
|
@@ -19892,21 +19915,21 @@ function useGridDrillConfig(args) {
|
|
|
19892
19915
|
},
|
|
19893
19916
|
[setQuestion, onPresentationChange, presentation]
|
|
19894
19917
|
);
|
|
19895
|
-
const flat =
|
|
19896
|
-
const rule =
|
|
19918
|
+
const flat = state2.filter && !(0, import_records39.isRuleFilter)(state2.filter) ? state2.filter : void 0;
|
|
19919
|
+
const rule = state2.filter && (0, import_records39.isRuleFilter)(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
|
|
19897
19920
|
const { config } = useDrill({
|
|
19898
|
-
source:
|
|
19899
|
-
question:
|
|
19921
|
+
source: state2.source,
|
|
19922
|
+
question: state2.question,
|
|
19900
19923
|
onQuestionChange,
|
|
19901
19924
|
filter: flat,
|
|
19902
19925
|
rule,
|
|
19903
19926
|
version,
|
|
19904
|
-
enabled:
|
|
19927
|
+
enabled: state2.enabled
|
|
19905
19928
|
});
|
|
19906
19929
|
return config;
|
|
19907
19930
|
}
|
|
19908
|
-
function filterWithTrailRuleOnly(
|
|
19909
|
-
return
|
|
19931
|
+
function filterWithTrailRuleOnly(state2) {
|
|
19932
|
+
return state2.trailFilter;
|
|
19910
19933
|
}
|
|
19911
19934
|
|
|
19912
19935
|
// src/pointsCost.ts
|
|
@@ -19935,18 +19958,18 @@ function ago(at) {
|
|
|
19935
19958
|
return at ? (0, import_format6.formatRelativeTime)(at, { style: "intl", fallback: "" }) : "";
|
|
19936
19959
|
}
|
|
19937
19960
|
function EnrichBadge({ cell: cell2, onPin, className }) {
|
|
19938
|
-
const
|
|
19939
|
-
if (!cell2 ||
|
|
19961
|
+
const state2 = cellState(cell2);
|
|
19962
|
+
if (!cell2 || state2 === "none") return null;
|
|
19940
19963
|
const source = cell2.source ?? {};
|
|
19941
19964
|
const read = Array.isArray(source.read) ? source.read : [];
|
|
19942
19965
|
const alternates = cell2.alternates ?? [];
|
|
19943
|
-
const word =
|
|
19966
|
+
const word = state2 === "yours" ? "yours" : state2 === "unsure" ? "unsure" : "agent";
|
|
19944
19967
|
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_design_system60.HoverCard, { openDelay: 120, children: [
|
|
19945
19968
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system60.HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: (0, import_design_system60.cn)("inline-flex items-center gap-1 align-middle", className), children: [
|
|
19946
19969
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
19947
19970
|
import_design_system60.Badge,
|
|
19948
19971
|
{
|
|
19949
|
-
variant:
|
|
19972
|
+
variant: state2 === "yours" ? "secondary" : "outline",
|
|
19950
19973
|
className: "text-[10px] font-normal leading-none",
|
|
19951
19974
|
children: word
|
|
19952
19975
|
}
|
|
@@ -19954,8 +19977,8 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
|
|
|
19954
19977
|
cell2.stale ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_design_system60.Badge, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
|
|
19955
19978
|
] }) }),
|
|
19956
19979
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_design_system60.HoverCardContent, { className: "w-80 space-y-2 text-xs", children: [
|
|
19957
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "font-medium", children:
|
|
19958
|
-
|
|
19980
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
|
|
19981
|
+
state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
19959
19982
|
"Acting for ",
|
|
19960
19983
|
cell2.on_behalf_of,
|
|
19961
19984
|
cell2.written_at ? `, ${ago(cell2.written_at)}` : "",
|
|
@@ -19976,7 +19999,7 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
|
|
|
19976
19999
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
|
|
19977
20000
|
] }) : null,
|
|
19978
20001
|
alternates.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { children: [
|
|
19979
|
-
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-muted-foreground", children:
|
|
20002
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
|
|
19980
20003
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("li", { children: String(a.value ?? "") }, i)) })
|
|
19981
20004
|
] }) : null,
|
|
19982
20005
|
cell2.stale && cell2.due_at ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("p", { className: "text-muted-foreground", children: [
|
|
@@ -21430,6 +21453,7 @@ function ObjectActionMenuItems({ actions }) {
|
|
|
21430
21453
|
}
|
|
21431
21454
|
|
|
21432
21455
|
// src/RecordActionMenu.tsx
|
|
21456
|
+
var import_outbound2 = require("@ai-matrx/kit/outbound");
|
|
21433
21457
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
21434
21458
|
function duplicateValues(fields, document2) {
|
|
21435
21459
|
const data = {};
|
|
@@ -21462,7 +21486,7 @@ function useRecordActionHost({ tableId, row, onOpenRecord, onChanged, onMerge, o
|
|
|
21462
21486
|
// The record's panel carries its history under it — on its page, or in the table's rail.
|
|
21463
21487
|
...href ? { history: () => window.location.assign(href) } : onOpenRecord ? { history: (r) => onOpenRecord(r.id) } : {},
|
|
21464
21488
|
openInNewTab: (url) => {
|
|
21465
|
-
|
|
21489
|
+
(0, import_outbound2.openOutbound)(url, "_blank", "noopener");
|
|
21466
21490
|
},
|
|
21467
21491
|
copyText: async (url) => {
|
|
21468
21492
|
if (await (0, import_clipboard2.copyText)(url)) {
|
|
@@ -21630,6 +21654,7 @@ function RecordActionMenu({ tableId, row, name, onOpenRecord, onChanged, childre
|
|
|
21630
21654
|
}
|
|
21631
21655
|
|
|
21632
21656
|
// src/gridOpen.tsx
|
|
21657
|
+
var import_outbound3 = require("@ai-matrx/kit/outbound");
|
|
21633
21658
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
21634
21659
|
function openRecordLabel(name) {
|
|
21635
21660
|
return `Open ${name}`;
|
|
@@ -21667,7 +21692,7 @@ function withOpenRecord(columns, onOpen, nameOf2, place = "end", hrefOf) {
|
|
|
21667
21692
|
onOpen(row.id);
|
|
21668
21693
|
return;
|
|
21669
21694
|
}
|
|
21670
|
-
if (event.metaKey || event.ctrlKey)
|
|
21695
|
+
if (event.metaKey || event.ctrlKey) (0, import_outbound3.openOutbound)(href, "_blank", "noopener");
|
|
21671
21696
|
else window.location.assign(href);
|
|
21672
21697
|
},
|
|
21673
21698
|
children: "\u2922"
|
|
@@ -24417,7 +24442,7 @@ var import_react131 = require("react");
|
|
|
24417
24442
|
var import_react132 = require("@ai-matrx/records/react");
|
|
24418
24443
|
var import_core15 = require("@ai-matrx/records/core");
|
|
24419
24444
|
var import_design_system69 = require("@ai-matrx/design-system");
|
|
24420
|
-
var
|
|
24445
|
+
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
24421
24446
|
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
24422
24447
|
function changesFor(step2, direction, versions = /* @__PURE__ */ new Map()) {
|
|
24423
24448
|
const byRow = /* @__PURE__ */ new Map();
|
|
@@ -24445,7 +24470,7 @@ function useGridUndo(args) {
|
|
|
24445
24470
|
onVersionsRef.current = args.onVersions;
|
|
24446
24471
|
const onVersions = (versions) => onVersionsRef.current?.(versions);
|
|
24447
24472
|
const known = (0, import_react131.useRef)(/* @__PURE__ */ new Map());
|
|
24448
|
-
const [held, setHeld] = (0, import_react131.useState)(() => ({ stack: (0,
|
|
24473
|
+
const [held, setHeld] = (0, import_react131.useState)(() => ({ stack: (0, import_data_table13.createUndoStack)(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
|
|
24449
24474
|
const heldRef = (0, import_react131.useRef)(held);
|
|
24450
24475
|
heldRef.current = held;
|
|
24451
24476
|
const [busy, setBusy] = (0, import_react131.useState)(false);
|
|
@@ -24460,7 +24485,7 @@ function useGridUndo(args) {
|
|
|
24460
24485
|
setHeld((was) => {
|
|
24461
24486
|
const steps = new Map(was.steps);
|
|
24462
24487
|
steps.set(id, step2);
|
|
24463
|
-
const stack = (0,
|
|
24488
|
+
const stack = (0, import_data_table13.pushUndo)(was.stack, { label: id, undo: [], redo: [] });
|
|
24464
24489
|
const live = new Set([...stack.past, ...stack.future].map((e) => e.label));
|
|
24465
24490
|
for (const key of [...steps.keys()]) if (!live.has(key)) steps.delete(key);
|
|
24466
24491
|
return { stack, steps };
|
|
@@ -24470,7 +24495,7 @@ function useGridUndo(args) {
|
|
|
24470
24495
|
const apply = (0, import_react131.useCallback)(
|
|
24471
24496
|
async (direction) => {
|
|
24472
24497
|
const was = heldRef.current;
|
|
24473
|
-
const taken = direction === "undo" ? (0,
|
|
24498
|
+
const taken = direction === "undo" ? (0, import_data_table13.popUndo)(was.stack) : (0, import_data_table13.popRedo)(was.stack);
|
|
24474
24499
|
if (!taken.entry) return;
|
|
24475
24500
|
const step2 = was.steps.get(taken.entry.label);
|
|
24476
24501
|
if (!step2) return;
|
|
@@ -25598,19 +25623,19 @@ function StructureLocked({ className }) {
|
|
|
25598
25623
|
// src/viewAddress.ts
|
|
25599
25624
|
var import_react142 = require("react");
|
|
25600
25625
|
var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
|
|
25601
|
-
function isViewAddressEmpty(
|
|
25602
|
-
if (!
|
|
25603
|
-
return !
|
|
25626
|
+
function isViewAddressEmpty(state2) {
|
|
25627
|
+
if (!state2) return true;
|
|
25628
|
+
return !state2.sort && Object.keys(state2.filters ?? {}).length === 0 && !(state2.search ?? "").trim() && (state2.hidden?.length ?? 0) === 0 && !(state2.page && state2.page > 1);
|
|
25604
25629
|
}
|
|
25605
|
-
function viewAddressToParams(
|
|
25630
|
+
function viewAddressToParams(state2) {
|
|
25606
25631
|
const out = {};
|
|
25607
|
-
if (!
|
|
25608
|
-
if (
|
|
25609
|
-
const filters = Object.fromEntries(Object.entries(
|
|
25632
|
+
if (!state2) return out;
|
|
25633
|
+
if (state2.sort) out["sort"] = `${state2.sort.field}:${state2.sort.direction}`;
|
|
25634
|
+
const filters = Object.fromEntries(Object.entries(state2.filters ?? {}).filter(([, v]) => v !== void 0 && v !== null));
|
|
25610
25635
|
if (Object.keys(filters).length > 0) out["cf"] = JSON.stringify(filters);
|
|
25611
|
-
if ((
|
|
25612
|
-
if (
|
|
25613
|
-
if (
|
|
25636
|
+
if ((state2.search ?? "").trim()) out["q"] = (state2.search ?? "").trim();
|
|
25637
|
+
if (state2.hidden && state2.hidden.length > 0) out["hide"] = JSON.stringify(state2.hidden);
|
|
25638
|
+
if (state2.page && state2.page > 1) out["page"] = String(Math.floor(state2.page));
|
|
25614
25639
|
return out;
|
|
25615
25640
|
}
|
|
25616
25641
|
function viewAddressFromParams(get) {
|
|
@@ -25665,7 +25690,7 @@ var NO_REREAD = () => {
|
|
|
25665
25690
|
};
|
|
25666
25691
|
var VALUE_FILTER_UI = { allowNegation: true };
|
|
25667
25692
|
function Grid(props) {
|
|
25668
|
-
const inCard = (0,
|
|
25693
|
+
const inCard = (0, import_data_table14.useMatrxTableCard)() !== null;
|
|
25669
25694
|
if (!inCard) return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(GridBody, { ...props });
|
|
25670
25695
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarSlotContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarFoldContext.Provider, { value: 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(TableToolbarSheetExtrasContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(GridBody, { ...props }) }) }) });
|
|
25671
25696
|
}
|
|
@@ -25696,7 +25721,7 @@ function GridBody({
|
|
|
25696
25721
|
hideRefusedRowActions = false
|
|
25697
25722
|
}) {
|
|
25698
25723
|
const toolbarSlot = useTableToolbarSlot();
|
|
25699
|
-
const tableCard = (0,
|
|
25724
|
+
const tableCard = (0, import_data_table14.useMatrxTableCard)();
|
|
25700
25725
|
const [cardExtraRows, setCardExtraRows] = (0, import_react143.useState)(0);
|
|
25701
25726
|
const fills = footer === "sticky";
|
|
25702
25727
|
const host = useRecordsUi();
|
|
@@ -26918,7 +26943,7 @@ function GridBody({
|
|
|
26918
26943
|
[tableId, table.data, ordered, labelFor, merged]
|
|
26919
26944
|
);
|
|
26920
26945
|
const tableStyleProp = (0, import_react143.useMemo)(
|
|
26921
|
-
() => (0,
|
|
26946
|
+
() => (0, import_data_table14.tableStyleIsEmpty)(paint.style) ? null : {
|
|
26922
26947
|
style: paint.style,
|
|
26923
26948
|
// A choice is read as its OPTION (`paintByOption`): the rule, the value and the
|
|
26924
26949
|
// colour a column keeps for it all name the same option, however it is stored.
|
|
@@ -27708,7 +27733,7 @@ function GridBody({
|
|
|
27708
27733
|
"data-records-grid-fit": look.fit,
|
|
27709
27734
|
onPasteCapture: takeEmptyTablePaste,
|
|
27710
27735
|
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(EmbeddedLookProvider, { value: embedded ? EMBEDDED_LOOK : null, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
27711
|
-
|
|
27736
|
+
import_data_table14.MatrxDataTable,
|
|
27712
27737
|
{
|
|
27713
27738
|
...fills ? { className: "min-h-0 flex-1" } : {},
|
|
27714
27739
|
frameHeight: fills ? "fill" : "content",
|
|
@@ -27827,7 +27852,7 @@ function GridBody({
|
|
|
27827
27852
|
// More exists when the store's total says so, or when it answered a FULL page (it
|
|
27828
27853
|
// names a total only once a page comes back short).
|
|
27829
27854
|
(typeof records.data?.total === "number" ? records.data.total > rows.length : rows.length >= pageSize + cardExtraRows) ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
27830
|
-
|
|
27855
|
+
import_data_table14.MatrxTableCardShowMore,
|
|
27831
27856
|
{
|
|
27832
27857
|
shown: rows.length,
|
|
27833
27858
|
total: typeof records.data?.total === "number" ? records.data.total : void 0,
|
|
@@ -27836,7 +27861,7 @@ function GridBody({
|
|
|
27836
27861
|
}
|
|
27837
27862
|
) : null
|
|
27838
27863
|
) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
27839
|
-
|
|
27864
|
+
import_data_table14.MatrxTableCardShowMore,
|
|
27840
27865
|
{
|
|
27841
27866
|
shown: pageRows.length,
|
|
27842
27867
|
total: records.data.total,
|
|
@@ -28009,13 +28034,13 @@ function sortIgnoredOf(answer) {
|
|
|
28009
28034
|
}
|
|
28010
28035
|
|
|
28011
28036
|
// src/RecordsTableCard.tsx
|
|
28012
|
-
var
|
|
28037
|
+
var import_data_table16 = require("@ai-matrx/design-system/data-table");
|
|
28013
28038
|
var import_design_system73 = require("@ai-matrx/design-system");
|
|
28014
28039
|
var import_react148 = require("@ai-matrx/records/react");
|
|
28015
28040
|
|
|
28016
28041
|
// src/entityTable.tsx
|
|
28017
28042
|
var import_react145 = require("react");
|
|
28018
|
-
var
|
|
28043
|
+
var import_data_table15 = require("@ai-matrx/design-system/data-table");
|
|
28019
28044
|
var import_react146 = require("@ai-matrx/records/react");
|
|
28020
28045
|
var import_react147 = require("@ai-matrx/records/entity/react");
|
|
28021
28046
|
|
|
@@ -28137,7 +28162,7 @@ function EntityGrid({
|
|
|
28137
28162
|
const columns = (0, import_react145.useMemo)(() => entityTableColumns(entity.columns, canEdit), [entity.columns, canEdit]);
|
|
28138
28163
|
const byId = (0, import_react145.useMemo)(() => new Map(entity.columns.map((c) => [columnId(c), c])), [entity.columns]);
|
|
28139
28164
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
28140
|
-
|
|
28165
|
+
import_data_table15.MatrxDataTable,
|
|
28141
28166
|
{
|
|
28142
28167
|
data: entity.rows,
|
|
28143
28168
|
columns,
|
|
@@ -28172,7 +28197,7 @@ var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
|
28172
28197
|
function RecordsTableCard(props) {
|
|
28173
28198
|
const client = (0, import_react148.useOptionalRecordsClient)();
|
|
28174
28199
|
if (!client) {
|
|
28175
|
-
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
|
|
28176
28201
|
}
|
|
28177
28202
|
if (props.source.kind === "entity") return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(EntityTableCard, { ...props, source: props.source });
|
|
28178
28203
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(ConnectedRecordsTableCard, { ...props, source: props.source });
|
|
@@ -28192,11 +28217,11 @@ function EntityTableCardBody({
|
|
|
28192
28217
|
editable,
|
|
28193
28218
|
className
|
|
28194
28219
|
}) {
|
|
28195
|
-
const batch = initialRows ??
|
|
28220
|
+
const batch = initialRows ?? import_data_table16.TABLE_CARD_DEFAULT_INITIAL_ROWS;
|
|
28196
28221
|
const entity = useEntityTable(source.token, { pageSize: batch });
|
|
28197
28222
|
const label = entity.label ?? (entity.loading ? "Loading\u2026" : "Table");
|
|
28198
28223
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28199
|
-
|
|
28224
|
+
import_data_table16.MatrxTableCard,
|
|
28200
28225
|
{
|
|
28201
28226
|
title: label,
|
|
28202
28227
|
fields: entity.columns.length,
|
|
@@ -28209,10 +28234,10 @@ function EntityTableCardBody({
|
|
|
28209
28234
|
...entity.newer > 0 ? { headerActions: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_design_system73.Button, { size: "sm", variant: "ghost", onClick: entity.refresh, children: `${entity.newer.toLocaleString()} new` }) } : {},
|
|
28210
28235
|
...initialRows ? { initialRows } : {},
|
|
28211
28236
|
...className ? { className } : {},
|
|
28212
|
-
children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28237
|
+
children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: `This table could not be read: ${entity.error}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
28213
28238
|
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(EntityGrid, { entity, pageSize: batch, ...editable === void 0 ? {} : { editable } }),
|
|
28214
28239
|
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28215
|
-
|
|
28240
|
+
import_data_table16.MatrxTableCardShowMore,
|
|
28216
28241
|
{
|
|
28217
28242
|
shown: entity.rows.length,
|
|
28218
28243
|
total: entity.total ?? entity.rows.length + 1,
|
|
@@ -28243,7 +28268,7 @@ function ConnectedRecordsTableCard({
|
|
|
28243
28268
|
const plural4 = t?.label_plural ?? t?.name ?? "Records";
|
|
28244
28269
|
const singular = t?.label_singular ?? t?.name ?? "Record";
|
|
28245
28270
|
return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28246
|
-
|
|
28271
|
+
import_data_table16.MatrxTableCard,
|
|
28247
28272
|
{
|
|
28248
28273
|
title: t ? plural4 : table.loading ? "Loading\u2026" : "Table",
|
|
28249
28274
|
records: { singular: singular.toLowerCase(), plural: plural4.toLowerCase() },
|
|
@@ -28256,11 +28281,11 @@ function ConnectedRecordsTableCard({
|
|
|
28256
28281
|
...edit ? { edit } : {},
|
|
28257
28282
|
...initialRows ? { initialRows } : {},
|
|
28258
28283
|
...className ? { className } : {},
|
|
28259
|
-
children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28284
|
+
children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_data_table16.MatrxTableCardEmpty, { message: `This table could not be read: ${refusalSentence(table.error)}` }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
28260
28285
|
Grid,
|
|
28261
28286
|
{
|
|
28262
28287
|
tableId: source.id,
|
|
28263
|
-
pageSize: initialRows ??
|
|
28288
|
+
pageSize: initialRows ?? import_data_table16.TABLE_CARD_DEFAULT_INITIAL_ROWS,
|
|
28264
28289
|
...onOpenRecord ? { onOpenRecord } : {},
|
|
28265
28290
|
...editable === void 0 ? {} : { editable }
|
|
28266
28291
|
}
|
|
@@ -29445,7 +29470,7 @@ function TimeZoneInput({
|
|
|
29445
29470
|
"aria-label": label
|
|
29446
29471
|
}
|
|
29447
29472
|
),
|
|
29448
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("datalist", { id: listId, children: TIME_ZONES.map((
|
|
29473
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("datalist", { id: listId, children: TIME_ZONES.map((zone) => /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("option", { value: zone }, zone)) })
|
|
29449
29474
|
] });
|
|
29450
29475
|
}
|
|
29451
29476
|
|
|
@@ -33331,7 +33356,7 @@ async function declare(client, spec) {
|
|
|
33331
33356
|
}
|
|
33332
33357
|
function usePlatformTable(spec) {
|
|
33333
33358
|
const client = (0, import_react198.useRecordsClient)();
|
|
33334
|
-
const [
|
|
33359
|
+
const [state2, setState] = (0, import_react197.useState)({ tableId: null, loading: true, error: null });
|
|
33335
33360
|
const slug = spec.slug;
|
|
33336
33361
|
const stable = (0, import_react197.useMemo)(() => spec, [slug]);
|
|
33337
33362
|
(0, import_react197.useEffect)(() => {
|
|
@@ -33347,7 +33372,7 @@ function usePlatformTable(spec) {
|
|
|
33347
33372
|
cancelled = true;
|
|
33348
33373
|
};
|
|
33349
33374
|
}, [client, stable]);
|
|
33350
|
-
return
|
|
33375
|
+
return state2;
|
|
33351
33376
|
}
|
|
33352
33377
|
|
|
33353
33378
|
// src/viewLook.ts
|
|
@@ -33385,7 +33410,7 @@ var import_react224 = require("react");
|
|
|
33385
33410
|
var import_react225 = require("@ai-matrx/records/react");
|
|
33386
33411
|
var import_records61 = require("@ai-matrx/records");
|
|
33387
33412
|
var import_design_system109 = require("@ai-matrx/design-system");
|
|
33388
|
-
var
|
|
33413
|
+
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
33389
33414
|
var import_format10 = require("@ai-matrx/kit/format");
|
|
33390
33415
|
|
|
33391
33416
|
// src/recordMoves.tsx
|
|
@@ -33586,7 +33611,7 @@ var import_react201 = require("react");
|
|
|
33586
33611
|
var import_react202 = require("@ai-matrx/records/react");
|
|
33587
33612
|
var import_records58 = require("@ai-matrx/records");
|
|
33588
33613
|
var import_design_system100 = require("@ai-matrx/design-system");
|
|
33589
|
-
var
|
|
33614
|
+
var import_data_table17 = require("@ai-matrx/design-system/data-table");
|
|
33590
33615
|
|
|
33591
33616
|
// src/CardDates.tsx
|
|
33592
33617
|
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
@@ -33821,7 +33846,7 @@ function PipelineBoard({
|
|
|
33821
33846
|
const ordered = (definition?.stages ?? []).flatMap((stage) => cardsByStage.get(stage.key) ?? []);
|
|
33822
33847
|
const selectedInOrder = ordered.filter((r) => selected.has(r.id));
|
|
33823
33848
|
const select = (index, how) => {
|
|
33824
|
-
const { next, anchor: at } = (0,
|
|
33849
|
+
const { next, anchor: at } = (0, import_data_table17.toggleSelection)({
|
|
33825
33850
|
order: ordered,
|
|
33826
33851
|
idOf: (r) => r.id,
|
|
33827
33852
|
selected,
|
|
@@ -34198,7 +34223,7 @@ function PipelineCard({
|
|
|
34198
34223
|
dates
|
|
34199
34224
|
}) {
|
|
34200
34225
|
const labels = useRecordLabels(field2 ? [field2] : []);
|
|
34201
|
-
const color = style ? (0,
|
|
34226
|
+
const color = style ? (0, import_data_table17.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
|
|
34202
34227
|
const draggable = (0, import_react202.mayDrag)(record.level);
|
|
34203
34228
|
const { text: label, withheld } = cardWords(record, field2, labels);
|
|
34204
34229
|
return /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)(
|
|
@@ -34216,7 +34241,7 @@ function PipelineCard({
|
|
|
34216
34241
|
draggable ? "cursor-grab active:cursor-grabbing" : "",
|
|
34217
34242
|
dragging ? "opacity-50" : "",
|
|
34218
34243
|
// A selected card shows the selection, not its tint — the two never fight for one background.
|
|
34219
|
-
selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ?
|
|
34244
|
+
selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ? import_data_table17.ROW_TINT_CLASS[color] : ""
|
|
34220
34245
|
),
|
|
34221
34246
|
onClick: (e) => {
|
|
34222
34247
|
if (draggable && (e.shiftKey || e.metaKey || e.ctrlKey)) {
|
|
@@ -34374,7 +34399,7 @@ function CardFieldsInline({ row, fields }) {
|
|
|
34374
34399
|
var import_react206 = require("react");
|
|
34375
34400
|
var import_react207 = require("@ai-matrx/records/react");
|
|
34376
34401
|
var import_design_system101 = require("@ai-matrx/design-system");
|
|
34377
|
-
var
|
|
34402
|
+
var import_data_table19 = require("@ai-matrx/design-system/data-table");
|
|
34378
34403
|
|
|
34379
34404
|
// src/weekStart.ts
|
|
34380
34405
|
var import_react203 = require("react");
|
|
@@ -34412,7 +34437,7 @@ function useReaderWeekStart() {
|
|
|
34412
34437
|
|
|
34413
34438
|
// src/rowColorBy.tsx
|
|
34414
34439
|
var import_react205 = require("react");
|
|
34415
|
-
var
|
|
34440
|
+
var import_data_table18 = require("@ai-matrx/design-system/data-table");
|
|
34416
34441
|
function useRowColorBy(all, colorKey, style) {
|
|
34417
34442
|
const colorField = all.find((f) => f.key === colorKey);
|
|
34418
34443
|
const options = useChoiceOptions(all, colorField && isChoiceField(colorField) ? [colorField.key] : []);
|
|
@@ -34422,11 +34447,11 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
34422
34447
|
return optionFor(options.get(key), first)?.color ?? (colorField ? storedChoiceColor(colorField, first) : void 0) ?? colorFromTheValue(key, first);
|
|
34423
34448
|
};
|
|
34424
34449
|
const effective = {
|
|
34425
|
-
...
|
|
34450
|
+
...import_data_table18.EMPTY_TABLE_STYLE,
|
|
34426
34451
|
...style ?? {},
|
|
34427
34452
|
...colorKey ? { colorBy: { field: colorKey, target: "row" } } : { colorBy: null }
|
|
34428
34453
|
};
|
|
34429
|
-
return (row) => (0,
|
|
34454
|
+
return (row) => (0, import_data_table18.resolveRowColor)(effective, { id: row.id, data: row.document ?? {} }, lookup);
|
|
34430
34455
|
}, [options, colorField, colorKey, style]);
|
|
34431
34456
|
}
|
|
34432
34457
|
|
|
@@ -35019,7 +35044,7 @@ function CalendarView({
|
|
|
35019
35044
|
className: (0, import_design_system101.cn)(
|
|
35020
35045
|
"flex w-full min-w-0 items-center gap-1 truncate rounded border px-1.5 py-0.5 text-left text-xs hover:brightness-95",
|
|
35021
35046
|
// The chip palette, not the faint row tint: a calendar is read by its colours at a glance.
|
|
35022
|
-
color ?
|
|
35047
|
+
color ? import_data_table19.CHOICE_CHIP_CLASS[color] : "bg-background",
|
|
35023
35048
|
may ? "cursor-grab active:cursor-grabbing" : "cursor-default",
|
|
35024
35049
|
className2
|
|
35025
35050
|
),
|
|
@@ -35436,7 +35461,7 @@ function weekHeading(first) {
|
|
|
35436
35461
|
var import_react208 = require("react");
|
|
35437
35462
|
var import_react209 = require("@ai-matrx/records/react");
|
|
35438
35463
|
var import_design_system102 = require("@ai-matrx/design-system");
|
|
35439
|
-
var
|
|
35464
|
+
var import_data_table20 = require("@ai-matrx/design-system/data-table");
|
|
35440
35465
|
var import_react210 = require("@ai-matrx/records/react");
|
|
35441
35466
|
|
|
35442
35467
|
// src/timelineGantt.ts
|
|
@@ -36215,7 +36240,7 @@ function TimelineView({
|
|
|
36215
36240
|
className: (0, import_design_system102.cn)(
|
|
36216
36241
|
"absolute flex select-none items-center gap-1 rounded border px-1.5 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
36217
36242
|
outside ? "overflow-visible" : "overflow-hidden",
|
|
36218
|
-
milestone ? "border-transparent bg-transparent" : color ?
|
|
36243
|
+
milestone ? "border-transparent bg-transparent" : color ? import_data_table20.CHOICE_CHIP_CLASS[color] : "bg-muted",
|
|
36219
36244
|
onCritical ? "ring-2 ring-amber-500" : void 0,
|
|
36220
36245
|
linkTarget === p.row.id ? "ring-2 ring-primary" : void 0,
|
|
36221
36246
|
may ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
|
|
@@ -36445,7 +36470,7 @@ function TimelineView({
|
|
|
36445
36470
|
type: "button",
|
|
36446
36471
|
className: (0, import_design_system102.cn)(
|
|
36447
36472
|
"flex w-full min-w-0 items-center gap-1 truncate rounded border px-1.5 py-0.5 text-left text-xs hover:brightness-95",
|
|
36448
|
-
color ?
|
|
36473
|
+
color ? import_data_table20.CHOICE_CHIP_CLASS[color] : "bg-background",
|
|
36449
36474
|
may ? "cursor-grab" : "cursor-default"
|
|
36450
36475
|
),
|
|
36451
36476
|
title: may ? `${titleOf(row)} \xB7 drag onto a day` : (0, import_react209.mayDrag)(row.level) ? WORKED_OUT_DATE_LOCK : whatYouMayDo(row.level ?? null).why("write"),
|
|
@@ -36525,7 +36550,7 @@ function TimelineView({
|
|
|
36525
36550
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
36526
36551
|
"span",
|
|
36527
36552
|
{
|
|
36528
|
-
className: (0, import_design_system102.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ?
|
|
36553
|
+
className: (0, import_design_system102.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ? import_data_table20.CHOICE_CHIP_CLASS[lane.color] : void 0),
|
|
36529
36554
|
title: laneLocked ?? lane.label,
|
|
36530
36555
|
...laneLocked ? { "data-timeline-lane-locked": "" } : {},
|
|
36531
36556
|
children: lane.label
|
|
@@ -36937,7 +36962,7 @@ function BoardOptions({
|
|
|
36937
36962
|
// src/ListView.tsx
|
|
36938
36963
|
var import_react215 = require("react");
|
|
36939
36964
|
var import_design_system105 = require("@ai-matrx/design-system");
|
|
36940
|
-
var
|
|
36965
|
+
var import_data_table21 = require("@ai-matrx/design-system/data-table");
|
|
36941
36966
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
36942
36967
|
var LIST_DEFAULT_FIELDS = 4;
|
|
36943
36968
|
var NO_GROUP = "__none";
|
|
@@ -37079,7 +37104,7 @@ function ListRow({
|
|
|
37079
37104
|
const doc = row.document ?? {};
|
|
37080
37105
|
const filled = fields.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
|
|
37081
37106
|
const onRow = chose ? filled : filled.slice(0, LIST_DEFAULT_FIELDS);
|
|
37082
|
-
const color = style ? (0,
|
|
37107
|
+
const color = style ? (0, import_data_table21.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
|
|
37083
37108
|
const values = onRow.map((field2) => (
|
|
37084
37109
|
// ONE LINE PER VALUE (walk 2026-10-05): a multi-line caption drew as paragraphs, pushing the
|
|
37085
37110
|
// title to the row's foot. A list row is one line, as Notion's is; the record page has the rest.
|
|
@@ -37103,7 +37128,7 @@ function ListRow({
|
|
|
37103
37128
|
"data-records-list-row": row.id,
|
|
37104
37129
|
className: (0, import_design_system105.cn)(
|
|
37105
37130
|
"flex w-full min-w-0 items-center gap-3 rounded px-1 py-1 pr-7 text-left text-xs hover:bg-muted",
|
|
37106
|
-
color ?
|
|
37131
|
+
color ? import_data_table21.ROW_TINT_CLASS[color] : void 0
|
|
37107
37132
|
),
|
|
37108
37133
|
onClick: () => onOpenRecord?.(row.id),
|
|
37109
37134
|
title: withheld ?? title,
|
|
@@ -38065,7 +38090,7 @@ function chartQuestion(view, fields) {
|
|
|
38065
38090
|
function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
38066
38091
|
const client = (0, import_react223.useRecordsClient)();
|
|
38067
38092
|
const q = (0, import_react222.useMemo)(() => chartQuestion(view, fields), [view, fields]);
|
|
38068
|
-
const [
|
|
38093
|
+
const [state2, setState] = (0, import_react222.useState)({ block: null, error: null });
|
|
38069
38094
|
const filterKey = JSON.stringify(filter ?? {});
|
|
38070
38095
|
const qKey = JSON.stringify(q);
|
|
38071
38096
|
(0, import_react222.useEffect)(() => {
|
|
@@ -38133,7 +38158,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
38133
38158
|
MEASURE_LABEL2[isChartMeasure(view.chartMeasure) ? view.chartMeasure : "count"],
|
|
38134
38159
|
" needs a number field \u2014 pick one above. Counting until then."
|
|
38135
38160
|
] }) : null,
|
|
38136
|
-
|
|
38161
|
+
state2.error ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(RefusalNotice, { error: state2.error }) : state2.block ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ChartBlock, { block: state2.block, subject: view.subject, variant: "bare", centerValue: true }) : null
|
|
38137
38162
|
] });
|
|
38138
38163
|
}
|
|
38139
38164
|
|
|
@@ -38666,7 +38691,7 @@ function Board({
|
|
|
38666
38691
|
onColorFieldChange: (key) => onChange({
|
|
38667
38692
|
presentation: {
|
|
38668
38693
|
...view.presentation,
|
|
38669
|
-
style: { ...
|
|
38694
|
+
style: { ...import_data_table22.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: key ? { field: key, target: "row" } : null }
|
|
38670
38695
|
}
|
|
38671
38696
|
}),
|
|
38672
38697
|
titleField,
|
|
@@ -38717,7 +38742,7 @@ function Board({
|
|
|
38717
38742
|
onChange({
|
|
38718
38743
|
presentation: {
|
|
38719
38744
|
...view.presentation,
|
|
38720
|
-
style: { ...
|
|
38745
|
+
style: { ...import_data_table22.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: patch.colorKey ? { field: patch.colorKey, target: "row" } : null }
|
|
38721
38746
|
}
|
|
38722
38747
|
});
|
|
38723
38748
|
}
|
|
@@ -38977,7 +39002,7 @@ function Kanban({
|
|
|
38977
39002
|
const heading = (name) => /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(
|
|
38978
39003
|
"header",
|
|
38979
39004
|
{
|
|
38980
|
-
className: (0, import_design_system109.cn)("flex h-7 items-center gap-2 border-b px-2 text-xs font-medium", columnColor(name) ?
|
|
39005
|
+
className: (0, import_design_system109.cn)("flex h-7 items-center gap-2 border-b px-2 text-xs font-medium", columnColor(name) ? import_data_table22.CHOICE_CHIP_CLASS[columnColor(name)] : void 0),
|
|
38981
39006
|
"data-board-heading": name,
|
|
38982
39007
|
...columnColor(name) ? { "data-column-color": columnColor(name) } : {},
|
|
38983
39008
|
children: [
|
|
@@ -39044,7 +39069,7 @@ function Kanban({
|
|
|
39044
39069
|
void move(card, { column: name, lane: laneName }, { column: to, lane: laneName });
|
|
39045
39070
|
},
|
|
39046
39071
|
children: [
|
|
39047
|
-
accent ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { "aria-hidden": "true", "data-card-accent": accent, className: (0, import_design_system109.cn)("absolute inset-y-0.5 left-0 w-1 rounded",
|
|
39072
|
+
accent ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { "aria-hidden": "true", "data-card-accent": accent, className: (0, import_design_system109.cn)("absolute inset-y-0.5 left-0 w-1 rounded", import_data_table22.SWATCH_CLASS[accent]) }) : null,
|
|
39048
39073
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(RecordActionMenu, { tableId, row: card, name: cardWords(card, titleField).text, onOpenRecord, onChanged, children: previewField ? /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
39049
39074
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: (0, import_design_system109.cn)("block w-full shrink-0 overflow-hidden rounded bg-muted/50", size.cover), "data-board-preview": previewField.key, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GalleryCover, { field: previewField, value: cover }) }),
|
|
39050
39075
|
recordCard
|
|
@@ -39176,7 +39201,7 @@ function Gallery({
|
|
|
39176
39201
|
const doc = row.document ?? {};
|
|
39177
39202
|
const filled = shown5.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
|
|
39178
39203
|
const onCard = chose ? filled : filled.slice(0, GALLERY_DEFAULT_FIELDS);
|
|
39179
|
-
const rowColor = style ? (0,
|
|
39204
|
+
const rowColor = style ? (0, import_data_table22.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
|
|
39180
39205
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("li", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
39181
39206
|
MaybeRecordActionMenu,
|
|
39182
39207
|
{
|
|
@@ -39191,7 +39216,7 @@ function Gallery({
|
|
|
39191
39216
|
type: "button",
|
|
39192
39217
|
className: (0, import_design_system109.cn)(
|
|
39193
39218
|
"flex h-full w-full flex-col gap-1 rounded border p-2 pr-7 text-left hover:bg-muted",
|
|
39194
|
-
rowColor ?
|
|
39219
|
+
rowColor ? import_data_table22.ROW_TINT_CLASS[rowColor] : void 0
|
|
39195
39220
|
),
|
|
39196
39221
|
onClick: () => onOpenRecord?.(row.id),
|
|
39197
39222
|
children: [
|
|
@@ -39266,7 +39291,7 @@ function RecordCard({
|
|
|
39266
39291
|
const parentId = parentField ? parentIdOf(record.document, parentField.key) : null;
|
|
39267
39292
|
const parentName = parentField && parentId ? scalarText(parentField, parentId, labels) : null;
|
|
39268
39293
|
const open = () => onOpenRecord?.(record.id);
|
|
39269
|
-
const color = style ? (0,
|
|
39294
|
+
const color = style ? (0, import_data_table22.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
|
|
39270
39295
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
39271
39296
|
"div",
|
|
39272
39297
|
{
|
|
@@ -39276,7 +39301,7 @@ function RecordCard({
|
|
|
39276
39301
|
className: (0, import_design_system109.cn)(
|
|
39277
39302
|
"w-full cursor-pointer truncate rounded border bg-background px-2 py-1 text-left text-xs hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
39278
39303
|
host.density === "spacious" ? "py-2" : "",
|
|
39279
|
-
color ?
|
|
39304
|
+
color ? import_data_table22.ROW_TINT_CLASS[color] : void 0
|
|
39280
39305
|
),
|
|
39281
39306
|
onClick: open,
|
|
39282
39307
|
onKeyDown: (e) => {
|
|
@@ -39767,7 +39792,7 @@ function SectionBox({ id, children, ...rest }) {
|
|
|
39767
39792
|
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { ref: setNodeRef, className: (0, import_design_system112.cn)("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
|
|
39768
39793
|
}
|
|
39769
39794
|
function SortableRow({ id, disabled, children }) {
|
|
39770
|
-
const { attributes, listeners
|
|
39795
|
+
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = (0, import_sortable.useSortable)({ id, disabled });
|
|
39771
39796
|
return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
39772
39797
|
"div",
|
|
39773
39798
|
{
|
|
@@ -39776,7 +39801,7 @@ function SortableRow({ id, disabled, children }) {
|
|
|
39776
39801
|
className: (0, import_design_system112.cn)(isDragging && "relative z-10 opacity-80"),
|
|
39777
39802
|
"data-view-row": id,
|
|
39778
39803
|
...disabled ? {} : attributes,
|
|
39779
|
-
...disabled ? {} :
|
|
39804
|
+
...disabled ? {} : listeners,
|
|
39780
39805
|
children
|
|
39781
39806
|
}
|
|
39782
39807
|
);
|
|
@@ -40361,7 +40386,7 @@ function ProposalRow({
|
|
|
40361
40386
|
var import_react238 = require("react");
|
|
40362
40387
|
var import_react239 = require("@ai-matrx/records/react");
|
|
40363
40388
|
var import_design_system115 = require("@ai-matrx/design-system");
|
|
40364
|
-
var
|
|
40389
|
+
var import_data_table23 = require("@ai-matrx/design-system/data-table");
|
|
40365
40390
|
var import_format11 = require("@ai-matrx/kit/format");
|
|
40366
40391
|
|
|
40367
40392
|
// src/ChecklistRunner.tsx
|
|
@@ -41429,7 +41454,7 @@ function ActionInbox({
|
|
|
41429
41454
|
);
|
|
41430
41455
|
const select = (0, import_react238.useCallback)(
|
|
41431
41456
|
(index, shift) => {
|
|
41432
|
-
const { next, anchor: at } = (0,
|
|
41457
|
+
const { next, anchor: at } = (0, import_data_table23.toggleSelection)({
|
|
41433
41458
|
order: shown5,
|
|
41434
41459
|
idOf: (i) => i.item_id,
|
|
41435
41460
|
selected,
|
|
@@ -42028,8 +42053,8 @@ function planUndo(changes, current, only) {
|
|
|
42028
42053
|
const doc = current ?? {};
|
|
42029
42054
|
return changes.filter((change) => !only || change.key === only).map((change) => {
|
|
42030
42055
|
const now = doc[change.key];
|
|
42031
|
-
const
|
|
42032
|
-
return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state };
|
|
42056
|
+
const state2 = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
|
|
42057
|
+
return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state: state2 };
|
|
42033
42058
|
});
|
|
42034
42059
|
}
|
|
42035
42060
|
function undoPatch(lines, replaceLaterEdits) {
|
|
@@ -42055,11 +42080,11 @@ var import_design_system116 = require("@ai-matrx/design-system");
|
|
|
42055
42080
|
var import_controls3 = require("@ai-matrx/design-system/controls");
|
|
42056
42081
|
var import_text_case16 = require("@ai-matrx/kit/text-case");
|
|
42057
42082
|
var import_jsx_runtime135 = require("react/jsx-runtime");
|
|
42058
|
-
function endOfDayIso(day2,
|
|
42083
|
+
function endOfDayIso(day2, zone = getPersonTimeZone()) {
|
|
42059
42084
|
const [y, m, d] = day2.split("-").map(Number);
|
|
42060
|
-
if (!
|
|
42085
|
+
if (!zone) return new Date(y, m - 1, d, 23, 59, 59, 999).toISOString();
|
|
42061
42086
|
const wall = (at) => {
|
|
42062
|
-
const parts = new Intl.DateTimeFormat("en-US", { timeZone:
|
|
42087
|
+
const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(new Date(at));
|
|
42063
42088
|
const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
|
|
42064
42089
|
return Date.UTC(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
|
|
42065
42090
|
};
|
|
@@ -42068,8 +42093,8 @@ function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
|
|
|
42068
42093
|
for (let i = 0; i < 2; i += 1) guess -= wall(guess) - target;
|
|
42069
42094
|
return new Date(guess + 999).toISOString();
|
|
42070
42095
|
}
|
|
42071
|
-
function asOfArgs(record_id, asOf,
|
|
42072
|
-
return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day,
|
|
42096
|
+
function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
|
|
42097
|
+
return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
|
|
42073
42098
|
}
|
|
42074
42099
|
function AsOfControl({ value, onChange, className }) {
|
|
42075
42100
|
const [text, setText] = (0, import_react240.useState)(value ? (0, import_records64.typedDateText)(value.day) : "");
|
|
@@ -42172,12 +42197,12 @@ function AsOfReading({
|
|
|
42172
42197
|
className
|
|
42173
42198
|
}) {
|
|
42174
42199
|
const client = (0, import_react241.useRecordsClient)();
|
|
42175
|
-
const
|
|
42200
|
+
const zone = usePersonTimeZone();
|
|
42176
42201
|
const [answer, setAnswer] = (0, import_react240.useState)(null);
|
|
42177
|
-
const key = `${recordId}|${asOf.clock}|${asOf.day}|${
|
|
42202
|
+
const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone ?? ""}`;
|
|
42178
42203
|
(0, import_react240.useEffect)(() => {
|
|
42179
42204
|
let live = true;
|
|
42180
|
-
void client.recordAsOf(asOfArgs(recordId, asOf,
|
|
42205
|
+
void client.recordAsOf(asOfArgs(recordId, asOf, zone)).then((got) => {
|
|
42181
42206
|
if (!live) return;
|
|
42182
42207
|
setAnswer(got.ok ? { key, doc: got.data } : { key, error: got.error });
|
|
42183
42208
|
});
|
|
@@ -44461,7 +44486,7 @@ function People({
|
|
|
44461
44486
|
said2 ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "text-xs text-muted-foreground", children: said2 }) : null,
|
|
44462
44487
|
card.principals.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "text-xs text-muted-foreground", children: "Nobody yet. Inviting somebody below emails them a sign-in link; it gives them nothing until they follow it." }) : null,
|
|
44463
44488
|
card.principals.map((person) => {
|
|
44464
|
-
const
|
|
44489
|
+
const state2 = stateWords(person);
|
|
44465
44490
|
const asking = askingToRevoke?.principal_id === person.principal_id;
|
|
44466
44491
|
const showing = previewing?.principal_id === person.principal_id;
|
|
44467
44492
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(
|
|
@@ -44471,10 +44496,10 @@ function People({
|
|
|
44471
44496
|
children: [
|
|
44472
44497
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
44473
44498
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("span", { className: "min-w-0 flex-1 truncate font-medium", children: person.client || person.email }),
|
|
44474
|
-
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_design_system125.Badge, { variant:
|
|
44499
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(import_design_system125.Badge, { variant: state2.tone, children: state2.label })
|
|
44475
44500
|
] }),
|
|
44476
44501
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 break-all text-muted-foreground", children: person.email }),
|
|
44477
|
-
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 text-muted-foreground", children:
|
|
44502
|
+
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)("p", { className: "mt-0.5 text-muted-foreground", children: state2.why }),
|
|
44478
44503
|
person.is_active ? /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: [
|
|
44479
44504
|
person.accept_path ? /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(CopyLink, { url: `${here}${person.accept_path}`, what: "their link" }) : null,
|
|
44480
44505
|
/* @__PURE__ */ (0, import_jsx_runtime144.jsx)(
|
|
@@ -44675,7 +44700,7 @@ function Invite({ card, onInvited }) {
|
|
|
44675
44700
|
|
|
44676
44701
|
// src/FormLookFrame.tsx
|
|
44677
44702
|
var import_design_system126 = require("@ai-matrx/design-system");
|
|
44678
|
-
var
|
|
44703
|
+
var import_data_table24 = require("@ai-matrx/design-system/data-table");
|
|
44679
44704
|
var import_jsx_runtime145 = require("react/jsx-runtime");
|
|
44680
44705
|
var ACCENT_PRIMARY = {
|
|
44681
44706
|
slate: "215 19% 35%",
|
|
@@ -44694,15 +44719,15 @@ function safeHref(url) {
|
|
|
44694
44719
|
return null;
|
|
44695
44720
|
}
|
|
44696
44721
|
function formLookView(style, fallbackName) {
|
|
44697
|
-
const accent = style?.accent && style.accent in
|
|
44722
|
+
const accent = style?.accent && style.accent in import_data_table24.SWATCH_CLASS ? style.accent : null;
|
|
44698
44723
|
const https = (u) => typeof u === "string" && /^https:\/\//i.test(u) ? u : null;
|
|
44699
44724
|
const links = Array.isArray(style?.footer_links) ? style.footer_links : [];
|
|
44700
44725
|
return {
|
|
44701
44726
|
name: (style?.display_name ?? "").trim() || fallbackName.trim() || "Form",
|
|
44702
44727
|
logoUrl: https(style?.logo_url),
|
|
44703
44728
|
coverUrl: https(style?.cover_url),
|
|
44704
|
-
bandClass: accent ?
|
|
44705
|
-
monogramClass: accent ? `${
|
|
44729
|
+
bandClass: accent ? import_data_table24.SWATCH_CLASS[accent] : null,
|
|
44730
|
+
monogramClass: accent ? `${import_data_table24.SWATCH_CLASS[accent]} text-white` : "bg-primary text-primary-foreground",
|
|
44706
44731
|
primaryVars: accent && ACCENT_PRIMARY[accent] ? {
|
|
44707
44732
|
"--primary": ACCENT_PRIMARY[accent],
|
|
44708
44733
|
"--primary-foreground": "0 0% 100%",
|
|
@@ -44803,8 +44828,8 @@ function scheduleWords(schedule, tz) {
|
|
|
44803
44828
|
if (words2.length === 0) return null;
|
|
44804
44829
|
const time = words2.find((w) => /^\d{1,2}:\d{2}$/.test(w)) ?? null;
|
|
44805
44830
|
const day2 = words2.map((w) => DAYS3[w.slice(0, 3)]).find(Boolean) ?? null;
|
|
44806
|
-
const
|
|
44807
|
-
const at = time ? `at ${time.padStart(5, "0")}, ${
|
|
44831
|
+
const zone = tz?.trim() ? `${tz.trim()} time` : "UTC";
|
|
44832
|
+
const at = time ? `at ${time.padStart(5, "0")}, ${zone}` : null;
|
|
44808
44833
|
return [day2, at].filter(Boolean).join(" ") || null;
|
|
44809
44834
|
}
|
|
44810
44835
|
|
|
@@ -46512,6 +46537,7 @@ function Question({
|
|
|
46512
46537
|
|
|
46513
46538
|
// src/FormBuilder.tsx
|
|
46514
46539
|
var import_forms3 = require("@ai-matrx/records/forms");
|
|
46540
|
+
var import_outbound_react7 = require("@ai-matrx/kit/outbound-react");
|
|
46515
46541
|
var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
46516
46542
|
function freshFormName(base2, taken) {
|
|
46517
46543
|
const names = new Set(taken.map((n) => n.trim().toLowerCase()));
|
|
@@ -47141,7 +47167,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
47141
47167
|
}
|
|
47142
47168
|
function PublishRow({
|
|
47143
47169
|
url,
|
|
47144
|
-
state,
|
|
47170
|
+
state: state2,
|
|
47145
47171
|
mayPublish,
|
|
47146
47172
|
why,
|
|
47147
47173
|
busy,
|
|
@@ -47151,7 +47177,7 @@ function PublishRow({
|
|
|
47151
47177
|
onCopy,
|
|
47152
47178
|
unsaved = false
|
|
47153
47179
|
}) {
|
|
47154
|
-
const open =
|
|
47180
|
+
const open = state2 === "open";
|
|
47155
47181
|
return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-col gap-1.5 rounded border px-2.5 py-2", children: [
|
|
47156
47182
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
47157
47183
|
mayPublish ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
@@ -47164,13 +47190,11 @@ function PublishRow({
|
|
|
47164
47190
|
children: busy ? "\u2026" : open ? "Unpublish" : unsaved ? "Save and publish" : "Publish"
|
|
47165
47191
|
}
|
|
47166
47192
|
) : null,
|
|
47167
|
-
|
|
47193
|
+
state2 !== "draft" ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)(import_jsx_runtime151.Fragment, { children: [
|
|
47168
47194
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(
|
|
47169
|
-
|
|
47195
|
+
import_outbound_react7.OutboundLink,
|
|
47170
47196
|
{
|
|
47171
47197
|
href: url,
|
|
47172
|
-
target: "_blank",
|
|
47173
|
-
rel: "noreferrer",
|
|
47174
47198
|
className: "min-w-0 flex-1 truncate text-xs underline underline-offset-2",
|
|
47175
47199
|
children: url
|
|
47176
47200
|
}
|
|
@@ -47178,7 +47202,7 @@ function PublishRow({
|
|
|
47178
47202
|
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_design_system133.Button, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
|
|
47179
47203
|
] }) : null
|
|
47180
47204
|
] }),
|
|
47181
|
-
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: import_forms3.FORM_STATE_WORDS[
|
|
47205
|
+
/* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: import_forms3.FORM_STATE_WORDS[state2], "data-records-form-state": state2, children: FORM_STATE_LABELS[state2] }),
|
|
47182
47206
|
open && unsaved ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "text-xs text-muted-foreground", "data-records-form-unsaved": "", children: "Unsaved changes \u2014 the live form shows your last save" }) : null,
|
|
47183
47207
|
!mayPublish ? /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { className: "w-fit text-xs text-muted-foreground", title: why, children: "Publishing needs table admin" }) : null,
|
|
47184
47208
|
shownUrl ? /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("p", { className: "break-all rounded border border-dashed px-2 py-1 text-xs", title: "This browser would not copy for you.", children: [
|
|
@@ -52156,6 +52180,7 @@ function asRefusal3(e, fallback) {
|
|
|
52156
52180
|
|
|
52157
52181
|
// src/CalendarSubscribe.tsx
|
|
52158
52182
|
var import_design_system150 = require("@ai-matrx/design-system");
|
|
52183
|
+
var import_outbound_react8 = require("@ai-matrx/kit/outbound-react");
|
|
52159
52184
|
var import_jsx_runtime168 = require("react/jsx-runtime");
|
|
52160
52185
|
function CalendarLinkOnce({ url }) {
|
|
52161
52186
|
const notify = useRecordsUi().notify;
|
|
@@ -52183,7 +52208,7 @@ function CalendarLinkOnce({ url }) {
|
|
|
52183
52208
|
] }),
|
|
52184
52209
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsxs)("div", { className: "flex flex-wrap gap-2", children: [
|
|
52185
52210
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)(import_design_system150.Button, { asChild: true, size: "sm", variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)("a", { href: webcalUrl(url), "data-calendar-apple": "", children: "Open in Apple Calendar" }) }),
|
|
52186
|
-
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)(import_design_system150.Button, { asChild: true, size: "sm", variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(
|
|
52211
|
+
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)(import_design_system150.Button, { asChild: true, size: "sm", variant: "outline", children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)(import_outbound_react8.OutboundLink, { href: googleCalendarUrl(url), "data-calendar-google": "", children: "Add to Google Calendar" }) })
|
|
52187
52212
|
] }),
|
|
52188
52213
|
/* @__PURE__ */ (0, import_jsx_runtime168.jsx)("p", { className: "text-xs text-muted-foreground", children: "Shown once. Rotate it from Settings if you lose it." })
|
|
52189
52214
|
] });
|
|
@@ -53077,6 +53102,7 @@ function useSlotScroll(slot) {
|
|
|
53077
53102
|
|
|
53078
53103
|
// src/TablePage.tsx
|
|
53079
53104
|
var import_uuid3 = require("@ai-matrx/kit/uuid");
|
|
53105
|
+
var import_outbound4 = require("@ai-matrx/kit/outbound");
|
|
53080
53106
|
var import_jsx_runtime175 = require("react/jsx-runtime");
|
|
53081
53107
|
var RAIL_TITLE = {
|
|
53082
53108
|
settings: "Table settings",
|
|
@@ -53897,7 +53923,7 @@ function TablePage({
|
|
|
53897
53923
|
...actionHost?.extend ? actionHost.extend(subject, mayDo) : []
|
|
53898
53924
|
],
|
|
53899
53925
|
openInNewTab: (url) => {
|
|
53900
|
-
|
|
53926
|
+
(0, import_outbound4.openOutbound)(url, "_blank", "noopener");
|
|
53901
53927
|
},
|
|
53902
53928
|
copyText: async (url) => {
|
|
53903
53929
|
if (await (0, import_clipboard17.copyText)(url)) {
|
|
@@ -54529,7 +54555,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
54529
54555
|
// src/entityViews.tsx
|
|
54530
54556
|
var import_format15 = require("@ai-matrx/kit/format");
|
|
54531
54557
|
var import_design_system158 = require("@ai-matrx/design-system");
|
|
54532
|
-
var
|
|
54558
|
+
var import_data_table25 = require("@ai-matrx/design-system/data-table");
|
|
54533
54559
|
var import_react313 = require("react");
|
|
54534
54560
|
var import_design_system159 = require("@ai-matrx/design-system");
|
|
54535
54561
|
var import_react314 = require("@ai-matrx/records/react");
|
|
@@ -54776,7 +54802,7 @@ function EntityTablePageBody({
|
|
|
54776
54802
|
) }) }) : null,
|
|
54777
54803
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
54778
54804
|
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(
|
|
54779
|
-
|
|
54805
|
+
import_data_table25.MatrxTableCardShowMore,
|
|
54780
54806
|
{
|
|
54781
54807
|
shown: entity.rows.length,
|
|
54782
54808
|
total: entity.total ?? entity.rows.length + 1,
|