@ai-matrx/records-ui 0.103.2 → 0.103.6
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 +25 -0
- package/dist/index.cjs +128 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +55 -13
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -8305,6 +8305,17 @@ function rememberRowCount(key, count) {
|
|
|
8305
8305
|
} catch {
|
|
8306
8306
|
}
|
|
8307
8307
|
}
|
|
8308
|
+
var LAYOUT_PREFIX = "records-ui:layout:";
|
|
8309
|
+
function rememberedLayout(tableId) {
|
|
8310
|
+
const held = storage()?.getItem(LAYOUT_PREFIX + tableId);
|
|
8311
|
+
return held && /^[a-z_-]{2,24}$/.test(held) ? held : null;
|
|
8312
|
+
}
|
|
8313
|
+
function rememberLayout(tableId, layout) {
|
|
8314
|
+
try {
|
|
8315
|
+
storage()?.setItem(LAYOUT_PREFIX + tableId, layout);
|
|
8316
|
+
} catch {
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8308
8319
|
|
|
8309
8320
|
// src/RecordsSkeleton.tsx
|
|
8310
8321
|
var import_react40 = require("react");
|
|
@@ -8320,6 +8331,13 @@ function useRememberedPageRows(tableId) {
|
|
|
8320
8331
|
() => "fill"
|
|
8321
8332
|
);
|
|
8322
8333
|
}
|
|
8334
|
+
function useRememberedLayout(tableId) {
|
|
8335
|
+
return (0, import_react40.useSyncExternalStore)(
|
|
8336
|
+
NEVER,
|
|
8337
|
+
() => tableId ? rememberedLayout(tableId) : null,
|
|
8338
|
+
() => null
|
|
8339
|
+
);
|
|
8340
|
+
}
|
|
8323
8341
|
var RECORDS_SKELETON_LAYOUTS = [
|
|
8324
8342
|
"grid",
|
|
8325
8343
|
"kanban",
|
|
@@ -8454,13 +8472,15 @@ function RecordsSkeleton({ layout = "grid", embedded = false, rows, className })
|
|
|
8454
8472
|
);
|
|
8455
8473
|
}
|
|
8456
8474
|
function TablePageSkeleton({
|
|
8457
|
-
layout
|
|
8475
|
+
layout: layoutAsked,
|
|
8458
8476
|
embedded = false,
|
|
8459
8477
|
rows,
|
|
8460
8478
|
tableId,
|
|
8461
8479
|
className
|
|
8462
8480
|
}) {
|
|
8463
8481
|
const remembered = useRememberedPageRows(embedded ? void 0 : tableId);
|
|
8482
|
+
const rememberedFace = useRememberedLayout(embedded || layoutAsked ? void 0 : tableId);
|
|
8483
|
+
const layout = layoutAsked ?? skeletonLayoutFor(rememberedFace);
|
|
8464
8484
|
const painted = rows ?? (remembered === "fill" ? void 0 : remembered);
|
|
8465
8485
|
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: (0, import_design_system24.cn)(TABLE_PAGE_FRAME_CLASS, className), "data-records-skeleton-page": layout, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: TABLE_PAGE_COLUMN_CLASS, children: [
|
|
8466
8486
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: TABLE_TOOLBAR_ROW_CLASS, "data-table-toolbar": "", "data-records-skeleton-part": "toolbar", "aria-hidden": "true", children: [
|
|
@@ -8502,7 +8522,7 @@ function useWholeTableCount(args) {
|
|
|
8502
8522
|
var import_react113 = require("react");
|
|
8503
8523
|
var import_react114 = require("@ai-matrx/records/react");
|
|
8504
8524
|
var import_records36 = require("@ai-matrx/records");
|
|
8505
|
-
var
|
|
8525
|
+
var import_data_table12 = require("@ai-matrx/design-system/data-table");
|
|
8506
8526
|
var import_core16 = require("@ai-matrx/records/core");
|
|
8507
8527
|
|
|
8508
8528
|
// src/archiveWords.ts
|
|
@@ -8814,6 +8834,7 @@ var REVERSE_COLUMN_PREFIX = "linked:";
|
|
|
8814
8834
|
|
|
8815
8835
|
// src/gridControls.tsx
|
|
8816
8836
|
var import_design_system46 = require("@ai-matrx/design-system");
|
|
8837
|
+
var import_data_table9 = require("@ai-matrx/design-system/data-table");
|
|
8817
8838
|
var import_format3 = require("@ai-matrx/kit/format");
|
|
8818
8839
|
|
|
8819
8840
|
// src/FieldEditor.tsx
|
|
@@ -14996,11 +15017,7 @@ function useMergedGridControls(args) {
|
|
|
14996
15017
|
const row = rows.find((r) => r.id === rowId);
|
|
14997
15018
|
if (!row) return null;
|
|
14998
15019
|
const doc = row.document ?? {};
|
|
14999
|
-
return order.filter((k) => !hidden.includes(k)).map((k) =>
|
|
15000
|
-
const v = doc[k];
|
|
15001
|
-
if (v === null || v === void 0) return "";
|
|
15002
|
-
return typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
15003
|
-
}).join(" ");
|
|
15020
|
+
return (0, import_data_table9.gridToTsv)([order.filter((k) => !hidden.includes(k)).map((k) => doc[k])]);
|
|
15004
15021
|
},
|
|
15005
15022
|
[rows, order, hidden]
|
|
15006
15023
|
);
|
|
@@ -16318,7 +16335,7 @@ function NewRecordControl({
|
|
|
16318
16335
|
var import_react90 = require("react");
|
|
16319
16336
|
var import_react91 = require("@ai-matrx/records/react");
|
|
16320
16337
|
var import_records30 = require("@ai-matrx/records");
|
|
16321
|
-
var
|
|
16338
|
+
var import_data_table10 = require("@ai-matrx/design-system/data-table");
|
|
16322
16339
|
var ADDITIVE_OPS = /* @__PURE__ */ new Set(["count", "sum", "filled", "empty"]);
|
|
16323
16340
|
function drillDimensionsOf(def, labels) {
|
|
16324
16341
|
if (!def) return [];
|
|
@@ -16381,7 +16398,7 @@ function useDrillDefinition(source) {
|
|
|
16381
16398
|
function drillWhere(base, trail, booleans) {
|
|
16382
16399
|
const where = { ...base ?? {} };
|
|
16383
16400
|
for (const w of trail) {
|
|
16384
|
-
const { key, grain } = (0,
|
|
16401
|
+
const { key, grain } = (0, import_data_table10.parseDimensionRef)(w.dim);
|
|
16385
16402
|
if (grain) where[w.dim] = w.value;
|
|
16386
16403
|
else if (booleans.has(key) && (w.value === "true" || w.value === "false")) where[key] = w.value === "true";
|
|
16387
16404
|
else where[key] = w.value;
|
|
@@ -16435,7 +16452,7 @@ function useDrillAnswers(args) {
|
|
|
16435
16452
|
(0, import_react90.useEffect)(() => {
|
|
16436
16453
|
if (!enabled || !source || question.by.length === 0) return;
|
|
16437
16454
|
const asked3 = JSON.parse(askKey2);
|
|
16438
|
-
const range = asked3.window && asked3.windowKey ? (0,
|
|
16455
|
+
const range = asked3.window && asked3.windowKey ? (0, import_data_table10.drillWindowRange)(asked3.window) : null;
|
|
16439
16456
|
const compare = asked3.compare && range && asked3.windowKey ? {
|
|
16440
16457
|
against: asked3.compare,
|
|
16441
16458
|
from: range.from,
|
|
@@ -16445,12 +16462,12 @@ function useDrillAnswers(args) {
|
|
|
16445
16462
|
let cancelled = false;
|
|
16446
16463
|
setAnswers({});
|
|
16447
16464
|
setError(null);
|
|
16448
|
-
const requests = (0,
|
|
16465
|
+
const requests = (0, import_data_table10.drillRequests)({ by: asked3.by, across: asked3.across, show: asked3.show, where: [] });
|
|
16449
16466
|
void Promise.all(
|
|
16450
16467
|
requests.map(async (request) => {
|
|
16451
16468
|
if (asked3.rule && asked3.source.kind === "table") {
|
|
16452
|
-
const time = request.by.find((ref) => (0,
|
|
16453
|
-
const t = time ? (0,
|
|
16469
|
+
const time = request.by.find((ref) => (0, import_data_table10.parseDimensionRef)(ref).grain !== null) ?? null;
|
|
16470
|
+
const t = time ? (0, import_data_table10.parseDimensionRef)(time) : null;
|
|
16454
16471
|
const measures = asked3.show.map(storeMeasure).filter((m) => m !== null);
|
|
16455
16472
|
if (t?.grain === "hour") return { request, error: "This table's periods start at a day; it cannot be read by the hour." };
|
|
16456
16473
|
const got2 = await client.recordAggregate({
|
|
@@ -16539,7 +16556,7 @@ function useDrillAnswers(args) {
|
|
|
16539
16556
|
}
|
|
16540
16557
|
function drillQuestionFor(question, def) {
|
|
16541
16558
|
if (!def) return question;
|
|
16542
|
-
const known = (ref) => def.dimensions.some((d) => d.key === (0,
|
|
16559
|
+
const known = (ref) => def.dimensions.some((d) => d.key === (0, import_data_table10.parseDimensionRef)(ref).key);
|
|
16543
16560
|
const show = question.show.filter((key) => def.measures.some((m) => m.key === key));
|
|
16544
16561
|
return {
|
|
16545
16562
|
...question,
|
|
@@ -16600,7 +16617,7 @@ function questionFromGrouping(grouping) {
|
|
|
16600
16617
|
};
|
|
16601
16618
|
}
|
|
16602
16619
|
function groupingFromQuestion(question, held) {
|
|
16603
|
-
const [first, ...rest] = question.by.map(
|
|
16620
|
+
const [first, ...rest] = question.by.map(import_data_table10.parseDimensionRef);
|
|
16604
16621
|
if (!first) return void 0;
|
|
16605
16622
|
const sameFirst = held?.field === first.key;
|
|
16606
16623
|
return {
|
|
@@ -16615,9 +16632,9 @@ function groupingFromQuestion(question, held) {
|
|
|
16615
16632
|
};
|
|
16616
16633
|
}
|
|
16617
16634
|
function trailClause(fields, w) {
|
|
16618
|
-
const { key, grain } = (0,
|
|
16635
|
+
const { key, grain } = (0, import_data_table10.parseDimensionRef)(w.dim);
|
|
16619
16636
|
const field2 = fields.find((f) => f.key === key);
|
|
16620
|
-
if (grain && w.value !== null) return { key, value: (0,
|
|
16637
|
+
if (grain && w.value !== null) return { key, value: (0, import_data_table10.bucketWindow)(w.value, grain), field: field2 };
|
|
16621
16638
|
if (field2 && String(editorKindFor(field2)) === "checkbox" && (w.value === "true" || w.value === "false")) {
|
|
16622
16639
|
return { key, value: w.value === "true", field: field2 };
|
|
16623
16640
|
}
|
|
@@ -16661,7 +16678,7 @@ function useGridDrillQuestion(args) {
|
|
|
16661
16678
|
const { tableId, fields, presentation, filter } = args;
|
|
16662
16679
|
const source = (0, import_react90.useMemo)(() => ({ kind: "table", id: tableId }), [tableId]);
|
|
16663
16680
|
const saved = (0, import_react90.useMemo)(() => questionFromGrouping(presentation.grouping), [presentation.grouping]);
|
|
16664
|
-
const url = (0,
|
|
16681
|
+
const url = (0, import_data_table10.useDrillUrlState)({ fallback: saved });
|
|
16665
16682
|
const requested = args.enabled && (url.question.by.length > (args.plainGroupingIsRows ? 1 : 0) || url.question.across !== null || url.question.where.length > 0 || // `!= null`: a question read by a design-system that does not know the window or the comparison
|
|
16666
16683
|
// yet has them UNDEFINED, and `undefined !== null` asked for drill metadata on every plain grid.
|
|
16667
16684
|
url.question.window != null || url.question.compare != null);
|
|
@@ -16671,7 +16688,7 @@ function useGridDrillQuestion(args) {
|
|
|
16671
16688
|
const windowKey = drillWindowDimensionOf(def);
|
|
16672
16689
|
const trailFilter = (0, import_react90.useMemo)(() => {
|
|
16673
16690
|
if (!enabled) return filter;
|
|
16674
|
-
const range = question.window && windowKey ? (0,
|
|
16691
|
+
const range = question.window && windowKey ? (0, import_data_table10.drillWindowRange)(question.window) : null;
|
|
16675
16692
|
const withWindow = range && windowKey ? filterWithWindow(fields, filter, windowKey, range) : filter;
|
|
16676
16693
|
return filterWithTrail(fields, withWindow, question.where);
|
|
16677
16694
|
}, [enabled, fields, filter, question.where, question.window, windowKey]);
|
|
@@ -20431,7 +20448,7 @@ var import_react105 = require("react");
|
|
|
20431
20448
|
var import_react106 = require("@ai-matrx/records/react");
|
|
20432
20449
|
var import_core13 = require("@ai-matrx/records/core");
|
|
20433
20450
|
var import_design_system57 = require("@ai-matrx/design-system");
|
|
20434
|
-
var
|
|
20451
|
+
var import_data_table11 = require("@ai-matrx/design-system/data-table");
|
|
20435
20452
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
20436
20453
|
function changesFor(step2, direction, versions = /* @__PURE__ */ new Map()) {
|
|
20437
20454
|
const byRow = /* @__PURE__ */ new Map();
|
|
@@ -20459,7 +20476,7 @@ function useGridUndo(args) {
|
|
|
20459
20476
|
onVersionsRef.current = args.onVersions;
|
|
20460
20477
|
const onVersions = (versions) => onVersionsRef.current?.(versions);
|
|
20461
20478
|
const known = (0, import_react105.useRef)(/* @__PURE__ */ new Map());
|
|
20462
|
-
const [held, setHeld] = (0, import_react105.useState)(() => ({ stack: (0,
|
|
20479
|
+
const [held, setHeld] = (0, import_react105.useState)(() => ({ stack: (0, import_data_table11.createUndoStack)(args.depth ?? 100), steps: /* @__PURE__ */ new Map() }));
|
|
20463
20480
|
const heldRef = (0, import_react105.useRef)(held);
|
|
20464
20481
|
heldRef.current = held;
|
|
20465
20482
|
const [busy, setBusy] = (0, import_react105.useState)(false);
|
|
@@ -20474,7 +20491,7 @@ function useGridUndo(args) {
|
|
|
20474
20491
|
setHeld((was) => {
|
|
20475
20492
|
const steps = new Map(was.steps);
|
|
20476
20493
|
steps.set(id, step2);
|
|
20477
|
-
const stack = (0,
|
|
20494
|
+
const stack = (0, import_data_table11.pushUndo)(was.stack, { label: id, undo: [], redo: [] });
|
|
20478
20495
|
const live = new Set([...stack.past, ...stack.future].map((e) => e.label));
|
|
20479
20496
|
for (const key of [...steps.keys()]) if (!live.has(key)) steps.delete(key);
|
|
20480
20497
|
return { stack, steps };
|
|
@@ -20484,7 +20501,7 @@ function useGridUndo(args) {
|
|
|
20484
20501
|
const apply = (0, import_react105.useCallback)(
|
|
20485
20502
|
async (direction) => {
|
|
20486
20503
|
const was = heldRef.current;
|
|
20487
|
-
const taken = direction === "undo" ? (0,
|
|
20504
|
+
const taken = direction === "undo" ? (0, import_data_table11.popUndo)(was.stack) : (0, import_data_table11.popRedo)(was.stack);
|
|
20488
20505
|
if (!taken.entry) return;
|
|
20489
20506
|
const step2 = was.steps.get(taken.entry.label);
|
|
20490
20507
|
if (!step2) return;
|
|
@@ -20673,6 +20690,7 @@ var import_core14 = require("@ai-matrx/records/core");
|
|
|
20673
20690
|
var import_workspace = require("@ai-matrx/alchemy/react/workspace");
|
|
20674
20691
|
|
|
20675
20692
|
// src/gridAgentContext.ts
|
|
20693
|
+
var import_delimited3 = require("@ai-matrx/kit/delimited");
|
|
20676
20694
|
function recordOf(table, row) {
|
|
20677
20695
|
const document2 = row.document ?? {};
|
|
20678
20696
|
return { id: row.id, title: recordNameIn(table, document2), document: document2 };
|
|
@@ -20695,7 +20713,8 @@ function gridContextSnapshot(args) {
|
|
|
20695
20713
|
if (args.cursor && args.cursor.cellCount > 1) {
|
|
20696
20714
|
const keys = args.cursor.columnIds.filter((k) => byKey.has(k));
|
|
20697
20715
|
selectedRange = {
|
|
20698
|
-
tsv:
|
|
20716
|
+
tsv: `${(0, import_delimited3.toDelimited)([keys], { format: "tsv", spreadsheetSafe: false })}
|
|
20717
|
+
${args.cursor.tsv}`,
|
|
20699
20718
|
cellCount: args.cursor.cellCount,
|
|
20700
20719
|
rowIds: args.cursor.rowIds.filter((id) => byId.has(id)),
|
|
20701
20720
|
keys
|
|
@@ -21868,7 +21887,7 @@ var NO_REREAD = () => {
|
|
|
21868
21887
|
};
|
|
21869
21888
|
var VALUE_FILTER_UI = { allowNegation: true };
|
|
21870
21889
|
function Grid(props) {
|
|
21871
|
-
const inCard = (0,
|
|
21890
|
+
const inCard = (0, import_data_table12.useMatrxTableCard)() !== null;
|
|
21872
21891
|
if (!inCard) return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(GridBody, { ...props });
|
|
21873
21892
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TableToolbarSlotContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TableToolbarFoldContext.Provider, { value: 0, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TableToolbarSheetExtrasContext.Provider, { value: void 0, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(GridBody, { ...props }) }) }) });
|
|
21874
21893
|
}
|
|
@@ -21898,7 +21917,7 @@ function GridBody({
|
|
|
21898
21917
|
searchBox = true
|
|
21899
21918
|
}) {
|
|
21900
21919
|
const toolbarSlot = useTableToolbarSlot();
|
|
21901
|
-
const tableCard = (0,
|
|
21920
|
+
const tableCard = (0, import_data_table12.useMatrxTableCard)();
|
|
21902
21921
|
const [cardExtraRows, setCardExtraRows] = (0, import_react113.useState)(0);
|
|
21903
21922
|
const fills = footer === "sticky";
|
|
21904
21923
|
const host = useRecordsUi();
|
|
@@ -22945,7 +22964,7 @@ function GridBody({
|
|
|
22945
22964
|
[tableId, table.data, ordered, labelFor]
|
|
22946
22965
|
);
|
|
22947
22966
|
const tableStyleProp = (0, import_react113.useMemo)(
|
|
22948
|
-
() => (0,
|
|
22967
|
+
() => (0, import_data_table12.tableStyleIsEmpty)(paint.style) ? null : {
|
|
22949
22968
|
style: paint.style,
|
|
22950
22969
|
// A choice is read as its OPTION (`paintByOption`): the rule, the value and the
|
|
22951
22970
|
// colour a column keeps for it all name the same option, however it is stored.
|
|
@@ -23361,7 +23380,7 @@ function GridBody({
|
|
|
23361
23380
|
overflow: {
|
|
23362
23381
|
mode: phone ? "sheet" : toolbarFold2 >= 3 ? "menu" : "inline",
|
|
23363
23382
|
pinned: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [
|
|
23364
|
-
/* @__PURE__ */ (0, import_jsx_runtime70.jsx)(UndoRedoLive, { source: undoSource }),
|
|
23383
|
+
embedded ? null : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(UndoRedoLive, { source: undoSource }),
|
|
23365
23384
|
!embedded && !readOnly && rights.write ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
23366
23385
|
NewFromTemplateMenu,
|
|
23367
23386
|
{
|
|
@@ -23681,7 +23700,7 @@ function GridBody({
|
|
|
23681
23700
|
"data-records-grid-fit": look.fit,
|
|
23682
23701
|
onPasteCapture: takeEmptyTablePaste,
|
|
23683
23702
|
children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EmbeddedLookProvider, { value: embedded ? EMBEDDED_LOOK : null, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
23684
|
-
|
|
23703
|
+
import_data_table12.MatrxDataTable,
|
|
23685
23704
|
{
|
|
23686
23705
|
...fills ? { className: "min-h-0 flex-1" } : {},
|
|
23687
23706
|
frameHeight: fills ? "fill" : "content",
|
|
@@ -23745,7 +23764,7 @@ function GridBody({
|
|
|
23745
23764
|
window: WINDOW_OFF,
|
|
23746
23765
|
...controls.contextMenu ? { contextMenu: controls.contextMenu } : {},
|
|
23747
23766
|
spreadsheet: spreadsheetConfig,
|
|
23748
|
-
...drillConfig && (drillState.enabled || !merged) ? { drill: drillConfig } : groupingConfig ? { grouping: groupingConfig } : {},
|
|
23767
|
+
...embedded ? {} : drillConfig && (drillState.enabled || !merged) ? { drill: drillConfig } : groupingConfig ? { grouping: groupingConfig } : {},
|
|
23749
23768
|
columnState,
|
|
23750
23769
|
...look.rowHeight ? { rowHeight: look.rowHeight } : {},
|
|
23751
23770
|
fitToWidth: look.fit === "fit",
|
|
@@ -23797,7 +23816,7 @@ function GridBody({
|
|
|
23797
23816
|
// More exists when the store's total says so, or when it answered a FULL page (it
|
|
23798
23817
|
// names a total only once a page comes back short).
|
|
23799
23818
|
(typeof records.data?.total === "number" ? records.data.total > rows.length : rows.length >= pageSize + cardExtraRows) ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
23800
|
-
|
|
23819
|
+
import_data_table12.MatrxTableCardShowMore,
|
|
23801
23820
|
{
|
|
23802
23821
|
shown: rows.length,
|
|
23803
23822
|
total: typeof records.data?.total === "number" ? records.data.total : void 0,
|
|
@@ -23806,7 +23825,7 @@ function GridBody({
|
|
|
23806
23825
|
}
|
|
23807
23826
|
) : null
|
|
23808
23827
|
) : embeddedMore ? typeof records.data?.total === "number" && records.data.total > pageRows.length ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
23809
|
-
|
|
23828
|
+
import_data_table12.MatrxTableCardShowMore,
|
|
23810
23829
|
{
|
|
23811
23830
|
shown: pageRows.length,
|
|
23812
23831
|
total: records.data.total,
|
|
@@ -23969,13 +23988,13 @@ function withoutGoneColumns(query, liveKeys, openingSort) {
|
|
|
23969
23988
|
}
|
|
23970
23989
|
|
|
23971
23990
|
// src/RecordsTableCard.tsx
|
|
23972
|
-
var
|
|
23991
|
+
var import_data_table14 = require("@ai-matrx/design-system/data-table");
|
|
23973
23992
|
var import_design_system61 = require("@ai-matrx/design-system");
|
|
23974
23993
|
var import_react120 = require("@ai-matrx/records/react");
|
|
23975
23994
|
|
|
23976
23995
|
// src/entityTable.tsx
|
|
23977
23996
|
var import_react117 = require("react");
|
|
23978
|
-
var
|
|
23997
|
+
var import_data_table13 = require("@ai-matrx/design-system/data-table");
|
|
23979
23998
|
var import_react118 = require("@ai-matrx/records/react");
|
|
23980
23999
|
|
|
23981
24000
|
// ../entity-data/src/react/index.tsx
|
|
@@ -24821,7 +24840,7 @@ function EntityGrid({
|
|
|
24821
24840
|
const columns = (0, import_react117.useMemo)(() => entityTableColumns(entity.columns, canEdit), [entity.columns, canEdit]);
|
|
24822
24841
|
const byId = (0, import_react117.useMemo)(() => new Map(entity.columns.map((c) => [columnId(c), c])), [entity.columns]);
|
|
24823
24842
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
24824
|
-
|
|
24843
|
+
import_data_table13.MatrxDataTable,
|
|
24825
24844
|
{
|
|
24826
24845
|
data: entity.rows,
|
|
24827
24846
|
columns,
|
|
@@ -24856,7 +24875,7 @@ var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
|
24856
24875
|
function RecordsTableCard(props) {
|
|
24857
24876
|
const client = (0, import_react120.useOptionalRecordsClient)();
|
|
24858
24877
|
if (!client) {
|
|
24859
|
-
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_data_table14.MatrxTableCard, { title: "Table", ...props.className ? { className: props.className } : {}, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_data_table14.MatrxTableCardEmpty, { message: "This table cannot be shown here: the page has no connection to the data store." }) });
|
|
24860
24879
|
}
|
|
24861
24880
|
if (props.source.kind === "entity") return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(EntityTableCard, { ...props, source: props.source });
|
|
24862
24881
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ConnectedRecordsTableCard, { ...props, source: props.source });
|
|
@@ -24876,11 +24895,11 @@ function EntityTableCardBody({
|
|
|
24876
24895
|
editable,
|
|
24877
24896
|
className
|
|
24878
24897
|
}) {
|
|
24879
|
-
const batch = initialRows ??
|
|
24898
|
+
const batch = initialRows ?? import_data_table14.TABLE_CARD_DEFAULT_INITIAL_ROWS;
|
|
24880
24899
|
const entity = useEntityTable(source.token, { pageSize: batch });
|
|
24881
24900
|
const label = entity.label ?? (entity.loading ? "Loading\u2026" : "Table");
|
|
24882
24901
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24883
|
-
|
|
24902
|
+
import_data_table14.MatrxTableCard,
|
|
24884
24903
|
{
|
|
24885
24904
|
title: label,
|
|
24886
24905
|
fields: entity.columns.length,
|
|
@@ -24893,10 +24912,10 @@ function EntityTableCardBody({
|
|
|
24893
24912
|
...entity.newer > 0 ? { headerActions: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_design_system61.Button, { size: "sm", variant: "ghost", onClick: entity.refresh, children: `${entity.newer.toLocaleString()} new` }) } : {},
|
|
24894
24913
|
...initialRows ? { initialRows } : {},
|
|
24895
24914
|
...className ? { className } : {},
|
|
24896
|
-
children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24915
|
+
children: entity.error ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_data_table14.MatrxTableCardEmpty, { message: `This table could not be read: ${entity.error}` }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
24897
24916
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(EntityGrid, { entity, pageSize: batch, ...editable === void 0 ? {} : { editable } }),
|
|
24898
24917
|
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24899
|
-
|
|
24918
|
+
import_data_table14.MatrxTableCardShowMore,
|
|
24900
24919
|
{
|
|
24901
24920
|
shown: entity.rows.length,
|
|
24902
24921
|
total: entity.total ?? entity.rows.length + 1,
|
|
@@ -24927,7 +24946,7 @@ function ConnectedRecordsTableCard({
|
|
|
24927
24946
|
const plural4 = t?.label_plural ?? t?.name ?? "Records";
|
|
24928
24947
|
const singular = t?.label_singular ?? t?.name ?? "Record";
|
|
24929
24948
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24930
|
-
|
|
24949
|
+
import_data_table14.MatrxTableCard,
|
|
24931
24950
|
{
|
|
24932
24951
|
title: t ? plural4 : table.loading ? "Loading\u2026" : "Table",
|
|
24933
24952
|
records: { singular: singular.toLowerCase(), plural: plural4.toLowerCase() },
|
|
@@ -24940,11 +24959,11 @@ function ConnectedRecordsTableCard({
|
|
|
24940
24959
|
...edit ? { edit } : {},
|
|
24941
24960
|
...initialRows ? { initialRows } : {},
|
|
24942
24961
|
...className ? { className } : {},
|
|
24943
|
-
children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24962
|
+
children: table.error ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_data_table14.MatrxTableCardEmpty, { message: `This table could not be read: ${refusalSentence(table.error)}` }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
24944
24963
|
Grid,
|
|
24945
24964
|
{
|
|
24946
24965
|
tableId: source.id,
|
|
24947
|
-
pageSize: initialRows ??
|
|
24966
|
+
pageSize: initialRows ?? import_data_table14.TABLE_CARD_DEFAULT_INITIAL_ROWS,
|
|
24948
24967
|
...onOpenRecord ? { onOpenRecord } : {},
|
|
24949
24968
|
...editable === void 0 ? {} : { editable }
|
|
24950
24969
|
}
|
|
@@ -25261,7 +25280,7 @@ var import_design_system72 = require("@ai-matrx/design-system");
|
|
|
25261
25280
|
|
|
25262
25281
|
// src/newTableColumns.ts
|
|
25263
25282
|
var import_templates = require("@ai-matrx/records/templates");
|
|
25264
|
-
var
|
|
25283
|
+
var import_delimited4 = require("@ai-matrx/kit/delimited");
|
|
25265
25284
|
var NEW_COLUMN_TYPES = [
|
|
25266
25285
|
{ type: "text", words: "Text" },
|
|
25267
25286
|
{ type: "rich_text", words: "Formatted text" },
|
|
@@ -25358,7 +25377,7 @@ function specsFrom(text) {
|
|
|
25358
25377
|
let parts;
|
|
25359
25378
|
const firstLine = trimmed.split(/\r?\n/)[0];
|
|
25360
25379
|
if (firstLine.includes(" ")) {
|
|
25361
|
-
parts = (0,
|
|
25380
|
+
parts = (0, import_delimited4.parseDelimited)(trimmed, { delimiter: " ", strayQuotes: "literal" }).data[0] ?? [];
|
|
25362
25381
|
} else if (/\r?\n/.test(trimmed)) {
|
|
25363
25382
|
parts = trimmed.split(/\r?\n/).map((line) => line.replace(BULLET, ""));
|
|
25364
25383
|
} else {
|
|
@@ -29734,7 +29753,7 @@ var import_react183 = require("react");
|
|
|
29734
29753
|
var import_react184 = require("@ai-matrx/records/react");
|
|
29735
29754
|
var import_records47 = require("@ai-matrx/records");
|
|
29736
29755
|
var import_design_system93 = require("@ai-matrx/design-system");
|
|
29737
|
-
var
|
|
29756
|
+
var import_data_table20 = require("@ai-matrx/design-system/data-table");
|
|
29738
29757
|
var import_format6 = require("@ai-matrx/kit/format");
|
|
29739
29758
|
|
|
29740
29759
|
// src/recordMoves.tsx
|
|
@@ -29889,7 +29908,7 @@ var import_react171 = require("react");
|
|
|
29889
29908
|
var import_react172 = require("@ai-matrx/records/react");
|
|
29890
29909
|
var import_records46 = require("@ai-matrx/records");
|
|
29891
29910
|
var import_design_system88 = require("@ai-matrx/design-system");
|
|
29892
|
-
var
|
|
29911
|
+
var import_data_table15 = require("@ai-matrx/design-system/data-table");
|
|
29893
29912
|
|
|
29894
29913
|
// src/CardDates.tsx
|
|
29895
29914
|
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
@@ -30349,7 +30368,7 @@ function PipelineBoard({
|
|
|
30349
30368
|
const ordered = (definition?.stages ?? []).flatMap((stage) => cardsByStage.get(stage.key) ?? []);
|
|
30350
30369
|
const selectedInOrder = ordered.filter((r) => selected.has(r.id));
|
|
30351
30370
|
const select = (index, how) => {
|
|
30352
|
-
const { next, anchor: at } = (0,
|
|
30371
|
+
const { next, anchor: at } = (0, import_data_table15.toggleSelection)({
|
|
30353
30372
|
order: ordered,
|
|
30354
30373
|
idOf: (r) => r.id,
|
|
30355
30374
|
selected,
|
|
@@ -30726,7 +30745,7 @@ function PipelineCard({
|
|
|
30726
30745
|
dates
|
|
30727
30746
|
}) {
|
|
30728
30747
|
const labels = useRecordLabels(field2 ? [field2] : []);
|
|
30729
|
-
const color = style ? (0,
|
|
30748
|
+
const color = style ? (0, import_data_table15.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
|
|
30730
30749
|
const draggable = (0, import_react172.mayDrag)(record.level);
|
|
30731
30750
|
const { text: label, withheld } = cardWords(record, field2, labels);
|
|
30732
30751
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
|
|
@@ -30744,7 +30763,7 @@ function PipelineCard({
|
|
|
30744
30763
|
draggable ? "cursor-grab active:cursor-grabbing" : "",
|
|
30745
30764
|
dragging ? "opacity-50" : "",
|
|
30746
30765
|
// A selected card shows the selection, not its tint — the two never fight for one background.
|
|
30747
|
-
selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ?
|
|
30766
|
+
selected ? "border-primary bg-primary/10 ring-1 ring-primary" : color ? import_data_table15.ROW_TINT_CLASS[color] : ""
|
|
30748
30767
|
),
|
|
30749
30768
|
onClick: (e) => {
|
|
30750
30769
|
if (draggable && (e.shiftKey || e.metaKey || e.ctrlKey)) {
|
|
@@ -30902,11 +30921,11 @@ function CardFieldsInline({ row, fields }) {
|
|
|
30902
30921
|
var import_react174 = require("react");
|
|
30903
30922
|
var import_react175 = require("@ai-matrx/records/react");
|
|
30904
30923
|
var import_design_system89 = require("@ai-matrx/design-system");
|
|
30905
|
-
var
|
|
30924
|
+
var import_data_table17 = require("@ai-matrx/design-system/data-table");
|
|
30906
30925
|
|
|
30907
30926
|
// src/rowColorBy.tsx
|
|
30908
30927
|
var import_react173 = require("react");
|
|
30909
|
-
var
|
|
30928
|
+
var import_data_table16 = require("@ai-matrx/design-system/data-table");
|
|
30910
30929
|
function useRowColorBy(all, colorKey, style) {
|
|
30911
30930
|
const colorField = all.find((f) => f.key === colorKey);
|
|
30912
30931
|
const options = useChoiceOptions(all, colorField && isChoiceField(colorField) ? [colorField.key] : []);
|
|
@@ -30916,11 +30935,11 @@ function useRowColorBy(all, colorKey, style) {
|
|
|
30916
30935
|
return optionFor(options.get(key), first)?.color ?? (colorField ? storedChoiceColor(colorField, first) : void 0) ?? colorFromTheValue(key, first);
|
|
30917
30936
|
};
|
|
30918
30937
|
const effective = {
|
|
30919
|
-
...
|
|
30938
|
+
...import_data_table16.EMPTY_TABLE_STYLE,
|
|
30920
30939
|
...style ?? {},
|
|
30921
30940
|
...colorKey ? { colorBy: { field: colorKey, target: "row" } } : { colorBy: null }
|
|
30922
30941
|
};
|
|
30923
|
-
return (row) => (0,
|
|
30942
|
+
return (row) => (0, import_data_table16.resolveRowColor)(effective, { id: row.id, data: row.document ?? {} }, lookup);
|
|
30924
30943
|
}, [options, colorField, colorKey, style]);
|
|
30925
30944
|
}
|
|
30926
30945
|
|
|
@@ -31511,7 +31530,7 @@ function CalendarView({
|
|
|
31511
31530
|
className: (0, import_design_system89.cn)(
|
|
31512
31531
|
"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",
|
|
31513
31532
|
// The chip palette, not the faint row tint: a calendar is read by its colours at a glance.
|
|
31514
|
-
color ?
|
|
31533
|
+
color ? import_data_table17.CHOICE_CHIP_CLASS[color] : "bg-background",
|
|
31515
31534
|
may ? "cursor-grab active:cursor-grabbing" : "cursor-default",
|
|
31516
31535
|
className2
|
|
31517
31536
|
),
|
|
@@ -31927,7 +31946,7 @@ function weekHeading(first) {
|
|
|
31927
31946
|
var import_react176 = require("react");
|
|
31928
31947
|
var import_react177 = require("@ai-matrx/records/react");
|
|
31929
31948
|
var import_design_system90 = require("@ai-matrx/design-system");
|
|
31930
|
-
var
|
|
31949
|
+
var import_data_table18 = require("@ai-matrx/design-system/data-table");
|
|
31931
31950
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
31932
31951
|
var TIMELINE_ZOOMS = ["day", "week", "month", "quarter"];
|
|
31933
31952
|
var ZOOM_LABEL = { day: "Day", week: "Week", month: "Month", quarter: "Quarter" };
|
|
@@ -32360,7 +32379,7 @@ function TimelineView({
|
|
|
32360
32379
|
className: (0, import_design_system90.cn)(
|
|
32361
32380
|
"absolute flex select-none items-center gap-1 rounded border px-1.5 text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
32362
32381
|
outside ? "overflow-visible" : "overflow-hidden",
|
|
32363
|
-
color ?
|
|
32382
|
+
color ? import_data_table18.CHOICE_CHIP_CLASS[color] : "bg-muted",
|
|
32364
32383
|
may ? "cursor-grab active:cursor-grabbing" : "cursor-pointer",
|
|
32365
32384
|
dragging?.id === p.row.id ? "z-20 shadow-md" : "z-10",
|
|
32366
32385
|
refused ? "ring-2 ring-destructive" : void 0
|
|
@@ -32492,7 +32511,7 @@ function TimelineView({
|
|
|
32492
32511
|
type: "button",
|
|
32493
32512
|
className: (0, import_design_system90.cn)(
|
|
32494
32513
|
"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",
|
|
32495
|
-
color ?
|
|
32514
|
+
color ? import_data_table18.CHOICE_CHIP_CLASS[color] : "bg-background",
|
|
32496
32515
|
may ? "cursor-grab" : "cursor-default"
|
|
32497
32516
|
),
|
|
32498
32517
|
title: may ? `${titleOf(row)} \xB7 drag onto a day` : (0, import_react177.mayDrag)(row.level) ? WORKED_OUT_DATE_LOCK : whatYouMayDo(row.level ?? null).why("write"),
|
|
@@ -32549,7 +32568,7 @@ function TimelineView({
|
|
|
32549
32568
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
32550
32569
|
"span",
|
|
32551
32570
|
{
|
|
32552
|
-
className: (0, import_design_system90.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ?
|
|
32571
|
+
className: (0, import_design_system90.cn)("max-w-full truncate rounded px-1.5 py-0.5 text-xs font-medium", lane.color ? import_data_table18.CHOICE_CHIP_CLASS[lane.color] : void 0),
|
|
32553
32572
|
title: laneLocked ?? lane.label,
|
|
32554
32573
|
...laneLocked ? { "data-timeline-lane-locked": "" } : {},
|
|
32555
32574
|
children: lane.label
|
|
@@ -32763,7 +32782,7 @@ function FileCover({ recordId }) {
|
|
|
32763
32782
|
// src/ListView.tsx
|
|
32764
32783
|
var import_react182 = require("react");
|
|
32765
32784
|
var import_design_system92 = require("@ai-matrx/design-system");
|
|
32766
|
-
var
|
|
32785
|
+
var import_data_table19 = require("@ai-matrx/design-system/data-table");
|
|
32767
32786
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32768
32787
|
var LIST_DEFAULT_FIELDS = 4;
|
|
32769
32788
|
var NO_GROUP = "__none";
|
|
@@ -32905,7 +32924,7 @@ function ListRow({
|
|
|
32905
32924
|
const doc = row.document ?? {};
|
|
32906
32925
|
const filled = fields.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
|
|
32907
32926
|
const onRow = chose ? filled : filled.slice(0, LIST_DEFAULT_FIELDS);
|
|
32908
|
-
const color = style ? (0,
|
|
32927
|
+
const color = style ? (0, import_data_table19.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
|
|
32909
32928
|
const values = onRow.map((field2) => (
|
|
32910
32929
|
// ONE LINE PER VALUE (walk 2026-10-05): a multi-line caption drew as paragraphs, pushing the
|
|
32911
32930
|
// title to the row's foot. A list row is one line, as Notion's is; the record page has the rest.
|
|
@@ -32929,7 +32948,7 @@ function ListRow({
|
|
|
32929
32948
|
"data-records-list-row": row.id,
|
|
32930
32949
|
className: (0, import_design_system92.cn)(
|
|
32931
32950
|
"flex w-full min-w-0 items-center gap-3 rounded px-1 py-1 pr-7 text-left text-xs hover:bg-muted",
|
|
32932
|
-
color ?
|
|
32951
|
+
color ? import_data_table19.ROW_TINT_CLASS[color] : void 0
|
|
32933
32952
|
),
|
|
32934
32953
|
onClick: () => onOpenRecord?.(row.id),
|
|
32935
32954
|
title: withheld ?? title,
|
|
@@ -33456,7 +33475,7 @@ function Board({
|
|
|
33456
33475
|
onColorFieldChange: (key) => onChange({
|
|
33457
33476
|
presentation: {
|
|
33458
33477
|
...view.presentation,
|
|
33459
|
-
style: { ...
|
|
33478
|
+
style: { ...import_data_table20.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: key ? { field: key, target: "row" } : null }
|
|
33460
33479
|
}
|
|
33461
33480
|
}),
|
|
33462
33481
|
titleField,
|
|
@@ -33500,7 +33519,7 @@ function Board({
|
|
|
33500
33519
|
onChange({
|
|
33501
33520
|
presentation: {
|
|
33502
33521
|
...view.presentation,
|
|
33503
|
-
style: { ...
|
|
33522
|
+
style: { ...import_data_table20.EMPTY_TABLE_STYLE, ...view.presentation?.style ?? {}, colorBy: patch.colorKey ? { field: patch.colorKey, target: "row" } : null }
|
|
33504
33523
|
}
|
|
33505
33524
|
});
|
|
33506
33525
|
}
|
|
@@ -33778,7 +33797,7 @@ function Kanban({
|
|
|
33778
33797
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsxs)(
|
|
33779
33798
|
"header",
|
|
33780
33799
|
{
|
|
33781
|
-
className: (0, import_design_system93.cn)("flex items-center gap-2 border-b px-2 py-1 text-xs font-medium", columnColor(name) ?
|
|
33800
|
+
className: (0, import_design_system93.cn)("flex items-center gap-2 border-b px-2 py-1 text-xs font-medium", columnColor(name) ? import_data_table20.CHOICE_CHIP_CLASS[columnColor(name)] : void 0),
|
|
33782
33801
|
...columnColor(name) ? { "data-column-color": columnColor(name) } : {},
|
|
33783
33802
|
children: [
|
|
33784
33803
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { className: "truncate", children: name }),
|
|
@@ -33808,7 +33827,7 @@ function Kanban({
|
|
|
33808
33827
|
void move(card, name, to);
|
|
33809
33828
|
},
|
|
33810
33829
|
children: [
|
|
33811
|
-
columnColor(name) ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { "aria-hidden": "true", "data-card-accent": columnColor(name), className: (0, import_design_system93.cn)("absolute inset-y-0.5 left-0 w-1 rounded",
|
|
33830
|
+
columnColor(name) ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("span", { "aria-hidden": "true", "data-card-accent": columnColor(name), className: (0, import_design_system93.cn)("absolute inset-y-0.5 left-0 w-1 rounded", import_data_table20.SWATCH_CLASS[columnColor(name)]) }) : null,
|
|
33812
33831
|
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
33813
33832
|
RecordActionMenu,
|
|
33814
33833
|
{
|
|
@@ -33914,7 +33933,7 @@ function Gallery({
|
|
|
33914
33933
|
const doc = row.document ?? {};
|
|
33915
33934
|
const filled = shown4.filter((field2) => !isEmptyOnCard(doc[field2.key]) || withheldNoticeOf(row.hidden, field2.key));
|
|
33916
33935
|
const onCard = chose ? filled : filled.slice(0, GALLERY_DEFAULT_FIELDS);
|
|
33917
|
-
const rowColor = style ? (0,
|
|
33936
|
+
const rowColor = style ? (0, import_data_table20.resolveRowColor)(style, { id: row.id, data: row.document ?? {} }, colorFromTheValue) : null;
|
|
33918
33937
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)("li", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
33919
33938
|
MaybeRecordActionMenu,
|
|
33920
33939
|
{
|
|
@@ -33929,7 +33948,7 @@ function Gallery({
|
|
|
33929
33948
|
type: "button",
|
|
33930
33949
|
className: (0, import_design_system93.cn)(
|
|
33931
33950
|
"flex h-full w-full flex-col gap-1 rounded border p-2 pr-7 text-left hover:bg-muted",
|
|
33932
|
-
rowColor ?
|
|
33951
|
+
rowColor ? import_data_table20.ROW_TINT_CLASS[rowColor] : void 0
|
|
33933
33952
|
),
|
|
33934
33953
|
onClick: () => onOpenRecord?.(row.id),
|
|
33935
33954
|
children: [
|
|
@@ -34000,7 +34019,7 @@ function RecordCard({
|
|
|
34000
34019
|
);
|
|
34001
34020
|
const labels = useRecordLabels(wanted);
|
|
34002
34021
|
const { text: label, withheld } = cardWords(record, field2, labels);
|
|
34003
|
-
const color = style ? (0,
|
|
34022
|
+
const color = style ? (0, import_data_table20.resolveRowColor)(style, { id: record.id, data: record.document ?? {} }, colorFromTheValue) : null;
|
|
34004
34023
|
return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
34005
34024
|
"button",
|
|
34006
34025
|
{
|
|
@@ -34008,7 +34027,7 @@ function RecordCard({
|
|
|
34008
34027
|
className: (0, import_design_system93.cn)(
|
|
34009
34028
|
"w-full truncate rounded border bg-background px-2 py-1 text-left text-xs hover:bg-muted",
|
|
34010
34029
|
host.density === "spacious" ? "py-2" : "",
|
|
34011
|
-
color ?
|
|
34030
|
+
color ? import_data_table20.ROW_TINT_CLASS[color] : void 0
|
|
34012
34031
|
),
|
|
34013
34032
|
onClick: () => onOpenRecord?.(record.id),
|
|
34014
34033
|
title: withheld ?? label,
|
|
@@ -34850,7 +34869,7 @@ function ProposalRow({
|
|
|
34850
34869
|
var import_react197 = require("react");
|
|
34851
34870
|
var import_react198 = require("@ai-matrx/records/react");
|
|
34852
34871
|
var import_design_system99 = require("@ai-matrx/design-system");
|
|
34853
|
-
var
|
|
34872
|
+
var import_data_table21 = require("@ai-matrx/design-system/data-table");
|
|
34854
34873
|
var import_format7 = require("@ai-matrx/kit/format");
|
|
34855
34874
|
|
|
34856
34875
|
// src/ChecklistRunner.tsx
|
|
@@ -35917,7 +35936,7 @@ function ActionInbox({
|
|
|
35917
35936
|
);
|
|
35918
35937
|
const select = (0, import_react197.useCallback)(
|
|
35919
35938
|
(index, shift) => {
|
|
35920
|
-
const { next, anchor: at } = (0,
|
|
35939
|
+
const { next, anchor: at } = (0, import_data_table21.toggleSelection)({
|
|
35921
35940
|
order: shown4,
|
|
35922
35941
|
idOf: (i) => i.item_id,
|
|
35923
35942
|
selected,
|
|
@@ -37719,7 +37738,7 @@ var import_design_system106 = require("@ai-matrx/design-system");
|
|
|
37719
37738
|
// src/AccentSwatches.tsx
|
|
37720
37739
|
var import_records51 = require("@ai-matrx/records");
|
|
37721
37740
|
var import_design_system104 = require("@ai-matrx/design-system");
|
|
37722
|
-
var
|
|
37741
|
+
var import_data_table22 = require("@ai-matrx/design-system/data-table");
|
|
37723
37742
|
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
37724
37743
|
function AccentSwatches({ value, onChange, options = import_records51.PORTAL_ACCENTS, noneLabel = "App colour" }) {
|
|
37725
37744
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "flex flex-wrap gap-1.5", role: "radiogroup", "aria-label": "Colour", children: [
|
|
@@ -37743,10 +37762,10 @@ function AccentSwatches({ value, onChange, options = import_records51.PORTAL_ACC
|
|
|
37743
37762
|
type: "button",
|
|
37744
37763
|
role: "radio",
|
|
37745
37764
|
"aria-checked": value === c,
|
|
37746
|
-
"aria-label":
|
|
37747
|
-
title:
|
|
37765
|
+
"aria-label": import_data_table22.STYLE_COLOR_LABELS[c],
|
|
37766
|
+
title: import_data_table22.STYLE_COLOR_LABELS[c],
|
|
37748
37767
|
onClick: () => onChange(c),
|
|
37749
|
-
className: (0, import_design_system104.cn)("h-7 w-7 rounded-full border-2",
|
|
37768
|
+
className: (0, import_design_system104.cn)("h-7 w-7 rounded-full border-2", import_data_table22.SWATCH_CLASS[c], value === c ? "border-foreground" : "border-transparent")
|
|
37750
37769
|
},
|
|
37751
37770
|
c
|
|
37752
37771
|
))
|
|
@@ -38737,7 +38756,7 @@ function Invite({ card, onInvited }) {
|
|
|
38737
38756
|
|
|
38738
38757
|
// src/FormLookFrame.tsx
|
|
38739
38758
|
var import_design_system108 = require("@ai-matrx/design-system");
|
|
38740
|
-
var
|
|
38759
|
+
var import_data_table23 = require("@ai-matrx/design-system/data-table");
|
|
38741
38760
|
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
38742
38761
|
var ACCENT_PRIMARY = {
|
|
38743
38762
|
slate: "215 19% 35%",
|
|
@@ -38756,15 +38775,15 @@ function safeHref(url) {
|
|
|
38756
38775
|
return null;
|
|
38757
38776
|
}
|
|
38758
38777
|
function formLookView(style, fallbackName) {
|
|
38759
|
-
const accent = style?.accent && style.accent in
|
|
38778
|
+
const accent = style?.accent && style.accent in import_data_table23.SWATCH_CLASS ? style.accent : null;
|
|
38760
38779
|
const https = (u) => typeof u === "string" && /^https:\/\//i.test(u) ? u : null;
|
|
38761
38780
|
const links = Array.isArray(style?.footer_links) ? style.footer_links : [];
|
|
38762
38781
|
return {
|
|
38763
38782
|
name: (style?.display_name ?? "").trim() || fallbackName.trim() || "Form",
|
|
38764
38783
|
logoUrl: https(style?.logo_url),
|
|
38765
38784
|
coverUrl: https(style?.cover_url),
|
|
38766
|
-
bandClass: accent ?
|
|
38767
|
-
monogramClass: accent ? `${
|
|
38785
|
+
bandClass: accent ? import_data_table23.SWATCH_CLASS[accent] : null,
|
|
38786
|
+
monogramClass: accent ? `${import_data_table23.SWATCH_CLASS[accent]} text-white` : "bg-primary text-primary-foreground",
|
|
38768
38787
|
primaryVars: accent && ACCENT_PRIMARY[accent] ? {
|
|
38769
38788
|
"--primary": ACCENT_PRIMARY[accent],
|
|
38770
38789
|
"--primary-foreground": "0 0% 100%",
|
|
@@ -40900,6 +40919,18 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
|
|
|
40900
40919
|
onChange: (e) => patchQuestion(index, { help: e.target.value || null })
|
|
40901
40920
|
}
|
|
40902
40921
|
),
|
|
40922
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("label", { className: "col-span-2 flex items-center gap-2 text-xs", children: [
|
|
40923
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
40924
|
+
import_design_system115.Checkbox,
|
|
40925
|
+
{
|
|
40926
|
+
checked: field2.required ? true : question.required === true,
|
|
40927
|
+
disabled: field2.required === true,
|
|
40928
|
+
"aria-label": `${fieldName(field2)} is required`,
|
|
40929
|
+
onCheckedChange: (checked) => patchQuestion(index, { required: checked === true ? true : null })
|
|
40930
|
+
}
|
|
40931
|
+
),
|
|
40932
|
+
"Required"
|
|
40933
|
+
] }),
|
|
40903
40934
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
40904
40935
|
Condition,
|
|
40905
40936
|
{
|
|
@@ -41576,8 +41607,11 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
|
|
|
41576
41607
|
if (!element) return;
|
|
41577
41608
|
setBusy("pdf");
|
|
41578
41609
|
try {
|
|
41579
|
-
const {
|
|
41580
|
-
|
|
41610
|
+
const [{ documentToPdf }, { downloadFile: downloadFile3 }] = await Promise.all([
|
|
41611
|
+
import("@ai-matrx/alchemy/operate/capture"),
|
|
41612
|
+
import("@ai-matrx/kit/download")
|
|
41613
|
+
]);
|
|
41614
|
+
downloadFile3(`${filename ?? "document"}.pdf`, await documentToPdf(element), "application/pdf");
|
|
41581
41615
|
} catch (thrown) {
|
|
41582
41616
|
setError({
|
|
41583
41617
|
code: "internal",
|
|
@@ -47912,6 +47946,14 @@ function TablePage({
|
|
|
47912
47946
|
};
|
|
47913
47947
|
const show = (next) => press({ rail: next });
|
|
47914
47948
|
const layoutShowing = main !== "records" ? null : hostLayout ?? shownLayout;
|
|
47949
|
+
const rememberedFace = useRememberedLayout(embedded ? void 0 : tableId);
|
|
47950
|
+
const skeletonFace = skeletonLayoutFor(
|
|
47951
|
+
hostLayout ? "grid" : faceUnknown && !layoutFromLink ? rememberedFace ?? shownLayout : shownLayout
|
|
47952
|
+
);
|
|
47953
|
+
(0, import_react272.useEffect)(() => {
|
|
47954
|
+
if (embedded || faceUnknown || main !== "records" || opened.layout || !table.data) return;
|
|
47955
|
+
rememberLayout(tableId, hostLayout ? "grid" : shownLayout);
|
|
47956
|
+
}, [embedded, faceUnknown, main, hostLayout, shownLayout, tableId, table.data !== void 0]);
|
|
47915
47957
|
const shownReport = {
|
|
47916
47958
|
viewId: view?.id ?? null,
|
|
47917
47959
|
viewName: view?.name ?? null,
|
|
@@ -48387,7 +48429,7 @@ function TablePage({
|
|
|
48387
48429
|
if (table.loading && !table.data) {
|
|
48388
48430
|
return /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(import_jsx_runtime155.Fragment, { children: [
|
|
48389
48431
|
headerNode,
|
|
48390
|
-
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(TablePageSkeleton, { layout:
|
|
48432
|
+
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(TablePageSkeleton, { layout: skeletonFace, embedded, tableId, ...className ? { className } : {} })
|
|
48391
48433
|
] });
|
|
48392
48434
|
}
|
|
48393
48435
|
if (!table.data) {
|
|
@@ -48673,7 +48715,7 @@ function TablePage({
|
|
|
48673
48715
|
/* @__PURE__ */ (0, import_jsx_runtime155.jsx)(
|
|
48674
48716
|
RecordsSkeleton,
|
|
48675
48717
|
{
|
|
48676
|
-
layout:
|
|
48718
|
+
layout: skeletonFace,
|
|
48677
48719
|
embedded,
|
|
48678
48720
|
...embedded ? {} : { rows: rememberedRowCount(`${tableId}:page:last`, 100, "fill") }
|
|
48679
48721
|
}
|
|
@@ -48850,7 +48892,7 @@ function usePublicReadOnly(client, organizationId, tableId, table, rights) {
|
|
|
48850
48892
|
|
|
48851
48893
|
// src/entityViews.tsx
|
|
48852
48894
|
var import_design_system141 = require("@ai-matrx/design-system");
|
|
48853
|
-
var
|
|
48895
|
+
var import_data_table24 = require("@ai-matrx/design-system/data-table");
|
|
48854
48896
|
var import_react274 = require("react");
|
|
48855
48897
|
var import_design_system142 = require("@ai-matrx/design-system");
|
|
48856
48898
|
var import_react275 = require("@ai-matrx/records/react");
|
|
@@ -49095,7 +49137,7 @@ function EntityTablePageBody({
|
|
|
49095
49137
|
) }) }) : null,
|
|
49096
49138
|
/* @__PURE__ */ (0, import_jsx_runtime156.jsx)(EntityGrid, { entity, pageSize, embedded: presentation === "embedded", ...drill ? { drill } : {} }),
|
|
49097
49139
|
entity.hasMore ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)(
|
|
49098
|
-
|
|
49140
|
+
import_data_table24.MatrxTableCardShowMore,
|
|
49099
49141
|
{
|
|
49100
49142
|
shown: entity.rows.length,
|
|
49101
49143
|
total: entity.total ?? entity.rows.length + 1,
|