@zywave/zui-table 4.0.1-pre.2 → 4.0.1

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.0.1](https://gitlab.com/zywave/devkit/zui/zui/compare/@zywave/zui-table@4.0.1-pre.5...@zywave/zui-table@4.0.1) (2022-01-26)
7
+
8
+ **Note:** Version bump only for package @zywave/zui-table
9
+
10
+
11
+
12
+
13
+
6
14
  # [4.0.0](https://gitlab.com/zywave/devkit/zui/zui/compare/@zywave/zui-table@4.0.0-pre.3...@zywave/zui-table@4.0.0) (2021-12-10)
7
15
 
8
16
  **Note:** Version bump only for package @zywave/zui-table
@@ -1 +1 @@
1
- zui-table:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:block;width:100%;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}zui-table:not(:defined) [slot=topbar]{display:flex;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}zui-table:not(:defined) [slot=footer]{margin-top:.625rem}zui-table:not(:defined) [slot=no-results-message]{display:none}zui-table:not(:defined) *,zui-table:not(:defined) *::before,zui-table:not(:defined) *::after{box-sizing:inherit}zui-table[banded]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-table[banded]:not(:defined) zui-table-row:not([header]):nth-child(even){background-color:var(--zui-gray-25)}zui-table[banded]:not(:defined) zui-table-row:not([header]){border:0}zui-table[banded]:not(:defined) *,zui-table[banded]:not(:defined) *::before,zui-table[banded]:not(:defined) *::after{box-sizing:inherit}zui-table[no-results]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-table[no-results]:not(:defined) [slot=no-results-message]{display:block;padding:.75rem 1.25rem}zui-table[no-results]:not(:defined) *,zui-table[no-results]:not(:defined) *::before,zui-table[no-results]:not(:defined) *::after{box-sizing:inherit}zui-table-topbar:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}zui-table-topbar:not(:defined) [slot=counter]{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}zui-table-topbar:not(:defined) [slot=action]{margin-left:.625rem}zui-table-topbar:not(:defined) [slot=action] zui-button:not(:first-of-type){margin-left:.625rem}zui-table-topbar:not(:defined) *,zui-table-topbar:not(:defined) *::before,zui-table-topbar:not(:defined) *::after{box-sizing:inherit}zui-table-row:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;background-color:#fff}zui-table-row:not(:defined) *,zui-table-row:not(:defined) *::before,zui-table-row:not(:defined) *::after{box-sizing:inherit}zui-table-row[header]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}zui-table-row[header]:not(:defined) zui-table-cell{font-weight:600}zui-table-row[header]:not(:defined) *,zui-table-row[header]:not(:defined) *::before,zui-table-row[header]:not(:defined) *::after{box-sizing:inherit}zui-table-row:not([header]):not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;border-bottom:1px solid var(--zui-gray-100)}zui-table-row:not([header]):not(:defined) *,zui-table-row:not([header]):not(:defined) *::before,zui-table-row:not([header]):not(:defined) *::after{box-sizing:inherit}zui-table-row:not([header]):last-of-type:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;border-bottom:0}zui-table-row:not([header]):last-of-type:not(:defined) *,zui-table-row:not([header]):last-of-type:not(:defined) *::before,zui-table-row:not([header]):last-of-type:not(:defined) *::after{box-sizing:inherit}zui-table-row[summary]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}zui-table-row[summary]:not(:defined) zui-table-cell{font-weight:600;color:var(--zui-table-summary-text-color, #fff)}zui-table-row[summary]:not(:defined) *,zui-table-row[summary]:not(:defined) *::before,zui-table-row[summary]:not(:defined) *::after{box-sizing:inherit}zui-table-cell:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;flex-grow:1;flex-basis:0;padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}zui-table-cell:not(:defined) *,zui-table-cell:not(:defined) *::before,zui-table-cell:not(:defined) *::after{box-sizing:inherit}zui-table-cell[action]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;--zui-table-cell-padding: 0.375rem 1.25rem;display:flex;align-items:center}zui-table-cell[action]:not(:defined) *,zui-table-cell[action]:not(:defined) *::before,zui-table-cell[action]:not(:defined) *::after{box-sizing:inherit}zui-table-footer:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;justify-content:center;align-items:center;margin-top:var(--zui-table-footer-margin, 0.625rem)}zui-table-footer:not(:defined) zui-pager{width:100%}zui-table-footer:not(:defined) *,zui-table-footer:not(:defined) *::before,zui-table-footer:not(:defined) *::after{box-sizing:inherit}
1
+ zui-table:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:block;width:100%;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}zui-table:not(:defined) [slot=topbar]{display:flex;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}zui-table:not(:defined) [slot=footer]{margin-top:.625rem}zui-table:not(:defined) [slot=no-results-message]{display:none}zui-table:not(:defined) *,zui-table:not(:defined) *::before,zui-table:not(:defined) *::after{box-sizing:inherit}zui-table[banded]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-table[banded]:not(:defined) zui-table-row:not([header]):nth-child(even){background-color:var(--zui-gray-25)}zui-table[banded]:not(:defined) zui-table-row:not([header]){border:0}zui-table[banded]:not(:defined) *,zui-table[banded]:not(:defined) *::before,zui-table[banded]:not(:defined) *::after{box-sizing:inherit}zui-table[no-results]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%}zui-table[no-results]:not(:defined) [slot=no-results-message]{display:block;padding:.75rem 1.25rem}zui-table[no-results]:not(:defined) *,zui-table[no-results]:not(:defined) *::before,zui-table[no-results]:not(:defined) *::after{box-sizing:inherit}zui-table-topbar:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}zui-table-topbar:not(:defined) [slot=counter]{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}zui-table-topbar:not(:defined) [slot=action]{margin-left:.625rem}zui-table-topbar:not(:defined) [slot=action] zui-button:not(:first-of-type){margin-left:.625rem}zui-table-topbar:not(:defined) *,zui-table-topbar:not(:defined) *::before,zui-table-topbar:not(:defined) *::after{box-sizing:inherit}zui-table-row:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:grid;grid-template-columns:auto;padding:.625rem 0;background-color:#fff}@media(min-width: 45em){zui-table-row:not(:defined){display:flex;padding:0}}zui-table-row:not(:defined) *,zui-table-row:not(:defined) *::before,zui-table-row:not(:defined) *::after{box-sizing:inherit}zui-table-row[header]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:none;background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}@media(min-width: 45em){zui-table-row[header]:not(:defined){display:flex}}zui-table-row[header]:not(:defined) zui-table-cell{--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}zui-table-row[header]:not(:defined) *,zui-table-row[header]:not(:defined) *::before,zui-table-row[header]:not(:defined) *::after{box-sizing:inherit}zui-table-row:not([header]):not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;border-bottom:3px solid var(--zui-gray-100)}@media(min-width: 45em){zui-table-row:not([header]):not(:defined){border-bottom-width:1px}}zui-table-row:not([header]):not(:defined) *,zui-table-row:not([header]):not(:defined) *::before,zui-table-row:not([header]):not(:defined) *::after{box-sizing:inherit}zui-table-row:not([header]):last-of-type:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;border-bottom:0}zui-table-row:not([header]):last-of-type:not(:defined) *,zui-table-row:not([header]):last-of-type:not(:defined) *::before,zui-table-row:not([header]):last-of-type:not(:defined) *::after{box-sizing:inherit}zui-table-row[summary]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}zui-table-row[summary]:not(:defined) zui-table-cell{font-weight:600;color:var(--zui-table-summary-text-color, #fff)}zui-table-row[summary]:not(:defined) *,zui-table-row[summary]:not(:defined) *::before,zui-table-row[summary]:not(:defined) *::after{box-sizing:inherit}zui-table-cell:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;flex-grow:1;flex-basis:0;padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem)}@media(min-width: 45em){zui-table-cell:not(:defined){padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}}zui-table-cell:not(:defined) *,zui-table-cell:not(:defined) *::before,zui-table-cell:not(:defined) *::after{box-sizing:inherit}zui-table-cell[action]:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;align-items:center}@media(min-width: 45em){zui-table-cell[action]:not(:defined){--zui-table-cell-padding: 0.375rem 1.25rem}}zui-table-cell[action]:not(:defined) zui-button:not(:first-of-type){margin-left:.625rem}zui-table-cell[action]:not(:defined) *,zui-table-cell[action]:not(:defined) *::before,zui-table-cell[action]:not(:defined) *::after{box-sizing:inherit}zui-table-footer:not(:defined){font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol";font-size:var(--zui-font-size, 0.875rem);font-weight:400;line-height:var(--zui-line-height, 1.6);box-sizing:border-box;-webkit-text-size-adjust:100%;display:flex;justify-content:center;align-items:center;margin-top:var(--zui-table-footer-margin, 0.625rem)}zui-table-footer:not(:defined) zui-pager{width:100%}zui-table-footer:not(:defined) *,zui-table-footer:not(:defined) *::before,zui-table-footer:not(:defined) *::after{box-sizing:inherit}
@@ -179,17 +179,12 @@
179
179
  },
180
180
  {
181
181
  "kind": "field",
182
- "name": "_slotEl",
182
+ "name": "_slottedCells",
183
183
  "type": {
184
- "text": "HTMLSlotElement | undefined"
184
+ "text": "Array<ZuiTableCellElement>"
185
185
  },
186
186
  "privacy": "private"
187
187
  },
188
- {
189
- "kind": "field",
190
- "name": "_slottedCells",
191
- "privacy": "private"
192
- },
193
188
  {
194
189
  "kind": "method",
195
190
  "name": "#setCellsRole"
@@ -366,15 +361,39 @@
366
361
  },
367
362
  {
368
363
  "kind": "field",
369
- "name": "_slotEl",
364
+ "name": "_rows",
370
365
  "type": {
371
- "text": "HTMLSlotElement"
366
+ "text": "Array<ZuiTableRowElement>"
372
367
  },
373
368
  "privacy": "private"
374
369
  },
375
370
  {
376
371
  "kind": "field",
377
372
  "name": "_footer",
373
+ "type": {
374
+ "text": "Array<ZuiTableFooterElement>"
375
+ },
376
+ "privacy": "private"
377
+ },
378
+ {
379
+ "kind": "field",
380
+ "name": "#internals",
381
+ "privacy": "private",
382
+ "type": {
383
+ "text": "ElementInternals | undefined"
384
+ }
385
+ },
386
+ {
387
+ "kind": "field",
388
+ "name": "#mobileBreakpoint",
389
+ "privacy": "private",
390
+ "type": {
391
+ "text": "MediaQueryList"
392
+ }
393
+ },
394
+ {
395
+ "kind": "field",
396
+ "name": "#mobileHeadersEvent",
378
397
  "privacy": "private"
379
398
  },
380
399
  {
@@ -384,6 +403,14 @@
384
403
  {
385
404
  "kind": "method",
386
405
  "name": "#reassignFooter"
406
+ },
407
+ {
408
+ "kind": "method",
409
+ "name": "#addRowHeadersToCells"
410
+ },
411
+ {
412
+ "kind": "method",
413
+ "name": "#removeRowHeadersFromCells"
387
414
  }
388
415
  ],
389
416
  "attributes": [
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{contain:none}:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;display:flex;align-items:center}div{height:100%;padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}`;
2
+ export const style = css `:host{contain:none}:host([action]) div{display:flex}@media(min-width: 45em){:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;align-items:center}}:host([action]) ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem)}@media(min-width: 45em){div{padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}}div.header{float:left;width:33.333%;font-weight:600}div.header+div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem 0.3125rem 0)}`;
3
3
  //# sourceMappingURL=zui-table-cell-css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table-cell-css.js","sourceRoot":"","sources":["../src/zui-table-cell-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,6LAA6L,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;display:flex;align-items:center}div{height:100%;padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}`;\n"]}
1
+ {"version":3,"file":"zui-table-cell-css.js","sourceRoot":"","sources":["../src/zui-table-cell-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,8gBAA8gB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}:host([action]) div{display:flex}@media(min-width: 45em){:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;align-items:center}}:host([action]) ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem)}@media(min-width: 45em){div{padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}}div.header{float:left;width:33.333%;font-weight:600}div.header+div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem 0.3125rem 0)}`;\n"]}
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem}::slotted(zui-table-row:not([header])){border-bottom:1px solid var(--zui-gray-100)}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}`;
2
+ export const style = css `:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){:host([no-results]) .no-results{background-color:transparent;box-shadow:none}}::slotted(zui-table-row:not([header])){border-bottom:3px solid var(--zui-gray-100)}@media(min-width: 45em){::slotted(zui-table-row:not([header])){border-bottom-width:1px}}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}@media(min-width: 45em){.table{background-color:#fff}}`;
3
3
  //# sourceMappingURL=zui-table-css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table-css.js","sourceRoot":"","sources":["../src/zui-table-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,sjBAAsjB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem}::slotted(zui-table-row:not([header])){border-bottom:1px solid var(--zui-gray-100)}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}`;\n"]}
1
+ {"version":3,"file":"zui-table-css.js","sourceRoot":"","sources":["../src/zui-table-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,+0BAA+0B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){:host([no-results]) .no-results{background-color:transparent;box-shadow:none}}::slotted(zui-table-row:not([header])){border-bottom:3px solid var(--zui-gray-100)}@media(min-width: 45em){::slotted(zui-table-row:not([header])){border-bottom-width:1px}}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}@media(min-width: 45em){.table{background-color:#fff}}`;\n"]}
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{contain:none}:host([header]){background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}div{display:grid;grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)))}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;
2
+ export const style = css `:host{contain:none}:host(:last-of-type:not([summary])) div,:host([summary]) div{margin-bottom:0}:host([header]){display:none;background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}@media(min-width: 45em){:host([header]){display:block}}div{display:grid;grid-template-columns:auto;margin-bottom:0;padding:.625rem 0;background-color:#fff}@media(min-width: 45em){div{grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)));padding:0;background-color:transparent}}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) div{margin-bottom:0;background-color:transparent}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;
3
3
  //# sourceMappingURL=zui-table-row-css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table-row-css.js","sourceRoot":"","sources":["../src/zui-table-row-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,ghBAAghB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}:host([header]){background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}div{display:grid;grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)))}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;\n"]}
1
+ {"version":3,"file":"zui-table-row-css.js","sourceRoot":"","sources":["../src/zui-table-row-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,03BAA03B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}:host(:last-of-type:not([summary])) div,:host([summary]) div{margin-bottom:0}:host([header]){display:none;background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}@media(min-width: 45em){:host([header]){display:block}}div{display:grid;grid-template-columns:auto;margin-bottom:0;padding:.625rem 0;background-color:#fff}@media(min-width: 45em){div{grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)));padding:0;background-color:transparent}}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) div{margin-bottom:0;background-color:transparent}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;\n"]}
@@ -18,8 +18,7 @@ export declare class ZuiTableRowElement extends ZuiBaseElement {
18
18
  * Declare a table summary row; typically the last row in `<zui-table>` before `<zui-table-footer>`
19
19
  */
20
20
  summary: boolean;
21
- private _slotEl;
22
- private get _slottedCells();
21
+ private _slottedCells;
23
22
  static get styles(): import("lit").CSSResultGroup[];
24
23
  connectedCallback(): void;
25
24
  firstUpdated(): void;
@@ -12,8 +12,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
12
12
  var _ZuiTableRowElement_instances, _ZuiTableRowElement_setCellsRole;
13
13
  import { ZuiBaseElement } from '@zywave/zui-base';
14
14
  import { html } from 'lit';
15
- import { property, query } from 'lit/decorators.js';
16
- import { findAssignedElements } from '@zywave/zui-base/dist/utils/find-assigned-element.js';
15
+ import { property, queryAssignedElements } from 'lit/decorators.js';
17
16
  import { style } from './zui-table-row-css.js';
18
17
  /**
19
18
  * @element zui-table-row
@@ -37,9 +36,6 @@ export class ZuiTableRowElement extends ZuiBaseElement {
37
36
  */
38
37
  this.summary = false;
39
38
  }
40
- get _slottedCells() {
41
- return findAssignedElements(this._slotEl, 'zui-table-cell');
42
- }
43
39
  static get styles() {
44
40
  return [super.styles, style];
45
41
  }
@@ -61,15 +57,12 @@ _ZuiTableRowElement_instances = new WeakSet(), _ZuiTableRowElement_setCellsRole
61
57
  return;
62
58
  }
63
59
  if (this.header) {
64
- this._slottedCells.forEach((cell) => {
65
- cell.setAttribute('role', 'columnheader');
66
- });
60
+ this._slottedCells.map((cell) => cell.setAttribute('role', 'columnheader'));
67
61
  }
68
62
  else {
69
- this._slottedCells.forEach((cell) => {
70
- cell.setAttribute('role', 'cell');
71
- });
63
+ this._slottedCells.map((cell) => cell.setAttribute('role', 'cell'));
72
64
  }
65
+ this.requestUpdate();
73
66
  };
74
67
  __decorate([
75
68
  property({ type: Boolean, reflect: true })
@@ -78,7 +71,7 @@ __decorate([
78
71
  property({ type: Boolean, reflect: true })
79
72
  ], ZuiTableRowElement.prototype, "summary", void 0);
80
73
  __decorate([
81
- query('slot')
82
- ], ZuiTableRowElement.prototype, "_slotEl", void 0);
74
+ queryAssignedElements({ selector: 'zui-table-cell' })
75
+ ], ZuiTableRowElement.prototype, "_slottedCells", void 0);
83
76
  window.customElements.define('zui-table-row', ZuiTableRowElement);
84
77
  //# sourceMappingURL=zui-table-row.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table-row.js","sourceRoot":"","sources":["../src/zui-table-row.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAC5F,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IAAtD;;;QACE;;WAEG;QAEH,WAAM,GAAG,KAAK,CAAC;QAEf;;WAEG;QA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CAAC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { findAssignedElements } from '@zywave/zui-base/dist/utils/find-assigned-element.js';\nimport { style } from './zui-table-row-css.js';\n\n/**\n * @element zui-table-row\n *\n * @slot - Default slot; `<zui-table-cell>`s are declared here\n *\n * @cssprop [--zui-table-columns-template=repeat(auto-fit, minmax(0, 1fr))] - Override the table columns template. See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns} for more information on valid values.\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Override the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Override the table summary text color\n */\nexport class ZuiTableRowElement extends ZuiBaseElement {\n /**\n * Declare a table header; typically the first row in `<zui-table>`\n */\n @property({ type: Boolean, reflect: true })\n header = false;\n\n /**\n * Declare a table summary row; typically the last row in `<zui-table>` before `<zui-table-footer>`\n */\n @property({ type: Boolean, reflect: true })\n summary = false;\n\n @query('slot')\n private _slotEl: HTMLSlotElement | undefined;\n\n private get _slottedCells() {\n return findAssignedElements(this._slotEl, 'zui-table-cell');\n }\n\n static get styles() {\n return [super.styles, style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'row');\n }\n\n firstUpdated() {\n this.#setCellsRole();\n }\n\n render() {\n return html`<div>\n <slot @slotchange=\"${this.#setCellsRole()}\"></slot>\n </div>`;\n }\n\n #setCellsRole() {\n if (!this._slottedCells) {\n return;\n }\n\n if (this.header) {\n this._slottedCells.forEach((cell) => {\n cell.setAttribute('role', 'columnheader');\n });\n } else {\n this._slottedCells.forEach((cell) => {\n cell.setAttribute('role', 'cell');\n });\n }\n }\n}\n\nwindow.customElements.define('zui-table-row', ZuiTableRowElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table-row': ZuiTableRowElement;\n }\n}\n"]}
1
+ {"version":3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CAAC;KACrE;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;AACvB,CAAC;AA1CD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kDAC5B;AAMf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDAC3B;AAGhB;IADC,qBAAqB,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;yDACJ;AAoCpD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { style } from './zui-table-row-css.js';\nimport type { ZuiTableCellElement } from './zui-table-cell.js';\n\n/**\n * @element zui-table-row\n *\n * @slot - Default slot; `<zui-table-cell>`s are declared here\n *\n * @cssprop [--zui-table-columns-template=repeat(auto-fit, minmax(0, 1fr))] - Override the table columns template. See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns} for more information on valid values.\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Override the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Override the table summary text color\n */\nexport class ZuiTableRowElement extends ZuiBaseElement {\n /**\n * Declare a table header; typically the first row in `<zui-table>`\n */\n @property({ type: Boolean, reflect: true })\n header = false;\n\n /**\n * Declare a table summary row; typically the last row in `<zui-table>` before `<zui-table-footer>`\n */\n @property({ type: Boolean, reflect: true })\n summary = false;\n\n @queryAssignedElements({ selector: 'zui-table-cell' })\n private _slottedCells: Array<ZuiTableCellElement>;\n\n static get styles() {\n return [super.styles, style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'row');\n }\n\n firstUpdated() {\n this.#setCellsRole();\n }\n\n render() {\n return html`<div>\n <slot @slotchange=\"${this.#setCellsRole()}\"></slot>\n </div>`;\n }\n\n #setCellsRole() {\n if (!this._slottedCells) {\n return;\n }\n\n if (this.header) {\n this._slottedCells.map((cell) => cell.setAttribute('role', 'columnheader'));\n } else {\n this._slottedCells.map((cell) => cell.setAttribute('role', 'cell'));\n }\n\n this.requestUpdate();\n }\n}\n\nwindow.customElements.define('zui-table-row', ZuiTableRowElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table-row': ZuiTableRowElement;\n }\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
- export const style = css `:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;
2
+ export const style = css `:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25);box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){.topbar{box-shadow:none}}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;
3
3
  //# sourceMappingURL=zui-table-topbar-css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table-topbar-css.js","sourceRoot":"","sources":["../src/zui-table-topbar-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,6fAA6f,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;\n"]}
1
+ {"version":3,"file":"zui-table-topbar-css.js","sourceRoot":"","sources":["../src/zui-table-topbar-css.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA,mlBAAmlB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const style = css`:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25);box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){.topbar{box-shadow:none}}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;\n"]}
@@ -22,10 +22,12 @@ export declare class ZuiTableElement extends ZuiBaseElement {
22
22
  * Set to show or hide no results message when there are no results; use in conjunction with the assigned slot "no-results-message" to include a no results message
23
23
  */
24
24
  noResults: boolean;
25
- private _slotEl;
26
- private get _footer();
25
+ private _rows;
26
+ private _footer;
27
27
  static get styles(): import("lit").CSSResultGroup[];
28
+ constructor();
28
29
  connectedCallback(): void;
30
+ disconnectedCallback(): void;
29
31
  firstUpdated(): void;
30
32
  render(): import("lit-html").TemplateResult<1>;
31
33
  }
package/dist/zui-table.js CHANGED
@@ -4,17 +4,23 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
7
13
  var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
14
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
15
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
16
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
17
  };
12
- var _ZuiTableElement_instances, _ZuiTableElement_renderNoResultsView, _ZuiTableElement_reassignFooter;
18
+ var _ZuiTableElement_instances, _ZuiTableElement_internals, _ZuiTableElement_mobileBreakpoint, _ZuiTableElement_mobileHeadersEvent, _ZuiTableElement_renderNoResultsView, _ZuiTableElement_reassignFooter, _ZuiTableElement_addRowHeadersToCells, _ZuiTableElement_removeRowHeadersFromCells;
13
19
  import { ZuiBaseElement } from '@zywave/zui-base';
14
20
  import { html } from 'lit';
15
- import { property, query } from 'lit/decorators.js';
21
+ import { property, queryAssignedElements } from 'lit/decorators.js';
16
22
  import { style } from './zui-table-css.js';
17
- import { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-element.js';
23
+ import { screenBreakpoints } from '@zywave/zui-base/dist/utils/breakpoints';
18
24
  /**
19
25
  * @element zui-table
20
26
  *
@@ -30,7 +36,8 @@ import { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-e
30
36
  */
31
37
  export class ZuiTableElement extends ZuiBaseElement {
32
38
  constructor() {
33
- super(...arguments);
39
+ var _a;
40
+ super();
34
41
  _ZuiTableElement_instances.add(this);
35
42
  /**
36
43
  * Set for alternating table row background colors
@@ -41,9 +48,12 @@ export class ZuiTableElement extends ZuiBaseElement {
41
48
  * Set to show or hide no results message when there are no results; use in conjunction with the assigned slot "no-results-message" to include a no results message
42
49
  */
43
50
  this.noResults = false;
44
- }
45
- get _footer() {
46
- return findAssignedElement(this._slotEl, 'zui-table-footer');
51
+ _ZuiTableElement_internals.set(this, void 0);
52
+ _ZuiTableElement_mobileBreakpoint.set(this, window.matchMedia(`only screen and (max-width: ${screenBreakpoints.xsmall})`));
53
+ _ZuiTableElement_mobileHeadersEvent.set(this, (b) => {
54
+ b.matches ? __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_addRowHeadersToCells).call(this) : __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_removeRowHeadersFromCells).call(this);
55
+ });
56
+ __classPrivateFieldSet(this, _ZuiTableElement_internals, (_a = this.attachInternals) === null || _a === void 0 ? void 0 : _a.call(this), "f");
47
57
  }
48
58
  static get styles() {
49
59
  return [super.styles, style];
@@ -51,24 +61,79 @@ export class ZuiTableElement extends ZuiBaseElement {
51
61
  connectedCallback() {
52
62
  super.connectedCallback();
53
63
  this.setAttribute('role', 'table');
64
+ if (__classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").addEventListener) {
65
+ __classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").addEventListener('change', __classPrivateFieldGet(this, _ZuiTableElement_mobileHeadersEvent, "f"));
66
+ }
67
+ else {
68
+ __classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").addListener(__classPrivateFieldGet(this, _ZuiTableElement_mobileHeadersEvent, "f"));
69
+ }
70
+ }
71
+ disconnectedCallback() {
72
+ super.disconnectedCallback();
73
+ if (__classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").addEventListener) {
74
+ __classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").removeEventListener('change', __classPrivateFieldGet(this, _ZuiTableElement_mobileHeadersEvent, "f"));
75
+ }
76
+ else if (__classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").addListener) {
77
+ __classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").removeListener(__classPrivateFieldGet(this, _ZuiTableElement_mobileHeadersEvent, "f"));
78
+ }
54
79
  }
55
80
  firstUpdated() {
56
81
  __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_reassignFooter).call(this);
82
+ __classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").matches ? __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_addRowHeadersToCells).call(this) : __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_removeRowHeadersFromCells).call(this);
57
83
  }
58
84
  render() {
59
85
  return html `<div class="table">
60
- <slot></slot>
86
+ <slot
87
+ @slotchange="${__classPrivateFieldGet(this, _ZuiTableElement_mobileBreakpoint, "f").matches
88
+ ? __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_addRowHeadersToCells).call(this)
89
+ : __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_removeRowHeadersFromCells).call(this)}"
90
+ ></slot>
61
91
  ${this.noResults ? __classPrivateFieldGet(this, _ZuiTableElement_instances, "m", _ZuiTableElement_renderNoResultsView).call(this) : ``}</div
62
92
  >
63
93
  <div><slot name="footer"></slot></div>`;
64
94
  }
65
95
  }
66
- _ZuiTableElement_instances = new WeakSet(), _ZuiTableElement_renderNoResultsView = function _ZuiTableElement_renderNoResultsView() {
96
+ _ZuiTableElement_internals = new WeakMap(), _ZuiTableElement_mobileBreakpoint = new WeakMap(), _ZuiTableElement_mobileHeadersEvent = new WeakMap(), _ZuiTableElement_instances = new WeakSet(), _ZuiTableElement_renderNoResultsView = function _ZuiTableElement_renderNoResultsView() {
67
97
  return html `<div class="no-results"><slot name="no-results-message"></slot></div>`;
68
98
  }, _ZuiTableElement_reassignFooter = function _ZuiTableElement_reassignFooter() {
69
- if (this._footer) {
70
- this._footer.setAttribute('slot', 'footer');
99
+ var _a;
100
+ (_a = this._footer) === null || _a === void 0 ? void 0 : _a.map((f) => f.setAttribute('slot', 'footer'));
101
+ }, _ZuiTableElement_addRowHeadersToCells = function _ZuiTableElement_addRowHeadersToCells() {
102
+ var _a, _b;
103
+ const rowHeadersList = this._rows.filter((h) => h.hasAttribute('header'));
104
+ const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));
105
+ if (rowHeadersList.length > 0) {
106
+ for (const row of rowBodyList) {
107
+ for (let i = 0; i < row.children.length; i++) {
108
+ const cell = row.children[i];
109
+ if (!cell.shadowRoot.querySelector('.header')) {
110
+ const rowHeaderContainer = document.createElement('div');
111
+ rowHeaderContainer.classList.add('header');
112
+ const rowHeaderText = rowHeadersList[0].children[i].textContent;
113
+ rowHeaderContainer.innerText = rowHeaderText;
114
+ cell.shadowRoot.prepend(rowHeaderContainer);
115
+ }
116
+ }
117
+ }
71
118
  }
119
+ // add custom state --mobile to zui-table
120
+ (_b = (_a = __classPrivateFieldGet(this, _ZuiTableElement_internals, "f")) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.add('--mobile');
121
+ this.requestUpdate();
122
+ }, _ZuiTableElement_removeRowHeadersFromCells = function _ZuiTableElement_removeRowHeadersFromCells() {
123
+ var _a, _b;
124
+ const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));
125
+ for (const row of rowBodyList) {
126
+ for (let i = 0; i < row.children.length; i++) {
127
+ const rowChildren = row.children[i].shadowRoot;
128
+ const header = rowChildren.querySelector('.header');
129
+ if (header) {
130
+ rowChildren.removeChild(header);
131
+ }
132
+ }
133
+ }
134
+ // remove custom state --mobile from zui-table
135
+ ((_b = (_a = __classPrivateFieldGet(this, _ZuiTableElement_internals, "f")) === null || _a === void 0 ? void 0 : _a.states) === null || _b === void 0 ? void 0 : _b.has('--mobile')) && __classPrivateFieldGet(this, _ZuiTableElement_internals, "f").states.delete('--mobile');
136
+ this.requestUpdate();
72
137
  };
73
138
  __decorate([
74
139
  property({ type: Boolean, reflect: true })
@@ -77,7 +142,10 @@ __decorate([
77
142
  property({ type: Boolean, reflect: true, attribute: 'no-results' })
78
143
  ], ZuiTableElement.prototype, "noResults", void 0);
79
144
  __decorate([
80
- query('slot')
81
- ], ZuiTableElement.prototype, "_slotEl", void 0);
145
+ queryAssignedElements({ selector: 'zui-table-row' })
146
+ ], ZuiTableElement.prototype, "_rows", void 0);
147
+ __decorate([
148
+ queryAssignedElements({ selector: 'zui-table-footer' })
149
+ ], ZuiTableElement.prototype, "_footer", void 0);
82
150
  window.customElements.define('zui-table', ZuiTableElement);
83
151
  //# sourceMappingURL=zui-table.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zui-table.js","sourceRoot":"","sources":["../src/zui-table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAAnD;;;QACE;;WAEG;QAEH,WAAM,GAAG,KA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lit/decorators.js';\nimport { style } from './zui-table-css.js';\nimport { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-element.js';\n\n/**\n * @element zui-table\n *\n * @slot - Default slot; all table content will appear here, such as table rows\n * @slot no-results-message - Customize the no results message that is shown when the `no-results` attribute is set on `<zui-table>`: `<zui-table no-results>`\n * @slot footer - Only for `<zui-table-footer>`. When there is a `<zui-table-footer>` present inside `<zui-table>`, it will be auto-assigned to this slot in order to place it outside of the rendered table for styling purposes.\n *\n * @cssprop [--zui-table-cell-padding=13px 20px] - Override cell padding\n * @cssprop [--zui-table-columns-template=repeat(auto-fit, minmax(0, 1fr))] - Override the table columns template. See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns} for more information on valid values.\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Override the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Override the the table summary text color\n * @cssprop [--zui-table-footer-margin=10px] - Override the margin between the table and footer of the table\n */\n\nexport class ZuiTableElement extends ZuiBaseElement {\n /**\n * Set for alternating table row background colors\n */\n @property({ type: Boolean, reflect: true })\n banded = false;\n\n // TODO: add divided prop so all table cells will have 1px border\n\n /**\n * Set to show or hide no results message when there are no results; use in conjunction with the assigned slot \"no-results-message\" to include a no results message\n */\n @property({ type: Boolean, reflect: true, attribute: 'no-results' })\n noResults = false;\n\n @query('slot')\n private _slotEl: HTMLSlotElement;\n\n private get _footer() {\n return findAssignedElement(this._slotEl, 'zui-table-footer');\n }\n\n static get styles() {\n return [super.styles, style];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'table');\n }\n\n firstUpdated() {\n this.#reassignFooter();\n }\n\n render() {\n return html`<div class=\"table\">\n <slot></slot>\n ${this.noResults ? this.#renderNoResultsView() : ``}</div\n >\n <div><slot name=\"footer\"></slot></div>`;\n }\n\n #renderNoResultsView() {\n return html`<div class=\"no-results\"><slot name=\"no-results-message\"></slot></div>`;\n }\n\n #reassignFooter() {\n if (this._footer) {\n this._footer.setAttribute('slot', 'footer');\n }\n }\n}\n\nwindow.customElements.define('zui-table', ZuiTableElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table': ZuiTableElement;\n }\n}\n"]}
1
+ {"version":3,"file":"zui-table.js","sourceRoot":"","sources":["../src/zui-table.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAI5E;;;;;;;;;;;;GAYG;AAEH,MAAM,OAAO,eAAgB,SAAQ,cAAc;IAiCjD;;QACE,KAAK,EAAE,CAAC;;QAjCV;;WAEG;QAEH,WAAM,GAAG,KAAK,CAAC;QAEf,iEAAiE;QAEjE;;WAEG;QAEH,cAAS,GAAG,KAAK,CAAC;QAQlB,6CAA8B;QAE9B,4CAAoC,MAAM,CAAC,UAAU,CAAC,+BAA+B,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAC;QAElH,8CAAsB,CAAC,CAAsB,EAAE,EAAE;YAC/C,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAA,IAAI,yEAAsB,MAA1B,IAAI,CAAwB,CAAC,CAAC,CAAC,uBAAA,IAAI,8EAA2B,MAA/B,IAAI,CAA6B,CAAC;QAC/E,CAAC,EAAC;QASA,uBAAA,IAAI,8BAAc,MAAA,IAAI,CAAC,eAAe,+CAApB,IAAI,CAAoB,MAAA,CAAC;IAC7C,CAAC;IARD,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;IAQD,iBAAiB;QACf,KA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AAS,EAAE,YAAY,EAAE,CAAC;kDAClD;AAGlB;IADC,qBAAqB,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;8CACZ;AAGzC;IADC,qBAAqB,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC;gDACV;AAgHhD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC","sourcesContent":["import { ZuiBaseElement } from '@zywave/zui-base';\nimport { html } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\nimport { style } from './zui-table-css.js';\nimport { screenBreakpoints } from '@zywave/zui-base/dist/utils/breakpoints';\nimport type { ZuiTableRowElement } from './zui-table-row.js';\nimport type { ZuiTableFooterElement } from './zui-table-footer.js';\n\n/**\n * @element zui-table\n *\n * @slot - Default slot; all table content will appear here, such as table rows\n * @slot no-results-message - Customize the no results message that is shown when the `no-results` attribute is set on `<zui-table>`: `<zui-table no-results>`\n * @slot footer - Only for `<zui-table-footer>`. When there is a `<zui-table-footer>` present inside `<zui-table>`, it will be auto-assigned to this slot in order to place it outside of the rendered table for styling purposes.\n *\n * @cssprop [--zui-table-cell-padding=13px 20px] - Override cell padding\n * @cssprop [--zui-table-columns-template=repeat(auto-fit, minmax(0, 1fr))] - Override the table columns template. See {@link https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns} for more information on valid values.\n * @cssprop [--zui-table-summary-background-color=var(--zui-gray-600)] - Override the table summary background color\n * @cssprop [--zui-table-summary-text-color=#fff] - Override the the table summary text color\n * @cssprop [--zui-table-footer-margin=10px] - Override the margin between the table and footer of the table\n */\n\nexport class ZuiTableElement extends ZuiBaseElement {\n /**\n * Set for alternating table row background colors\n */\n @property({ type: Boolean, reflect: true })\n banded = false;\n\n // TODO: add divided prop so all table cells will have 1px border\n\n /**\n * Set to show or hide no results message when there are no results; use in conjunction with the assigned slot \"no-results-message\" to include a no results message\n */\n @property({ type: Boolean, reflect: true, attribute: 'no-results' })\n noResults = false;\n\n @queryAssignedElements({ selector: 'zui-table-row' })\n private _rows: Array<ZuiTableRowElement>;\n\n @queryAssignedElements({ selector: 'zui-table-footer' })\n private _footer: Array<ZuiTableFooterElement>;\n\n #internals?: ElementInternals;\n\n #mobileBreakpoint: MediaQueryList = window.matchMedia(`only screen and (max-width: ${screenBreakpoints.xsmall})`);\n\n #mobileHeadersEvent = (b: MediaQueryListEvent) => {\n b.matches ? this.#addRowHeadersToCells() : this.#removeRowHeadersFromCells();\n };\n\n static get styles() {\n return [super.styles, style];\n }\n\n constructor() {\n super();\n\n this.#internals = this.attachInternals?.();\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'table');\n\n if (this.#mobileBreakpoint.addEventListener) {\n this.#mobileBreakpoint.addEventListener('change', this.#mobileHeadersEvent);\n } else {\n this.#mobileBreakpoint.addListener(this.#mobileHeadersEvent);\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n\n if (this.#mobileBreakpoint.addEventListener) {\n this.#mobileBreakpoint.removeEventListener('change', this.#mobileHeadersEvent);\n } else if (this.#mobileBreakpoint.addListener) {\n this.#mobileBreakpoint.removeListener(this.#mobileHeadersEvent);\n }\n }\n\n firstUpdated() {\n this.#reassignFooter();\n\n this.#mobileBreakpoint.matches ? this.#addRowHeadersToCells() : this.#removeRowHeadersFromCells();\n }\n\n render() {\n return html`<div class=\"table\">\n <slot\n @slotchange=\"${this.#mobileBreakpoint.matches\n ? this.#addRowHeadersToCells()\n : this.#removeRowHeadersFromCells()}\"\n ></slot>\n ${this.noResults ? this.#renderNoResultsView() : ``}</div\n >\n <div><slot name=\"footer\"></slot></div>`;\n }\n\n #renderNoResultsView() {\n return html`<div class=\"no-results\"><slot name=\"no-results-message\"></slot></div>`;\n }\n\n #reassignFooter() {\n this._footer?.map((f) => f.setAttribute('slot', 'footer'));\n }\n\n #addRowHeadersToCells() {\n const rowHeadersList = this._rows.filter((h) => h.hasAttribute('header'));\n const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));\n\n if (rowHeadersList.length > 0) {\n for (const row of rowBodyList) {\n for (let i = 0; i < row.children.length; i++) {\n const cell = row.children[i];\n if (!cell.shadowRoot.querySelector('.header')) {\n const rowHeaderContainer = document.createElement('div');\n rowHeaderContainer.classList.add('header');\n const rowHeaderText = rowHeadersList[0].children[i].textContent;\n rowHeaderContainer.innerText = rowHeaderText;\n cell.shadowRoot.prepend(rowHeaderContainer);\n }\n }\n }\n }\n\n // add custom state --mobile to zui-table\n this.#internals?.states?.add('--mobile');\n\n this.requestUpdate();\n }\n\n #removeRowHeadersFromCells() {\n const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));\n\n for (const row of rowBodyList) {\n for (let i = 0; i < row.children.length; i++) {\n const rowChildren = row.children[i].shadowRoot;\n const header = rowChildren.querySelector('.header');\n if (header) {\n rowChildren.removeChild(header);\n }\n }\n }\n\n // remove custom state --mobile from zui-table\n this.#internals?.states?.has('--mobile') && this.#internals.states.delete('--mobile');\n\n this.requestUpdate();\n }\n}\n\nwindow.customElements.define('zui-table', ZuiTableElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'zui-table': ZuiTableElement;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zywave/zui-table",
3
- "version": "4.0.1-pre.2",
3
+ "version": "4.0.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "license": "UNLICENSED",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "customElements": "dist/custom-elements.json",
23
23
  "dependencies": {
24
- "@zywave/zui-base": "^4.1.19-pre.2"
24
+ "@zywave/zui-base": "^4.1.19"
25
25
  },
26
- "gitHead": "3e298837477b09bfe5de979305b5f16164ef72a0"
26
+ "gitHead": "be591f9f992e3555c1891d00a70b140e56bd6616"
27
27
  }
@@ -1,4 +1,5 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-base-styles/src/variables' as *;
2
3
 
3
4
  zui-table {
4
5
  @include undefined-element {
@@ -76,17 +77,30 @@ zui-table-topbar {
76
77
 
77
78
  zui-table-row {
78
79
  @include undefined-element {
79
- display: flex;
80
+ display: grid;
81
+ grid-template-columns: auto;
82
+ padding: rem(10) 0;
80
83
  background-color: #fff;
84
+
85
+ @media (min-width: $bp-xs) {
86
+ display: flex;
87
+ padding: 0;
88
+ }
81
89
  }
82
90
  }
83
91
 
84
92
  zui-table-row[header] {
85
93
  @include undefined-element {
94
+ display: none;
86
95
  background-color: #fff;
87
96
  border-bottom: 1px solid var(--zui-gray-200);
88
97
 
98
+ @media (min-width: $bp-xs) {
99
+ display: flex;
100
+ }
101
+
89
102
  zui-table-cell {
103
+ --zui-table-cell-padding: #{rem(8.5)} #{rem(20)};
90
104
  font-weight: 600;
91
105
  }
92
106
  }
@@ -94,7 +108,11 @@ zui-table-row[header] {
94
108
 
95
109
  zui-table-row:not([header]) {
96
110
  @include undefined-element {
97
- border-bottom: 1px solid var(--zui-gray-100);
111
+ border-bottom: 3px solid var(--zui-gray-100);
112
+
113
+ @media (min-width: $bp-xs) {
114
+ border-bottom-width: 1px;
115
+ }
98
116
  }
99
117
  }
100
118
 
@@ -119,15 +137,26 @@ zui-table-cell {
119
137
  @include undefined-element {
120
138
  flex-grow: 1;
121
139
  flex-basis: 0;
122
- padding: var(--zui-table-cell-padding, #{rem(13)} #{rem(20)});
140
+ padding: var(--zui-table-cell-padding, #{rem(5)} #{rem(15)});
141
+
142
+ @media (min-width: $bp-xs) {
143
+ padding: var(--zui-table-cell-padding, #{rem(13)} #{rem(20)});
144
+ }
123
145
  }
124
146
  }
125
147
 
126
148
  zui-table-cell[action] {
127
149
  @include undefined-element {
128
- --zui-table-cell-padding: #{rem(6) #{rem(20)}};
129
150
  display: flex;
130
151
  align-items: center;
152
+
153
+ @media (min-width: $bp-xs) {
154
+ --zui-table-cell-padding: #{rem(6) #{rem(20)}};
155
+ }
156
+
157
+ zui-button:not(:first-of-type) {
158
+ margin-left: rem(10);
159
+ }
131
160
  }
132
161
  }
133
162
 
@@ -0,0 +1,69 @@
1
+ // can remove once https://github.com/microsoft/TSJS-lib-generator/pull/818 is merged
2
+ // TODO: duplicate file, figure out how to add global *.d.ts files to monorepo
3
+
4
+ interface ValidityStateFlags {
5
+ badInput?: boolean;
6
+ customError?: boolean;
7
+ patternMismatch?: boolean;
8
+ rangeOverflow?: boolean;
9
+ rangeUnderflow?: boolean;
10
+ stepMismatch?: boolean;
11
+ tooLong?: boolean;
12
+ tooShort?: boolean;
13
+ typeMismatch?: boolean;
14
+ valueMissing?: boolean;
15
+ }
16
+
17
+ interface ElementInternals {
18
+ /**
19
+ * Returns the form owner of internals's target element.
20
+ */
21
+ readonly form: HTMLFormElement | null;
22
+ /**
23
+ * Returns a NodeList of all the label elements that internals's target element is associated with.
24
+ */
25
+ readonly labels: NodeList;
26
+ /**
27
+ * Returns the error message that would be shown to the user if internals's target element was to be checked for validity.
28
+ */
29
+ readonly validationMessage: string;
30
+ /**
31
+ * Returns the ValidityState object for internals's target element.
32
+ */
33
+ readonly validity: ValidityState;
34
+ /**
35
+ * Returns true if internals's target element will be validated when the form is submitted; false otherwise.
36
+ */
37
+ readonly willValidate: boolean;
38
+ /**
39
+ * Returns true if internals's target element has no validity problems; false otherwise. Fires an invalid event at the element in the latter case.
40
+ */
41
+ checkValidity(): boolean;
42
+ /**
43
+ * Returns true if internals's target element has no validity problems; otherwise, returns false, fires an invalid event at the element, and (if the event isn't canceled) reports the problem to the user.
44
+ */
45
+ reportValidity(): boolean;
46
+ /**
47
+ * Sets both the state and submission value of internals's target element to value.
48
+ *
49
+ * If value is null, the element won't participate in form submission.
50
+ */
51
+ setFormValue(value: File | string | FormData | null, state?: File | string | FormData | null): void;
52
+ /**
53
+ * Marks internals's target element as suffering from the constraints indicated by the flags argument, and sets the element's validation message to message. If anchor is specified, the user agent might use it to indicate problems with the constraints of internals's target element when the form owner is validated interactively or reportValidity() is called.
54
+ */
55
+ setValidity(flags: ValidityStateFlags, message?: string, anchor?: HTMLElement): void;
56
+ /**
57
+ * Defines custom states for an element to be styled with CSS Pseudoselectors
58
+ */
59
+ states?: Set;
60
+ }
61
+
62
+ declare var ElementInternals: {
63
+ prototype: ElementInternals;
64
+ new (): ElementInternals;
65
+ };
66
+
67
+ interface HTMLElement {
68
+ attachInternals?(): ElementInternals;
69
+ }
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
2
 
3
- export const style = css`:host{contain:none}:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;display:flex;align-items:center}div{height:100%;padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}`;
3
+ export const style = css`:host{contain:none}:host([action]) div{display:flex}@media(min-width: 45em){:host([action]) div{--zui-table-cell-padding: 0.375rem 1.25rem;align-items:center}}:host([action]) ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem)}@media(min-width: 45em){div{padding:var(--zui-table-cell-padding, 0.8125rem 1.25rem)}}div.header{float:left;width:33.333%;font-weight:600}div.header+div{padding:var(--zui-table-cell-padding, 0.3125rem 0.9375rem 0.3125rem 0)}`;
@@ -1,4 +1,5 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-base-styles/src/variables' as *;
2
3
 
3
4
  :host {
4
5
  contain: none;
@@ -6,13 +7,32 @@
6
7
 
7
8
  :host([action]) {
8
9
  div {
9
- --zui-table-cell-padding: #{rem(6) #{rem(20)}};
10
10
  display: flex;
11
- align-items: center;
11
+ @media (min-width: $bp-xs) {
12
+ --zui-table-cell-padding: #{rem(6)} #{rem(20)};
13
+ align-items: center;
14
+ }
15
+ }
16
+
17
+ ::slotted(zui-button:not(:first-of-type)) {
18
+ margin-left: rem(10);
12
19
  }
13
20
  }
14
21
 
15
22
  div {
16
- height: 100%;
17
- padding: var(--zui-table-cell-padding, #{rem(13)} #{rem(20)});
23
+ padding: var(--zui-table-cell-padding, #{rem(5)} #{rem(15)});
24
+
25
+ @media (min-width: $bp-xs) {
26
+ padding: var(--zui-table-cell-padding, #{rem(13)} #{rem(20)});
27
+ }
28
+ }
29
+
30
+ div.header {
31
+ float: left;
32
+ width: 33.333%;
33
+ font-weight: 600;
34
+
35
+ + div {
36
+ padding: var(--zui-table-cell-padding, #{rem(5)} #{rem(15)} #{rem(5)} 0);
37
+ }
18
38
  }
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
2
 
3
- export const style = css`:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem}::slotted(zui-table-row:not([header])){border-bottom:1px solid var(--zui-gray-100)}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}`;
3
+ export const style = css`:host{contain:none;display:block}:host([banded]) ::slotted(zui-table-row:not([header]):nth-child(even)){background-color:var(--zui-gray-25)}:host([banded]) ::slotted(zui-table-row:not([header])){border:0}:host([no-results]) .no-results{padding:.75rem 1.25rem;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){:host([no-results]) .no-results{background-color:transparent;box-shadow:none}}::slotted(zui-table-row:not([header])){border-bottom:3px solid var(--zui-gray-100)}@media(min-width: 45em){::slotted(zui-table-row:not([header])){border-bottom-width:1px}}::slotted(zui-table-row:not([header]):last-of-type){border-bottom:0}.table{display:flex;width:100%;flex-direction:column;box-shadow:0 1px 3px rgba(0,0,0,.29);border-collapse:collapse;border-spacing:0}@media(min-width: 45em){.table{background-color:#fff}}`;
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
2
 
3
- export const style = css`:host{contain:none}:host([header]){background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}div{display:grid;grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)))}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;
3
+ export const style = css`:host{contain:none}:host(:last-of-type:not([summary])) div,:host([summary]) div{margin-bottom:0}:host([header]){display:none;background-color:#fff;border-bottom:1px solid var(--zui-gray-200)}:host([header]) ::slotted(zui-table-cell){--zui-table-cell-padding: 0.53125rem 1.25rem;font-weight:600}@media(min-width: 45em){:host([header]){display:block}}div{display:grid;grid-template-columns:auto;margin-bottom:0;padding:.625rem 0;background-color:#fff}@media(min-width: 45em){div{grid-template-columns:var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)));padding:0;background-color:transparent}}:host([summary]){background-color:var(--zui-table-summary-background-color, var(--zui-gray-600)) !important}:host([summary]) div{margin-bottom:0;background-color:transparent}:host([summary]) ::slotted(zui-table-cell){font-weight:600;color:var(--zui-table-summary-text-color, #fff)}`;
@@ -1,10 +1,19 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-base-styles/src/variables' as *;
2
3
 
3
4
  :host {
4
5
  contain: none;
5
6
  }
6
7
 
8
+ :host(:last-of-type:not([summary])),
9
+ :host([summary]) {
10
+ div {
11
+ margin-bottom: 0;
12
+ }
13
+ }
14
+
7
15
  :host([header]) {
16
+ display: none;
8
17
  background-color: #fff;
9
18
  border-bottom: 1px solid var(--zui-gray-200);
10
19
 
@@ -12,16 +21,34 @@
12
21
  --zui-table-cell-padding: #{rem(8.5)} #{rem(20)};
13
22
  font-weight: 600;
14
23
  }
24
+
25
+ @media (min-width: $bp-xs) {
26
+ display: block;
27
+ }
15
28
  }
16
29
 
17
30
  div {
18
31
  display: grid;
19
- grid-template-columns: var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)));
32
+ grid-template-columns: auto;
33
+ margin-bottom: 0;
34
+ padding: rem(10) 0;
35
+ background-color: #fff;
36
+
37
+ @media (min-width: $bp-xs) {
38
+ grid-template-columns: var(--zui-table-columns-template, repeat(auto-fit, minmax(0, 1fr)));
39
+ padding: 0;
40
+ background-color: transparent;
41
+ }
20
42
  }
21
43
 
22
44
  :host([summary]) {
23
45
  background-color: var(--zui-table-summary-background-color, var(--zui-gray-600)) !important;
24
46
 
47
+ div {
48
+ margin-bottom: 0;
49
+ background-color: transparent;
50
+ }
51
+
25
52
  ::slotted(zui-table-cell) {
26
53
  font-weight: 600;
27
54
  color: var(--zui-table-summary-text-color, #fff);
@@ -1,8 +1,8 @@
1
1
  import { ZuiBaseElement } from '@zywave/zui-base';
2
2
  import { html } from 'lit';
3
- import { property, query } from 'lit/decorators.js';
4
- import { findAssignedElements } from '@zywave/zui-base/dist/utils/find-assigned-element.js';
3
+ import { property, queryAssignedElements } from 'lit/decorators.js';
5
4
  import { style } from './zui-table-row-css.js';
5
+ import type { ZuiTableCellElement } from './zui-table-cell.js';
6
6
 
7
7
  /**
8
8
  * @element zui-table-row
@@ -26,12 +26,8 @@ export class ZuiTableRowElement extends ZuiBaseElement {
26
26
  @property({ type: Boolean, reflect: true })
27
27
  summary = false;
28
28
 
29
- @query('slot')
30
- private _slotEl: HTMLSlotElement | undefined;
31
-
32
- private get _slottedCells() {
33
- return findAssignedElements(this._slotEl, 'zui-table-cell');
34
- }
29
+ @queryAssignedElements({ selector: 'zui-table-cell' })
30
+ private _slottedCells: Array<ZuiTableCellElement>;
35
31
 
36
32
  static get styles() {
37
33
  return [super.styles, style];
@@ -58,14 +54,12 @@ export class ZuiTableRowElement extends ZuiBaseElement {
58
54
  }
59
55
 
60
56
  if (this.header) {
61
- this._slottedCells.forEach((cell) => {
62
- cell.setAttribute('role', 'columnheader');
63
- });
57
+ this._slottedCells.map((cell) => cell.setAttribute('role', 'columnheader'));
64
58
  } else {
65
- this._slottedCells.forEach((cell) => {
66
- cell.setAttribute('role', 'cell');
67
- });
59
+ this._slottedCells.map((cell) => cell.setAttribute('role', 'cell'));
68
60
  }
61
+
62
+ this.requestUpdate();
69
63
  }
70
64
  }
71
65
 
@@ -1,3 +1,3 @@
1
1
  import { css } from 'lit';
2
2
 
3
- export const style = css`:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25)}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;
3
+ export const style = css`:host{contain:none}.topbar{display:flex;width:100%;min-height:3.75rem;align-items:center;padding:.625rem 1.25rem;background-color:var(--zui-gray-25);box-shadow:0 1px 3px rgba(0,0,0,.29)}@media(min-width: 45em){.topbar{box-shadow:none}}.content{display:flex;flex:1;align-items:center}.content ::slotted(zui-search){--zui-search-border-color: var(--zui-gray-50)}.counter{flex-shrink:0;margin-left:auto;padding-left:.625rem;font-size:.75rem;color:var(--zui-gray-400)}.action{margin-left:.625rem}.action ::slotted(zui-button:not(:first-of-type)){margin-left:.625rem}slot[name=action]{display:flex}`;
@@ -1,4 +1,5 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-base-styles/src/variables' as *;
2
3
 
3
4
  :host {
4
5
  contain: none;
@@ -11,6 +12,11 @@
11
12
  align-items: center;
12
13
  padding: rem(10) rem(20);
13
14
  background-color: var(--zui-gray-25);
15
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.29);
16
+
17
+ @media (min-width: $bp-xs) {
18
+ box-shadow: none;
19
+ }
14
20
  }
15
21
 
16
22
  .content {
@@ -1,4 +1,5 @@
1
1
  @use '@zywave/zui-sass-scripts' as *;
2
+ @use '@zywave/zui-base-styles/src/variables' as *;
2
3
 
3
4
  :host {
4
5
  contain: none;
@@ -18,11 +19,22 @@
18
19
  :host([no-results]) {
19
20
  .no-results {
20
21
  padding: rem(12) rem(20);
22
+ background-color: #fff;
23
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.29);
24
+
25
+ @media (min-width: $bp-xs) {
26
+ background-color: transparent;
27
+ box-shadow: none;
28
+ }
21
29
  }
22
30
  }
23
31
 
24
32
  ::slotted(zui-table-row:not([header])) {
25
- border-bottom: 1px solid var(--zui-gray-100);
33
+ border-bottom: 3px solid var(--zui-gray-100);
34
+
35
+ @media (min-width: $bp-xs) {
36
+ border-bottom-width: 1px;
37
+ }
26
38
  }
27
39
 
28
40
  ::slotted(zui-table-row:not([header]):last-of-type) {
@@ -33,8 +45,11 @@
33
45
  display: flex;
34
46
  width: 100%;
35
47
  flex-direction: column;
36
- background-color: #fff;
37
48
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.29);
38
49
  border-collapse: collapse;
39
50
  border-spacing: 0;
51
+
52
+ @media (min-width: $bp-xs) {
53
+ background-color: #fff;
54
+ }
40
55
  }
package/src/zui-table.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { ZuiBaseElement } from '@zywave/zui-base';
2
2
  import { html } from 'lit';
3
- import { property, query } from 'lit/decorators.js';
3
+ import { property, queryAssignedElements } from 'lit/decorators.js';
4
4
  import { style } from './zui-table-css.js';
5
- import { findAssignedElement } from '@zywave/zui-base/dist/utils/find-assigned-element.js';
5
+ import { screenBreakpoints } from '@zywave/zui-base/dist/utils/breakpoints';
6
+ import type { ZuiTableRowElement } from './zui-table-row.js';
7
+ import type { ZuiTableFooterElement } from './zui-table-footer.js';
6
8
 
7
9
  /**
8
10
  * @element zui-table
@@ -33,29 +35,64 @@ export class ZuiTableElement extends ZuiBaseElement {
33
35
  @property({ type: Boolean, reflect: true, attribute: 'no-results' })
34
36
  noResults = false;
35
37
 
36
- @query('slot')
37
- private _slotEl: HTMLSlotElement;
38
+ @queryAssignedElements({ selector: 'zui-table-row' })
39
+ private _rows: Array<ZuiTableRowElement>;
38
40
 
39
- private get _footer() {
40
- return findAssignedElement(this._slotEl, 'zui-table-footer');
41
- }
41
+ @queryAssignedElements({ selector: 'zui-table-footer' })
42
+ private _footer: Array<ZuiTableFooterElement>;
43
+
44
+ #internals?: ElementInternals;
45
+
46
+ #mobileBreakpoint: MediaQueryList = window.matchMedia(`only screen and (max-width: ${screenBreakpoints.xsmall})`);
47
+
48
+ #mobileHeadersEvent = (b: MediaQueryListEvent) => {
49
+ b.matches ? this.#addRowHeadersToCells() : this.#removeRowHeadersFromCells();
50
+ };
42
51
 
43
52
  static get styles() {
44
53
  return [super.styles, style];
45
54
  }
46
55
 
56
+ constructor() {
57
+ super();
58
+
59
+ this.#internals = this.attachInternals?.();
60
+ }
61
+
47
62
  connectedCallback() {
48
63
  super.connectedCallback();
49
64
  this.setAttribute('role', 'table');
65
+
66
+ if (this.#mobileBreakpoint.addEventListener) {
67
+ this.#mobileBreakpoint.addEventListener('change', this.#mobileHeadersEvent);
68
+ } else {
69
+ this.#mobileBreakpoint.addListener(this.#mobileHeadersEvent);
70
+ }
71
+ }
72
+
73
+ disconnectedCallback() {
74
+ super.disconnectedCallback();
75
+
76
+ if (this.#mobileBreakpoint.addEventListener) {
77
+ this.#mobileBreakpoint.removeEventListener('change', this.#mobileHeadersEvent);
78
+ } else if (this.#mobileBreakpoint.addListener) {
79
+ this.#mobileBreakpoint.removeListener(this.#mobileHeadersEvent);
80
+ }
50
81
  }
51
82
 
52
83
  firstUpdated() {
53
84
  this.#reassignFooter();
85
+
86
+ this.#mobileBreakpoint.matches ? this.#addRowHeadersToCells() : this.#removeRowHeadersFromCells();
54
87
  }
55
88
 
56
89
  render() {
57
90
  return html`<div class="table">
58
- <slot></slot>
91
+ <slot
92
+ @slotchange="${this.#mobileBreakpoint.matches
93
+ ? this.#addRowHeadersToCells()
94
+ : this.#removeRowHeadersFromCells()}"
95
+ ></slot>
59
96
  ${this.noResults ? this.#renderNoResultsView() : ``}</div
60
97
  >
61
98
  <div><slot name="footer"></slot></div>`;
@@ -66,9 +103,51 @@ export class ZuiTableElement extends ZuiBaseElement {
66
103
  }
67
104
 
68
105
  #reassignFooter() {
69
- if (this._footer) {
70
- this._footer.setAttribute('slot', 'footer');
106
+ this._footer?.map((f) => f.setAttribute('slot', 'footer'));
107
+ }
108
+
109
+ #addRowHeadersToCells() {
110
+ const rowHeadersList = this._rows.filter((h) => h.hasAttribute('header'));
111
+ const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));
112
+
113
+ if (rowHeadersList.length > 0) {
114
+ for (const row of rowBodyList) {
115
+ for (let i = 0; i < row.children.length; i++) {
116
+ const cell = row.children[i];
117
+ if (!cell.shadowRoot.querySelector('.header')) {
118
+ const rowHeaderContainer = document.createElement('div');
119
+ rowHeaderContainer.classList.add('header');
120
+ const rowHeaderText = rowHeadersList[0].children[i].textContent;
121
+ rowHeaderContainer.innerText = rowHeaderText;
122
+ cell.shadowRoot.prepend(rowHeaderContainer);
123
+ }
124
+ }
125
+ }
126
+ }
127
+
128
+ // add custom state --mobile to zui-table
129
+ this.#internals?.states?.add('--mobile');
130
+
131
+ this.requestUpdate();
132
+ }
133
+
134
+ #removeRowHeadersFromCells() {
135
+ const rowBodyList = this._rows.filter((r) => !r.hasAttribute('header') && !r.hasAttribute('summary'));
136
+
137
+ for (const row of rowBodyList) {
138
+ for (let i = 0; i < row.children.length; i++) {
139
+ const rowChildren = row.children[i].shadowRoot;
140
+ const header = rowChildren.querySelector('.header');
141
+ if (header) {
142
+ rowChildren.removeChild(header);
143
+ }
144
+ }
71
145
  }
146
+
147
+ // remove custom state --mobile from zui-table
148
+ this.#internals?.states?.has('--mobile') && this.#internals.states.delete('--mobile');
149
+
150
+ this.requestUpdate();
72
151
  }
73
152
  }
74
153
 
@@ -9,6 +9,10 @@ import {
9
9
  ZuiTableFooterElement,
10
10
  } from '@zywave/zui-table';
11
11
  import { assert } from '@esm-bundle/chai';
12
+ import { setViewport } from '@web/test-runner-commands';
13
+ import { isMobile } from '../../../../test/src/util/isMobile';
14
+ import { screenBreakpoints } from '@zywave/zui-base/dist/utils/breakpoints';
15
+ import { sleep } from '@zywave/../../test/src/util/helpers';
12
16
 
13
17
  suite('zui-table', () => {
14
18
  let table: ZuiTableElement;
@@ -110,4 +114,36 @@ suite('zui-table', () => {
110
114
 
111
115
  assert.isTrue(footerSlot, 'Expected zui-table-footer to be assigned to a slot');
112
116
  });
117
+
118
+ test('mobile table with headers in cell', async () => {
119
+ const rowHeader = document.createElement('zui-table-row');
120
+ const rowHeaderCell = document.createElement('zui-table-cell');
121
+ rowHeader.setAttribute('header', '');
122
+ rowHeaderCell.innerText = 'Dank';
123
+ rowHeader.appendChild(rowHeaderCell);
124
+ topbar.insertAdjacentElement('afterend', rowHeader);
125
+ cell.innerText = 'Farrik!';
126
+
127
+ // Order matters here
128
+ // TODO: Investigate why setting viewport prior to table update completion fails
129
+ await table.updateComplete;
130
+ await sleep(100);
131
+ await setViewport({ width: 480, height: 640 });
132
+
133
+ const rowHeaderComputedDisplayStyle = window.getComputedStyle(rowHeader).getPropertyValue('display');
134
+ const rowHeaderText = rowHeaderCell.textContent;
135
+ const bodyCellHeaderText = cell.shadowRoot.children[0].textContent;
136
+
137
+ assert.isTrue(isMobile(), `Expected viewport to be <${screenBreakpoints.xsmall}`);
138
+ assert.equal(rowHeaderComputedDisplayStyle, 'none', 'Expected table row header to be hidden on mobile');
139
+ assert.exists(
140
+ cell.shadowRoot.querySelector('.header'),
141
+ 'Expected cell to have an element with class .header in its shadow DOM'
142
+ );
143
+ assert.equal(
144
+ rowHeaderText,
145
+ bodyCellHeaderText,
146
+ `Expected table body cell text (${bodyCellHeaderText}) to have header text (${rowHeaderText}) in it`
147
+ );
148
+ });
113
149
  });