@teipublisher/pb-components 3.0.8 → 3.1.0
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/.github/workflows/release.js.yml +9 -1
- package/CHANGELOG.md +20 -0
- package/dist/demo/demos.json +2 -1
- package/dist/demo/pb-table-grid2.html +74 -0
- package/dist/demo/philosophers.json +180 -0
- package/dist/pb-components-bundle.js +73 -73
- package/dist/pb-elements.json +13 -0
- package/dist/pb-odd-editor.js +1 -1
- package/dist/{vaadin-element-mixin-d20fe0e7.js → vaadin-element-mixin-e6a38937.js} +1 -1
- package/package.json +4 -4
- package/pb-elements.json +13 -0
- package/src/pb-page.js +4 -0
- package/src/pb-table-column.js +0 -1
- package/src/pb-table-grid.js +22 -6
- package/src/theming.js +1 -1
package/dist/pb-elements.json
CHANGED
|
@@ -10909,6 +10909,12 @@
|
|
|
10909
10909
|
"type": "boolean",
|
|
10910
10910
|
"default": "false"
|
|
10911
10911
|
},
|
|
10912
|
+
{
|
|
10913
|
+
"name": "pagination-top",
|
|
10914
|
+
"description": "If specified, render the pagination controls above the table instead of below.",
|
|
10915
|
+
"type": "boolean",
|
|
10916
|
+
"default": "false"
|
|
10917
|
+
},
|
|
10912
10918
|
{
|
|
10913
10919
|
"name": "per-page",
|
|
10914
10920
|
"type": "number",
|
|
@@ -10983,6 +10989,13 @@
|
|
|
10983
10989
|
"type": "boolean",
|
|
10984
10990
|
"default": "false"
|
|
10985
10991
|
},
|
|
10992
|
+
{
|
|
10993
|
+
"name": "paginationTop",
|
|
10994
|
+
"attribute": "pagination-top",
|
|
10995
|
+
"description": "If specified, render the pagination controls above the table instead of below.",
|
|
10996
|
+
"type": "boolean",
|
|
10997
|
+
"default": "false"
|
|
10998
|
+
},
|
|
10986
10999
|
{
|
|
10987
11000
|
"name": "perPage",
|
|
10988
11001
|
"attribute": "per-page",
|
package/dist/pb-odd-editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{f as e,N as t,j as o,k as i,l as s,A as a,L as r,c as n,h as l,b as d,w as p,p as c}from"./pb-mixin-886ece32.js";import{E as h,T as u,D as m,p as b}from"./vaadin-element-mixin-
|
|
1
|
+
import{f as e,N as t,j as o,k as i,l as s,A as a,L as r,c as n,h as l,b as d,w as p,p as c}from"./pb-mixin-886ece32.js";import{E as h,T as u,D as m,p as b}from"./vaadin-element-mixin-e6a38937.js";import{h as g,c as v,F as f,k as y,x as w,y as _,P as x}from"./paper-inky-focus-behavior-fa16796b.js";import{a as $}from"./paper-listbox-5f5d1cec.js";import{a as S}from"./paper-checkbox-645e1077.js";import"./paper-icon-button-984162bd.js";import"./jinn-codemirror-b4fb2138.js";import{t as E,g as C}from"./pb-i18n-4cc00bfe.js";const k=(()=>{if("undefined"==typeof self)return!1;if("top"in self&&self!==top)try{top}catch(e){return!1}return"showOpenFilePicker"in self})();k?Promise.resolve().then((function(){return O})):Promise.resolve().then((function(){return T})),k?Promise.resolve().then((function(){return I})):Promise.resolve().then((function(){return z}));const A=k?Promise.resolve().then((function(){return j})):Promise.resolve().then((function(){return L}));async function P(...e){return(await A).default(...e)}const R=async e=>{const t=await e.getFile();return t.handle=e,t};var O={__proto__:null,default:async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((e,o)=>{t[o]={description:e.description||"Files",accept:{}},e.mimeTypes?e.mimeTypes.map(i=>{t[o].accept[i]=e.extensions||[]}):t[o].accept["*/*"]=e.extensions||[]});const o=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),i=await Promise.all(o.map(R));return e[0].multiple?i:i[0]}};function B(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(B=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var o=this.s.return;return void 0===o?Promise.resolve({value:e,done:!0}):t(o.apply(this.s,arguments))},throw:function(e){var o=this.s.return;return void 0===o?Promise.reject(e):t(o.apply(this.s,arguments))}},new B(e)}const M=async(e,t,o=e.name,i)=>{const s=[],a=[];var r,n=!1,l=!1;try{for(var d,p=function(e){var t,o,i,s=2;for("undefined"!=typeof Symbol&&(o=Symbol.asyncIterator,i=Symbol.iterator);s--;){if(o&&null!=(t=e[o]))return t.call(e);if(i&&null!=(t=e[i]))return new B(t.call(e));o="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());n=!(d=await p.next()).done;n=!1){const r=d.value,n=`${o}/${r.name}`;"file"===r.kind?a.push(r.getFile().then(t=>(t.directoryHandle=e,t.handle=r,Object.defineProperty(t,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>n})))):"directory"!==r.kind||!t||i&&i(r)||s.push(M(r,t,n,i))}}catch(e){l=!0,r=e}finally{try{n&&null!=p.return&&await p.return()}finally{if(l)throw r}}return[...(await Promise.all(s)).flat(),...await Promise.all(a)]};var I={__proto__:null,default:async(e={})=>{e.recursive=e.recursive||!1,e.mode=e.mode||"read";const t=await window.showDirectoryPicker({id:e.id,startIn:e.startIn,mode:e.mode});return(await(await t.values()).next()).done?[t]:M(t,e.recursive,void 0,e.skipDirectory)}},j={__proto__:null,default:async(e,t=[{}],o=null,i=!1,s=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const a=[];let r=null;if(e instanceof Blob&&e.type?r=e.type:e.headers&&e.headers.get("content-type")&&(r=e.headers.get("content-type")),t.forEach((e,t)=>{a[t]={description:e.description||"Files",accept:{}},e.mimeTypes?(0===t&&r&&e.mimeTypes.push(r),e.mimeTypes.map(o=>{a[t].accept[o]=e.extensions||[]})):r?a[t].accept[r]=e.extensions||[]:a[t].accept["*/*"]=e.extensions||[]}),o)try{await o.getFile()}catch(e){if(o=null,i)throw e}const n=o||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:a,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!o&&s&&s(n);const l=await n.createWritable();if("stream"in e){const t=e.stream();return await t.pipeTo(l),n}return"body"in e?(await e.body.pipeTo(l),n):(await l.write(await e),await l.close(),n)}},T={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,o)=>{const i=document.createElement("input");i.type="file";const s=[...e.map(e=>e.mimeTypes||[]),...e.map(e=>e.extensions||[])].join();i.multiple=e[0].multiple||!1,i.accept=s||"",i.style.display="none",document.body.append(i);const a=e=>{"function"==typeof r&&r(),t(e)},r=e[0].legacySetup&&e[0].legacySetup(a,()=>r(o),i),n=()=>{window.removeEventListener("focus",n),i.remove()};i.addEventListener("click",()=>{window.addEventListener("focus",n)}),i.addEventListener("change",()=>{window.removeEventListener("focus",n),i.remove(),a(i.multiple?Array.from(i.files):i.files[0])}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},z={__proto__:null,default:async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,o)=>{const i=document.createElement("input");i.type="file",i.webkitdirectory=!0;const s=e=>{"function"==typeof a&&a(),t(e)},a=e[0].legacySetup&&e[0].legacySetup(s,()=>a(o),i);i.addEventListener("change",()=>{let t=Array.from(i.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(t=t.filter(t=>t.webkitRelativePath.split("/").every(t=>!e[0].skipDirectory({name:t,kind:"directory"})))):t=t.filter(e=>2===e.webkitRelativePath.split("/").length),s(t)}),"showPicker"in HTMLInputElement.prototype?i.showPicker():i.click()}))},L={__proto__:null,default:async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const o=document.createElement("a");let i=e;"body"in e&&(i=await async function(e,t){const o=e.getReader(),i=new ReadableStream({start:e=>async function t(){return o.read().then(({done:o,value:i})=>{if(!o)return e.enqueue(i),t();e.close()})}()}),s=new Response(i),a=await s.blob();return o.releaseLock(),new Blob([a],{type:t})}(e.body,e.headers.get("content-type"))),o.download=t.fileName||"Untitled",o.href=URL.createObjectURL(await i);const s=()=>{"function"==typeof a&&a()},a=t.legacySetup&&t.legacySetup(s,()=>a(),o);return o.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(o.href),3e4),s()}),o.click(),null}};
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
|
@@ -180,7 +180,7 @@ n({_template:o`
|
|
|
180
180
|
</div>
|
|
181
181
|
|
|
182
182
|
<slot></slot>
|
|
183
|
-
`,is:"paper-card",properties:{heading:{type:String,value:"",observer:"_headingChanged"},image:{type:String,value:""},alt:{type:String},preloadImage:{type:Boolean,value:!1},fadeImage:{type:Boolean,value:!1},placeholderImage:{type:String,value:null},elevation:{type:Number,value:1,reflectToAttribute:!0},animatedShadow:{type:Boolean,value:!1},animated:{type:Boolean,reflectToAttribute:!0,readOnly:!0,computed:"_computeAnimated(animatedShadow)"}},_isHidden:function(e){return e?"false":"true"},_headingChanged:function(e){var t=this.getAttribute("heading"),n=this.getAttribute("aria-label");"string"==typeof n&&n!==t||this.setAttribute("aria-label",e)},_computeHeadingClass:function(e){return e?" over-image":""},_computeAnimated:function(e){return e}}),function(){if("undefined"!=typeof document&&!("adoptedStyleSheets"in document)){var e="ShadyCSS"in window&&!ShadyCSS.nativeShadow,t=document.implementation.createHTMLDocument(""),n=new WeakMap,o="object"==typeof DOMException?Error:DOMException,i=Object.defineProperty,s=Array.prototype.forEach,a=/@import.+?;?$/gm,r=["addRule","deleteRule","insertRule","removeRule"],l=CSSStyleSheet.prototype;l.replace=function(){return Promise.reject(new o("Can't call replace on non-constructed CSSStyleSheets."))},l.replaceSync=function(){throw new o("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};var c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,h=F.prototype;h.replace=function(e){try{return this.replaceSync(e),Promise.resolve(this)}catch(e){return Promise.reject(e)}},h.replaceSync=function(e){if(B(this),"string"==typeof e){var t=this;c.get(t).textContent=w(e),p.set(t,[]),u.get(t).forEach((function(e){e.isConnected()&&L(t,T(t,e))}))}},i(h,"cssRules",{configurable:!0,enumerable:!0,get:function(){return B(this),c.get(this).sheet.cssRules}}),i(h,"media",{configurable:!0,enumerable:!0,get:function(){return B(this),c.get(this).sheet.media}}),r.forEach((function(e){h[e]=function(){var t=this;B(t);var n=arguments;p.get(t).push({method:e,args:n}),u.get(t).forEach((function(o){if(o.isConnected()){var i=T(t,o).sheet;i[e].apply(i,n)}}));var o=c.get(t).sheet;return o[e].apply(o,n)}})),i(F,Symbol.hasInstance,{configurable:!0,value:z});var m={childList:!0,subtree:!0},g=new WeakMap,f=new WeakMap,y=new WeakMap,v=new WeakMap;if(U.prototype={isConnected:function(){var e=f.get(this);return e instanceof Document?"loading"!==e.readyState:_(e.host)},connect:function(){var e=P(this);v.get(this).observe(e,m),y.get(this).length>0&&M(this),j(e,(function(e){R(e).connect()}))},disconnect:function(){v.get(this).disconnect()},update:function(e){var t=this,n=f.get(t)===document?"Document":"ShadowRoot";if(!Array.isArray(e))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Iterator getter is not callable.");if(!e.every(z))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Failed to convert value to 'CSSStyleSheet'");if(e.some(I))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Can't adopt non-constructed stylesheets");t.sheets=e;var o=y.get(t),i=S(e);k(o,i).forEach((function(e){C(T(e,t)),W(e,t)})),y.set(t,i),t.isConnected()&&i.length>0&&M(t)}},window.CSSStyleSheet=F,D(Document),"ShadowRoot"in window){D(ShadowRoot);var b=Element.prototype,x=b.attachShadow;b.attachShadow=function(e){var t=x.call(this,e);return"closed"===e.mode&&n.set(this,t),t}}var A=R(document);A.isConnected()?A.connect():document.addEventListener("DOMContentLoaded",A.connect.bind(A))}function w(e){var t=e.replace(a,"");return t!==e&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),t.trim()}function _(e){return"isConnected"in e?e.isConnected:document.contains(e)}function S(e){return e.filter((function(t,n){return e.indexOf(t)===n}))}function k(e,t){return e.filter((function(e){return-1===t.indexOf(e)}))}function C(e){e.parentNode.removeChild(e)}function E(e){return e.shadowRoot||n.get(e)}function z(e){return"object"==typeof e&&(h.isPrototypeOf(e)||l.isPrototypeOf(e))}function I(e){return"object"==typeof e&&l.isPrototypeOf(e)}function O(e,t){var n=document.createElement("style");return d.get(e).set(t,n),u.get(e).push(t),n}function T(e,t){return d.get(e).get(t)}function W(e,t){d.get(e).delete(t),u.set(e,u.get(e).filter((function(e){return e!==t})))}function L(e,t){requestAnimationFrame((function(){t.textContent=c.get(e).textContent,p.get(e).forEach((function(e){return t.sheet[e.method].apply(t.sheet,e.args)}))}))}function B(e){if(!c.has(e))throw new TypeError("Illegal invocation")}function F(){var e=this,n=document.createElement("style");t.body.appendChild(n),c.set(e,n),u.set(e,[]),d.set(e,new WeakMap),p.set(e,[])}function R(e){var t=g.get(e);return t||(t=new U(e),g.set(e,t)),t}function D(e){i(e.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return R(this).sheets},set:function(e){R(this).update(e)}})}function j(e,t){for(var n=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,(function(e){return E(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),null,!1),o=void 0;o=n.nextNode();)t(E(o))}function N(e,t){return t instanceof HTMLStyleElement&&y.get(e).some((function(t){return T(t,e)}))}function P(e){var t=f.get(e);return t instanceof Document?t.body:t}function M(e){var t=document.createDocumentFragment(),n=y.get(e),o=v.get(e),i=P(e);o.disconnect(),n.forEach((function(n){t.appendChild(T(n,e)||O(n,e))})),i.insertBefore(t,null),o.observe(i,m),n.forEach((function(t){L(t,T(t,e))}))}function U(t){var n=this;n.sheets=[],f.set(n,t),y.set(n,[]),v.set(n,new MutationObserver((function(t,o){document?t.forEach((function(t){e||s.call(t.addedNodes,(function(e){e instanceof Element&&j(e,(function(e){R(e).connect()}))})),s.call(t.removedNodes,(function(t){t instanceof Element&&(N(n,t)&&M(n),e||j(t,(function(e){R(e).disconnect()})))}))})):o.disconnect()})))}}();const A=new Map;async function w(e){const t=[];for(const n of e){const e=await _(n);e&&t.push(e)}if(t.length>0){return(new CSSStyleSheet).replace(t.join(""))}return null}function _(e){return fetch(e).then(t=>t.ok?t.text():(console.warn("<theming> Component stylesheet not found: %s",e),null)).then(e=>e).catch(t=>(console.error("<theming> Error loading stylesheet %s: %o",e,t),null))}function S(e){const t=k();if(!t)return null;const n=E(e).join("|");if(A.has(n))return A.get(n);const o=new RegExp(`^(${n})\\b`);let i=null;const s=C(t.cssRules,o,[]);return s.length>0&&(i=new CSSStyleSheet,i.replaceSync(s.join(""))),console.log("<theming> caching stylesheet for %s",n),A.set(n,i),i}function k(){const e=document.querySelector("pb-page");if(!e)return null;const t=e.stylesheet;return t||null}function C(e,t,n){for(let o=0;o<e.length;o++){const i=e[o];if(i instanceof CSSStyleRule){if(t.test(i.selectorText)){const e=i.cssText.replace(t,":host($1) ");n.push(e)}}else i instanceof CSSMediaRule?(n.push(`\n@media ${i.conditionText} {\n`),C(i.cssRules,t,n),n.push("\n}\n")):i instanceof CSSFontFaceRule||n.push(i.cssText)}return n}function E(e){const t=[e.localName];return e.id&&t.push("#"+e.id),e.classList.forEach(e=>t.push("."+e)),t}const z=e=>class extends e{connectedCallback(){super.connectedCallback(),h("pb-page-ready",e=>{const t=k();t&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,t])})}};class I extends(z(f(y))){static get properties(){return Object.assign(Object.assign({},super.properties),{},{noAnimation:{type:Boolean,attribute:"no-animation"},opened:{type:Boolean},toggles:{type:Boolean}})}constructor(){super(),this.horizontal=!1,this.noAnimation=!1,this.opened=!1,this.expandIcon="icons:expand-more",this.collapseIcon="icons:expand-less",this.noIcons=!1,this.toggles=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("pb-collapse-open",()=>{this.open()}),this.toggles&&this.subscribeTo("pb-collapse-open",e=>{if(e.detail&&e.detail._source!==this){for(const t of this.querySelectorAll("pb-collapse"))if(t===e.detail._source)return;this.close()}})}updated(e){if(super.updated(e),e.has("opened")){const e=this.shadowRoot.querySelector("details");e&&(e.open=this.opened)}}open(){this.opened||(this.opened=!0,this.emitTo("pb-collapse-open",this))}close(){this.opened&&(this.opened=!1)}toggle(){this.opened=!this.opened,this.opened&&this.emitTo("pb-collapse-open",this.data)}_handleToggle(e){e.preventDefault(),this.toggle()}render(){return m`
|
|
183
|
+
`,is:"paper-card",properties:{heading:{type:String,value:"",observer:"_headingChanged"},image:{type:String,value:""},alt:{type:String},preloadImage:{type:Boolean,value:!1},fadeImage:{type:Boolean,value:!1},placeholderImage:{type:String,value:null},elevation:{type:Number,value:1,reflectToAttribute:!0},animatedShadow:{type:Boolean,value:!1},animated:{type:Boolean,reflectToAttribute:!0,readOnly:!0,computed:"_computeAnimated(animatedShadow)"}},_isHidden:function(e){return e?"false":"true"},_headingChanged:function(e){var t=this.getAttribute("heading"),n=this.getAttribute("aria-label");"string"==typeof n&&n!==t||this.setAttribute("aria-label",e)},_computeHeadingClass:function(e){return e?" over-image":""},_computeAnimated:function(e){return e}}),function(){if("undefined"!=typeof document&&!("adoptedStyleSheets"in document)){var e="ShadyCSS"in window&&!ShadyCSS.nativeShadow,t=document.implementation.createHTMLDocument(""),n=new WeakMap,o="object"==typeof DOMException?Error:DOMException,i=Object.defineProperty,s=Array.prototype.forEach,a=/@import.+?;?$/gm,r=["addRule","deleteRule","insertRule","removeRule"],l=CSSStyleSheet.prototype;l.replace=function(){return Promise.reject(new o("Can't call replace on non-constructed CSSStyleSheets."))},l.replaceSync=function(){throw new o("Failed to execute 'replaceSync' on 'CSSStyleSheet': Can't call replaceSync on non-constructed CSSStyleSheets.")};var c=new WeakMap,u=new WeakMap,d=new WeakMap,p=new WeakMap,h=F.prototype;h.replace=function(e){try{return this.replaceSync(e),Promise.resolve(this)}catch(e){return Promise.reject(e)}},h.replaceSync=function(e){if(B(this),"string"==typeof e){var t=this;c.get(t).textContent=w(e),p.set(t,[]),u.get(t).forEach((function(e){e.isConnected()&&L(t,T(t,e))}))}},i(h,"cssRules",{configurable:!0,enumerable:!0,get:function(){return B(this),c.get(this).sheet.cssRules}}),i(h,"media",{configurable:!0,enumerable:!0,get:function(){return B(this),c.get(this).sheet.media}}),r.forEach((function(e){h[e]=function(){var t=this;B(t);var n=arguments;p.get(t).push({method:e,args:n}),u.get(t).forEach((function(o){if(o.isConnected()){var i=T(t,o).sheet;i[e].apply(i,n)}}));var o=c.get(t).sheet;return o[e].apply(o,n)}})),i(F,Symbol.hasInstance,{configurable:!0,value:z});var m={childList:!0,subtree:!0},g=new WeakMap,f=new WeakMap,y=new WeakMap,v=new WeakMap;if(U.prototype={isConnected:function(){var e=f.get(this);return e instanceof Document?"loading"!==e.readyState:_(e.host)},connect:function(){var e=P(this);v.get(this).observe(e,m),y.get(this).length>0&&M(this),j(e,(function(e){R(e).connect()}))},disconnect:function(){v.get(this).disconnect()},update:function(e){var t=this,n=f.get(t)===document?"Document":"ShadowRoot";if(!Array.isArray(e))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Iterator getter is not callable.");if(!e.every(z))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Failed to convert value to 'CSSStyleSheet'");if(e.some(I))throw new TypeError("Failed to set the 'adoptedStyleSheets' property on "+n+": Can't adopt non-constructed stylesheets");t.sheets=e;var o=y.get(t),i=S(e);k(o,i).forEach((function(e){C(T(e,t)),W(e,t)})),y.set(t,i),t.isConnected()&&i.length>0&&M(t)}},window.CSSStyleSheet=F,D(Document),"ShadowRoot"in window){D(ShadowRoot);var b=Element.prototype,x=b.attachShadow;b.attachShadow=function(e){var t=x.call(this,e);return"closed"===e.mode&&n.set(this,t),t}}var A=R(document);A.isConnected()?A.connect():document.addEventListener("DOMContentLoaded",A.connect.bind(A))}function w(e){var t=e.replace(a,"");return t!==e&&console.warn("@import rules are not allowed here. See https://github.com/WICG/construct-stylesheets/issues/119#issuecomment-588352418"),t.trim()}function _(e){return"isConnected"in e?e.isConnected:document.contains(e)}function S(e){return e.filter((function(t,n){return e.indexOf(t)===n}))}function k(e,t){return e.filter((function(e){return-1===t.indexOf(e)}))}function C(e){e.parentNode.removeChild(e)}function E(e){return e.shadowRoot||n.get(e)}function z(e){return"object"==typeof e&&(h.isPrototypeOf(e)||l.isPrototypeOf(e))}function I(e){return"object"==typeof e&&l.isPrototypeOf(e)}function O(e,t){var n=document.createElement("style");return d.get(e).set(t,n),u.get(e).push(t),n}function T(e,t){return d.get(e).get(t)}function W(e,t){d.get(e).delete(t),u.set(e,u.get(e).filter((function(e){return e!==t})))}function L(e,t){requestAnimationFrame((function(){t.textContent=c.get(e).textContent,p.get(e).forEach((function(e){return t.sheet[e.method].apply(t.sheet,e.args)}))}))}function B(e){if(!c.has(e))throw new TypeError("Illegal invocation")}function F(){var e=this,n=document.createElement("style");t.body.appendChild(n),c.set(e,n),u.set(e,[]),d.set(e,new WeakMap),p.set(e,[])}function R(e){var t=g.get(e);return t||(t=new U(e),g.set(e,t)),t}function D(e){i(e.prototype,"adoptedStyleSheets",{configurable:!0,enumerable:!0,get:function(){return R(this).sheets},set:function(e){R(this).update(e)}})}function j(e,t){for(var n=document.createNodeIterator(e,NodeFilter.SHOW_ELEMENT,(function(e){return E(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),null,!1),o=void 0;o=n.nextNode();)t(E(o))}function N(e,t){return t instanceof HTMLStyleElement&&y.get(e).some((function(t){return T(t,e)}))}function P(e){var t=f.get(e);return t instanceof Document?t.body:t}function M(e){var t=document.createDocumentFragment(),n=y.get(e),o=v.get(e),i=P(e);o.disconnect(),n.forEach((function(n){t.appendChild(T(n,e)||O(n,e))})),i.insertBefore(t,null),o.observe(i,m),n.forEach((function(t){L(t,T(t,e))}))}function U(t){var n=this;n.sheets=[],f.set(n,t),y.set(n,[]),v.set(n,new MutationObserver((function(t,o){document?t.forEach((function(t){e||s.call(t.addedNodes,(function(e){e instanceof Element&&j(e,(function(e){R(e).connect()}))})),s.call(t.removedNodes,(function(t){t instanceof Element&&(N(n,t)&&M(n),e||j(t,(function(e){R(e).disconnect()})))}))})):o.disconnect()})))}}();const A=new Map;async function w(e){const t=[];for(const n of e){const e=await _(n);e&&t.push(e)}if(t.length>0){return(new CSSStyleSheet).replace(t.join(""))}return null}function _(e){return fetch(e,{headers:{accept:"text/css"}}).then(t=>t.ok?t.text():(console.warn("<theming> Component stylesheet not found: %s",e),null)).then(e=>e).catch(t=>(console.error("<theming> Error loading stylesheet %s: %o",e,t),null))}function S(e){const t=k();if(!t)return null;const n=E(e).join("|");if(A.has(n))return A.get(n);const o=new RegExp(`^(${n})\\b`);let i=null;const s=C(t.cssRules,o,[]);return s.length>0&&(i=new CSSStyleSheet,i.replaceSync(s.join(""))),console.log("<theming> caching stylesheet for %s",n),A.set(n,i),i}function k(){const e=document.querySelector("pb-page");if(!e)return null;const t=e.stylesheet;return t||null}function C(e,t,n){for(let o=0;o<e.length;o++){const i=e[o];if(i instanceof CSSStyleRule){if(t.test(i.selectorText)){const e=i.cssText.replace(t,":host($1) ");n.push(e)}}else i instanceof CSSMediaRule?(n.push(`\n@media ${i.conditionText} {\n`),C(i.cssRules,t,n),n.push("\n}\n")):i instanceof CSSFontFaceRule||n.push(i.cssText)}return n}function E(e){const t=[e.localName];return e.id&&t.push("#"+e.id),e.classList.forEach(e=>t.push("."+e)),t}const z=e=>class extends e{connectedCallback(){super.connectedCallback(),h("pb-page-ready",e=>{const t=k();t&&(this.shadowRoot.adoptedStyleSheets=[...this.shadowRoot.adoptedStyleSheets,t])})}};class I extends(z(f(y))){static get properties(){return Object.assign(Object.assign({},super.properties),{},{noAnimation:{type:Boolean,attribute:"no-animation"},opened:{type:Boolean},toggles:{type:Boolean}})}constructor(){super(),this.horizontal=!1,this.noAnimation=!1,this.opened=!1,this.expandIcon="icons:expand-more",this.collapseIcon="icons:expand-less",this.noIcons=!1,this.toggles=!1}connectedCallback(){super.connectedCallback(),this.addEventListener("pb-collapse-open",()=>{this.open()}),this.toggles&&this.subscribeTo("pb-collapse-open",e=>{if(e.detail&&e.detail._source!==this){for(const t of this.querySelectorAll("pb-collapse"))if(t===e.detail._source)return;this.close()}})}updated(e){if(super.updated(e),e.has("opened")){const e=this.shadowRoot.querySelector("details");e&&(e.open=this.opened)}}open(){this.opened||(this.opened=!0,this.emitTo("pb-collapse-open",this))}close(){this.opened&&(this.opened=!1)}toggle(){this.opened=!this.opened,this.opened&&this.emitTo("pb-collapse-open",this.data)}_handleToggle(e){e.preventDefault(),this.toggle()}render(){return m`
|
|
184
184
|
<details ?open="${this.opened}" class="${this.horizontal?"horizontal":""}">
|
|
185
185
|
<summary @click="${this._handleToggle}" class="collapse-trigger">
|
|
186
186
|
<slot id="collapseTrigger" name="collapse-trigger"></slot>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teipublisher/pb-components",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Collection of webcomponents underlying TEI Publisher",
|
|
5
5
|
"repository": "https://github.com/eeditiones/tei-publisher-components.git",
|
|
6
6
|
"main": "index.html",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"@rollup/plugin-json": "^6.1.0",
|
|
108
108
|
"@rollup/plugin-node-resolve": "^7.1.1",
|
|
109
109
|
"@rollup/plugin-replace": "^2.3.3",
|
|
110
|
-
"@semantic-release/changelog": "^
|
|
111
|
-
"@semantic-release/git": "^
|
|
110
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
111
|
+
"@semantic-release/git": "^10.0.1",
|
|
112
112
|
"deepmerge": "^4.2.2",
|
|
113
113
|
"es-dev-server": "^2.1.0",
|
|
114
114
|
"eslint": "^7.10.0",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"rollup-plugin-copy": "^3.3.0",
|
|
123
123
|
"rollup-plugin-modify": "^3.0.0",
|
|
124
124
|
"rollup-plugin-terser": "^5.3.0",
|
|
125
|
-
"semantic-release": "^
|
|
125
|
+
"semantic-release": "^25.0.3",
|
|
126
126
|
"web-component-analyzer": "^2.0.0"
|
|
127
127
|
},
|
|
128
128
|
"eslintConfig": {
|
package/pb-elements.json
CHANGED
|
@@ -10909,6 +10909,12 @@
|
|
|
10909
10909
|
"type": "boolean",
|
|
10910
10910
|
"default": "false"
|
|
10911
10911
|
},
|
|
10912
|
+
{
|
|
10913
|
+
"name": "pagination-top",
|
|
10914
|
+
"description": "If specified, render the pagination controls above the table instead of below.",
|
|
10915
|
+
"type": "boolean",
|
|
10916
|
+
"default": "false"
|
|
10917
|
+
},
|
|
10912
10918
|
{
|
|
10913
10919
|
"name": "per-page",
|
|
10914
10920
|
"type": "number",
|
|
@@ -10983,6 +10989,13 @@
|
|
|
10983
10989
|
"type": "boolean",
|
|
10984
10990
|
"default": "false"
|
|
10985
10991
|
},
|
|
10992
|
+
{
|
|
10993
|
+
"name": "paginationTop",
|
|
10994
|
+
"attribute": "pagination-top",
|
|
10995
|
+
"description": "If specified, render the pagination controls above the table instead of below.",
|
|
10996
|
+
"type": "boolean",
|
|
10997
|
+
"default": "false"
|
|
10998
|
+
},
|
|
10986
10999
|
{
|
|
10987
11000
|
"name": "perPage",
|
|
10988
11001
|
"attribute": "per-page",
|
package/src/pb-page.js
CHANGED
|
@@ -394,6 +394,10 @@ export class PbPage extends pbMixin(LitElement) {
|
|
|
394
394
|
this._i18nInstance = i18next.createInstance();
|
|
395
395
|
this._i18nInstance.use(LanguageDetector).use(Backend);
|
|
396
396
|
this._i18nInstance.init(options).then(t => {
|
|
397
|
+
if (!this._i18nInstance) {
|
|
398
|
+
// We got deconstructed already
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
397
401
|
initTranslation(t);
|
|
398
402
|
// initialized and ready to go!
|
|
399
403
|
this._updateI18n(t);
|
package/src/pb-table-column.js
CHANGED
package/src/pb-table-grid.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
import { Grid } from 'gridjs';
|
|
2
|
+
import { Grid, PluginPosition } from 'gridjs';
|
|
3
3
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
4
|
import { resolveURL } from './utils.js';
|
|
5
|
-
import { loadStylesheets,
|
|
5
|
+
import { importStyles, loadStylesheets, themableMixin } from './theming.js';
|
|
6
6
|
import '@polymer/paper-input/paper-input';
|
|
7
7
|
import '@polymer/iron-icons';
|
|
8
8
|
import '@polymer/iron-form';
|
|
9
9
|
import '@polymer/paper-icon-button';
|
|
10
10
|
import './pb-table-column.js';
|
|
11
11
|
import { registry } from './urls.js';
|
|
12
|
+
import { translate } from './pb-i18n.js';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* A table grid based on [gridjs](https://gridjs.io/), which loads its data from a server endpoint
|
|
@@ -39,7 +40,7 @@ import { registry } from './urls.js';
|
|
|
39
40
|
* <pb-table-column label="Died" property="death"></pb-table-column>
|
|
40
41
|
* ```
|
|
41
42
|
*/
|
|
42
|
-
export class PbTableGrid extends pbMixin(LitElement) {
|
|
43
|
+
export class PbTableGrid extends themableMixin(pbMixin(LitElement)) {
|
|
43
44
|
static get properties() {
|
|
44
45
|
return {
|
|
45
46
|
/**
|
|
@@ -78,6 +79,13 @@ export class PbTableGrid extends pbMixin(LitElement) {
|
|
|
78
79
|
search: {
|
|
79
80
|
type: Boolean,
|
|
80
81
|
},
|
|
82
|
+
/**
|
|
83
|
+
* If specified, render the pagination controls above the table instead of below.
|
|
84
|
+
*/
|
|
85
|
+
paginationTop: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
attribute: 'pagination-top',
|
|
88
|
+
},
|
|
81
89
|
_params: {
|
|
82
90
|
type: Object,
|
|
83
91
|
},
|
|
@@ -91,6 +99,7 @@ export class PbTableGrid extends pbMixin(LitElement) {
|
|
|
91
99
|
this._params = {};
|
|
92
100
|
this.resizable = false;
|
|
93
101
|
this.search = false;
|
|
102
|
+
this.paginationTop = false;
|
|
94
103
|
this.perPage = 10;
|
|
95
104
|
this.height = null;
|
|
96
105
|
this.fixedHeader = false;
|
|
@@ -130,11 +139,15 @@ export class PbTableGrid extends pbMixin(LitElement) {
|
|
|
130
139
|
}
|
|
131
140
|
|
|
132
141
|
const gridjsTheme = await loadStylesheets([`${resolveURL(this.cssPath)}/mermaid.min.css`]);
|
|
133
|
-
const theme = importStyles(this);
|
|
134
142
|
const sheets = [...this.shadowRoot.adoptedStyleSheets, gridjsTheme];
|
|
143
|
+
// Manually import styles for backwards compatibility with pb-components < 3 importStyles
|
|
144
|
+
// extracts any relevant styling rules to this element and wraps them in `:host`. Which you can
|
|
145
|
+
// (and should) do manually anyway
|
|
146
|
+
const theme = importStyles(this);
|
|
135
147
|
if (theme) {
|
|
136
148
|
sheets.push(theme);
|
|
137
149
|
}
|
|
150
|
+
|
|
138
151
|
this.shadowRoot.adoptedStyleSheets = sheets;
|
|
139
152
|
}
|
|
140
153
|
|
|
@@ -206,6 +219,9 @@ export class PbTableGrid extends pbMixin(LitElement) {
|
|
|
206
219
|
};
|
|
207
220
|
|
|
208
221
|
this.grid = new Grid(config);
|
|
222
|
+
if (this.paginationTop) {
|
|
223
|
+
this.grid.plugin.get('pagination').position = PluginPosition.Header;
|
|
224
|
+
}
|
|
209
225
|
this.grid.on('load', () => {
|
|
210
226
|
this.emitTo('pb-results-received', {
|
|
211
227
|
params: this._params,
|
|
@@ -240,9 +256,9 @@ export class PbTableGrid extends pbMixin(LitElement) {
|
|
|
240
256
|
<paper-input
|
|
241
257
|
id="search"
|
|
242
258
|
name="search"
|
|
243
|
-
label="
|
|
259
|
+
label="${translate('search.search')}"
|
|
244
260
|
value="${this._params.search || ''}"
|
|
245
|
-
@keyup="${e => (e.keyCode
|
|
261
|
+
@keyup="${e => (e.keyCode === 13 ? this._submit() : null)}"
|
|
246
262
|
>
|
|
247
263
|
<paper-icon-button
|
|
248
264
|
icon="search"
|
package/src/theming.js
CHANGED