@abgov/web-components 1.14.0-alpha.2 → 1.14.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/web-components",
3
- "version": "1.14.0-alpha.2",
3
+ "version": "1.14.0",
4
4
  "description": "Government of Alberta - UI Web components",
5
5
  "bugs": {
6
6
  "url": "https://github.com/GovAlta/ui-components/issues"
@@ -16622,7 +16622,7 @@ function create_else_block$6(ctx) {
16622
16622
  };
16623
16623
  }
16624
16624
 
16625
- // (83:2) {#if _isTableRoot}
16625
+ // (85:2) {#if _isTableRoot}
16626
16626
  function create_if_block$a(ctx) {
16627
16627
  let slot;
16628
16628
 
@@ -16754,49 +16754,56 @@ function instance$h($$self, $$props, $$invalidate) {
16754
16754
  });
16755
16755
 
16756
16756
  async function attachSortEventHandling() {
16757
+ var _a;
16757
16758
  await tick();
16758
- const headings = _rootEl.querySelectorAll("goa-table-sort-header");
16759
-
16760
- headings.forEach(heading => {
16761
- heading.addEventListener("click", () => {
16762
- const sortBy = heading.getAttribute("name");
16763
- let sortDir;
16759
+ const contentSlot = _rootEl.querySelector("slot");
16764
16760
 
16765
- // relay state to all children
16766
- headings.forEach(child => {
16767
- if (child.getAttribute("name") === sortBy) {
16768
- const direction = child["direction"];
16761
+ const headings = (_a = contentSlot.assignedElements().find(el => el.tagName === "THEAD" || el.tagName === "TABLE")) === null || _a === void 0
16762
+ ? void 0
16763
+ : _a.querySelectorAll("goa-table-sort-header");
16769
16764
 
16770
- // starting direction is asc
16771
- const newDirection = direction === "asc" ? "desc" : "asc";
16765
+ headings === null || headings === void 0
16766
+ ? void 0
16767
+ : headings.forEach(heading => {
16768
+ heading.addEventListener("click", () => {
16769
+ const sortBy = heading.getAttribute("name");
16770
+ let sortDir;
16771
+
16772
+ // relay state to all children
16773
+ headings.forEach(child => {
16774
+ if (child.getAttribute("name") === sortBy) {
16775
+ const direction = child["direction"];
16776
+
16777
+ // starting direction is asc
16778
+ const newDirection = direction === "asc" ? "desc" : "asc";
16779
+
16780
+ sortDir = newDirection === "asc" ? 1 : -1;
16781
+ child.setAttribute("direction", newDirection);
16782
+ } else {
16783
+ child.setAttribute("direction", "none");
16784
+ }
16785
+ });
16772
16786
 
16773
- sortDir = newDirection === "asc" ? 1 : -1;
16774
- child.setAttribute("direction", newDirection);
16775
- } else {
16776
- child.setAttribute("direction", "none");
16777
- }
16787
+ dispatch(heading, { sortBy, sortDir });
16778
16788
  });
16779
16789
 
16780
- dispatch(heading, { sortBy, sortDir });
16790
+ // dispatch the default sort params if initially set
16791
+ const initialSortBy = heading.getAttribute("name");
16792
+
16793
+ const initialDirection = heading["direction"];
16794
+
16795
+ if (initialDirection && initialDirection !== "none") {
16796
+ setTimeout(
16797
+ () => {
16798
+ dispatch(heading, {
16799
+ sortBy: initialSortBy,
16800
+ sortDir: initialDirection === "asc" ? 1 : -1
16801
+ });
16802
+ },
16803
+ 10
16804
+ );
16805
+ }
16781
16806
  });
16782
-
16783
- // dispatch the default sort params if initially set
16784
- const initialSortBy = heading.getAttribute("name");
16785
-
16786
- const initialDirection = heading["direction"];
16787
-
16788
- if (initialDirection && initialDirection !== "none") {
16789
- setTimeout(
16790
- () => {
16791
- dispatch(heading, {
16792
- sortBy: initialSortBy,
16793
- sortDir: initialDirection === "asc" ? 1 : -1
16794
- });
16795
- },
16796
- 10
16797
- );
16798
- }
16799
- });
16800
16807
  }
16801
16808
 
16802
16809
  function div_binding($$value) {