@ai-matrx/records-ui 0.116.23 → 0.116.25
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 +36 -1
- package/README.md +3 -3
- package/dist/SaveToTable-P3MPRSCW.js +20 -0
- package/dist/{chunk-MUK63ANA.js → chunk-4ZS4WEEE.js} +3 -3
- package/dist/chunk-4ZS4WEEE.js.map +1 -0
- package/dist/{chunk-SYHUPGCU.js → chunk-6Z537SLG.js} +1 -1
- package/dist/{chunk-SYHUPGCU.js.map → chunk-6Z537SLG.js.map} +1 -1
- package/dist/{chunk-ODABFEHG.js → chunk-7RSMA3NK.js} +3 -3
- package/dist/chunk-7RSMA3NK.js.map +1 -0
- package/dist/{chunk-VHZKLE63.js → chunk-FLIERNH7.js} +9 -9
- package/dist/chunk-FLIERNH7.js.map +1 -0
- package/dist/{chunk-ZNIXJ5RY.js → chunk-KQR2RA4V.js} +3 -3
- package/dist/{chunk-WQGFKNE2.js → chunk-OJTJ4HJI.js} +26 -26
- package/dist/chunk-OJTJ4HJI.js.map +1 -0
- package/dist/{chunk-PPWNFIJ5.js → chunk-OV6QBL5R.js} +2 -2
- package/dist/{chunk-PPWNFIJ5.js.map → chunk-OV6QBL5R.js.map} +1 -1
- package/dist/{chunk-5IX4BL72.js → chunk-QBMUTXTQ.js} +2 -2
- package/dist/{chunk-5IX4BL72.js.map → chunk-QBMUTXTQ.js.map} +1 -1
- package/dist/{chunk-MCDA6L7E.js → chunk-TC5S4VOW.js} +2 -2
- package/dist/chunk-TC5S4VOW.js.map +1 -0
- package/dist/{chunk-FECWKOWW.js → chunk-W7GR64CB.js} +1 -1
- package/dist/chunk-W7GR64CB.js.map +1 -0
- package/dist/{chunk-FHL4GG6R.js → chunk-WCQSJPLS.js} +2 -2
- package/dist/chunk-WCQSJPLS.js.map +1 -0
- package/dist/data-source.cjs.map +1 -1
- package/dist/data-source.d.cts +1 -1
- package/dist/data-source.d.ts +1 -1
- package/dist/data-source.js.map +1 -1
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.d.cts +1 -1
- package/dist/first-page.d.ts +1 -1
- package/dist/first-page.js.map +1 -1
- package/dist/helpers.cjs +4 -4
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +9 -9
- package/dist/helpers.d.ts +9 -9
- package/dist/helpers.js +4 -4
- package/dist/helpers.js.map +1 -1
- package/dist/html-frame.cjs.map +1 -1
- package/dist/html-frame.d.cts +1 -1
- package/dist/html-frame.d.ts +1 -1
- package/dist/html-frame.js +1 -1
- package/dist/index.cjs +603 -251
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +162 -115
- package/dist/index.d.ts +162 -115
- package/dist/index.js +590 -224
- package/dist/index.js.map +1 -1
- package/dist/object-actions.cjs +2 -2
- package/dist/object-actions.cjs.map +1 -1
- package/dist/object-actions.js +3 -3
- package/dist/pickers.cjs +23 -23
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +8 -8
- package/dist/skeleton.cjs.map +1 -1
- package/dist/skeleton.js +4 -4
- package/dist/table-shape.cjs.map +1 -1
- package/dist/table-shape.js +1 -1
- package/package.json +3 -3
- package/dist/SaveToTable-PGOQVYVS.js +0 -20
- package/dist/chunk-FECWKOWW.js.map +0 -1
- package/dist/chunk-FHL4GG6R.js.map +0 -1
- package/dist/chunk-MCDA6L7E.js.map +0 -1
- package/dist/chunk-MUK63ANA.js.map +0 -1
- package/dist/chunk-ODABFEHG.js.map +0 -1
- package/dist/chunk-VHZKLE63.js.map +0 -1
- package/dist/chunk-WQGFKNE2.js.map +0 -1
- /package/dist/{SaveToTable-PGOQVYVS.js.map → SaveToTable-P3MPRSCW.js.map} +0 -0
- /package/dist/{chunk-ZNIXJ5RY.js.map → chunk-KQR2RA4V.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ function sentenceFor(what, level) {
|
|
|
49
49
|
read: "open this",
|
|
50
50
|
comment: "leave a comment",
|
|
51
51
|
write: "change anything here",
|
|
52
|
-
organise: "
|
|
52
|
+
organise: "organize this",
|
|
53
53
|
remove: "delete this",
|
|
54
54
|
share: "pass this on to somebody else",
|
|
55
55
|
structure: "change the columns of this table"
|
|
@@ -402,7 +402,7 @@ function refusalForAPerson(error) {
|
|
|
402
402
|
const said2 = (messageIsForEngineers ? "" : message.kept ?? "").trim();
|
|
403
403
|
const forEngineers = [
|
|
404
404
|
error.sqlstate ? `SQLSTATE ${error.sqlstate}.` : null,
|
|
405
|
-
// The client's own note about a class it did not
|
|
405
|
+
// The client's own note about a class it did not recognize, or a call that
|
|
406
406
|
// never reached the store. It is rendered out of sight, never as a sentence.
|
|
407
407
|
error.diagnostic ? error.diagnostic : null,
|
|
408
408
|
messageIsForEngineers ? `Message: ${error.message}` : null,
|
|
@@ -686,7 +686,7 @@ var init_fieldTypes = __esm({
|
|
|
686
686
|
{ id: "phone", group: "Words", label: "Phone number", explanation: "A phone number, checked as you type." },
|
|
687
687
|
{ id: "url", group: "Words", label: "Link", explanation: "A web address that opens in a new tab when you click it." },
|
|
688
688
|
{ id: "address", group: "Words", label: "Address", explanation: "A street address in parts, opened in maps." },
|
|
689
|
-
{ id: "color_pair", group: "Words", label: "
|
|
689
|
+
{ id: "color_pair", group: "Words", label: "Color", explanation: "A color for light and dark, with a readability check." },
|
|
690
690
|
{ id: "type_style", group: "Words", label: "Type style", explanation: "A font, weight and size, shown as a sample." },
|
|
691
691
|
{ id: "shadow", group: "Words", label: "Shadow", explanation: "A shadow, shown on a card." },
|
|
692
692
|
{ id: "json", group: "Words", label: "JSON", explanation: "Structured data \u2014 a list or a set of named values \u2014 shown folded." },
|
|
@@ -765,7 +765,7 @@ function fieldTypeLabel(field2) {
|
|
|
765
765
|
const known = fieldTypeChoice(kind2)?.label;
|
|
766
766
|
if (known) return field2.multi && kind2 !== "multi_select" ? `${known} (many)` : known;
|
|
767
767
|
const plain2 = {
|
|
768
|
-
// `boolean` is the
|
|
768
|
+
// `boolean` is the BEHAVIOR word; `checkbox` is the type a person picks. Both are
|
|
769
769
|
// written the way a person writes them, never as a raw token.
|
|
770
770
|
boolean: "Yes / no",
|
|
771
771
|
date: "Date",
|
|
@@ -2374,7 +2374,7 @@ function shapeTextOfNode(node) {
|
|
|
2374
2374
|
for (const r of rows.slice(1)) out.push(`| ${pad4(r).map(cell2).join(" | ")} |`);
|
|
2375
2375
|
rows = [];
|
|
2376
2376
|
};
|
|
2377
|
-
const
|
|
2377
|
+
const textOf2 = (n) => (n.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
2378
2378
|
const walk = (n, depth) => {
|
|
2379
2379
|
if (n.nodeType === 3) {
|
|
2380
2380
|
line += n.textContent ?? "";
|
|
@@ -2385,7 +2385,7 @@ function shapeTextOfNode(node) {
|
|
|
2385
2385
|
const tag = n.nodeType === 1 ? el.tagName.toUpperCase() : "#fragment";
|
|
2386
2386
|
if (tag === "TR") {
|
|
2387
2387
|
const cells = Array.from(el.children).filter((c) => /^(TD|TH)$/i.test(c.tagName));
|
|
2388
|
-
rows.push(cells.map((c) =>
|
|
2388
|
+
rows.push(cells.map((c) => textOf2(c)));
|
|
2389
2389
|
return;
|
|
2390
2390
|
}
|
|
2391
2391
|
if (tag === "TABLE" || tag === "THEAD" || tag === "TBODY" || tag === "TFOOT") {
|
|
@@ -4359,7 +4359,7 @@ function ImportWizard({ tableId, source, onDone, onWrote, autoRun, className })
|
|
|
4359
4359
|
),
|
|
4360
4360
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("span", { className: (0, import_design_system31.cn)("text-muted-foreground", titleMissing && "text-destructive"), children: [
|
|
4361
4361
|
titleMissing ? `Nothing goes into ${titleFieldLabel} yet, so these records would have no name. Choose the column above, then this will run.` : columnsSentence(mappedCount, plan.columns.length - leftOut.size, unmapped) + (leftOut.size > 0 ? ` \xB7 ${leftOut.size} left out` : ""),
|
|
4362
|
-
fileHash || titleMissing ? "" : " \xB7 this browser cannot
|
|
4362
|
+
fileHash || titleMissing ? "" : " \xB7 this browser cannot recognize the file again, so importing it twice would write it twice"
|
|
4363
4363
|
] })
|
|
4364
4364
|
] })
|
|
4365
4365
|
] }) : null,
|
|
@@ -5841,7 +5841,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, startNew, classN
|
|
|
5841
5841
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: "Nobody booking is asked who they are, so you would not know who booked or how to reach them." }),
|
|
5842
5842
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_design_system35.Button, { size: "sm", variant: "outline", disabled: addingWho, onClick: () => void addWho(), children: addingWho ? "Adding\u2026" : "Ask their name and email" })
|
|
5843
5843
|
] }) : null,
|
|
5844
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: "The time, whether it is booked or
|
|
5844
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: "The time, whether it is booked or canceled, and who it is with are filled in for you \u2014 a booking page cannot ask a visitor for any of the three." }),
|
|
5845
5845
|
leftOut ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("p", { className: "text-xs text-muted-foreground", children: leftOut }) : null,
|
|
5846
5846
|
unfillable ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
5847
5847
|
import_design_system34.ErrorBox,
|
|
@@ -6775,7 +6775,7 @@ function BookingSlots({ tableId, activeBookingId, className }) {
|
|
|
6775
6775
|
page.cancelled > 0 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
|
|
6776
6776
|
" \xB7 ",
|
|
6777
6777
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "font-medium", children: page.cancelled }),
|
|
6778
|
-
"
|
|
6778
|
+
" canceled"
|
|
6779
6779
|
] }) : null,
|
|
6780
6780
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
6781
6781
|
" \xB7 ",
|
|
@@ -7857,13 +7857,13 @@ __export(src_exports, {
|
|
|
7857
7857
|
ACTION_NO_ACCESS_REASON: () => ACTION_NO_ACCESS_REASON,
|
|
7858
7858
|
ACTION_PLATFORM_TABLE_REASON: () => ACTION_PLATFORM_TABLE_REASON,
|
|
7859
7859
|
ADD_CHOICES: () => ADD_CHOICES,
|
|
7860
|
-
ARCHIVED_NEVER_DESTROYED: () =>
|
|
7860
|
+
ARCHIVED_NEVER_DESTROYED: () => import_design_system182.ARCHIVED_NEVER_DESTROYED,
|
|
7861
7861
|
ARCHIVE_MEANS: () => ARCHIVE_MEANS,
|
|
7862
7862
|
ASK_EXAMPLE: () => ASK_EXAMPLE,
|
|
7863
7863
|
AccentSwatches: () => AccentSwatches,
|
|
7864
7864
|
ActionInbox: () => ActionInbox,
|
|
7865
7865
|
ArchiveDeliberatelyDialog: () => ArchiveDeliberatelyDialog,
|
|
7866
|
-
ArchivedDisclosure: () =>
|
|
7866
|
+
ArchivedDisclosure: () => import_design_system182.ArchivedDisclosure,
|
|
7867
7867
|
ArchivedPortals: () => ArchivedPortals,
|
|
7868
7868
|
ArchivedView: () => ArchivedView,
|
|
7869
7869
|
BODY_COLUMN_NAME: () => BODY_COLUMN_NAME,
|
|
@@ -7933,6 +7933,7 @@ __export(src_exports, {
|
|
|
7933
7933
|
EntityDataScope: () => EntityDataScope,
|
|
7934
7934
|
EntityGrid: () => EntityGrid,
|
|
7935
7935
|
EntityReferenceKindPicker: () => EntityReferenceKindPicker,
|
|
7936
|
+
EntitySectionCard: () => EntitySectionCard,
|
|
7936
7937
|
EntityTablePage: () => EntityTablePage,
|
|
7937
7938
|
ExportMenu: () => ExportMenu,
|
|
7938
7939
|
FEWEST_KEY_VALUE_PAIRS: () => FEWEST_KEY_VALUE_PAIRS,
|
|
@@ -8259,8 +8260,11 @@ __export(src_exports, {
|
|
|
8259
8260
|
entityCellValue: () => entityCellValue,
|
|
8260
8261
|
entityChartQuestion: () => import_first_page9.entityChartQuestion,
|
|
8261
8262
|
entityChoiceColumns: () => entityChoiceColumns,
|
|
8263
|
+
entityFilterWhere: () => entityFilterWhere,
|
|
8262
8264
|
entityNameColumn: () => entityNameColumn,
|
|
8263
8265
|
entityReferenceSpec: () => entityReferenceSpec,
|
|
8266
|
+
entitySectionColumns: () => entitySectionColumns,
|
|
8267
|
+
entitySectionGroups: () => entitySectionGroups,
|
|
8264
8268
|
entityShownColumns: () => entityShownColumns,
|
|
8265
8269
|
entityTableColumns: () => entityTableColumns,
|
|
8266
8270
|
entityTableQuery: () => import_first_page9.entityTableQuery,
|
|
@@ -9343,7 +9347,7 @@ function ColorWell({
|
|
|
9343
9347
|
import_design_system2.BasicInput,
|
|
9344
9348
|
{
|
|
9345
9349
|
type: "color",
|
|
9346
|
-
"aria-label": `${label}: pick a
|
|
9350
|
+
"aria-label": `${label}: pick a color`,
|
|
9347
9351
|
className: "h-7 w-8 shrink-0 p-0.5",
|
|
9348
9352
|
value: value && HEX_6.test(value) ? value : "#000000",
|
|
9349
9353
|
disabled,
|
|
@@ -9429,7 +9433,7 @@ function colorPairChecks(value, format, context) {
|
|
|
9429
9433
|
message: `hard to read on ${ground}`,
|
|
9430
9434
|
fix: {
|
|
9431
9435
|
label: "Fix with AI",
|
|
9432
|
-
ask: `The ${part}
|
|
9436
|
+
ask: `The ${part} color ${color} reads at ${ratio}:1 on ${ground}. Suggest the nearest color that reaches 4.5:1 and keeps its hue.`
|
|
9433
9437
|
}
|
|
9434
9438
|
});
|
|
9435
9439
|
}
|
|
@@ -9659,7 +9663,7 @@ function ShadowLayersEditor({
|
|
|
9659
9663
|
},
|
|
9660
9664
|
k
|
|
9661
9665
|
)),
|
|
9662
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "col-span-3", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ColorWell, { id: i === 0 ? id : `${id}-${i}`, label: `${label} layer ${i + 1}
|
|
9666
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "col-span-3", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ColorWell, { id: i === 0 ? id : `${id}-${i}`, label: `${label} layer ${i + 1} color`, value: layer.color, disabled, onChange: (c) => c && set(i, { color: c }) }) }),
|
|
9663
9667
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "flex items-center justify-end", children: layers.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", disabled, className: "text-xs text-muted-foreground hover:text-foreground", onClick: () => onChange(layers.filter((_, j) => j !== i)), children: "Remove" }) : null })
|
|
9664
9668
|
] }, i)),
|
|
9665
9669
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", disabled, className: "self-start text-xs text-muted-foreground hover:text-foreground", onClick: () => onChange([...layers, NEW_LAYER]), children: "+ Layer" })
|
|
@@ -10040,10 +10044,10 @@ function htmlSampleChecks(value, _format) {
|
|
|
10040
10044
|
const outsideFallbacks = styles.replace(/var\([^()]*(\([^()]*\))?[^()]*\)/g, "");
|
|
10041
10045
|
if (FIXED_COLOUR.test(outsideFallbacks)) {
|
|
10042
10046
|
out.push({
|
|
10043
|
-
message: "fixed
|
|
10047
|
+
message: "fixed colors, not the theme's",
|
|
10044
10048
|
fix: {
|
|
10045
10049
|
label: "Use tokens",
|
|
10046
|
-
ask: "Rewrite this HTML sample so every
|
|
10050
|
+
ask: "Rewrite this HTML sample so every color is one of the design system's CSS variables (var(--background), var(--foreground), var(--primary), var(--border)\u2026), keeping the markup and the look the same, so it follows light and dark."
|
|
10047
10051
|
}
|
|
10048
10052
|
});
|
|
10049
10053
|
}
|
|
@@ -13288,8 +13292,8 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
|
|
|
13288
13292
|
"button",
|
|
13289
13293
|
{
|
|
13290
13294
|
type: "button",
|
|
13291
|
-
"aria-label": `
|
|
13292
|
-
title: color ? import_data_table2.STYLE_COLOR_LABELS[color] : "No
|
|
13295
|
+
"aria-label": `Color for ${words2}: ${color ? import_data_table2.STYLE_COLOR_LABELS[color] : "none"}`,
|
|
13296
|
+
title: color ? import_data_table2.STYLE_COLOR_LABELS[color] : "No color",
|
|
13293
13297
|
"data-records-choice-swatch": color ?? "none",
|
|
13294
13298
|
className: (0, import_design_system16.cn)(
|
|
13295
13299
|
"h-4 w-4 shrink-0 rounded-full",
|
|
@@ -13297,15 +13301,15 @@ function ChoiceSwatch({ words: words2, color, onColor }) {
|
|
|
13297
13301
|
)
|
|
13298
13302
|
}
|
|
13299
13303
|
) }),
|
|
13300
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system16.PopoverContent, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `
|
|
13304
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_design_system16.PopoverContent, { sizing: "content", align: "start", className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center gap-1", role: "radiogroup", "aria-label": `Color for ${words2}`, children: [
|
|
13301
13305
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
13302
13306
|
"button",
|
|
13303
13307
|
{
|
|
13304
13308
|
type: "button",
|
|
13305
13309
|
role: "radio",
|
|
13306
13310
|
"aria-checked": color === null,
|
|
13307
|
-
"aria-label": "No
|
|
13308
|
-
title: "No
|
|
13311
|
+
"aria-label": "No color",
|
|
13312
|
+
title: "No color",
|
|
13309
13313
|
onClick: () => pick(null),
|
|
13310
13314
|
className: (0, import_design_system16.cn)("h-5 w-5 rounded-full border border-border bg-background", color === null && "ring-2 ring-ring ring-offset-1")
|
|
13311
13315
|
}
|
|
@@ -17706,8 +17710,8 @@ var import_records30 = require("@ai-matrx/records");
|
|
|
17706
17710
|
var import_design_system49 = require("@ai-matrx/design-system");
|
|
17707
17711
|
var import_data_table5 = require("@ai-matrx/design-system/data-table");
|
|
17708
17712
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
17709
|
-
function AccentSwatches({ value, onChange, options = import_records30.PORTAL_ACCENTS, noneLabel = "App
|
|
17710
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "
|
|
17713
|
+
function AccentSwatches({ value, onChange, options = import_records30.PORTAL_ACCENTS, noneLabel = "App color" }) {
|
|
17714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Color", children: [
|
|
17711
17715
|
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
17712
17716
|
"button",
|
|
17713
17717
|
{
|
|
@@ -17888,7 +17892,7 @@ function ButtonSettingsEditor({
|
|
|
17888
17892
|
] })
|
|
17889
17893
|
] }),
|
|
17890
17894
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
17891
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system51.Label, { className: "text-xs", children: "
|
|
17895
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_design_system51.Label, { className: "text-xs", children: "Color" }),
|
|
17892
17896
|
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
17893
17897
|
AccentSwatches,
|
|
17894
17898
|
{
|
|
@@ -18366,9 +18370,9 @@ function FieldEditor(props) {
|
|
|
18366
18370
|
// patch never carried it, so the tick beside "Can hold more than one"
|
|
18367
18371
|
// was decoration on an existing column — and the store's own roll-up
|
|
18368
18372
|
// refusal tells a person to use exactly that tick. It is sent ALONE:
|
|
18369
|
-
// `custom.field_update`
|
|
18370
|
-
// migration (before it, the door read `multi` only inside its
|
|
18371
|
-
// arm, answered "saved" and changed nothing), so there is no
|
|
18373
|
+
// `custom.field_update` honors a `multi`-only patch since FIX-7B-FIELD's
|
|
18374
|
+
// migration (before it, the door read `multi` only inside its behavior
|
|
18375
|
+
// arm, answered "saved" and changed nothing), so there is no behavior
|
|
18372
18376
|
// word to send beside it and sending one would retype a column nobody
|
|
18373
18377
|
// asked to retype.
|
|
18374
18378
|
...multiApplies(type) ? { multi: isTitle ? false : multi } : {},
|
|
@@ -18470,7 +18474,7 @@ function FieldEditor(props) {
|
|
|
18470
18474
|
...type === "modified_time" && watchFields.length ? { config: { only_fields: watchFields } } : {},
|
|
18471
18475
|
...type === "autonumber" && numberPrefix.trim() !== "" ? { display_format: { id: "autonumber", options: { prefix: numberPrefix.trim() } } } : {},
|
|
18472
18476
|
...type === "count" ? { via } : {},
|
|
18473
|
-
// THE
|
|
18477
|
+
// THE COLORS ITS CHOICES WERE GIVEN (W1-B), on the Field's look in the same declaration:
|
|
18474
18478
|
// both declare doors build the Field through `custom._field_document_for`, which keeps a
|
|
18475
18479
|
// `display_format` it is handed — so the grid paints them from its first draw.
|
|
18476
18480
|
...(() => {
|
|
@@ -19816,7 +19820,7 @@ function formatControl(args) {
|
|
|
19816
19820
|
{
|
|
19817
19821
|
id: `${id}-swatch`,
|
|
19818
19822
|
type: "color",
|
|
19819
|
-
"aria-label": `${label} \u2014 pick a
|
|
19823
|
+
"aria-label": `${label} \u2014 pick a color`,
|
|
19820
19824
|
className: "h-8 w-12 p-1",
|
|
19821
19825
|
value: /^#[0-9a-fA-F]{6}$/.test(text) ? text : "#000000",
|
|
19822
19826
|
disabled,
|
|
@@ -22401,9 +22405,9 @@ function OpenCell({
|
|
|
22401
22405
|
className: (0, import_design_system57.cn)(
|
|
22402
22406
|
// OVER the cell's ghost (see `data-records-open-cell`), never in the table's measuring.
|
|
22403
22407
|
"absolute inset-x-0 z-[25] flex w-full min-w-0 max-w-full flex-col gap-1 outline-none",
|
|
22404
|
-
// A one-line control sits
|
|
22408
|
+
// A one-line control sits centerd on the row; a multi-line box hangs from the cell's top and
|
|
22405
22409
|
// grows downward over the rows below (Airtable's expanded long-text cell), never up over the
|
|
22406
|
-
// header (D10:
|
|
22410
|
+
// header (D10: centerd, its first lines sat 58px above the cell, outside it).
|
|
22407
22411
|
// …and its words wrap: the one-line frame sets `white-space: nowrap` on every descendant, so the
|
|
22408
22412
|
// textarea scrolled sideways on one line (live, after the clip was lifted).
|
|
22409
22413
|
multiline ? "top-0 rounded-md bg-card shadow-md [&_textarea]:![white-space:pre-wrap] [&_textarea]:![overflow-wrap:anywhere]" : "top-1/2 -translate-y-1/2",
|
|
@@ -24426,9 +24430,9 @@ function paintByOption(style, _fields, index, lookup) {
|
|
|
24426
24430
|
}
|
|
24427
24431
|
return out ?? doc;
|
|
24428
24432
|
},
|
|
24429
|
-
// A CHOICE PAINTS IN ITS OWN
|
|
24430
|
-
// carries the
|
|
24431
|
-
// pink by the hash. The option's
|
|
24433
|
+
// A CHOICE PAINTS IN ITS OWN COLOR (DATA-V2-BASICS-2 C1b): an option kept in its own Table
|
|
24434
|
+
// carries the color its owner gave it; colored by Status, a "Verified" (green) row was tinted
|
|
24435
|
+
// pink by the hash. The option's color first, then the column's stored colors, then the hash.
|
|
24432
24436
|
choiceColorFor: (fieldKey, value) => {
|
|
24433
24437
|
const option = optionFor(index.get(fieldKey), value);
|
|
24434
24438
|
if (!option) return lookup(fieldKey, value);
|
|
@@ -24507,7 +24511,7 @@ function useGridColours(args) {
|
|
|
24507
24511
|
async (path, value, said2) => {
|
|
24508
24512
|
const answer = await client.tableDecorate({ table_id: tableId, path, value });
|
|
24509
24513
|
if (!answer.ok) {
|
|
24510
|
-
notify?.error(`The
|
|
24514
|
+
notify?.error(`The color was not kept: ${refusalSentence(answer.error)}`);
|
|
24511
24515
|
return false;
|
|
24512
24516
|
}
|
|
24513
24517
|
decorations.apply(answer.data);
|
|
@@ -24526,34 +24530,34 @@ function useGridColours(args) {
|
|
|
24526
24530
|
const name = fieldName(field2);
|
|
24527
24531
|
const by = decorations.data?.color_by;
|
|
24528
24532
|
const byThis = by?.field === field2.id;
|
|
24529
|
-
const byWhy = colourableBy(field2) ? void 0 : `${name} holds free values; rows are
|
|
24533
|
+
const byWhy = colourableBy(field2) ? void 0 : `${name} holds free values; rows are colored by a column of choices or ticks. Use a color rule instead.`;
|
|
24530
24534
|
const column = decorations.data?.columns?.[field2.id];
|
|
24531
24535
|
return {
|
|
24532
24536
|
id: "col-colour",
|
|
24533
|
-
label: "
|
|
24537
|
+
label: "Color by\u2026",
|
|
24534
24538
|
icon: "palette",
|
|
24535
24539
|
disabledReason: refusal3,
|
|
24536
24540
|
submenu: [
|
|
24537
24541
|
byThis ? {
|
|
24538
24542
|
id: "col-colour-off",
|
|
24539
|
-
label: `Stop
|
|
24540
|
-
onSelect: () => void write(["color_by"], null, `Rows are no longer
|
|
24543
|
+
label: `Stop coloring by ${name}`,
|
|
24544
|
+
onSelect: () => void write(["color_by"], null, `Rows are no longer colored by ${name}.`)
|
|
24541
24545
|
} : {
|
|
24542
24546
|
id: "col-colour-rows",
|
|
24543
|
-
label: "
|
|
24547
|
+
label: "Color rows by this column",
|
|
24544
24548
|
disabledReason: byWhy,
|
|
24545
|
-
onSelect: () => void write(["color_by"], { field: field2.id, target: "row" }, `Each row wears the
|
|
24549
|
+
onSelect: () => void write(["color_by"], { field: field2.id, target: "row" }, `Each row wears the color of its ${name}.`)
|
|
24546
24550
|
},
|
|
24547
24551
|
...byThis && by?.target === "row" ? [
|
|
24548
24552
|
{
|
|
24549
24553
|
id: "col-colour-cells",
|
|
24550
|
-
label: "
|
|
24551
|
-
onSelect: () => void write(["color_by"], { field: field2.id, target: "cell" }, `Only ${name}'s cells wear their
|
|
24554
|
+
label: "Color only this column's cells",
|
|
24555
|
+
onSelect: () => void write(["color_by"], { field: field2.id, target: "cell" }, `Only ${name}'s cells wear their color now.`)
|
|
24552
24556
|
}
|
|
24553
24557
|
] : [],
|
|
24554
24558
|
{
|
|
24555
24559
|
id: "col-colour-rules",
|
|
24556
|
-
label: "
|
|
24560
|
+
label: "Color rules\u2026",
|
|
24557
24561
|
onSelect: () => setRulesOpen(columnKey)
|
|
24558
24562
|
},
|
|
24559
24563
|
{
|
|
@@ -24607,7 +24611,7 @@ function useGridColours(args) {
|
|
|
24607
24611
|
if (!field2) continue;
|
|
24608
24612
|
const answer = await client.tableDecorate({ table_id: tableId, path: ["cells", cell2.rowId, field2.id], value: color });
|
|
24609
24613
|
if (!answer.ok) {
|
|
24610
|
-
notify?.error(`The
|
|
24614
|
+
notify?.error(`The color was not kept: ${refusalSentence(answer.error)}`);
|
|
24611
24615
|
return;
|
|
24612
24616
|
}
|
|
24613
24617
|
decorations.apply(answer.data);
|
|
@@ -24652,13 +24656,13 @@ function useGridColours(args) {
|
|
|
24652
24656
|
drafts: draftsFromView(view.rules, fields),
|
|
24653
24657
|
onSave: async (drafts) => {
|
|
24654
24658
|
view.save(viewRulesFrom(drafts));
|
|
24655
|
-
notify?.success(drafts.length === 0 ? "This view's
|
|
24659
|
+
notify?.success(drafts.length === 0 ? "This view's color rules are cleared." : "This view's color rules are kept.");
|
|
24656
24660
|
setRulesOpen(null);
|
|
24657
24661
|
}
|
|
24658
24662
|
}
|
|
24659
24663
|
} : {},
|
|
24660
24664
|
onSave: async (drafts) => {
|
|
24661
|
-
const kept = await write(["rules"], rulesLeaf(drafts, fields), drafts.length === 0 ? "The
|
|
24665
|
+
const kept = await write(["rules"], rulesLeaf(drafts, fields), drafts.length === 0 ? "The color rules are cleared." : "The color rules are kept.");
|
|
24662
24666
|
if (kept) setRulesOpen(null);
|
|
24663
24667
|
}
|
|
24664
24668
|
}
|
|
@@ -24666,25 +24670,25 @@ function useGridColours(args) {
|
|
|
24666
24670
|
const colourable = fields.filter(colourableBy);
|
|
24667
24671
|
const byId = decorations.data?.color_by?.field ?? null;
|
|
24668
24672
|
const sheet = enabled ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-1.5", "data-records-grid-sheet-colours": "", children: [
|
|
24669
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-xs font-medium text-muted-foreground", children: "
|
|
24673
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "text-xs font-medium text-muted-foreground", children: "Colors" }),
|
|
24670
24674
|
mayColour ? /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
24671
24675
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("label", { className: "flex min-w-0 flex-1 items-center gap-2 text-xs text-muted-foreground", children: [
|
|
24672
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "shrink-0", children: "
|
|
24676
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { className: "shrink-0", children: "Color rows by" }),
|
|
24673
24677
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
24674
24678
|
PickOne,
|
|
24675
24679
|
{
|
|
24676
|
-
label: "
|
|
24680
|
+
label: "Color rows by",
|
|
24677
24681
|
className: "h-10 min-w-0 flex-1 text-base",
|
|
24678
24682
|
value: byId ?? "",
|
|
24679
24683
|
onChange: (id) => {
|
|
24680
24684
|
const field2 = fields.find((f) => f.id === id);
|
|
24681
|
-
void (field2 ? write(["color_by"], { field: field2.id, target: "row" }, `Each row wears the
|
|
24685
|
+
void (field2 ? write(["color_by"], { field: field2.id, target: "row" }, `Each row wears the color of its ${fieldName(field2)}.`) : write(["color_by"], null, "Rows are no longer colored by a column."));
|
|
24682
24686
|
},
|
|
24683
|
-
options: [{ value: "", label: "No
|
|
24687
|
+
options: [{ value: "", label: "No color" }, ...colourable.map((field2) => ({ value: field2.id, label: fieldName(field2) }))]
|
|
24684
24688
|
}
|
|
24685
24689
|
)
|
|
24686
24690
|
] }),
|
|
24687
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.Button, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colourable[0]?.key ?? fields[0]?.key ?? ""), children: "
|
|
24691
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.Button, { type: "button", size: "sm", variant: "outline", className: "h-10 shrink-0", onClick: () => setRulesOpen(colourable[0]?.key ?? fields[0]?.key ?? ""), children: "Color rules\u2026" })
|
|
24688
24692
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: "text-xs text-muted-foreground", children: whyNot })
|
|
24689
24693
|
] }) : null;
|
|
24690
24694
|
return { headerItem, cellItem, cellsItem, rowItem, dialogs, sheet };
|
|
@@ -24735,7 +24739,7 @@ function ColourRulesDialog({
|
|
|
24735
24739
|
const first = startField ?? fields[0]?.key ?? "";
|
|
24736
24740
|
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.Dialog, { open, onOpenChange: (next) => !next ? close() : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_design_system66.DialogContent, { className: "sm:max-w-2xl", "data-records-colour-rules": "", children: [
|
|
24737
24741
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_design_system66.DialogHeader, { children: [
|
|
24738
|
-
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.DialogTitle, { children: "
|
|
24742
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.DialogTitle, { children: "Color rules" }),
|
|
24739
24743
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_design_system66.DialogDescription, { children: scope === "view" ? "The first rule a row matches wins. These rules belong to this view alone, and a date can be tested against today." : "The first rule a row matches wins. A rule tints the whole row, or only the cell it reads. Everyone who opens this table sees them." })
|
|
24740
24744
|
] }),
|
|
24741
24745
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -24823,7 +24827,7 @@ function ColourRulesDialog({
|
|
|
24823
24827
|
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
24824
24828
|
PickOne,
|
|
24825
24829
|
{
|
|
24826
|
-
label: "
|
|
24830
|
+
label: "Color",
|
|
24827
24831
|
attrs: { "data-records-colour-rule-color": "" },
|
|
24828
24832
|
className: SELECT2,
|
|
24829
24833
|
value: rule.color,
|
|
@@ -29876,8 +29880,8 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
29876
29880
|
// A column that holds numbers filters as numbers (=, <, >, between) — the record number too,
|
|
29877
29881
|
// which is worked out but kept (review 2: the autonumber header offered "Contains").
|
|
29878
29882
|
filter: filterRefusal(field2) !== null ? false : editorKindFor(field2) === "select" || editorKindFor(field2) === "multi_select" ? "select" : (0, import_first_page2.holdsNumbers)(field2) ? "number" : "auto",
|
|
29879
|
-
// THE MENU'S VALUE LIST WEARS THE CHOICES'
|
|
29880
|
-
// same chip the cell draws, never bare words beside a
|
|
29883
|
+
// THE MENU'S VALUE LIST WEARS THE CHOICES' COLORS (lane CELL-EDITORS, night walk 2026-10-06): the
|
|
29884
|
+
// same chip the cell draws, never bare words beside a colored column.
|
|
29881
29885
|
...editorKindFor(field2) === "select" || editorKindFor(field2) === "multi_select" ? { filterValueClass: (value, label) => choiceChipLookOf(field2, value, label).className } : {},
|
|
29882
29886
|
cell: (row) => (
|
|
29883
29887
|
/*
|
|
@@ -29926,7 +29930,7 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
29926
29930
|
// The type is in the header's tooltip rather than a second header row: one
|
|
29927
29931
|
// row of headers, always — and it is the parity type's own WORD, not a
|
|
29928
29932
|
// token (`Long text`, never `long_text`).
|
|
29929
|
-
//
|
|
29933
|
+
// CENTERD, EVERY WIDTH (Arman 2026-10-08: tick boxes sat on the cell's top edge). A grid row is
|
|
29930
29934
|
// ONE line (`cellLines` "one", the table's default), so nothing here wraps and top-aligning only
|
|
29931
29935
|
// lifted every value — text ~4 px, a 16 px tick box ~8 px — above the row's middle, out of line
|
|
29932
29936
|
// with the row's own controls. The table's cell is `align-middle`; this column no longer overrides it.
|
|
@@ -34010,9 +34014,9 @@ function GridBody({
|
|
|
34010
34014
|
() => (0, import_data_table14.tableStyleIsEmpty)(paint.style) ? null : {
|
|
34011
34015
|
style: paint.style,
|
|
34012
34016
|
// A choice is read as its OPTION (`paintByOption`): the rule, the value and the
|
|
34013
|
-
//
|
|
34017
|
+
// color a column keeps for it all name the same option, however it is stored.
|
|
34014
34018
|
documentOf: (row) => paint.documentOf(row.document ?? {}),
|
|
34015
|
-
// A value its column keeps a
|
|
34019
|
+
// A value its column keeps a color for wears THAT color (`choiceLooks.ts`);
|
|
34016
34020
|
// any other value still paints from its word.
|
|
34017
34021
|
choiceColorFor: paint.choiceColorFor
|
|
34018
34022
|
},
|
|
@@ -36726,7 +36730,7 @@ function VersionRow({
|
|
|
36726
36730
|
children: mine ? "Working out what would change\u2026" : "Put the record back to this version"
|
|
36727
36731
|
}
|
|
36728
36732
|
) }) : (
|
|
36729
|
-
// Absent AND explained: never a
|
|
36733
|
+
// Absent AND explained: never a grayed button, never silence.
|
|
36730
36734
|
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)("p", { className: "text-[11px] text-muted-foreground", children: whyNotRestore })
|
|
36731
36735
|
)
|
|
36732
36736
|
] }) : null
|
|
@@ -38310,10 +38314,16 @@ function editTypeOf(column) {
|
|
|
38310
38314
|
if (column.type === "checkbox" || column.type === "boolean") return "boolean";
|
|
38311
38315
|
return false;
|
|
38312
38316
|
}
|
|
38317
|
+
function entityFilterWhere(filter) {
|
|
38318
|
+
if (!filter) return [];
|
|
38319
|
+
return Object.keys(filter).sort().map((column) => ({ column, op: "eq", value: filter[column] }));
|
|
38320
|
+
}
|
|
38313
38321
|
function useEntitySourceTable(token2, options = {}) {
|
|
38314
38322
|
const type = (0, import_react214.useEntityType)(token2);
|
|
38315
38323
|
const columns = (0, import_react214.useEntityColumns)(token2);
|
|
38316
|
-
const
|
|
38324
|
+
const where = entityFilterWhere(options.filter);
|
|
38325
|
+
const query = { ...(0, import_first_page9.entityTableQuery)({ pageSize: options.pageSize, search: options.search }), ...where.length > 0 ? { where } : {} };
|
|
38326
|
+
const list = (0, import_react214.useEntityList)(token2, query);
|
|
38317
38327
|
const write = (0, import_react214.useEntityWrite)(token2);
|
|
38318
38328
|
const shown5 = (0, import_react212.useMemo)(() => entityShownColumns(columns.data ?? []), [columns.data]);
|
|
38319
38329
|
const refused = list.error ?? columns.error ?? type.error;
|
|
@@ -38339,7 +38349,7 @@ function useEntitySourceTable(token2, options = {}) {
|
|
|
38339
38349
|
return answer.ok ? null : refusalSentence(answer.error) || "That change was not saved.";
|
|
38340
38350
|
},
|
|
38341
38351
|
async create(values) {
|
|
38342
|
-
const answer = await write.create(values);
|
|
38352
|
+
const answer = await write.create(options.filter ? { ...values, ...options.filter } : values);
|
|
38343
38353
|
return answer.ok ? { id: answer.data._id } : { refused: refusalSentence(answer.error) || "That row was not added." };
|
|
38344
38354
|
}
|
|
38345
38355
|
};
|
|
@@ -38433,7 +38443,7 @@ function EntityTableCardBody({
|
|
|
38433
38443
|
className
|
|
38434
38444
|
}) {
|
|
38435
38445
|
const batch = initialRows ?? import_data_table16.TABLE_CARD_DEFAULT_INITIAL_ROWS;
|
|
38436
|
-
const entity = useEntitySourceTable(source.token, { pageSize: batch });
|
|
38446
|
+
const entity = useEntitySourceTable(source.token, { pageSize: batch, filter: source.filter ?? null });
|
|
38437
38447
|
const label = entity.label ?? (entity.loading ? "Loading\u2026" : "Table");
|
|
38438
38448
|
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
38439
38449
|
import_data_table16.MatrxTableCard,
|
|
@@ -41885,7 +41895,7 @@ function CalendarView({
|
|
|
41885
41895
|
type: "button",
|
|
41886
41896
|
className: (0, import_design_system119.cn)(
|
|
41887
41897
|
"@container 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",
|
|
41888
|
-
// The chip palette, not the faint row tint: a calendar is read by its
|
|
41898
|
+
// The chip palette, not the faint row tint: a calendar is read by its colors at a glance.
|
|
41889
41899
|
color ? import_data_table19.CHOICE_CHIP_CLASS[color] : "bg-background",
|
|
41890
41900
|
may ? "cursor-grab active:cursor-grabbing" : "cursor-default",
|
|
41891
41901
|
compact ? "min-h-3 px-0" : "",
|
|
@@ -41938,7 +41948,7 @@ function CalendarView({
|
|
|
41938
41948
|
setEndPick(key);
|
|
41939
41949
|
onEndFieldChange?.(key);
|
|
41940
41950
|
}, endKept ?? Boolean(onEndFieldChange), endUnusual) : null,
|
|
41941
|
-
choiceFields.length > 0 ? picker("
|
|
41951
|
+
choiceFields.length > 0 ? picker("Color by", colorKey, choiceFields, (key) => {
|
|
41942
41952
|
setColorPick(key);
|
|
41943
41953
|
onColorFieldChange?.(key);
|
|
41944
41954
|
}, true) : null
|
|
@@ -43190,7 +43200,7 @@ function TimelineView({
|
|
|
43190
43200
|
dates.length > 1 || !startField || !dates.some((f) => f.key === startChosen) ? picker("Start", startChosen, dates, (key) => setting({ startKey: key }), { none: false }) : null,
|
|
43191
43201
|
endCandidates.length > 0 || endField && !endCandidates.includes(endField) ? picker("End", endChosen, endCandidates, (key) => setting({ endKey: key }), { kept: layoutKept }) : null,
|
|
43192
43202
|
groupCandidates.length > 0 ? picker("Group by", groupChosen, groupCandidates, (key) => setting({ groupKey: key })) : null,
|
|
43193
|
-
choiceFields.length > 0 ? picker("
|
|
43203
|
+
choiceFields.length > 0 ? picker("Color by", colorChosen, choiceFields, (key) => setting({ colorKey: key })) : null
|
|
43194
43204
|
] });
|
|
43195
43205
|
const heading = zoom === "quarter" ? `Q${Math.floor(dayAt(anchor).getMonth() / 3) + 1} ${dayAt(anchor).getFullYear()}` : dayAt(anchor).toLocaleDateString(void 0, { month: "long", year: "numeric" });
|
|
43196
43206
|
const toolbar = /* @__PURE__ */ (0, import_jsx_runtime143.jsxs)("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
@@ -43845,7 +43855,7 @@ function BoardOptions({
|
|
|
43845
43855
|
)
|
|
43846
43856
|
] }) : null,
|
|
43847
43857
|
toggle("Count per column", "boardCounts", look.boardCounts !== false),
|
|
43848
|
-
toggle("
|
|
43858
|
+
toggle("Color the columns", "boardColorColumns", look.boardColorColumns !== false),
|
|
43849
43859
|
toggle("Hide empty groups", "boardHideEmpty", look.boardHideEmpty === true),
|
|
43850
43860
|
remembered ? null : /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("p", { className: "text-muted-foreground", children: "Kept for this visit only." })
|
|
43851
43861
|
] })
|
|
@@ -44113,7 +44123,7 @@ var CHART_KIND_LABEL = {
|
|
|
44113
44123
|
// (FIX-10C F12, 2026-09-22). The kind key stays `stuck` — it is the store's
|
|
44114
44124
|
// closed set and renaming it would be a second idea of the same shape — but
|
|
44115
44125
|
// the WORD in the picker read "Stuck", which is our jargon for a record that
|
|
44116
|
-
// has sat on one value too long, not a shape anybody
|
|
44126
|
+
// has sat on one value too long, not a shape anybody recognizes beside
|
|
44117
44127
|
// Number, Bars, Columns, Line, Donut and Table. This block lists the records
|
|
44118
44128
|
// that have not moved, so that is what it is called.
|
|
44119
44129
|
stuck: "Not moving"
|
|
@@ -44235,7 +44245,7 @@ var SERIES_COLORS = [
|
|
|
44235
44245
|
"hsl(var(--warning))",
|
|
44236
44246
|
"hsl(var(--destructive))",
|
|
44237
44247
|
"hsl(var(--accent-foreground))",
|
|
44238
|
-
// Slices 7-12: the theme's own chart tokens, so a donut of 8-12 slices never repeats a
|
|
44248
|
+
// Slices 7-12: the theme's own chart tokens, so a donut of 8-12 slices never repeats a color.
|
|
44239
44249
|
"hsl(var(--chart-1))",
|
|
44240
44250
|
"hsl(var(--chart-2))",
|
|
44241
44251
|
"hsl(var(--chart-3))",
|
|
@@ -47913,7 +47923,7 @@ function ArchivedPortals({
|
|
|
47913
47923
|
}
|
|
47914
47924
|
|
|
47915
47925
|
// src/index.ts
|
|
47916
|
-
var
|
|
47926
|
+
var import_design_system182 = require("@ai-matrx/design-system");
|
|
47917
47927
|
|
|
47918
47928
|
// src/ViewBar.tsx
|
|
47919
47929
|
var import_react276 = require("react");
|
|
@@ -49203,7 +49213,7 @@ function ActionInbox({
|
|
|
49203
49213
|
item.summary ? /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { className: "text-xs text-muted-foreground", children: item.summary }) : null,
|
|
49204
49214
|
snoozing === item.item_id ? (
|
|
49205
49215
|
// SUPERHUMAN'S CHOICES, then any moment the person names. The picked time's own Snooze is
|
|
49206
|
-
// absent until a time is picked — never a
|
|
49216
|
+
// absent until a time is picked — never a grayed button that does nothing.
|
|
49207
49217
|
/* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(
|
|
49208
49218
|
"div",
|
|
49209
49219
|
{
|
|
@@ -50241,7 +50251,7 @@ function PortalLookEditor({ card, onSaved, className }) {
|
|
|
50241
50251
|
)
|
|
50242
50252
|
] }),
|
|
50243
50253
|
/* @__PURE__ */ (0, import_jsx_runtime164.jsxs)("div", { className: "flex flex-col gap-1 text-xs", children: [
|
|
50244
|
-
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)("span", { children: "
|
|
50254
|
+
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)("span", { children: "Color" }),
|
|
50245
50255
|
/* @__PURE__ */ (0, import_jsx_runtime164.jsx)(AccentSwatches, { value: accent, onChange: setAccent, options: card.accents })
|
|
50246
50256
|
] }),
|
|
50247
50257
|
/* @__PURE__ */ (0, import_jsx_runtime164.jsxs)("div", { className: "flex flex-col gap-1 text-xs", children: [
|
|
@@ -51244,7 +51254,7 @@ function DigestScheduler({
|
|
|
51244
51254
|
// Tables this person can already open — never a grant on the table behind it.
|
|
51245
51255
|
client.views({ table_id: tableId }),
|
|
51246
51256
|
// The cadences are ASKED, never typed into this file, so a picker can
|
|
51247
|
-
// never offer a cadence the digest runner does not
|
|
51257
|
+
// never offer a cadence the digest runner does not honor.
|
|
51248
51258
|
client.subscriptionCadences()
|
|
51249
51259
|
]);
|
|
51250
51260
|
if (!saved.ok) setError(saved.error);
|
|
@@ -51346,11 +51356,11 @@ function DigestScheduler({
|
|
|
51346
51356
|
)
|
|
51347
51357
|
] }),
|
|
51348
51358
|
savedViewId ? null : /* @__PURE__ */ (0, import_jsx_runtime167.jsxs)("label", { className: "flex flex-col gap-1", children: [
|
|
51349
|
-
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_design_system143.Label, { className: "text-xs font-medium", children: "What it
|
|
51359
|
+
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_design_system143.Label, { className: "text-xs font-medium", children: "What it summarizes" }),
|
|
51350
51360
|
/* @__PURE__ */ (0, import_jsx_runtime167.jsx)(
|
|
51351
51361
|
import_controls9.Select,
|
|
51352
51362
|
{
|
|
51353
|
-
"aria-label": "What it
|
|
51363
|
+
"aria-label": "What it summarizes",
|
|
51354
51364
|
value: viewId,
|
|
51355
51365
|
onValueChange: setViewId,
|
|
51356
51366
|
options: [
|
|
@@ -52652,7 +52662,7 @@ function FormStage({
|
|
|
52652
52662
|
{
|
|
52653
52663
|
className: (0, import_design_system147.cn)(
|
|
52654
52664
|
"mx-auto flex w-full max-w-2xl flex-col gap-4 py-4",
|
|
52655
|
-
// TYPEFORM'S SIZE (TYPEFORM-2): one question at a time fills the screen,
|
|
52665
|
+
// TYPEFORM'S SIZE (TYPEFORM-2): one question at a time fills the screen, centerd in it.
|
|
52656
52666
|
oneAtATime && "min-h-[min(70dvh,640px)]",
|
|
52657
52667
|
theme.surface,
|
|
52658
52668
|
theme.background !== "plain" && "rounded-lg px-5 sm:px-8",
|
|
@@ -52881,7 +52891,7 @@ function Question({
|
|
|
52881
52891
|
),
|
|
52882
52892
|
uploadError ? /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(RefusalLine, { error: uploadError }) : null
|
|
52883
52893
|
] }) : (
|
|
52884
|
-
// A choice is laid out as lettered rows in the form's
|
|
52894
|
+
// A choice is laid out as lettered rows in the form's color (`ChoiceAnswer`).
|
|
52885
52895
|
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)(FieldControl, { field: field2, value, onChange, id, asForm: true, onChosen })
|
|
52886
52896
|
),
|
|
52887
52897
|
/* @__PURE__ */ (0, import_jsx_runtime171.jsx)("p", { id: sayId, role: "alert", "aria-live": "assertive", className: "min-h-0 empty:hidden", "data-records-form-refused": "", children: refused ? /* @__PURE__ */ (0, import_jsx_runtime171.jsxs)("span", { className: "inline-flex items-center gap-1.5 rounded bg-destructive px-2 py-1 text-sm font-medium text-destructive-foreground", children: [
|
|
@@ -53443,7 +53453,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
53443
53453
|
AccentSwatches,
|
|
53444
53454
|
{
|
|
53445
53455
|
value: draft.look?.accent ?? "",
|
|
53446
|
-
noneLabel: "Organization
|
|
53456
|
+
noneLabel: "Organization color",
|
|
53447
53457
|
onChange: (accent) => patchLook({ accent: accent || null })
|
|
53448
53458
|
}
|
|
53449
53459
|
),
|
|
@@ -58212,7 +58222,7 @@ function InterfaceScreen({
|
|
|
58212
58222
|
/* @__PURE__ */ (0, import_jsx_runtime183.jsx)(
|
|
58213
58223
|
PickOne,
|
|
58214
58224
|
{
|
|
58215
|
-
label: "
|
|
58225
|
+
label: "Color",
|
|
58216
58226
|
value: shape.color,
|
|
58217
58227
|
options: INTERFACE_COLORS.map((c) => ({ value: c, label: c[0].toUpperCase() + c.slice(1) })),
|
|
58218
58228
|
onChange: (color) => void save({ ...shape, color }),
|
|
@@ -62995,20 +63005,327 @@ function PreviewForms({ preview, booking }) {
|
|
|
62995
63005
|
}
|
|
62996
63006
|
|
|
62997
63007
|
// src/SectionCard.tsx
|
|
62998
|
-
var
|
|
63008
|
+
var import_react360 = require("react");
|
|
62999
63009
|
var import_field_kinds9 = require("@ai-matrx/records/field-kinds");
|
|
63000
|
-
var
|
|
63001
|
-
var
|
|
63002
|
-
var
|
|
63010
|
+
var import_react361 = require("@ai-matrx/records/react");
|
|
63011
|
+
var import_design_system181 = require("@ai-matrx/design-system");
|
|
63012
|
+
var import_icons3 = require("@ai-matrx/design-system/icons");
|
|
63003
63013
|
var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
|
|
63004
63014
|
init_names();
|
|
63005
63015
|
init_plainWords();
|
|
63006
|
-
|
|
63016
|
+
|
|
63017
|
+
// src/EntitySectionCard.tsx
|
|
63018
|
+
var import_react358 = require("react");
|
|
63019
|
+
var import_react359 = require("@ai-matrx/records/react");
|
|
63020
|
+
var import_design_system180 = require("@ai-matrx/design-system");
|
|
63021
|
+
var import_icons2 = require("@ai-matrx/design-system/icons");
|
|
63022
|
+
|
|
63023
|
+
// src/sectionKeys.ts
|
|
63007
63024
|
var NAME_KEYS4 = ["name", "title", "token", "label"];
|
|
63008
63025
|
var GROUP_KEYS = ["group", "set", "section", "category"];
|
|
63009
63026
|
var NOTE_KEYS = ["usage_note", "note", "notes", "usage"];
|
|
63010
|
-
|
|
63027
|
+
|
|
63028
|
+
// src/EntitySectionCard.tsx
|
|
63029
|
+
var import_jsx_runtime206 = require("react/jsx-runtime");
|
|
63030
|
+
var SECTION_PAGE = 200;
|
|
63031
|
+
var BOOKKEEPING = /* @__PURE__ */ new Set(["id", "organization_id", "created_by", "updated_by", "created_at", "updated_at", "version", "metadata", "test_run_id", "test_expires_at"]);
|
|
63011
63032
|
var UNGROUPED = "";
|
|
63033
|
+
var NATURAL = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
|
|
63034
|
+
function entitySectionColumns(columns, props, filter) {
|
|
63035
|
+
const pinned = new Set(Object.keys(filter ?? {}));
|
|
63036
|
+
const live = columns.filter((c) => c.origin === "custom" || !BOOKKEEPING.has(c.key) && !pinned.has(c.key));
|
|
63037
|
+
const byKey = (key) => key ? live.find((c) => c.key === key) : void 0;
|
|
63038
|
+
const firstOf = (keys) => keys.map((k) => byKey(k)).find((c) => c !== void 0);
|
|
63039
|
+
const name = byKey(props.nameField) ?? firstOf(NAME_KEYS4) ?? live.find((c) => c.title) ?? entityNameColumn(live) ?? void 0;
|
|
63040
|
+
const group = props.groupBy === null ? void 0 : byKey(props.groupBy) ?? firstOf(GROUP_KEYS);
|
|
63041
|
+
const note = props.noteField === null ? void 0 : byKey(props.noteField) ?? firstOf(NOTE_KEYS);
|
|
63042
|
+
const taken = new Set([name?.key, group?.key, note?.key].filter(Boolean));
|
|
63043
|
+
const values = props.valueFields ? props.valueFields.map((k) => byKey(k)).filter((c) => c !== void 0) : live.filter((c) => !taken.has(c.key));
|
|
63044
|
+
return { name, group, note, values };
|
|
63045
|
+
}
|
|
63046
|
+
function textOf(row, column) {
|
|
63047
|
+
return column ? entityValueText(column, entityCellValue(row, column)) : "";
|
|
63048
|
+
}
|
|
63049
|
+
function entitySectionGroups(rows, name, group) {
|
|
63050
|
+
const ordered = [...rows].sort((a, b) => {
|
|
63051
|
+
const x = textOf(a, name);
|
|
63052
|
+
const y = textOf(b, name);
|
|
63053
|
+
if (x === "" || y === "") return x === "" ? y === "" ? 0 : 1 : -1;
|
|
63054
|
+
return NATURAL.compare(x, y);
|
|
63055
|
+
});
|
|
63056
|
+
if (!group) return [{ key: UNGROUPED, rows: ordered }];
|
|
63057
|
+
const map = /* @__PURE__ */ new Map();
|
|
63058
|
+
for (const row of ordered) {
|
|
63059
|
+
const key = textOf(row, group);
|
|
63060
|
+
const held = map.get(key);
|
|
63061
|
+
if (held) held.push(row);
|
|
63062
|
+
else map.set(key, [row]);
|
|
63063
|
+
}
|
|
63064
|
+
return [...map.entries()].map(([key, r]) => ({ key, rows: r })).sort((a, b) => (a.key === UNGROUPED ? -1 : 0) - (b.key === UNGROUPED ? -1 : 0));
|
|
63065
|
+
}
|
|
63066
|
+
function editKindOf(column) {
|
|
63067
|
+
if (column.readOnly) return null;
|
|
63068
|
+
if (column.type === "choice") return column.choices && column.choices.length > 0 ? "choice" : null;
|
|
63069
|
+
if (column.linksTo && column.linksTo.length > 0) return null;
|
|
63070
|
+
if (column.type === "boolean" || column.type === "checkbox") return "boolean";
|
|
63071
|
+
if (column.type === "number" || column.type === "integer") return "number";
|
|
63072
|
+
if (column.type === "date") return "date";
|
|
63073
|
+
if (column.type === "text") return "text";
|
|
63074
|
+
return null;
|
|
63075
|
+
}
|
|
63076
|
+
function draftValue(kind2, draft) {
|
|
63077
|
+
if (draft.trim() === "") return null;
|
|
63078
|
+
if (kind2 === "number") {
|
|
63079
|
+
const n = Number(draft);
|
|
63080
|
+
return Number.isFinite(n) ? n : draft;
|
|
63081
|
+
}
|
|
63082
|
+
return draft;
|
|
63083
|
+
}
|
|
63084
|
+
function storedDraft(kind2, row, column) {
|
|
63085
|
+
const v = entityCellValue(row, column);
|
|
63086
|
+
if (v === null || v === void 0) return "";
|
|
63087
|
+
if (kind2 === "date" && typeof v === "string") return v.slice(0, 10);
|
|
63088
|
+
if (kind2 === "number" && typeof v === "number") return String(v);
|
|
63089
|
+
return entityValueText(column, v);
|
|
63090
|
+
}
|
|
63091
|
+
function EntityValueCell({ row, column, editable, save }) {
|
|
63092
|
+
const kind2 = editable ? editKindOf(column) : null;
|
|
63093
|
+
const stored = storedDraft(kind2, row, column);
|
|
63094
|
+
const [draft, setDraft] = (0, import_react358.useState)(stored);
|
|
63095
|
+
const [seen, setSeen] = (0, import_react358.useState)(stored);
|
|
63096
|
+
if (seen !== stored) {
|
|
63097
|
+
setSeen(stored);
|
|
63098
|
+
setDraft(stored);
|
|
63099
|
+
}
|
|
63100
|
+
if (kind2 === null) {
|
|
63101
|
+
const words2 = textOf(row, column);
|
|
63102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { className: (0, import_design_system180.cn)("block truncate text-sm", words2 ? "text-foreground" : "text-muted-foreground"), children: words2 || "\u2013" });
|
|
63103
|
+
}
|
|
63104
|
+
const label = `${column.label}`;
|
|
63105
|
+
if (kind2 === "choice") {
|
|
63106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(
|
|
63107
|
+
import_design_system180.Select,
|
|
63108
|
+
{
|
|
63109
|
+
value: draft === "" ? "__none" : draft,
|
|
63110
|
+
onValueChange: async (v) => {
|
|
63111
|
+
const next = v === "__none" ? "" : v;
|
|
63112
|
+
setDraft(next);
|
|
63113
|
+
if (!await save(column, next === "" ? null : next)) setDraft(stored);
|
|
63114
|
+
},
|
|
63115
|
+
children: [
|
|
63116
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectTrigger, { "aria-label": label, children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectValue, {}) }),
|
|
63117
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.SelectContent, { children: [
|
|
63118
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: "__none", children: "None" }),
|
|
63119
|
+
(column.choices ?? []).map((w) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: w, children: w }, w))
|
|
63120
|
+
] })
|
|
63121
|
+
]
|
|
63122
|
+
}
|
|
63123
|
+
);
|
|
63124
|
+
}
|
|
63125
|
+
if (kind2 === "boolean") {
|
|
63126
|
+
const on = entityCellValue(row, column) === true;
|
|
63127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Checkbox, { "aria-label": label, checked: on, onCheckedChange: (next) => void save(column, next === true) });
|
|
63128
|
+
}
|
|
63129
|
+
const commit = async () => {
|
|
63130
|
+
if (draft === stored) return;
|
|
63131
|
+
if (!await save(column, draftValue(kind2, draft))) setDraft(stored);
|
|
63132
|
+
};
|
|
63133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
|
|
63134
|
+
import_design_system180.BasicInput,
|
|
63135
|
+
{
|
|
63136
|
+
"aria-label": label,
|
|
63137
|
+
type: kind2 === "number" ? "number" : kind2 === "date" ? "date" : "text",
|
|
63138
|
+
value: draft,
|
|
63139
|
+
onChange: (e) => setDraft(e.target.value),
|
|
63140
|
+
onBlur: () => void commit(),
|
|
63141
|
+
onKeyDown: (e) => {
|
|
63142
|
+
if (e.key === "Enter") e.target.blur();
|
|
63143
|
+
if (e.key === "Escape") setDraft(stored);
|
|
63144
|
+
}
|
|
63145
|
+
}
|
|
63146
|
+
);
|
|
63147
|
+
}
|
|
63148
|
+
function EntityAddDialog({
|
|
63149
|
+
open,
|
|
63150
|
+
onOpenChange,
|
|
63151
|
+
noun,
|
|
63152
|
+
name,
|
|
63153
|
+
group,
|
|
63154
|
+
values,
|
|
63155
|
+
groups,
|
|
63156
|
+
startGroup,
|
|
63157
|
+
onAdd
|
|
63158
|
+
}) {
|
|
63159
|
+
const writable = values.filter((c) => editKindOf(c) !== null && editKindOf(c) !== "boolean");
|
|
63160
|
+
const [data, setData] = (0, import_react358.useState)({});
|
|
63161
|
+
const [chosen, setChosen] = (0, import_react358.useState)(startGroup);
|
|
63162
|
+
const [busy, setBusy] = (0, import_react358.useState)(false);
|
|
63163
|
+
const [seenOpen, setSeenOpen] = (0, import_react358.useState)(open);
|
|
63164
|
+
if (seenOpen !== open) {
|
|
63165
|
+
setSeenOpen(open);
|
|
63166
|
+
if (open) {
|
|
63167
|
+
setData({});
|
|
63168
|
+
setChosen(startGroup);
|
|
63169
|
+
}
|
|
63170
|
+
}
|
|
63171
|
+
const nameWritable = name && editKindOf(name) !== null;
|
|
63172
|
+
const ready = !busy && (!nameWritable || (data[name.key] ?? "").trim() !== "");
|
|
63173
|
+
const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
|
|
63174
|
+
const labelCls = "pt-2 text-sm text-muted-foreground";
|
|
63175
|
+
const fields = [...nameWritable ? [name] : [], ...writable.filter((c) => c.key !== name?.key && c.key !== group?.key)];
|
|
63176
|
+
const groupWritable = group && editKindOf(group) === "choice";
|
|
63177
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.DialogContent, { className: "max-w-md", children: [
|
|
63178
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.DialogTitle, { children: [
|
|
63179
|
+
"New ",
|
|
63180
|
+
noun
|
|
63181
|
+
] }) }),
|
|
63182
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(
|
|
63183
|
+
"form",
|
|
63184
|
+
{
|
|
63185
|
+
className: "flex flex-col gap-3",
|
|
63186
|
+
onSubmit: async (e) => {
|
|
63187
|
+
e.preventDefault();
|
|
63188
|
+
if (!ready) return;
|
|
63189
|
+
setBusy(true);
|
|
63190
|
+
const out = {};
|
|
63191
|
+
for (const c of fields) {
|
|
63192
|
+
const v = draftValue(editKindOf(c), data[c.key] ?? "");
|
|
63193
|
+
if (v !== null) out[c.key] = v;
|
|
63194
|
+
}
|
|
63195
|
+
if (group && groupWritable && chosen !== UNGROUPED) out[group.key] = chosen;
|
|
63196
|
+
const ok = await onAdd(out);
|
|
63197
|
+
setBusy(false);
|
|
63198
|
+
if (ok) onOpenChange(false);
|
|
63199
|
+
},
|
|
63200
|
+
children: [
|
|
63201
|
+
group && groupWritable ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { className: rowCls, children: [
|
|
63202
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { className: labelCls, children: group.label }),
|
|
63203
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.Select, { value: chosen === UNGROUPED ? "__none" : chosen, onValueChange: (v) => setChosen(v === "__none" ? UNGROUPED : v), children: [
|
|
63204
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectTrigger, { "aria-label": group.label, children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectValue, {}) }),
|
|
63205
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.SelectContent, { children: [
|
|
63206
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: "__none", children: "None" }),
|
|
63207
|
+
[.../* @__PURE__ */ new Set([...group.choices ?? [], ...groups.filter((g) => g !== UNGROUPED)])].map((g) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: g, children: g }, g))
|
|
63208
|
+
] })
|
|
63209
|
+
] })
|
|
63210
|
+
] }) : null,
|
|
63211
|
+
fields.map((c) => {
|
|
63212
|
+
const kind2 = editKindOf(c);
|
|
63213
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { className: rowCls, children: [
|
|
63214
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("label", { htmlFor: `entity-section-add-${c.key}`, className: labelCls, children: c.label }),
|
|
63215
|
+
kind2 === "choice" ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.Select, { value: data[c.key] || "__none", onValueChange: (v) => setData((d) => ({ ...d, [c.key]: v === "__none" ? "" : v })), children: [
|
|
63216
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectTrigger, { id: `entity-section-add-${c.key}`, "aria-label": c.label, children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectValue, {}) }),
|
|
63217
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.SelectContent, { children: [
|
|
63218
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: "__none", children: "None" }),
|
|
63219
|
+
(c.choices ?? []).map((w) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.SelectItem, { value: w, children: w }, w))
|
|
63220
|
+
] })
|
|
63221
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
|
|
63222
|
+
import_design_system180.BasicInput,
|
|
63223
|
+
{
|
|
63224
|
+
id: `entity-section-add-${c.key}`,
|
|
63225
|
+
type: kind2 === "number" ? "number" : kind2 === "date" ? "date" : "text",
|
|
63226
|
+
value: data[c.key] ?? "",
|
|
63227
|
+
onChange: (e) => setData((d) => ({ ...d, [c.key]: e.target.value }))
|
|
63228
|
+
}
|
|
63229
|
+
)
|
|
63230
|
+
] }, c.key);
|
|
63231
|
+
}),
|
|
63232
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
63233
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
63234
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Button, { type: "submit", disabled: !ready, children: "Add" })
|
|
63235
|
+
] })
|
|
63236
|
+
]
|
|
63237
|
+
}
|
|
63238
|
+
)
|
|
63239
|
+
] }) });
|
|
63240
|
+
}
|
|
63241
|
+
function EntitySectionCard(props) {
|
|
63242
|
+
if (!(0, import_react359.useOptionalRecordsClient)()) {
|
|
63243
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("section", { "data-records-section-card": "", className: (0, import_design_system180.cn)("rounded-2xl border border-border bg-card px-5 py-5 text-sm text-muted-foreground sm:px-6", props.className), children: "This section cannot be shown here: the page has no connection to the data." });
|
|
63244
|
+
}
|
|
63245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(EntityDataScope, { children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(EntitySectionBody, { ...props }) });
|
|
63246
|
+
}
|
|
63247
|
+
function EntitySectionBody(props) {
|
|
63248
|
+
const { source, readOnly, noun = "entry", className } = props;
|
|
63249
|
+
const entity = useEntitySourceTable(source.token, { pageSize: SECTION_PAGE, filter: source.filter ?? null });
|
|
63250
|
+
const cols = entitySectionColumns(entity.columns, props, source.filter);
|
|
63251
|
+
const groups = entitySectionGroups(entity.rows, cols.name, cols.group);
|
|
63252
|
+
const mayWrite = !readOnly && entity.canUpdate;
|
|
63253
|
+
const mayAdd = !readOnly && entity.creatable;
|
|
63254
|
+
const [adding, setAdding] = (0, import_react358.useState)(null);
|
|
63255
|
+
const [failed, setFailed] = (0, import_react358.useState)(null);
|
|
63256
|
+
const title = props.title ?? entity.label ?? "";
|
|
63257
|
+
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(cols.values.length + (cols.note ? 1 : 0), 1)}, minmax(0, 1fr))` };
|
|
63258
|
+
const shownValues = cols.note ? [...cols.values, cols.note] : cols.values;
|
|
63259
|
+
const save = (row) => async (column, value) => {
|
|
63260
|
+
const said2 = await entity.update(String(row._id), column, value);
|
|
63261
|
+
setFailed(said2);
|
|
63262
|
+
return said2 === null;
|
|
63263
|
+
};
|
|
63264
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("section", { "data-records-section-card": "", "data-records-section-source": source.token, className: (0, import_design_system180.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|
|
63265
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("header", { className: "flex items-start justify-between gap-4 px-5 pt-5 pb-3 sm:px-6", children: [
|
|
63266
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { className: "min-w-0", children: [
|
|
63267
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("h2", { className: "truncate font-serif text-2xl tracking-tight text-foreground", children: title || " " }),
|
|
63268
|
+
props.description ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("p", { className: "mt-1 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
|
|
63269
|
+
] }),
|
|
63270
|
+
mayAdd ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(import_design_system180.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED), children: [
|
|
63271
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_icons2.PlusIcon, { className: "h-3.5 w-3.5" }),
|
|
63272
|
+
"Add"
|
|
63273
|
+
] }) : null
|
|
63274
|
+
] }),
|
|
63275
|
+
entity.error ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: entity.error }) : entity.loading && entity.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("div", { className: "flex flex-col gap-1.5 px-5 pb-5 sm:px-6", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("div", { className: "h-9 rounded-md bg-muted" }, i)) }) : entity.rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("div", { className: "-mb-px overflow-x-auto", children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { "data-records-section-group": group.key, children: [
|
|
63276
|
+
cols.group ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { className: "flex items-center justify-between border-y border-border px-5 py-1 sm:px-6", children: [
|
|
63277
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { className: "text-xs font-semibold text-foreground", children: group.key || "No group" }),
|
|
63278
|
+
mayAdd ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Button, { type: "button", variant: "ghost", size: "sm", "aria-label": `Add to ${group.key || "no group"}`, onClick: () => setAdding(group.key), children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_icons2.PlusIcon, { className: "h-4 w-4" }) }) : null
|
|
63279
|
+
] }) : null,
|
|
63280
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { role: "table", "aria-label": group.key || title, className: "min-w-[36rem]", children: [
|
|
63281
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { role: "row", style: gridStyle, className: "grid border-b border-border text-xs text-muted-foreground", children: [
|
|
63282
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { role: "columnheader", className: "border-r border-border px-5 py-1.5 sm:px-6", children: cols.name?.label ?? "Name" }),
|
|
63283
|
+
shownValues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { role: "columnheader", className: "truncate px-3 py-1.5", children: c.label }, c.key))
|
|
63284
|
+
] }),
|
|
63285
|
+
group.rows.map((row) => {
|
|
63286
|
+
const rowSave = save(row);
|
|
63287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("div", { role: "row", "data-records-section-row": String(row._id), style: gridStyle, className: "grid items-center border-b border-border", children: [
|
|
63288
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { role: "cell", className: "min-w-0 self-stretch border-r border-border px-5 py-1.5 sm:px-6", children: cols.name && mayWrite && editKindOf(cols.name) !== null ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(EntityValueCell, { row, column: cols.name, editable: true, save: rowSave }) : /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("span", { className: "block truncate font-mono text-sm text-foreground", children: textOf(row, cols.name) || String(row._id) }) }),
|
|
63289
|
+
shownValues.map((c) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("div", { role: "cell", className: "min-w-0 px-3 py-1", children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(EntityValueCell, { row, column: c, editable: mayWrite, save: rowSave }) }, c.key))
|
|
63290
|
+
] }, String(row._id));
|
|
63291
|
+
})
|
|
63292
|
+
] })
|
|
63293
|
+
] }, group.key || "__ungrouped")) }),
|
|
63294
|
+
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)("p", { className: "px-5 py-2 text-sm text-muted-foreground sm:px-6", children: [
|
|
63295
|
+
`Showing ${entity.rows.length} of ${entity.total ?? "more"} \xB7 `,
|
|
63296
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Button, { type: "button", variant: "ghost", size: "sm", disabled: entity.loadingMore, onClick: entity.loadMore, children: "Show more" })
|
|
63297
|
+
] }) : null,
|
|
63298
|
+
entity.newer > 0 ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("p", { className: "px-5 py-2 text-sm text-muted-foreground sm:px-6", children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(import_design_system180.Button, { type: "button", variant: "ghost", size: "sm", onClick: entity.refresh, children: `${entity.newer.toLocaleString()} new` }) }) : null,
|
|
63299
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime206.jsx)("p", { role: "alert", className: "px-5 py-2 text-sm text-warning-ink sm:px-6", children: failed }) : null,
|
|
63300
|
+
/* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
|
|
63301
|
+
EntityAddDialog,
|
|
63302
|
+
{
|
|
63303
|
+
open: adding !== null,
|
|
63304
|
+
onOpenChange: (open) => !open && setAdding(null),
|
|
63305
|
+
noun,
|
|
63306
|
+
name: cols.name,
|
|
63307
|
+
group: cols.group,
|
|
63308
|
+
values: cols.values,
|
|
63309
|
+
groups: groups.map((g) => g.key),
|
|
63310
|
+
startGroup: adding ?? UNGROUPED,
|
|
63311
|
+
onAdd: async (values) => {
|
|
63312
|
+
const made = await entity.create(values);
|
|
63313
|
+
if ("refused" in made) {
|
|
63314
|
+
setFailed(made.refused);
|
|
63315
|
+
return false;
|
|
63316
|
+
}
|
|
63317
|
+
setFailed(null);
|
|
63318
|
+
return true;
|
|
63319
|
+
}
|
|
63320
|
+
}
|
|
63321
|
+
)
|
|
63322
|
+
] });
|
|
63323
|
+
}
|
|
63324
|
+
|
|
63325
|
+
// src/SectionCard.tsx
|
|
63326
|
+
var import_jsx_runtime207 = require("react/jsx-runtime");
|
|
63327
|
+
var SAVE_AFTER_MS = 500;
|
|
63328
|
+
var UNGROUPED2 = "";
|
|
63012
63329
|
function findKey(fields, wanted) {
|
|
63013
63330
|
for (const key of wanted) if (fields.some((f) => f.key === key)) return key;
|
|
63014
63331
|
return void 0;
|
|
@@ -63023,7 +63340,7 @@ function sectionColumns(fields, titleField, props) {
|
|
|
63023
63340
|
const values = props.valueFields ? props.valueFields.map((k) => live.find((f) => f.key === k)).filter((f) => f !== void 0 && f.key !== readsOn) : live.filter((f) => !taken.has(f.key));
|
|
63024
63341
|
return { name, group, note, readsOn, values };
|
|
63025
63342
|
}
|
|
63026
|
-
var
|
|
63343
|
+
var NATURAL2 = new Intl.Collator(void 0, { numeric: true, sensitivity: "base" });
|
|
63027
63344
|
function orderedRows(rows, nameKey) {
|
|
63028
63345
|
if (!nameKey) return [...rows];
|
|
63029
63346
|
const nameOf3 = (r) => String((r.document ?? {})[nameKey] ?? "");
|
|
@@ -63031,20 +63348,20 @@ function orderedRows(rows, nameKey) {
|
|
|
63031
63348
|
const x = nameOf3(a);
|
|
63032
63349
|
const y = nameOf3(b);
|
|
63033
63350
|
if (x === "" || y === "") return x === "" ? y === "" ? 0 : 1 : -1;
|
|
63034
|
-
return
|
|
63351
|
+
return NATURAL2.compare(x, y);
|
|
63035
63352
|
});
|
|
63036
63353
|
}
|
|
63037
63354
|
function sectionGroups(rows, groupKey) {
|
|
63038
|
-
if (!groupKey) return [{ key:
|
|
63355
|
+
if (!groupKey) return [{ key: UNGROUPED2, rows: [...rows] }];
|
|
63039
63356
|
const map = /* @__PURE__ */ new Map();
|
|
63040
63357
|
for (const row of rows) {
|
|
63041
63358
|
const raw = (row.document ?? {})[groupKey];
|
|
63042
|
-
const key = raw === null || raw === void 0 ?
|
|
63359
|
+
const key = raw === null || raw === void 0 ? UNGROUPED2 : String(raw);
|
|
63043
63360
|
const held = map.get(key);
|
|
63044
63361
|
if (held) held.push(row);
|
|
63045
63362
|
else map.set(key, [row]);
|
|
63046
63363
|
}
|
|
63047
|
-
return [...map.entries()].map(([key, r]) => ({ key, rows: r })).sort((a, b) => (a.key ===
|
|
63364
|
+
return [...map.entries()].map(([key, r]) => ({ key, rows: r })).sort((a, b) => (a.key === UNGROUPED2 ? -1 : 0) - (b.key === UNGROUPED2 ? -1 : 0));
|
|
63048
63365
|
}
|
|
63049
63366
|
function columnsOf(values) {
|
|
63050
63367
|
const out = [];
|
|
@@ -63059,12 +63376,12 @@ function columnsOf(values) {
|
|
|
63059
63376
|
}
|
|
63060
63377
|
var same4 = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
|
|
63061
63378
|
function useDraft(stored, save) {
|
|
63062
|
-
const [draft, setDraft] = (0,
|
|
63063
|
-
const latest = (0,
|
|
63064
|
-
(0,
|
|
63379
|
+
const [draft, setDraft] = (0, import_react360.useState)(null);
|
|
63380
|
+
const latest = (0, import_react360.useRef)({ draft, save, stored });
|
|
63381
|
+
(0, import_react360.useEffect)(() => {
|
|
63065
63382
|
latest.current = { draft, save, stored };
|
|
63066
63383
|
});
|
|
63067
|
-
(0,
|
|
63384
|
+
(0, import_react360.useEffect)(() => {
|
|
63068
63385
|
if (!draft || draft.phase !== "typing") return;
|
|
63069
63386
|
const timer = setTimeout(() => {
|
|
63070
63387
|
const sending = draft.value;
|
|
@@ -63076,7 +63393,7 @@ function useDraft(stored, save) {
|
|
|
63076
63393
|
}, SAVE_AFTER_MS);
|
|
63077
63394
|
return () => clearTimeout(timer);
|
|
63078
63395
|
}, [draft]);
|
|
63079
|
-
(0,
|
|
63396
|
+
(0, import_react360.useEffect)(
|
|
63080
63397
|
() => () => {
|
|
63081
63398
|
const held = latest.current;
|
|
63082
63399
|
if (held.draft && held.draft.phase === "typing") void held.save(held.draft.value);
|
|
@@ -63088,9 +63405,9 @@ function useDraft(stored, save) {
|
|
|
63088
63405
|
}
|
|
63089
63406
|
function ChecksLine({ checks, onFix }) {
|
|
63090
63407
|
if (checks.length === 0) return null;
|
|
63091
|
-
return /* @__PURE__ */ (0,
|
|
63092
|
-
/* @__PURE__ */ (0,
|
|
63093
|
-
check.fix && onFix ? /* @__PURE__ */ (0,
|
|
63408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mt-1 flex flex-col items-start gap-1", children: checks.map((check, i) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "flex flex-col items-start gap-1", children: [
|
|
63409
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
|
|
63410
|
+
check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-xs", onClick: () => onFix(check), children: check.fix.label }) : null
|
|
63094
63411
|
] }, i)) });
|
|
63095
63412
|
}
|
|
63096
63413
|
function ValueCell({
|
|
@@ -63108,16 +63425,16 @@ function ValueCell({
|
|
|
63108
63425
|
const fix = onFix ? (check) => onFix({ check, row, field: field2 }) : void 0;
|
|
63109
63426
|
const id = `section-${row.id}-${field2.key}`;
|
|
63110
63427
|
const withheld = row.hidden?.[field2.key] ?? null;
|
|
63111
|
-
if (withheld) return /* @__PURE__ */ (0,
|
|
63428
|
+
if (withheld) return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(RecordValue, { field: field2, value: null, withheld });
|
|
63112
63429
|
if (format?.id === "color_pair") {
|
|
63113
63430
|
const pair = (0, import_field_formats12.readColorPair)(value) ?? null;
|
|
63114
63431
|
const contrast = pair ? colorPairContrast(pair, format, context) : {};
|
|
63115
|
-
return /* @__PURE__ */ (0,
|
|
63432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63116
63433
|
const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
|
|
63117
63434
|
const ratio = contrast[part];
|
|
63118
|
-
return /* @__PURE__ */ (0,
|
|
63119
|
-
/* @__PURE__ */ (0,
|
|
63120
|
-
editable ? /* @__PURE__ */ (0,
|
|
63435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0 px-3", children: [
|
|
63436
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
63437
|
+
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63121
63438
|
ColorWell,
|
|
63122
63439
|
{
|
|
63123
63440
|
id: `${id}-${part}`,
|
|
@@ -63131,10 +63448,10 @@ function ValueCell({
|
|
|
63131
63448
|
change(updated.light ? JSON.stringify(updated) : null);
|
|
63132
63449
|
}
|
|
63133
63450
|
}
|
|
63134
|
-
) : /* @__PURE__ */ (0,
|
|
63135
|
-
ratio !== void 0 ? /* @__PURE__ */ (0,
|
|
63451
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
|
|
63452
|
+
ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ContrastMark, { ratio }) : null
|
|
63136
63453
|
] }),
|
|
63137
|
-
/* @__PURE__ */ (0,
|
|
63454
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
|
|
63138
63455
|
] }, part);
|
|
63139
63456
|
}) });
|
|
63140
63457
|
}
|
|
@@ -63143,16 +63460,16 @@ function ValueCell({
|
|
|
63143
63460
|
const ownDark = typeof value === "string" && value.includes('"dark"');
|
|
63144
63461
|
const pack = (l) => l.length === 1 ? l[0] : { layers: l };
|
|
63145
63462
|
const write = (light, dark) => change(JSON.stringify(dark ? { light: pack(light), dark: pack(dark) } : pack(light)));
|
|
63146
|
-
return /* @__PURE__ */ (0,
|
|
63463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63147
63464
|
const layers = pair ? pair[part] : null;
|
|
63148
63465
|
const words2 = !layers ? "Set" : part === "dark" && !ownDark ? "Same as light" : (0, import_field_formats12.shadowWords)(layers);
|
|
63149
|
-
const inner2 = /* @__PURE__ */ (0,
|
|
63150
|
-
layers ? /* @__PURE__ */ (0,
|
|
63151
|
-
/* @__PURE__ */ (0,
|
|
63466
|
+
const inner2 = /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
63467
|
+
layers ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ShadowSwatch, { layers, theme: part }) : null,
|
|
63468
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: (0, import_design_system181.cn)("truncate text-xs", part === "dark" && !ownDark ? "text-muted-foreground" : "text-foreground"), children: words2 })
|
|
63152
63469
|
] });
|
|
63153
|
-
return /* @__PURE__ */ (0,
|
|
63154
|
-
/* @__PURE__ */ (0,
|
|
63155
|
-
/* @__PURE__ */ (0,
|
|
63470
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "min-w-0 px-3", children: editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63471
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("button", { type: "button", "aria-label": `${fieldName(field2)} ${part}`, className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: inner2 }) }),
|
|
63472
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "start", className: "w-80", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63156
63473
|
ShadowLayersEditor,
|
|
63157
63474
|
{
|
|
63158
63475
|
layers: layers ?? [{ x: 0, y: 4, blur: 12, spread: 0, color: "#0000001f" }],
|
|
@@ -63168,21 +63485,21 @@ function ValueCell({
|
|
|
63168
63485
|
const pictureFirst = format?.id === "type_style" || format?.id === "motion";
|
|
63169
63486
|
if (look && pictureFirst) {
|
|
63170
63487
|
const { Editor, Preview: Preview2 } = look;
|
|
63171
|
-
const view = /* @__PURE__ */ (0,
|
|
63172
|
-
return /* @__PURE__ */ (0,
|
|
63173
|
-
editable && Editor ? /* @__PURE__ */ (0,
|
|
63174
|
-
/* @__PURE__ */ (0,
|
|
63175
|
-
/* @__PURE__ */ (0,
|
|
63176
|
-
Preview2 ? /* @__PURE__ */ (0,
|
|
63177
|
-
Editor ? /* @__PURE__ */ (0,
|
|
63488
|
+
const view = /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(RecordValue, { field: field2, value, withheld: null });
|
|
63489
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0", children: [
|
|
63490
|
+
editable && Editor ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63491
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("button", { type: "button", className: "block w-full min-w-0 rounded-md px-1 py-0.5 text-left hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: value === null || value === void 0 || value === "" ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-muted-foreground", children: "Set" }) : view }) }),
|
|
63492
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.PopoverContent, { align: "start", className: "w-80", children: [
|
|
63493
|
+
Preview2 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(Preview2, { value, format }) }) : null,
|
|
63494
|
+
Editor ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(Editor, { value, format, onChange: change, id, label: fieldName(field2) }) : null
|
|
63178
63495
|
] })
|
|
63179
63496
|
] }) : view,
|
|
63180
|
-
/* @__PURE__ */ (0,
|
|
63497
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ChecksLine, { checks, onFix: fix })
|
|
63181
63498
|
] });
|
|
63182
63499
|
}
|
|
63183
|
-
return /* @__PURE__ */ (0,
|
|
63184
|
-
editable ? /* @__PURE__ */ (0,
|
|
63185
|
-
/* @__PURE__ */ (0,
|
|
63500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0", children: [
|
|
63501
|
+
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(FieldControl, { field: field2, value, onChange: change, id, recordId: row.id }) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(RecordValue, { field: field2, value, withheld: null }),
|
|
63502
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ChecksLine, { checks, onFix: fix })
|
|
63186
63503
|
] });
|
|
63187
63504
|
}
|
|
63188
63505
|
var NOTHING2 = "__nothing";
|
|
@@ -63197,20 +63514,20 @@ function ReadsOnPicker({
|
|
|
63197
63514
|
const stored = (row.document ?? {})[field2.key];
|
|
63198
63515
|
const [value, change] = useDraft(stored, (next) => save(field2, next));
|
|
63199
63516
|
const on = typeof value === "string" && value.trim() !== "" ? value : null;
|
|
63200
|
-
const said2 = problem ? /* @__PURE__ */ (0,
|
|
63201
|
-
if (!editable) return on ? /* @__PURE__ */ (0,
|
|
63202
|
-
/* @__PURE__ */ (0,
|
|
63517
|
+
const said2 = problem ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "block truncate text-xs text-warning-ink", "data-records-reads-on-problem": problem, children: READS_ON_PROBLEM_WORDS[problem] }) : null;
|
|
63518
|
+
if (!editable) return on ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_jsx_runtime207.Fragment, { children: [
|
|
63519
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "block truncate text-xs text-muted-foreground", children: [
|
|
63203
63520
|
"on ",
|
|
63204
63521
|
on
|
|
63205
63522
|
] }),
|
|
63206
63523
|
said2
|
|
63207
63524
|
] }) : null;
|
|
63208
|
-
return /* @__PURE__ */ (0,
|
|
63209
|
-
/* @__PURE__ */ (0,
|
|
63210
|
-
/* @__PURE__ */ (0,
|
|
63211
|
-
/* @__PURE__ */ (0,
|
|
63212
|
-
/* @__PURE__ */ (0,
|
|
63213
|
-
names2.map((n) => /* @__PURE__ */ (0,
|
|
63525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_jsx_runtime207.Fragment, { children: [
|
|
63526
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Select, { value: on ?? NOTHING2, onValueChange: (v) => change(v === NOTHING2 ? null : v), children: [
|
|
63527
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectTrigger, { "aria-label": `${fieldName(field2)} for this row`, className: "mt-1 h-6 w-auto max-w-full gap-1 border-0 bg-transparent px-0 text-xs text-muted-foreground shadow-none", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "truncate", children: on ? `on ${on}` : "on nothing" }) }),
|
|
63528
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.SelectContent, { children: [
|
|
63529
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectItem, { value: NOTHING2, children: "Nothing" }),
|
|
63530
|
+
names2.map((n) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectItem, { value: n, children: n }, n))
|
|
63214
63531
|
] })
|
|
63215
63532
|
] }),
|
|
63216
63533
|
said2
|
|
@@ -63221,7 +63538,7 @@ var READS_ON_PROBLEM_WORDS = {
|
|
|
63221
63538
|
missing: "no row by that name",
|
|
63222
63539
|
self: "reads on itself",
|
|
63223
63540
|
duplicate: "two rows share that name",
|
|
63224
|
-
"no-colour": "that row has no
|
|
63541
|
+
"no-colour": "that row has no color"
|
|
63225
63542
|
};
|
|
63226
63543
|
function resolveReadsOn(row, rows, keys) {
|
|
63227
63544
|
if (!keys.readsOn || !keys.name) return { on: null, problem: null, target: null };
|
|
@@ -63245,24 +63562,24 @@ function groundOf(row, rows, keys) {
|
|
|
63245
63562
|
return pair ? { ground: { light: pair.light, dark: pair.dark ?? pair.light, label: on } } : { ground: null };
|
|
63246
63563
|
}
|
|
63247
63564
|
function RowComments({ tableId, row, count, onClosed }) {
|
|
63248
|
-
return /* @__PURE__ */ (0,
|
|
63249
|
-
/* @__PURE__ */ (0,
|
|
63565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { onOpenChange: (open) => !open && onClosed(), children: [
|
|
63566
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(
|
|
63250
63567
|
"button",
|
|
63251
63568
|
{
|
|
63252
63569
|
type: "button",
|
|
63253
63570
|
"aria-label": count > 0 ? `${count} open comment${count === 1 ? "" : "s"}` : "Comment",
|
|
63254
63571
|
"data-records-row-comments": count,
|
|
63255
|
-
className: (0,
|
|
63572
|
+
className: (0, import_design_system181.cn)(
|
|
63256
63573
|
"inline-flex h-7 min-w-7 items-center justify-center gap-0.5 rounded-md px-1 hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63257
63574
|
count > 0 ? "text-foreground" : "text-muted-foreground"
|
|
63258
63575
|
),
|
|
63259
63576
|
children: [
|
|
63260
|
-
/* @__PURE__ */ (0,
|
|
63261
|
-
count > 0 ? /* @__PURE__ */ (0,
|
|
63577
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.MessageSquareIcon, { className: "h-3.5 w-3.5" }),
|
|
63578
|
+
count > 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs tabular-nums", children: count }) : null
|
|
63262
63579
|
]
|
|
63263
63580
|
}
|
|
63264
63581
|
) }),
|
|
63265
|
-
/* @__PURE__ */ (0,
|
|
63582
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "end", className: "w-96 p-0", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(CommentThread, { tableId, recordId: row.id, className: "max-h-[70dvh] overflow-y-auto p-3" }) })
|
|
63266
63583
|
] });
|
|
63267
63584
|
}
|
|
63268
63585
|
function NoteButton({ row, noteField, editable, save }) {
|
|
@@ -63270,22 +63587,22 @@ function NoteButton({ row, noteField, editable, save }) {
|
|
|
63270
63587
|
const [value, change] = useDraft(stored, (next) => save(noteField, next));
|
|
63271
63588
|
const text = typeof value === "string" ? value : "";
|
|
63272
63589
|
const has = text.trim() !== "";
|
|
63273
|
-
return /* @__PURE__ */ (0,
|
|
63274
|
-
/* @__PURE__ */ (0,
|
|
63590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63591
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63275
63592
|
"button",
|
|
63276
63593
|
{
|
|
63277
63594
|
type: "button",
|
|
63278
63595
|
"aria-label": has ? `${fieldName(noteField)}: ${text}` : `Add ${fieldName(noteField).toLowerCase()}`,
|
|
63279
63596
|
title: has ? text : fieldName(noteField),
|
|
63280
|
-
className: (0,
|
|
63597
|
+
className: (0, import_design_system181.cn)(
|
|
63281
63598
|
"inline-flex h-7 w-7 items-center justify-center rounded-md hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63282
63599
|
has ? "text-foreground" : "text-muted-foreground"
|
|
63283
63600
|
),
|
|
63284
|
-
children: /* @__PURE__ */ (0,
|
|
63601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.StickyNoteIcon, { className: "h-4 w-4" })
|
|
63285
63602
|
}
|
|
63286
63603
|
) }),
|
|
63287
|
-
/* @__PURE__ */ (0,
|
|
63288
|
-
|
|
63604
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63605
|
+
import_design_system181.BasicTextarea,
|
|
63289
63606
|
{
|
|
63290
63607
|
"aria-label": fieldName(noteField),
|
|
63291
63608
|
rows: 4,
|
|
@@ -63318,13 +63635,13 @@ function AddDialog({
|
|
|
63318
63635
|
}
|
|
63319
63636
|
return out;
|
|
63320
63637
|
};
|
|
63321
|
-
const [data, setData] = (0,
|
|
63322
|
-
const [name, setName] = (0,
|
|
63323
|
-
const [group, setGroup] = (0,
|
|
63324
|
-
const [newGroup, setNewGroup] = (0,
|
|
63325
|
-
const [note, setNote] = (0,
|
|
63326
|
-
const [busy, setBusy] = (0,
|
|
63327
|
-
const [seenOpen, setSeenOpen] = (0,
|
|
63638
|
+
const [data, setData] = (0, import_react360.useState)(starters);
|
|
63639
|
+
const [name, setName] = (0, import_react360.useState)("");
|
|
63640
|
+
const [group, setGroup] = (0, import_react360.useState)(startGroup);
|
|
63641
|
+
const [newGroup, setNewGroup] = (0, import_react360.useState)("");
|
|
63642
|
+
const [note, setNote] = (0, import_react360.useState)("");
|
|
63643
|
+
const [busy, setBusy] = (0, import_react360.useState)(false);
|
|
63644
|
+
const [seenOpen, setSeenOpen] = (0, import_react360.useState)(open);
|
|
63328
63645
|
if (seenOpen !== open) {
|
|
63329
63646
|
setSeenOpen(open);
|
|
63330
63647
|
if (open) {
|
|
@@ -63342,12 +63659,12 @@ function AddDialog({
|
|
|
63342
63659
|
const ready = !busy && name.trim() !== "" && (!groupField || group !== "__new" || newGroup.trim() !== "");
|
|
63343
63660
|
const rowCls = "grid grid-cols-[6.5rem_1fr] items-start gap-3";
|
|
63344
63661
|
const labelCls = "pt-2 text-sm text-muted-foreground";
|
|
63345
|
-
return /* @__PURE__ */ (0,
|
|
63346
|
-
/* @__PURE__ */ (0,
|
|
63662
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.DialogContent, { className: "max-w-md", children: [
|
|
63663
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.DialogHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.DialogTitle, { children: [
|
|
63347
63664
|
"New ",
|
|
63348
63665
|
noun
|
|
63349
63666
|
] }) }),
|
|
63350
|
-
/* @__PURE__ */ (0,
|
|
63667
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(
|
|
63351
63668
|
"form",
|
|
63352
63669
|
{
|
|
63353
63670
|
className: "flex flex-col gap-3",
|
|
@@ -63356,47 +63673,47 @@ function AddDialog({
|
|
|
63356
63673
|
if (!ready || !nameField) return;
|
|
63357
63674
|
setBusy(true);
|
|
63358
63675
|
const doc = { ...data, [nameField.key]: name.trim() };
|
|
63359
|
-
if (groupField && chosenGroup !==
|
|
63676
|
+
if (groupField && chosenGroup !== UNGROUPED2) doc[groupField.key] = chosenGroup;
|
|
63360
63677
|
if (noteField && note.trim() !== "") doc[noteField.key] = note.trim();
|
|
63361
63678
|
const ok = await onAdd(doc);
|
|
63362
63679
|
setBusy(false);
|
|
63363
63680
|
if (ok) onOpenChange(false);
|
|
63364
63681
|
},
|
|
63365
63682
|
children: [
|
|
63366
|
-
preview ? /* @__PURE__ */ (0,
|
|
63367
|
-
groupField ? /* @__PURE__ */ (0,
|
|
63368
|
-
/* @__PURE__ */ (0,
|
|
63369
|
-
/* @__PURE__ */ (0,
|
|
63370
|
-
/* @__PURE__ */ (0,
|
|
63371
|
-
/* @__PURE__ */ (0,
|
|
63372
|
-
/* @__PURE__ */ (0,
|
|
63373
|
-
/* @__PURE__ */ (0,
|
|
63374
|
-
groups.filter((g) => g !==
|
|
63375
|
-
/* @__PURE__ */ (0,
|
|
63683
|
+
preview ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { children: preview }) : null,
|
|
63684
|
+
groupField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: rowCls, children: [
|
|
63685
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: labelCls, children: fieldName(groupField) }),
|
|
63686
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
63687
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Select, { value: group === UNGROUPED2 ? "__none" : group, onValueChange: (v) => setGroup(v === "__none" ? UNGROUPED2 : v), children: [
|
|
63688
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectTrigger, { "aria-label": fieldName(groupField), children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectValue, {}) }),
|
|
63689
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.SelectContent, { children: [
|
|
63690
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectItem, { value: "__none", children: "None" }),
|
|
63691
|
+
groups.filter((g) => g !== UNGROUPED2).map((g) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.SelectItem, { value: g, children: g }, g)),
|
|
63692
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.SelectItem, { value: "__new", children: [
|
|
63376
63693
|
"New ",
|
|
63377
63694
|
fieldName(groupField).toLowerCase(),
|
|
63378
63695
|
"\u2026"
|
|
63379
63696
|
] })
|
|
63380
63697
|
] })
|
|
63381
63698
|
] }),
|
|
63382
|
-
group === "__new" ? /* @__PURE__ */ (0,
|
|
63699
|
+
group === "__new" ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.BasicInput, { "aria-label": `New ${fieldName(groupField).toLowerCase()} name`, placeholder: "e.g. Display", value: newGroup, onChange: (e) => setNewGroup(e.target.value) }) : null
|
|
63383
63700
|
] })
|
|
63384
63701
|
] }) : null,
|
|
63385
|
-
nameField ? /* @__PURE__ */ (0,
|
|
63386
|
-
/* @__PURE__ */ (0,
|
|
63387
|
-
/* @__PURE__ */ (0,
|
|
63702
|
+
nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: rowCls, children: [
|
|
63703
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("label", { htmlFor: "section-add-name", className: labelCls, children: fieldName(nameField) }),
|
|
63704
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.BasicInput, { id: "section-add-name", className: "font-mono", autoFocus: true, value: name, onChange: (e) => setName(e.target.value) })
|
|
63388
63705
|
] }) : null,
|
|
63389
|
-
values.map((field2) => /* @__PURE__ */ (0,
|
|
63390
|
-
/* @__PURE__ */ (0,
|
|
63391
|
-
/* @__PURE__ */ (0,
|
|
63706
|
+
values.map((field2) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: rowCls, children: [
|
|
63707
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("label", { htmlFor: `section-add-${field2.key}`, className: labelCls, children: fieldName(field2) }),
|
|
63708
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(FieldControl, { field: field2, value: data[field2.key] ?? null, onChange: (v) => setData((d) => ({ ...d, [field2.key]: v })), id: `section-add-${field2.key}`, asForm: true })
|
|
63392
63709
|
] }, field2.key)),
|
|
63393
|
-
noteField ? /* @__PURE__ */ (0,
|
|
63394
|
-
/* @__PURE__ */ (0,
|
|
63395
|
-
/* @__PURE__ */ (0,
|
|
63710
|
+
noteField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: rowCls, children: [
|
|
63711
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("label", { htmlFor: "section-add-note", className: labelCls, children: fieldName(noteField) }),
|
|
63712
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.BasicTextarea, { id: "section-add-note", rows: 2, placeholder: name.trim() ? `When should ${name.trim()} be used?` : "When should it be used?", value: note, onChange: (e) => setNote(e.target.value) })
|
|
63396
63713
|
] }) : null,
|
|
63397
|
-
/* @__PURE__ */ (0,
|
|
63398
|
-
/* @__PURE__ */ (0,
|
|
63399
|
-
/* @__PURE__ */ (0,
|
|
63714
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
63715
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.Button, { type: "button", variant: "ghost", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
63716
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.Button, { type: "submit", disabled: !ready, children: "Add" })
|
|
63400
63717
|
] })
|
|
63401
63718
|
]
|
|
63402
63719
|
}
|
|
@@ -63404,15 +63721,34 @@ function AddDialog({
|
|
|
63404
63721
|
] }) });
|
|
63405
63722
|
}
|
|
63406
63723
|
function SectionCard(props) {
|
|
63724
|
+
if (props.source.kind === "entity") return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(EntitySectionCard, { ...props, source: props.source });
|
|
63725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(TableSectionCard, { ...props, tableId: props.source.id });
|
|
63726
|
+
}
|
|
63727
|
+
var SECTION_NARROW_PX = 576;
|
|
63728
|
+
function useNarrow2(ref) {
|
|
63729
|
+
const [narrow, setNarrow] = (0, import_react360.useState)(false);
|
|
63730
|
+
(0, import_react360.useEffect)(() => {
|
|
63731
|
+
const el = ref.current;
|
|
63732
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
63733
|
+
const ro = new ResizeObserver(() => {
|
|
63734
|
+
const w = el.getBoundingClientRect().width;
|
|
63735
|
+
if (w > 0) setNarrow(w < SECTION_NARROW_PX);
|
|
63736
|
+
});
|
|
63737
|
+
ro.observe(el);
|
|
63738
|
+
return () => ro.disconnect();
|
|
63739
|
+
}, [ref]);
|
|
63740
|
+
return narrow;
|
|
63741
|
+
}
|
|
63742
|
+
function TableSectionCard(props) {
|
|
63407
63743
|
const { tableId, readOnly, noun = "entry", onFix, className } = props;
|
|
63408
|
-
const table = (0,
|
|
63409
|
-
const fieldsRead = (0,
|
|
63744
|
+
const table = (0, import_react361.useTable)(tableId);
|
|
63745
|
+
const fieldsRead = (0, import_react361.useFields)(tableId);
|
|
63410
63746
|
const tableSort = (0, import_first_page3.defaultSortOf)(table.data ?? null, fieldsRead.data ?? []);
|
|
63411
|
-
const page = (0,
|
|
63747
|
+
const page = (0, import_react361.useRecordPage)(fieldsRead.data ? tableId : null, { pageSize: 200, ...tableSort ? { sort: [{ field: tableSort.id, direction: tableSort.direction }] } : {} });
|
|
63412
63748
|
const sortedByStore = tableSort !== null;
|
|
63413
|
-
const mutation = (0,
|
|
63414
|
-
const [adding, setAdding] = (0,
|
|
63415
|
-
const [failed, setFailed] = (0,
|
|
63749
|
+
const mutation = (0, import_react361.useRecordMutation)();
|
|
63750
|
+
const [adding, setAdding] = (0, import_react360.useState)(null);
|
|
63751
|
+
const [failed, setFailed] = (0, import_react360.useState)(null);
|
|
63416
63752
|
const fields = fieldsRead.data ?? [];
|
|
63417
63753
|
const cols = sectionColumns(fields, table.data?.title_field, props);
|
|
63418
63754
|
const nameField = fields.find((f) => f.key === cols.name);
|
|
@@ -63433,11 +63769,11 @@ function SectionCard(props) {
|
|
|
63433
63769
|
};
|
|
63434
63770
|
const cells = columns.filter((c) => c.part !== "dark");
|
|
63435
63771
|
const total = page.data?.total ?? null;
|
|
63436
|
-
const client = (0,
|
|
63437
|
-
const [counts, setCounts] = (0,
|
|
63438
|
-
const [countsAsked, setCountsAsked] = (0,
|
|
63772
|
+
const client = (0, import_react361.useRecordsClient)();
|
|
63773
|
+
const [counts, setCounts] = (0, import_react360.useState)({});
|
|
63774
|
+
const [countsAsked, setCountsAsked] = (0, import_react360.useState)(0);
|
|
63439
63775
|
const idsKey = rows.map((r) => r.id).join(",");
|
|
63440
|
-
(0,
|
|
63776
|
+
(0, import_react360.useEffect)(() => {
|
|
63441
63777
|
if (idsKey === "") return;
|
|
63442
63778
|
let alive = true;
|
|
63443
63779
|
void client.commentCounts({ record_ids: idsKey.split(",") }).then((answered) => {
|
|
@@ -63450,91 +63786,107 @@ function SectionCard(props) {
|
|
|
63450
63786
|
const rowNames = nameField ? rows.map((r) => String((r.document ?? {})[nameField.key] ?? "")).filter((n) => n !== "") : [];
|
|
63451
63787
|
const refused = table.error ?? fieldsRead.error ?? page.error;
|
|
63452
63788
|
const gridStyle = { gridTemplateColumns: `minmax(8rem, 12rem) repeat(${Math.max(columns.length, 1)}, minmax(0, 1fr)) 4.5rem` };
|
|
63453
|
-
|
|
63454
|
-
|
|
63455
|
-
|
|
63456
|
-
|
|
63457
|
-
|
|
63789
|
+
const sectionRef = (0, import_react360.useRef)(null);
|
|
63790
|
+
const narrow = useNarrow2(sectionRef);
|
|
63791
|
+
const cellLabel = (c) => c.part ? columns.filter((x) => x.field.key === c.field.key).map((x) => x.header).join(" \xB7 ") : c.header;
|
|
63792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("section", { ref: sectionRef, "data-records-section-card": "", "data-narrow": narrow ? "" : void 0, className: (0, import_design_system181.cn)("rounded-2xl border border-border bg-card text-card-foreground", className), children: [
|
|
63793
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("header", { className: "flex items-start justify-between gap-4 px-5 pt-5 pb-3 sm:px-6", children: [
|
|
63794
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0", children: [
|
|
63795
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("h2", { className: "truncate font-serif text-2xl tracking-tight text-foreground", children: title || "\xA0" }),
|
|
63796
|
+
props.description ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "mt-1 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
|
|
63458
63797
|
] }),
|
|
63459
|
-
mayWrite && nameField ? /* @__PURE__ */ (0,
|
|
63460
|
-
/* @__PURE__ */ (0,
|
|
63798
|
+
mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Button, { type: "button", variant: "outline", size: "sm", onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED2), children: [
|
|
63799
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-3.5 w-3.5" }),
|
|
63461
63800
|
"Add"
|
|
63462
63801
|
] }) : null
|
|
63463
63802
|
] }),
|
|
63464
|
-
refused ? /* @__PURE__ */ (0,
|
|
63465
|
-
cols.group ? /* @__PURE__ */ (0,
|
|
63466
|
-
/* @__PURE__ */ (0,
|
|
63467
|
-
mayWrite ? /* @__PURE__ */ (0,
|
|
63803
|
+
refused ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: refusalSentence(refused) }) : !fieldsRead.data || page.loading && rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "flex flex-col gap-1.5 px-5 pb-5 sm:px-6", "aria-busy": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "h-9 rounded-md bg-muted" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "px-5 pb-5 text-sm text-muted-foreground sm:px-6", children: "Nothing here yet." }) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: (0, import_design_system181.cn)("-mb-px", !narrow && "overflow-x-auto"), children: groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { "data-records-section-group": group.key, className: "", children: [
|
|
63804
|
+
cols.group ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex items-center justify-between border-y border-border px-5 py-1 sm:px-6", children: [
|
|
63805
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs font-semibold text-foreground", children: group.key || "No group" }),
|
|
63806
|
+
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63468
63807
|
"button",
|
|
63469
63808
|
{
|
|
63470
63809
|
type: "button",
|
|
63471
63810
|
"aria-label": `Add to ${group.key || "no group"}`,
|
|
63472
63811
|
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
63473
63812
|
onClick: () => setAdding(group.key),
|
|
63474
|
-
children: /* @__PURE__ */ (0,
|
|
63813
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-4 w-4" })
|
|
63475
63814
|
}
|
|
63476
63815
|
) : null
|
|
63477
63816
|
] }) : null,
|
|
63478
|
-
/* @__PURE__ */ (0,
|
|
63479
|
-
/* @__PURE__ */ (0,
|
|
63480
|
-
/* @__PURE__ */ (0,
|
|
63481
|
-
columns.map((c) => /* @__PURE__ */ (0,
|
|
63482
|
-
/* @__PURE__ */ (0,
|
|
63817
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { role: "table", "aria-label": group.key || title, className: narrow ? "" : "min-w-[36rem]", children: [
|
|
63818
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { role: "row", style: gridStyle, className: (0, import_design_system181.cn)("grid border-b border-border text-xs text-muted-foreground", narrow && "hidden"), children: [
|
|
63819
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { role: "columnheader", className: "border-r border-border px-5 py-1.5 sm:px-6", children: nameField ? fieldName(nameField) : "Name" }),
|
|
63820
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { role: "columnheader", className: "truncate px-3 py-1.5", children: c.header }, `${c.field.key}-${c.part ?? ""}`)),
|
|
63821
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", {})
|
|
63483
63822
|
] }),
|
|
63484
63823
|
group.rows.map((row) => {
|
|
63485
63824
|
const editable = mayWrite && (0, import_field_kinds9.atLeast)(row.level, "edit_content");
|
|
63486
63825
|
const rowSave = save(row);
|
|
63487
|
-
return /* @__PURE__ */ (0,
|
|
63488
|
-
|
|
63489
|
-
|
|
63490
|
-
|
|
63491
|
-
|
|
63492
|
-
|
|
63493
|
-
|
|
63494
|
-
|
|
63495
|
-
|
|
63496
|
-
|
|
63497
|
-
|
|
63498
|
-
|
|
63499
|
-
|
|
63500
|
-
|
|
63501
|
-
|
|
63502
|
-
|
|
63503
|
-
|
|
63504
|
-
|
|
63505
|
-
|
|
63506
|
-
|
|
63507
|
-
|
|
63508
|
-
|
|
63509
|
-
|
|
63826
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(
|
|
63827
|
+
"div",
|
|
63828
|
+
{
|
|
63829
|
+
role: "row",
|
|
63830
|
+
"data-records-section-row": row.id,
|
|
63831
|
+
style: narrow ? void 0 : gridStyle,
|
|
63832
|
+
className: narrow ? "relative flex flex-col gap-1.5 border-b border-border px-4 py-2.5" : "grid items-center border-b border-border",
|
|
63833
|
+
children: [
|
|
63834
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { role: "cell", className: narrow ? "min-w-0 pr-16" : "min-w-0 self-stretch border-r border-border px-5 py-1.5 sm:px-6", children: [
|
|
63835
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "block truncate font-mono text-sm text-foreground", children: nameField ? String((row.document ?? {})[nameField.key] ?? "") : row.id }),
|
|
63836
|
+
readsOnField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63837
|
+
ReadsOnPicker,
|
|
63838
|
+
{
|
|
63839
|
+
row,
|
|
63840
|
+
field: readsOnField,
|
|
63841
|
+
names: [...new Set(rowNames)].filter((n) => !sameName(n, String((row.document ?? {})[nameField?.key ?? ""] ?? ""))),
|
|
63842
|
+
editable,
|
|
63843
|
+
save: rowSave,
|
|
63844
|
+
problem: resolveReadsOn(row, rows, { name: cols.name, readsOn: cols.readsOn, color: readsOnColorKey }).problem
|
|
63845
|
+
}
|
|
63846
|
+
) : null
|
|
63847
|
+
] }),
|
|
63848
|
+
cells.map((c) => /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(
|
|
63849
|
+
"div",
|
|
63510
63850
|
{
|
|
63511
|
-
|
|
63512
|
-
|
|
63513
|
-
|
|
63514
|
-
|
|
63515
|
-
|
|
63516
|
-
|
|
63517
|
-
|
|
63518
|
-
|
|
63519
|
-
|
|
63520
|
-
|
|
63521
|
-
|
|
63522
|
-
|
|
63523
|
-
|
|
63524
|
-
|
|
63525
|
-
|
|
63526
|
-
|
|
63851
|
+
role: "cell",
|
|
63852
|
+
style: c.part ? { gridColumn: "span 2" } : void 0,
|
|
63853
|
+
className: narrow ? "min-w-0" : (0, import_design_system181.cn)("min-w-0 py-1", c.part ? "" : "px-3"),
|
|
63854
|
+
children: [
|
|
63855
|
+
narrow ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mb-0.5 block text-xs text-muted-foreground", children: cellLabel(c) }) : null,
|
|
63856
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63857
|
+
ValueCell,
|
|
63858
|
+
{
|
|
63859
|
+
row,
|
|
63860
|
+
column: c,
|
|
63861
|
+
editable,
|
|
63862
|
+
save: rowSave,
|
|
63863
|
+
onFix,
|
|
63864
|
+
context: c.field.key === readsOnColorKey ? groundOf(row, rows, { name: cols.name, readsOn: cols.readsOn, color: c.field.key }) : void 0
|
|
63865
|
+
}
|
|
63866
|
+
)
|
|
63867
|
+
]
|
|
63868
|
+
},
|
|
63869
|
+
c.field.key
|
|
63870
|
+
)),
|
|
63871
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { role: "cell", className: narrow ? "absolute right-2 top-2 flex items-center gap-0.5" : "flex items-center justify-end gap-0.5 pr-2", children: [
|
|
63872
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(RowComments, { tableId, row, count: counts[row.id] ?? 0, onClosed: () => setCountsAsked((n) => n + 1) }),
|
|
63873
|
+
noteField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(NoteButton, { row, noteField, editable, save: rowSave }) : null
|
|
63874
|
+
] })
|
|
63875
|
+
]
|
|
63876
|
+
},
|
|
63877
|
+
row.id
|
|
63878
|
+
);
|
|
63527
63879
|
})
|
|
63528
63880
|
] })
|
|
63529
63881
|
] }, group.key || "__ungrouped")) }),
|
|
63530
|
-
total !== null && total > rows.length ? /* @__PURE__ */ (0,
|
|
63882
|
+
total !== null && total > rows.length ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("p", { className: "px-5 py-2 text-sm text-muted-foreground sm:px-6", children: [
|
|
63531
63883
|
"Showing ",
|
|
63532
63884
|
rows.length,
|
|
63533
63885
|
" of ",
|
|
63534
63886
|
total
|
|
63535
63887
|
] }) : null,
|
|
63536
|
-
failed ? /* @__PURE__ */ (0,
|
|
63537
|
-
/* @__PURE__ */ (0,
|
|
63888
|
+
failed ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "px-5 py-2 text-sm text-warning-ink sm:px-6", children: mutation.error ? refusalSentence(mutation.error) : failed }) : null,
|
|
63889
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63538
63890
|
AddDialog,
|
|
63539
63891
|
{
|
|
63540
63892
|
open: adding !== null,
|
|
@@ -63545,7 +63897,7 @@ function SectionCard(props) {
|
|
|
63545
63897
|
noteField,
|
|
63546
63898
|
values: cols.values,
|
|
63547
63899
|
groups: groups.map((g) => g.key),
|
|
63548
|
-
startGroup: adding ??
|
|
63900
|
+
startGroup: adding ?? UNGROUPED2,
|
|
63549
63901
|
onAdd: async (data) => {
|
|
63550
63902
|
const id = await mutation.write({ table_id: tableId, data });
|
|
63551
63903
|
if (id === null) {
|