@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.js
CHANGED
|
@@ -6880,6 +6880,21 @@ import { createContext as createContext5, useContext as useContext5 } from "reac
|
|
|
6880
6880
|
|
|
6881
6881
|
// src/firstPage.ts
|
|
6882
6882
|
import { asRecordsDataSource as asRecordsDataSource2, createRecordsClient, recordingDataSource } from "@ai-matrx/records/core";
|
|
6883
|
+
import { isUuidShape as isUuidShape4 } from "@ai-matrx/kit/uuid";
|
|
6884
|
+
|
|
6885
|
+
// src/groupReads.ts
|
|
6886
|
+
function groupedPageSort(fields, groupKey, sort) {
|
|
6887
|
+
if (!groupKey) return sort;
|
|
6888
|
+
const field2 = fields.find((f) => f.key === groupKey);
|
|
6889
|
+
if (!field2) return sort;
|
|
6890
|
+
return [{ field: groupKey, direction: "asc", as: sortAsFor(field2) }, ...sort.filter((s) => s.field !== groupKey)];
|
|
6891
|
+
}
|
|
6892
|
+
function chosenEntries(chosen) {
|
|
6893
|
+
return JSON.parse(JSON.stringify(Object.entries(chosen).sort())).filter(([, op2]) => op2 in MEASURE_LABEL);
|
|
6894
|
+
}
|
|
6895
|
+
function groupFactMeasures(chosen) {
|
|
6896
|
+
return [{ op: "count" }, ...chosenEntries(chosen).filter(([, op2]) => op2 !== "count").map(([key, op2]) => ({ op: op2, key }))];
|
|
6897
|
+
}
|
|
6883
6898
|
|
|
6884
6899
|
// src/viewKeys.ts
|
|
6885
6900
|
var STORE_KEEPS_TIMELINE = true;
|
|
@@ -22132,12 +22147,6 @@ function groupValueKey(value) {
|
|
|
22132
22147
|
if (Array.isArray(value)) return value.length === 0 ? "" : JSON.stringify(value);
|
|
22133
22148
|
return typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
22134
22149
|
}
|
|
22135
|
-
function groupedPageSort(fields, groupKey, sort) {
|
|
22136
|
-
if (!groupKey) return sort;
|
|
22137
|
-
const field2 = fields.find((f) => f.key === groupKey);
|
|
22138
|
-
if (!field2) return sort;
|
|
22139
|
-
return [{ field: groupKey, direction: "asc", as: sortAsFor(field2) }, ...sort.filter((s) => s.field !== groupKey)];
|
|
22140
|
-
}
|
|
22141
22150
|
function useGroupFacts(args) {
|
|
22142
22151
|
const client = useRecordsClient35();
|
|
22143
22152
|
const { tableId, groupKey, version } = args;
|
|
@@ -22153,10 +22162,7 @@ function useGroupFacts(args) {
|
|
|
22153
22162
|
const entries = JSON.parse(chosenKey);
|
|
22154
22163
|
const asked3 = JSON.parse(filterKey);
|
|
22155
22164
|
const filter = Object.keys(asked3).length > 0 ? asked3 : void 0;
|
|
22156
|
-
const measures =
|
|
22157
|
-
{ op: "count" },
|
|
22158
|
-
...entries.filter(([, op2]) => op2 !== "count").map(([key, op2]) => ({ op: op2, key }))
|
|
22159
|
-
];
|
|
22165
|
+
const measures = groupFactMeasures(Object.fromEntries(entries));
|
|
22160
22166
|
let cancelled = false;
|
|
22161
22167
|
void client.recordAggregate({ table_id: tableId, groupBy: [groupKey], measures, limit: 1e3, ...filter ? { filter } : {} }).then((answered) => {
|
|
22162
22168
|
if (cancelled) return;
|
|
@@ -49827,7 +49833,7 @@ function useSlotScroll(slot) {
|
|
|
49827
49833
|
}
|
|
49828
49834
|
|
|
49829
49835
|
// src/TablePage.tsx
|
|
49830
|
-
import { isUuidShape as
|
|
49836
|
+
import { isUuidShape as isUuidShape5 } from "@ai-matrx/kit/uuid";
|
|
49831
49837
|
import { Fragment as Fragment66, jsx as jsx158, jsxs as jsxs147 } from "react/jsx-runtime";
|
|
49832
49838
|
var RAIL_TITLE = {
|
|
49833
49839
|
settings: "Table settings",
|
|
@@ -50049,7 +50055,7 @@ function openingView(activeView, activeDashboardId) {
|
|
|
50049
50055
|
}
|
|
50050
50056
|
function savedViewFromParam(activeView) {
|
|
50051
50057
|
const word = typeof activeView === "string" ? activeView.trim() : "";
|
|
50052
|
-
return
|
|
50058
|
+
return isUuidShape5(word) ? word.toLowerCase() : null;
|
|
50053
50059
|
}
|
|
50054
50060
|
function addressForView(view, layout) {
|
|
50055
50061
|
return view && !view.isDefault ? view.id : layout;
|
|
@@ -50874,7 +50880,7 @@ function TablePage({
|
|
|
50874
50880
|
QuestionPanel,
|
|
50875
50881
|
{
|
|
50876
50882
|
tableId,
|
|
50877
|
-
activeQuestionId: questionsFromLink && activeItemId &&
|
|
50883
|
+
activeQuestionId: questionsFromLink && activeItemId && isUuidShape5(activeItemId) ? activeItemId : null,
|
|
50878
50884
|
draft: questionDraft
|
|
50879
50885
|
}
|
|
50880
50886
|
) : main === "archived" ? (
|
|
@@ -51104,7 +51110,7 @@ import { TapTargetSearchGroup as TapTargetSearchGroup2, TooltipProvider } from "
|
|
|
51104
51110
|
import { MatrxTableCardShowMore as MatrxTableCardShowMore3 } from "@ai-matrx/design-system/data-table";
|
|
51105
51111
|
import { useEffect as useEffect116, useMemo as useMemo79, useRef as useRef65, useState as useState136 } from "react";
|
|
51106
51112
|
import { Button as Button108, ErrorBox as ErrorBox9, Input as Input12, cn as cn95 } from "@ai-matrx/design-system";
|
|
51107
|
-
import { useRecordsClient as useRecordsClient98,
|
|
51113
|
+
import { SEED_FRESH_MS, useRecordsClient as useRecordsClient98, useSeededAnswerAt } from "@ai-matrx/records/react";
|
|
51108
51114
|
import { Fragment as Fragment67, jsx as jsx159, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
51109
51115
|
var entityTitleColumn = entityNameColumn;
|
|
51110
51116
|
function shown3(v) {
|
|
@@ -51207,15 +51213,13 @@ function EntityChartBlock({ source, kind, by, measure, title, where, organizatio
|
|
|
51207
51213
|
const question = entityChartQuestion({ by, measure, where, organization });
|
|
51208
51214
|
const measures = [m.op === "count" ? { op: "count" } : { op: m.op, key: m.of }];
|
|
51209
51215
|
const base = { title: title ?? "", kind, measures, group_by: by ? [by] : [] };
|
|
51210
|
-
const seeded =
|
|
51211
|
-
const [block, setBlock] = useState136(() => seeded ? blockOfAnswer({ ok: true, data: seeded }, base, by) : null);
|
|
51212
|
-
const
|
|
51216
|
+
const seeded = useSeededAnswerAt(`entity-chart:${ask}`, (c) => c.drillAsk({ source, question }));
|
|
51217
|
+
const [block, setBlock] = useState136(() => seeded ? blockOfAnswer({ ok: true, data: seeded.data }, base, by) : null);
|
|
51218
|
+
const seededFor = useRef65(seeded ? { ask: `${ask}|${kind}|${title ?? ""}`, at: seeded.at } : null);
|
|
51213
51219
|
useEffect116(() => {
|
|
51214
|
-
|
|
51215
|
-
|
|
51216
|
-
|
|
51217
|
-
}
|
|
51218
|
-
firstRead.current = false;
|
|
51220
|
+
const held = seededFor.current;
|
|
51221
|
+
if (held && held.ask === `${ask}|${kind}|${title ?? ""}` && Date.now() - held.at < SEED_FRESH_MS) return;
|
|
51222
|
+
seededFor.current = null;
|
|
51219
51223
|
let cancelled = false;
|
|
51220
51224
|
void client.drillAsk({ source, question }).then((answer) => {
|
|
51221
51225
|
if (cancelled) return;
|