@gridsheet/preact-core 3.4.2 → 3.4.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/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, render } from "preact";
|
|
2
|
-
import { f as fe, u as ue, p as pe, k as ks, _, t as te, D as Dn, a as useBrowser, s as setEditingAddress, o as oe, G, w as write, b as setInputting, c as updateSheet, d as bt, e as te$1, g as ae, r as redo, h as undo, i as cut, P as Pe, j as fillRight, l as setSearchQuery, m as setEntering, n as fillDown, q as copy, v as select, x as selectToDataEdge, y as arrow, z as escape, A as clear, R, B as walk, M as Mn, C as ee, E as paste, F as setEditorHovering, H as Pn, I as setStore, J as submitAutofill, K as setDragging, L as setAutofillDraggingTo, N as drag, O as he, Q as rt, S as setResizingPositionY, T as setResizingPositionX, U as nn, V as cn, W as M, X as qr, Z as Zr, Y as filterRows, $ as sortRows, a0 as an, a1 as removeCols, a2 as removeRows, a3 as insertColsRight, a4 as insertColsLeft, a5 as insertRowsBelow, a6 as insertRowsAbove, a7 as setContextMenuPosition, a8 as Ln, a9 as setColumnMenu, aa as setRowMenu, ab as isXSheetFocused, ac as setEditorRect, ad as S, ae as L, af as choose, ag as q, ah as rn, ai as ce, aj as be, ak as on, al as le, am as re, an as selectCols, ao as useDebounceCallback, ap as selectRows, aq as W, ar as Hn, as as Q, at as T, au as ge, av as se, aw as ne, ax as en, ay as bn, az as Z, aA as ie, aB as de, aC as search, aD as setSearchCaseSensitive, aE as setSearchRegex, aF as wn, aG as setSearchRange, aH as useBook, aI as Y, aJ as reducer, aK as me, aL as isAsyncMutationAction, aM as isMutationAction, aN as commitAsyncOp, aO as Hs, aP as $e, aQ as $t, aR as jr, aS as Le, aT as kt, aU as Gr } from "./hooks-
|
|
3
|
-
import { bi, bj, bA, bk, bz, bx, bn as bn2, bl, b6, bB, by, b1, bm, aW, a_, a$, b0, aX, aY, b2, b5, bs, bv, b7, bu, b8, bt as bt2, bq, br, bp, bo, aZ, aV, b3, b4, bw, bh, be as be2, bf, bg, bd, b9, ba, bb, bc, bC } from "./hooks-
|
|
2
|
+
import { f as fe, u as ue, p as pe, k as ks, _, t as te, D as Dn, a as useBrowser, s as setEditingAddress, o as oe, G, w as write, b as setInputting, c as updateSheet, d as bt, e as te$1, g as ae, r as redo, h as undo, i as cut, P as Pe, j as fillRight, l as setSearchQuery, m as setEntering, n as fillDown, q as copy, v as select, x as selectToDataEdge, y as arrow, z as escape, A as clear, R, B as walk, M as Mn, C as ee, E as paste, F as setEditorHovering, H as Pn, I as setStore, J as submitAutofill, K as setDragging, L as setAutofillDraggingTo, N as drag, O as he, Q as rt, S as setResizingPositionY, T as setResizingPositionX, U as nn, V as cn, W as M, X as qr, Z as Zr, Y as filterRows, $ as sortRows, a0 as an, a1 as removeCols, a2 as removeRows, a3 as insertColsRight, a4 as insertColsLeft, a5 as insertRowsBelow, a6 as insertRowsAbove, a7 as setContextMenuPosition, a8 as Ln, a9 as setColumnMenu, aa as setRowMenu, ab as isXSheetFocused, ac as setEditorRect, ad as S, ae as L, af as choose, ag as q, ah as rn, ai as ce, aj as be, ak as on, al as le, am as re, an as selectCols, ao as useDebounceCallback, ap as selectRows, aq as W, ar as Hn, as as Q, at as T, au as ge, av as se, aw as ne, ax as en, ay as bn, az as Z, aA as ie, aB as de, aC as search, aD as setSearchCaseSensitive, aE as setSearchRegex, aF as wn, aG as setSearchRange, aH as useBook, aI as Y, aJ as reducer, aK as me, aL as isAsyncMutationAction, aM as isMutationAction, aN as commitAsyncOp, aO as Hs, aP as $e, aQ as $t, aR as jr, aS as Le, aT as kt, aU as Gr } from "./hooks-CWD7gJMA.mjs";
|
|
3
|
+
import { bi, bj, bA, bk, bz, bx, bn as bn2, bl, b6, bB, by, b1, bm, aW, a_, a$, b0, aX, aY, b2, b5, bs, bv, b7, bu, b8, bt as bt2, bq, br, bp, bo, aZ, aV, b3, b4, bw, bh, be as be2, bf, bg, bd, b9, ba, bb, bc, bC } from "./hooks-CWD7gJMA.mjs";
|
|
4
4
|
import { jsx, jsxs, Fragment } from "preact/compat/jsx-runtime";
|
|
5
5
|
import React, { createContext, forwardRef, useState, useImperativeHandle, useRef, useContext, useLayoutEffect, useMemo, useCallback, createPortal, memo, useEffect, createRef, useReducer } from "preact/compat";
|
|
6
6
|
import { Children, Component, Fragment as Fragment2, PureComponent, StrictMode, Suspense, SuspenseList, cloneElement, render as render2, createContext as createContext2, createElement, createFactory, createPortal as createPortal2, createRef as createRef2, findDOMNode, forwardRef as forwardRef2, hydrate, isValidElement, lazy, memo as memo2, unmountComponentAtNode, unstable_batchedUpdates, useCallback as useCallback2, useContext as useContext2, useDebugValue, useEffect as useEffect2, useImperativeHandle as useImperativeHandle2, useLayoutEffect as useLayoutEffect2, useMemo as useMemo2, useReducer as useReducer2, useRef as useRef2, useState as useState2, version } from "preact/compat";
|
|
@@ -5387,6 +5387,7 @@ function GridSheet({
|
|
|
5387
5387
|
const [resizedHeight, setResizedHeight] = useState(false);
|
|
5388
5388
|
const fixedWidth = centersWidth && (options.sheetWidth != null || resizedWidth);
|
|
5389
5389
|
const fixedHeight = centersHeight && (options.sheetHeight != null || resizedHeight);
|
|
5390
|
+
const canResizeVertical = sheetResize === "both" || sheetResize === "vertical";
|
|
5390
5391
|
const [sheetHeight, setSheetHeight] = useState(
|
|
5391
5392
|
typeof (options == null ? void 0 : options.sheetHeight) === "number" ? options.sheetHeight : estimateSheetHeight(initialCells)
|
|
5392
5393
|
);
|
|
@@ -5414,7 +5415,8 @@ function GridSheet({
|
|
|
5414
5415
|
}
|
|
5415
5416
|
const root = rootRef.current;
|
|
5416
5417
|
if (fillHeight || el.style.height) {
|
|
5417
|
-
|
|
5418
|
+
const measured = el.style.height && !fillHeight ? el.clientHeight : root ? Math.min(el.clientHeight, root.clientHeight) : el.clientHeight;
|
|
5419
|
+
setSheetHeight(measured);
|
|
5418
5420
|
}
|
|
5419
5421
|
setSheetWidth(root ? Math.min(el.clientWidth, root.clientWidth) : el.clientWidth);
|
|
5420
5422
|
});
|
|
@@ -5426,6 +5428,16 @@ function GridSheet({
|
|
|
5426
5428
|
setSheetHeight(options.sheetHeight);
|
|
5427
5429
|
}
|
|
5428
5430
|
}, [options.sheetHeight]);
|
|
5431
|
+
useLayoutEffect(() => {
|
|
5432
|
+
var _a2;
|
|
5433
|
+
const el = mainRef.current;
|
|
5434
|
+
if (!el || !canResizeVertical || !fixedHeight) {
|
|
5435
|
+
return;
|
|
5436
|
+
}
|
|
5437
|
+
const target = typeof options.sheetHeight === "number" ? options.sheetHeight : sheetHeight;
|
|
5438
|
+
const content = (((_a2 = store.sheetReactive.current) == null ? void 0 : _a2.fullHeight) || 0) + 2;
|
|
5439
|
+
el.style.height = `${Math.min(target, content)}px`;
|
|
5440
|
+
}, [options.sheetHeight, canResizeVertical, fixedHeight]);
|
|
5429
5441
|
useEffect(() => {
|
|
5430
5442
|
if (typeof options.sheetWidth === "number") {
|
|
5431
5443
|
setSheetWidth(options.sheetWidth);
|
|
@@ -5490,7 +5502,12 @@ function GridSheet({
|
|
|
5490
5502
|
} catch (e) {
|
|
5491
5503
|
console.error("[gridsheet] async op failed:", e);
|
|
5492
5504
|
if (!cancelled) {
|
|
5493
|
-
dispatch(
|
|
5505
|
+
dispatch(
|
|
5506
|
+
commitAsyncOp({
|
|
5507
|
+
sheet: latestStoreRef.current.sheetReactive.current,
|
|
5508
|
+
selectingZone: pendingAsyncOp.selectingZone
|
|
5509
|
+
})
|
|
5510
|
+
);
|
|
5494
5511
|
}
|
|
5495
5512
|
}
|
|
5496
5513
|
})
|
|
@@ -5539,7 +5556,14 @@ function GridSheet({
|
|
|
5539
5556
|
// (never shrink to the viewport — otherwise a grid placed low on a page or in a
|
|
5540
5557
|
// short viewport collapses). Only the shrink-to-content case caps at the viewport
|
|
5541
5558
|
// bottom so a very tall grid stays usable within the current view.
|
|
5542
|
-
...fillHeight ? { flex: 1, minHeight: 0, maxHeight: "100%" } : fixedHeight ?
|
|
5559
|
+
...fillHeight ? { flex: 1, minHeight: 0, maxHeight: "100%" } : fixedHeight ? canResizeVertical ? (
|
|
5560
|
+
// A user-resizable fixed-height box can't be React-controlled: `maxHeight`
|
|
5561
|
+
// blocks the CSS resize handle from dragging taller, and a controlled `height`
|
|
5562
|
+
// is overwritten on every render (fighting the drag). So leave the height
|
|
5563
|
+
// uncontrolled here — the initial pixel height is set imperatively in a layout
|
|
5564
|
+
// effect and the ResizeObserver syncs drags back into `sheetHeight`.
|
|
5565
|
+
{}
|
|
5566
|
+
) : { maxHeight: sheetHeight } : {
|
|
5543
5567
|
maxHeight: mainRef.current ? window.innerHeight - mainRef.current.getBoundingClientRect().top : (((_c = store.sheetReactive.current) == null ? void 0 : _c.fullHeight) || 0) + 2
|
|
5544
5568
|
},
|
|
5545
5569
|
resize: sheetResize,
|