@teipublisher/pb-components 3.2.1 → 3.2.2
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 +7 -0
- package/dist/pb-components-bundle.js +50 -50
- package/package.json +1 -1
- package/src/pb-table-grid.js +18 -3
package/package.json
CHANGED
package/src/pb-table-grid.js
CHANGED
|
@@ -111,6 +111,7 @@ export class PbTableGrid extends themableMixin(pbMixin(LitElement)) {
|
|
|
111
111
|
this._columns = [];
|
|
112
112
|
this._selectedRow = null;
|
|
113
113
|
this._gridI18nInitialized = false;
|
|
114
|
+
this._visibilityApplyFrame = null;
|
|
114
115
|
this._onTableClick = this._onTableClick.bind(this);
|
|
115
116
|
this._onDocumentClick = this._onDocumentClick.bind(this);
|
|
116
117
|
}
|
|
@@ -181,6 +182,10 @@ export class PbTableGrid extends themableMixin(pbMixin(LitElement)) {
|
|
|
181
182
|
}
|
|
182
183
|
|
|
183
184
|
disconnectedCallback() {
|
|
185
|
+
if (this._visibilityApplyFrame !== null) {
|
|
186
|
+
cancelAnimationFrame(this._visibilityApplyFrame);
|
|
187
|
+
this._visibilityApplyFrame = null;
|
|
188
|
+
}
|
|
184
189
|
document.removeEventListener('click', this._onDocumentClick);
|
|
185
190
|
super.disconnectedCallback();
|
|
186
191
|
}
|
|
@@ -255,16 +260,16 @@ export class PbTableGrid extends themableMixin(pbMixin(LitElement)) {
|
|
|
255
260
|
|
|
256
261
|
this.grid = new Grid(config);
|
|
257
262
|
this._applyPaginationPosition();
|
|
258
|
-
this.grid.on('
|
|
263
|
+
this.grid.on('ready', () => {
|
|
259
264
|
this._clearRowSelection();
|
|
260
265
|
if (this.paginationTop) {
|
|
261
|
-
// `forceRender()` can reset GridJS plugin state; re-apply after each
|
|
266
|
+
// `forceRender()` can reset GridJS plugin state; re-apply after each ready event.
|
|
262
267
|
this.grid.plugin.get('pagination').position = PluginPosition.Header;
|
|
263
268
|
}
|
|
264
269
|
this.emitTo('pb-results-received', {
|
|
265
270
|
params: this._params,
|
|
266
271
|
});
|
|
267
|
-
this.
|
|
272
|
+
this._scheduleColumnVisibilityReapply();
|
|
268
273
|
});
|
|
269
274
|
|
|
270
275
|
this.grid.render(table);
|
|
@@ -311,6 +316,16 @@ export class PbTableGrid extends themableMixin(pbMixin(LitElement)) {
|
|
|
311
316
|
});
|
|
312
317
|
}
|
|
313
318
|
|
|
319
|
+
_scheduleColumnVisibilityReapply() {
|
|
320
|
+
if (this._visibilityApplyFrame !== null) {
|
|
321
|
+
cancelAnimationFrame(this._visibilityApplyFrame);
|
|
322
|
+
}
|
|
323
|
+
this._visibilityApplyFrame = requestAnimationFrame(() => {
|
|
324
|
+
this._visibilityApplyFrame = null;
|
|
325
|
+
this._applyColumnVisibilityToDom();
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
314
329
|
_onTableClick(event) {
|
|
315
330
|
const row = event.target.closest('tbody tr');
|
|
316
331
|
if (!row) {
|