@ai-matrx/records-ui 0.116.54 → 0.116.56
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 +10 -1
- package/dist/index.cjs +41 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +41 -10
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -2509,6 +2509,13 @@ interface ViewReading {
|
|
|
2509
2509
|
presentation?: GridPresentation | undefined;
|
|
2510
2510
|
/** A hand-ordered view with no sort is read by its own id (the store places its rows). */
|
|
2511
2511
|
viewId?: string | null | undefined;
|
|
2512
|
+
/**
|
|
2513
|
+
* What the person has done in THE GRID on top of the view: the column filters she set in the header
|
|
2514
|
+
* menus and the words in the search box. The grid asks the store with them, so the file does too
|
|
2515
|
+
* (AT-FIX-I: a file listed rows the grid had filtered out).
|
|
2516
|
+
*/
|
|
2517
|
+
columnFilters?: Record<string, unknown> | undefined;
|
|
2518
|
+
search?: string | undefined;
|
|
2512
2519
|
}
|
|
2513
2520
|
|
|
2514
2521
|
/**
|
|
@@ -6318,7 +6325,7 @@ interface CaptureRunProps {
|
|
|
6318
6325
|
className?: string | undefined;
|
|
6319
6326
|
}
|
|
6320
6327
|
/** What control one question gets. `attachment` is why a phone opens its camera. */
|
|
6321
|
-
declare function controlFor(field: CaptureField | undefined): "photo" | "voice" | "number" | "text";
|
|
6328
|
+
declare function controlFor(field: CaptureField | undefined): "photo" | "voice" | "number" | "text" | "paragraph";
|
|
6322
6329
|
declare function CaptureRun({ sheetId, face: given, className }: CaptureRunProps): react.JSX.Element;
|
|
6323
6330
|
|
|
6324
6331
|
interface PortalShellProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -2509,6 +2509,13 @@ interface ViewReading {
|
|
|
2509
2509
|
presentation?: GridPresentation | undefined;
|
|
2510
2510
|
/** A hand-ordered view with no sort is read by its own id (the store places its rows). */
|
|
2511
2511
|
viewId?: string | null | undefined;
|
|
2512
|
+
/**
|
|
2513
|
+
* What the person has done in THE GRID on top of the view: the column filters she set in the header
|
|
2514
|
+
* menus and the words in the search box. The grid asks the store with them, so the file does too
|
|
2515
|
+
* (AT-FIX-I: a file listed rows the grid had filtered out).
|
|
2516
|
+
*/
|
|
2517
|
+
columnFilters?: Record<string, unknown> | undefined;
|
|
2518
|
+
search?: string | undefined;
|
|
2512
2519
|
}
|
|
2513
2520
|
|
|
2514
2521
|
/**
|
|
@@ -6318,7 +6325,7 @@ interface CaptureRunProps {
|
|
|
6318
6325
|
className?: string | undefined;
|
|
6319
6326
|
}
|
|
6320
6327
|
/** What control one question gets. `attachment` is why a phone opens its camera. */
|
|
6321
|
-
declare function controlFor(field: CaptureField | undefined): "photo" | "voice" | "number" | "text";
|
|
6328
|
+
declare function controlFor(field: CaptureField | undefined): "photo" | "voice" | "number" | "text" | "paragraph";
|
|
6322
6329
|
declare function CaptureRun({ sheetId, face: given, className }: CaptureRunProps): react.JSX.Element;
|
|
6323
6330
|
|
|
6324
6331
|
interface PortalShellProps {
|
package/dist/index.js
CHANGED
|
@@ -18276,14 +18276,16 @@ function viewPageSorts(fields, sorts) {
|
|
|
18276
18276
|
}
|
|
18277
18277
|
async function readViewRows(client, tableId, fields, view, ceiling = VIEW_EXPORT_CEILING) {
|
|
18278
18278
|
const sort = viewPageSorts(fields, view.sorts);
|
|
18279
|
+
const asked2 = storeQuestion(fields, view.filter ?? void 0, view.columnFilters ?? {}).filter;
|
|
18280
|
+
const search = view.search?.trim() ? view.search.trim() : null;
|
|
18279
18281
|
const rows = [];
|
|
18280
18282
|
let physicalOffset = 0;
|
|
18281
18283
|
for (; ; ) {
|
|
18282
18284
|
const limit = VIEW_EXPORT_PAGE;
|
|
18283
18285
|
const answered = await client.listPage({
|
|
18284
18286
|
table_id: tableId,
|
|
18285
|
-
...
|
|
18286
|
-
search
|
|
18287
|
+
...asked2 ? { filter: asked2 } : {},
|
|
18288
|
+
search,
|
|
18287
18289
|
sort,
|
|
18288
18290
|
view_id: sort.length === 0 && view.viewId ? view.viewId : null,
|
|
18289
18291
|
limit,
|
|
@@ -18365,7 +18367,7 @@ function ExportMenu({ tableId, rows, label, className, view }) {
|
|
|
18365
18367
|
const host = useRecordsUi();
|
|
18366
18368
|
const fields = useFields17(tableId);
|
|
18367
18369
|
const page = useRecords4(view ? null : tableId, { pageSize: 500 });
|
|
18368
|
-
const viewKey = view ? JSON.stringify([view.filter ?? null, view.sorts ?? [], view.viewId ?? null]) : "";
|
|
18370
|
+
const viewKey = view ? JSON.stringify([view.filter ?? null, view.sorts ?? [], view.viewId ?? null, view.columnFilters ?? null, view.search ?? null]) : "";
|
|
18369
18371
|
const [viewRead, setViewRead] = useState57(null);
|
|
18370
18372
|
useEffect49(() => {
|
|
18371
18373
|
if (!view || !fields.data) return;
|
|
@@ -18817,7 +18819,7 @@ function StageRulesSection({ tableId, stage, className }) {
|
|
|
18817
18819
|
{
|
|
18818
18820
|
lead: "it cannot get here unless",
|
|
18819
18821
|
emptyLabel: "\u2014 pick a column \u2014",
|
|
18820
|
-
expr: draft.demands
|
|
18822
|
+
expr: draft.demands && Object.keys(draft.demands).length > 0 ? draft.demands : null,
|
|
18821
18823
|
fields: conditionFields,
|
|
18822
18824
|
onChange: (next) => setDraft({ ...draft, demands: next ?? {} })
|
|
18823
18825
|
}
|
|
@@ -38349,8 +38351,16 @@ function controlFor(field) {
|
|
|
38349
38351
|
if (field.type === "range" || field.parity_type === "currency" || field.parity_type === "percent") {
|
|
38350
38352
|
return "number";
|
|
38351
38353
|
}
|
|
38354
|
+
const config = field.config;
|
|
38355
|
+
if (field.type === "long_text" || field.format === "long" || config?.multiline === true) return "paragraph";
|
|
38352
38356
|
return "text";
|
|
38353
38357
|
}
|
|
38358
|
+
function askFor(question, field) {
|
|
38359
|
+
const own = question.ask?.trim();
|
|
38360
|
+
if (own) return own;
|
|
38361
|
+
const label = field?.label?.trim();
|
|
38362
|
+
return label ? label : question.field;
|
|
38363
|
+
}
|
|
38354
38364
|
function deviceName() {
|
|
38355
38365
|
const nav = globalThis.navigator;
|
|
38356
38366
|
if (!nav?.userAgent) return "unknown device";
|
|
@@ -38442,10 +38452,13 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38442
38452
|
}, [client, given, sheetId]);
|
|
38443
38453
|
const questions = useMemo67(() => {
|
|
38444
38454
|
const asked2 = face?.presentation?.questions ?? [];
|
|
38445
|
-
|
|
38446
|
-
|
|
38455
|
+
const fields = face?.fields ?? [];
|
|
38456
|
+
if (asked2.length > 0) {
|
|
38457
|
+
return asked2.map((x) => ({ ...x, ask: askFor(x, fields.find((f) => f.key === x.field)) }));
|
|
38458
|
+
}
|
|
38459
|
+
return fields.map((f) => ({
|
|
38447
38460
|
field: f.key,
|
|
38448
|
-
ask:
|
|
38461
|
+
ask: askFor({ field: f.key }, f),
|
|
38449
38462
|
help: null,
|
|
38450
38463
|
required: f.required
|
|
38451
38464
|
}));
|
|
@@ -38666,13 +38679,26 @@ function CaptureRun({ sheetId, face: given, className }) {
|
|
|
38666
38679
|
setMissing(null);
|
|
38667
38680
|
}
|
|
38668
38681
|
}
|
|
38682
|
+
) : control === "text" ? /* @__PURE__ */ jsx119(
|
|
38683
|
+
Input7,
|
|
38684
|
+
{
|
|
38685
|
+
id: `capture-${q.field}`,
|
|
38686
|
+
"data-testid": `capture-input-${q.field}`,
|
|
38687
|
+
"aria-label": q.ask ?? q.field,
|
|
38688
|
+
className: "h-14 text-lg",
|
|
38689
|
+
value: String(answers[q.field] ?? ""),
|
|
38690
|
+
onChange: (e) => {
|
|
38691
|
+
setAnswers((held) => ({ ...held, [q.field]: e.target.value }));
|
|
38692
|
+
setMissing(null);
|
|
38693
|
+
}
|
|
38694
|
+
}
|
|
38669
38695
|
) : /* @__PURE__ */ jsx119(
|
|
38670
38696
|
Textarea6,
|
|
38671
38697
|
{
|
|
38672
38698
|
id: `capture-${q.field}`,
|
|
38673
38699
|
"data-testid": `capture-input-${q.field}`,
|
|
38674
38700
|
"aria-label": q.ask ?? q.field,
|
|
38675
|
-
rows:
|
|
38701
|
+
rows: 3,
|
|
38676
38702
|
className: "min-h-12 text-lg",
|
|
38677
38703
|
value: String(answers[q.field] ?? ""),
|
|
38678
38704
|
onChange: (e) => {
|
|
@@ -41169,11 +41195,16 @@ function TablePage({
|
|
|
41169
41195
|
};
|
|
41170
41196
|
const actionOrigin = actionHost?.origin ?? (typeof window !== "undefined" ? window.location.origin : void 0);
|
|
41171
41197
|
const makeDefaultReason = !view ? "No saved view yet" : layoutShowing !== null && layoutShowing === opensAs ? "Already the default" : "This layout can't be the default";
|
|
41198
|
+
const tableSort = defaultSortOf(table.data, allFields.data ?? []);
|
|
41199
|
+
const shownSorts = gridQuery?.sort ? [{ field: gridQuery.sort.field, direction: gridQuery.sort.direction }] : shown4?.sorts && shown4.sorts.length > 0 ? shown4.sorts : shown4?.order !== "manual" && tableSort ? [{ field: tableSort.id, direction: tableSort.direction }] : shown4?.sorts;
|
|
41172
41200
|
const viewReading = {
|
|
41173
41201
|
filter: shownFilter,
|
|
41174
|
-
sorts:
|
|
41202
|
+
sorts: shownSorts,
|
|
41175
41203
|
presentation: shown4?.presentation,
|
|
41176
|
-
viewId: shown4?.order === "manual" ? shown4?.id ?? null : null
|
|
41204
|
+
viewId: shown4?.order === "manual" ? shown4?.id ?? null : null,
|
|
41205
|
+
// What she did in the grid over the view: header-menu column filters and the search box.
|
|
41206
|
+
columnFilters: gridQuery?.filters,
|
|
41207
|
+
search: gridQuery?.search
|
|
41177
41208
|
};
|
|
41178
41209
|
const subItemsLink = subItemsField(allFields.data, tableId);
|
|
41179
41210
|
const subItemsOn = subItemsLink !== null;
|