@ai-matrx/records-ui 0.110.4 → 0.110.5
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 +6 -0
- package/dist/first-page.cjs +74 -7
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.d.cts +13 -0
- package/dist/first-page.d.ts +13 -0
- package/dist/first-page.js +74 -7
- package/dist/first-page.js.map +1 -1
- package/dist/index.cjs +25 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -22
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -7439,6 +7439,21 @@ var import_react40 = require("react");
|
|
|
7439
7439
|
|
|
7440
7440
|
// src/firstPage.ts
|
|
7441
7441
|
var import_core6 = require("@ai-matrx/records/core");
|
|
7442
|
+
var import_uuid4 = require("@ai-matrx/kit/uuid");
|
|
7443
|
+
|
|
7444
|
+
// src/groupReads.ts
|
|
7445
|
+
function groupedPageSort(fields, groupKey, sort) {
|
|
7446
|
+
if (!groupKey) return sort;
|
|
7447
|
+
const field2 = fields.find((f) => f.key === groupKey);
|
|
7448
|
+
if (!field2) return sort;
|
|
7449
|
+
return [{ field: groupKey, direction: "asc", as: sortAsFor(field2) }, ...sort.filter((s) => s.field !== groupKey)];
|
|
7450
|
+
}
|
|
7451
|
+
function chosenEntries(chosen) {
|
|
7452
|
+
return JSON.parse(JSON.stringify(Object.entries(chosen).sort())).filter(([, op2]) => op2 in MEASURE_LABEL);
|
|
7453
|
+
}
|
|
7454
|
+
function groupFactMeasures(chosen) {
|
|
7455
|
+
return [{ op: "count" }, ...chosenEntries(chosen).filter(([, op2]) => op2 !== "count").map(([key, op2]) => ({ op: op2, key }))];
|
|
7456
|
+
}
|
|
7442
7457
|
|
|
7443
7458
|
// src/viewKeys.ts
|
|
7444
7459
|
var STORE_KEEPS_TIMELINE = true;
|
|
@@ -22469,12 +22484,6 @@ function groupValueKey(value) {
|
|
|
22469
22484
|
if (Array.isArray(value)) return value.length === 0 ? "" : JSON.stringify(value);
|
|
22470
22485
|
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
22471
22486
|
}
|
|
22472
|
-
function groupedPageSort(fields, groupKey, sort) {
|
|
22473
|
-
if (!groupKey) return sort;
|
|
22474
|
-
const field2 = fields.find((f) => f.key === groupKey);
|
|
22475
|
-
if (!field2) return sort;
|
|
22476
|
-
return [{ field: groupKey, direction: "asc", as: sortAsFor(field2) }, ...sort.filter((s) => s.field !== groupKey)];
|
|
22477
|
-
}
|
|
22478
22487
|
function useGroupFacts(args) {
|
|
22479
22488
|
const client = (0, import_react112.useRecordsClient)();
|
|
22480
22489
|
const { tableId, groupKey, version } = args;
|
|
@@ -22490,10 +22499,7 @@ function useGroupFacts(args) {
|
|
|
22490
22499
|
const entries = JSON.parse(chosenKey);
|
|
22491
22500
|
const asked3 = JSON.parse(filterKey);
|
|
22492
22501
|
const filter = Object.keys(asked3).length > 0 ? asked3 : void 0;
|
|
22493
|
-
const measures =
|
|
22494
|
-
{ op: "count" },
|
|
22495
|
-
...entries.filter(([, op2]) => op2 !== "count").map(([key, op2]) => ({ op: op2, key }))
|
|
22496
|
-
];
|
|
22502
|
+
const measures = groupFactMeasures(Object.fromEntries(entries));
|
|
22497
22503
|
let cancelled = false;
|
|
22498
22504
|
void client.recordAggregate({ table_id: tableId, groupBy: [groupKey], measures, limit: 1e3, ...filter ? { filter } : {} }).then((answered) => {
|
|
22499
22505
|
if (cancelled) return;
|
|
@@ -49919,7 +49925,7 @@ function useSlotScroll(slot) {
|
|
|
49919
49925
|
}
|
|
49920
49926
|
|
|
49921
49927
|
// src/TablePage.tsx
|
|
49922
|
-
var
|
|
49928
|
+
var import_uuid5 = require("@ai-matrx/kit/uuid");
|
|
49923
49929
|
var import_jsx_runtime158 = require("react/jsx-runtime");
|
|
49924
49930
|
var RAIL_TITLE = {
|
|
49925
49931
|
settings: "Table settings",
|
|
@@ -50141,7 +50147,7 @@ function openingView(activeView, activeDashboardId) {
|
|
|
50141
50147
|
}
|
|
50142
50148
|
function savedViewFromParam(activeView) {
|
|
50143
50149
|
const word = typeof activeView === "string" ? activeView.trim() : "";
|
|
50144
|
-
return (0,
|
|
50150
|
+
return (0, import_uuid5.isUuidShape)(word) ? word.toLowerCase() : null;
|
|
50145
50151
|
}
|
|
50146
50152
|
function addressForView(view, layout) {
|
|
50147
50153
|
return view && !view.isDefault ? view.id : layout;
|
|
@@ -50966,7 +50972,7 @@ function TablePage({
|
|
|
50966
50972
|
QuestionPanel,
|
|
50967
50973
|
{
|
|
50968
50974
|
tableId,
|
|
50969
|
-
activeQuestionId: questionsFromLink && activeItemId && (0,
|
|
50975
|
+
activeQuestionId: questionsFromLink && activeItemId && (0, import_uuid5.isUuidShape)(activeItemId) ? activeItemId : null,
|
|
50970
50976
|
draft: questionDraft
|
|
50971
50977
|
}
|
|
50972
50978
|
) : main === "archived" ? (
|
|
@@ -51299,15 +51305,13 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
51299
51305
|
const question = entityChartQuestion({ by, measure, where, organization });
|
|
51300
51306
|
const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
|
|
51301
51307
|
const base = { title: title ?? "", kind, measures, group_by: by ? [by] : [] };
|
|
51302
|
-
const seeded = (0, import_react287.
|
|
51303
|
-
const [block, setBlock] = (0, import_react286.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded }, base, by) : null);
|
|
51304
|
-
const
|
|
51308
|
+
const seeded = (0, import_react287.useSeededAnswerAt)(`entity-chart:${ask}`, (c) => c.drillAsk({ source, question }));
|
|
51309
|
+
const [block, setBlock] = (0, import_react286.useState)(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
51310
|
+
const seededFor = (0, import_react286.useRef)(seeded ? { ask: `${ask}|${kind}|${title ?? ""}`, at: seeded.at } : null);
|
|
51305
51311
|
(0, import_react286.useEffect)(() => {
|
|
51306
|
-
|
|
51307
|
-
|
|
51308
|
-
|
|
51309
|
-
}
|
|
51310
|
-
firstRead.current = false;
|
|
51312
|
+
const held = seededFor.current;
|
|
51313
|
+
if (held && held.ask === `${ask}|${kind}|${title ?? ""}` && Date.now() - held.at < import_react287.SEED_FRESH_MS) return;
|
|
51314
|
+
seededFor.current = null;
|
|
51311
51315
|
let cancelled = false;
|
|
51312
51316
|
void client.drillAsk({ source, question }).then((answer) => {
|
|
51313
51317
|
if (cancelled) return;
|