@ai-matrx/records-ui 0.116.115 → 0.116.116
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 +5 -0
- package/dist/index.cjs +56 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +56 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.116.116
|
|
4
|
+
|
|
5
|
+
UNVERIFIED: this release has no Unreleased entry and the package-input comparison could not be made (the caller supplied no source comparison). Whether package inputs changed is unknown; consumer action is unknown.
|
|
6
|
+
Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/records-ui`.
|
|
7
|
+
|
|
3
8
|
## 0.116.115
|
|
4
9
|
|
|
5
10
|
- Fixed: `/helpers` (and the `/skeleton` chunk) no longer import the `@ai-matrx/records` root: `setPersonTimeZone` reaches `setReadersTimeZone` through `@ai-matrx/records/views`. Guard: `check-light-entries` in `build` (it was red).
|
package/dist/index.cjs
CHANGED
|
@@ -67108,10 +67108,62 @@ function orderedRows(rows, nameKey, direction = "asc") {
|
|
|
67108
67108
|
return sign * NATURAL2.compare(x, y);
|
|
67109
67109
|
});
|
|
67110
67110
|
}
|
|
67111
|
-
function tableSortedRows(rows, sort, fields) {
|
|
67111
|
+
function tableSortedRows(rows, sort, fields, scaleKey) {
|
|
67112
67112
|
const field2 = fields.find((f) => f.key === sort.id);
|
|
67113
67113
|
if (!field2 || (0, import_first_page10.sortAsFor)(field2) !== "text") return [...rows];
|
|
67114
|
-
|
|
67114
|
+
const named = orderedRows(rows, sort.id, sort.direction);
|
|
67115
|
+
return scaleKey ? scaleOrdered(named, scaleKey) : named;
|
|
67116
|
+
}
|
|
67117
|
+
function scaleOrdered(rows, valueKey) {
|
|
67118
|
+
const sizes = rows.map((r) => scaleMagnitude((r.document ?? {})[valueKey]));
|
|
67119
|
+
if (rows.length < 2 || sizes.some((m) => m === null)) return [...rows];
|
|
67120
|
+
return rows.map((row, i) => ({ row, i, m: sizes[i] })).sort((a, b) => a.m - b.m || a.i - b.i).map((x) => x.row);
|
|
67121
|
+
}
|
|
67122
|
+
function cssShadowDepth(text) {
|
|
67123
|
+
if (text === "none") return 0;
|
|
67124
|
+
let deepest = null;
|
|
67125
|
+
for (const layer of text.split(/,(?![^(]*\))/)) {
|
|
67126
|
+
const lengths = layer.replace(/(rgba?|hsla?|oklch|oklab|lab|lch|color|var)\([^)]*\)/gi, " ").replace(/#[0-9a-f]{3,8}\b|\binset\b|\b[a-z]+\b(?!\()/gi, (m) => /^\d/.test(m) ? m : " ").trim().split(/\s+/).filter((w) => w !== "");
|
|
67127
|
+
if (lengths.length < 2 || lengths.length > 4 || !lengths.every((w) => /^-?\d+(\.\d+)?(px|rem|em)?$/i.test(w))) return null;
|
|
67128
|
+
const [, y = 0, blur = 0, spread = 0] = lengths.map((w) => parseFloat(w));
|
|
67129
|
+
const depth = Math.abs(y) + blur + spread / 2;
|
|
67130
|
+
deepest = deepest === null ? depth : Math.max(deepest, depth);
|
|
67131
|
+
}
|
|
67132
|
+
return deepest;
|
|
67133
|
+
}
|
|
67134
|
+
function scaleMagnitude(value) {
|
|
67135
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : null;
|
|
67136
|
+
if (typeof value === "string") {
|
|
67137
|
+
const t = value.trim();
|
|
67138
|
+
const n = /^-?\d+(\.\d+)?/.exec(t);
|
|
67139
|
+
if (n && /^-?\d+(\.\d+)?\s*[a-z%]*$/i.test(t)) return Number(n[0]);
|
|
67140
|
+
if (t.startsWith("{")) {
|
|
67141
|
+
try {
|
|
67142
|
+
return scaleMagnitude(JSON.parse(t));
|
|
67143
|
+
} catch {
|
|
67144
|
+
return null;
|
|
67145
|
+
}
|
|
67146
|
+
}
|
|
67147
|
+
const timing = /^(\d+(?:\.\d+)?)(ms|s)\b/i.exec(t);
|
|
67148
|
+
if (timing) return Number(timing[1]) * (timing[2]?.toLowerCase() === "s" ? 1e3 : 1);
|
|
67149
|
+
return cssShadowDepth(t);
|
|
67150
|
+
}
|
|
67151
|
+
if (value && typeof value === "object") {
|
|
67152
|
+
const o = value;
|
|
67153
|
+
if (typeof o.duration === "number") return o.duration;
|
|
67154
|
+
const theme = o.light ?? o.dark;
|
|
67155
|
+
if (theme !== void 0) return scaleMagnitude(theme);
|
|
67156
|
+
const layers = Array.isArray(o.layers) ? o.layers : "blur" in o || "y" in o ? [o] : null;
|
|
67157
|
+
if (layers) {
|
|
67158
|
+
let deepest = null;
|
|
67159
|
+
for (const layer of layers) {
|
|
67160
|
+
const depth = (Number(layer.y) || 0) + (Number(layer.blur) || 0) + (Number(layer.spread) || 0) / 2;
|
|
67161
|
+
deepest = deepest === null ? depth : Math.max(deepest, depth);
|
|
67162
|
+
}
|
|
67163
|
+
return deepest;
|
|
67164
|
+
}
|
|
67165
|
+
}
|
|
67166
|
+
return null;
|
|
67115
67167
|
}
|
|
67116
67168
|
function sectionGroups(rows, groupKey) {
|
|
67117
67169
|
if (!groupKey) return [{ key: UNGROUPED2, rows: [...rows] }];
|
|
@@ -67516,7 +67568,8 @@ function TableSectionCard(props) {
|
|
|
67516
67568
|
const readsOnField = cols.readsOn ? fields.find((f) => f.key === cols.readsOn) : void 0;
|
|
67517
67569
|
const readsOnColorKey = cols.readsOn ? cols.values.find((f) => formatForField(f)?.options?.contrastWith?.readsOnField === cols.readsOn)?.key : void 0;
|
|
67518
67570
|
const columns = columnsOf(cols.values);
|
|
67519
|
-
const
|
|
67571
|
+
const scaleKey = cols.values.length === 1 && !cols.group ? cols.values[0]?.key : void 0;
|
|
67572
|
+
const rows = tableSort ? tableSortedRows(page.data?.rows ?? [], tableSort, fields, scaleKey) : scaleKey ? scaleOrdered(orderedRows(page.data?.rows ?? [], cols.name), scaleKey) : orderedRows(page.data?.rows ?? [], cols.name);
|
|
67520
67573
|
const groups = sectionGroups(rows, cols.group);
|
|
67521
67574
|
const level = rows[0]?.level ?? null;
|
|
67522
67575
|
const mayWrite = !readOnly && (rows.length === 0 ? !readOnly : (0, import_field_kinds9.atLeast)(level, "edit_content"));
|