scb-wc-test 0.1.267 → 0.1.268
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/mvc/components/scb-viz/scb-viz.js +8 -7
- package/package.json +2 -2
- package/scb-viz/scb-viz.js +13 -12
- package/scb-wc-test.bundle.js +6 -5
|
@@ -113,7 +113,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
113
113
|
<path d="M688.2,24.4h5.8v6h-5.8V24.4z M688.2,36.6h5.8v30.1h-5.8V36.6z"/>
|
|
114
114
|
<path d="M701.8,24.4h5.8v26.3h0.1l11.2-14.1h7l-10,11.7l11.4,18.3H720l-7.7-14l-4.6,5.4v8.7h-5.8V24.4H701.8z"/>
|
|
115
115
|
</svg>
|
|
116
|
-
`;let c=class extends D{constructor(){super(...arguments),I(this,v),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.officialStatistics=!1,this.disableToggle=!1,this.contentMaxWidth="",this.containerMaxWidth="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}get officialStatisticsLabel(){return this.lang==="en"?"Official statistics of Sweden":"Sveriges officiella statistik"}get officialStatisticsTitle(){return this.lang==="en"?"Part of Official statistics of Sweden":"Tillhör Sveriges officiella statistik"}get officialStatisticsAlt(){return this.lang==="en"?"Read more about Official statistics of Sweden":"Läs mer om Sveriges officiella statistik"}firstUpdated(t){this._readTableDataFromSlot(),b(this,v,M).call(this),b(this,v,L).call(this),this._syncChipClass()}updated(t){super.updated(t),(t.has("selectedChip")||t.has("variant"))&&this._syncChipClass(),t.has("selectedChip")&&this._dispatchSelectedChipChanged(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&b(this,v,M).call(this),t.has("containerMaxWidth")&&b(this,v,L).call(this)}_onTableSlotChange(t){const e=t.target;e&&this._readTableDataFromSlot(e)}_normalizeRenderableCell(t){return t&&typeof t=="object"&&"html"in t&&"text"in t?{html:typeof t.html=="string"?t.html:"",text:typeof t.text=="string"?t.text:""}:{html:"",text:t==null?"":String(t)}}_readTableDataFromSlot(t){const e=t||this.shadowRoot?.querySelector('slot[name="table"]');if(!e)return;const l=e.assignedElements({flatten:!0}),r=[];l.forEach(d=>{if(d.tagName==="TABLE"){r.push(d);return}d.querySelectorAll("table").forEach(g=>r.push(g))});const s=r[0];if(!s){this._slottedTableData=void 0;return}const n=[],a=[],p=[],m=d=>d?(d.textContent??"").replace(/\s+/g," ").trim():"",f=d=>d?{html:(d.innerHTML??"").trim(),text:m(d)}:{html:"",text:""},u=s.querySelector("thead tr");u&&Array.from(u.querySelectorAll("th, td")).forEach(g=>n.push(f(g)));const w=Array.from(s.querySelectorAll("tbody tr"))
|
|
116
|
+
`;let c=class extends D{constructor(){super(...arguments),I(this,v),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.officialStatistics=!1,this.disableToggle=!1,this.contentMaxWidth="",this.containerMaxWidth="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}get officialStatisticsLabel(){return this.lang==="en"?"Official statistics of Sweden":"Sveriges officiella statistik"}get officialStatisticsTitle(){return this.lang==="en"?"Part of Official statistics of Sweden":"Tillhör Sveriges officiella statistik"}get officialStatisticsAlt(){return this.lang==="en"?"Read more about Official statistics of Sweden":"Läs mer om Sveriges officiella statistik"}firstUpdated(t){this._readTableDataFromSlot(),b(this,v,M).call(this),b(this,v,L).call(this),this._syncChipClass()}updated(t){super.updated(t),(t.has("selectedChip")||t.has("variant"))&&this._syncChipClass(),t.has("selectedChip")&&this._dispatchSelectedChipChanged(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&b(this,v,M).call(this),t.has("containerMaxWidth")&&b(this,v,L).call(this)}_onTableSlotChange(t){const e=t.target;e&&this._readTableDataFromSlot(e)}_normalizeRenderableCell(t){return t&&typeof t=="object"&&"html"in t&&"text"in t?{html:typeof t.html=="string"?t.html:"",text:typeof t.text=="string"?t.text:""}:{html:"",text:t==null?"":String(t)}}_readTableDataFromSlot(t){const e=t||this.shadowRoot?.querySelector('slot[name="table"]');if(!e)return;const l=e.assignedElements({flatten:!0}),r=[];l.forEach(d=>{if(d.tagName==="TABLE"){r.push(d);return}d.querySelectorAll("table").forEach(g=>r.push(g))});const s=r[0];if(!s){this._slottedTableData=void 0;return}const n=[],a=[],p=[],m=d=>d?(d.textContent??"").replace(/\s+/g," ").trim():"",f=d=>d?{html:(d.innerHTML??"").trim(),text:m(d)}:{html:"",text:""},u=s.querySelector("thead tr");u&&Array.from(u.querySelectorAll("th, td")).forEach(g=>n.push(f(g)));const w=Array.from(s.querySelectorAll("tbody tr")),$=w.length>0?w:Array.from(s.querySelectorAll("tr")).filter(d=>d.closest("thead")===null);if($.forEach(d=>{const g=Array.from(d.querySelectorAll("th, td"));if(g.length===0)return;const x=g[0].tagName==="TH"&&d.closest("thead")===null&&d.closest("tfoot")===null;p.push(x);const S=[];g.forEach(_=>S.push(f(_))),a.push(S)}),!u&&a.length>0){const d=a[0],g=$[0],x=Array.from(g?.querySelectorAll("th, td")??[]);x.length>0&&x.every(_=>_.tagName==="TH")&&g?.closest("tbody")===null&&(n.splice(0,n.length,...d),a.shift(),p.shift())}this._slottedTableData={headers:n.length>0?n:void 0,rows:a,rowHeaderRows:p.length>0?p:void 0}}_inferTableAlignments(t){const e=Math.max(t.headers?.length??0,...t.rows.map(s=>s.length)),l=s=>{if(s==null)return!1;if(typeof s=="number")return!0;const n=String(s).replace(/[\u00A0\u202F\s]+/g,"").trim();return n?/^-?\d+(?:[.,]\d+)?$/.test(n):!1},r=[];for(let s=0;s<e;s+=1){if(s===0){r.push("left");continue}const n=t.rows.map(p=>this._normalizeRenderableCell(p[s]).text).filter(p=>p!==""&&p!==null&&p!==void 0),a=n.length>0&&n.every(l);r.push(a?"right":"left")}return r}_getResolvedContentMaxWidth(){return this.contentMaxWidth?.trim()||""}_renderTable(){const t=this.tableData??this._slottedTableData;if(!t||!t.rows||t.rows.length===0)return null;const e=this._inferTableAlignments(t),l=Math.max(t.headers?.length??0,...t.rows.map(a=>a.length)),r=(t.headers??[]).map(a=>this._normalizeRenderableCell(a)),s=t.rows.map(a=>{const p=a.map(m=>this._normalizeRenderableCell(m));for(;p.length<l;)p.push({html:"",text:""});return p}),n=t.rowHeaderRows??[];return i`
|
|
117
117
|
<table class="scb-viz-table" part="table">
|
|
118
118
|
${r.length>0?i`
|
|
119
119
|
<thead>
|
|
@@ -125,7 +125,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
125
125
|
<tbody>
|
|
126
126
|
${s.map((a,p)=>{const m=n[p]===!0;return i`
|
|
127
127
|
<tr>
|
|
128
|
-
${a.map((f,u)=>{const w=e[u]==="right"?"align-right":"align-left"
|
|
128
|
+
${a.map((f,u)=>{const w=e[u]==="right"?"align-right":"align-left",$=f.html?T(f.html):f.text;return u===0&&m?i`<th scope="row" class=${w}>${$}</th>`:i`<td class=${w}>${$}</td>`})}
|
|
129
129
|
</tr>
|
|
130
130
|
`})}
|
|
131
131
|
</tbody>
|
|
@@ -304,7 +304,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
304
304
|
>
|
|
305
305
|
<div
|
|
306
306
|
class=${this._getResolvedContentMaxWidth()?"diagram-content diagram-content--constrained":"diagram-content"}
|
|
307
|
-
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()}
|
|
307
|
+
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()};`:""}
|
|
308
308
|
>
|
|
309
309
|
<slot name="diagram"></slot>
|
|
310
310
|
</div>
|
|
@@ -494,13 +494,14 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
494
494
|
.diagram-content {
|
|
495
495
|
width: 100%;
|
|
496
496
|
max-width: var(--scb-viz-content-max-width, 100%);
|
|
497
|
+
min-width: 0;
|
|
497
498
|
flex: 0 0 auto;
|
|
498
499
|
}
|
|
499
500
|
|
|
500
501
|
.diagram-content--constrained {
|
|
501
502
|
width: min(100%, var(--scb-viz-content-max-width, 100%));
|
|
502
|
-
|
|
503
|
-
|
|
503
|
+
max-width: var(--scb-viz-content-max-width, 100%);
|
|
504
|
+
min-width: 0;
|
|
504
505
|
}
|
|
505
506
|
|
|
506
507
|
::slotted([slot='diagram']) {
|
|
@@ -508,8 +509,8 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
508
509
|
width: 100%;
|
|
509
510
|
max-width: 100%;
|
|
510
511
|
min-width: 0;
|
|
511
|
-
height:
|
|
512
|
-
max-height:
|
|
512
|
+
height: auto;
|
|
513
|
+
max-height: none;
|
|
513
514
|
}
|
|
514
515
|
|
|
515
516
|
:host([variant='Table']) .table-scroller {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.268",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -386,5 +386,5 @@
|
|
|
386
386
|
},
|
|
387
387
|
"./mvc/*": "./mvc/*"
|
|
388
388
|
},
|
|
389
|
-
"buildHash": "
|
|
389
|
+
"buildHash": "AF724D867D9C31D5235D7F229261F108BEA8058AB8474B332A871FBC05F29F52"
|
|
390
390
|
}
|
package/scb-viz/scb-viz.js
CHANGED
|
@@ -180,8 +180,8 @@ let s = class extends D {
|
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
_readTableDataFromSlot(t) {
|
|
183
|
-
var
|
|
184
|
-
const e = t || ((
|
|
183
|
+
var x;
|
|
184
|
+
const e = t || ((x = this.shadowRoot) == null ? void 0 : x.querySelector('slot[name="table"]'));
|
|
185
185
|
if (!e) return;
|
|
186
186
|
const c = e.assignedElements({ flatten: !0 }), h = [];
|
|
187
187
|
c.forEach((n) => {
|
|
@@ -201,10 +201,10 @@ let s = class extends D {
|
|
|
201
201
|
text: v(n)
|
|
202
202
|
} : { html: "", text: "" }, u = o.querySelector("thead tr");
|
|
203
203
|
u && Array.from(u.querySelectorAll("th, td")).forEach((g) => a.push(f(g)));
|
|
204
|
-
const w = Array.from(o.querySelectorAll("tbody tr")),
|
|
204
|
+
const w = Array.from(o.querySelectorAll("tbody tr")), $ = w.length > 0 ? w : Array.from(o.querySelectorAll("tr")).filter(
|
|
205
205
|
(n) => n.closest("thead") === null
|
|
206
206
|
);
|
|
207
|
-
if (
|
|
207
|
+
if ($.forEach((n) => {
|
|
208
208
|
const g = Array.from(n.querySelectorAll("th, td"));
|
|
209
209
|
if (g.length === 0) return;
|
|
210
210
|
const S = g[0].tagName === "TH" && n.closest("thead") === null && n.closest("tfoot") === null;
|
|
@@ -212,7 +212,7 @@ let s = class extends D {
|
|
|
212
212
|
const z = [];
|
|
213
213
|
g.forEach((_) => z.push(f(_))), d.push(z);
|
|
214
214
|
}), !u && d.length > 0) {
|
|
215
|
-
const n = d[0], g =
|
|
215
|
+
const n = d[0], g = $[0], S = Array.from((g == null ? void 0 : g.querySelectorAll("th, td")) ?? []);
|
|
216
216
|
S.length > 0 && S.every((_) => _.tagName === "TH") && (g == null ? void 0 : g.closest("tbody")) === null && (a.splice(0, a.length, ...n), d.shift(), p.shift());
|
|
217
217
|
}
|
|
218
218
|
this._slottedTableData = {
|
|
@@ -276,8 +276,8 @@ let s = class extends D {
|
|
|
276
276
|
return i`
|
|
277
277
|
<tr>
|
|
278
278
|
${p.map((u, w) => {
|
|
279
|
-
const
|
|
280
|
-
return w === 0 && f ? i`<th scope="row" class=${
|
|
279
|
+
const $ = e[w] === "right" ? "align-right" : "align-left", x = u.html ? T(u.html) : u.text;
|
|
280
|
+
return w === 0 && f ? i`<th scope="row" class=${$}>${x}</th>` : i`<td class=${$}>${x}</td>`;
|
|
281
281
|
})}
|
|
282
282
|
</tr>
|
|
283
283
|
`;
|
|
@@ -467,7 +467,7 @@ let s = class extends D {
|
|
|
467
467
|
>
|
|
468
468
|
<div
|
|
469
469
|
class=${this._getResolvedContentMaxWidth() ? "diagram-content diagram-content--constrained" : "diagram-content"}
|
|
470
|
-
style=${this._getResolvedContentMaxWidth() ? `--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()}
|
|
470
|
+
style=${this._getResolvedContentMaxWidth() ? `--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()};` : ""}
|
|
471
471
|
>
|
|
472
472
|
<slot name="diagram"></slot>
|
|
473
473
|
</div>
|
|
@@ -714,13 +714,14 @@ s.styles = R`
|
|
|
714
714
|
.diagram-content {
|
|
715
715
|
width: 100%;
|
|
716
716
|
max-width: var(--scb-viz-content-max-width, 100%);
|
|
717
|
+
min-width: 0;
|
|
717
718
|
flex: 0 0 auto;
|
|
718
719
|
}
|
|
719
720
|
|
|
720
721
|
.diagram-content--constrained {
|
|
721
722
|
width: min(100%, var(--scb-viz-content-max-width, 100%));
|
|
722
|
-
|
|
723
|
-
|
|
723
|
+
max-width: var(--scb-viz-content-max-width, 100%);
|
|
724
|
+
min-width: 0;
|
|
724
725
|
}
|
|
725
726
|
|
|
726
727
|
::slotted([slot='diagram']) {
|
|
@@ -728,8 +729,8 @@ s.styles = R`
|
|
|
728
729
|
width: 100%;
|
|
729
730
|
max-width: 100%;
|
|
730
731
|
min-width: 0;
|
|
731
|
-
height:
|
|
732
|
-
max-height:
|
|
732
|
+
height: auto;
|
|
733
|
+
max-height: none;
|
|
733
734
|
}
|
|
734
735
|
|
|
735
736
|
:host([variant='Table']) .table-scroller {
|
package/scb-wc-test.bundle.js
CHANGED
|
@@ -12393,7 +12393,7 @@
|
|
|
12393
12393
|
>
|
|
12394
12394
|
<div
|
|
12395
12395
|
class=${this._getResolvedContentMaxWidth()?"diagram-content diagram-content--constrained":"diagram-content"}
|
|
12396
|
-
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()}
|
|
12396
|
+
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()};`:""}
|
|
12397
12397
|
>
|
|
12398
12398
|
<slot name="diagram"></slot>
|
|
12399
12399
|
</div>
|
|
@@ -12583,13 +12583,14 @@
|
|
|
12583
12583
|
.diagram-content {
|
|
12584
12584
|
width: 100%;
|
|
12585
12585
|
max-width: var(--scb-viz-content-max-width, 100%);
|
|
12586
|
+
min-width: 0;
|
|
12586
12587
|
flex: 0 0 auto;
|
|
12587
12588
|
}
|
|
12588
12589
|
|
|
12589
12590
|
.diagram-content--constrained {
|
|
12590
12591
|
width: min(100%, var(--scb-viz-content-max-width, 100%));
|
|
12591
|
-
|
|
12592
|
-
|
|
12592
|
+
max-width: var(--scb-viz-content-max-width, 100%);
|
|
12593
|
+
min-width: 0;
|
|
12593
12594
|
}
|
|
12594
12595
|
|
|
12595
12596
|
::slotted([slot='diagram']) {
|
|
@@ -12597,8 +12598,8 @@
|
|
|
12597
12598
|
width: 100%;
|
|
12598
12599
|
max-width: 100%;
|
|
12599
12600
|
min-width: 0;
|
|
12600
|
-
height:
|
|
12601
|
-
max-height:
|
|
12601
|
+
height: auto;
|
|
12602
|
+
max-height: none;
|
|
12602
12603
|
}
|
|
12603
12604
|
|
|
12604
12605
|
:host([variant='Table']) .table-scroller {
|