@ai-matrx/records-ui 0.101.23 → 0.101.25
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/index.cjs +76 -36
- 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 +77 -37
- package/dist/index.js.map +1 -1
- package/dist/pickers.cjs.map +1 -1
- package/dist/pickers.js +1 -1
- package/dist/pickers.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3921,7 +3921,7 @@ declare function useViewRecords(view: SavedViewSpec, pageSize?: number, filter?:
|
|
|
3921
3921
|
*/
|
|
3922
3922
|
membership: string;
|
|
3923
3923
|
};
|
|
3924
|
-
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize, titleField, filter, onClearFilter, hostLayout, onHostLayoutChange, chooser, openExport, viewId, onOrderPlaced, footer, embedded, sortOverride, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
3924
|
+
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, hostLayout, onHostLayoutChange, chooser, openExport, viewId, onOrderPlaced, footer, embedded, sortOverride, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
3925
3925
|
|
|
3926
3926
|
type CalendarMode = "month" | "week" | "day" | "list";
|
|
3927
3927
|
interface CalendarViewProps {
|
package/dist/index.d.ts
CHANGED
|
@@ -3921,7 +3921,7 @@ declare function useViewRecords(view: SavedViewSpec, pageSize?: number, filter?:
|
|
|
3921
3921
|
*/
|
|
3922
3922
|
membership: string;
|
|
3923
3923
|
};
|
|
3924
|
-
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize, titleField, filter, onClearFilter, hostLayout, onHostLayoutChange, chooser, openExport, viewId, onOrderPlaced, footer, embedded, sortOverride, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
3924
|
+
declare function ViewSwitcher({ view, onLayoutChange, onViewChange, onOpenRecord, openRecordId, onCloseRecord, onMoved, onNewRecordForm, onAskWhoChanged, pageSize: pageSizeAsked, titleField, filter, onClearFilter, hostLayout, onHostLayoutChange, chooser, openExport, viewId, onOrderPlaced, footer, embedded, sortOverride, newRowLabel, className, }: ViewSwitcherProps): react.JSX.Element;
|
|
3925
3925
|
|
|
3926
3926
|
type CalendarMode = "month" | "week" | "day" | "list";
|
|
3927
3927
|
interface CalendarViewProps {
|
package/dist/index.js
CHANGED
|
@@ -3137,7 +3137,7 @@ function Chips({
|
|
|
3137
3137
|
|
|
3138
3138
|
// src/presentation.ts
|
|
3139
3139
|
import {
|
|
3140
|
-
|
|
3140
|
+
COLOR_ROTATION,
|
|
3141
3141
|
parseTableStyle,
|
|
3142
3142
|
tableStyleIsEmpty
|
|
3143
3143
|
} from "@ai-matrx/design-system/data-table";
|
|
@@ -3387,7 +3387,7 @@ var colorFromTheValue = (_fieldKey, value) => {
|
|
|
3387
3387
|
for (let i = 0; i < text.length; i += 1) {
|
|
3388
3388
|
hash = hash * 31 + text.charCodeAt(i) >>> 0;
|
|
3389
3389
|
}
|
|
3390
|
-
return
|
|
3390
|
+
return COLOR_ROTATION[hash % COLOR_ROTATION.length];
|
|
3391
3391
|
};
|
|
3392
3392
|
function styleFromDecorations(decorations, fields) {
|
|
3393
3393
|
if (!decorations) return { version: 1 };
|
|
@@ -6070,6 +6070,14 @@ function workedOutErrorFor(document2, key) {
|
|
|
6070
6070
|
if (said && typeof said === "object" && typeof said.says === "string") return String(said.says).trim() || null;
|
|
6071
6071
|
return null;
|
|
6072
6072
|
}
|
|
6073
|
+
function cellMarkSentence(field2, document2, value) {
|
|
6074
|
+
if (value === null || value === void 0) {
|
|
6075
|
+
const failed = workedOutErrorFor(document2, field2.key);
|
|
6076
|
+
if (failed) return failed;
|
|
6077
|
+
}
|
|
6078
|
+
const kept = keptAsideFor(document2, field2.key);
|
|
6079
|
+
return kept ? keptAsideReason(field2, kept) : null;
|
|
6080
|
+
}
|
|
6073
6081
|
var WORKED_OUT_ERROR_WORD = "#ERROR";
|
|
6074
6082
|
function WorkedOutError({ field: field2, sentence: sentence2 }) {
|
|
6075
6083
|
return /* @__PURE__ */ jsx25(
|
|
@@ -7014,6 +7022,7 @@ function GridCell({
|
|
|
7014
7022
|
}
|
|
7015
7023
|
if (wasActive.current && opensAsAList(field2, hostTakesFiles(ui))) openThisCell(event);
|
|
7016
7024
|
};
|
|
7025
|
+
const cellMark = cellMarkSentence(field2, row.document, value);
|
|
7017
7026
|
return (
|
|
7018
7027
|
// BOTH MARKERS, ON PURPOSE. `data-matrx-cell-control` is the data table's
|
|
7019
7028
|
// opt-out from whole-row click, so opening a cell never also opens the
|
|
@@ -7034,7 +7043,7 @@ function GridCell({
|
|
|
7034
7043
|
{
|
|
7035
7044
|
role: editable ? "button" : void 0,
|
|
7036
7045
|
"aria-label": editable ? `Edit ${fieldName(field2)}` : void 0,
|
|
7037
|
-
title: editable ? `${fieldName(field2)} \u2014 double-click or press Enter to edit` : fieldIsEditable(field2) ? (
|
|
7046
|
+
title: cellMark ? cellMark : editable ? `${fieldName(field2)} \u2014 double-click or press Enter to edit` : fieldIsEditable(field2) ? (
|
|
7038
7047
|
// NOT A DEAD CONTROL AND NOT A SILENT ONE: the cell is plain
|
|
7039
7048
|
// text, and hovering it says exactly why, in the level's own
|
|
7040
7049
|
// words. The editor was never offered, so nothing is refused
|
|
@@ -15328,33 +15337,55 @@ function columnForField(field2, editing, mayWriteRow, whyNotRow, look, onAskWhoC
|
|
|
15328
15337
|
...{ title: fieldTypeLabel(field2) }
|
|
15329
15338
|
};
|
|
15330
15339
|
}
|
|
15331
|
-
var
|
|
15332
|
-
|
|
15333
|
-
|
|
15334
|
-
|
|
15335
|
-
|
|
15336
|
-
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15342
|
-
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15349
|
-
|
|
15350
|
-
|
|
15351
|
-
|
|
15340
|
+
var LINK2 = [["path", { d: "M7 7h10v10" }], ["path", { d: "M7 17 17 7" }]];
|
|
15341
|
+
var FORMULA = [["path", { d: "M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2" }]];
|
|
15342
|
+
var TYPE_ICON = {
|
|
15343
|
+
text: [["path", { d: "M12 4v16" }], ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2" }], ["path", { d: "M9 20h6" }]],
|
|
15344
|
+
long_text: [["path", { d: "M21 5H3" }], ["path", { d: "M15 12H3" }], ["path", { d: "M17 19H3" }]],
|
|
15345
|
+
number: [["line", { x1: 4, x2: 20, y1: 9, y2: 9 }], ["line", { x1: 4, x2: 20, y1: 15, y2: 15 }], ["line", { x1: 10, x2: 8, y1: 3, y2: 21 }], ["line", { x1: 16, x2: 14, y1: 3, y2: 21 }]],
|
|
15346
|
+
currency: [["line", { x1: 12, x2: 12, y1: 2, y2: 22 }], ["path", { d: "M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6" }]],
|
|
15347
|
+
percent: [["line", { x1: 19, x2: 5, y1: 5, y2: 19 }], ["circle", { cx: 6.5, cy: 6.5, r: 2.5 }], ["circle", { cx: 17.5, cy: 17.5, r: 2.5 }]],
|
|
15348
|
+
datetime: [["path", { d: "M8 2v3" }], ["path", { d: "M16 2v3" }], ["rect", { x: 3, y: 3, width: 18, height: 18, rx: 2 }], ["path", { d: "M3 9h18" }]],
|
|
15349
|
+
checkbox: [["rect", { width: 18, height: 18, x: 3, y: 3, rx: 2 }], ["path", { d: "m16 9-5.5 5.5L8 12" }]],
|
|
15350
|
+
select: [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "m16 10-4 4-4-4" }]],
|
|
15351
|
+
multi_select: [["path", { d: "M3 5h.01" }], ["path", { d: "M3 12h.01" }], ["path", { d: "M3 19h.01" }], ["path", { d: "M8 5h13" }], ["path", { d: "M8 12h13" }], ["path", { d: "M8 19h13" }]],
|
|
15352
|
+
member: [["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }], ["circle", { cx: 12, cy: 7, r: 4 }]],
|
|
15353
|
+
relation: LINK2,
|
|
15354
|
+
entity_reference: LINK2,
|
|
15355
|
+
attachment: [["path", { d: "m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551" }]],
|
|
15356
|
+
email: [["path", { d: "m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7" }], ["rect", { x: 2, y: 4, width: 20, height: 16, rx: 2 }]],
|
|
15357
|
+
url: [["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }], ["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }]],
|
|
15358
|
+
phone: [["path", { d: "M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384" }]],
|
|
15359
|
+
formula: FORMULA,
|
|
15360
|
+
lookup: FORMULA,
|
|
15361
|
+
rollup: FORMULA,
|
|
15362
|
+
json: [["path", { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1" }], ["path", { d: "M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1" }]]
|
|
15352
15363
|
};
|
|
15353
15364
|
function withTypeMark(field2, header) {
|
|
15354
|
-
const kind =
|
|
15355
|
-
const
|
|
15356
|
-
return /* @__PURE__ */ jsxs47("span", { className: "inline-flex min-w-0 items-center gap-1", "data-records-type-mark": kind, children: [
|
|
15357
|
-
/* @__PURE__ */ jsx52(
|
|
15365
|
+
const kind = editorKindFor(field2);
|
|
15366
|
+
const parts = TYPE_ICON[kind] ?? TYPE_ICON.text;
|
|
15367
|
+
return /* @__PURE__ */ jsxs47("span", { className: "inline-flex min-w-0 items-center gap-1.5", "data-records-type-mark": kind, children: [
|
|
15368
|
+
/* @__PURE__ */ jsx52(
|
|
15369
|
+
"svg",
|
|
15370
|
+
{
|
|
15371
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
15372
|
+
viewBox: "0 0 24 24",
|
|
15373
|
+
width: 14,
|
|
15374
|
+
height: 14,
|
|
15375
|
+
fill: "none",
|
|
15376
|
+
stroke: "currentColor",
|
|
15377
|
+
strokeWidth: 2,
|
|
15378
|
+
strokeLinecap: "round",
|
|
15379
|
+
strokeLinejoin: "round",
|
|
15380
|
+
"aria-hidden": "true",
|
|
15381
|
+
className: "shrink-0 text-muted-foreground",
|
|
15382
|
+
"data-records-type-icon": kind,
|
|
15383
|
+
children: parts.map(([tag, attrs], i) => {
|
|
15384
|
+
const El = tag;
|
|
15385
|
+
return /* @__PURE__ */ jsx52(El, { ...attrs }, i);
|
|
15386
|
+
})
|
|
15387
|
+
}
|
|
15388
|
+
),
|
|
15358
15389
|
header
|
|
15359
15390
|
] });
|
|
15360
15391
|
}
|
|
@@ -22385,7 +22416,7 @@ function GridBody({
|
|
|
22385
22416
|
) : null,
|
|
22386
22417
|
viewId && viewOrder?.onPlaced && hasSeveralRows ? /* @__PURE__ */ jsx68(Button42, { size: "sm", variant: "ghost", onClick: () => setReordering(true), "data-records-reorder-open": "", children: "Reorder" }) : null,
|
|
22387
22418
|
!readOnly && rights.structure && onAddField ? /* @__PURE__ */ jsx68(AddFieldButton, { onClick: onAddField }) : null,
|
|
22388
|
-
/* @__PURE__ */ jsx68(
|
|
22419
|
+
embedded ? null : /* @__PURE__ */ jsx68(
|
|
22389
22420
|
GridLayoutMenu,
|
|
22390
22421
|
{
|
|
22391
22422
|
look,
|
|
@@ -22522,7 +22553,8 @@ function GridBody({
|
|
|
22522
22553
|
phoneSheetTools,
|
|
22523
22554
|
sheetExtras,
|
|
22524
22555
|
tableId,
|
|
22525
|
-
noun
|
|
22556
|
+
noun,
|
|
22557
|
+
embedded
|
|
22526
22558
|
]
|
|
22527
22559
|
);
|
|
22528
22560
|
const labelOfField = useCallback25(
|
|
@@ -22729,6 +22761,7 @@ function GridBody({
|
|
|
22729
22761
|
query: tableQuery,
|
|
22730
22762
|
...valueFacets ? { facets: valueFacets, filterUi: VALUE_FILTER_UI } : {},
|
|
22731
22763
|
...classicInCard ? { hidePagination: true } : {},
|
|
22764
|
+
...embedded ? { appearance: "embedded" } : {},
|
|
22732
22765
|
tableClassName: cn34(
|
|
22733
22766
|
!look.wrap && "[&_tbody_td]:max-w-[28rem] [&_tbody_td]:overflow-hidden [&_tbody_td]:text-ellipsis [&_tbody_td]:whitespace-nowrap! [&_tbody_td_*]:whitespace-nowrap!",
|
|
22734
22767
|
look.fit === "scroll" && "sm:[&>table]:w-max! sm:[&>table]:max-w-none! sm:[&>table]:min-w-full!"
|
|
@@ -23053,6 +23086,13 @@ function useEntitySource(token, options = {}) {
|
|
|
23053
23086
|
);
|
|
23054
23087
|
return { ...state, write, create, reload };
|
|
23055
23088
|
}
|
|
23089
|
+
function entityValueText(column, v) {
|
|
23090
|
+
if (v === null || v === void 0 || v === "") return "";
|
|
23091
|
+
if (typeof v === "number") return v.toLocaleString();
|
|
23092
|
+
if (column.type !== "date" && column.type !== "datetime" && column.type !== "timestamp") return String(v);
|
|
23093
|
+
const kind = column.type === "date" ? "date" : "datetime";
|
|
23094
|
+
return dateText({ type: "range", config: { kind }, format: null }, v) ?? String(v);
|
|
23095
|
+
}
|
|
23056
23096
|
var NAME_KEYS = ["name", "display_name", "title", "subject"];
|
|
23057
23097
|
function entityNameColumn(columns) {
|
|
23058
23098
|
for (const key of NAME_KEYS) {
|
|
@@ -23068,9 +23108,7 @@ function entityTableColumns(columns) {
|
|
|
23068
23108
|
label: c.name,
|
|
23069
23109
|
accessorFn: (row) => row[c.api_name] ?? null,
|
|
23070
23110
|
cell: (row) => {
|
|
23071
|
-
|
|
23072
|
-
if (v === null || v === void 0 || v === "") return "";
|
|
23073
|
-
return typeof v === "number" ? v.toLocaleString() : String(v);
|
|
23111
|
+
return entityValueText(c, row[c.api_name]);
|
|
23074
23112
|
},
|
|
23075
23113
|
sortable: !c.lookup,
|
|
23076
23114
|
...c.type === "choice" && c.choices ? { filter: "select", filterOptions: c.choices.map((w) => ({ value: w, label: w })) } : {}
|
|
@@ -31213,7 +31251,7 @@ function ViewSwitcher({
|
|
|
31213
31251
|
onMoved,
|
|
31214
31252
|
onNewRecordForm,
|
|
31215
31253
|
onAskWhoChanged,
|
|
31216
|
-
pageSize
|
|
31254
|
+
pageSize: pageSizeAsked,
|
|
31217
31255
|
titleField = null,
|
|
31218
31256
|
filter,
|
|
31219
31257
|
onClearFilter,
|
|
@@ -31229,6 +31267,7 @@ function ViewSwitcher({
|
|
|
31229
31267
|
newRowLabel,
|
|
31230
31268
|
className
|
|
31231
31269
|
}) {
|
|
31270
|
+
const pageSize = pageSizeAsked ?? (embedded ? 50 : 200);
|
|
31232
31271
|
const toolbarSlot = useTableToolbarSlot();
|
|
31233
31272
|
const [layout, setLayout] = useState89(view.layout);
|
|
31234
31273
|
const hostLayouts = useRecordsUi().layouts ?? [];
|
|
@@ -31249,7 +31288,7 @@ function ViewSwitcher({
|
|
|
31249
31288
|
onViewChange?.(patch);
|
|
31250
31289
|
};
|
|
31251
31290
|
return /* @__PURE__ */ jsxs94("div", { className: cn53("flex min-h-0 flex-col gap-2", footer === "sticky" && "flex-1", className), children: [
|
|
31252
|
-
chooser ? /* @__PURE__ */ jsxs94("div", { className: "flex items-center gap-2", children: [
|
|
31291
|
+
chooser && !embedded ? /* @__PURE__ */ jsxs94("div", { className: "flex items-center gap-2", children: [
|
|
31253
31292
|
/* @__PURE__ */ jsx105("span", { className: "truncate text-sm font-medium", children: view.name }),
|
|
31254
31293
|
/* @__PURE__ */ jsxs94("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Layout", children: [
|
|
31255
31294
|
VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx105(
|
|
@@ -45923,7 +45962,7 @@ function TablePage({
|
|
|
45923
45962
|
tableId,
|
|
45924
45963
|
presentation: pagePresentation2 = "page",
|
|
45925
45964
|
newRowLabel,
|
|
45926
|
-
pageSize
|
|
45965
|
+
pageSize: pageSizeAsked,
|
|
45927
45966
|
seedViews,
|
|
45928
45967
|
onLeave,
|
|
45929
45968
|
leaveLabel = "Back to your tables",
|
|
@@ -46015,6 +46054,7 @@ function TablePage({
|
|
|
46015
46054
|
const face = tableOpening(view, hostLayouts.map((h) => h.id));
|
|
46016
46055
|
const designated = face.kind === "designated";
|
|
46017
46056
|
const embedded = pagePresentation2 === "embedded";
|
|
46057
|
+
const pageSize = pageSizeAsked ?? (embedded ? 50 : 100);
|
|
46018
46058
|
const chooserInline = !embedded && !designated && !phone && toolbarFold2 < 2;
|
|
46019
46059
|
const chooserCompact = !embedded && !designated && !phone && toolbarFold2 >= 2;
|
|
46020
46060
|
const controlsInSheet = phone && !designated;
|
|
@@ -47017,7 +47057,7 @@ function EntityBoard({ entity, groupBy, cardFields, onOpenRecord, className }) {
|
|
|
47017
47057
|
"data-records-entity-card": row.id,
|
|
47018
47058
|
children: [
|
|
47019
47059
|
onOpenRecord ? /* @__PURE__ */ jsx153("button", { type: "button", className: "truncate text-left font-medium hover:underline", onClick: () => onOpenRecord(row.id), children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }) : /* @__PURE__ */ jsx153("span", { className: "truncate font-medium", children: shown3(title ? row[title.api_name] : row.id) || "Untitled" }),
|
|
47020
|
-
extra.map((c) =>
|
|
47060
|
+
extra.map((c) => entityValueText(c, row[c.api_name]) ? /* @__PURE__ */ jsx153("span", { className: "truncate text-muted-foreground", children: entityValueText(c, row[c.api_name]) }, c.api_name) : null)
|
|
47021
47061
|
]
|
|
47022
47062
|
},
|
|
47023
47063
|
row.id
|