@ai-matrx/records-ui 0.115.65 → 0.115.66
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 +38 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +38 -15
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -52809,6 +52809,13 @@ function phoneTableActions(actions) {
|
|
|
52809
52809
|
|
|
52810
52810
|
// src/toolbarFit.ts
|
|
52811
52811
|
import { useEffect as useEffect123, useLayoutEffect as useLayoutEffect6, useState as useState149 } from "react";
|
|
52812
|
+
function widthAtFold(piece, fold) {
|
|
52813
|
+
for (let f = Math.min(fold, (piece.byFold?.length ?? 0) - 1); f >= 0; f -= 1) {
|
|
52814
|
+
const w = piece.byFold?.[f];
|
|
52815
|
+
if (w != null && w > 0) return w;
|
|
52816
|
+
}
|
|
52817
|
+
return piece.full ?? piece.now;
|
|
52818
|
+
}
|
|
52812
52819
|
var FOLDED_GUESS = { look: 104, chooser: 96, tools: 120 };
|
|
52813
52820
|
var SLOT_MIN = 36;
|
|
52814
52821
|
function toolbarFold(input) {
|
|
@@ -52821,7 +52828,7 @@ function toolbarFold(input) {
|
|
|
52821
52828
|
const widthAt = ({ piece, stage, guess }, fold) => {
|
|
52822
52829
|
if (piece.now === 0 && piece.full === null) return 0;
|
|
52823
52830
|
if (fold >= stage) return piece.folded ?? (folded >= stage ? piece.now : Math.min(guess, piece.full ?? piece.now));
|
|
52824
|
-
return piece
|
|
52831
|
+
return widthAtFold(piece, fold);
|
|
52825
52832
|
};
|
|
52826
52833
|
const withGap = (width) => width > 0 ? width + gap : 0;
|
|
52827
52834
|
const shareNow = input.share ? withGap(input.share.now) : 0;
|
|
@@ -52864,18 +52871,40 @@ function rowNeeds(row) {
|
|
|
52864
52871
|
}
|
|
52865
52872
|
return { needs: needs + gap * Math.max(0, pieces.length - 1), gap };
|
|
52866
52873
|
}
|
|
52874
|
+
var STAGE_OF = { look: 1, chooser: 2, tools: 3, share: 4 };
|
|
52875
|
+
function createFitMemory() {
|
|
52876
|
+
const widths = {
|
|
52877
|
+
look: { full: null, folded: null, byFold: [] },
|
|
52878
|
+
chooser: { full: null, folded: null, byFold: [] },
|
|
52879
|
+
tools: { full: null, folded: null, byFold: [] },
|
|
52880
|
+
share: { full: null, folded: null, byFold: [] }
|
|
52881
|
+
};
|
|
52882
|
+
return {
|
|
52883
|
+
/** Record one piece's measured width (`now`; `present`: the piece is on the row) with the row at `current`. */
|
|
52884
|
+
piece(name, current, now, present) {
|
|
52885
|
+
const w = widths[name];
|
|
52886
|
+
const stage = STAGE_OF[name];
|
|
52887
|
+
if (present && now > 0) {
|
|
52888
|
+
if (current >= stage) w.folded = now;
|
|
52889
|
+
else {
|
|
52890
|
+
if (name === "tools") w.byFold[current] = now;
|
|
52891
|
+
if (name !== "tools" || current === 0 || w.full === null) w.full = now;
|
|
52892
|
+
}
|
|
52893
|
+
}
|
|
52894
|
+
if (!present && current < stage) {
|
|
52895
|
+
w.full = null;
|
|
52896
|
+
w.byFold = [];
|
|
52897
|
+
}
|
|
52898
|
+
return { now, full: w.full, folded: w.folded, byFold: w.byFold };
|
|
52899
|
+
}
|
|
52900
|
+
};
|
|
52901
|
+
}
|
|
52867
52902
|
var useIsoLayoutEffect = typeof window === "undefined" ? useEffect123 : useLayoutEffect6;
|
|
52868
52903
|
function useToolbarFit(row) {
|
|
52869
52904
|
const [fold, setFold] = useState149(0);
|
|
52870
52905
|
useIsoLayoutEffect(() => {
|
|
52871
52906
|
if (!row) return;
|
|
52872
|
-
const
|
|
52873
|
-
look: { full: null, folded: null },
|
|
52874
|
-
chooser: { full: null, folded: null },
|
|
52875
|
-
tools: { full: null, folded: null },
|
|
52876
|
-
share: { full: null, folded: null }
|
|
52877
|
-
};
|
|
52878
|
-
const stageOf = { look: 1, chooser: 2, tools: 3, share: 4 };
|
|
52907
|
+
const memory = createFitMemory();
|
|
52879
52908
|
let current = 0;
|
|
52880
52909
|
let pending = 0;
|
|
52881
52910
|
let stopped = false;
|
|
@@ -52887,13 +52916,7 @@ function useToolbarFit(row) {
|
|
|
52887
52916
|
const read = (name) => {
|
|
52888
52917
|
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}"]`);
|
|
52889
52918
|
const now = !el ? 0 : name === "tools" ? slotNeeds(el) : naturalWidth(el);
|
|
52890
|
-
|
|
52891
|
-
if (el && now > 0) {
|
|
52892
|
-
if (current >= stageOf[name]) w.folded = now;
|
|
52893
|
-
else w.full = now;
|
|
52894
|
-
}
|
|
52895
|
-
if (!el && current < stageOf[name]) w.full = null;
|
|
52896
|
-
return { now, full: w.full, folded: w.folded };
|
|
52919
|
+
return memory.piece(name, current, now, !!el);
|
|
52897
52920
|
};
|
|
52898
52921
|
const look = read("look");
|
|
52899
52922
|
const chooser = read("chooser");
|