@ai-matrx/records-ui 0.93.84 → 0.93.86
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 -0
- package/dist/index.cjs +23 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +23 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -31518,6 +31518,7 @@ function ViewFilter({ tableId, view, onApply, className }) {
|
|
|
31518
31518
|
// src/toolbarFit.ts
|
|
31519
31519
|
import { useEffect as useEffect81, useState as useState93 } from "react";
|
|
31520
31520
|
var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
|
|
31521
|
+
var SLOT_MIN = 36;
|
|
31521
31522
|
function toolbarFold(input) {
|
|
31522
31523
|
const { available, needsNow, gap, folded } = input;
|
|
31523
31524
|
const pieces = [
|
|
@@ -31531,13 +31532,18 @@ function toolbarFold(input) {
|
|
|
31531
31532
|
return piece.full ?? piece.now;
|
|
31532
31533
|
};
|
|
31533
31534
|
const withGap = (width) => width > 0 ? width + gap : 0;
|
|
31534
|
-
const
|
|
31535
|
+
const shareNow = input.share ? withGap(input.share.now) : 0;
|
|
31536
|
+
const base = pieces.reduce((rest, p) => rest - withGap(p.piece.now), needsNow - shareNow);
|
|
31535
31537
|
const stages = input.tools ? [0, 1, 2, 3] : [0, 1, 2];
|
|
31536
|
-
const
|
|
31538
|
+
const shareOn = input.share ? withGap(input.share.full ?? input.share.now) : 0;
|
|
31539
|
+
const needs = stages.map((fold) => pieces.reduce((sum, p) => sum + withGap(widthAt(p, fold)), base + shareOn));
|
|
31537
31540
|
const fits = needs.findIndex((need) => need <= available + 0.5);
|
|
31538
31541
|
if (fits >= 0) return stages[fits];
|
|
31539
31542
|
const least = Math.min(...needs);
|
|
31540
|
-
|
|
31543
|
+
const most = stages[needs.findIndex((need) => need <= least + 0.5)];
|
|
31544
|
+
if (most < 3 || !input.tools || !input.share) return most;
|
|
31545
|
+
const fixed = pieces.reduce((sum, p) => sum + withGap(p.stage === 3 ? SLOT_MIN : widthAt(p, 3)), base + shareOn);
|
|
31546
|
+
return fixed > available + 0.5 ? 4 : 3;
|
|
31541
31547
|
}
|
|
31542
31548
|
function naturalWidth(el) {
|
|
31543
31549
|
const html = el;
|
|
@@ -31573,9 +31579,10 @@ function useToolbarFit(row) {
|
|
|
31573
31579
|
const widths = {
|
|
31574
31580
|
look: { full: null, folded: null },
|
|
31575
31581
|
chooser: { full: null, folded: null },
|
|
31576
|
-
tools: { full: null, folded: null }
|
|
31582
|
+
tools: { full: null, folded: null },
|
|
31583
|
+
share: { full: null, folded: null }
|
|
31577
31584
|
};
|
|
31578
|
-
const stageOf = { look: 1, chooser: 2, tools: 3 };
|
|
31585
|
+
const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
|
|
31579
31586
|
let current = 0;
|
|
31580
31587
|
let pending = 0;
|
|
31581
31588
|
let stopped = false;
|
|
@@ -31585,7 +31592,7 @@ function useToolbarFit(row) {
|
|
|
31585
31592
|
const available = row.clientWidth;
|
|
31586
31593
|
if (available <= 0) return;
|
|
31587
31594
|
const read = (name) => {
|
|
31588
|
-
const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
|
|
31595
|
+
const el = name === "tools" ? row.querySelector(":scope > [data-toolbar-fit-slot]") : name === "share" ? row.querySelector('[data-toolbar-fit="share"]') : row.querySelector(`:scope > [data-toolbar-fit="${name}"]`);
|
|
31589
31596
|
const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
|
|
31590
31597
|
const w = widths[name];
|
|
31591
31598
|
if (el && now > 0) {
|
|
@@ -31598,8 +31605,11 @@ function useToolbarFit(row) {
|
|
|
31598
31605
|
const look = read("look");
|
|
31599
31606
|
const chooser = read("chooser");
|
|
31600
31607
|
const tools = read("tools");
|
|
31608
|
+
const shareEl = row.querySelector('[data-toolbar-fit="share"]');
|
|
31609
|
+
const shareRead = shareEl ? read("share") : null;
|
|
31610
|
+
const share = shareRead && (shareRead.now > 0 || shareRead.full !== null) ? shareRead : void 0;
|
|
31601
31611
|
const { needs, gap } = rowNeeds(row);
|
|
31602
|
-
const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools });
|
|
31612
|
+
const next = toolbarFold({ available, needsNow: needs, gap, folded: current, look, chooser, tools, share });
|
|
31603
31613
|
if (next !== current) {
|
|
31604
31614
|
current = next;
|
|
31605
31615
|
setFold(next);
|
|
@@ -32016,6 +32026,7 @@ function TablePage({
|
|
|
32016
32026
|
const chooserInline = !designated && !phone && toolbarFold2 < 2;
|
|
32017
32027
|
const chooserCompact = !designated && !phone && toolbarFold2 >= 2;
|
|
32018
32028
|
const controlsInSheet = phone && !designated;
|
|
32029
|
+
const shareInMenu = phone || toolbarFold2 >= 4;
|
|
32019
32030
|
useEffect82(() => {
|
|
32020
32031
|
if (face.kind !== "designated") return;
|
|
32021
32032
|
if (hostFromLink || opened.layout || layoutChosen) return;
|
|
@@ -32240,7 +32251,7 @@ function TablePage({
|
|
|
32240
32251
|
rights.share && canShare ? /* @__PURE__ */ jsx105(Button80, { size: "sm", variant: "ghost", className: "h-8", onClick: () => setShareAsked((n) => n + 1), "data-table-sheet-share": "", children: "Share\u2026" }) : null
|
|
32241
32252
|
] }) : void 0;
|
|
32242
32253
|
const pageActions = /* @__PURE__ */ jsxs95(Fragment44, { children: [
|
|
32243
|
-
organizationId ? /* @__PURE__ */ jsx105(
|
|
32254
|
+
organizationId ? /* @__PURE__ */ jsx105("span", { className: shareInMenu ? "hidden" : "flex shrink-0 items-center", "data-toolbar-fit": "share", children: /* @__PURE__ */ jsx105(
|
|
32244
32255
|
ShareControl,
|
|
32245
32256
|
{
|
|
32246
32257
|
kind: "table",
|
|
@@ -32250,10 +32261,10 @@ function TablePage({
|
|
|
32250
32261
|
may: rights.share,
|
|
32251
32262
|
whyNot: rights.read ? rights.why("share") : void 0,
|
|
32252
32263
|
initiallyOpen: shareFromLink || shareAsked > 0,
|
|
32253
|
-
...
|
|
32264
|
+
...shareInMenu ? { className: "hidden" } : {}
|
|
32254
32265
|
},
|
|
32255
|
-
|
|
32256
|
-
) : null,
|
|
32266
|
+
shareInMenu ? `share-${shareAsked}` : "share"
|
|
32267
|
+
) }, "share") : null,
|
|
32257
32268
|
/* @__PURE__ */ jsxs95(DropdownMenu5, { children: [
|
|
32258
32269
|
/* @__PURE__ */ jsx105(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsx105(Button80, { size: "sm", variant: "ghost", "aria-label": "Table menu", title: "Table menu", "data-table-menu": "", children: /* @__PURE__ */ jsxs95("svg", { viewBox: "0 0 24 24", className: "h-4 w-4", fill: "currentColor", "aria-hidden": "true", children: [
|
|
32259
32270
|
/* @__PURE__ */ jsx105("circle", { cx: "5", cy: "12", r: "1.75" }),
|
|
@@ -32276,7 +32287,7 @@ function TablePage({
|
|
|
32276
32287
|
},
|
|
32277
32288
|
entry.key
|
|
32278
32289
|
)),
|
|
32279
|
-
|
|
32290
|
+
shareInMenu && rights.share && canShare ? /* @__PURE__ */ jsxs95(Fragment44, { children: [
|
|
32280
32291
|
/* @__PURE__ */ jsx105(DropdownMenuSeparator4, {}),
|
|
32281
32292
|
/* @__PURE__ */ jsx105(DropdownMenuItem5, { onSelect: () => setShareAsked((n) => n + 1), "data-table-menu-share": "", children: "Share\u2026" })
|
|
32282
32293
|
] }) : null,
|