@ai-matrx/records-ui 0.108.0 → 0.109.4
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 +41 -0
- package/dist/first-page.cjs +54 -106
- package/dist/first-page.cjs.map +1 -1
- package/dist/first-page.d.cts +291 -6
- package/dist/first-page.d.ts +291 -6
- package/dist/first-page.js +44 -89
- package/dist/first-page.js.map +1 -1
- package/dist/index.cjs +3658 -3465
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +603 -99
- package/dist/index.d.ts +603 -99
- package/dist/index.js +4381 -4190
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs +1 -0
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +2 -3
- package/dist/pickers.js.map +1 -1
- package/package.json +20 -5
- package/dist/views-VPwb3QQk.d.cts +0 -505
- package/dist/views-VPwb3QQk.d.ts +0 -505
package/dist/first-page.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import { recordingDataSource, asRecordsDataSource, createRecordsClient } from '@ai-matrx/records/core';
|
|
2
|
+
import { PARITY_FIELD_TYPES, KERNEL_TABLES, fieldKindFor } from '@ai-matrx/records';
|
|
3
|
+
import '@ai-matrx/kit/text-case';
|
|
4
|
+
import '@ai-matrx/design-system/data-table';
|
|
5
|
+
import { parseTableStyle, tableStyleIsEmpty } from '@ai-matrx/design-system/data-table/table-style';
|
|
6
|
+
import '@ai-matrx/design-system/field-formats';
|
|
2
7
|
|
|
3
|
-
// src/
|
|
4
|
-
import {
|
|
5
|
-
KERNEL_TABLES,
|
|
6
|
-
PARITY_FIELD_TYPES,
|
|
7
|
-
fieldKindFor,
|
|
8
|
-
newerKindOf
|
|
9
|
-
} from "@ai-matrx/records";
|
|
10
|
-
import { humanizeIdentifier } from "@ai-matrx/kit/text-case";
|
|
8
|
+
// src/firstPage.ts
|
|
11
9
|
var kernelId = (name) => KERNEL_TABLES.find((t) => t.name === name)?.id ?? "";
|
|
12
10
|
var KERNEL_FILE_TABLE = kernelId("File");
|
|
13
11
|
var KERNEL_PERSON_TABLE = kernelId("Person");
|
|
14
|
-
|
|
12
|
+
Object.fromEntries(
|
|
15
13
|
PARITY_FIELD_TYPES.map((p) => [p.parity_type, p.made_of])
|
|
16
14
|
);
|
|
17
15
|
var KERNEL = { file: KERNEL_FILE_TABLE, person: KERNEL_PERSON_TABLE };
|
|
@@ -46,10 +44,6 @@ function defaultSortOf(table, fields) {
|
|
|
46
44
|
const field = fields.find((f) => f.key === name) ?? fields.find((f) => f.id === name);
|
|
47
45
|
return field ? { id: field.key, direction } : null;
|
|
48
46
|
}
|
|
49
|
-
|
|
50
|
-
// src/gridPage.ts
|
|
51
|
-
import { isRuleFilter } from "@ai-matrx/records";
|
|
52
|
-
import { dateFilterBounds, dateFilterDayBounds } from "@ai-matrx/design-system/data-table";
|
|
53
47
|
function holdsNumbers(field) {
|
|
54
48
|
const kind = String(editorKindFor(field));
|
|
55
49
|
if (kind === "number" || kind === "currency" || kind === "percent") return true;
|
|
@@ -67,15 +61,6 @@ function pageSortFor(fields, sort) {
|
|
|
67
61
|
if (!field) return [];
|
|
68
62
|
return [{ field: field.key, direction: sort.direction === "desc" ? "desc" : "asc", as: sortAsFor(field) }];
|
|
69
63
|
}
|
|
70
|
-
|
|
71
|
-
// src/presentation.ts
|
|
72
|
-
import {
|
|
73
|
-
COLOR_ROTATION,
|
|
74
|
-
parseTableStyle,
|
|
75
|
-
tableStyleIsEmpty
|
|
76
|
-
} from "@ai-matrx/design-system/data-table";
|
|
77
|
-
import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
|
|
78
|
-
import { newerKindOf as newerKindOf2, ratingMaxOf } from "@ai-matrx/records";
|
|
79
64
|
var MIN_ROW_HEIGHT = 24;
|
|
80
65
|
var MAX_ROW_HEIGHT = 96;
|
|
81
66
|
var AGGREGATE_KINDS = [
|
|
@@ -243,53 +228,7 @@ function parseGrouping(raw) {
|
|
|
243
228
|
}
|
|
244
229
|
return out;
|
|
245
230
|
}
|
|
246
|
-
|
|
247
|
-
// src/viewKeys.ts
|
|
248
|
-
var STORE_KEEPS_TIMELINE = true;
|
|
249
|
-
var ALL = ["grid", "kanban", "calendar", "gallery", ...STORE_KEEPS_TIMELINE ? ["timeline"] : [], "list"];
|
|
250
|
-
var HIDES = ["grid", "gallery", "kanban", "calendar", ...STORE_KEEPS_TIMELINE ? ["timeline"] : [], "list"];
|
|
251
|
-
var GRIDS = ["grid"];
|
|
252
|
-
var VIEW_KEYS = [
|
|
253
|
-
{ path: "layout", shape: "kind", layouts: ALL, writer: "caller" },
|
|
254
|
-
{ path: "filters", shape: "filter", layouts: ALL, writer: "caller" },
|
|
255
|
-
{ path: "where", shape: "rule", layouts: ALL, writer: "caller" },
|
|
256
|
-
{ path: "group_field", shape: "field", layouts: ["kanban", ...STORE_KEEPS_TIMELINE ? ["timeline"] : []], writer: "caller" },
|
|
257
|
-
{ path: "swimlane_field", shape: "field:lane", layouts: ["kanban"], writer: "caller" },
|
|
258
|
-
{ path: "collapsed_columns", shape: "values", layouts: ["kanban"], writer: "caller" },
|
|
259
|
-
{ path: "measure", shape: "field:number", layouts: ["kanban"], writer: "caller" },
|
|
260
|
-
{ path: "date_field", shape: "field:date", layouts: ["calendar"], writer: "caller" },
|
|
261
|
-
...STORE_KEEPS_TIMELINE ? [
|
|
262
|
-
{ path: "start_field", shape: "field:date", layouts: ["timeline"], writer: "caller" },
|
|
263
|
-
{ path: "end_field", shape: "field:date", layouts: ["calendar", "timeline"], writer: "caller" }
|
|
264
|
-
] : [],
|
|
265
|
-
{ path: "image_field", shape: "field", layouts: ["gallery"], writer: "caller" },
|
|
266
|
-
{ path: "sorts", shape: "sorts", layouts: ALL, writer: "caller" },
|
|
267
|
-
{ path: "rule_id", shape: "uuid", layouts: ALL, writer: "caller" },
|
|
268
|
-
{ path: "is_default", shape: "boolean", layouts: ALL, writer: "caller" },
|
|
269
|
-
{ path: "presentation", shape: "presentation", layouts: ALL, writer: "caller" },
|
|
270
|
-
{ path: "presentation.style", shape: "style", layouts: ALL, writer: "caller" },
|
|
271
|
-
{ path: "presentation.formats", shape: "object", layouts: GRIDS, writer: "caller" },
|
|
272
|
-
{ path: "presentation.frozen", shape: "fields", layouts: GRIDS, writer: "caller" },
|
|
273
|
-
{ path: "presentation.grouping", shape: "grouping", layouts: ["grid", "gallery", "list"], writer: "caller" },
|
|
274
|
-
{ path: "presentation.widths", shape: "widths", layouts: GRIDS, writer: "caller" },
|
|
275
|
-
{ path: "presentation.rowHeight", shape: "row_height", layouts: GRIDS, writer: "caller" },
|
|
276
|
-
{ path: "presentation.hiddenFields", shape: "fields", layouts: HIDES, writer: "caller" },
|
|
277
|
-
{ path: "presentation.cardHidden", shape: "fields", layouts: ["kanban", "calendar", ...STORE_KEEPS_TIMELINE ? ["timeline"] : [], "list", "gallery"], writer: "caller" },
|
|
278
|
-
{ path: "presentation.columnOrder", shape: "fields", layouts: GRIDS, writer: "caller" },
|
|
279
|
-
{ path: "presentation.gallerySize", shape: "gallery_size", layouts: ["gallery"], writer: "caller" },
|
|
280
|
-
{ path: "presentation.wrap", shape: "boolean", layouts: GRIDS, writer: "caller" },
|
|
281
|
-
{ path: "presentation.wrapColumns", shape: "fields", layouts: GRIDS, writer: "caller" },
|
|
282
|
-
{ path: "presentation.fit", shape: "fit", layouts: GRIDS, writer: "caller" },
|
|
283
|
-
{ path: "presentation.freezeFirst", shape: "boolean", layouts: GRIDS, writer: "caller" },
|
|
284
|
-
{ path: "presentation.footer", shape: "footer", layouts: GRIDS, writer: "caller" },
|
|
285
|
-
{ path: "presentation.summaries", shape: "summaries", layouts: GRIDS, writer: "caller" },
|
|
286
|
-
{ path: "grid", shape: "grid", layouts: GRIDS, writer: "caller" },
|
|
287
|
-
{ path: "hidden_fields", shape: "input", layouts: HIDES, writer: "input" },
|
|
288
|
-
{ path: "table_id", shape: "server", layouts: ALL, writer: "server" },
|
|
289
|
-
{ path: "order", shape: "server", layouts: GRIDS, writer: "server" },
|
|
290
|
-
{ path: "moved_from", shape: "server", layouts: ALL, writer: "server" }
|
|
291
|
-
];
|
|
292
|
-
var STORE_KEPT_LAYOUTS = ["grid", "kanban", "calendar", "gallery", ...STORE_KEEPS_TIMELINE ? ["timeline"] : [], "list"];
|
|
231
|
+
var STORE_KEPT_LAYOUTS = ["grid", "kanban", "calendar", "gallery", ...["timeline"] , "list"];
|
|
293
232
|
var KINDS = STORE_KEPT_LAYOUTS;
|
|
294
233
|
function viewSettings(definition, rowFilters) {
|
|
295
234
|
const data = definition ?? {};
|
|
@@ -342,14 +281,6 @@ function parseSorts(raw) {
|
|
|
342
281
|
|
|
343
282
|
// src/views.ts
|
|
344
283
|
var VIEW_LAYOUTS = ["grid", "kanban", "calendar", "gallery", "timeline", "list"];
|
|
345
|
-
var LAYOUT_LABEL = {
|
|
346
|
-
grid: "Grid",
|
|
347
|
-
kanban: "Kanban",
|
|
348
|
-
calendar: "Calendar",
|
|
349
|
-
gallery: "Gallery",
|
|
350
|
-
timeline: "Timeline",
|
|
351
|
-
list: "List"
|
|
352
|
-
};
|
|
353
284
|
function viewOrderOf(definition) {
|
|
354
285
|
const raw = definition?.["order"];
|
|
355
286
|
return raw === "manual" ? "manual" : raw === "sorted" ? "sorted" : null;
|
|
@@ -357,12 +288,6 @@ function viewOrderOf(definition) {
|
|
|
357
288
|
function defaultViewOf(views) {
|
|
358
289
|
return views.find((v) => v.isDefault);
|
|
359
290
|
}
|
|
360
|
-
var PAGE_VIEWS = [...VIEW_LAYOUTS, "dashboards", "archived"];
|
|
361
|
-
var PAGE_VIEW_LABEL = {
|
|
362
|
-
...LAYOUT_LABEL,
|
|
363
|
-
dashboards: "Dashboards",
|
|
364
|
-
archived: "Archived"
|
|
365
|
-
};
|
|
366
291
|
function viewFromRow(row) {
|
|
367
292
|
const data = row.definition ?? {};
|
|
368
293
|
const k = viewSettings(data, row.filters && Object.keys(row.filters).length > 0 ? row.filters : null);
|
|
@@ -432,6 +357,7 @@ async function readLooks(client, tableId) {
|
|
|
432
357
|
|
|
433
358
|
// src/firstPage.ts
|
|
434
359
|
var TABLE_PAGE_SIZE = 100;
|
|
360
|
+
var EMBEDDED_PAGE_SIZE = 50;
|
|
435
361
|
function firstGridPageArgs(input) {
|
|
436
362
|
const { shown, fields } = input;
|
|
437
363
|
if (!shown) return null;
|
|
@@ -466,9 +392,38 @@ async function firstGridPageRequest(client, tableId, options = {}) {
|
|
|
466
392
|
const shown = view ? applyLook(view, looks.data[view.id]) : null;
|
|
467
393
|
return firstGridPageArgs({ tableId, table: table.data, fields: fields.data, shown, ...options.pageSize ? { pageSize: options.pageSize } : {} });
|
|
468
394
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
395
|
+
async function askTablePageSeed(input) {
|
|
396
|
+
const recording = recordingDataSource(asRecordsDataSource(input.dataSource));
|
|
397
|
+
const client = createRecordsClient({
|
|
398
|
+
dataSource: recording.source,
|
|
399
|
+
organizationId: input.organizationId,
|
|
400
|
+
actor: input.actor,
|
|
401
|
+
onError: () => {
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
const record = input.recordId ? Promise.resolve(
|
|
405
|
+
recording.source.rpc("record_page_bundle", { p_organization_id: input.organizationId, p_record_id: input.recordId }, { schema: "custom" })
|
|
406
|
+
).catch(() => null) : null;
|
|
407
|
+
try {
|
|
408
|
+
const pageSize = input.pageSize ?? (input.embedded ? EMBEDDED_PAGE_SIZE : TABLE_PAGE_SIZE);
|
|
409
|
+
const args = await firstGridPageRequest(client, input.tableId, { pageSize });
|
|
410
|
+
if (args && input.rows !== false) {
|
|
411
|
+
await client.listPage({
|
|
412
|
+
table_id: args.p_table_id,
|
|
413
|
+
filter: args.p_filter,
|
|
414
|
+
search: args.p_search,
|
|
415
|
+
sort: args.p_sort,
|
|
416
|
+
view_id: args.p_view_id,
|
|
417
|
+
limit: args.p_limit,
|
|
418
|
+
offset: args.p_offset
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
} catch {
|
|
422
|
+
}
|
|
423
|
+
if (record) await record;
|
|
424
|
+
return recording.seed();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export { EMBEDDED_PAGE_SIZE, TABLE_PAGE_SIZE, askTablePageSeed, firstGridPageArgs, firstGridPageRequest };
|
|
428
|
+
//# sourceMappingURL=first-page.js.map
|
|
474
429
|
//# sourceMappingURL=first-page.js.map
|