@ni/nimble-components 29.7.2 → 29.7.3
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/all-components-bundle.js +248 -137
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +527 -504
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/table/models/virtualizer.d.ts +1 -1
- package/dist/esm/table/models/virtualizer.js +4 -1
- package/dist/esm/table/models/virtualizer.js.map +1 -1
- package/dist/esm/table/template.js.map +1 -1
- package/package.json +1 -1
|
@@ -16280,7 +16280,7 @@
|
|
|
16280
16280
|
|
|
16281
16281
|
/**
|
|
16282
16282
|
* Do not edit directly
|
|
16283
|
-
* Generated on
|
|
16283
|
+
* Generated on Mon, 01 Jul 2024 20:00:46 GMT
|
|
16284
16284
|
*/
|
|
16285
16285
|
|
|
16286
16286
|
const Information100DarkUi = "#a46eff";
|
|
@@ -26760,7 +26760,7 @@
|
|
|
26760
26760
|
/**
|
|
26761
26761
|
Find the index and inner offset corresponding to a given relative
|
|
26762
26762
|
position in this fragment. The result object will be reused
|
|
26763
|
-
(overwritten) the next time the function is called.
|
|
26763
|
+
(overwritten) the next time the function is called. @internal
|
|
26764
26764
|
*/
|
|
26765
26765
|
findIndex(pos, round = -1) {
|
|
26766
26766
|
if (pos == 0)
|
|
@@ -27549,17 +27549,29 @@
|
|
|
27549
27549
|
@internal
|
|
27550
27550
|
*/
|
|
27551
27551
|
static resolveCached(doc, pos) {
|
|
27552
|
-
|
|
27553
|
-
|
|
27554
|
-
|
|
27555
|
-
|
|
27552
|
+
let cache = resolveCache.get(doc);
|
|
27553
|
+
if (cache) {
|
|
27554
|
+
for (let i = 0; i < cache.elts.length; i++) {
|
|
27555
|
+
let elt = cache.elts[i];
|
|
27556
|
+
if (elt.pos == pos)
|
|
27557
|
+
return elt;
|
|
27558
|
+
}
|
|
27559
|
+
}
|
|
27560
|
+
else {
|
|
27561
|
+
resolveCache.set(doc, cache = new ResolveCache);
|
|
27556
27562
|
}
|
|
27557
|
-
let result =
|
|
27558
|
-
|
|
27563
|
+
let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);
|
|
27564
|
+
cache.i = (cache.i + 1) % resolveCacheSize;
|
|
27559
27565
|
return result;
|
|
27560
27566
|
}
|
|
27561
27567
|
}
|
|
27562
|
-
|
|
27568
|
+
class ResolveCache {
|
|
27569
|
+
constructor() {
|
|
27570
|
+
this.elts = [];
|
|
27571
|
+
this.i = 0;
|
|
27572
|
+
}
|
|
27573
|
+
}
|
|
27574
|
+
const resolveCacheSize = 12, resolveCache = new WeakMap();
|
|
27563
27575
|
/**
|
|
27564
27576
|
Represents a flat range of content, i.e. one that starts and
|
|
27565
27577
|
ends in the same node.
|
|
@@ -27991,7 +28003,7 @@
|
|
|
27991
28003
|
static fromJSON(schema, json) {
|
|
27992
28004
|
if (!json)
|
|
27993
28005
|
throw new RangeError("Invalid input for Node.fromJSON");
|
|
27994
|
-
let marks =
|
|
28006
|
+
let marks = undefined;
|
|
27995
28007
|
if (json.marks) {
|
|
27996
28008
|
if (!Array.isArray(json.marks))
|
|
27997
28009
|
throw new RangeError("Invalid mark data for Node.fromJSON");
|
|
@@ -28663,7 +28675,7 @@
|
|
|
28663
28675
|
}
|
|
28664
28676
|
/**
|
|
28665
28677
|
Returns true if the given fragment is valid content for this node
|
|
28666
|
-
type
|
|
28678
|
+
type.
|
|
28667
28679
|
*/
|
|
28668
28680
|
validContent(content) {
|
|
28669
28681
|
let result = this.contentMatch.matchFragment(content);
|
|
@@ -28995,11 +29007,17 @@
|
|
|
28995
29007
|
@internal
|
|
28996
29008
|
*/
|
|
28997
29009
|
this.styles = [];
|
|
29010
|
+
let matchedStyles = this.matchedStyles = [];
|
|
28998
29011
|
rules.forEach(rule => {
|
|
28999
|
-
if (isTagRule(rule))
|
|
29012
|
+
if (isTagRule(rule)) {
|
|
29000
29013
|
this.tags.push(rule);
|
|
29001
|
-
|
|
29014
|
+
}
|
|
29015
|
+
else if (isStyleRule(rule)) {
|
|
29016
|
+
let prop = /[^=]*/.exec(rule.style)[0];
|
|
29017
|
+
if (matchedStyles.indexOf(prop) < 0)
|
|
29018
|
+
matchedStyles.push(prop);
|
|
29002
29019
|
this.styles.push(rule);
|
|
29020
|
+
}
|
|
29003
29021
|
});
|
|
29004
29022
|
// Only normalize list elements when lists in the schema can't directly contain themselves
|
|
29005
29023
|
this.normalizeLists = !this.tags.some(r => {
|
|
@@ -29249,10 +29267,10 @@
|
|
|
29249
29267
|
this.addElement(dom);
|
|
29250
29268
|
}
|
|
29251
29269
|
withStyleRules(dom, f) {
|
|
29252
|
-
let style = dom.
|
|
29253
|
-
if (!style)
|
|
29270
|
+
let style = dom.style;
|
|
29271
|
+
if (!style || !style.length)
|
|
29254
29272
|
return f();
|
|
29255
|
-
let marks = this.readStyles(
|
|
29273
|
+
let marks = this.readStyles(dom.style);
|
|
29256
29274
|
if (!marks)
|
|
29257
29275
|
return; // A style with ignore: true
|
|
29258
29276
|
let [addMarks, removeMarks] = marks, top = this.top;
|
|
@@ -29361,28 +29379,36 @@
|
|
|
29361
29379
|
// had a rule with `ignore` set.
|
|
29362
29380
|
readStyles(styles) {
|
|
29363
29381
|
let add = Mark$1.none, remove = Mark$1.none;
|
|
29364
|
-
|
|
29365
|
-
|
|
29366
|
-
|
|
29367
|
-
|
|
29368
|
-
|
|
29369
|
-
|
|
29370
|
-
|
|
29371
|
-
|
|
29372
|
-
|
|
29373
|
-
|
|
29374
|
-
|
|
29375
|
-
|
|
29376
|
-
|
|
29377
|
-
|
|
29378
|
-
|
|
29379
|
-
|
|
29380
|
-
|
|
29381
|
-
|
|
29382
|
-
|
|
29383
|
-
|
|
29382
|
+
// Because many properties will only show up in 'normalized' form
|
|
29383
|
+
// in `style.item` (i.e. text-decoration becomes
|
|
29384
|
+
// text-decoration-line, text-decoration-color, etc), we directly
|
|
29385
|
+
// query the styles mentioned in our rules instead of iterating
|
|
29386
|
+
// over the items.
|
|
29387
|
+
if (styles.length)
|
|
29388
|
+
for (let i = 0; i < this.parser.matchedStyles.length; i++) {
|
|
29389
|
+
let name = this.parser.matchedStyles[i], value = styles.getPropertyValue(name);
|
|
29390
|
+
if (value)
|
|
29391
|
+
for (let after = undefined;;) {
|
|
29392
|
+
let rule = this.parser.matchStyle(name, value, this, after);
|
|
29393
|
+
if (!rule)
|
|
29394
|
+
break;
|
|
29395
|
+
if (rule.ignore)
|
|
29396
|
+
return null;
|
|
29397
|
+
if (rule.clearMark) {
|
|
29398
|
+
this.top.pendingMarks.concat(this.top.activeMarks).forEach(m => {
|
|
29399
|
+
if (rule.clearMark(m))
|
|
29400
|
+
remove = m.addToSet(remove);
|
|
29401
|
+
});
|
|
29402
|
+
}
|
|
29403
|
+
else {
|
|
29404
|
+
add = this.parser.schema.marks[rule.mark].create(rule.attrs).addToSet(add);
|
|
29405
|
+
}
|
|
29406
|
+
if (rule.consuming === false)
|
|
29407
|
+
after = rule;
|
|
29408
|
+
else
|
|
29409
|
+
break;
|
|
29410
|
+
}
|
|
29384
29411
|
}
|
|
29385
|
-
}
|
|
29386
29412
|
return [add, remove];
|
|
29387
29413
|
}
|
|
29388
29414
|
// Look up a handler for the given node. If none are found, return
|
|
@@ -29666,13 +29692,6 @@
|
|
|
29666
29692
|
function matches(dom, selector) {
|
|
29667
29693
|
return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);
|
|
29668
29694
|
}
|
|
29669
|
-
// Tokenize a style attribute into property/value pairs.
|
|
29670
|
-
function parseStyles(style) {
|
|
29671
|
-
let re = /\s*([\w-]+)\s*:\s*([^;]+)/g, m, result = [];
|
|
29672
|
-
while (m = re.exec(style))
|
|
29673
|
-
result.push(m[1], m[2].trim());
|
|
29674
|
-
return result;
|
|
29675
|
-
}
|
|
29676
29695
|
function copy$1(obj) {
|
|
29677
29696
|
let copy = {};
|
|
29678
29697
|
for (let prop in obj)
|
|
@@ -63197,13 +63216,13 @@ img.ProseMirror-separator {
|
|
|
63197
63216
|
return isTop ? 'top' : isBottom ? 'bottom' : false;
|
|
63198
63217
|
};
|
|
63199
63218
|
row.getPinnedIndex = () => {
|
|
63200
|
-
var
|
|
63219
|
+
var _ref4, _visiblePinnedRowIds$;
|
|
63201
63220
|
const position = row.getIsPinned();
|
|
63202
63221
|
if (!position) return -1;
|
|
63203
|
-
const visiblePinnedRowIds = (
|
|
63222
|
+
const visiblePinnedRowIds = (_ref4 = position === 'top' ? table.getTopRows() : table.getBottomRows()) == null ? void 0 : _ref4.map(_ref5 => {
|
|
63204
63223
|
let {
|
|
63205
63224
|
id
|
|
63206
|
-
} =
|
|
63225
|
+
} = _ref5;
|
|
63207
63226
|
return id;
|
|
63208
63227
|
});
|
|
63209
63228
|
return (_visiblePinnedRowIds$ = visiblePinnedRowIds == null ? void 0 : visiblePinnedRowIds.indexOf(row.id)) != null ? _visiblePinnedRowIds$ : -1;
|
|
@@ -63224,7 +63243,7 @@ img.ProseMirror-separator {
|
|
|
63224
63243
|
}
|
|
63225
63244
|
return Boolean((_pinningState$positio = pinningState[position]) == null ? void 0 : _pinningState$positio.length);
|
|
63226
63245
|
};
|
|
63227
|
-
table._getPinnedRows =
|
|
63246
|
+
table._getPinnedRows = (visibleRows, pinnedRowIds, position) => {
|
|
63228
63247
|
var _table$options$keepPi;
|
|
63229
63248
|
const rows = ((_table$options$keepPi = table.options.keepPinnedRows) != null ? _table$options$keepPi : true) ?
|
|
63230
63249
|
//get all rows that are pinned even if they would not be otherwise visible
|
|
@@ -63239,9 +63258,9 @@ img.ProseMirror-separator {
|
|
|
63239
63258
|
...d,
|
|
63240
63259
|
position
|
|
63241
63260
|
}));
|
|
63242
|
-
}
|
|
63243
|
-
table.getTopRows = () => table._getPinnedRows('top');
|
|
63244
|
-
table.getBottomRows = () => table._getPinnedRows('bottom');
|
|
63261
|
+
};
|
|
63262
|
+
table.getTopRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top], (allRows, topPinnedRowIds) => table._getPinnedRows(allRows, topPinnedRowIds, 'top'), getMemoOptions(table.options, 'debugRows', 'getTopRows'));
|
|
63263
|
+
table.getBottomRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.bottom], (allRows, bottomPinnedRowIds) => table._getPinnedRows(allRows, bottomPinnedRowIds, 'bottom'), getMemoOptions(table.options, 'debugRows', 'getBottomRows'));
|
|
63245
63264
|
table.getCenterRows = memo$1(() => [table.getRowModel().rows, table.getState().rowPinning.top, table.getState().rowPinning.bottom], (allRows, top, bottom) => {
|
|
63246
63265
|
const topAndBottom = new Set([...(top != null ? top : []), ...(bottom != null ? bottom : [])]);
|
|
63247
63266
|
return allRows.filter(d => !topAndBottom.has(d.id));
|
|
@@ -66373,8 +66392,7 @@ focus outline in that case.
|
|
|
66373
66392
|
return () => {
|
|
66374
66393
|
var _a, _b, _c, _d;
|
|
66375
66394
|
let depTime;
|
|
66376
|
-
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts)))
|
|
66377
|
-
depTime = Date.now();
|
|
66395
|
+
if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
|
|
66378
66396
|
const newDeps = getDeps();
|
|
66379
66397
|
const depsChanged = newDeps.length !== deps.length || newDeps.some((dep, index) => deps[index] !== dep);
|
|
66380
66398
|
if (!depsChanged) {
|
|
@@ -66382,8 +66400,7 @@ focus outline in that case.
|
|
|
66382
66400
|
}
|
|
66383
66401
|
deps = newDeps;
|
|
66384
66402
|
let resultTime;
|
|
66385
|
-
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts)))
|
|
66386
|
-
resultTime = Date.now();
|
|
66403
|
+
if (opts.key && ((_b = opts.debug) == null ? void 0 : _b.call(opts))) resultTime = Date.now();
|
|
66387
66404
|
result = fn(...newDeps);
|
|
66388
66405
|
if (opts.key && ((_c = opts.debug) == null ? void 0 : _c.call(opts))) {
|
|
66389
66406
|
const depEndTime = Math.round((Date.now() - depTime) * 100) / 100;
|
|
@@ -66420,11 +66437,11 @@ focus outline in that case.
|
|
|
66420
66437
|
}
|
|
66421
66438
|
}
|
|
66422
66439
|
const approxEqual = (a, b) => Math.abs(a - b) < 1;
|
|
66423
|
-
const debounce = (fn, ms) => {
|
|
66440
|
+
const debounce = (targetWindow, fn, ms) => {
|
|
66424
66441
|
let timeoutId;
|
|
66425
66442
|
return function(...args) {
|
|
66426
|
-
clearTimeout(timeoutId);
|
|
66427
|
-
timeoutId = setTimeout(() => fn.apply(this, args), ms);
|
|
66443
|
+
targetWindow.clearTimeout(timeoutId);
|
|
66444
|
+
timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
|
|
66428
66445
|
};
|
|
66429
66446
|
};
|
|
66430
66447
|
|
|
@@ -66443,16 +66460,20 @@ focus outline in that case.
|
|
|
66443
66460
|
if (!element) {
|
|
66444
66461
|
return;
|
|
66445
66462
|
}
|
|
66463
|
+
const targetWindow = instance.targetWindow;
|
|
66464
|
+
if (!targetWindow) {
|
|
66465
|
+
return;
|
|
66466
|
+
}
|
|
66446
66467
|
const handler = (rect) => {
|
|
66447
66468
|
const { width, height } = rect;
|
|
66448
66469
|
cb({ width: Math.round(width), height: Math.round(height) });
|
|
66449
66470
|
};
|
|
66450
66471
|
handler(element.getBoundingClientRect());
|
|
66451
|
-
if (
|
|
66472
|
+
if (!targetWindow.ResizeObserver) {
|
|
66452
66473
|
return () => {
|
|
66453
66474
|
};
|
|
66454
66475
|
}
|
|
66455
|
-
const observer = new ResizeObserver((entries) => {
|
|
66476
|
+
const observer = new targetWindow.ResizeObserver((entries) => {
|
|
66456
66477
|
const entry = entries[0];
|
|
66457
66478
|
if (entry == null ? void 0 : entry.borderBoxSize) {
|
|
66458
66479
|
const box = entry.borderBoxSize[0];
|
|
@@ -66477,10 +66498,18 @@ focus outline in that case.
|
|
|
66477
66498
|
if (!element) {
|
|
66478
66499
|
return;
|
|
66479
66500
|
}
|
|
66501
|
+
const targetWindow = instance.targetWindow;
|
|
66502
|
+
if (!targetWindow) {
|
|
66503
|
+
return;
|
|
66504
|
+
}
|
|
66480
66505
|
let offset = 0;
|
|
66481
|
-
const fallback = supportsScrollend ? () => void 0 : debounce(
|
|
66482
|
-
|
|
66483
|
-
|
|
66506
|
+
const fallback = supportsScrollend ? () => void 0 : debounce(
|
|
66507
|
+
targetWindow,
|
|
66508
|
+
() => {
|
|
66509
|
+
cb(offset, false);
|
|
66510
|
+
},
|
|
66511
|
+
instance.options.isScrollingResetDelay
|
|
66512
|
+
);
|
|
66484
66513
|
const createHandler = (isScrolling) => () => {
|
|
66485
66514
|
offset = element[instance.options.horizontal ? "scrollLeft" : "scrollTop"];
|
|
66486
66515
|
fallback();
|
|
@@ -66525,28 +66554,31 @@ focus outline in that case.
|
|
|
66525
66554
|
constructor(opts) {
|
|
66526
66555
|
this.unsubs = [];
|
|
66527
66556
|
this.scrollElement = null;
|
|
66557
|
+
this.targetWindow = null;
|
|
66528
66558
|
this.isScrolling = false;
|
|
66529
66559
|
this.scrollToIndexTimeoutId = null;
|
|
66530
66560
|
this.measurementsCache = [];
|
|
66531
66561
|
this.itemSizeCache = /* @__PURE__ */ new Map();
|
|
66532
66562
|
this.pendingMeasuredCacheIndexes = [];
|
|
66563
|
+
this.scrollRect = null;
|
|
66564
|
+
this.scrollOffset = null;
|
|
66533
66565
|
this.scrollDirection = null;
|
|
66534
66566
|
this.scrollAdjustments = 0;
|
|
66535
|
-
this.
|
|
66567
|
+
this.elementsCache = /* @__PURE__ */ new Map();
|
|
66536
66568
|
this.observer = /* @__PURE__ */ (() => {
|
|
66537
66569
|
let _ro = null;
|
|
66538
66570
|
const get = () => {
|
|
66539
66571
|
if (_ro) {
|
|
66540
66572
|
return _ro;
|
|
66541
|
-
}
|
|
66542
|
-
|
|
66543
|
-
entries.forEach((entry) => {
|
|
66544
|
-
this._measureElement(entry.target, entry);
|
|
66545
|
-
});
|
|
66546
|
-
});
|
|
66547
|
-
} else {
|
|
66573
|
+
}
|
|
66574
|
+
if (!this.targetWindow || !this.targetWindow.ResizeObserver) {
|
|
66548
66575
|
return null;
|
|
66549
66576
|
}
|
|
66577
|
+
return _ro = new this.targetWindow.ResizeObserver((entries) => {
|
|
66578
|
+
entries.forEach((entry) => {
|
|
66579
|
+
this._measureElement(entry.target, entry);
|
|
66580
|
+
});
|
|
66581
|
+
});
|
|
66550
66582
|
};
|
|
66551
66583
|
return {
|
|
66552
66584
|
disconnect: () => {
|
|
@@ -66566,8 +66598,7 @@ focus outline in that case.
|
|
|
66566
66598
|
this.range = null;
|
|
66567
66599
|
this.setOptions = (opts2) => {
|
|
66568
66600
|
Object.entries(opts2).forEach(([key, value]) => {
|
|
66569
|
-
if (typeof value === "undefined")
|
|
66570
|
-
delete opts2[key];
|
|
66601
|
+
if (typeof value === "undefined") delete opts2[key];
|
|
66571
66602
|
});
|
|
66572
66603
|
this.options = {
|
|
66573
66604
|
debug: false,
|
|
@@ -66590,6 +66621,7 @@ focus outline in that case.
|
|
|
66590
66621
|
initialMeasurementsCache: [],
|
|
66591
66622
|
lanes: 1,
|
|
66592
66623
|
isScrollingResetDelay: 150,
|
|
66624
|
+
enabled: true,
|
|
66593
66625
|
...opts2
|
|
66594
66626
|
};
|
|
66595
66627
|
};
|
|
@@ -66608,20 +66640,31 @@ focus outline in that case.
|
|
|
66608
66640
|
this.unsubs.filter(Boolean).forEach((d) => d());
|
|
66609
66641
|
this.unsubs = [];
|
|
66610
66642
|
this.scrollElement = null;
|
|
66643
|
+
this.targetWindow = null;
|
|
66644
|
+
this.observer.disconnect();
|
|
66645
|
+
this.elementsCache.clear();
|
|
66611
66646
|
};
|
|
66612
66647
|
this._didMount = () => {
|
|
66613
|
-
this.measureElementCache.forEach(this.observer.observe);
|
|
66614
66648
|
return () => {
|
|
66615
|
-
this.observer.disconnect();
|
|
66616
66649
|
this.cleanup();
|
|
66617
66650
|
};
|
|
66618
66651
|
};
|
|
66619
66652
|
this._willUpdate = () => {
|
|
66620
|
-
|
|
66653
|
+
var _a;
|
|
66654
|
+
const scrollElement = this.options.enabled ? this.options.getScrollElement() : null;
|
|
66621
66655
|
if (this.scrollElement !== scrollElement) {
|
|
66622
66656
|
this.cleanup();
|
|
66657
|
+
if (!scrollElement) {
|
|
66658
|
+
this.notify(false, false);
|
|
66659
|
+
return;
|
|
66660
|
+
}
|
|
66623
66661
|
this.scrollElement = scrollElement;
|
|
66624
|
-
this.
|
|
66662
|
+
if (this.scrollElement && "ownerDocument" in this.scrollElement) {
|
|
66663
|
+
this.targetWindow = this.scrollElement.ownerDocument.defaultView;
|
|
66664
|
+
} else {
|
|
66665
|
+
this.targetWindow = ((_a = this.scrollElement) == null ? void 0 : _a.window) ?? null;
|
|
66666
|
+
}
|
|
66667
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
66625
66668
|
adjustments: void 0,
|
|
66626
66669
|
behavior: void 0
|
|
66627
66670
|
});
|
|
@@ -66634,7 +66677,7 @@ focus outline in that case.
|
|
|
66634
66677
|
this.unsubs.push(
|
|
66635
66678
|
this.options.observeElementOffset(this, (offset, isScrolling) => {
|
|
66636
66679
|
this.scrollAdjustments = 0;
|
|
66637
|
-
this.scrollDirection = isScrolling ? this.
|
|
66680
|
+
this.scrollDirection = isScrolling ? this.getScrollOffset() < offset ? "forward" : "backward" : null;
|
|
66638
66681
|
this.scrollOffset = offset;
|
|
66639
66682
|
const prevIsScrolling = this.isScrolling;
|
|
66640
66683
|
this.isScrolling = isScrolling;
|
|
@@ -66644,28 +66687,21 @@ focus outline in that case.
|
|
|
66644
66687
|
}
|
|
66645
66688
|
};
|
|
66646
66689
|
this.getSize = () => {
|
|
66690
|
+
if (!this.options.enabled) {
|
|
66691
|
+
this.scrollRect = null;
|
|
66692
|
+
return 0;
|
|
66693
|
+
}
|
|
66694
|
+
this.scrollRect = this.scrollRect ?? this.options.initialRect;
|
|
66647
66695
|
return this.scrollRect[this.options.horizontal ? "width" : "height"];
|
|
66648
66696
|
};
|
|
66649
|
-
this.
|
|
66650
|
-
()
|
|
66651
|
-
this.
|
|
66652
|
-
|
|
66653
|
-
this.options.scrollMargin,
|
|
66654
|
-
this.options.getItemKey
|
|
66655
|
-
],
|
|
66656
|
-
(count, paddingStart, scrollMargin, getItemKey) => {
|
|
66657
|
-
this.pendingMeasuredCacheIndexes = [];
|
|
66658
|
-
return {
|
|
66659
|
-
count,
|
|
66660
|
-
paddingStart,
|
|
66661
|
-
scrollMargin,
|
|
66662
|
-
getItemKey
|
|
66663
|
-
};
|
|
66664
|
-
},
|
|
66665
|
-
{
|
|
66666
|
-
key: false
|
|
66697
|
+
this.getScrollOffset = () => {
|
|
66698
|
+
if (!this.options.enabled) {
|
|
66699
|
+
this.scrollOffset = null;
|
|
66700
|
+
return 0;
|
|
66667
66701
|
}
|
|
66668
|
-
|
|
66702
|
+
this.scrollOffset = this.scrollOffset ?? (typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset);
|
|
66703
|
+
return this.scrollOffset;
|
|
66704
|
+
};
|
|
66669
66705
|
this.getFurthestMeasurement = (measurements, index) => {
|
|
66670
66706
|
const furthestMeasurementsFound = /* @__PURE__ */ new Map();
|
|
66671
66707
|
const furthestMeasurements = /* @__PURE__ */ new Map();
|
|
@@ -66693,13 +66729,74 @@ focus outline in that case.
|
|
|
66693
66729
|
return a.end - b.end;
|
|
66694
66730
|
})[0] : void 0;
|
|
66695
66731
|
};
|
|
66732
|
+
this.getMeasurementOptions = memo(
|
|
66733
|
+
() => [
|
|
66734
|
+
this.options.count,
|
|
66735
|
+
this.options.paddingStart,
|
|
66736
|
+
this.options.scrollMargin,
|
|
66737
|
+
this.options.getItemKey,
|
|
66738
|
+
this.options.enabled
|
|
66739
|
+
],
|
|
66740
|
+
(count, paddingStart, scrollMargin, getItemKey, enabled) => {
|
|
66741
|
+
this.pendingMeasuredCacheIndexes = [];
|
|
66742
|
+
return {
|
|
66743
|
+
count,
|
|
66744
|
+
paddingStart,
|
|
66745
|
+
scrollMargin,
|
|
66746
|
+
getItemKey,
|
|
66747
|
+
enabled
|
|
66748
|
+
};
|
|
66749
|
+
},
|
|
66750
|
+
{
|
|
66751
|
+
key: false
|
|
66752
|
+
}
|
|
66753
|
+
);
|
|
66696
66754
|
this.getMeasurements = memo(
|
|
66697
66755
|
() => [this.getMeasurementOptions(), this.itemSizeCache],
|
|
66698
|
-
({ count, paddingStart, scrollMargin, getItemKey }, itemSizeCache) => {
|
|
66756
|
+
({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
|
|
66757
|
+
var _a;
|
|
66758
|
+
if (!enabled) {
|
|
66759
|
+
this.measurementsCache = [];
|
|
66760
|
+
this.itemSizeCache.clear();
|
|
66761
|
+
return [];
|
|
66762
|
+
}
|
|
66763
|
+
if (this.measurementsCache.length === 0) {
|
|
66764
|
+
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
66765
|
+
this.measurementsCache.forEach((item) => {
|
|
66766
|
+
this.itemSizeCache.set(item.key, item.size);
|
|
66767
|
+
});
|
|
66768
|
+
}
|
|
66699
66769
|
const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
|
|
66700
66770
|
this.pendingMeasuredCacheIndexes = [];
|
|
66701
66771
|
const measurements = this.measurementsCache.slice(0, min);
|
|
66702
66772
|
for (let i = min; i < count; i++) {
|
|
66773
|
+
let measureElement2 = (_a = this.measurementsCache[i]) == null ? void 0 : _a.measureElement;
|
|
66774
|
+
if (!measureElement2) {
|
|
66775
|
+
measureElement2 = (node) => {
|
|
66776
|
+
const key2 = getItemKey(i);
|
|
66777
|
+
const prevNode = this.elementsCache.get(key2);
|
|
66778
|
+
if (!node) {
|
|
66779
|
+
if (prevNode) {
|
|
66780
|
+
this.observer.unobserve(prevNode);
|
|
66781
|
+
this.elementsCache.delete(key2);
|
|
66782
|
+
}
|
|
66783
|
+
return;
|
|
66784
|
+
}
|
|
66785
|
+
if (prevNode !== node) {
|
|
66786
|
+
if (prevNode) {
|
|
66787
|
+
this.observer.unobserve(prevNode);
|
|
66788
|
+
}
|
|
66789
|
+
this.observer.observe(node);
|
|
66790
|
+
this.elementsCache.set(key2, node);
|
|
66791
|
+
}
|
|
66792
|
+
if (node.isConnected) {
|
|
66793
|
+
this.resizeItem(
|
|
66794
|
+
i,
|
|
66795
|
+
this.options.measureElement(node, void 0, this)
|
|
66796
|
+
);
|
|
66797
|
+
}
|
|
66798
|
+
};
|
|
66799
|
+
}
|
|
66703
66800
|
const key = getItemKey(i);
|
|
66704
66801
|
const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
|
|
66705
66802
|
const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
|
|
@@ -66713,7 +66810,8 @@ focus outline in that case.
|
|
|
66713
66810
|
size,
|
|
66714
66811
|
end,
|
|
66715
66812
|
key,
|
|
66716
|
-
lane
|
|
66813
|
+
lane,
|
|
66814
|
+
measureElement: measureElement2
|
|
66717
66815
|
};
|
|
66718
66816
|
}
|
|
66719
66817
|
this.measurementsCache = measurements;
|
|
@@ -66725,7 +66823,7 @@ focus outline in that case.
|
|
|
66725
66823
|
}
|
|
66726
66824
|
);
|
|
66727
66825
|
this.calculateRange = memo(
|
|
66728
|
-
() => [this.getMeasurements(), this.getSize(), this.
|
|
66826
|
+
() => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
|
|
66729
66827
|
(measurements, outerSize, scrollOffset) => {
|
|
66730
66828
|
return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
|
|
66731
66829
|
measurements,
|
|
@@ -66770,36 +66868,40 @@ focus outline in that case.
|
|
|
66770
66868
|
return parseInt(indexStr, 10);
|
|
66771
66869
|
};
|
|
66772
66870
|
this._measureElement = (node, entry) => {
|
|
66773
|
-
const
|
|
66871
|
+
const i = this.indexFromElement(node);
|
|
66872
|
+
const item = this.getMeasurements()[i];
|
|
66774
66873
|
if (!item || !node.isConnected) {
|
|
66775
|
-
this.
|
|
66874
|
+
this.elementsCache.forEach((cached, key) => {
|
|
66776
66875
|
if (cached === node) {
|
|
66777
66876
|
this.observer.unobserve(node);
|
|
66778
|
-
this.
|
|
66877
|
+
this.elementsCache.delete(key);
|
|
66779
66878
|
}
|
|
66780
66879
|
});
|
|
66781
66880
|
return;
|
|
66782
66881
|
}
|
|
66783
|
-
const prevNode = this.
|
|
66882
|
+
const prevNode = this.elementsCache.get(item.key);
|
|
66784
66883
|
if (prevNode !== node) {
|
|
66785
66884
|
if (prevNode) {
|
|
66786
66885
|
this.observer.unobserve(prevNode);
|
|
66787
66886
|
}
|
|
66788
66887
|
this.observer.observe(node);
|
|
66789
|
-
this.
|
|
66888
|
+
this.elementsCache.set(item.key, node);
|
|
66790
66889
|
}
|
|
66791
|
-
|
|
66792
|
-
this.resizeItem(item, measuredItemSize);
|
|
66890
|
+
this.resizeItem(i, this.options.measureElement(node, entry, this));
|
|
66793
66891
|
};
|
|
66794
|
-
this.resizeItem = (
|
|
66892
|
+
this.resizeItem = (index, size) => {
|
|
66893
|
+
const item = this.getMeasurements()[index];
|
|
66894
|
+
if (!item) {
|
|
66895
|
+
return;
|
|
66896
|
+
}
|
|
66795
66897
|
const itemSize = this.itemSizeCache.get(item.key) ?? item.size;
|
|
66796
66898
|
const delta = size - itemSize;
|
|
66797
66899
|
if (delta !== 0) {
|
|
66798
|
-
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.
|
|
66900
|
+
if (this.shouldAdjustScrollPositionOnItemSizeChange !== void 0 ? this.shouldAdjustScrollPositionOnItemSizeChange(item, delta, this) : item.start < this.getScrollOffset() + this.scrollAdjustments) {
|
|
66799
66901
|
if (this.options.debug) {
|
|
66800
66902
|
console.info("correction", delta);
|
|
66801
66903
|
}
|
|
66802
|
-
this._scrollToOffset(this.
|
|
66904
|
+
this._scrollToOffset(this.getScrollOffset(), {
|
|
66803
66905
|
adjustments: this.scrollAdjustments += delta,
|
|
66804
66906
|
behavior: void 0
|
|
66805
66907
|
});
|
|
@@ -66833,6 +66935,9 @@ focus outline in that case.
|
|
|
66833
66935
|
);
|
|
66834
66936
|
this.getVirtualItemForOffset = (offset) => {
|
|
66835
66937
|
const measurements = this.getMeasurements();
|
|
66938
|
+
if (measurements.length === 0) {
|
|
66939
|
+
return void 0;
|
|
66940
|
+
}
|
|
66836
66941
|
return notUndefined(
|
|
66837
66942
|
measurements[findNearestBinarySearch(
|
|
66838
66943
|
0,
|
|
@@ -66844,10 +66949,11 @@ focus outline in that case.
|
|
|
66844
66949
|
};
|
|
66845
66950
|
this.getOffsetForAlignment = (toOffset, align) => {
|
|
66846
66951
|
const size = this.getSize();
|
|
66952
|
+
const scrollOffset = this.getScrollOffset();
|
|
66847
66953
|
if (align === "auto") {
|
|
66848
|
-
if (toOffset <=
|
|
66954
|
+
if (toOffset <= scrollOffset) {
|
|
66849
66955
|
align = "start";
|
|
66850
|
-
} else if (toOffset >=
|
|
66956
|
+
} else if (toOffset >= scrollOffset + size) {
|
|
66851
66957
|
align = "end";
|
|
66852
66958
|
} else {
|
|
66853
66959
|
align = "start";
|
|
@@ -66862,28 +66968,33 @@ focus outline in that case.
|
|
|
66862
66968
|
}
|
|
66863
66969
|
const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
|
|
66864
66970
|
const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
|
|
66865
|
-
const maxOffset = scrollSize -
|
|
66971
|
+
const maxOffset = scrollSize - size;
|
|
66866
66972
|
return Math.max(Math.min(maxOffset, toOffset), 0);
|
|
66867
66973
|
};
|
|
66868
66974
|
this.getOffsetForIndex = (index, align = "auto") => {
|
|
66869
66975
|
index = Math.max(0, Math.min(index, this.options.count - 1));
|
|
66870
|
-
const
|
|
66976
|
+
const item = this.getMeasurements()[index];
|
|
66977
|
+
if (!item) {
|
|
66978
|
+
return void 0;
|
|
66979
|
+
}
|
|
66980
|
+
const size = this.getSize();
|
|
66981
|
+
const scrollOffset = this.getScrollOffset();
|
|
66871
66982
|
if (align === "auto") {
|
|
66872
|
-
if (
|
|
66983
|
+
if (item.end >= scrollOffset + size - this.options.scrollPaddingEnd) {
|
|
66873
66984
|
align = "end";
|
|
66874
|
-
} else if (
|
|
66985
|
+
} else if (item.start <= scrollOffset + this.options.scrollPaddingStart) {
|
|
66875
66986
|
align = "start";
|
|
66876
66987
|
} else {
|
|
66877
|
-
return [
|
|
66988
|
+
return [scrollOffset, align];
|
|
66878
66989
|
}
|
|
66879
66990
|
}
|
|
66880
|
-
const toOffset = align === "end" ?
|
|
66991
|
+
const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
|
|
66881
66992
|
return [this.getOffsetForAlignment(toOffset, align), align];
|
|
66882
66993
|
};
|
|
66883
|
-
this.isDynamicMode = () => this.
|
|
66994
|
+
this.isDynamicMode = () => this.elementsCache.size > 0;
|
|
66884
66995
|
this.cancelScrollToIndex = () => {
|
|
66885
|
-
if (this.scrollToIndexTimeoutId !== null) {
|
|
66886
|
-
clearTimeout(this.scrollToIndexTimeoutId);
|
|
66996
|
+
if (this.scrollToIndexTimeoutId !== null && this.targetWindow) {
|
|
66997
|
+
this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);
|
|
66887
66998
|
this.scrollToIndexTimeoutId = null;
|
|
66888
66999
|
}
|
|
66889
67000
|
};
|
|
@@ -66907,17 +67018,21 @@ focus outline in that case.
|
|
|
66907
67018
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
66908
67019
|
);
|
|
66909
67020
|
}
|
|
66910
|
-
const
|
|
66911
|
-
|
|
66912
|
-
|
|
66913
|
-
|
|
67021
|
+
const offsetAndAlign = this.getOffsetForIndex(index, initialAlign);
|
|
67022
|
+
if (!offsetAndAlign) return;
|
|
67023
|
+
const [offset, align] = offsetAndAlign;
|
|
67024
|
+
this._scrollToOffset(offset, { adjustments: void 0, behavior });
|
|
67025
|
+
if (behavior !== "smooth" && this.isDynamicMode() && this.targetWindow) {
|
|
67026
|
+
this.scrollToIndexTimeoutId = this.targetWindow.setTimeout(() => {
|
|
66914
67027
|
this.scrollToIndexTimeoutId = null;
|
|
66915
|
-
const elementInDOM = this.
|
|
67028
|
+
const elementInDOM = this.elementsCache.has(
|
|
66916
67029
|
this.options.getItemKey(index)
|
|
66917
67030
|
);
|
|
66918
67031
|
if (elementInDOM) {
|
|
66919
|
-
const [
|
|
66920
|
-
|
|
67032
|
+
const [latestOffset] = notUndefined(
|
|
67033
|
+
this.getOffsetForIndex(index, align)
|
|
67034
|
+
);
|
|
67035
|
+
if (!approxEqual(latestOffset, this.getScrollOffset())) {
|
|
66921
67036
|
this.scrollToIndex(index, { align, behavior });
|
|
66922
67037
|
}
|
|
66923
67038
|
} else {
|
|
@@ -66933,7 +67048,7 @@ focus outline in that case.
|
|
|
66933
67048
|
"The `smooth` scroll behavior is not fully supported with dynamic size."
|
|
66934
67049
|
);
|
|
66935
67050
|
}
|
|
66936
|
-
this._scrollToOffset(this.
|
|
67051
|
+
this._scrollToOffset(this.getScrollOffset() + delta, {
|
|
66937
67052
|
adjustments: void 0,
|
|
66938
67053
|
behavior
|
|
66939
67054
|
});
|
|
@@ -66963,13 +67078,6 @@ focus outline in that case.
|
|
|
66963
67078
|
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, this, false);
|
|
66964
67079
|
};
|
|
66965
67080
|
this.setOptions(opts);
|
|
66966
|
-
this.scrollRect = this.options.initialRect;
|
|
66967
|
-
this.scrollOffset = typeof this.options.initialOffset === "function" ? this.options.initialOffset() : this.options.initialOffset;
|
|
66968
|
-
this.measurementsCache = this.options.initialMeasurementsCache;
|
|
66969
|
-
this.measurementsCache.forEach((item) => {
|
|
66970
|
-
this.itemSizeCache.set(item.key, item.size);
|
|
66971
|
-
});
|
|
66972
|
-
this.notify(false, false);
|
|
66973
67081
|
}
|
|
66974
67082
|
};
|
|
66975
67083
|
const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
|
|
@@ -67040,7 +67148,10 @@ focus outline in that case.
|
|
|
67040
67148
|
connect() {
|
|
67041
67149
|
this.viewportResizeObserver.observe(this.table.viewport);
|
|
67042
67150
|
this.updateVirtualizer();
|
|
67043
|
-
|
|
67151
|
+
const scrollOffset = this.virtualizer.scrollOffset;
|
|
67152
|
+
if (scrollOffset !== null) {
|
|
67153
|
+
this.table.viewport.scrollTo({ top: scrollOffset });
|
|
67154
|
+
}
|
|
67044
67155
|
}
|
|
67045
67156
|
disconnect() {
|
|
67046
67157
|
this.viewportResizeObserver.disconnect();
|