scb-wc 0.1.63 → 0.1.65
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.
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{_ as g,b as _,g as v,h as
|
|
1
|
+
import{_ as g,b as _,g as v,h as f,y as C}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as b}from"../../vendor/decorate.js";import"../scb-icon-button/scb-icon-button.js";(function(){try{var y=typeof globalThis<"u"?globalThis:window;if(!y.__scb_ce_guard_installed__){y.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,r,t){try{customElements.get(s)||e(s,r,t)}catch(a){var l=String(a||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p,w=96,S=32,m=(p=class extends g{constructor(...e){super(...e),this.dataSorting=!1,this.columnWidthMode="auto",this._sortedColumn=null,this._sortDirection="asc",this._columnWidthFrame=null,this._onSlotChange=()=>{this._attachThListeners()}}render(){return C`
|
|
2
2
|
<div class="scb-table-scroll-wrapper">
|
|
3
3
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}firstUpdated(){const e=this.shadowRoot?.querySelector("slot");e&&(e.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners())}updated(e){e.has("dataSorting")&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection="asc"),this._attachThListeners()),e.has("columnWidthMode")&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){const e=this.shadowRoot?.querySelector("slot");if(!e)return null;const
|
|
5
|
+
`}firstUpdated(){const e=this.shadowRoot?.querySelector("slot");e&&(e.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners())}updated(e){e.has("dataSorting")&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection="asc"),this._attachThListeners()),e.has("columnWidthMode")&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){const e=this.shadowRoot?.querySelector("slot");if(!e)return null;const s=e.assignedNodes({flatten:!0});for(const r of s)if(r.nodeType===Node.ELEMENT_NODE){const t=r,l=t.tagName.toLowerCase()==="tbody"?t:t.querySelector("tbody");if(l)return l}return null}_getTables(){const e=this.shadowRoot?.querySelector("slot");if(!e)return[];const s=e.assignedNodes({flatten:!0}),r=[];return s.forEach(t=>{if(t.nodeType===Node.ELEMENT_NODE){const l=t;l.tagName.toLowerCase()==="table"&&r.push(l),r.push(...Array.from(l.querySelectorAll("table")))}}),r}_attachThListeners(){const e=this.shadowRoot?.querySelector("slot");if(!e)return;const s=e.assignedNodes({flatten:!0}),r=[],t=[],l=[],a=[];s.forEach(o=>{o.nodeType===Node.ELEMENT_NODE&&(r.push(...o.querySelectorAll("thead")),t.push(...o.querySelectorAll("th")),l.push(...o.querySelectorAll("td")),a.push(...o.querySelectorAll("tr")))}),r.forEach(o=>{o.style.borderTop="1px solid var(--md-sys-color-on-surface)"}),t.forEach((o,i)=>{o.style.textAlign="left",o.style.padding="12px",o.style.position="relative",o.style.backgroundColor="var(--md-sys-color-surface)",o.style.fontFamily="var(--md-sys-typescale-label-medium-font)",o.style.fontSize="var(--md-sys-typescale-label-medium-size)",o.style.lineHeight="var(--md-sys-typescale-label-medium-line-height)",o.style.fontWeight=" var(--weight-bold)",o.style.letterSpacing="var(--md-sys-typescale-label-medium-tracking)",o.style.verticalAlign="bottom",o.style.borderRight="1px solid var(--md-sys-color-on-surface)",o.style.borderBottom="1px solid var(--md-sys-color-on-surface)",o.style.overflowWrap="normal",o.style.wordBreak="normal",o.style.hyphens="manual";const c=(o.textContent??"").replace(/\s+/g," ").trim();for(;o.firstChild;)o.removeChild(o.firstChild);const u=document.createElement("p");if(u.textContent=c,u.style.margin="0",this.dataSorting){const d=document.createElement("scb-icon-button");d.className="scb-sort-icon",d.onclick=()=>this._onThClick(i),d.setAttribute("variant","standard"),d.setAttribute("size","small"),d.style.alignSelf="end",this._sortedColumn===i?(d.setAttribute("variant","filled-tonal"),d.setAttribute("icon",this._sortDirection==="asc"?"arrow_downward":"arrow_upward")):(d.setAttribute("icon","swap_horiz"),d.style.transform+=" rotate(90deg)");const h=document.createElement("div");h.style.display="flex",h.style.gap="8px",h.style.flexWrap="nowrap",h.style.alignItems="center",h.appendChild(u),h.appendChild(d),o.appendChild(h)}else o.appendChild(u)}),l.forEach(o=>{o.style.padding="12px",o.style.textAlign="left",o.style.borderTop="1px solid var(--md-sys-color-outline-variant)",o.style.verticalAlign="text-top",o.style.backgroundColor="var(--md-sys-color-surface)",o.style.fontFamily="var(--md-sys-typescale-body-medium-font)",o.style.fontSize="var(--md-sys-typescale-body-medium-size)",o.style.lineHeight="var(--md-sys-typescale-body-medium-line-height)",o.style.fontWeight="var(--md-sys-typescale-body-medium-weight)",o.style.letterSpacing="var(--md-sys-typescale-body-medium-tracking)",o.style.borderRight="1px solid var(--md-sys-color-on-surface)",o.style.borderBottom="1px solid var(--md-sys-color-on-surface)",o.style.overflowWrap="normal",o.style.wordBreak="normal",o.style.hyphens="manual"}),a.forEach(o=>{const i=Array.from(o.cells);i.forEach((c,u)=>{c.style.borderRight=u===i.length-1?"none":"1px solid var(--md-sys-color-on-surface)"})});const n=this._getTbody();n&&Array.from(n.querySelectorAll("tr")).forEach((o,i)=>{const c=i%2===0?"var(--md-sys-color-surface-container)":"var(--md-sys-color-surface)";Array.from(o.cells).forEach(u=>{u.style.backgroundColor=c})}),this._queueColumnWidthUpdate()}_queueColumnWidthUpdate(){this._columnWidthFrame!==null&&cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=requestAnimationFrame(()=>{this._columnWidthFrame=null,this._applyColumnWidthMode()})}_applyColumnWidthMode(){this._getTables().forEach(e=>{if(this._removeGeneratedColGroup(e),e.style.tableLayout="",e.style.width="",e.style.minWidth="",e.style.maxWidth="",this.columnWidthMode!=="header")return;const s=Array.from(e.querySelectorAll("thead tr")),r=s[s.length-1];if(!r)return;const t=Array.from(r.cells).map((a,n)=>{const o=this._measureCellContentWidth(a),i=this._measureColumnReadableBodyWidth(e,n),c=Math.max(o,i);return`${Math.ceil(c>0?Math.max(c,w):0)}px`}),l=t.reduce((a,n)=>a+parseFloat(n),0);this._applyGeneratedColGroup(e,t),e.style.tableLayout="fixed",e.style.width=`${Math.ceil(l)}px`,e.style.minWidth=`${Math.ceil(l)}px`,e.style.maxWidth="none"})}_applyGeneratedColGroup(e,s){const r=document.createElement("colgroup");r.setAttribute("data-scb-generated-column-widths","true"),s.forEach(t=>{const l=document.createElement("col");l.style.width=t,l.style.minWidth=t,r.appendChild(l)}),e.insertBefore(r,e.firstChild)}_removeGeneratedColGroup(e){e.querySelector('colgroup[data-scb-generated-column-widths="true"]')?.remove()}_measureCellContentWidth(e){const s=e.firstElementChild?.cloneNode(!0)??document.createElement("span");e.firstElementChild||(s.textContent=e.textContent??"");const r=window.getComputedStyle(e),t=document.createElement("div");t.style.position="absolute",t.style.left="-99999px",t.style.top="0",t.style.visibility="hidden",t.style.pointerEvents="none",t.style.width="max-content",t.style.maxWidth="none",t.style.whiteSpace="nowrap",t.style.fontFamily=r.fontFamily,t.style.fontSize=r.fontSize,t.style.fontWeight=r.fontWeight,t.style.lineHeight=r.lineHeight,t.style.letterSpacing=r.letterSpacing,s instanceof HTMLElement&&(s.style.width="max-content",s.style.maxWidth="none",s.style.whiteSpace="nowrap"),t.appendChild(s),document.body.appendChild(t);const l=parseFloat(r.paddingLeft||"0"),a=parseFloat(r.paddingRight||"0"),n=parseFloat(r.borderLeftWidth||"0"),o=parseFloat(r.borderRightWidth||"0"),i=t.getBoundingClientRect().width+l+a+n+o;return document.body.removeChild(t),i}_measureColumnReadableBodyWidth(e,s){return Array.from(e.querySelectorAll("tbody tr")).reduce((r,t)=>{const l=t.cells[s];if(!l)return r;const a=(l.textContent??"").replace(/\s+/g," ").trim().split(" ").filter(Boolean).reduce((o,i)=>Math.max(o,this._measureCellTextWidth(l,i)),0),n=a>0?a+S:0;return Math.max(r,n)},0)}_measureCellTextWidth(e,s){const r=window.getComputedStyle(e),t=document.createElement("span");t.textContent=s,t.style.position="absolute",t.style.left="-99999px",t.style.top="0",t.style.visibility="hidden",t.style.pointerEvents="none",t.style.whiteSpace="nowrap",t.style.fontFamily=r.fontFamily,t.style.fontSize=r.fontSize,t.style.fontWeight=r.fontWeight,t.style.lineHeight=r.lineHeight,t.style.letterSpacing=r.letterSpacing,document.body.appendChild(t);const l=parseFloat(r.paddingLeft||"0"),a=parseFloat(r.paddingRight||"0"),n=parseFloat(r.borderLeftWidth||"0"),o=parseFloat(r.borderRightWidth||"0"),i=t.getBoundingClientRect().width+l+a+n+o;return document.body.removeChild(t),i}_onThClick(e){this.dataSorting&&(this._sortedColumn===e?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortedColumn=e,this._sortDirection="asc"),this._sortTable(e,this._sortDirection),this._attachThListeners(),this.dispatchEvent(new CustomEvent("tablesortchange",{detail:{sortedColumn:this._sortedColumn,sortDirection:this._sortDirection},bubbles:!0,composed:!0})))}_sortTable(e,s){const r=this._getTbody();if(!r)return;const t=Array.from(r.querySelectorAll("tr"));t.sort((l,a)=>{const n=this._getCellSortableValue(l.children[e]),o=this._getCellSortableValue(a.children[e]);return this._compareCellValues(n,o,s)}),t.forEach(l=>r.appendChild(l))}_getCellSortableValue(e){if(!e)return"";const s=e,r=this._getSortableAttributeValue(s);if(r)return r;const t=[],l=s.textContent?.replace(/\s+/g," ").trim();return l&&t.push(l),s.querySelectorAll("[data-sort-value], [data-sort], [aria-label], [label], [value], [title]").forEach(a=>{const n=this._getSortableAttributeValue(a);n&&!t.includes(n)&&t.push(n)}),t.join(" ").trim()}_getSortableAttributeValue(e){return(e.getAttribute("data-sort-value")??e.getAttribute("data-sort")??e.getAttribute("aria-label")??e.getAttribute("label")??e.getAttribute("value")??e.getAttribute("title")??"").replace(/\s+/g," ").trim()}_compareCellValues(e,s,r){const t=this._parseSortableNumber(e),l=this._parseSortableNumber(s);if(t!==null&&l!==null)return r==="asc"?t-l:l-t;const a=Date.parse(e.replace(/\s+/g," ")),n=Date.parse(s.replace(/\s+/g," "));if(!isNaN(a)&&!isNaN(n))return r==="asc"?a-n:n-a;const o=e.localeCompare(s,"sv");return r==="asc"?o:-o}_parseSortableNumber(e){const s=e.trim();if(!/^[+-]?(?:\d+|\d{1,3}(?:[\s\u00a0\u202f]\d{3})+)(?:[,.]\d+)?$/.test(s))return null;const r=Number(s.replace(/[\s\u00a0\u202f]/g,"").replace(",","."));return Number.isNaN(r)?null:r}},p.styles=_`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
color: var(--md-sys-color-on-surface);
|
|
@@ -48,4 +48,4 @@ import{_ as g,b as _,g as v,h as b,y as C}from"../../vendor/vendor.js";import"..
|
|
|
48
48
|
::slotted(th:hover) .scb-sort-icon {
|
|
49
49
|
pointer-events: auto;
|
|
50
50
|
}
|
|
51
|
-
`,p);
|
|
51
|
+
`,p);b([f({type:Boolean,attribute:"data-sorting"})],m.prototype,"dataSorting",void 0);b([f({type:String,attribute:"column-width-mode"})],m.prototype,"columnWidthMode",void 0);m=b([v("scb-table")],m);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.65",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -440,5 +440,5 @@
|
|
|
440
440
|
},
|
|
441
441
|
"./mvc/*": "./mvc/*"
|
|
442
442
|
},
|
|
443
|
-
"buildHash": "
|
|
443
|
+
"buildHash": "4D5839BF30719F683A1EEDABB6874A189A3182F795C1D5F14D077307C3F7345F"
|
|
444
444
|
}
|
package/scb-table/scb-table.js
CHANGED
|
@@ -3,7 +3,7 @@ import "../scb-icon-button/scb-icon-button.js";
|
|
|
3
3
|
import { LitElement as t, css as n, html as r } from "lit";
|
|
4
4
|
import { customElement as i, property as a } from "lit/decorators.js";
|
|
5
5
|
//#region src/scb-components/scb-table/scb-table.ts
|
|
6
|
-
var o =
|
|
6
|
+
var o = 96, s = 32, c = class extends t {
|
|
7
7
|
constructor(...e) {
|
|
8
8
|
super(...e), this.dataSorting = !1, this.columnWidthMode = "auto", this._sortedColumn = null, this._sortDirection = "asc", this._columnWidthFrame = null, this._onSlotChange = () => {
|
|
9
9
|
this._attachThListeners();
|
|
@@ -105,7 +105,7 @@ var o = 88, s = 16, c = class extends t {
|
|
|
105
105
|
}), n.forEach((e) => {
|
|
106
106
|
e.style.borderTop = "1px solid var(--md-sys-color-on-surface)";
|
|
107
107
|
}), r.forEach((e, t) => {
|
|
108
|
-
e.style.textAlign = "left", e.style.padding = "12px", e.style.position = "relative", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-label-medium-font)", e.style.fontSize = "var(--md-sys-typescale-label-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-label-medium-line-height)", e.style.fontWeight = " var(--weight-bold)", e.style.letterSpacing = "var(--md-sys-typescale-label-medium-tracking)", e.style.verticalAlign = "bottom", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)";
|
|
108
|
+
e.style.textAlign = "left", e.style.padding = "12px", e.style.position = "relative", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-label-medium-font)", e.style.fontSize = "var(--md-sys-typescale-label-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-label-medium-line-height)", e.style.fontWeight = " var(--weight-bold)", e.style.letterSpacing = "var(--md-sys-typescale-label-medium-tracking)", e.style.verticalAlign = "bottom", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)", e.style.overflowWrap = "normal", e.style.wordBreak = "normal", e.style.hyphens = "manual";
|
|
109
109
|
let n = (e.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
110
110
|
for (; e.firstChild;) e.removeChild(e.firstChild);
|
|
111
111
|
let r = document.createElement("p");
|
|
@@ -116,7 +116,7 @@ var o = 88, s = 16, c = class extends t {
|
|
|
116
116
|
i.style.display = "flex", i.style.gap = "8px", i.style.flexWrap = "nowrap", i.style.alignItems = "center", i.appendChild(r), i.appendChild(n), e.appendChild(i);
|
|
117
117
|
} else e.appendChild(r);
|
|
118
118
|
}), i.forEach((e) => {
|
|
119
|
-
e.style.padding = "12px", e.style.textAlign = "left", e.style.borderTop = "1px solid var(--md-sys-color-outline-variant)", e.style.verticalAlign = "text-top", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-body-medium-font)", e.style.fontSize = "var(--md-sys-typescale-body-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-body-medium-line-height)", e.style.fontWeight = "var(--md-sys-typescale-body-medium-weight)", e.style.letterSpacing = "var(--md-sys-typescale-body-medium-tracking)", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)", e.style.overflowWrap = "
|
|
119
|
+
e.style.padding = "12px", e.style.textAlign = "left", e.style.borderTop = "1px solid var(--md-sys-color-outline-variant)", e.style.verticalAlign = "text-top", e.style.backgroundColor = "var(--md-sys-color-surface)", e.style.fontFamily = "var(--md-sys-typescale-body-medium-font)", e.style.fontSize = "var(--md-sys-typescale-body-medium-size)", e.style.lineHeight = "var(--md-sys-typescale-body-medium-line-height)", e.style.fontWeight = "var(--md-sys-typescale-body-medium-weight)", e.style.letterSpacing = "var(--md-sys-typescale-body-medium-tracking)", e.style.borderRight = "1px solid var(--md-sys-color-on-surface)", e.style.borderBottom = "1px solid var(--md-sys-color-on-surface)", e.style.overflowWrap = "normal", e.style.wordBreak = "normal", e.style.hyphens = "manual";
|
|
120
120
|
}), a.forEach((e) => {
|
|
121
121
|
let t = Array.from(e.cells);
|
|
122
122
|
t.forEach((e, n) => {
|
|
@@ -163,8 +163,8 @@ var o = 88, s = 16, c = class extends t {
|
|
|
163
163
|
e.firstElementChild || (t.textContent = e.textContent ?? "");
|
|
164
164
|
let n = window.getComputedStyle(e), r = document.createElement("div");
|
|
165
165
|
r.style.position = "absolute", r.style.left = "-99999px", r.style.top = "0", r.style.visibility = "hidden", r.style.pointerEvents = "none", r.style.width = "max-content", r.style.maxWidth = "none", r.style.whiteSpace = "nowrap", r.style.fontFamily = n.fontFamily, r.style.fontSize = n.fontSize, r.style.fontWeight = n.fontWeight, r.style.lineHeight = n.lineHeight, r.style.letterSpacing = n.letterSpacing, t instanceof HTMLElement && (t.style.width = "max-content", t.style.maxWidth = "none", t.style.whiteSpace = "nowrap"), r.appendChild(t), document.body.appendChild(r);
|
|
166
|
-
let i = parseFloat(n.paddingLeft || "0"), a = parseFloat(n.paddingRight || "0"), o = r.getBoundingClientRect().width + i + a;
|
|
167
|
-
return document.body.removeChild(r),
|
|
166
|
+
let i = parseFloat(n.paddingLeft || "0"), a = parseFloat(n.paddingRight || "0"), o = parseFloat(n.borderLeftWidth || "0"), s = parseFloat(n.borderRightWidth || "0"), c = r.getBoundingClientRect().width + i + a + o + s;
|
|
167
|
+
return document.body.removeChild(r), c;
|
|
168
168
|
}
|
|
169
169
|
_measureColumnReadableBodyWidth(e, t) {
|
|
170
170
|
return Array.from(e.querySelectorAll("tbody tr")).reduce((e, n) => {
|
|
@@ -177,8 +177,8 @@ var o = 88, s = 16, c = class extends t {
|
|
|
177
177
|
_measureCellTextWidth(e, t) {
|
|
178
178
|
let n = window.getComputedStyle(e), r = document.createElement("span");
|
|
179
179
|
r.textContent = t, r.style.position = "absolute", r.style.left = "-99999px", r.style.top = "0", r.style.visibility = "hidden", r.style.pointerEvents = "none", r.style.whiteSpace = "nowrap", r.style.fontFamily = n.fontFamily, r.style.fontSize = n.fontSize, r.style.fontWeight = n.fontWeight, r.style.lineHeight = n.lineHeight, r.style.letterSpacing = n.letterSpacing, document.body.appendChild(r);
|
|
180
|
-
let i = parseFloat(n.paddingLeft || "0"), a = parseFloat(n.paddingRight || "0"), o = r.getBoundingClientRect().width + i + a;
|
|
181
|
-
return document.body.removeChild(r),
|
|
180
|
+
let i = parseFloat(n.paddingLeft || "0"), a = parseFloat(n.paddingRight || "0"), o = parseFloat(n.borderLeftWidth || "0"), s = parseFloat(n.borderRightWidth || "0"), c = r.getBoundingClientRect().width + i + a + o + s;
|
|
181
|
+
return document.body.removeChild(r), c;
|
|
182
182
|
}
|
|
183
183
|
_onThClick(e) {
|
|
184
184
|
this.dataSorting && (this._sortedColumn === e ? this._sortDirection = this._sortDirection === "asc" ? "desc" : "asc" : (this._sortedColumn = e, this._sortDirection = "asc"), this._sortTable(e, this._sortDirection), this._attachThListeners(), this.dispatchEvent(new CustomEvent("tablesortchange", {
|
package/scb-wc.bundle.js
CHANGED
|
@@ -12163,7 +12163,7 @@
|
|
|
12163
12163
|
>
|
|
12164
12164
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
12165
12165
|
</div>
|
|
12166
|
-
`}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<`u`&&(this.#e=new ResizeObserver(()=>{this.#i()}),this.#e.observe(this))}disconnectedCallback(){this.#e&&=(this.#e.disconnect(),void 0),this.#t&&=(cancelAnimationFrame(this.#t),0),super.disconnectedCallback()}#n(){let e=this.#r(this.spacing),t=this.#r(this.spacingTop)??e,n=this.#r(this.spacingBottom)??e,r=this.#r(this.spacingLeft),i=this.#r(this.spacingRight);t?this.style.setProperty(`--scb-stepper-spacing-block-start`,t):this.style.removeProperty(`--scb-stepper-spacing-block-start`),n?this.style.setProperty(`--scb-stepper-spacing-block-end`,n):this.style.removeProperty(`--scb-stepper-spacing-block-end`),r?this.style.setProperty(`--scb-stepper-spacing-inline-start`,r):this.style.removeProperty(`--scb-stepper-spacing-inline-start`),i?this.style.setProperty(`--scb-stepper-spacing-inline-end`,i):this.style.removeProperty(`--scb-stepper-spacing-inline-end`)}#r(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#i(){this.#t||=requestAnimationFrame(()=>{this.#t=0,this.#a()})}#a(){let e=this._getSteps();e.length!==0&&e.forEach(e=>{let t=e.shadowRoot;if(!t)return;let n=t.querySelector(`.label`),r=t.querySelector(`.scb-step-content`);if(!n)return;if(this.variant!==`horizontal`){n.style.removeProperty(`max-width`),n.style.removeProperty(`white-space`),n.style.removeProperty(`word-break`),n.style.removeProperty(`overflow-wrap`);return}n.style.maxWidth=`none`,n.style.whiteSpace=`nowrap`,n.style.wordBreak=`normal`,n.style.overflowWrap=`normal`;let i=r?.clientWidth??e.clientWidth;i>0&&n.scrollWidth>i&&(n.style.maxWidth=`100%`,n.style.whiteSpace=`normal`,n.style.wordBreak=`break-word`,n.style.overflowWrap=`anywhere`)})}};P([g({type:String,reflect:!0})],Vu.prototype,`type`,void 0),P([g({type:String,reflect:!0})],Vu.prototype,`label`,void 0),P([g({type:Boolean,reflect:!0,attribute:`change-on-completed`})],Vu.prototype,`changeOnCompleted`,void 0),P([g({type:String})],Vu.prototype,`variant`,void 0),P([g({type:String,reflect:!0,attribute:`symbol-variant`})],Vu.prototype,`symbolVariant`,void 0),P([g({type:String,reflect:!0})],Vu.prototype,`spacing`,void 0),P([g({type:String,attribute:`spacing-top`,reflect:!0})],Vu.prototype,`spacingTop`,void 0),P([g({type:String,attribute:`spacing-bottom`,reflect:!0})],Vu.prototype,`spacingBottom`,void 0),P([g({type:String,attribute:`spacing-left`,reflect:!0})],Vu.prototype,`spacingLeft`,void 0),P([g({type:String,attribute:`spacing-right`,reflect:!0})],Vu.prototype,`spacingRight`,void 0),P([g({type:Number,reflect:!0,attribute:`active-index`})],Vu.prototype,`activeIndex`,void 0),Vu=P([a(`scb-stepper`)],Vu),C(),y(),F();var Hu=
|
|
12166
|
+
`}connectedCallback(){super.connectedCallback(),typeof ResizeObserver<`u`&&(this.#e=new ResizeObserver(()=>{this.#i()}),this.#e.observe(this))}disconnectedCallback(){this.#e&&=(this.#e.disconnect(),void 0),this.#t&&=(cancelAnimationFrame(this.#t),0),super.disconnectedCallback()}#n(){let e=this.#r(this.spacing),t=this.#r(this.spacingTop)??e,n=this.#r(this.spacingBottom)??e,r=this.#r(this.spacingLeft),i=this.#r(this.spacingRight);t?this.style.setProperty(`--scb-stepper-spacing-block-start`,t):this.style.removeProperty(`--scb-stepper-spacing-block-start`),n?this.style.setProperty(`--scb-stepper-spacing-block-end`,n):this.style.removeProperty(`--scb-stepper-spacing-block-end`),r?this.style.setProperty(`--scb-stepper-spacing-inline-start`,r):this.style.removeProperty(`--scb-stepper-spacing-inline-start`),i?this.style.setProperty(`--scb-stepper-spacing-inline-end`,i):this.style.removeProperty(`--scb-stepper-spacing-inline-end`)}#r(e){if(!e)return;let t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}#i(){this.#t||=requestAnimationFrame(()=>{this.#t=0,this.#a()})}#a(){let e=this._getSteps();e.length!==0&&e.forEach(e=>{let t=e.shadowRoot;if(!t)return;let n=t.querySelector(`.label`),r=t.querySelector(`.scb-step-content`);if(!n)return;if(this.variant!==`horizontal`){n.style.removeProperty(`max-width`),n.style.removeProperty(`white-space`),n.style.removeProperty(`word-break`),n.style.removeProperty(`overflow-wrap`);return}n.style.maxWidth=`none`,n.style.whiteSpace=`nowrap`,n.style.wordBreak=`normal`,n.style.overflowWrap=`normal`;let i=r?.clientWidth??e.clientWidth;i>0&&n.scrollWidth>i&&(n.style.maxWidth=`100%`,n.style.whiteSpace=`normal`,n.style.wordBreak=`break-word`,n.style.overflowWrap=`anywhere`)})}};P([g({type:String,reflect:!0})],Vu.prototype,`type`,void 0),P([g({type:String,reflect:!0})],Vu.prototype,`label`,void 0),P([g({type:Boolean,reflect:!0,attribute:`change-on-completed`})],Vu.prototype,`changeOnCompleted`,void 0),P([g({type:String})],Vu.prototype,`variant`,void 0),P([g({type:String,reflect:!0,attribute:`symbol-variant`})],Vu.prototype,`symbolVariant`,void 0),P([g({type:String,reflect:!0})],Vu.prototype,`spacing`,void 0),P([g({type:String,attribute:`spacing-top`,reflect:!0})],Vu.prototype,`spacingTop`,void 0),P([g({type:String,attribute:`spacing-bottom`,reflect:!0})],Vu.prototype,`spacingBottom`,void 0),P([g({type:String,attribute:`spacing-left`,reflect:!0})],Vu.prototype,`spacingLeft`,void 0),P([g({type:String,attribute:`spacing-right`,reflect:!0})],Vu.prototype,`spacingRight`,void 0),P([g({type:Number,reflect:!0,attribute:`active-index`})],Vu.prototype,`activeIndex`,void 0),Vu=P([a(`scb-stepper`)],Vu),C(),y(),F();var Hu=96,Uu=32,Wu=class extends S{constructor(...e){super(...e),this.dataSorting=!1,this.columnWidthMode=`auto`,this._sortedColumn=null,this._sortDirection=`asc`,this._columnWidthFrame=null,this._onSlotChange=()=>{this._attachThListeners()}}static{this.styles=p`
|
|
12167
12167
|
:host {
|
|
12168
12168
|
display: block;
|
|
12169
12169
|
color: var(--md-sys-color-on-surface);
|
|
@@ -12213,7 +12213,7 @@
|
|
|
12213
12213
|
<div class="scb-table-scroll-wrapper">
|
|
12214
12214
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
12215
12215
|
</div>
|
|
12216
|
-
`}firstUpdated(){let e=this.shadowRoot?.querySelector(`slot`);e&&(e.addEventListener(`slotchange`,()=>this._attachThListeners()),this._attachThListeners())}updated(e){e.has(`dataSorting`)&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection=`asc`),this._attachThListeners()),e.has(`columnWidthMode`)&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return null;let t=e.assignedNodes({flatten:!0});for(let e of t)if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.tagName.toLowerCase()===`tbody`?t:t.querySelector(`tbody`);if(n)return n}return null}_getTables(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return[];let t=e.assignedNodes({flatten:!0}),n=[];return t.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e;t.tagName.toLowerCase()===`table`&&n.push(t),n.push(...Array.from(t.querySelectorAll(`table`)))}}),n}_attachThListeners(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return;let t=e.assignedNodes({flatten:!0}),n=[],r=[],i=[],a=[];t.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&(n.push(...e.querySelectorAll(`thead`)),r.push(...e.querySelectorAll(`th`)),i.push(...e.querySelectorAll(`td`)),a.push(...e.querySelectorAll(`tr`)))}),n.forEach(e=>{e.style.borderTop=`1px solid var(--md-sys-color-on-surface)`}),r.forEach((e,t)=>{e.style.textAlign=`left`,e.style.padding=`12px`,e.style.position=`relative`,e.style.backgroundColor=`var(--md-sys-color-surface)`,e.style.fontFamily=`var(--md-sys-typescale-label-medium-font)`,e.style.fontSize=`var(--md-sys-typescale-label-medium-size)`,e.style.lineHeight=`var(--md-sys-typescale-label-medium-line-height)`,e.style.fontWeight=` var(--weight-bold)`,e.style.letterSpacing=`var(--md-sys-typescale-label-medium-tracking)`,e.style.verticalAlign=`bottom`,e.style.borderRight=`1px solid var(--md-sys-color-on-surface)`,e.style.borderBottom=`1px solid var(--md-sys-color-on-surface)`;let n=(e.textContent??``).replace(/\s+/g,` `).trim();for(;e.firstChild;)e.removeChild(e.firstChild);let r=document.createElement(`p`);if(r.textContent=n,r.style.margin=`0`,this.dataSorting){let n=document.createElement(`scb-icon-button`);n.className=`scb-sort-icon`,n.onclick=()=>this._onThClick(t),n.setAttribute(`variant`,`standard`),n.setAttribute(`size`,`small`),n.style.alignSelf=`end`,this._sortedColumn===t?(n.setAttribute(`variant`,`filled-tonal`),n.setAttribute(`icon`,this._sortDirection===`asc`?`arrow_downward`:`arrow_upward`)):(n.setAttribute(`icon`,`swap_horiz`),n.style.transform+=` rotate(90deg)`);let i=document.createElement(`div`);i.style.display=`flex`,i.style.gap=`8px`,i.style.flexWrap=`nowrap`,i.style.alignItems=`center`,i.appendChild(r),i.appendChild(n),e.appendChild(i)}else e.appendChild(r)}),i.forEach(e=>{e.style.padding=`12px`,e.style.textAlign=`left`,e.style.borderTop=`1px solid var(--md-sys-color-outline-variant)`,e.style.verticalAlign=`text-top`,e.style.backgroundColor=`var(--md-sys-color-surface)`,e.style.fontFamily=`var(--md-sys-typescale-body-medium-font)`,e.style.fontSize=`var(--md-sys-typescale-body-medium-size)`,e.style.lineHeight=`var(--md-sys-typescale-body-medium-line-height)`,e.style.fontWeight=`var(--md-sys-typescale-body-medium-weight)`,e.style.letterSpacing=`var(--md-sys-typescale-body-medium-tracking)`,e.style.borderRight=`1px solid var(--md-sys-color-on-surface)`,e.style.borderBottom=`1px solid var(--md-sys-color-on-surface)`,e.style.overflowWrap=`
|
|
12216
|
+
`}firstUpdated(){let e=this.shadowRoot?.querySelector(`slot`);e&&(e.addEventListener(`slotchange`,()=>this._attachThListeners()),this._attachThListeners())}updated(e){e.has(`dataSorting`)&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection=`asc`),this._attachThListeners()),e.has(`columnWidthMode`)&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return null;let t=e.assignedNodes({flatten:!0});for(let e of t)if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.tagName.toLowerCase()===`tbody`?t:t.querySelector(`tbody`);if(n)return n}return null}_getTables(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return[];let t=e.assignedNodes({flatten:!0}),n=[];return t.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){let t=e;t.tagName.toLowerCase()===`table`&&n.push(t),n.push(...Array.from(t.querySelectorAll(`table`)))}}),n}_attachThListeners(){let e=this.shadowRoot?.querySelector(`slot`);if(!e)return;let t=e.assignedNodes({flatten:!0}),n=[],r=[],i=[],a=[];t.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&(n.push(...e.querySelectorAll(`thead`)),r.push(...e.querySelectorAll(`th`)),i.push(...e.querySelectorAll(`td`)),a.push(...e.querySelectorAll(`tr`)))}),n.forEach(e=>{e.style.borderTop=`1px solid var(--md-sys-color-on-surface)`}),r.forEach((e,t)=>{e.style.textAlign=`left`,e.style.padding=`12px`,e.style.position=`relative`,e.style.backgroundColor=`var(--md-sys-color-surface)`,e.style.fontFamily=`var(--md-sys-typescale-label-medium-font)`,e.style.fontSize=`var(--md-sys-typescale-label-medium-size)`,e.style.lineHeight=`var(--md-sys-typescale-label-medium-line-height)`,e.style.fontWeight=` var(--weight-bold)`,e.style.letterSpacing=`var(--md-sys-typescale-label-medium-tracking)`,e.style.verticalAlign=`bottom`,e.style.borderRight=`1px solid var(--md-sys-color-on-surface)`,e.style.borderBottom=`1px solid var(--md-sys-color-on-surface)`,e.style.overflowWrap=`normal`,e.style.wordBreak=`normal`,e.style.hyphens=`manual`;let n=(e.textContent??``).replace(/\s+/g,` `).trim();for(;e.firstChild;)e.removeChild(e.firstChild);let r=document.createElement(`p`);if(r.textContent=n,r.style.margin=`0`,this.dataSorting){let n=document.createElement(`scb-icon-button`);n.className=`scb-sort-icon`,n.onclick=()=>this._onThClick(t),n.setAttribute(`variant`,`standard`),n.setAttribute(`size`,`small`),n.style.alignSelf=`end`,this._sortedColumn===t?(n.setAttribute(`variant`,`filled-tonal`),n.setAttribute(`icon`,this._sortDirection===`asc`?`arrow_downward`:`arrow_upward`)):(n.setAttribute(`icon`,`swap_horiz`),n.style.transform+=` rotate(90deg)`);let i=document.createElement(`div`);i.style.display=`flex`,i.style.gap=`8px`,i.style.flexWrap=`nowrap`,i.style.alignItems=`center`,i.appendChild(r),i.appendChild(n),e.appendChild(i)}else e.appendChild(r)}),i.forEach(e=>{e.style.padding=`12px`,e.style.textAlign=`left`,e.style.borderTop=`1px solid var(--md-sys-color-outline-variant)`,e.style.verticalAlign=`text-top`,e.style.backgroundColor=`var(--md-sys-color-surface)`,e.style.fontFamily=`var(--md-sys-typescale-body-medium-font)`,e.style.fontSize=`var(--md-sys-typescale-body-medium-size)`,e.style.lineHeight=`var(--md-sys-typescale-body-medium-line-height)`,e.style.fontWeight=`var(--md-sys-typescale-body-medium-weight)`,e.style.letterSpacing=`var(--md-sys-typescale-body-medium-tracking)`,e.style.borderRight=`1px solid var(--md-sys-color-on-surface)`,e.style.borderBottom=`1px solid var(--md-sys-color-on-surface)`,e.style.overflowWrap=`normal`,e.style.wordBreak=`normal`,e.style.hyphens=`manual`}),a.forEach(e=>{let t=Array.from(e.cells);t.forEach((e,n)=>{e.style.borderRight=n===t.length-1?`none`:`1px solid var(--md-sys-color-on-surface)`})});let o=this._getTbody();o&&Array.from(o.querySelectorAll(`tr`)).forEach((e,t)=>{let n=t%2==0?`var(--md-sys-color-surface-container)`:`var(--md-sys-color-surface)`;Array.from(e.cells).forEach(e=>{e.style.backgroundColor=n})}),this._queueColumnWidthUpdate()}_queueColumnWidthUpdate(){this._columnWidthFrame!==null&&cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=requestAnimationFrame(()=>{this._columnWidthFrame=null,this._applyColumnWidthMode()})}_applyColumnWidthMode(){this._getTables().forEach(e=>{if(this._removeGeneratedColGroup(e),e.style.tableLayout=``,e.style.width=``,e.style.minWidth=``,e.style.maxWidth=``,this.columnWidthMode!==`header`)return;let t=Array.from(e.querySelectorAll(`thead tr`)),n=t[t.length-1];if(!n)return;let r=Array.from(n.cells).map((t,n)=>{let r=this._measureCellContentWidth(t),i=this._measureColumnReadableBodyWidth(e,n),a=Math.max(r,i);return`${Math.ceil(a>0?Math.max(a,Hu):0)}px`}),i=r.reduce((e,t)=>e+parseFloat(t),0);this._applyGeneratedColGroup(e,r),e.style.tableLayout=`fixed`,e.style.width=`${Math.ceil(i)}px`,e.style.minWidth=`${Math.ceil(i)}px`,e.style.maxWidth=`none`})}_applyGeneratedColGroup(e,t){let n=document.createElement(`colgroup`);n.setAttribute(`data-scb-generated-column-widths`,`true`),t.forEach(e=>{let t=document.createElement(`col`);t.style.width=e,t.style.minWidth=e,n.appendChild(t)}),e.insertBefore(n,e.firstChild)}_removeGeneratedColGroup(e){e.querySelector(`colgroup[data-scb-generated-column-widths="true"]`)?.remove()}_measureCellContentWidth(e){let t=e.firstElementChild?.cloneNode(!0)??document.createElement(`span`);e.firstElementChild||(t.textContent=e.textContent??``);let n=window.getComputedStyle(e),r=document.createElement(`div`);r.style.position=`absolute`,r.style.left=`-99999px`,r.style.top=`0`,r.style.visibility=`hidden`,r.style.pointerEvents=`none`,r.style.width=`max-content`,r.style.maxWidth=`none`,r.style.whiteSpace=`nowrap`,r.style.fontFamily=n.fontFamily,r.style.fontSize=n.fontSize,r.style.fontWeight=n.fontWeight,r.style.lineHeight=n.lineHeight,r.style.letterSpacing=n.letterSpacing,t instanceof HTMLElement&&(t.style.width=`max-content`,t.style.maxWidth=`none`,t.style.whiteSpace=`nowrap`),r.appendChild(t),document.body.appendChild(r);let i=parseFloat(n.paddingLeft||`0`),a=parseFloat(n.paddingRight||`0`),o=parseFloat(n.borderLeftWidth||`0`),s=parseFloat(n.borderRightWidth||`0`),c=r.getBoundingClientRect().width+i+a+o+s;return document.body.removeChild(r),c}_measureColumnReadableBodyWidth(e,t){return Array.from(e.querySelectorAll(`tbody tr`)).reduce((e,n)=>{let r=n.cells[t];if(!r)return e;let i=(r.textContent??``).replace(/\s+/g,` `).trim().split(` `).filter(Boolean).reduce((e,t)=>Math.max(e,this._measureCellTextWidth(r,t)),0),a=i>0?i+Uu:0;return Math.max(e,a)},0)}_measureCellTextWidth(e,t){let n=window.getComputedStyle(e),r=document.createElement(`span`);r.textContent=t,r.style.position=`absolute`,r.style.left=`-99999px`,r.style.top=`0`,r.style.visibility=`hidden`,r.style.pointerEvents=`none`,r.style.whiteSpace=`nowrap`,r.style.fontFamily=n.fontFamily,r.style.fontSize=n.fontSize,r.style.fontWeight=n.fontWeight,r.style.lineHeight=n.lineHeight,r.style.letterSpacing=n.letterSpacing,document.body.appendChild(r);let i=parseFloat(n.paddingLeft||`0`),a=parseFloat(n.paddingRight||`0`),o=parseFloat(n.borderLeftWidth||`0`),s=parseFloat(n.borderRightWidth||`0`),c=r.getBoundingClientRect().width+i+a+o+s;return document.body.removeChild(r),c}_onThClick(e){this.dataSorting&&(this._sortedColumn===e?this._sortDirection=this._sortDirection===`asc`?`desc`:`asc`:(this._sortedColumn=e,this._sortDirection=`asc`),this._sortTable(e,this._sortDirection),this._attachThListeners(),this.dispatchEvent(new CustomEvent(`tablesortchange`,{detail:{sortedColumn:this._sortedColumn,sortDirection:this._sortDirection},bubbles:!0,composed:!0})))}_sortTable(e,t){let n=this._getTbody();if(!n)return;let r=Array.from(n.querySelectorAll(`tr`));r.sort((n,r)=>{let i=this._getCellSortableValue(n.children[e]),a=this._getCellSortableValue(r.children[e]);return this._compareCellValues(i,a,t)}),r.forEach(e=>n.appendChild(e))}_getCellSortableValue(e){if(!e)return``;let t=e,n=this._getSortableAttributeValue(t);if(n)return n;let r=[],i=t.textContent?.replace(/\s+/g,` `).trim();return i&&r.push(i),t.querySelectorAll(`[data-sort-value], [data-sort], [aria-label], [label], [value], [title]`).forEach(e=>{let t=this._getSortableAttributeValue(e);t&&!r.includes(t)&&r.push(t)}),r.join(` `).trim()}_getSortableAttributeValue(e){return(e.getAttribute(`data-sort-value`)??e.getAttribute(`data-sort`)??e.getAttribute(`aria-label`)??e.getAttribute(`label`)??e.getAttribute(`value`)??e.getAttribute(`title`)??``).replace(/\s+/g,` `).trim()}_compareCellValues(e,t,n){let r=this._parseSortableNumber(e),i=this._parseSortableNumber(t);if(r!==null&&i!==null)return n===`asc`?r-i:i-r;let a=Date.parse(e.replace(/\s+/g,` `)),o=Date.parse(t.replace(/\s+/g,` `));if(!isNaN(a)&&!isNaN(o))return n===`asc`?a-o:o-a;let s=e.localeCompare(t,`sv`);return n===`asc`?s:-s}_parseSortableNumber(e){let t=e.trim();if(!/^[+-]?(?:\d+|\d{1,3}(?:[\s\u00a0\u202f]\d{3})+)(?:[,.]\d+)?$/.test(t))return null;let n=Number(t.replace(/[\s\u00a0\u202f]/g,``).replace(`,`,`.`));return Number.isNaN(n)?null:n}};P([g({type:Boolean,attribute:`data-sorting`})],Wu.prototype,`dataSorting`,void 0),P([g({type:String,attribute:`column-width-mode`})],Wu.prototype,`columnWidthMode`,void 0),Wu=P([a(`scb-table`)],Wu),C(),y(),F();var Gu=class extends S{constructor(...e){super(...e),this.searchTerm=``,this.pagination=!1,this.filteringSearch=!1,this.noScroll=!1,this.pageSize=10,this.currentPage=1,this.totalRows=0,this._sortedColumn=null,this._sortDirection=`asc`,this._filteredRows=null,this._tbodyObserver=null,this._observedTbody=null,this._pendingTableRefresh=!1,this._suppressTbodyObserver=!1,this._onSlotChange=()=>{this._attachTbodyObserver(),this._refreshFromTableContent()},this._onPaginationChange=e=>{let t=e.detail;t&&typeof t.page==`number`&&this._changePage(t.page)}}static{this.styles=p`
|
|
12217
12217
|
:host {
|
|
12218
12218
|
display: block;
|
|
12219
12219
|
color: var(--md-sys-color-on-surface);
|