@ai-matrx/records-ui 0.116.29 → 0.116.31
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 +28 -1
- package/dist/{SaveToTable-P3MPRSCW.js → SaveToTable-4AS5YBRT.js} +2 -2
- package/dist/{chunk-FLIERNH7.js → chunk-4G6EOOKM.js} +17 -5
- package/dist/chunk-4G6EOOKM.js.map +1 -0
- package/dist/{chunk-5EFM2G2O.js → chunk-BQS26T6D.js} +10 -8
- package/dist/chunk-BQS26T6D.js.map +1 -0
- package/dist/index.cjs +182 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +153 -165
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +7 -6
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-5EFM2G2O.js.map +0 -1
- package/dist/chunk-FLIERNH7.js.map +0 -1
- /package/dist/{SaveToTable-P3MPRSCW.js.map → SaveToTable-4AS5YBRT.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -7241,10 +7241,22 @@ function TablesHome({ onOpenTable, organizationName, makingOnly = false, askedBy
|
|
|
7241
7241
|
) }, board.dashboard_id)) })
|
|
7242
7242
|
] }) : null,
|
|
7243
7243
|
!makingOnly && tables.data && !sectionsKnown ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "text-xs text-muted-foreground", children: SECTIONS_UNKNOWN }) : null,
|
|
7244
|
-
!makingOnly && tables.data && keptCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7244
|
+
!makingOnly && tables.data && keptCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-tables-show-everything": showEverything ? "on" : "off", className: "flex items-center text-xs", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
7245
|
+
import_design_system41.Button,
|
|
7246
|
+
{
|
|
7247
|
+
size: "sm",
|
|
7248
|
+
variant: "ghost",
|
|
7249
|
+
className: "h-6 px-2 text-xs",
|
|
7250
|
+
"aria-pressed": showEverything,
|
|
7251
|
+
onClick: () => setShowEverything((on) => !on),
|
|
7252
|
+
children: [
|
|
7253
|
+
showEverything ? "\u2713 " : "",
|
|
7254
|
+
"Include system tables (",
|
|
7255
|
+
keptCount,
|
|
7256
|
+
")"
|
|
7257
|
+
]
|
|
7258
|
+
}
|
|
7259
|
+
) }) : null,
|
|
7248
7260
|
!makingOnly && tables.data ? TABLE_LANES.filter((lane) => lane !== "app" || showEverything).map((lane) => {
|
|
7249
7261
|
const rows = listed.filter(
|
|
7250
7262
|
(t) => lane === "mine" ? laneFor(t) === "mine" || isMine(t) : laneFor(t) === lane
|
|
@@ -9295,8 +9307,8 @@ function colorPairContrast(pair, format, context) {
|
|
|
9295
9307
|
}
|
|
9296
9308
|
return out;
|
|
9297
9309
|
}
|
|
9298
|
-
function ContrastMark({ ratio }) {
|
|
9299
|
-
const level = (0, import_field_formats.contrastLevel)(ratio);
|
|
9310
|
+
function ContrastMark({ ratio, min }) {
|
|
9311
|
+
const level = (0, import_field_formats.contrastLevel)(ratio, min);
|
|
9300
9312
|
const said2 = `${ratio}:1`;
|
|
9301
9313
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
9302
9314
|
"span",
|
|
@@ -9319,12 +9331,12 @@ function ColorPairView({ value, format }) {
|
|
|
9319
9331
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
9320
9332
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Swatch, { color: pair.light }),
|
|
9321
9333
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: "font-mono text-xs uppercase", children: pair.light }),
|
|
9322
|
-
contrast.light !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.light }) : null
|
|
9334
|
+
contrast.light !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.light, min: pair.min }) : null
|
|
9323
9335
|
] }),
|
|
9324
9336
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
9325
9337
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Swatch, { color: pair.dark ?? pair.light }),
|
|
9326
9338
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { className: (0, import_design_system2.cn)("font-mono text-xs uppercase", !pair.dark && "text-muted-foreground"), children: pair.dark ?? "Inherits light" }),
|
|
9327
|
-
contrast.dark !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.dark }) : null
|
|
9339
|
+
contrast.dark !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ContrastMark, { ratio: contrast.dark, min: pair.min }) : null
|
|
9328
9340
|
] })
|
|
9329
9341
|
] });
|
|
9330
9342
|
}
|
|
@@ -9426,14 +9438,15 @@ function colorPairChecks(value, format, context) {
|
|
|
9426
9438
|
const out = [];
|
|
9427
9439
|
for (const part of ["light", "dark"]) {
|
|
9428
9440
|
const ratio = contrast[part];
|
|
9429
|
-
if (ratio === void 0 || (0, import_field_formats.contrastLevel)(ratio) === "pass") continue;
|
|
9441
|
+
if (ratio === void 0 || (0, import_field_formats.contrastLevel)(ratio, pair.min) === "pass") continue;
|
|
9430
9442
|
const color = part === "light" ? pair.light : pair.dark ?? pair.light;
|
|
9443
|
+
const need = pair.min ?? import_field_formats.TEXT_CONTRAST;
|
|
9431
9444
|
out.push({
|
|
9432
9445
|
part,
|
|
9433
9446
|
message: `hard to read on ${ground}`,
|
|
9434
9447
|
fix: {
|
|
9435
9448
|
label: "Fix with AI",
|
|
9436
|
-
ask: `The ${part} color ${color} reads at ${ratio}:1 on ${ground}. Suggest the nearest color that reaches
|
|
9449
|
+
ask: `The ${part} color ${color} reads at ${ratio}:1 on ${ground}. Suggest the nearest color that reaches ${need}:1 and keeps its hue.`
|
|
9437
9450
|
}
|
|
9438
9451
|
});
|
|
9439
9452
|
}
|
|
@@ -29706,10 +29719,7 @@ function EnrichPanel({ tableId, fieldId, className }) {
|
|
|
29706
29719
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "truncate text-muted-foreground", children: preview?.find((p) => p.record_id === w.record_id)?.title ?? w.record_id.slice(0, 8) }),
|
|
29707
29720
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("span", { className: "min-w-0 truncate text-right", children: w.absent ? w.absent === "conflicting" ? "Sources disagree" : "Nothing found" : String(w.value ?? "") })
|
|
29708
29721
|
] }, w.record_id)) }) : null,
|
|
29709
|
-
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ (0, import_jsx_runtime93.
|
|
29710
|
-
outcome.message,
|
|
29711
|
-
costInPoints(outcome.costCents, host.pointsRate) !== null ? ` \xB7 ${costInPoints(outcome.costCents, host.pointsRate)}` : ""
|
|
29712
|
-
] }) : (
|
|
29722
|
+
outcome && (outcome.fieldId === void 0 || outcome.fieldId === row.field_id) ? outcome.ok ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("p", { className: "text-xs text-muted-foreground", "data-testid": "enrich-outcome", children: outcome.message }) : (
|
|
29713
29723
|
// A run that did not happen is a refusal, with a heading and a remedy,
|
|
29714
29724
|
// never the host's words in red (lane REFUSAL-SWEEP).
|
|
29715
29725
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
@@ -41424,7 +41434,7 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
41424
41434
|
// src/workedOutDate.ts
|
|
41425
41435
|
var import_records55 = require("@ai-matrx/records");
|
|
41426
41436
|
var WORKED_OUT_DATE_LOCK = "Worked out \xB7 can't move";
|
|
41427
|
-
var
|
|
41437
|
+
var FORMULA_TYPING_ROUNDS = 9;
|
|
41428
41438
|
var configOf = (field2) => field2?.config ?? {};
|
|
41429
41439
|
function isStoredDate(field2) {
|
|
41430
41440
|
if (!field2 || field2.type !== "range") return false;
|
|
@@ -41438,27 +41448,36 @@ function ownExpression(field2) {
|
|
|
41438
41448
|
const expr = config["expr"];
|
|
41439
41449
|
return !("via" in config) && expr && typeof expr === "object" && !Array.isArray(expr) ? expr : null;
|
|
41440
41450
|
}
|
|
41441
|
-
function
|
|
41442
|
-
if (
|
|
41443
|
-
|
|
41444
|
-
if ("
|
|
41445
|
-
|
|
41446
|
-
|
|
41447
|
-
|
|
41448
|
-
|
|
41449
|
-
|
|
41450
|
-
|
|
41451
|
+
function typedAs(field2, kind2) {
|
|
41452
|
+
if (kind2 === "date") return { ...field2, type: "range", config: { kind: "date", _typed: true } };
|
|
41453
|
+
if (kind2 === "number") return { ...field2, type: "range", config: { _typed: true } };
|
|
41454
|
+
if (kind2 === "text") return { ...field2, type: "text" };
|
|
41455
|
+
if (kind2 === "boolean") return { ...field2, type: "boolean" };
|
|
41456
|
+
return field2;
|
|
41457
|
+
}
|
|
41458
|
+
var typedRounds = /* @__PURE__ */ new WeakMap();
|
|
41459
|
+
function typedFormulaFields(all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
41460
|
+
let byRounds = typedRounds.get(all);
|
|
41461
|
+
const hit = byRounds?.get(rounds);
|
|
41462
|
+
if (hit) return hit;
|
|
41463
|
+
let cur = all;
|
|
41464
|
+
for (let i = 0; i < rounds; i++) {
|
|
41465
|
+
const prev = cur;
|
|
41466
|
+
cur = all.map((f) => {
|
|
41467
|
+
const expr = ownExpression(f);
|
|
41468
|
+
return expr ? typedAs(f, formulaResultKind(expr, prev)) : f;
|
|
41469
|
+
});
|
|
41451
41470
|
}
|
|
41452
|
-
if (
|
|
41453
|
-
|
|
41454
|
-
|
|
41455
|
-
const r = inlineFormulas(a, all, seen);
|
|
41456
|
-
if (r === null) return null;
|
|
41457
|
-
args.push(r);
|
|
41458
|
-
}
|
|
41459
|
-
return { ...n, args };
|
|
41471
|
+
if (!byRounds) {
|
|
41472
|
+
byRounds = /* @__PURE__ */ new Map();
|
|
41473
|
+
typedRounds.set(all, byRounds);
|
|
41460
41474
|
}
|
|
41461
|
-
|
|
41475
|
+
byRounds.set(rounds, cur);
|
|
41476
|
+
return cur;
|
|
41477
|
+
}
|
|
41478
|
+
function formulaTypeOf(targetId, all, rounds = FORMULA_TYPING_ROUNDS) {
|
|
41479
|
+
const expr = ownExpression(all.find((f) => f.id === targetId));
|
|
41480
|
+
return expr ? formulaResultKind(expr, typedFormulaFields(all, rounds)) : "unknown";
|
|
41462
41481
|
}
|
|
41463
41482
|
function formulaResultKind(node, all) {
|
|
41464
41483
|
if (!node || typeof node !== "object" || Array.isArray(node)) return "unknown";
|
|
@@ -41497,10 +41516,7 @@ function formulaResultKind(node, all) {
|
|
|
41497
41516
|
return import_records55.FORMULA_NODE_RESULTS[op2] ?? "unknown";
|
|
41498
41517
|
}
|
|
41499
41518
|
function isDateFormula(field2, all) {
|
|
41500
|
-
|
|
41501
|
-
if (!expr || !field2) return false;
|
|
41502
|
-
const inlined = inlineFormulas(expr, all, [field2.id]);
|
|
41503
|
-
return inlined !== null && formulaResultKind(inlined, all) === "date";
|
|
41519
|
+
return !!field2 && formulaTypeOf(field2.id, all) === "date";
|
|
41504
41520
|
}
|
|
41505
41521
|
function isComputedField(field2) {
|
|
41506
41522
|
return field2?.type === "formula";
|
|
@@ -44176,16 +44192,81 @@ function ListRow({
|
|
|
44176
44192
|
);
|
|
44177
44193
|
}
|
|
44178
44194
|
|
|
44195
|
+
// src/pivot.ts
|
|
44196
|
+
var import_records56 = require("@ai-matrx/records");
|
|
44197
|
+
var PIVOT_OPS = ["count", "sum", "avg", "min", "max"];
|
|
44198
|
+
var isPivotOp = (v) => PIVOT_OPS.includes(v ?? "");
|
|
44199
|
+
var PIVOT_OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Min", max: "Max" };
|
|
44200
|
+
var PIVOT_CELL_LIMIT = 1e3;
|
|
44201
|
+
var NUMBER_TYPES = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage", "range"]);
|
|
44202
|
+
var isNumberField = (f) => {
|
|
44203
|
+
if (!NUMBER_TYPES.has(String(f.type))) return false;
|
|
44204
|
+
const kind2 = String((f.config ?? {})["kind"] ?? "number");
|
|
44205
|
+
return kind2 !== "date" && kind2 !== "datetime";
|
|
44206
|
+
};
|
|
44207
|
+
function pivotQuestion(view, fields) {
|
|
44208
|
+
const has = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
44209
|
+
const rowKey = has(view.groupField);
|
|
44210
|
+
const colKey = has(view.columnField) !== rowKey ? has(view.columnField) : null;
|
|
44211
|
+
const op2 = isPivotOp(view.pivotMeasure) ? view.pivotMeasure : "count";
|
|
44212
|
+
const field2 = view.measure ? fields.find((f) => f.key === view.measure && isNumberField(f)) : void 0;
|
|
44213
|
+
const fellBack = op2 !== "count" && !field2;
|
|
44214
|
+
const measure = op2 !== "count" && field2 ? { op: op2, key: field2.key } : { op: "count" };
|
|
44215
|
+
return { rowKey, colKey, op: fellBack ? "count" : op2, measure, fellBack };
|
|
44216
|
+
}
|
|
44217
|
+
var NONE3 = "\0none";
|
|
44218
|
+
function groupId(value) {
|
|
44219
|
+
return value === null || value === void 0 || value === "" ? NONE3 : String(value);
|
|
44220
|
+
}
|
|
44221
|
+
function byValue(a, b) {
|
|
44222
|
+
if (a.id === NONE3 || b.id === NONE3) return a.id === b.id ? 0 : a.id === NONE3 ? 1 : -1;
|
|
44223
|
+
const x = typeof a.value === "number" ? a.value : null;
|
|
44224
|
+
const y = typeof b.value === "number" ? b.value : null;
|
|
44225
|
+
if (x !== null && y !== null) return x - y;
|
|
44226
|
+
return a.label.localeCompare(b.label, void 0, { numeric: true, sensitivity: "base" });
|
|
44227
|
+
}
|
|
44228
|
+
function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
|
|
44229
|
+
const m = (0, import_records56.measureKey)(q.measure);
|
|
44230
|
+
const read = (r) => r ? { value: typeof r.measures?.[m] === "number" ? r.measures[m] : null, n: r.row_count } : null;
|
|
44231
|
+
const axis = (key, sources) => {
|
|
44232
|
+
if (!key) return [{ id: NONE3, value: null, label: "" }];
|
|
44233
|
+
const seen = /* @__PURE__ */ new Map();
|
|
44234
|
+
for (const rows2 of sources)
|
|
44235
|
+
for (const r of rows2) {
|
|
44236
|
+
const raw = r.groups?.[key];
|
|
44237
|
+
const id = groupId(raw);
|
|
44238
|
+
if (!seen.has(id)) seen.set(id, { id, value: id === NONE3 ? null : raw, label: id === NONE3 ? "\u2014" : label(key, raw) });
|
|
44239
|
+
}
|
|
44240
|
+
return [...seen.values()].sort(byValue);
|
|
44241
|
+
};
|
|
44242
|
+
const rows = axis(q.rowKey, [answers2.rowTotals, answers2.cells]);
|
|
44243
|
+
const cols = axis(q.colKey, [answers2.colTotals, answers2.cells]);
|
|
44244
|
+
const cellAt = /* @__PURE__ */ new Map();
|
|
44245
|
+
for (const r of answers2.cells) cellAt.set(`${groupId(q.rowKey ? r.groups?.[q.rowKey] : null)}${groupId(q.colKey ? r.groups?.[q.colKey] : null)}`, r);
|
|
44246
|
+
const rowAt = new Map(answers2.rowTotals.map((r) => [groupId(q.rowKey ? r.groups?.[q.rowKey] : null), r]));
|
|
44247
|
+
const colAt = new Map(answers2.colTotals.map((r) => [groupId(q.colKey ? r.groups?.[q.colKey] : null), r]));
|
|
44248
|
+
return {
|
|
44249
|
+
rows,
|
|
44250
|
+
cols,
|
|
44251
|
+
// With no row Field every cell is the one row; with no column Field, the one column.
|
|
44252
|
+
cell: (rowId, colId) => read(cellAt.get(`${rowId}${colId}`)),
|
|
44253
|
+
rowTotal: (rowId) => read(rowAt.get(rowId)),
|
|
44254
|
+
colTotal: (colId) => read(colAt.get(colId)),
|
|
44255
|
+
grand: read(answers2.grand[0]),
|
|
44256
|
+
cut: answers2.cells.length >= limit
|
|
44257
|
+
};
|
|
44258
|
+
}
|
|
44259
|
+
|
|
44179
44260
|
// src/ChartLayout.tsx
|
|
44180
44261
|
var import_react263 = require("react");
|
|
44181
44262
|
var import_react264 = require("@ai-matrx/records/react");
|
|
44182
|
-
var
|
|
44263
|
+
var import_records58 = require("@ai-matrx/records");
|
|
44183
44264
|
var import_design_system127 = require("@ai-matrx/design-system");
|
|
44184
44265
|
|
|
44185
44266
|
// src/ChartBlock.tsx
|
|
44186
44267
|
var import_react262 = require("react");
|
|
44187
44268
|
var import_recharts = require("recharts");
|
|
44188
|
-
var
|
|
44269
|
+
var import_records57 = require("@ai-matrx/records");
|
|
44189
44270
|
var import_core21 = require("@ai-matrx/records/core");
|
|
44190
44271
|
var import_design_system126 = require("@ai-matrx/design-system");
|
|
44191
44272
|
var import_format11 = require("@ai-matrx/kit/format");
|
|
@@ -44766,7 +44847,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
44766
44847
|
const kind2 = shape ? BASE_KIND_OF_SHAPE[shape] : block.kind;
|
|
44767
44848
|
const tableId = block.table_id ?? subject;
|
|
44768
44849
|
const measures = block.measures && block.measures.length > 0 ? block.measures : [{ op: "count" }];
|
|
44769
|
-
const primary = (0,
|
|
44850
|
+
const primary = (0, import_records57.measureKey)(measures[0]);
|
|
44770
44851
|
const windows = kind2 === "stuck" ? null : block.compare ?? null;
|
|
44771
44852
|
const compared = !!windows;
|
|
44772
44853
|
const grain = block.bucket?.by ?? null;
|
|
@@ -44776,7 +44857,7 @@ function ChartBlock({ block, subject, tableName: tableName2, className, centerVa
|
|
|
44776
44857
|
const measureFields = useMeasureFields(primary, source ? void 0 : tableId);
|
|
44777
44858
|
const measureName = useMeasureWords(primary, tableId);
|
|
44778
44859
|
const numberFormat = (0, import_react262.useMemo)(() => source ? null : chartFormatFor(primary, measureFields), [source, primary, measureFields]);
|
|
44779
|
-
const yKey = drawn === "scatter" && measures[1] ? (0,
|
|
44860
|
+
const yKey = drawn === "scatter" && measures[1] ? (0, import_records57.measureKey)(measures[1]) : null;
|
|
44780
44861
|
const yName = useMeasureWords(yKey ?? primary, tableId);
|
|
44781
44862
|
const points = (0, import_react262.useMemo)(() => {
|
|
44782
44863
|
if (kind2 === "stuck") return [];
|
|
@@ -45490,13 +45571,12 @@ var import_jsx_runtime151 = require("react/jsx-runtime");
|
|
|
45490
45571
|
var KIND_LABEL = { bar: "Bars", line: "Line", area: "Area", donut: "Donut", pie: "Pie", stacked: "Stacked bars", scatter: "Scatter" };
|
|
45491
45572
|
var BASE_SHAPES = ["bar", "line", "donut"];
|
|
45492
45573
|
var MEASURE_LABEL2 = { count: "Count", sum: "Sum", avg: "Average" };
|
|
45493
|
-
var NUMBER_TYPES = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage"]);
|
|
45494
45574
|
var DATE_TYPES = /* @__PURE__ */ new Set(["date", "datetime", "timestamp"]);
|
|
45495
45575
|
var isChartKind = (v) => Object.prototype.hasOwnProperty.call(KIND_LABEL, v ?? "");
|
|
45496
45576
|
var isChartMeasure = (v) => v === "count" || v === "sum" || v === "avg";
|
|
45497
45577
|
function defaultChartGroup(fields) {
|
|
45498
45578
|
return fields.find((f) => {
|
|
45499
|
-
const kind2 = (0,
|
|
45579
|
+
const kind2 = (0, import_records58.fieldKindFor)(f);
|
|
45500
45580
|
return kind2 === "select" || kind2 === "multi_select";
|
|
45501
45581
|
})?.key ?? null;
|
|
45502
45582
|
}
|
|
@@ -45548,7 +45628,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
45548
45628
|
return;
|
|
45549
45629
|
}
|
|
45550
45630
|
const wholeRow = overall && overall.ok ? (overall.data ?? [])[0] : void 0;
|
|
45551
|
-
const wholeValue = wholeRow ? wholeRow.measures[(0,
|
|
45631
|
+
const wholeValue = wholeRow ? wholeRow.measures[(0, import_records58.measureKey)(question.measure)] : void 0;
|
|
45552
45632
|
setState({
|
|
45553
45633
|
error: null,
|
|
45554
45634
|
...question.kind === "donut" ? { total: typeof wholeValue === "number" ? wholeValue : null } : {},
|
|
@@ -45568,8 +45648,8 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
|
|
|
45568
45648
|
};
|
|
45569
45649
|
}, [client, view.subject, view.name, qKey, filterKey]);
|
|
45570
45650
|
const groupable = fields.filter((f) => !["attachment", "file", "formula", "button"].includes(String(f.type)));
|
|
45571
|
-
const numeric = fields.filter(
|
|
45572
|
-
const pickMeasure = (0,
|
|
45651
|
+
const numeric = fields.filter(isNumberField);
|
|
45652
|
+
const pickMeasure = (0, import_records58.measureKey)(q.measure);
|
|
45573
45653
|
const dataLabels = view.presentation?.chartLabels === true;
|
|
45574
45654
|
const legend = view.presentation?.chartLegend !== false;
|
|
45575
45655
|
const setLook = (patch) => onChange({ presentation: { ...view.presentation, ...patch } });
|
|
@@ -45636,69 +45716,6 @@ var import_design_system128 = require("@ai-matrx/design-system");
|
|
|
45636
45716
|
var import_skeleton2 = require("@ai-matrx/design-system/skeleton");
|
|
45637
45717
|
init_host();
|
|
45638
45718
|
init_names();
|
|
45639
|
-
|
|
45640
|
-
// src/pivot.ts
|
|
45641
|
-
var import_records58 = require("@ai-matrx/records");
|
|
45642
|
-
var PIVOT_OPS = ["count", "sum", "avg", "min", "max"];
|
|
45643
|
-
var isPivotOp = (v) => PIVOT_OPS.includes(v ?? "");
|
|
45644
|
-
var PIVOT_OP_LABEL = { count: "Count", sum: "Sum", avg: "Average", min: "Min", max: "Max" };
|
|
45645
|
-
var PIVOT_CELL_LIMIT = 1e3;
|
|
45646
|
-
var NUMBER_TYPES2 = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage"]);
|
|
45647
|
-
var isNumberField = (f) => NUMBER_TYPES2.has(String(f.type));
|
|
45648
|
-
function pivotQuestion(view, fields) {
|
|
45649
|
-
const has = (key) => key && fields.some((f) => f.key === key) ? key : null;
|
|
45650
|
-
const rowKey = has(view.groupField);
|
|
45651
|
-
const colKey = has(view.columnField) !== rowKey ? has(view.columnField) : null;
|
|
45652
|
-
const op2 = isPivotOp(view.pivotMeasure) ? view.pivotMeasure : "count";
|
|
45653
|
-
const field2 = view.measure ? fields.find((f) => f.key === view.measure && isNumberField(f)) : void 0;
|
|
45654
|
-
const fellBack = op2 !== "count" && !field2;
|
|
45655
|
-
const measure = op2 !== "count" && field2 ? { op: op2, key: field2.key } : { op: "count" };
|
|
45656
|
-
return { rowKey, colKey, op: fellBack ? "count" : op2, measure, fellBack };
|
|
45657
|
-
}
|
|
45658
|
-
var NONE3 = "\0none";
|
|
45659
|
-
function groupId(value) {
|
|
45660
|
-
return value === null || value === void 0 || value === "" ? NONE3 : String(value);
|
|
45661
|
-
}
|
|
45662
|
-
function byValue(a, b) {
|
|
45663
|
-
if (a.id === NONE3 || b.id === NONE3) return a.id === b.id ? 0 : a.id === NONE3 ? 1 : -1;
|
|
45664
|
-
const x = typeof a.value === "number" ? a.value : null;
|
|
45665
|
-
const y = typeof b.value === "number" ? b.value : null;
|
|
45666
|
-
if (x !== null && y !== null) return x - y;
|
|
45667
|
-
return a.label.localeCompare(b.label, void 0, { numeric: true, sensitivity: "base" });
|
|
45668
|
-
}
|
|
45669
|
-
function pivotTable(q, answers2, label, limit = PIVOT_CELL_LIMIT) {
|
|
45670
|
-
const m = (0, import_records58.measureKey)(q.measure);
|
|
45671
|
-
const read = (r) => r ? { value: typeof r.measures?.[m] === "number" ? r.measures[m] : null, n: r.row_count } : null;
|
|
45672
|
-
const axis = (key, sources) => {
|
|
45673
|
-
if (!key) return [{ id: NONE3, value: null, label: "" }];
|
|
45674
|
-
const seen = /* @__PURE__ */ new Map();
|
|
45675
|
-
for (const rows2 of sources)
|
|
45676
|
-
for (const r of rows2) {
|
|
45677
|
-
const raw = r.groups?.[key];
|
|
45678
|
-
const id = groupId(raw);
|
|
45679
|
-
if (!seen.has(id)) seen.set(id, { id, value: id === NONE3 ? null : raw, label: id === NONE3 ? "\u2014" : label(key, raw) });
|
|
45680
|
-
}
|
|
45681
|
-
return [...seen.values()].sort(byValue);
|
|
45682
|
-
};
|
|
45683
|
-
const rows = axis(q.rowKey, [answers2.rowTotals, answers2.cells]);
|
|
45684
|
-
const cols = axis(q.colKey, [answers2.colTotals, answers2.cells]);
|
|
45685
|
-
const cellAt = /* @__PURE__ */ new Map();
|
|
45686
|
-
for (const r of answers2.cells) cellAt.set(`${groupId(q.rowKey ? r.groups?.[q.rowKey] : null)}${groupId(q.colKey ? r.groups?.[q.colKey] : null)}`, r);
|
|
45687
|
-
const rowAt = new Map(answers2.rowTotals.map((r) => [groupId(q.rowKey ? r.groups?.[q.rowKey] : null), r]));
|
|
45688
|
-
const colAt = new Map(answers2.colTotals.map((r) => [groupId(q.colKey ? r.groups?.[q.colKey] : null), r]));
|
|
45689
|
-
return {
|
|
45690
|
-
rows,
|
|
45691
|
-
cols,
|
|
45692
|
-
// With no row Field every cell is the one row; with no column Field, the one column.
|
|
45693
|
-
cell: (rowId, colId) => read(cellAt.get(`${rowId}${colId}`)),
|
|
45694
|
-
rowTotal: (rowId) => read(rowAt.get(rowId)),
|
|
45695
|
-
colTotal: (colId) => read(colAt.get(colId)),
|
|
45696
|
-
grand: read(answers2.grand[0]),
|
|
45697
|
-
cut: answers2.cells.length >= limit
|
|
45698
|
-
};
|
|
45699
|
-
}
|
|
45700
|
-
|
|
45701
|
-
// src/PivotLayout.tsx
|
|
45702
45719
|
init_Refusal();
|
|
45703
45720
|
var import_jsx_runtime152 = require("react/jsx-runtime");
|
|
45704
45721
|
var PIVOT_BOX = "min-h-[16rem]";
|
|
@@ -45883,9 +45900,9 @@ var import_design_system129 = require("@ai-matrx/design-system");
|
|
|
45883
45900
|
init_host();
|
|
45884
45901
|
|
|
45885
45902
|
// src/mapPins.ts
|
|
45886
|
-
var
|
|
45903
|
+
var NUMBER_TYPES2 = /* @__PURE__ */ new Set(["number", "integer", "decimal", "money", "currency", "percent", "percentage", "range"]);
|
|
45887
45904
|
function isNumberField2(field2) {
|
|
45888
|
-
if (!
|
|
45905
|
+
if (!NUMBER_TYPES2.has(String(field2.type))) return false;
|
|
45889
45906
|
const kind2 = String((field2.config ?? {})["kind"] ?? "number");
|
|
45890
45907
|
return kind2 !== "date" && kind2 !== "datetime";
|
|
45891
45908
|
}
|
|
@@ -56361,7 +56378,6 @@ function QuestionAnswerView({ tableId, spec, answer, fields, related = NO_RELATE
|
|
|
56361
56378
|
|
|
56362
56379
|
// src/TableAsk.tsx
|
|
56363
56380
|
var import_react315 = require("react");
|
|
56364
|
-
var import_format14 = require("@ai-matrx/kit/format");
|
|
56365
56381
|
var import_design_system157 = require("@ai-matrx/design-system");
|
|
56366
56382
|
var import_records68 = require("@ai-matrx/records");
|
|
56367
56383
|
var import_react316 = require("@ai-matrx/records/react");
|
|
@@ -56602,7 +56618,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
56602
56618
|
setSaid({ kind: "asking", reads: words2.trim() });
|
|
56603
56619
|
const got = await askTable({ tableId, question: words2.trim(), viewId: viewId ?? "" });
|
|
56604
56620
|
setSaid(
|
|
56605
|
-
got.ok ? { kind: "agent-answer", answer: got.answer
|
|
56621
|
+
got.ok ? { kind: "agent-answer", answer: got.answer } : { kind: "agent-failed", error: (0, refusals_exports.refusal)("door", got.message, got.hint ?? null) }
|
|
56606
56622
|
);
|
|
56607
56623
|
return;
|
|
56608
56624
|
}
|
|
@@ -56655,7 +56671,7 @@ function TableAsk({ tableId, onOpenInQuestions, viewId }) {
|
|
|
56655
56671
|
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_design_system157.Skeleton, { className: "h-24 w-full", "data-table-ask-pending": "" })
|
|
56656
56672
|
] }) : null,
|
|
56657
56673
|
said2.kind === "agent-failed" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("div", { "data-table-ask-failed": "", children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: said2.error }) }) : null,
|
|
56658
|
-
said2.kind === "agent-answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(AgentAnswer, { tableId, answer: said2.answer, fields: all
|
|
56674
|
+
said2.kind === "agent-answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(AgentAnswer, { tableId, answer: said2.answer, fields: all }) : null,
|
|
56659
56675
|
said2.kind === "refused" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: said2.error }) : null,
|
|
56660
56676
|
said2.kind === "answer" ? /* @__PURE__ */ (0, import_jsx_runtime180.jsxs)(import_jsx_runtime180.Fragment, { children: [
|
|
56661
56677
|
/* @__PURE__ */ (0, import_jsx_runtime180.jsx)("p", { className: "truncate text-muted-foreground", title: said2.reads, "data-table-ask-reads": "", children: said2.reads }),
|
|
@@ -56704,8 +56720,7 @@ function useNames(tableId, ids) {
|
|
|
56704
56720
|
function AgentAnswer({
|
|
56705
56721
|
tableId,
|
|
56706
56722
|
answer,
|
|
56707
|
-
fields
|
|
56708
|
-
costPoints = null
|
|
56723
|
+
fields
|
|
56709
56724
|
}) {
|
|
56710
56725
|
const client = (0, import_react316.useRecordsClient)();
|
|
56711
56726
|
const ui = useRecordsUi();
|
|
@@ -56771,7 +56786,6 @@ function AgentAnswer({
|
|
|
56771
56786
|
] }, `${c.record_id}:${c.field_key}:${i}`)) }) : null,
|
|
56772
56787
|
open.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_design_system157.Button, { size: "sm", className: "w-fit self-end", disabled: busy, onClick: () => void apply(open), "data-table-ask-apply-all": "", children: "Apply all" }) : null,
|
|
56773
56788
|
refusal3 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(RefusalNotice, { error: refusal3 }) : null,
|
|
56774
|
-
costPoints !== null ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("p", { className: "text-muted-foreground", "data-table-ask-cost": "", children: (0, import_format14.formatPoints)(costPoints) }) : null,
|
|
56775
56789
|
answer.could_not.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("ul", { className: "text-muted-foreground", "data-table-ask-could-not": "", children: answer.could_not.map((w) => /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("li", { children: w }, w)) }) : null
|
|
56776
56790
|
] });
|
|
56777
56791
|
}
|
|
@@ -56789,7 +56803,7 @@ var import_react317 = require("react");
|
|
|
56789
56803
|
var import_react318 = require("@ai-matrx/records/react");
|
|
56790
56804
|
var import_core25 = require("@ai-matrx/records/core");
|
|
56791
56805
|
var import_download3 = require("@ai-matrx/kit/download");
|
|
56792
|
-
var
|
|
56806
|
+
var import_format14 = require("@ai-matrx/kit/format");
|
|
56793
56807
|
var import_design_system158 = require("@ai-matrx/design-system");
|
|
56794
56808
|
init_parity();
|
|
56795
56809
|
var import_forms4 = require("@ai-matrx/records/forms");
|
|
@@ -57293,7 +57307,7 @@ function NumberBlockView({ block, viewerUserId, extra }) {
|
|
|
57293
57307
|
const read = useElementRows(block, viewerUserId, extra, false);
|
|
57294
57308
|
if (read.error) return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(RefusalLine, { error: read.error });
|
|
57295
57309
|
if (read.waiting || read.total === null) return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_design_system158.Skeleton, { className: "h-12 w-24" });
|
|
57296
|
-
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: (0,
|
|
57310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)("p", { className: "text-3xl font-semibold tabular-nums", "data-records-page-number": block.id, children: (0, import_format14.formatCount)(read.total) });
|
|
57297
57311
|
}
|
|
57298
57312
|
function LayoutBlockView({ block, viewerUserId, extra }) {
|
|
57299
57313
|
const door = useInterfaceDoor();
|
|
@@ -60083,7 +60097,7 @@ function TableReferenceDialog({
|
|
|
60083
60097
|
}
|
|
60084
60098
|
|
|
60085
60099
|
// src/TableDuplicate.tsx
|
|
60086
|
-
var
|
|
60100
|
+
var import_format15 = require("@ai-matrx/kit/format");
|
|
60087
60101
|
var import_react340 = require("react");
|
|
60088
60102
|
var import_react341 = require("@ai-matrx/records/react");
|
|
60089
60103
|
var import_design_system171 = require("@ai-matrx/design-system");
|
|
@@ -60094,7 +60108,7 @@ function copyNameFor(name) {
|
|
|
60094
60108
|
return `${name.trim() || "Table"} (copy)`;
|
|
60095
60109
|
}
|
|
60096
60110
|
function duplicateProgressWords(p) {
|
|
60097
|
-
if (p.records && p.records.total > 0) return `Copying records \xB7 ${(0,
|
|
60111
|
+
if (p.records && p.records.total > 0) return `Copying records \xB7 ${(0, import_format15.formatCount)(p.records.done)} of ${(0, import_format15.formatCount)(p.records.total)}`;
|
|
60098
60112
|
if (p.views.total > 0 && p.step === "views") return `Copying views \xB7 ${p.views.done} of ${p.views.total}`;
|
|
60099
60113
|
return "Copying columns\u2026";
|
|
60100
60114
|
}
|
|
@@ -60151,7 +60165,7 @@ function TableDuplicateDialog({ tableId, name, organizationId, open, onOpenChang
|
|
|
60151
60165
|
" columns, ",
|
|
60152
60166
|
phase.copy.copied.views,
|
|
60153
60167
|
" views",
|
|
60154
|
-
phase.copy.copied.withRecords ? `, ${(0,
|
|
60168
|
+
phase.copy.copied.withRecords ? `, ${(0, import_format15.formatCount)(phase.copy.copied.records)} records` : "",
|
|
60155
60169
|
"."
|
|
60156
60170
|
] }),
|
|
60157
60171
|
phase.copy.notCopied.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime194.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -62281,7 +62295,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
62281
62295
|
}
|
|
62282
62296
|
|
|
62283
62297
|
// src/entityViews.tsx
|
|
62284
|
-
var
|
|
62298
|
+
var import_format16 = require("@ai-matrx/kit/format");
|
|
62285
62299
|
var import_design_system175 = require("@ai-matrx/design-system");
|
|
62286
62300
|
var import_data_table26 = require("@ai-matrx/design-system/data-table");
|
|
62287
62301
|
var import_react348 = require("react");
|
|
@@ -62476,7 +62490,7 @@ function EntityTablePageBody({
|
|
|
62476
62490
|
return /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: (0, import_design_system176.cn)("flex min-w-0 flex-col gap-2", className), "data-records-entity-page": source.token, children: [
|
|
62477
62491
|
presentation === "page" || boardable || entity.creatable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
62478
62492
|
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("h2", { className: "truncate text-base font-semibold", children: entity.label ?? (entity.loading ? "Loading\u2026" : "Table") }) : null,
|
|
62479
|
-
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0,
|
|
62493
|
+
presentation === "page" ? /* @__PURE__ */ (0, import_jsx_runtime199.jsx)("span", { className: "text-xs tabular-nums text-muted-foreground", children: entity.loading || entity.total === null ? "" : (0, import_format16.formatCount)(entity.total) }) : null,
|
|
62480
62494
|
/* @__PURE__ */ (0, import_jsx_runtime199.jsxs)("span", { className: "ml-auto flex items-center gap-1", children: [
|
|
62481
62495
|
boardable ? /* @__PURE__ */ (0, import_jsx_runtime199.jsxs)(import_jsx_runtime199.Fragment, { children: [
|
|
62482
62496
|
/* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_design_system176.Button, { size: "sm", variant: layout === "grid" ? "secondary" : "ghost", "aria-pressed": layout === "grid", onClick: () => choose("grid"), children: "Table" }),
|
|
@@ -63124,6 +63138,7 @@ var import_react361 = require("@ai-matrx/records/react");
|
|
|
63124
63138
|
var import_design_system181 = require("@ai-matrx/design-system");
|
|
63125
63139
|
var import_icons3 = require("@ai-matrx/design-system/icons");
|
|
63126
63140
|
var import_field_formats12 = require("@ai-matrx/design-system/field-formats");
|
|
63141
|
+
var import_controls14 = require("@ai-matrx/design-system/controls");
|
|
63127
63142
|
init_names();
|
|
63128
63143
|
init_plainWords();
|
|
63129
63144
|
|
|
@@ -63520,7 +63535,7 @@ function ChecksLine({ checks, onFix }) {
|
|
|
63520
63535
|
if (checks.length === 0) return null;
|
|
63521
63536
|
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: [
|
|
63522
63537
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs text-warning-ink", children: check.message }),
|
|
63523
|
-
check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63538
|
+
check.fix && onFix ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "outline", onClick: () => onFix(check), children: check.fix.label }) : null
|
|
63524
63539
|
] }, i)) });
|
|
63525
63540
|
}
|
|
63526
63541
|
function ValueCell({
|
|
@@ -63529,7 +63544,8 @@ function ValueCell({
|
|
|
63529
63544
|
editable,
|
|
63530
63545
|
save,
|
|
63531
63546
|
onFix,
|
|
63532
|
-
context
|
|
63547
|
+
context,
|
|
63548
|
+
stacked
|
|
63533
63549
|
}) {
|
|
63534
63550
|
const { field: field2, format } = column;
|
|
63535
63551
|
const stored = (row.document ?? {})[field2.key];
|
|
@@ -63542,11 +63558,12 @@ function ValueCell({
|
|
|
63542
63558
|
if (format?.id === "color_pair") {
|
|
63543
63559
|
const pair = (0, import_field_formats12.readColorPair)(value) ?? null;
|
|
63544
63560
|
const contrast = pair ? colorPairContrast(pair, format, context) : {};
|
|
63545
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63546
63562
|
const side = part === "light" ? pair?.light : pair?.dark ?? void 0;
|
|
63547
63563
|
const ratio = contrast[part];
|
|
63548
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0 px-3", children: [
|
|
63564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: stacked ? "min-w-0" : "min-w-0 px-3", children: [
|
|
63549
63565
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
63566
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "w-9 shrink-0 text-xs text-muted-foreground", children: part === "light" ? "Light" : "Dark" }) : null,
|
|
63550
63567
|
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63551
63568
|
ColorWell,
|
|
63552
63569
|
{
|
|
@@ -63562,7 +63579,7 @@ function ValueCell({
|
|
|
63562
63579
|
}
|
|
63563
63580
|
}
|
|
63564
63581
|
) : /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("code", { className: "font-mono text-xs uppercase", children: side ?? (part === "dark" ? "Inherits light" : "\u2014") }),
|
|
63565
|
-
ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ContrastMark, { ratio }) : null
|
|
63582
|
+
ratio !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ContrastMark, { ratio, min: pair?.min }) : null
|
|
63566
63583
|
] }),
|
|
63567
63584
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ChecksLine, { checks: checks.filter((c) => c.part === part), onFix: fix })
|
|
63568
63585
|
] }, part);
|
|
@@ -63573,25 +63590,28 @@ function ValueCell({
|
|
|
63573
63590
|
const ownDark = typeof value === "string" && value.includes('"dark"');
|
|
63574
63591
|
const pack = (l) => l.length === 1 ? l[0] : { layers: l };
|
|
63575
63592
|
const write = (light, dark) => change(JSON.stringify(dark ? { light: pack(light), dark: pack(dark) } : pack(light)));
|
|
63576
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63593
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("div", { className: stacked ? "flex min-w-0 flex-col gap-1.5" : "grid min-w-0 grid-cols-2", children: ["light", "dark"].map((part) => {
|
|
63577
63594
|
const layers = pair ? pair[part] : null;
|
|
63578
63595
|
const words2 = !layers ? "Set" : part === "dark" && !ownDark ? "Same as light" : (0, import_field_formats12.shadowWords)(layers);
|
|
63579
63596
|
const inner2 = /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("span", { className: "flex min-w-0 items-center gap-2", children: [
|
|
63580
63597
|
layers ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(ShadowSwatch, { layers, theme: part }) : null,
|
|
63581
63598
|
/* @__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 })
|
|
63582
63599
|
] });
|
|
63583
|
-
return /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63584
|
-
|
|
63585
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63586
|
-
|
|
63587
|
-
{
|
|
63588
|
-
|
|
63589
|
-
|
|
63590
|
-
|
|
63591
|
-
|
|
63592
|
-
|
|
63593
|
-
|
|
63594
|
-
|
|
63600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: stacked ? "flex min-w-0 items-center gap-2" : "min-w-0 px-3", children: [
|
|
63601
|
+
stacked ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "w-9 shrink-0 text-xs text-muted-foreground", children: part === "light" ? "Light" : "Dark" }) : null,
|
|
63602
|
+
editable ? /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63603
|
+
/* @__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 }) }),
|
|
63604
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "start", className: "w-80", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63605
|
+
ShadowLayersEditor,
|
|
63606
|
+
{
|
|
63607
|
+
layers: layers ?? [{ x: 0, y: 4, blur: 12, spread: 0, color: "#0000001f" }],
|
|
63608
|
+
id: `${id}-${part}`,
|
|
63609
|
+
label: `${fieldName(field2)} ${part}`,
|
|
63610
|
+
onChange: (next) => part === "light" ? write(next, ownDark && pair ? pair.dark : null) : write(pair ? pair.light : next, next)
|
|
63611
|
+
}
|
|
63612
|
+
) })
|
|
63613
|
+
] }) : inner2
|
|
63614
|
+
] }, part);
|
|
63595
63615
|
}) });
|
|
63596
63616
|
}
|
|
63597
63617
|
const look = fieldLookFor(format?.id);
|
|
@@ -63676,20 +63696,15 @@ function groundOf(row, rows, keys) {
|
|
|
63676
63696
|
}
|
|
63677
63697
|
function RowComments({ tableId, row, count, onClosed }) {
|
|
63678
63698
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { onOpenChange: (open) => !open && onClosed(), children: [
|
|
63679
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63680
|
-
|
|
63699
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63700
|
+
import_controls14.Button,
|
|
63681
63701
|
{
|
|
63682
63702
|
type: "button",
|
|
63703
|
+
variant: "quiet",
|
|
63704
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.MessageSquareIcon, {}),
|
|
63705
|
+
badge: count,
|
|
63683
63706
|
"aria-label": count > 0 ? `${count} open comment${count === 1 ? "" : "s"}` : "Comment",
|
|
63684
|
-
"data-records-row-comments": count
|
|
63685
|
-
className: (0, import_design_system181.cn)(
|
|
63686
|
-
"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",
|
|
63687
|
-
count > 0 ? "text-foreground" : "text-muted-foreground"
|
|
63688
|
-
),
|
|
63689
|
-
children: [
|
|
63690
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.MessageSquareIcon, { className: "h-3.5 w-3.5" }),
|
|
63691
|
-
count > 0 ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs tabular-nums", children: count }) : null
|
|
63692
|
-
]
|
|
63707
|
+
"data-records-row-comments": count
|
|
63693
63708
|
}
|
|
63694
63709
|
) }),
|
|
63695
63710
|
/* @__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" }) })
|
|
@@ -63702,16 +63717,14 @@ function NoteButton({ row, noteField, editable, save }) {
|
|
|
63702
63717
|
const has = text.trim() !== "";
|
|
63703
63718
|
return /* @__PURE__ */ (0, import_jsx_runtime207.jsxs)(import_design_system181.Popover, { children: [
|
|
63704
63719
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63705
|
-
|
|
63720
|
+
import_controls14.Button,
|
|
63706
63721
|
{
|
|
63707
63722
|
type: "button",
|
|
63723
|
+
variant: "quiet",
|
|
63724
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.StickyNoteIcon, {}),
|
|
63725
|
+
pressed: has,
|
|
63708
63726
|
"aria-label": has ? `${fieldName(noteField)}: ${text}` : `Add ${fieldName(noteField).toLowerCase()}`,
|
|
63709
|
-
title: has ? text : fieldName(noteField)
|
|
63710
|
-
className: (0, import_design_system181.cn)(
|
|
63711
|
-
"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",
|
|
63712
|
-
has ? "text-foreground" : "text-muted-foreground"
|
|
63713
|
-
),
|
|
63714
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.StickyNoteIcon, { className: "h-4 w-4" })
|
|
63727
|
+
title: has ? text : fieldName(noteField)
|
|
63715
63728
|
}
|
|
63716
63729
|
) }),
|
|
63717
63730
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_design_system181.PopoverContent, { align: "end", className: "w-72", children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
@@ -63825,8 +63838,8 @@ function AddDialog({
|
|
|
63825
63838
|
/* @__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) })
|
|
63826
63839
|
] }) : null,
|
|
63827
63840
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "flex justify-end gap-2 pt-1", children: [
|
|
63828
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63829
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63841
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "quiet", onClick: () => onOpenChange(false), children: "Cancel" }),
|
|
63842
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "submit", variant: "primary", disabled: !ready, children: "Add" })
|
|
63830
63843
|
] })
|
|
63831
63844
|
]
|
|
63832
63845
|
}
|
|
@@ -63905,27 +63918,15 @@ function TableSectionCard(props) {
|
|
|
63905
63918
|
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: [
|
|
63906
63919
|
/* @__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: [
|
|
63907
63920
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { className: "min-w-0", children: [
|
|
63908
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("h2", { className: "
|
|
63921
|
+
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("h2", { className: "type-heading truncate text-foreground", children: title || "\xA0" }),
|
|
63909
63922
|
props.description ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("p", { className: "mt-1 max-w-prose text-sm text-muted-foreground", children: props.description }) : null
|
|
63910
63923
|
] }),
|
|
63911
|
-
mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.
|
|
63912
|
-
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-3.5 w-3.5" }),
|
|
63913
|
-
"Add"
|
|
63914
|
-
] }) : null
|
|
63924
|
+
mayWrite && nameField ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "outline", icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, {}), onClick: () => setAdding(groups[groups.length - 1]?.key ?? UNGROUPED2), children: "Add" }) : null
|
|
63915
63925
|
] }),
|
|
63916
63926
|
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: [
|
|
63917
63927
|
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: [
|
|
63918
63928
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "text-xs font-semibold text-foreground", children: group.key || "No group" }),
|
|
63919
|
-
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63920
|
-
"button",
|
|
63921
|
-
{
|
|
63922
|
-
type: "button",
|
|
63923
|
-
"aria-label": `Add to ${group.key || "no group"}`,
|
|
63924
|
-
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",
|
|
63925
|
-
onClick: () => setAdding(group.key),
|
|
63926
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, { className: "h-4 w-4" })
|
|
63927
|
-
}
|
|
63928
|
-
) : null
|
|
63929
|
+
mayWrite ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_controls14.Button, { type: "button", variant: "quiet", icon: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_icons3.PlusIcon, {}), "aria-label": `Add to ${group.key || "no group"}`, onClick: () => setAdding(group.key) }) : null
|
|
63929
63930
|
] }) : null,
|
|
63930
63931
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsxs)("div", { role: "table", "aria-label": group.key || title, className: narrow ? "" : "min-w-[36rem]", children: [
|
|
63931
63932
|
/* @__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: [
|
|
@@ -63965,7 +63966,7 @@ function TableSectionCard(props) {
|
|
|
63965
63966
|
style: c.part ? { gridColumn: "span 2" } : void 0,
|
|
63966
63967
|
className: narrow ? "min-w-0" : (0, import_design_system181.cn)("min-w-0 py-1", c.part ? "" : "px-3"),
|
|
63967
63968
|
children: [
|
|
63968
|
-
narrow ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mb-0.5 block text-xs text-muted-foreground", children: cellLabel(c) }) : null,
|
|
63969
|
+
narrow && !c.part ? /* @__PURE__ */ (0, import_jsx_runtime207.jsx)("span", { className: "mb-0.5 block text-xs text-muted-foreground", children: cellLabel(c) }) : null,
|
|
63969
63970
|
/* @__PURE__ */ (0, import_jsx_runtime207.jsx)(
|
|
63970
63971
|
ValueCell,
|
|
63971
63972
|
{
|
|
@@ -63974,7 +63975,8 @@ function TableSectionCard(props) {
|
|
|
63974
63975
|
editable,
|
|
63975
63976
|
save: rowSave,
|
|
63976
63977
|
onFix,
|
|
63977
|
-
context: c.field.key === readsOnColorKey ? groundOf(row, rows, { name: cols.name, readsOn: cols.readsOn, color: c.field.key }) : void 0
|
|
63978
|
+
context: c.field.key === readsOnColorKey ? groundOf(row, rows, { name: cols.name, readsOn: cols.readsOn, color: c.field.key }) : void 0,
|
|
63979
|
+
stacked: narrow
|
|
63978
63980
|
}
|
|
63979
63981
|
)
|
|
63980
63982
|
]
|