@momentum-design/components 0.122.15 → 0.122.17
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/browser/index.js +61 -57
- package/dist/browser/index.js.map +2 -2
- package/dist/components/virtualizedlist/virtualizedlist.component.d.ts +6 -0
- package/dist/components/virtualizedlist/virtualizedlist.component.js +20 -0
- package/dist/components/virtualizedlist/virtualizedlist.styles.js +4 -0
- package/dist/custom-elements.json +4128 -4123
- package/dist/react/index.d.ts +5 -5
- package/dist/react/index.js +5 -5
- package/package.json +1 -1
|
@@ -219,6 +219,11 @@ declare class VirtualizedList extends VirtualizedList_base {
|
|
|
219
219
|
* @internal
|
|
220
220
|
*/
|
|
221
221
|
private endOfScrollQueue;
|
|
222
|
+
/**
|
|
223
|
+
* Resize observer to monitor size changes of the component.
|
|
224
|
+
* @internal
|
|
225
|
+
*/
|
|
226
|
+
private resizeObserver;
|
|
222
227
|
constructor();
|
|
223
228
|
/**
|
|
224
229
|
* Create the virtualizer controller and the virtualizer instance when the component is first connected to the DOM.
|
|
@@ -288,6 +293,7 @@ declare class VirtualizedList extends VirtualizedList_base {
|
|
|
288
293
|
scrollToIndex(index: number, options?: ScrollToOptions): void;
|
|
289
294
|
private syncUI;
|
|
290
295
|
private handleWheelEvent;
|
|
296
|
+
private handleResizeObserverCallback;
|
|
291
297
|
render(): import("lit-html").TemplateResult<1>;
|
|
292
298
|
static styles: Array<CSSResult>;
|
|
293
299
|
}
|
|
@@ -245,6 +245,11 @@ class VirtualizedList extends DataAriaLabelMixin(List) {
|
|
|
245
245
|
* @internal
|
|
246
246
|
*/
|
|
247
247
|
this.endOfScrollQueue = [];
|
|
248
|
+
/**
|
|
249
|
+
* Resize observer to monitor size changes of the component.
|
|
250
|
+
* @internal
|
|
251
|
+
*/
|
|
252
|
+
this.resizeObserver = null;
|
|
248
253
|
this.handleElementFirstUpdateCompleted = (event) => {
|
|
249
254
|
var _a, _b;
|
|
250
255
|
if (this.observeSizeChanges && this.navItems.find(el => el === event.target) !== undefined) {
|
|
@@ -270,12 +275,18 @@ class VirtualizedList extends DataAriaLabelMixin(List) {
|
|
|
270
275
|
// Set the role attribute for accessibility.
|
|
271
276
|
this.role = null;
|
|
272
277
|
this.atBottom = this.revertList && this.scrollAnchoring ? 'yes' : 'no';
|
|
278
|
+
this.resizeObserver = new ResizeObserver(this.handleResizeObserverCallback.bind(this));
|
|
279
|
+
this.resizeObserver.observe(this);
|
|
273
280
|
}
|
|
274
281
|
disconnectedCallback() {
|
|
275
282
|
super.disconnectedCallback();
|
|
276
283
|
this.clearScrollToBottomTimer();
|
|
277
284
|
this.virtualizerController = null;
|
|
278
285
|
this.virtualizer = null;
|
|
286
|
+
if (this.resizeObserver) {
|
|
287
|
+
this.resizeObserver.disconnect();
|
|
288
|
+
this.resizeObserver = null;
|
|
289
|
+
}
|
|
279
290
|
}
|
|
280
291
|
/**
|
|
281
292
|
* This override is necessary to update the virtualizer with relevant props
|
|
@@ -612,6 +623,15 @@ class VirtualizedList extends DataAriaLabelMixin(List) {
|
|
|
612
623
|
if (e.deltaY < 0)
|
|
613
624
|
this.atBottom = 're-evaluate';
|
|
614
625
|
}
|
|
626
|
+
handleResizeObserverCallback() {
|
|
627
|
+
requestAnimationFrame(() => {
|
|
628
|
+
// If revertList is true and we are positioning the items at the bottom, we need to sync the UI
|
|
629
|
+
// to update the transforms
|
|
630
|
+
if (this.revertList && this.scrollRef.clientHeight >= this.totalListHeight) {
|
|
631
|
+
this.syncUI();
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
615
635
|
render() {
|
|
616
636
|
var _a;
|
|
617
637
|
return html `
|