@limetech/lime-elements 40.2.2 → 40.2.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/CHANGELOG.md +23 -0
- package/dist/cjs/limel-hotkey_4.cjs.entry.js +54 -35
- package/dist/cjs/limel-select.cjs.entry.js +8 -5
- package/dist/cjs/limel-table.cjs.entry.js +19 -5
- package/dist/collection/components/portal/portal.js +54 -35
- package/dist/collection/components/select/select.css +1 -2
- package/dist/collection/components/select/select.js +2 -2
- package/dist/collection/components/select/select.template.js +5 -2
- package/dist/collection/components/table/table.js +19 -5
- package/dist/esm/limel-hotkey_4.entry.js +54 -35
- package/dist/esm/limel-select.entry.js +8 -5
- package/dist/esm/limel-table.entry.js +19 -5
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-d521d599.entry.js → p-33ccc617.entry.js} +1 -1
- package/dist/lime-elements/{p-5e432a44.entry.js → p-3ac35da4.entry.js} +1 -1
- package/dist/lime-elements/p-b1fb33a2.entry.js +23 -0
- package/dist/types/components/portal/portal.d.ts +4 -0
- package/dist/types/components/table/table.d.ts +2 -0
- package/package.json +1 -1
- package/dist/lime-elements/p-9152d7e1.entry.js +0 -23
|
@@ -44,6 +44,9 @@ const hideAnimationDuration = 300;
|
|
|
44
44
|
* @exampleComponent limel-example-portal-basic
|
|
45
45
|
*/
|
|
46
46
|
export class Portal {
|
|
47
|
+
get anchorElement() {
|
|
48
|
+
return this.anchor || this.host;
|
|
49
|
+
}
|
|
47
50
|
constructor() {
|
|
48
51
|
/**
|
|
49
52
|
* Decides which direction the portal content should open.
|
|
@@ -75,14 +78,13 @@ export class Portal {
|
|
|
75
78
|
*/
|
|
76
79
|
this.anchor = null;
|
|
77
80
|
this.loaded = false;
|
|
81
|
+
this.writtenStyles = {};
|
|
78
82
|
this.parents = new WeakMap();
|
|
79
83
|
}
|
|
80
84
|
disconnectedCallback() {
|
|
81
85
|
this.removeContainer();
|
|
82
86
|
this.destroyPopper();
|
|
83
|
-
|
|
84
|
-
this.observer.unobserve(this.container);
|
|
85
|
-
}
|
|
87
|
+
this.observer = null;
|
|
86
88
|
this.container = null;
|
|
87
89
|
}
|
|
88
90
|
connectedCallback() {
|
|
@@ -109,18 +111,9 @@ export class Portal {
|
|
|
109
111
|
this.createPopper();
|
|
110
112
|
this.showContainer();
|
|
111
113
|
}
|
|
112
|
-
if ('ResizeObserver' in window) {
|
|
113
|
-
this.observer = new ResizeObserver(() => {
|
|
114
|
-
if (this.popperInstance) {
|
|
115
|
-
this.styleContainer();
|
|
116
|
-
this.popperInstance.update();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
this.observer.observe(this.container);
|
|
120
|
-
}
|
|
121
114
|
}
|
|
122
115
|
render() {
|
|
123
|
-
return h("slot", { key: '
|
|
116
|
+
return h("slot", { key: '18852003d1bf5f0aeb7c18f73eb26f37e8c75294' });
|
|
124
117
|
}
|
|
125
118
|
onVisible() {
|
|
126
119
|
if (!this.container && this.visible) {
|
|
@@ -140,6 +133,7 @@ export class Portal {
|
|
|
140
133
|
createContainer() {
|
|
141
134
|
const slot = this.host.shadowRoot.querySelector('slot');
|
|
142
135
|
const content = (slot.assignedElements && slot.assignedElements()) || [];
|
|
136
|
+
this.writtenStyles = {};
|
|
143
137
|
this.container = document.createElement('div');
|
|
144
138
|
this.container.setAttribute('id', this.containerId);
|
|
145
139
|
this.container.setAttribute('class', 'limel-portal--container');
|
|
@@ -196,20 +190,19 @@ export class Portal {
|
|
|
196
190
|
}, hideAnimationDuration);
|
|
197
191
|
}
|
|
198
192
|
styleContainer() {
|
|
199
|
-
this.
|
|
200
|
-
this.
|
|
193
|
+
const hostRect = this.host.getBoundingClientRect();
|
|
194
|
+
this.setContainerWidth(hostRect);
|
|
195
|
+
this.setContainerHeight(hostRect);
|
|
201
196
|
this.setContainerStyles();
|
|
202
197
|
}
|
|
203
|
-
setContainerWidth() {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
const containerWidth = this.getContentWidth(this.container);
|
|
207
|
-
let width = containerWidth;
|
|
208
|
-
if (hostWidth > 0) {
|
|
209
|
-
width = hostWidth;
|
|
210
|
-
}
|
|
211
|
-
this.container.style.width = `${width}px`;
|
|
198
|
+
setContainerWidth(hostRect) {
|
|
199
|
+
if (!this.inheritParentWidth) {
|
|
200
|
+
return;
|
|
212
201
|
}
|
|
202
|
+
const width = hostRect.width > 0
|
|
203
|
+
? hostRect.width
|
|
204
|
+
: this.getContentWidth(this.container);
|
|
205
|
+
this.setContainerStyle('width', `${width}px`);
|
|
213
206
|
}
|
|
214
207
|
getContentWidth(element) {
|
|
215
208
|
if (!element) {
|
|
@@ -227,15 +220,42 @@ export class Portal {
|
|
|
227
220
|
this.container.style[property] = this.containerStyle[property];
|
|
228
221
|
}
|
|
229
222
|
}
|
|
223
|
+
// Compared against what was last written rather than against
|
|
224
|
+
// `container.style`, which serializes lengths to six significant digits
|
|
225
|
+
// and so never reads back a fractional width verbatim.
|
|
226
|
+
setContainerStyle(property, value) {
|
|
227
|
+
if (this.writtenStyles[property] === value) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
this.writtenStyles[property] = value;
|
|
231
|
+
this.container.style[property] = value;
|
|
232
|
+
}
|
|
230
233
|
createPopper() {
|
|
234
|
+
this.destroyPopper();
|
|
231
235
|
const config = this.createPopperConfig();
|
|
232
|
-
this.popperInstance = createPopper(this.
|
|
236
|
+
this.popperInstance = createPopper(this.anchorElement, this.container, config);
|
|
237
|
+
this.observeResize();
|
|
233
238
|
}
|
|
234
239
|
destroyPopper() {
|
|
235
|
-
var _a;
|
|
236
|
-
(_a = this.
|
|
240
|
+
var _a, _b;
|
|
241
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
242
|
+
(_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
237
243
|
this.popperInstance = null;
|
|
238
244
|
}
|
|
245
|
+
observeResize() {
|
|
246
|
+
var _a;
|
|
247
|
+
if (!('ResizeObserver' in window)) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
(_a = this.observer) !== null && _a !== void 0 ? _a : (this.observer = new ResizeObserver(() => {
|
|
251
|
+
if (this.popperInstance) {
|
|
252
|
+
this.styleContainer();
|
|
253
|
+
this.popperInstance.update();
|
|
254
|
+
}
|
|
255
|
+
}));
|
|
256
|
+
this.observer.observe(this.container);
|
|
257
|
+
this.observer.observe(this.anchorElement);
|
|
258
|
+
}
|
|
239
259
|
createPopperConfig() {
|
|
240
260
|
const placement = this.getPlacement(this.openDirection);
|
|
241
261
|
const flipPlacement = this.getFlipPlacement(this.openDirection);
|
|
@@ -286,20 +306,19 @@ export class Portal {
|
|
|
286
306
|
};
|
|
287
307
|
return flipPlacements[direction];
|
|
288
308
|
}
|
|
289
|
-
setContainerHeight() {
|
|
309
|
+
setContainerHeight(hostRect) {
|
|
290
310
|
const viewHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
|
|
291
|
-
const
|
|
292
|
-
const
|
|
293
|
-
const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);
|
|
311
|
+
const spaceAboveTopOfSurface = Math.max(hostRect.top, 0);
|
|
312
|
+
const spaceBelowTopOfSurface = Math.max(viewHeight - hostRect.bottom, 0);
|
|
294
313
|
const extraCosmeticSpace = 16;
|
|
295
|
-
const maxHeight = Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
|
|
296
|
-
extraCosmeticSpace;
|
|
297
|
-
this.
|
|
314
|
+
const maxHeight = Math.max(0, Math.round(Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
|
|
315
|
+
extraCosmeticSpace));
|
|
316
|
+
this.setContainerStyle('maxHeight', `${maxHeight}px`);
|
|
298
317
|
}
|
|
299
318
|
// Returns the parent element where the content of the portal will be moved to.
|
|
300
319
|
// It needs to have styling of the portal container.
|
|
301
320
|
getParent() {
|
|
302
|
-
let element = this.
|
|
321
|
+
let element = this.anchorElement;
|
|
303
322
|
while (element) {
|
|
304
323
|
const parent = element.closest('.limel-portal--parent');
|
|
305
324
|
if (parent) {
|
|
@@ -136,8 +136,7 @@
|
|
|
136
136
|
will-change: grid-template-rows;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.limel-
|
|
140
|
-
.limel-select--invalid limel-helper-line {
|
|
139
|
+
div.limel-select__field--open limel-helper-line {
|
|
141
140
|
--limel-h-l-grid-template-rows-transition-speed: 0.46s;
|
|
142
141
|
--limel-h-l-grid-template-rows: 1fr;
|
|
143
142
|
}
|
|
@@ -274,12 +274,12 @@ export class Select {
|
|
|
274
274
|
trigger.focus();
|
|
275
275
|
}
|
|
276
276
|
// During the first render(), the shadow DOM isn't populated yet, so
|
|
277
|
-
// querySelector('.limel-
|
|
277
|
+
// querySelector('.limel-select__field') returns null and we fall back
|
|
278
278
|
// to this.host. componentDidLoad() calls updatePortalAnchor() to
|
|
279
279
|
// imperatively refresh the anchor once the shadow DOM is available.
|
|
280
280
|
getAnchorElement() {
|
|
281
281
|
var _a;
|
|
282
|
-
return ((_a = this.host.shadowRoot.querySelector('.limel-
|
|
282
|
+
return ((_a = this.host.shadowRoot.querySelector('.limel-select__field')) !== null && _a !== void 0 ? _a : this.host);
|
|
283
283
|
}
|
|
284
284
|
updatePortalAnchor() {
|
|
285
285
|
const portal = this.host.shadowRoot.querySelector('limel-portal');
|
|
@@ -25,9 +25,12 @@ export const SelectTemplate = (props) => {
|
|
|
25
25
|
'limel-select--invalid': !isValid,
|
|
26
26
|
'limel-select--with-helper-text': typeof props.helperText === 'string',
|
|
27
27
|
};
|
|
28
|
+
const fieldClassList = {
|
|
29
|
+
'limel-select__field': true,
|
|
30
|
+
'limel-select__field--open': props.isOpen,
|
|
31
|
+
};
|
|
28
32
|
return [
|
|
29
|
-
h("limel-notched-outline", { class: classList, labelId: "s-label", label: props.label, required: props.required, invalid: !isValid, disabled: props.disabled, readonly: props.readonly, hasValue: hasValue, hasFloatingLabel: floatLabelAbove(props) }, h(SelectValue, Object.assign({}, props, { hasValue: hasValue, isValid: isValid, hasEmptyText: hasEmptyText }))),
|
|
30
|
-
h(HelperText, { text: props.helperText, isValid: !props.invalid }),
|
|
33
|
+
h("div", { class: fieldClassList }, h("limel-notched-outline", { class: classList, labelId: "s-label", label: props.label, required: props.required, invalid: !isValid, disabled: props.disabled, readonly: props.readonly, hasValue: hasValue, hasFloatingLabel: floatLabelAbove(props) }, h(SelectValue, Object.assign({}, props, { hasValue: hasValue, isValid: isValid, hasEmptyText: hasEmptyText }))), h(HelperText, { text: props.helperText, isValid: isValid })),
|
|
31
34
|
h(SelectDropdown, Object.assign({}, props)),
|
|
32
35
|
];
|
|
33
36
|
};
|
|
@@ -74,6 +74,7 @@ export class Table {
|
|
|
74
74
|
*/
|
|
75
75
|
this.paginationLocation = 'bottom';
|
|
76
76
|
this.initialized = false;
|
|
77
|
+
this.pendingColumnRefresh = false;
|
|
77
78
|
this.destroyed = false;
|
|
78
79
|
this.shouldSort = false;
|
|
79
80
|
this.hasWarnedOnConflictingMovableAndSortable = false;
|
|
@@ -162,6 +163,7 @@ export class Table {
|
|
|
162
163
|
var _a;
|
|
163
164
|
this.destroyed = true;
|
|
164
165
|
this.initialized = false;
|
|
166
|
+
this.pendingColumnRefresh = false;
|
|
165
167
|
(_a = this.rowDragManager) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
166
168
|
this.rowDragManager = null;
|
|
167
169
|
if (this.resizeObserver) {
|
|
@@ -229,7 +231,8 @@ export class Table {
|
|
|
229
231
|
});
|
|
230
232
|
}
|
|
231
233
|
updateColumns(newColumns, oldColumns) {
|
|
232
|
-
if (!this.tabulator) {
|
|
234
|
+
if (!this.tabulator || !this.initialized) {
|
|
235
|
+
this.pendingColumnRefresh = true;
|
|
233
236
|
return;
|
|
234
237
|
}
|
|
235
238
|
if (this.areSameColumns(newColumns, oldColumns)) {
|
|
@@ -246,7 +249,8 @@ export class Table {
|
|
|
246
249
|
this.shouldSort = true;
|
|
247
250
|
}
|
|
248
251
|
updateAggregates(newAggregates, oldAggregates) {
|
|
249
|
-
if (!this.tabulator) {
|
|
252
|
+
if (!this.tabulator || !this.initialized) {
|
|
253
|
+
this.pendingColumnRefresh = true;
|
|
250
254
|
return;
|
|
251
255
|
}
|
|
252
256
|
if (isEqual(newAggregates, oldAggregates)) {
|
|
@@ -282,7 +286,8 @@ export class Table {
|
|
|
282
286
|
}
|
|
283
287
|
updateSortableColumns() {
|
|
284
288
|
this.warnOnConflictingMovableAndSortable();
|
|
285
|
-
if (!this.tabulator) {
|
|
289
|
+
if (!this.tabulator || !this.initialized) {
|
|
290
|
+
this.pendingColumnRefresh = true;
|
|
286
291
|
return;
|
|
287
292
|
}
|
|
288
293
|
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
@@ -417,6 +422,7 @@ export class Table {
|
|
|
417
422
|
return;
|
|
418
423
|
}
|
|
419
424
|
this.initialized = true;
|
|
425
|
+
this.applyPendingColumnRefresh();
|
|
420
426
|
if ((_a = this.data) === null || _a === void 0 ? void 0 : _a.length) {
|
|
421
427
|
this.updateData(this.data, []);
|
|
422
428
|
if (this.isRemoteMode()) {
|
|
@@ -429,6 +435,14 @@ export class Table {
|
|
|
429
435
|
});
|
|
430
436
|
return tabulator;
|
|
431
437
|
}
|
|
438
|
+
applyPendingColumnRefresh() {
|
|
439
|
+
if (!this.pendingColumnRefresh || !this.tabulator) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
this.pendingColumnRefresh = false;
|
|
443
|
+
this.tabulator.setColumns(this.getColumnDefinitions());
|
|
444
|
+
this.tabulator.recalc();
|
|
445
|
+
}
|
|
432
446
|
initRowDragManager() {
|
|
433
447
|
if (this.movableRows) {
|
|
434
448
|
this.rowDragManager = new RowDragManager(this.pool, this.reorder, () => this.language);
|
|
@@ -734,13 +748,13 @@ export class Table {
|
|
|
734
748
|
render() {
|
|
735
749
|
var _a, _b;
|
|
736
750
|
const totalRows = (_a = this.totalRows) !== null && _a !== void 0 ? _a : this.data.length;
|
|
737
|
-
return (h(Host, { key: '
|
|
751
|
+
return (h(Host, { key: 'bdf212a18d552e674b125bc7211720a4c12017c9', class: {
|
|
738
752
|
'has-low-density': this.layout === 'lowDensity',
|
|
739
753
|
'has-pagination-on-top': this.paginationLocation === 'top',
|
|
740
754
|
'has-aggregation': this.hasAggregation(this.columns),
|
|
741
755
|
'has-pagination': totalRows > this.pageSize,
|
|
742
756
|
'has-selection': (_b = this.tableSelection) === null || _b === void 0 ? void 0 : _b.hasSelection,
|
|
743
|
-
} }, h("div", { key: '
|
|
757
|
+
} }, h("div", { key: '7e2255cc81d1df9ec44b0b10de49ef1dff6c6119', id: "tabulator-container" }, h("div", { key: 'c413d5abefd874be1d7da0764ff6c8b41c096ec0', id: "tabulator-loader", style: { display: this.loading ? 'flex' : 'none' } }, h("limel-spinner", { key: 'f2018824ceef425f572839540a543d71d19b77b3', size: "large" })), this.renderEmptyMessage(), this.renderSelectAll(), h("div", { key: '27dcea556552419f9c904320192c847b94742d2c', id: "tabulator-table" }))));
|
|
744
758
|
}
|
|
745
759
|
renderSelectAll() {
|
|
746
760
|
var _a, _b, _c;
|
|
@@ -1919,6 +1919,9 @@ const IS_VISIBLE_CLASS = 'is-visible';
|
|
|
1919
1919
|
const IS_HIDING_CLASS = 'is-hiding';
|
|
1920
1920
|
const hideAnimationDuration = 300;
|
|
1921
1921
|
const Portal = class {
|
|
1922
|
+
get anchorElement() {
|
|
1923
|
+
return this.anchor || this.host;
|
|
1924
|
+
}
|
|
1922
1925
|
constructor(hostRef) {
|
|
1923
1926
|
registerInstance(this, hostRef);
|
|
1924
1927
|
/**
|
|
@@ -1951,14 +1954,13 @@ const Portal = class {
|
|
|
1951
1954
|
*/
|
|
1952
1955
|
this.anchor = null;
|
|
1953
1956
|
this.loaded = false;
|
|
1957
|
+
this.writtenStyles = {};
|
|
1954
1958
|
this.parents = new WeakMap();
|
|
1955
1959
|
}
|
|
1956
1960
|
disconnectedCallback() {
|
|
1957
1961
|
this.removeContainer();
|
|
1958
1962
|
this.destroyPopper();
|
|
1959
|
-
|
|
1960
|
-
this.observer.unobserve(this.container);
|
|
1961
|
-
}
|
|
1963
|
+
this.observer = null;
|
|
1962
1964
|
this.container = null;
|
|
1963
1965
|
}
|
|
1964
1966
|
connectedCallback() {
|
|
@@ -1985,18 +1987,9 @@ const Portal = class {
|
|
|
1985
1987
|
this.createPopper();
|
|
1986
1988
|
this.showContainer();
|
|
1987
1989
|
}
|
|
1988
|
-
if ('ResizeObserver' in window) {
|
|
1989
|
-
this.observer = new ResizeObserver(() => {
|
|
1990
|
-
if (this.popperInstance) {
|
|
1991
|
-
this.styleContainer();
|
|
1992
|
-
this.popperInstance.update();
|
|
1993
|
-
}
|
|
1994
|
-
});
|
|
1995
|
-
this.observer.observe(this.container);
|
|
1996
|
-
}
|
|
1997
1990
|
}
|
|
1998
1991
|
render() {
|
|
1999
|
-
return h("slot", { key: '
|
|
1992
|
+
return h("slot", { key: '18852003d1bf5f0aeb7c18f73eb26f37e8c75294' });
|
|
2000
1993
|
}
|
|
2001
1994
|
onVisible() {
|
|
2002
1995
|
if (!this.container && this.visible) {
|
|
@@ -2016,6 +2009,7 @@ const Portal = class {
|
|
|
2016
2009
|
createContainer() {
|
|
2017
2010
|
const slot = this.host.shadowRoot.querySelector('slot');
|
|
2018
2011
|
const content = (slot.assignedElements && slot.assignedElements()) || [];
|
|
2012
|
+
this.writtenStyles = {};
|
|
2019
2013
|
this.container = document.createElement('div');
|
|
2020
2014
|
this.container.setAttribute('id', this.containerId);
|
|
2021
2015
|
this.container.setAttribute('class', 'limel-portal--container');
|
|
@@ -2072,20 +2066,19 @@ const Portal = class {
|
|
|
2072
2066
|
}, hideAnimationDuration);
|
|
2073
2067
|
}
|
|
2074
2068
|
styleContainer() {
|
|
2075
|
-
this.
|
|
2076
|
-
this.
|
|
2069
|
+
const hostRect = this.host.getBoundingClientRect();
|
|
2070
|
+
this.setContainerWidth(hostRect);
|
|
2071
|
+
this.setContainerHeight(hostRect);
|
|
2077
2072
|
this.setContainerStyles();
|
|
2078
2073
|
}
|
|
2079
|
-
setContainerWidth() {
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
const containerWidth = this.getContentWidth(this.container);
|
|
2083
|
-
let width = containerWidth;
|
|
2084
|
-
if (hostWidth > 0) {
|
|
2085
|
-
width = hostWidth;
|
|
2086
|
-
}
|
|
2087
|
-
this.container.style.width = `${width}px`;
|
|
2074
|
+
setContainerWidth(hostRect) {
|
|
2075
|
+
if (!this.inheritParentWidth) {
|
|
2076
|
+
return;
|
|
2088
2077
|
}
|
|
2078
|
+
const width = hostRect.width > 0
|
|
2079
|
+
? hostRect.width
|
|
2080
|
+
: this.getContentWidth(this.container);
|
|
2081
|
+
this.setContainerStyle('width', `${width}px`);
|
|
2089
2082
|
}
|
|
2090
2083
|
getContentWidth(element) {
|
|
2091
2084
|
if (!element) {
|
|
@@ -2103,15 +2096,42 @@ const Portal = class {
|
|
|
2103
2096
|
this.container.style[property] = this.containerStyle[property];
|
|
2104
2097
|
}
|
|
2105
2098
|
}
|
|
2099
|
+
// Compared against what was last written rather than against
|
|
2100
|
+
// `container.style`, which serializes lengths to six significant digits
|
|
2101
|
+
// and so never reads back a fractional width verbatim.
|
|
2102
|
+
setContainerStyle(property, value) {
|
|
2103
|
+
if (this.writtenStyles[property] === value) {
|
|
2104
|
+
return;
|
|
2105
|
+
}
|
|
2106
|
+
this.writtenStyles[property] = value;
|
|
2107
|
+
this.container.style[property] = value;
|
|
2108
|
+
}
|
|
2106
2109
|
createPopper() {
|
|
2110
|
+
this.destroyPopper();
|
|
2107
2111
|
const config = this.createPopperConfig();
|
|
2108
|
-
this.popperInstance = createPopper(this.
|
|
2112
|
+
this.popperInstance = createPopper(this.anchorElement, this.container, config);
|
|
2113
|
+
this.observeResize();
|
|
2109
2114
|
}
|
|
2110
2115
|
destroyPopper() {
|
|
2111
|
-
var _a;
|
|
2112
|
-
(_a = this.
|
|
2116
|
+
var _a, _b;
|
|
2117
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
2118
|
+
(_b = this.popperInstance) === null || _b === void 0 ? void 0 : _b.destroy();
|
|
2113
2119
|
this.popperInstance = null;
|
|
2114
2120
|
}
|
|
2121
|
+
observeResize() {
|
|
2122
|
+
var _a;
|
|
2123
|
+
if (!('ResizeObserver' in window)) {
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
(_a = this.observer) !== null && _a !== void 0 ? _a : (this.observer = new ResizeObserver(() => {
|
|
2127
|
+
if (this.popperInstance) {
|
|
2128
|
+
this.styleContainer();
|
|
2129
|
+
this.popperInstance.update();
|
|
2130
|
+
}
|
|
2131
|
+
}));
|
|
2132
|
+
this.observer.observe(this.container);
|
|
2133
|
+
this.observer.observe(this.anchorElement);
|
|
2134
|
+
}
|
|
2115
2135
|
createPopperConfig() {
|
|
2116
2136
|
const placement = this.getPlacement(this.openDirection);
|
|
2117
2137
|
const flipPlacement = this.getFlipPlacement(this.openDirection);
|
|
@@ -2162,20 +2182,19 @@ const Portal = class {
|
|
|
2162
2182
|
};
|
|
2163
2183
|
return flipPlacements[direction];
|
|
2164
2184
|
}
|
|
2165
|
-
setContainerHeight() {
|
|
2185
|
+
setContainerHeight(hostRect) {
|
|
2166
2186
|
const viewHeight = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
|
|
2167
|
-
const
|
|
2168
|
-
const
|
|
2169
|
-
const spaceBelowTopOfSurface = Math.max(viewHeight - bottom, 0);
|
|
2187
|
+
const spaceAboveTopOfSurface = Math.max(hostRect.top, 0);
|
|
2188
|
+
const spaceBelowTopOfSurface = Math.max(viewHeight - hostRect.bottom, 0);
|
|
2170
2189
|
const extraCosmeticSpace = 16;
|
|
2171
|
-
const maxHeight = Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
|
|
2172
|
-
extraCosmeticSpace;
|
|
2173
|
-
this.
|
|
2190
|
+
const maxHeight = Math.max(0, Math.round(Math.max(spaceAboveTopOfSurface, spaceBelowTopOfSurface) -
|
|
2191
|
+
extraCosmeticSpace));
|
|
2192
|
+
this.setContainerStyle('maxHeight', `${maxHeight}px`);
|
|
2174
2193
|
}
|
|
2175
2194
|
// Returns the parent element where the content of the portal will be moved to.
|
|
2176
2195
|
// It needs to have styling of the portal container.
|
|
2177
2196
|
getParent() {
|
|
2178
|
-
let element = this.
|
|
2197
|
+
let element = this.anchorElement;
|
|
2179
2198
|
while (element) {
|
|
2180
2199
|
const parent = element.closest('.limel-portal--parent');
|
|
2181
2200
|
if (parent) {
|