@brightspace-ui/core 3.175.3 → 3.175.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.
@@ -41,6 +41,7 @@ class TestTable extends DemoPassthroughMixin(TableWrapper, 'd2l-table-wrapper')
41
41
  return {
42
42
  paging: { type: Boolean, reflect: true },
43
43
  multiLine: { type: Boolean, attribute: 'multi-line' },
44
+ resetOnSort: { type: Boolean, attribute: 'reset-on-sort' },
44
45
  showButtons: { type: Boolean, attribute: 'show-buttons' },
45
46
  stickyControls: { attribute: 'sticky-controls', type: Boolean, reflect: true },
46
47
  visibleBackground: { attribute: 'visible-background', type: Boolean, reflect: true },
@@ -187,7 +188,7 @@ class TestTable extends DemoPassthroughMixin(TableWrapper, 'd2l-table-wrapper')
187
188
  }
188
189
 
189
190
  _handleSortData() {
190
- this._data = this._data.sort((a, b) => {
191
+ this._data = (this.resetOnSort ? data() : this._data).sort((a, b) => {
191
192
  if (this._sortDesc) {
192
193
  if (a.data[this._sortField] > b.data[this._sortField]) return -1;
193
194
  if (a.data[this._sortField] < b.data[this._sortField]) return 1;
@@ -50,6 +50,13 @@
50
50
  </template>
51
51
  </d2l-demo-snippet>
52
52
 
53
+ <h2>Default, Paging, Reset on sort</h2>
54
+ <d2l-demo-snippet>
55
+ <template>
56
+ <d2l-test-table type="default" sticky-controls paging reset-on-sort></d2l-test-table>
57
+ </template>
58
+ </d2l-demo-snippet>
59
+
53
60
  <h2>Default, Visible controls background</h2>
54
61
  <d2l-demo-snippet>
55
62
  <template>
@@ -258,7 +258,8 @@ export const tableStyles = css`
258
258
 
259
259
  const SELECTORS = {
260
260
  headers: 'tr.d2l-table-header, tr[header], thead tr',
261
- items: ':not(thead) > tr:not(.d2l-table-header):not([header])',
261
+ body: ':not(thead)',
262
+ items: 'tr:not(.d2l-table-header):not([header])',
262
263
  };
263
264
 
264
265
  /**
@@ -494,7 +495,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
494
495
  }
495
496
 
496
497
  _getItems() {
497
- return this._table?.querySelectorAll(SELECTORS.items) || [];
498
+ return this._table?.querySelectorAll(`${SELECTORS.body} > ${SELECTORS.items}`) || [];
498
499
  }
499
500
 
500
501
  _getItemShowingCount() {
@@ -604,7 +605,7 @@ export class TableWrapper extends PageableMixin(SelectionMixin(LitElement)) {
604
605
  updates.classNames ||= node.matches('tr, td, th');
605
606
  updates.syncWidths ||= node.matches('tr');
606
607
  updates.sticky ||= node.matches(SELECTORS.headers);
607
- updates.count ||= node.matches(SELECTORS.items);
608
+ updates.count ||= node.matches(SELECTORS.items) && target.matches(SELECTORS.body);
608
609
  }
609
610
  }
610
611
  }
@@ -14,7 +14,6 @@ import { RtlMixin } from '../../mixins/rtl/rtl-mixin.js';
14
14
  import { styleMap } from 'lit/directives/style-map.js';
15
15
 
16
16
  const usePopoverMixin = getFlag('GAUD-7355-tooltip-popover', false);
17
- const useMutationObserver = getFlag('GAUD-8203-tooltip-mutation-observer', true);
18
17
 
19
18
  const contentBorderSize = 1;
20
19
  const contentHorizontalPadding = 15;
@@ -337,11 +336,9 @@ if (usePopoverMixin) {
337
336
  this.#targetSizeObserver = new ResizeObserver(this.#handleTargetResizeBound);
338
337
  this.#targetSizeObserver.observe(this.#target);
339
338
 
340
- if (useMutationObserver) {
341
- this.#targetMutationObserver = new MutationObserver(this.#handleTargetMutationBound);
342
- this.#targetMutationObserver.observe(this.#target, { attributes: true, attributeFilter: ['id'] });
343
- this.#targetMutationObserver.observe(this.#target.parentNode, { childList: true });
344
- }
339
+ this.#targetMutationObserver = new MutationObserver(this.#handleTargetMutationBound);
340
+ this.#targetMutationObserver.observe(this.#target, { attributes: true, attributeFilter: ['id'] });
341
+ this.#targetMutationObserver.observe(this.#target.parentNode, { childList: true });
345
342
  }
346
343
 
347
344
  #findTarget() {
@@ -1215,11 +1212,9 @@ if (usePopoverMixin) {
1215
1212
  this._targetSizeObserver = new ResizeObserver(this._onTargetResize);
1216
1213
  this._targetSizeObserver.observe(this._target);
1217
1214
 
1218
- if (useMutationObserver) {
1219
- this._targetMutationObserver = new MutationObserver(this._onTargetMutation);
1220
- this._targetMutationObserver.observe(this._target, { attributes: true, attributeFilter: ['id'] });
1221
- this._targetMutationObserver.observe(this._target.parentNode, { childList: true });
1222
- }
1215
+ this._targetMutationObserver = new MutationObserver(this._onTargetMutation);
1216
+ this._targetMutationObserver.observe(this._target, { attributes: true, attributeFilter: ['id'] });
1217
+ this._targetMutationObserver.observe(this._target.parentNode, { childList: true });
1223
1218
  }
1224
1219
 
1225
1220
  _computeAvailableSpaces(targetRect, spaceAround) {
@@ -13495,6 +13495,10 @@
13495
13495
  "name": "d2l-test-table",
13496
13496
  "path": "./components/table/demo/table-test.js",
13497
13497
  "attributes": [
13498
+ {
13499
+ "name": "reset-on-sort",
13500
+ "type": "boolean"
13501
+ },
13498
13502
  {
13499
13503
  "name": "multi-line",
13500
13504
  "type": "boolean",
@@ -13557,6 +13561,11 @@
13557
13561
  }
13558
13562
  ],
13559
13563
  "properties": [
13564
+ {
13565
+ "name": "resetOnSort",
13566
+ "attribute": "reset-on-sort",
13567
+ "type": "boolean"
13568
+ },
13560
13569
  {
13561
13570
  "name": "multiLine",
13562
13571
  "attribute": "multi-line",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.175.3",
3
+ "version": "3.175.4",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",