scb-wc 0.1.24 → 0.1.26
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-grid/scb-grid-item.js +1 -1
- package/mvc/components/scb-grid/scb-grid.js +2 -2
- package/mvc/components/scb-pagination/scb-pagination.js +55 -35
- package/mvc/components/scb-table/scb-table.js +3 -3
- package/mvc/components/scb-table-advanced/scb-table-advanced.js +7 -7
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb.svg +13 -13
- package/package.json +2 -2
- package/scb-components/scb-pagination/scb-pagination.d.ts +1 -0
- package/scb-components/scb-table/scb-table.d.ts +2 -0
- package/scb-components/scb-table-advanced/scb-table-advanced.d.ts +3 -0
- package/scb-grid/scb-grid-item.js +2 -2
- package/scb-grid/scb-grid.js +1 -4
- package/scb-pagination/scb-pagination.js +54 -34
- package/scb-table/scb-table.js +14 -1
- package/scb-table-advanced/scb-table-advanced.js +19 -3
- package/scb-wc.bundle.js +45 -25
- package/starters/blazor/Components/Layout/MainLayout.razor +1 -1
- package/starters/blazor/Components/Pages/Home.razor +15 -19
- package/starters/html/main.js +17 -22
- package/starters/react/src/App.jsx +16 -20
- package/starters/react/src/main.jsx +1 -2
|
@@ -8,4 +8,4 @@ import{_ as y,b as f,g as b,h as r,y as S}from"../../vendor/vendor.js";import"..
|
|
|
8
8
|
}
|
|
9
9
|
:host([fit]) { block-size: 100%; }
|
|
10
10
|
:host([fit]) ::slotted(*) { block-size: 100%; }
|
|
11
|
-
`,p);function d(){o(e,this,l).call(this,"--col-span",this.hasAttribute("col-span")?String(this.colSpan):null),o(e,this,l).call(this,"--col-span-compact",this.hasAttribute("col-span-compact")?String(this.colSpanCompact):null),o(e,this,l).call(this,"--col-span-medium",this.hasAttribute("col-span-medium")?String(this.colSpanMedium):null),o(e,this,l).call(this,"--col-span-expanded",this.hasAttribute("col-span-expanded")?String(this.colSpanExpanded):null),o(e,this,l).call(this,"--row-rule",this.hasAttribute("row-span")?`span ${this.rowSpan}`:null),o(e,this,l).call(this,"--row-rule-compact",this.hasAttribute("row-span-compact")?`span ${this.rowSpanCompact}`:null),o(e,this,l).call(this,"--row-rule-medium",this.hasAttribute("row-span-medium")?`span ${this.rowSpanMedium}`:null),o(e,this,l).call(this,"--row-rule-expanded",this.hasAttribute("row-span-expanded")?`span ${this.rowSpanExpanded}`:null),this.align?(this.style.setProperty("--scb-grid-item-align",this.align),this.style.setProperty("align-self",this.align)):(this.style.
|
|
11
|
+
`,p);function d(){o(e,this,l).call(this,"--col-span",this.hasAttribute("col-span")?String(this.colSpan):null),o(e,this,l).call(this,"--col-span-compact",this.hasAttribute("col-span-compact")?String(this.colSpanCompact):null),o(e,this,l).call(this,"--col-span-medium",this.hasAttribute("col-span-medium")?String(this.colSpanMedium):null),o(e,this,l).call(this,"--col-span-expanded",this.hasAttribute("col-span-expanded")?String(this.colSpanExpanded):null),o(e,this,l).call(this,"--row-rule",this.hasAttribute("row-span")?`span ${this.rowSpan}`:null),o(e,this,l).call(this,"--row-rule-compact",this.hasAttribute("row-span-compact")?`span ${this.rowSpanCompact}`:null),o(e,this,l).call(this,"--row-rule-medium",this.hasAttribute("row-span-medium")?`span ${this.rowSpanMedium}`:null),o(e,this,l).call(this,"--row-rule-expanded",this.hasAttribute("row-span-expanded")?`span ${this.rowSpanExpanded}`:null),this.align?(this.style.setProperty("--scb-grid-item-align",this.align),this.style.setProperty("align-self",this.align)):(this.style.setProperty("--scb-grid-item-align","initial"),this.style.removeProperty("align-self")),this.justify?(this.style.setProperty("--scb-grid-item-justify",this.justify),this.style.setProperty("justify-self",this.justify)):(this.style.setProperty("--scb-grid-item-justify","initial"),this.style.removeProperty("justify-self"))}function l(a,s){this.style.setProperty(a,s===null||s===""?"initial":s)}i([r({type:Number,attribute:"col-span",reflect:!0})],t.prototype,"colSpan",void 0);i([r({type:Number,attribute:"col-span-compact",reflect:!0})],t.prototype,"colSpanCompact",void 0);i([r({type:Number,attribute:"col-span-medium",reflect:!0})],t.prototype,"colSpanMedium",void 0);i([r({type:Number,attribute:"col-span-expanded",reflect:!0})],t.prototype,"colSpanExpanded",void 0);i([r({type:Number,attribute:"row-span",reflect:!0})],t.prototype,"rowSpan",void 0);i([r({type:Number,attribute:"row-span-compact",reflect:!0})],t.prototype,"rowSpanCompact",void 0);i([r({type:Number,attribute:"row-span-medium",reflect:!0})],t.prototype,"rowSpanMedium",void 0);i([r({type:Number,attribute:"row-span-expanded",reflect:!0})],t.prototype,"rowSpanExpanded",void 0);i([r({type:String,reflect:!0})],t.prototype,"align",void 0);i([r({type:String,reflect:!0})],t.prototype,"justify",void 0);i([r({type:Boolean,reflect:!0,converter:w})],t.prototype,"fit",void 0);t=i([b("scb-grid-item")],t);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as
|
|
1
|
+
import{_ as u,b as h,g as b,h as s,y as v}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as r}from"../../vendor/decorate.js";import{n as y,t as m}from"../../vendor/assertClassBrand.js";import"./scb-grid-item.js";import"./scb-stack.js";(function(){try{var o=typeof globalThis<"u"?globalThis:window;if(!o.__scb_ce_guard_installed__){o.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(t,a,c){try{customElements.get(t)||e(t,a,c)}catch(l){var n=String(l||"");if(n.indexOf("already been used")===-1&&n.indexOf("NotSupportedError")===-1)throw l}}}}catch{}})();var d,p,i=(d=new WeakSet,p=class extends u{constructor(...e){super(...e),y(this,d),this.colsCompact=4,this.colsMedium=8,this.colsExpanded=12,this.gap="",this.rowGap="",this.columnGap="",this.alignItems="stretch",this.justifyItems="stretch",this.paddingInline="",this.paddingBlock="",this.maxWidth="",this.autoRows=""}firstUpdated(){m(d,this,g).call(this)}updated(){m(d,this,g).call(this)}mapSpacingToken(e){if(!e)return;const t=String(e).trim();return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}parseGapShorthand(e){if(!e)return{};const t=e.trim().split(/\s+/);if(t.length===1){const a=this.mapSpacingToken(t[0]);return{row:a,col:a}}return{row:this.mapSpacingToken(t[0]),col:this.mapSpacingToken(t[1])}}render(){return v`<div class="grid"><slot></slot></div>`}},p.styles=h`
|
|
2
2
|
:host {
|
|
3
3
|
box-sizing: border-box;
|
|
4
4
|
display: block;
|
|
@@ -95,4 +95,4 @@ import{_ as h,b,g as v,h as s,y}from"../../vendor/vendor.js";import"../../vendor
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
`,
|
|
98
|
+
`,p);function g(){this.style.setProperty("--scb-grid-cols-compact",String(this.colsCompact)),this.style.setProperty("--scb-grid-cols-medium",String(this.colsMedium)),this.style.setProperty("--scb-grid-cols-expanded",String(this.colsExpanded));const o="var(--spacing-7, 24px)",e=this.parseGapShorthand(this.gap),t=this.mapSpacingToken(this.rowGap)??e.row??o,a=this.mapSpacingToken(this.columnGap)??e.col??o;this.style.setProperty("--scb-grid-row-gap",t),this.style.setProperty("--scb-grid-column-gap",a),this.style.setProperty("--scb-grid-gap",`${t} ${a}`),this.style.setProperty("--scb-grid-align-items",this.alignItems),this.style.setProperty("--scb-grid-justify-items",this.justifyItems);const c=this.mapSpacingToken(this.paddingInline),n=this.mapSpacingToken(this.paddingBlock);this.style.setProperty("--scb-grid-max-width",this.maxWidth||"1440px"),this.style.setProperty("--scb-grid-padding-inline",c??"0"),this.style.setProperty("--scb-grid-padding-block",n??"0"),this.style.setProperty("--scb-grid-auto-rows",this.autoRows||"auto")}r([s({type:Number,attribute:"cols-compact",reflect:!0})],i.prototype,"colsCompact",void 0);r([s({type:Number,attribute:"cols-medium",reflect:!0})],i.prototype,"colsMedium",void 0);r([s({type:Number,attribute:"cols-expanded",reflect:!0})],i.prototype,"colsExpanded",void 0);r([s({type:String,reflect:!0})],i.prototype,"gap",void 0);r([s({type:String,attribute:"row-gap",reflect:!0})],i.prototype,"rowGap",void 0);r([s({type:String,attribute:"column-gap",reflect:!0})],i.prototype,"columnGap",void 0);r([s({type:String,attribute:"align-items",reflect:!0})],i.prototype,"alignItems",void 0);r([s({type:String,attribute:"justify-items",reflect:!0})],i.prototype,"justifyItems",void 0);r([s({type:String,attribute:"padding-inline",reflect:!0})],i.prototype,"paddingInline",void 0);r([s({type:String,attribute:"padding-block",reflect:!0})],i.prototype,"paddingBlock",void 0);r([s({type:String,attribute:"max-width",reflect:!0})],i.prototype,"maxWidth",void 0);r([s({type:String,attribute:"auto-rows",reflect:!0})],i.prototype,"autoRows",void 0);i=r([b("scb-grid")],i);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import"../../vendor/vendor-material.js";import{_ as
|
|
1
|
+
import"../../vendor/vendor-material.js";import{_ as x,b as w,g as _,h as p,y as o}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as l}from"../../vendor/decorate.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-link/scb-link.js";(function(){try{var h=typeof globalThis<"u"?globalThis:window;if(!h.__scb_ce_guard_installed__){h.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(n,a,s){try{customElements.get(n)||t(n,a,s)}catch(g){var e=String(g||"");if(e.indexOf("already been used")===-1&&e.indexOf("NotSupportedError")===-1)throw g}}}}catch{}})();var b,r=(b=class extends x{constructor(...t){super(...t),this.variant="icon-text",this.alignment="start",this.page=1,this.totalPages=0,this.pagingHref="",this.baseUri="",this.paginationAriaLabel="Paginering",this.currentAriaLabel="Nuvarande sida, ",this.pagingNumberAriaLabel="Gå till sida ",this.isNarrow=window.innerWidth<=768,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._onResize=()=>{this.isNarrow=window.innerWidth<=768}}_emitPageChange(t){const n={page:t};this.dispatchEvent(new CustomEvent("page-change",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:n,bubbles:!0,composed:!0}))}_getPagingHref(t){if(!this.pagingHref)return;const n=(this.baseUri||"").trim(),a=n||window.location.href,s=new URL(a,window.location.href),e=this.pagingHref.trim().replace(/^[?&]/,"").split("=")[0];if(e)return s.searchParams.delete(e),s.searchParams.set(e,String(t)),/^https?:\/\//i.test(n)?s.toString():`${s.pathname}${s.search}${s.hash}`}_handlePageSelection(t,n){!this.pagingHref&&n&&n.preventDefault(),this.page=t,this._emitPageChange(t)}_prevPage(t){if(this.page<=1){!this.pagingHref&&t&&t.preventDefault();return}this._handlePageSelection(this.page-1,t)}_nextPage(t){if(this.page>=this.totalPages){!this.pagingHref&&t&&t.preventDefault();return}this._handlePageSelection(this.page+1,t)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(t){if(t==null)return;const n=String(t).trim();if(n)return/^\d+$/.test(n)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(n,10)))})`:n}__applySpacing(){const t=this.mapSpacingToken(this.spacing),n=this.mapSpacingToken(this.spacingTop)??t,a=this.mapSpacingToken(this.spacingBottom)??t,s=this.mapSpacingToken(this.spacingLeft),e=this.mapSpacingToken(this.spacingRight);n?this.style.setProperty("--scb-pagination-spacing-block-start",n):this.style.removeProperty("--scb-pagination-spacing-block-start"),a?this.style.setProperty("--scb-pagination-spacing-block-end",a):this.style.removeProperty("--scb-pagination-spacing-block-end"),s?this.style.setProperty("--scb-pagination-spacing-inline-start",s):this.style.removeProperty("--scb-pagination-spacing-inline-start"),e?this.style.setProperty("--scb-pagination-spacing-inline-end",e):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(t){super.updated(t),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const t=this.variant?`${this.variant.toLowerCase()}`:"",n=this.alignment==="center"||this.alignment==="end"?`align-${this.alignment}`:"align-start",a=[],{page:s,totalPages:e}=this,g=window.innerWidth<=768,d=g?1:2,u=this._getPagingHref(Math.max(1,this.page-1)),f=this._getPagingHref(Math.min(this.totalPages,this.page+1)),m=this.pagingHref?this.variant==="icon"?o`<a
|
|
2
2
|
class="paging-action-link"
|
|
3
|
-
href=${
|
|
3
|
+
href=${u}
|
|
4
4
|
@click=${this._prevPage}
|
|
5
5
|
aria-label="Föregående sida"
|
|
6
6
|
aria-disabled=${this.page===1?"true":"false"}
|
|
@@ -10,9 +10,9 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
10
10
|
?disabled=${this.page===1}
|
|
11
11
|
aria-label="Föregående sida"
|
|
12
12
|
></scb-icon-button>
|
|
13
|
-
</a>`:
|
|
13
|
+
</a>`:o`<a
|
|
14
14
|
class="paging-action-link"
|
|
15
|
-
href=${
|
|
15
|
+
href=${u}
|
|
16
16
|
@click=${this._prevPage}
|
|
17
17
|
aria-label="Föregående sida"
|
|
18
18
|
aria-disabled=${this.page===1?"true":"false"}
|
|
@@ -24,21 +24,21 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
24
24
|
?disabled=${this.page===1}
|
|
25
25
|
aria-label="Föregående sida"
|
|
26
26
|
></scb-button>
|
|
27
|
-
</a>`:this.variant==="icon"?
|
|
27
|
+
</a>`:this.variant==="icon"?o`<scb-icon-button
|
|
28
28
|
icon="chevron_left"
|
|
29
29
|
@click=${this._prevPage}
|
|
30
30
|
?disabled=${this.page===1}
|
|
31
31
|
aria-label="Föregående sida"
|
|
32
|
-
></scb-icon-button>`:
|
|
32
|
+
></scb-icon-button>`:o`<scb-button
|
|
33
33
|
variant="text"
|
|
34
34
|
label="Föregående"
|
|
35
35
|
icon="chevron_left"
|
|
36
36
|
@click=${this._prevPage}
|
|
37
37
|
?disabled=${this.page===1}
|
|
38
38
|
aria-label="Föregående sida"
|
|
39
|
-
></scb-button>`,
|
|
39
|
+
></scb-button>`,v=this.pagingHref?this.variant==="icon"?o`<a
|
|
40
40
|
class="paging-action-link"
|
|
41
|
-
href=${
|
|
41
|
+
href=${f}
|
|
42
42
|
@click=${this._nextPage}
|
|
43
43
|
aria-label="Nästa sida"
|
|
44
44
|
aria-disabled=${this.page===this.totalPages?"true":"false"}
|
|
@@ -48,9 +48,9 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
48
48
|
?disabled=${this.page===this.totalPages}
|
|
49
49
|
aria-label="Nästa sida"
|
|
50
50
|
></scb-icon-button>
|
|
51
|
-
</a>`:
|
|
51
|
+
</a>`:o`<a
|
|
52
52
|
class="paging-action-link"
|
|
53
|
-
href=${
|
|
53
|
+
href=${f}
|
|
54
54
|
@click=${this._nextPage}
|
|
55
55
|
aria-label="Nästa sida"
|
|
56
56
|
aria-disabled=${this.page===this.totalPages?"true":"false"}
|
|
@@ -64,12 +64,12 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
64
64
|
aria-label="Nästa sida"
|
|
65
65
|
trailing-icon
|
|
66
66
|
></scb-button>
|
|
67
|
-
</a>`:this.variant==="icon"?
|
|
67
|
+
</a>`:this.variant==="icon"?o`<scb-icon-button
|
|
68
68
|
icon="chevron_right"
|
|
69
69
|
@click=${this._nextPage}
|
|
70
70
|
?disabled=${this.page===this.totalPages}
|
|
71
71
|
aria-label="Nästa sida"
|
|
72
|
-
></scb-icon-button>`:
|
|
72
|
+
></scb-icon-button>`:o`<scb-button
|
|
73
73
|
variant="text"
|
|
74
74
|
label="Nästa"
|
|
75
75
|
icon="chevron_right"
|
|
@@ -78,56 +78,56 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
78
78
|
?disabled=${this.page===this.totalPages}
|
|
79
79
|
aria-label="Nästa sida"
|
|
80
80
|
trailing-icon
|
|
81
|
-
></scb-button>`,
|
|
81
|
+
></scb-button>`,c=i=>i===s?o`
|
|
82
82
|
<li>
|
|
83
83
|
<span
|
|
84
84
|
class="page-number active"
|
|
85
85
|
aria-current="page"
|
|
86
|
-
aria-label="${this.currentAriaLabel} ${
|
|
87
|
-
>${
|
|
86
|
+
aria-label="${this.currentAriaLabel} ${i}"
|
|
87
|
+
>${i}</span
|
|
88
88
|
>
|
|
89
89
|
</li>
|
|
90
|
-
`:
|
|
90
|
+
`:o`
|
|
91
91
|
<li>
|
|
92
92
|
<scb-link
|
|
93
|
-
class="page-number${
|
|
94
|
-
@click=${
|
|
95
|
-
aria-current=${
|
|
96
|
-
aria-label="${this.pagingNumberAriaLabel} ${
|
|
97
|
-
href=${this._getPagingHref(
|
|
98
|
-
?disabled=${
|
|
99
|
-
>${
|
|
93
|
+
class="page-number${i===s?" active":""}"
|
|
94
|
+
@click=${y=>this._handlePageSelection(i,y)}
|
|
95
|
+
aria-current=${i===s?"page":void 0}
|
|
96
|
+
aria-label="${this.pagingNumberAriaLabel} ${i}"
|
|
97
|
+
href=${this._getPagingHref(i)}
|
|
98
|
+
?disabled=${i===s}
|
|
99
|
+
>${i}</scb-link
|
|
100
100
|
>
|
|
101
101
|
</li>
|
|
102
|
-
`;if(
|
|
103
|
-
<nav aria-label="${this.paginationAriaLabel}" class="pagination ${
|
|
102
|
+
`;if(e<=8)for(let i=1;i<=e;i++)a.push(c(i));else if(a.push(c(1)),s<=4&&!g){for(let i=2;i<=5;i++)a.push(c(i));e>6?(a.push(o`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),a.push(c(e))):e===6&&a.push(c(e))}else if(s<=3&&g){for(let i=2;i<=3;i++)a.push(c(i));e>4?(a.push(o`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),a.push(c(e))):e===4&&a.push(c(e))}else if(s>=e-(d+1)){a.push(o`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let i=e-d*2;i<=e;i++)i>1&&a.push(c(i))}else{a.push(o`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let i=s-d;i<=s+d;i++)i>1&&i<e&&a.push(c(i));a.push(o`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),a.push(c(e))}return g?o`
|
|
103
|
+
<nav aria-label="${this.paginationAriaLabel}" class="pagination ${t} ${n}">
|
|
104
104
|
<div class="pagination-row">
|
|
105
105
|
<div class="prev">
|
|
106
|
-
${
|
|
106
|
+
${m}
|
|
107
107
|
</div>
|
|
108
108
|
<ol>
|
|
109
|
-
${
|
|
109
|
+
${a}
|
|
110
110
|
</ol>
|
|
111
111
|
</div>
|
|
112
112
|
<div class="next">
|
|
113
|
-
${
|
|
113
|
+
${v}
|
|
114
114
|
</div>
|
|
115
115
|
</nav>
|
|
116
|
-
`:
|
|
117
|
-
<nav aria-label="${this.paginationAriaLabel}" class="pagination ${
|
|
116
|
+
`:o`
|
|
117
|
+
<nav aria-label="${this.paginationAriaLabel}" class="pagination ${t} ${n}">
|
|
118
118
|
<div class="pagination-row">
|
|
119
119
|
<div class="prev">
|
|
120
|
-
${
|
|
120
|
+
${m}
|
|
121
121
|
</div>
|
|
122
122
|
<ol>
|
|
123
|
-
${
|
|
123
|
+
${a}
|
|
124
124
|
</ol>
|
|
125
125
|
<div class="next">
|
|
126
|
-
${
|
|
126
|
+
${v}
|
|
127
127
|
</div>
|
|
128
128
|
</div>
|
|
129
129
|
</nav>
|
|
130
|
-
`}},
|
|
130
|
+
`}},b.styles=[w`
|
|
131
131
|
:host {
|
|
132
132
|
display: block;
|
|
133
133
|
width: 100%;
|
|
@@ -204,6 +204,26 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
204
204
|
width: auto;
|
|
205
205
|
margin-top: 0;
|
|
206
206
|
}
|
|
207
|
+
.pagination.align-center .pagination-row,
|
|
208
|
+
.pagination.align-center .pagination-row ol,
|
|
209
|
+
.pagination.align-center .pagination-row .prev,
|
|
210
|
+
.pagination.align-center .pagination-row .next,
|
|
211
|
+
.pagination.align-center > .next {
|
|
212
|
+
justify-content: center;
|
|
213
|
+
}
|
|
214
|
+
.pagination.align-center > .next {
|
|
215
|
+
display: flex;
|
|
216
|
+
}
|
|
217
|
+
.pagination.align-end .pagination-row,
|
|
218
|
+
.pagination.align-end .pagination-row ol,
|
|
219
|
+
.pagination.align-end .pagination-row .prev,
|
|
220
|
+
.pagination.align-end .pagination-row .next,
|
|
221
|
+
.pagination.align-end > .next {
|
|
222
|
+
justify-content: flex-end;
|
|
223
|
+
}
|
|
224
|
+
.pagination.align-end > .next {
|
|
225
|
+
display: flex;
|
|
226
|
+
}
|
|
207
227
|
scb-link.page-number a {
|
|
208
228
|
cursor: pointer;
|
|
209
229
|
text-decoration: none;
|
|
@@ -309,4 +329,4 @@ import"../../vendor/vendor-material.js";import{_ as y,b as x,g as w,h as c,y as
|
|
|
309
329
|
margin-top: 8px;
|
|
310
330
|
}
|
|
311
331
|
}
|
|
312
|
-
`],
|
|
332
|
+
`],b);l([p({type:String})],r.prototype,"variant",void 0);l([p({type:String})],r.prototype,"alignment",void 0);l([p({type:Number})],r.prototype,"page",void 0);l([p({type:Number,attribute:"total-pages"})],r.prototype,"totalPages",void 0);l([p({type:String,attribute:"paging-href"})],r.prototype,"pagingHref",void 0);l([p({type:String,attribute:"base-uri"})],r.prototype,"baseUri",void 0);l([p({type:String,attribute:"pagination-aria-label"})],r.prototype,"paginationAriaLabel",void 0);l([p({type:String,attribute:"current-aria-label"})],r.prototype,"currentAriaLabel",void 0);l([p({type:String,attribute:"paging-number-aria-label"})],r.prototype,"pagingNumberAriaLabel",void 0);l([p({type:Boolean})],r.prototype,"isNarrow",void 0);l([p({type:String})],r.prototype,"spacing",void 0);l([p({type:String,attribute:"spacing-top"})],r.prototype,"spacingTop",void 0);l([p({type:String,attribute:"spacing-bottom"})],r.prototype,"spacingBottom",void 0);l([p({type:String,attribute:"spacing-left"})],r.prototype,"spacingLeft",void 0);l([p({type:String,attribute:"spacing-right"})],r.prototype,"spacingRight",void 0);r=l([_("scb-pagination")],r);
|
|
@@ -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 t=customElements.define.bind(customElements);customElements.define=function(r,s,o){try{customElements.get(r)||t(r,s,o)}catch(a){var l=String(a||"");if(l.indexOf("already been used")===-1&&l.indexOf("NotSupportedError")===-1)throw a}}}}catch{}})();var p,m=(p=class extends g{constructor(...t){super(...t),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
|
|
5
|
+
`}firstUpdated(){const t=this.shadowRoot?.querySelector("slot");t&&(t.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners())}updated(t){t.has("dataSorting")&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection="asc"),this._attachThListeners()),t.has("columnWidthMode")&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){const t=this.shadowRoot?.querySelector("slot");if(!t)return null;const r=t.assignedNodes({flatten:!0});for(const s of r)if(s.nodeType===Node.ELEMENT_NODE){const o=s,l=o.tagName.toLowerCase()==="tbody"?o:o.querySelector("tbody");if(l)return l}return null}_getTables(){const t=this.shadowRoot?.querySelector("slot");if(!t)return[];const r=t.assignedNodes({flatten:!0}),s=[];return r.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const l=o;l.tagName.toLowerCase()==="table"&&s.push(l),s.push(...Array.from(l.querySelectorAll("table")))}}),s}_attachThListeners(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const r=t.assignedNodes({flatten:!0}),s=[],o=[],l=[],a=[];r.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&(s.push(...e.querySelectorAll("thead")),o.push(...e.querySelectorAll("th")),l.push(...e.querySelectorAll("td")),a.push(...e.querySelectorAll("tr")))}),s.forEach(e=>{e.style.borderTop="1px solid var(--md-sys-color-on-surface)"}),o.forEach((e,d)=>{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)";const u=(e.textContent??"").replace(/\s+/g," ").trim();for(;e.firstChild;)e.removeChild(e.firstChild);const c=document.createElement("p");if(c.textContent=u,c.style.margin="0",this.dataSorting){const n=document.createElement("scb-icon-button");n.className="scb-sort-icon",n.onclick=()=>this._onThClick(d),n.setAttribute("variant","standard"),n.setAttribute("size","small"),n.style.alignSelf="end",this._sortedColumn===d?(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)");const h=document.createElement("div");h.style.display="flex",h.style.gap="8px",h.style.flexWrap="nowrap",h.style.alignItems="center",h.appendChild(c),h.appendChild(n),e.appendChild(h)}else e.appendChild(c)}),l.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)"}),a.forEach(e=>{const d=e.querySelectorAll("th");d.length>0&&d.forEach((c,n)=>{n===d.length-1&&(c.style.borderRight="none")});const u=e.querySelectorAll("td");u.length>0&&u.forEach((c,n)=>{n===u.length-1&&(c.style.borderRight="none")})});const i=this._getTbody();i&&Array.from(i.querySelectorAll("tr")).forEach((e,d)=>{const u=d%2===0?"var(--md-sys-color-surface-container)":"var(--md-sys-color-surface)";e.querySelectorAll("td").forEach(c=>{c.style.backgroundColor=u})}),this._queueColumnWidthUpdate()}_queueColumnWidthUpdate(){this._columnWidthFrame!==null&&cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=requestAnimationFrame(()=>{this._columnWidthFrame=null,this._applyColumnWidthMode()})}_applyColumnWidthMode(){this._getTables().forEach(t=>{if(this._removeGeneratedColGroup(t),t.style.tableLayout="",t.style.width="",t.style.minWidth="",t.style.maxWidth="",this.columnWidthMode!=="header")return;const r=Array.from(t.querySelectorAll("thead tr")),s=r[r.length-1];if(!s)return;const o=Array.from(s.cells).map(a=>`${Math.ceil(this._measureCellContentWidth(a))}px`),l=o.reduce((a,i)=>a+parseFloat(i),0);this._applyGeneratedColGroup(t,o),t.style.tableLayout="fixed",t.style.width=`${Math.ceil(l)}px`,t.style.minWidth=`${Math.ceil(l)}px`,t.style.maxWidth="none"})}_applyGeneratedColGroup(t,r){const s=document.createElement("colgroup");s.setAttribute("data-scb-generated-column-widths","true"),r.forEach(o=>{const l=document.createElement("col");l.style.width=o,l.style.minWidth=o,s.appendChild(l)}),t.insertBefore(s,t.firstChild)}_removeGeneratedColGroup(t){t.querySelector('colgroup[data-scb-generated-column-widths="true"]')?.remove()}_measureCellContentWidth(t){const r=t.firstElementChild?.cloneNode(!0)??document.createElement("span");t.firstElementChild||(r.textContent=t.textContent??"");const s=window.getComputedStyle(t),o=document.createElement("div");o.style.position="absolute",o.style.left="-99999px",o.style.top="0",o.style.visibility="hidden",o.style.pointerEvents="none",o.style.width="max-content",o.style.maxWidth="none",o.style.whiteSpace="nowrap",o.style.fontFamily=s.fontFamily,o.style.fontSize=s.fontSize,o.style.fontWeight=s.fontWeight,o.style.lineHeight=s.lineHeight,o.style.letterSpacing=s.letterSpacing,r instanceof HTMLElement&&(r.style.width="max-content",r.style.maxWidth="none",r.style.whiteSpace="nowrap"),o.appendChild(r),document.body.appendChild(o);const l=parseFloat(s.paddingLeft||"0"),a=parseFloat(s.paddingRight||"0"),i=o.getBoundingClientRect().width+l+a;return document.body.removeChild(o),i}_onThClick(t){this.dataSorting&&(this._sortedColumn===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortedColumn=t,this._sortDirection="asc"),this._sortTable(t,this._sortDirection),this._attachThListeners(),this.dispatchEvent(new CustomEvent("tablesortchange",{detail:{sortedColumn:this._sortedColumn,sortDirection:this._sortDirection},bubbles:!0,composed:!0})))}_sortTable(t,r){const s=this._getTbody();if(!s)return;const o=Array.from(s.querySelectorAll("tr"));o.sort((l,a)=>{const i=this._getCellSortableValue(l.children[t]),e=this._getCellSortableValue(a.children[t]);return this._compareCellValues(i,e,r)}),o.forEach(l=>s.appendChild(l))}_getCellSortableValue(t){if(!t)return"";const r=t,s=this._getSortableAttributeValue(r);if(s)return s;const o=[],l=r.textContent?.replace(/\s+/g," ").trim();return l&&o.push(l),r.querySelectorAll("[data-sort-value], [data-sort], [aria-label], [label], [value], [title]").forEach(a=>{const i=this._getSortableAttributeValue(a);i&&!o.includes(i)&&o.push(i)}),o.join(" ").trim()}_getSortableAttributeValue(t){return(t.getAttribute("data-sort-value")??t.getAttribute("data-sort")??t.getAttribute("aria-label")??t.getAttribute("label")??t.getAttribute("value")??t.getAttribute("title")??"").replace(/\s+/g," ").trim()}_compareCellValues(t,r,s){const o=this._parseSortableNumber(t),l=this._parseSortableNumber(r);if(o!==null&&l!==null)return s==="asc"?o-l:l-o;const a=Date.parse(t.replace(/\s+/g," ")),i=Date.parse(r.replace(/\s+/g," "));if(!isNaN(a)&&!isNaN(i))return s==="asc"?a-i:i-a;const e=t.localeCompare(r,"sv");return s==="asc"?e:-e}_parseSortableNumber(t){const r=t.trim();if(!/^[+-]?(?:\d+|\d{1,3}(?:[\s\u00a0\u202f]\d{3})+)(?:[,.]\d+)?$/.test(r))return null;const s=Number(r.replace(/[\s\u00a0\u202f]/g,"").replace(",","."));return Number.isNaN(s)?null:s}},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);
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{_,b as m,g as v,h as
|
|
2
|
-
${this.filteringSearch?
|
|
1
|
+
import{_,b as m,g as v,h as b,y as p}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as u}from"../../vendor/decorate.js";import"../scb-icon-button/scb-icon-button.js";import"../scb-search/scb-search.js";import"../scb-pagination/scb-pagination.js";(function(){try{var f=typeof globalThis<"u"?globalThis:window;if(!f.__scb_ce_guard_installed__){f.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(s,r,l){try{customElements.get(s)||e(s,r,l)}catch(t){var a=String(t||"");if(a.indexOf("already been used")===-1&&a.indexOf("NotSupportedError")===-1)throw t}}}}catch{}})();var y,d=(y=class extends _{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=s=>{const r=s.detail;r&&typeof r.page=="number"&&this._changePage(r.page)}}disconnectedCallback(){super.disconnectedCallback(),this._disconnectTbodyObserver()}attributeChangedCallback(e,s,r){if(super.attributeChangedCallback(e,s,r),s!==r){if(e==="searchterm"){queueMicrotask(()=>{this.isConnected&&this._filterTable()});return}if(e==="currentpage"){queueMicrotask(()=>{this.isConnected&&this._paginateTable()});return}(e==="page-size"||e==="with-filtering-search"||e==="with-pagination")&&this._scheduleTableRefresh()}}render(){const e=Math.ceil(this.totalRows/this.pageSize);return p`
|
|
2
|
+
${this.filteringSearch?p`
|
|
3
3
|
<div style="margin-bottom: 12px;">
|
|
4
4
|
<scb-search
|
|
5
5
|
value=${this.searchTerm}
|
|
6
|
-
@input=${
|
|
6
|
+
@input=${s=>this._onSearchInput(s)}
|
|
7
7
|
/>
|
|
8
8
|
</div>
|
|
9
9
|
`:""}
|
|
10
|
-
${this.noScroll?
|
|
10
|
+
${this.noScroll?p`<slot @slotchange=${this._onSlotChange}></slot>`:p`
|
|
11
11
|
<div class="scb-table-scroll-wrapper">
|
|
12
12
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
13
13
|
</div>
|
|
14
14
|
`}
|
|
15
15
|
<div class="pagination">
|
|
16
|
-
${this.pagination&&e>1?
|
|
16
|
+
${this.pagination&&e>1?p`
|
|
17
17
|
<scb-pagination
|
|
18
18
|
.page=${this.currentPage}
|
|
19
19
|
.totalPages=${e}
|
|
@@ -22,7 +22,7 @@ import{_,b as m,g as v,h as p,y as b}from"../../vendor/vendor.js";import"../../v
|
|
|
22
22
|
></scb-pagination>
|
|
23
23
|
`:""}
|
|
24
24
|
</div>
|
|
25
|
-
`}_onSearchInput(e){const
|
|
25
|
+
`}_onSearchInput(e){const s=e.target.value;this.searchTerm=s,this._filterTable(),this.dispatchEvent(new CustomEvent("tableadvancedchange",{detail:{searchTerm:this.searchTerm,currentPage:this.currentPage},bubbles:!0,composed:!0}))}_filterTable(){const e=this.shadowRoot.querySelector("slot");if(!e)return;const s=e.assignedNodes({flatten:!0});let r=null;if(s.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const o=i.querySelector("tbody");o&&(r=o)}}),!r)return;const a=Array.from(r.querySelectorAll("tr")),t=this.searchTerm.trim().toLowerCase();if(!t)this._filteredRows=null,a.forEach(i=>i.style.display=""),this._updateTotalRows(),this._ensureCurrentPageWithinBounds(),this.pagination&&this._paginateTable(),this._sortedColumn!==null&&this._sortTable(this._sortedColumn,this._sortDirection);else{this._filteredRows=a.filter(o=>this._getRowSearchText(o).toLowerCase().includes(t)),a.forEach(o=>o.style.display="none");let i=this._filteredRows;this._sortedColumn!==null&&(i=[...i],i.sort((o,c)=>{const h=this._getCellSortableValue(o.children[this._sortedColumn]),n=this._getCellSortableValue(c.children[this._sortedColumn]);return this._compareCellValues(h,n,this._sortDirection)}),this._filteredRows=i),this.totalRows=this._filteredRows.length,this._ensureCurrentPageWithinBounds(),this.pagination?this._paginateTable():this._filteredRows.forEach(o=>o.style.display="")}}firstUpdated(){const e=this.shadowRoot.querySelector("slot");e&&(e.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners(),this._attachTbodyObserver(),this._refreshFromTableContent())}updated(e){super.updated(e),(e.has("searchTerm")||e.has("currentPage")||e.has("pageSize")||e.has("filteringSearch")||e.has("pagination"))&&this.updateComplete.then(()=>{this.isConnected&&this._refreshFromTableContent()})}_disconnectTbodyObserver(){this._tbodyObserver&&(this._tbodyObserver.disconnect(),this._tbodyObserver=null),this._observedTbody=null}_attachTbodyObserver(){const e=this._getTbody();if(!e){this._disconnectTbodyObserver();return}this._observedTbody!==e&&(this._disconnectTbodyObserver(),this._observedTbody=e,this._tbodyObserver=new MutationObserver(()=>{this._suppressTbodyObserver||this._scheduleTableRefresh()}),this._tbodyObserver.observe(e,{childList:!0,subtree:!0,characterData:!0}))}_scheduleTableRefresh(){this._pendingTableRefresh||(this._pendingTableRefresh=!0,queueMicrotask(()=>{this._pendingTableRefresh=!1,this._refreshFromTableContent()}))}_refreshFromTableContent(){if(this._attachTbodyObserver(),this.filteringSearch){this._filterTable();return}if(this._updateTotalRows(),this._ensureCurrentPageWithinBounds(),this._sortedColumn!==null){this._sortTable(this._sortedColumn,this._sortDirection);return}this.pagination&&this._paginateTable()}_ensureCurrentPageWithinBounds(){const e=Math.max(1,Math.ceil(this.totalRows/this.pageSize)),s=Math.min(Math.max(1,this.currentPage),e);s!==this.currentPage&&(this.currentPage=s)}_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 l=r.querySelector("tbody");if(l)return l}return null}_attachThListeners(){const e=this.shadowRoot.querySelector("slot");if(!e)return;const s=e.assignedNodes({flatten:!0}),r=[],l=[],a=[];s.forEach(t=>{t.nodeType===Node.ELEMENT_NODE&&(r.push(...t.querySelectorAll("th")),l.push(...t.querySelectorAll("td")),a.push(...t.querySelectorAll("tr")))}),r.forEach((t,i)=>{t.style.textAlign="left",t.style.padding="16px 0px 16px 32px",t.style.position="relative",t.style.backgroundColor="var(--md-sys-color-surface)",t.style.fontFamily="var(--md-sys-typescale-label-medium-font)",t.style.fontSize="var(--md-sys-typescale-label-medium-size)",t.style.lineHeight="var(--md-sys-typescale-label-medium-line-height)",t.style.fontWeight="var(--md-sys-typescale-label-medium-weight)",t.style.letterSpacing="var(--md-sys-typescale-label-medium-tracking)",t.style.verticalAlign="bottom";const o=t.firstChild;if(o&&o.nodeType===Node.TEXT_NODE&&o.textContent?.trim()||o&&o.nodeType===Node.ELEMENT_NODE&&o.tagName.toLowerCase()!=="p"){const h=document.createElement("p");h.textContent=o.textContent?o.textContent.trim():"",h.style.margin="0",t.replaceChild(h,o),t.querySelectorAll("scb-icon-button.scb-sort-icon").forEach(g=>g.remove());const n=document.createElement("scb-icon-button");n.className="scb-sort-icon",n.onclick=()=>this._onThClick(i),n.setAttribute("variant","standard"),n.setAttribute("size","small"),this._sortedColumn===i?(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)",n.style.alignSelf="end");var c=document.createElement("div");c.style.display="flex",c.style.gap="8px",c.style.flexWrap="nowrap",c.style.alignItems="center",c.appendChild(h),c.appendChild(n),t.appendChild(c)}}),l.forEach(t=>{t.style.padding="16px 0px 16px 32px",t.style.textAlign="left",t.style.borderTop="1px solid var(--md-sys-color-outline-variant)",t.style.verticalAlign="text-top",t.style.backgroundColor="var(--md-sys-color-surface)",t.style.fontFamily="var(--md-sys-typescale-body-medium-font)",t.style.fontSize="var(--md-sys-typescale-body-medium-size)",t.style.lineHeight="var(--md-sys-typescale-body-medium-line-height)",t.style.fontWeight="var(--md-sys-typescale-body-medium-weight)",t.style.letterSpacing="var(--md-sys-typescale-body-medium-tracking)"}),a.forEach((t,i)=>{i%2===1&&t.querySelectorAll("td").forEach(h=>{h.style.backgroundColor="var(--scb-background-row)"});const o=t.querySelectorAll("th");o.length>0&&o.forEach((h,n)=>{n===0&&(h.style.paddingLeft="24px"),n===o.length-1?h.style.paddingRight="24px":h.style.paddingRight=""});const c=t.querySelectorAll("td");c.length>0&&c.forEach((h,n)=>{n===0&&(h.style.paddingLeft="24px"),n===c.length-1?h.style.paddingRight="24px":h.style.paddingRight=""})}),this.pagination&&this._paginateTable()}_onThClick(e){this._sortedColumn===e?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortedColumn=e,this._sortDirection="asc"),this._sortTable(e,this._sortDirection),this._attachThListeners()}_sortTable(e,s){const r=this.shadowRoot.querySelector("slot");if(!r)return;const l=r.assignedNodes({flatten:!0});let a=null;if(l.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const c=o.querySelector("tbody");c&&(a=c)}}),!a)return;let t;this._filteredRows?t=[...this._filteredRows]:t=Array.from(a.querySelectorAll("tr")),t.sort((o,c)=>{const h=this._getCellSortableValue(o.children[e]),n=this._getCellSortableValue(c.children[e]);return this._compareCellValues(h,n,s)});const i=this._tbodyObserver!==null;i&&this._disconnectTbodyObserver();try{t.forEach(o=>a.appendChild(o))}finally{i&&this._attachTbodyObserver()}this._filteredRows&&(this._filteredRows=t,this.totalRows=this._filteredRows.length),this.pagination&&this._paginateTable()}_getRowSearchText(e){return Array.from(e.cells).map(s=>this._getCellSortableValue(s)).join(" ")}_getCellSortableValue(e){if(!e)return"";const s=e,r=this._getSortableAttributeValue(s);if(r)return r;const l=[],a=s.textContent?.replace(/\s+/g," ").trim();return a&&l.push(a),s.querySelectorAll("[data-sort-value], [data-sort], [aria-label], [label], [value], [title]").forEach(t=>{const i=this._getSortableAttributeValue(t);i&&!l.includes(i)&&l.push(i)}),l.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 l=this._parseSortableNumber(e),a=this._parseSortableNumber(s);if(l!==null&&a!==null)return r==="asc"?l-a:a-l;const t=Date.parse(e.replace(/\s+/g," ")),i=Date.parse(s.replace(/\s+/g," "));if(!isNaN(t)&&!isNaN(i))return r==="asc"?t-i:i-t;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}_updateTotalRows(){const e=this.shadowRoot.querySelector("slot");if(!e)return;const s=e.assignedNodes({flatten:!0});let r=null;s.forEach(l=>{if(l.nodeType===Node.ELEMENT_NODE){const a=l.querySelector("tbody");a&&(r=a)}}),r&&(this.totalRows=r.querySelectorAll("tr").length,this._ensureCurrentPageWithinBounds())}_paginateTable(){const e=this.shadowRoot.querySelector("slot");if(!e)return;const s=e.assignedNodes({flatten:!0});let r=null;if(s.forEach(i=>{if(i.nodeType===Node.ELEMENT_NODE){const o=i.querySelector("tbody");o&&(r=o)}}),!r)return;let l;this._filteredRows?l=this._filteredRows:l=Array.from(r.querySelectorAll("tr")),Array.from(r.querySelectorAll("tr")).forEach(i=>i.style.display="none");const a=(this.currentPage-1)*this.pageSize,t=a+this.pageSize;l.slice(a,t).forEach(i=>i.style.display="")}_changePage(e){const s=Math.ceil(this.totalRows/this.pageSize);e<1||e>s||(this.currentPage=e,this._paginateTable(),this.dispatchEvent(new CustomEvent("tableadvancedchange",{detail:{searchTerm:this.searchTerm,currentPage:this.currentPage},bubbles:!0,composed:!0})),this.requestUpdate())}},y.styles=m`
|
|
26
26
|
:host {
|
|
27
27
|
display: block;
|
|
28
28
|
color: var(--md-sys-color-on-surface);
|
|
@@ -73,4 +73,4 @@ import{_,b as m,g as v,h as p,y as b}from"../../vendor/vendor.js";import"../../v
|
|
|
73
73
|
::slotted(th:hover) .scb-sort-icon {
|
|
74
74
|
pointer-events: auto;
|
|
75
75
|
}
|
|
76
|
-
`,y);u([
|
|
76
|
+
`,y);u([b({type:String})],d.prototype,"searchTerm",void 0);u([b({type:Boolean,attribute:"with-pagination"})],d.prototype,"pagination",void 0);u([b({type:Boolean,attribute:"with-filtering-search"})],d.prototype,"filteringSearch",void 0);u([b({type:Boolean,attribute:"no-scroll"})],d.prototype,"noScroll",void 0);u([b({type:Number,attribute:"page-size"})],d.prototype,"pageSize",void 0);u([b({type:Number})],d.prototype,"currentPage",void 0);u([b({type:Number})],d.prototype,"totalRows",void 0);d=u([v("scb-table-advanced")],d);
|
package/mvc/scb-logo.svg
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
-
<svg viewBox="-0.0002 -0.0066 1344.9076 377.9532" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<defs>
|
|
4
|
-
<style type="text/css">
|
|
5
|
-
g {
|
|
6
|
-
fill: #100f0d;
|
|
7
|
-
}
|
|
8
|
-
g:target {
|
|
9
|
-
fill: #fff;
|
|
10
|
-
}
|
|
11
|
-
</style>
|
|
12
|
-
</defs>
|
|
13
|
-
<g transform="matrix(1.3333330154418945, 0, 0, -1.3333330154418945, 0, 377.9466552734375)" id="g10">
|
|
14
|
-
<g transform="scale(0.1)" id="inverted">
|
|
15
|
-
<path id="path14" d="m 1346.6,2515.59 c 0,48.24 -39.11,87.31 -87.4,87.31 -48.29,0 -87.4,-39.07 -87.4,-87.31 V 312.898 c 0,-48.339 39.11,-87.5 87.4,-87.5 48.29,0 87.4,39.161 87.4,87.5 V 1106.8 c 0,5.77 4.79,10.45 10.51,10.45 h 287.22 c 5.76,0 10.5,-4.68 10.5,-10.45 V 305.969 C 1654.83,137.02 1477.67,0 1259.2,0 1040.63,0 863.523,137.02 863.523,305.969 V 2528.77 c 0,168.86 177.107,305.88 395.677,305.88 218.47,0 395.63,-137.02 395.63,-305.88 V 1738.1 c 0,-5.86 -4.74,-10.45 -10.5,-10.45 h -287.22 c -5.72,0 -10.51,4.59 -10.51,10.45 v 777.49"/>
|
|
16
|
-
<path id="path16" d="M 10.4414,2265.38 C -8.01563,2136.85 -1.52734,1926.1 26.1172,1807.73 56.4922,1678.71 231.645,1417.96 310.555,1296.86 389.566,1175.85 494.949,1049.49 493.375,880.922 V 477.18 c 0,-48.25 -39.109,-87.41 -87.406,-87.41 -48.145,0 -87.254,39.16 -87.254,87.41 v 618.79 c 0,5.76 -4.785,10.55 -10.645,10.55 H 20.9453 c -5.8711,0 -10.5039,-4.79 -10.5039,-10.55 V 458.719 c 0,-168.957 177.1056,-305.969 395.5276,-305.969 218.574,0 395.683,137.012 395.683,305.969 v 422.203 c -1.324,289.568 -80.332,331.748 -182.867,505.398 -73.445,124.71 -254.121,381.95 -284.398,510.97 -27.735,118.36 -26.516,255.39 -15.672,379.9 0,48.25 39.109,87.41 87.254,87.41 48.297,0 87.406,-39.16 87.406,-87.41 v -550.32 c 0,-5.77 4.746,-10.45 10.645,-10.45 h 287.085 c 5.911,0 10.547,4.68 10.547,10.45 v 538.51 c 0,169.06 -177.109,305.97 -395.683,305.97 -218.422,0 -395.5276,-136.91 -395.5276,-305.97"/>
|
|
17
|
-
<path id="path18" d="m 1726.57,2547.82 h 440.8 c 182.04,0 329.61,-147.57 329.61,-329.52 v -462.24 c 0,-129.59 -84.97,-238.98 -202.16,-276.48 v -6.24 c 117.19,-37.4 202.16,-146.89 202.16,-276.58 V 491.148 c 0,-160.367 -130.2,-290.457 -290.45,-290.457 l -479.96,-0.293 c -5.91,0 -10.6,4.793 -10.6,10.454 V 2537.37 c 0,5.66 4.69,10.45 10.6,10.45 m 308.27,-229.22 c -5.97,0 -10.65,-4.78 -10.65,-10.55 v -729.33 c 0,-5.97 4.68,-10.65 10.65,-10.65 h 43.36 c 58.01,0 105.08,47.16 105.08,105.18 v 540.18 c 0,58 -47.07,105.17 -105.08,105.17 z m 0,-982.29 c -5.97,0 -10.65,-4.69 -10.65,-10.45 V 430.59 c 0,-5.86 4.68,-10.649 10.65,-10.649 h 51.85 c 58.12,0 105.09,47.18 105.09,105.188 v 706.011 c 0,58.19 -46.97,105.17 -105.09,105.17 h -51.85"/>
|
|
18
|
-
</g>
|
|
19
|
-
</g>
|
|
20
|
-
<text style="fill: rgb(1, 1, 1); font-family: Roboto; font-size: 139.2px; font-weight: 500; stroke: rgb(0, 0, 0); white-space: pre;" x="455.182" y="234.25">Designsystem</text>
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<svg viewBox="-0.0002 -0.0066 1344.9076 377.9532" xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<defs>
|
|
4
|
+
<style type="text/css">
|
|
5
|
+
g {
|
|
6
|
+
fill: #100f0d;
|
|
7
|
+
}
|
|
8
|
+
g:target {
|
|
9
|
+
fill: #fff;
|
|
10
|
+
}
|
|
11
|
+
</style>
|
|
12
|
+
</defs>
|
|
13
|
+
<g transform="matrix(1.3333330154418945, 0, 0, -1.3333330154418945, 0, 377.9466552734375)" id="g10">
|
|
14
|
+
<g transform="scale(0.1)" id="inverted">
|
|
15
|
+
<path id="path14" d="m 1346.6,2515.59 c 0,48.24 -39.11,87.31 -87.4,87.31 -48.29,0 -87.4,-39.07 -87.4,-87.31 V 312.898 c 0,-48.339 39.11,-87.5 87.4,-87.5 48.29,0 87.4,39.161 87.4,87.5 V 1106.8 c 0,5.77 4.79,10.45 10.51,10.45 h 287.22 c 5.76,0 10.5,-4.68 10.5,-10.45 V 305.969 C 1654.83,137.02 1477.67,0 1259.2,0 1040.63,0 863.523,137.02 863.523,305.969 V 2528.77 c 0,168.86 177.107,305.88 395.677,305.88 218.47,0 395.63,-137.02 395.63,-305.88 V 1738.1 c 0,-5.86 -4.74,-10.45 -10.5,-10.45 h -287.22 c -5.72,0 -10.51,4.59 -10.51,10.45 v 777.49"/>
|
|
16
|
+
<path id="path16" d="M 10.4414,2265.38 C -8.01563,2136.85 -1.52734,1926.1 26.1172,1807.73 56.4922,1678.71 231.645,1417.96 310.555,1296.86 389.566,1175.85 494.949,1049.49 493.375,880.922 V 477.18 c 0,-48.25 -39.109,-87.41 -87.406,-87.41 -48.145,0 -87.254,39.16 -87.254,87.41 v 618.79 c 0,5.76 -4.785,10.55 -10.645,10.55 H 20.9453 c -5.8711,0 -10.5039,-4.79 -10.5039,-10.55 V 458.719 c 0,-168.957 177.1056,-305.969 395.5276,-305.969 218.574,0 395.683,137.012 395.683,305.969 v 422.203 c -1.324,289.568 -80.332,331.748 -182.867,505.398 -73.445,124.71 -254.121,381.95 -284.398,510.97 -27.735,118.36 -26.516,255.39 -15.672,379.9 0,48.25 39.109,87.41 87.254,87.41 48.297,0 87.406,-39.16 87.406,-87.41 v -550.32 c 0,-5.77 4.746,-10.45 10.645,-10.45 h 287.085 c 5.911,0 10.547,4.68 10.547,10.45 v 538.51 c 0,169.06 -177.109,305.97 -395.683,305.97 -218.422,0 -395.5276,-136.91 -395.5276,-305.97"/>
|
|
17
|
+
<path id="path18" d="m 1726.57,2547.82 h 440.8 c 182.04,0 329.61,-147.57 329.61,-329.52 v -462.24 c 0,-129.59 -84.97,-238.98 -202.16,-276.48 v -6.24 c 117.19,-37.4 202.16,-146.89 202.16,-276.58 V 491.148 c 0,-160.367 -130.2,-290.457 -290.45,-290.457 l -479.96,-0.293 c -5.91,0 -10.6,4.793 -10.6,10.454 V 2537.37 c 0,5.66 4.69,10.45 10.6,10.45 m 308.27,-229.22 c -5.97,0 -10.65,-4.78 -10.65,-10.55 v -729.33 c 0,-5.97 4.68,-10.65 10.65,-10.65 h 43.36 c 58.01,0 105.08,47.16 105.08,105.18 v 540.18 c 0,58 -47.07,105.17 -105.08,105.17 z m 0,-982.29 c -5.97,0 -10.65,-4.69 -10.65,-10.45 V 430.59 c 0,-5.86 4.68,-10.649 10.65,-10.649 h 51.85 c 58.12,0 105.09,47.18 105.09,105.188 v 706.011 c 0,58.19 -46.97,105.17 -105.09,105.17 h -51.85"/>
|
|
18
|
+
</g>
|
|
19
|
+
</g>
|
|
20
|
+
<text style="fill: rgb(1, 1, 1); font-family: Roboto; font-size: 139.2px; font-weight: 500; stroke: rgb(0, 0, 0); white-space: pre;" x="455.182" y="234.25">Designsystem</text>
|
|
21
21
|
</svg>
|
package/mvc/scb.svg
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
-
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
4
|
-
aria-hidden="true"
|
|
5
|
-
role="img"
|
|
6
|
-
width="48"
|
|
7
|
-
height="48"
|
|
8
|
-
preserveAspectRatio="xMidYMid meet"
|
|
9
|
-
viewBox="0 0 1300 1300"
|
|
10
|
-
>
|
|
11
|
-
<path d="M539.3,128.2c0-19.3-15.7-35-35-35c-19.3,0-35,15.6-35,35v882.1c0,19.4,15.7,35,35,35c19.3,0,35-15.7,35-35V692.4 c0-2.3,1.9-4.2,4.2-4.2h115c2.3,0,4.2,1.9,4.2,4.2v320.7c0,67.7-71,122.5-158.4,122.5c-87.5,0-158.5-54.9-158.5-122.5V122.9 c0-67.6,70.9-122.5,158.5-122.5c87.5,0,158.4,54.9,158.4,122.5v316.6c0,2.3-1.9,4.2-4.2,4.2h-115c-2.3,0-4.2-1.8-4.2-4.2V128.2z" />
|
|
12
|
-
<path d="M4.2,228.4c-7.4,51.5-4.8,135.9,6.3,183.3c12.2,51.7,82.3,156.1,113.9,204.6c31.6,48.5,73.8,99.1,73.2,166.6v161.7 c0,19.3-15.7,35-35,35c-19.3,0-34.9-15.7-34.9-35V696.7c0-2.3-1.9-4.2-4.3-4.2H8.4c-2.4,0-4.2,1.9-4.2,4.2v255.2 c0,67.7,70.9,122.5,158.4,122.5c87.5,0,158.5-54.9,158.5-122.5V782.8c-0.5-116-32.2-132.9-73.2-202.4 c-29.4-49.9-101.8-153-113.9-204.6c-11.1-47.4-10.6-102.3-6.3-152.1c0-19.3,15.7-35,34.9-35c19.3,0,35,15.7,35,35V444 c0,2.3,1.9,4.2,4.3,4.2h115c2.4,0,4.2-1.9,4.2-4.2V228.4c0-67.7-70.9-122.5-158.5-122.5C75.1,105.8,4.2,160.7,4.2,228.4" />
|
|
13
|
-
<path d="M814.9,600.4c-2.4,0-4.3,1.9-4.3,4.2v358.5c0,2.3,1.9,4.3,4.3,4.3h20.8c23.3,0,42.1-18.9,42.1-42.1V642.6 c0-23.3-18.8-42.1-42.1-42.1H814.9z M814.9,207.1c-2.4,0-4.3,1.9-4.3,4.2v292.1c0,2.4,1.9,4.3,4.3,4.3h17.4 c23.2,0,42.1-18.9,42.1-42.1V249.2c0-23.2-18.9-42.1-42.1-42.1H814.9z M691.5,115.3H868c72.9,0,132,59.1,132,132v185.1 c0,51.9-34,95.7-81,110.7v2.5c46.9,15,81,58.8,81,110.8v282.6c0,64.2-52.1,116.3-116.3,116.3l-192.2,0.1c-2.4,0-4.2-1.9-4.2-4.2 V119.4C687.2,117.2,689.1,115.3,691.5,115.3" />
|
|
1
|
+
<svg
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
4
|
+
aria-hidden="true"
|
|
5
|
+
role="img"
|
|
6
|
+
width="48"
|
|
7
|
+
height="48"
|
|
8
|
+
preserveAspectRatio="xMidYMid meet"
|
|
9
|
+
viewBox="0 0 1300 1300"
|
|
10
|
+
>
|
|
11
|
+
<path d="M539.3,128.2c0-19.3-15.7-35-35-35c-19.3,0-35,15.6-35,35v882.1c0,19.4,15.7,35,35,35c19.3,0,35-15.7,35-35V692.4 c0-2.3,1.9-4.2,4.2-4.2h115c2.3,0,4.2,1.9,4.2,4.2v320.7c0,67.7-71,122.5-158.4,122.5c-87.5,0-158.5-54.9-158.5-122.5V122.9 c0-67.6,70.9-122.5,158.5-122.5c87.5,0,158.4,54.9,158.4,122.5v316.6c0,2.3-1.9,4.2-4.2,4.2h-115c-2.3,0-4.2-1.8-4.2-4.2V128.2z" />
|
|
12
|
+
<path d="M4.2,228.4c-7.4,51.5-4.8,135.9,6.3,183.3c12.2,51.7,82.3,156.1,113.9,204.6c31.6,48.5,73.8,99.1,73.2,166.6v161.7 c0,19.3-15.7,35-35,35c-19.3,0-34.9-15.7-34.9-35V696.7c0-2.3-1.9-4.2-4.3-4.2H8.4c-2.4,0-4.2,1.9-4.2,4.2v255.2 c0,67.7,70.9,122.5,158.4,122.5c87.5,0,158.5-54.9,158.5-122.5V782.8c-0.5-116-32.2-132.9-73.2-202.4 c-29.4-49.9-101.8-153-113.9-204.6c-11.1-47.4-10.6-102.3-6.3-152.1c0-19.3,15.7-35,34.9-35c19.3,0,35,15.7,35,35V444 c0,2.3,1.9,4.2,4.3,4.2h115c2.4,0,4.2-1.9,4.2-4.2V228.4c0-67.7-70.9-122.5-158.5-122.5C75.1,105.8,4.2,160.7,4.2,228.4" />
|
|
13
|
+
<path d="M814.9,600.4c-2.4,0-4.3,1.9-4.3,4.2v358.5c0,2.3,1.9,4.3,4.3,4.3h20.8c23.3,0,42.1-18.9,42.1-42.1V642.6 c0-23.3-18.8-42.1-42.1-42.1H814.9z M814.9,207.1c-2.4,0-4.3,1.9-4.3,4.2v292.1c0,2.4,1.9,4.3,4.3,4.3h17.4 c23.2,0,42.1-18.9,42.1-42.1V249.2c0-23.2-18.9-42.1-42.1-42.1H814.9z M691.5,115.3H868c72.9,0,132,59.1,132,132v185.1 c0,51.9-34,95.7-81,110.7v2.5c46.9,15,81,58.8,81,110.8v282.6c0,64.2-52.1,116.3-116.3,116.3l-192.2,0.1c-2.4,0-4.2-1.9-4.2-4.2 V119.4C687.2,117.2,689.1,115.3,691.5,115.3" />
|
|
14
14
|
</svg>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -417,5 +417,5 @@
|
|
|
417
417
|
},
|
|
418
418
|
"./mvc/*": "./mvc/*"
|
|
419
419
|
},
|
|
420
|
-
"buildHash": "
|
|
420
|
+
"buildHash": "458C1B8AEDE69F1820B80ACE8E8D87E2D19195DAFD4D14A997D4EE17AA997116"
|
|
421
421
|
}
|
|
@@ -21,6 +21,8 @@ export declare class ScbTable extends LitElement {
|
|
|
21
21
|
private _measureCellContentWidth;
|
|
22
22
|
private _onThClick;
|
|
23
23
|
private _sortTable;
|
|
24
|
+
private _getCellSortableValue;
|
|
25
|
+
private _getSortableAttributeValue;
|
|
24
26
|
private _compareCellValues;
|
|
25
27
|
private _parseSortableNumber;
|
|
26
28
|
}
|
|
@@ -31,6 +31,9 @@ export declare class ScbTableAdvanced extends LitElement {
|
|
|
31
31
|
private _attachThListeners;
|
|
32
32
|
private _onThClick;
|
|
33
33
|
private _sortTable;
|
|
34
|
+
private _getRowSearchText;
|
|
35
|
+
private _getCellSortableValue;
|
|
36
|
+
private _getSortableAttributeValue;
|
|
34
37
|
private _compareCellValues;
|
|
35
38
|
private _parseSortableNumber;
|
|
36
39
|
private _onSlotChange;
|
|
@@ -30,10 +30,10 @@ var o = { fromAttribute(e) {
|
|
|
30
30
|
this.#e();
|
|
31
31
|
}
|
|
32
32
|
#e() {
|
|
33
|
-
this.#t("--col-span", this.hasAttribute("col-span") ? String(this.colSpan) : null), this.#t("--col-span-compact", this.hasAttribute("col-span-compact") ? String(this.colSpanCompact) : null), this.#t("--col-span-medium", this.hasAttribute("col-span-medium") ? String(this.colSpanMedium) : null), this.#t("--col-span-expanded", this.hasAttribute("col-span-expanded") ? String(this.colSpanExpanded) : null), this.#t("--row-rule", this.hasAttribute("row-span") ? `span ${this.rowSpan}` : null), this.#t("--row-rule-compact", this.hasAttribute("row-span-compact") ? `span ${this.rowSpanCompact}` : null), this.#t("--row-rule-medium", this.hasAttribute("row-span-medium") ? `span ${this.rowSpanMedium}` : null), this.#t("--row-rule-expanded", this.hasAttribute("row-span-expanded") ? `span ${this.rowSpanExpanded}` : null), this.align ? (this.style.setProperty("--scb-grid-item-align", this.align), this.style.setProperty("align-self", this.align)) : (this.style.
|
|
33
|
+
this.#t("--col-span", this.hasAttribute("col-span") ? String(this.colSpan) : null), this.#t("--col-span-compact", this.hasAttribute("col-span-compact") ? String(this.colSpanCompact) : null), this.#t("--col-span-medium", this.hasAttribute("col-span-medium") ? String(this.colSpanMedium) : null), this.#t("--col-span-expanded", this.hasAttribute("col-span-expanded") ? String(this.colSpanExpanded) : null), this.#t("--row-rule", this.hasAttribute("row-span") ? `span ${this.rowSpan}` : null), this.#t("--row-rule-compact", this.hasAttribute("row-span-compact") ? `span ${this.rowSpanCompact}` : null), this.#t("--row-rule-medium", this.hasAttribute("row-span-medium") ? `span ${this.rowSpanMedium}` : null), this.#t("--row-rule-expanded", this.hasAttribute("row-span-expanded") ? `span ${this.rowSpanExpanded}` : null), this.align ? (this.style.setProperty("--scb-grid-item-align", this.align), this.style.setProperty("align-self", this.align)) : (this.style.setProperty("--scb-grid-item-align", "initial"), this.style.removeProperty("align-self")), this.justify ? (this.style.setProperty("--scb-grid-item-justify", this.justify), this.style.setProperty("justify-self", this.justify)) : (this.style.setProperty("--scb-grid-item-justify", "initial"), this.style.removeProperty("justify-self"));
|
|
34
34
|
}
|
|
35
35
|
#t(e, t) {
|
|
36
|
-
t === null || t === "" ?
|
|
36
|
+
this.style.setProperty(e, t === null || t === "" ? "initial" : t);
|
|
37
37
|
}
|
|
38
38
|
render() {
|
|
39
39
|
return r`<slot></slot>`;
|
package/scb-grid/scb-grid.js
CHANGED
|
@@ -139,10 +139,7 @@ var o = class extends t {
|
|
|
139
139
|
let e = "var(--spacing-7, 24px)", t = this.parseGapShorthand(this.gap), n = this.mapSpacingToken(this.rowGap) ?? t.row ?? e, r = this.mapSpacingToken(this.columnGap) ?? t.col ?? e;
|
|
140
140
|
this.style.setProperty("--scb-grid-row-gap", n), this.style.setProperty("--scb-grid-column-gap", r), this.style.setProperty("--scb-grid-gap", `${n} ${r}`), this.style.setProperty("--scb-grid-align-items", this.alignItems), this.style.setProperty("--scb-grid-justify-items", this.justifyItems);
|
|
141
141
|
let i = this.mapSpacingToken(this.paddingInline), a = this.mapSpacingToken(this.paddingBlock);
|
|
142
|
-
this
|
|
143
|
-
}
|
|
144
|
-
#t(e, t) {
|
|
145
|
-
t ? this.style.setProperty(e, t) : this.style.removeProperty(e);
|
|
142
|
+
this.style.setProperty("--scb-grid-max-width", this.maxWidth || "1440px"), this.style.setProperty("--scb-grid-padding-inline", i ?? "0"), this.style.setProperty("--scb-grid-padding-block", a ?? "0"), this.style.setProperty("--scb-grid-auto-rows", this.autoRows || "auto");
|
|
146
143
|
}
|
|
147
144
|
render() {
|
|
148
145
|
return r`<div class="grid"><slot></slot></div>`;
|