scb-wc-test 0.1.312 → 0.1.313
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,4 +1,4 @@
|
|
|
1
|
-
import{a as m,n as
|
|
1
|
+
import{a as m,n as c,i as v,x as r,t as y}from"../../vendor/vendor.js";import"../scb-link/scb-link.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";import"../../vendor/vendor-material.js";import"../../vendor/preload-helper.js";(function(){try{var i=typeof globalThis<"u"?globalThis:window;if(!i.__scb_ce_guard_installed__){i.__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(d){var p=String(d||"");if(p.indexOf("already been used")===-1&&p.indexOf("NotSupportedError")===-1)throw d}}}}catch{}})();var x=Object.defineProperty,w=Object.getOwnPropertyDescriptor,l=(i,t,n,a)=>{for(var s=a>1?void 0:a?w(t,n):t,p=i.length-1,d;p>=0;p--)(d=i[p])&&(s=(a?d(t,n,s):d(s))||s);return a&&s&&x(t,n,s),s};let o=class extends v{constructor(){super(...arguments),this.variant="icon-text",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(i){const t={page:i};this.dispatchEvent(new CustomEvent("page-change",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("pagechange",{detail:t,bubbles:!0,composed:!0}))}_getPagingHref(i){if(!this.pagingHref)return;const t=(this.baseUri||"").trim().replace(/^\?/,"").replace(/&+$/,""),n=window.location.search.replace(/^\?/,"").replace(/&+$/,""),a=t||n;return a?`${a}&${this.pagingHref}${i}`:`${this.pagingHref}${i}`}_handlePageSelection(i,t){!this.pagingHref&&t&&t.preventDefault(),this.page=i,this._emitPageChange(i)}_prevPage(i){if(this.page<=1){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page-1,i)}_nextPage(i){if(this.page>=this.totalPages){!this.pagingHref&&i&&i.preventDefault();return}this._handlePageSelection(this.page+1,i)}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._onResize),this._onResize()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this._onResize)}mapSpacingToken(i){if(i==null)return;const t=String(i).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}__applySpacing(){const i=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??i,n=this.mapSpacingToken(this.spacingBottom)??i,a=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-pagination-spacing-block-start",t):this.style.removeProperty("--scb-pagination-spacing-block-start"),n?this.style.setProperty("--scb-pagination-spacing-block-end",n):this.style.removeProperty("--scb-pagination-spacing-block-end"),a?this.style.setProperty("--scb-pagination-spacing-inline-start",a):this.style.removeProperty("--scb-pagination-spacing-inline-start"),s?this.style.setProperty("--scb-pagination-spacing-inline-end",s):this.style.removeProperty("--scb-pagination-spacing-inline-end")}firstUpdated(){this.__applySpacing()}updated(i){super.updated(i),(i.has("spacing")||i.has("spacingTop")||i.has("spacingBottom")||i.has("spacingLeft")||i.has("spacingRight"))&&this.__applySpacing()}render(){if(this.totalPages===0)return null;const i=this.variant?`${this.variant.toLowerCase()}`:"",t=[],{page:n,totalPages:a}=this,s=window.innerWidth<=768,p=s?1:2,d=this._getPagingHref(Math.max(1,this.page-1)),h=this._getPagingHref(Math.min(this.totalPages,this.page+1)),b=this.pagingHref?this.variant==="icon"?r`<a
|
|
2
2
|
class="paging-action-link"
|
|
3
3
|
href=${d}
|
|
4
4
|
@click=${this._prevPage}
|
|
@@ -99,7 +99,7 @@ import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"..
|
|
|
99
99
|
>${e}</scb-link
|
|
100
100
|
>
|
|
101
101
|
</li>
|
|
102
|
-
`;if(a<=8)for(let e=1;e<=a;e++)t.push(g(e));else if(t.push(g(1)),n<=4&&!s){for(let e=2;e<=5;e++)t.push(g(e));a>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===6&&t.push(g(a))}else if(n<=3&&s){for(let e=2;e<=3;e++)t.push(g(e));a>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===4&&t.push(g(a))}else if(n>=a-(
|
|
102
|
+
`;if(a<=8)for(let e=1;e<=a;e++)t.push(g(e));else if(t.push(g(1)),n<=4&&!s){for(let e=2;e<=5;e++)t.push(g(e));a>6?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===6&&t.push(g(a))}else if(n<=3&&s){for(let e=2;e<=3;e++)t.push(g(e));a>4?(t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))):a===4&&t.push(g(a))}else if(n>=a-(p+1)){t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=a-p*2;e<=a;e++)e>1&&t.push(g(e))}else{t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`);for(let e=n-p;e<=n+p;e++)e>1&&e<a&&t.push(g(e));t.push(r`<li><span class="ellipsis" aria-hidden="true">…</span></li>`),t.push(g(a))}return s?r`
|
|
103
103
|
<nav aria-label="${this.paginationAriaLabel}" class="pagination ${i}">
|
|
104
104
|
<div class="pagination-row">
|
|
105
105
|
<div class="prev">
|
|
@@ -309,4 +309,4 @@ import{a as m,n as p,i as v,x as r,t as y}from"../../vendor/vendor.js";import"..
|
|
|
309
309
|
margin-top: 8px;
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
`];l([
|
|
312
|
+
`];l([c({type:String})],o.prototype,"variant",2);l([c({type:Number})],o.prototype,"page",2);l([c({type:Number,attribute:"total-pages"})],o.prototype,"totalPages",2);l([c({type:String,attribute:"paging-href"})],o.prototype,"pagingHref",2);l([c({type:String,attribute:"base-uri"})],o.prototype,"baseUri",2);l([c({type:String,attribute:"pagination-aria-label"})],o.prototype,"paginationAriaLabel",2);l([c({type:String,attribute:"current-aria-label"})],o.prototype,"currentAriaLabel",2);l([c({type:String,attribute:"paging-number-aria-label"})],o.prototype,"pagingNumberAriaLabel",2);l([c({type:Boolean})],o.prototype,"isNarrow",2);l([c({type:String})],o.prototype,"spacing",2);l([c({type:String,attribute:"spacing-top"})],o.prototype,"spacingTop",2);l([c({type:String,attribute:"spacing-bottom"})],o.prototype,"spacingBottom",2);l([c({type:String,attribute:"spacing-left"})],o.prototype,"spacingLeft",2);l([c({type:String,attribute:"spacing-right"})],o.prototype,"spacingRight",2);o=l([y("scb-pagination")],o);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.313",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -390,5 +390,5 @@
|
|
|
390
390
|
},
|
|
391
391
|
"./mvc/*": "./mvc/*"
|
|
392
392
|
},
|
|
393
|
-
"buildHash": "
|
|
393
|
+
"buildHash": "2127631CF9D8760490BDA325B8585C5115083751887E3777611A7FCDD287FB75"
|
|
394
394
|
}
|
|
@@ -12,7 +12,7 @@ var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, l = (i, t, n
|
|
|
12
12
|
};
|
|
13
13
|
let r = class extends v {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(...arguments), this.variant = "icon-text", this.page = 1, this.totalPages = 0, this.pagingHref = "", 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 = () => {
|
|
15
|
+
super(...arguments), this.variant = "icon-text", 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 = () => {
|
|
16
16
|
this.isNarrow = window.innerWidth <= 768;
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -25,8 +25,9 @@ let r = class extends v {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
_getPagingHref(i) {
|
|
28
|
-
if (this.pagingHref)
|
|
29
|
-
|
|
28
|
+
if (!this.pagingHref) return;
|
|
29
|
+
const t = (this.baseUri || "").trim().replace(/^\?/, "").replace(/&+$/, ""), n = window.location.search.replace(/^\?/, "").replace(/&+$/, ""), a = t || n;
|
|
30
|
+
return a ? `${a}&${this.pagingHref}${i}` : `${this.pagingHref}${i}`;
|
|
30
31
|
}
|
|
31
32
|
_handlePageSelection(i, t) {
|
|
32
33
|
!this.pagingHref && t && t.preventDefault(), this.page = i, this._emitPageChange(i);
|
|
@@ -428,6 +429,9 @@ l([
|
|
|
428
429
|
l([
|
|
429
430
|
p({ type: String, attribute: "paging-href" })
|
|
430
431
|
], r.prototype, "pagingHref", 2);
|
|
432
|
+
l([
|
|
433
|
+
p({ type: String, attribute: "base-uri" })
|
|
434
|
+
], r.prototype, "baseUri", 2);
|
|
431
435
|
l([
|
|
432
436
|
p({ type: String, attribute: "pagination-aria-label" })
|
|
433
437
|
], r.prototype, "paginationAriaLabel", 2);
|