@teipublisher/pb-components 1.30.0 → 1.30.4
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/CHANGELOG.md +28 -0
- package/Dockerfile +1 -1
- package/dist/demo/pb-leaflet-map3.html +12 -17
- package/dist/pb-components-bundle.js +112 -106
- package/dist/pb-elements.json +11 -0
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/pb-odd-editor.js +29 -19
- package/i18n/common/de.json +23 -1
- package/i18n/common/en.json +22 -1
- package/package.json +1 -1
- package/pb-elements.json +11 -0
- package/src/pb-geolocation.js +30 -11
- package/src/pb-leaflet-map.js +1 -2
- package/src/pb-odd-model-editor.js +26 -15
- package/src/pb-odd-parameter-editor.js +1 -1
- package/src/pb-select-feature.js +6 -0
- package/src/pb-view-annotate.js +7 -4
package/dist/pb-odd-editor.js
CHANGED
|
@@ -12,7 +12,7 @@ import{h as e,o as t,F as o,D as i,E as s,H as r,l as a,f as n,t as d,g as l}fro
|
|
|
12
12
|
* subject to an additional IP rights grant found at
|
|
13
13
|
* http://polymer.github.io/PATENTS.txt
|
|
14
14
|
*/
|
|
15
|
-
const S=(e,t)=>{const o=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNode,s=o.insertBefore(g(),i);o.insertBefore(g(),i);const r=new b(e.options);return r.insertAfterNode(s),r},C=(e,t)=>(e.setValue(t),e.commit(),e),k=(e,t,o)=>{const i=e.startNode.parentNode,s=o?o.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&v(i,t.startNode,r,s)},A=e=>{f(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},M=(e,t,o)=>{const i=new Map;for(let s=t;s<=o;s++)i.set(e[s],s);return i},R=new WeakMap,I=new WeakMap,B=u((e,t,o)=>{let i;return void 0===o?o=t:void 0!==t&&(i=t),t=>{if(!(t instanceof b))throw new Error("repeat can only be used in text bindings");const s=R.get(t)||[],r=I.get(t)||[],a=[],n=[],d=[];let l,c,p=0;for(const t of e)d[p]=i?i(t,p):p,n[p]=o(t,p),p++;let h=0,m=s.length-1,u=0,g=n.length-1;for(;h<=m&&u<=g;)if(null===s[h])h++;else if(null===s[m])m--;else if(r[h]===d[u])a[u]=C(s[h],n[u]),h++,u++;else if(r[m]===d[g])a[g]=C(s[m],n[g]),m--,g--;else if(r[h]===d[g])a[g]=C(s[h],n[g]),k(t,s[h],a[g+1]),h++,g--;else if(r[m]===d[u])a[u]=C(s[m],n[u]),k(t,s[m],s[h]),m--,u++;else if(void 0===l&&(l=M(d,u,g),c=M(r,h,m)),l.has(r[h]))if(l.has(r[m])){const e=c.get(d[u]),o=void 0!==e?s[e]:null;if(null===o){const e=S(t,s[h]);C(e,n[u]),a[u]=e}else a[u]=C(o,n[u]),k(t,o,s[h]),s[e]=null;u++}else A(s[m]),m--;else A(s[h]),h++;for(;u<=g;){const e=S(t,a[g+1]);C(e,n[u]),a[u++]=e}for(;h<=m;){const e=s[h++];null!==e&&A(e)}R.set(t,a),I.set(t,d)}}),P=new WeakMap,
|
|
15
|
+
const S=(e,t)=>{const o=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNode,s=o.insertBefore(g(),i);o.insertBefore(g(),i);const r=new b(e.options);return r.insertAfterNode(s),r},C=(e,t)=>(e.setValue(t),e.commit(),e),k=(e,t,o)=>{const i=e.startNode.parentNode,s=o?o.startNode:e.endNode,r=t.endNode.nextSibling;r!==s&&v(i,t.startNode,r,s)},A=e=>{f(e.startNode.parentNode,e.startNode,e.endNode.nextSibling)},M=(e,t,o)=>{const i=new Map;for(let s=t;s<=o;s++)i.set(e[s],s);return i},R=new WeakMap,I=new WeakMap,B=u((e,t,o)=>{let i;return void 0===o?o=t:void 0!==t&&(i=t),t=>{if(!(t instanceof b))throw new Error("repeat can only be used in text bindings");const s=R.get(t)||[],r=I.get(t)||[],a=[],n=[],d=[];let l,c,p=0;for(const t of e)d[p]=i?i(t,p):p,n[p]=o(t,p),p++;let h=0,m=s.length-1,u=0,g=n.length-1;for(;h<=m&&u<=g;)if(null===s[h])h++;else if(null===s[m])m--;else if(r[h]===d[u])a[u]=C(s[h],n[u]),h++,u++;else if(r[m]===d[g])a[g]=C(s[m],n[g]),m--,g--;else if(r[h]===d[g])a[g]=C(s[h],n[g]),k(t,s[h],a[g+1]),h++,g--;else if(r[m]===d[u])a[u]=C(s[m],n[u]),k(t,s[m],s[h]),m--,u++;else if(void 0===l&&(l=M(d,u,g),c=M(r,h,m)),l.has(r[h]))if(l.has(r[m])){const e=c.get(d[u]),o=void 0!==e?s[e]:null;if(null===o){const e=S(t,s[h]);C(e,n[u]),a[u]=e}else a[u]=C(o,n[u]),k(t,o,s[h]),s[e]=null;u++}else A(s[m]),m--;else A(s[h]),h++;for(;u<=g;){const e=S(t,a[g+1]);C(e,n[u]),a[u++]=e}for(;h<=m;){const e=s[h++];null!==e&&A(e)}R.set(t,a),I.set(t,d)}}),P=new WeakMap,z=u(e=>t=>{const o=P.get(t);if(void 0===e&&t instanceof w){if(void 0!==o||!P.has(t)){const e=t.committer.name;t.committer.element.removeAttribute(e)}}else e!==o&&t.setValue(e);P.set(t,e)}),T=e`<dom-module id="lumo-tab" theme-for="vaadin-tab">
|
|
16
16
|
<template>
|
|
17
17
|
<style>
|
|
18
18
|
:host {
|
|
@@ -234,7 +234,7 @@ const S=(e,t)=>{const o=e.startNode.parentNode,i=void 0===t?e.endNode:t.startNod
|
|
|
234
234
|
}
|
|
235
235
|
</style>
|
|
236
236
|
</template>
|
|
237
|
-
</dom-module>`;document.head.appendChild(
|
|
237
|
+
</dom-module>`;document.head.appendChild(T.content);
|
|
238
238
|
/**
|
|
239
239
|
@license
|
|
240
240
|
Copyright (c) 2017 Vaadin Ltd.
|
|
@@ -645,7 +645,7 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
645
645
|
code="${this.value}"
|
|
646
646
|
linter="${this.endpoint}/${$(this.apiVersion,"1.0.0")?"modules/editor.xql":"api/lint"}"
|
|
647
647
|
apiVersion="${this.apiVersion}"></pb-code-editor>
|
|
648
|
-
<paper-checkbox id="set" ?checked="${this.setParam}" @change="${this._handleCodeChange}"
|
|
648
|
+
<paper-checkbox id="set" ?checked="${this.setParam}" @change="${this._handleCodeChange}">${d("odd.editor.model.set-param")}</paper-checkbox>
|
|
649
649
|
<paper-icon-button @click="${this._delete}" icon="delete" title="delete this parameter"></paper-icon-button>
|
|
650
650
|
</div>
|
|
651
651
|
|
|
@@ -830,6 +830,16 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
830
830
|
pb-code-editor {
|
|
831
831
|
margin-bottom: 20px;
|
|
832
832
|
}
|
|
833
|
+
|
|
834
|
+
.horizontal {
|
|
835
|
+
display: flex;
|
|
836
|
+
flex-wrap: wrap;
|
|
837
|
+
justify-content: space-between;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
#mode {
|
|
841
|
+
min-width: 18em;
|
|
842
|
+
}
|
|
833
843
|
`}static get properties(){return{behaviour:{type:String},predicate:{type:String,reflect:!0,converter:(e,t)=>"null"===e.toLowerCase()?"":e},type:{type:String,reflect:!0},template:{type:String,reflect:!0,converter:(e,t)=>"null"===e.toLowerCase()?"":e},output:{type:String,reflect:!0,converter:(e,t)=>"null"===e.toLowerCase()?"":e},css:{type:String,converter:(e,t)=>"null"===e.toLowerCase()?"":e},mode:{type:String},model:{type:Object},models:{type:Array},parameters:{type:Array},renditions:{type:Array},desc:{type:String,converter:(e,t)=>"null"===e.toLowerCase()?"":e},sourcerend:{type:String},show:{type:Boolean,reflect:!0},outputs:{type:Array},behaviours:{type:Array},icon:{type:String},open:{type:String},hasCustomBehaviour:{type:Boolean},endpoint:{type:String},apiVersion:{type:String}}}constructor(){super(),this.behaviour="inline",this.predicate="",this.type="",this.template="",this.output="",this.css="",this.mode="",this.model={},this.model.models=[],this.parameters=[],this.renditions=[],this.desc="",this.sourcerend="",this.show=!1,this.outputs=["","web","print","epub","fo","latex","plain"],this.parentModel=[],this.behaviours=["alternate","anchor","block","body","break","cell","cit","document","figure","graphic","heading","inline","link","list","listItem","metadata","note","omit","paragraph","pass-through","row","section","table","text","title","webcomponent"],this.icon="expand-more",this.hasCustomBehaviour=!1}render(){return x`
|
|
834
844
|
<form>
|
|
835
845
|
<header>
|
|
@@ -874,17 +884,22 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
874
884
|
</p>
|
|
875
885
|
</header>
|
|
876
886
|
<iron-collapse id="details" ?opened="${this.show}" class="details">
|
|
877
|
-
<
|
|
878
|
-
<paper-
|
|
879
|
-
|
|
887
|
+
<div class="horizontal">
|
|
888
|
+
<paper-dropdown-menu class="selectOutput" label="Output">
|
|
889
|
+
<paper-listbox id="output" slot="dropdown-content" attr-for-selected="value"
|
|
890
|
+
selected="${this.output}" @iron-select="${this._selectOutput}">
|
|
880
891
|
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
</paper-listbox>
|
|
886
|
-
</paper-dropdown-menu>
|
|
892
|
+
${this.outputs.map(e=>x`
|
|
893
|
+
<paper-item value="${e}">${e}</paper-item>
|
|
894
|
+
`)}
|
|
887
895
|
|
|
896
|
+
</paper-listbox>
|
|
897
|
+
</paper-dropdown-menu>
|
|
898
|
+
<paper-input id="mode" .value="${this.mode}"
|
|
899
|
+
placeholder="${d("odd.editor.model.mode-placeholder")}"
|
|
900
|
+
label="Mode"
|
|
901
|
+
@change="${this._inputMode}"></paper-input>
|
|
902
|
+
</div>
|
|
888
903
|
<paper-input id="desc" .value="${this.desc}" placeholder="${d("odd.editor.model.description-placeholder")}"
|
|
889
904
|
label="Description" @change="${this._inputDesc}"></paper-input>
|
|
890
905
|
|
|
@@ -919,11 +934,6 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
919
934
|
placeholder="${d("odd.editor.model.css-class-placeholder")}"
|
|
920
935
|
label="CSS Class"
|
|
921
936
|
@change="${this._inputCss}"></paper-input>
|
|
922
|
-
|
|
923
|
-
<paper-input id="mode" .value="${this.mode}"
|
|
924
|
-
placeholder="${d("odd.editor.model.mode-placeholder")}"
|
|
925
|
-
label="Mode"
|
|
926
|
-
@change="${this._inputMode}"></paper-input>
|
|
927
937
|
|
|
928
938
|
<pb-code-editor id="template"
|
|
929
939
|
code="${this.template}"
|
|
@@ -1007,7 +1017,7 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
1007
1017
|
</div>
|
|
1008
1018
|
</form>
|
|
1009
1019
|
<pb-message id="dialog"></pb-message>
|
|
1010
|
-
`}firstUpdated(){super.firstUpdated(),this.hasCustomBehaviour=this.behaviours.indexOf(this.behaviour)<0,this.hasCustomBehaviour&&(this.shadowRoot.getElementById("custombehaviour").value=this.behaviour)}updated(e){e.has("show")&&this.show&&this.refreshEditors()}refreshEditors(){if(console.log("refreshEditors"),this.shadowRoot.getElementById("predicate").refresh(),this._isGroupOrSequence())return console.log("asfdfa");this.shadowRoot.getElementById("template").refresh();const e=this.shadowRoot.querySelectorAll("pb-odd-model-editor");for(let t=0;t<e.length;t++)e[t].refreshEditors();const t=this.shadowRoot.querySelectorAll("pb-odd-rendition-editor");for(let e=0;e<t.length;e++)t[e].refreshEditor();const o=this.shadowRoot.querySelectorAll("pb-odd-parameter-editor");for(let e=0;e<o.length;e++)o[e].refreshEditor()}toggle(e){this.show=!this.show,this.toggleButtonIcon();const t=this.model,o=Object.assign({},t,{show:this.show});this.model=o,this.refreshEditors(),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:t,newModel:o}}))}toggleButtonIcon(){this.show?this.icon="expand-less":this.icon="expand-more"}_isModel(){return"model"===this.type}_isGroupOrSequence(){return"model"!==this.type}static _templateMode(e){switch(e){case"latex":return"latex";case"web":default:return"xml"}}_changeSelection(e){if(e.detail.target==this)return;e.preventDefault(),e.stopPropagation(),null!=this.currentSelection&&this.currentSelection.removeAttribute("currentselection");const t=e.detail.target;t.setAttribute("currentselection","true"),this.currentSelection=t}_requestRemoval(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("model-remove"))}_moveDown(e){e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent("model-move-down",{composed:!0,bubbles:!0,detail:{model:this}}))}_moveUp(e){e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent("model-move-up"))}_addNested(e){const t={behaviour:"inline",css:"",desc:"",predicate:"",type:e.detail.item.getAttribute("value"),output:"",sourcerend:!1,models:[],parameters:[],renditions:[],template:"",show:!0},o=this.model,i=Array.from(this.model.models);i.unshift(t),this.model=Object.assign({},o,{models:i});this.shadowRoot.querySelector("#modelType").select(""),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:o,newModel:this.model}}))}_removeModel(e){console.log("_removeModel ",e),e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);this.shadowRoot.getElementById("dialog").confirm(l("odd.editor.model.delete-model-label"),l("odd.editor.model.delete-model-message")).then(()=>{const e=this.model,t=Array.from(this.model.models);t.splice(o,1),this.model=Object.assign({},e,{models:t}),this.models=t,this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:e,newModel:this.model}}))},()=>null)}_moveModelDown(e){console.log("MODEL._moveModelDown ",e),e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);if(o===this.model.models.length)return;const i=this.model,s=Array.from(this.model.models);s.splice(o,1),s.splice(o+1,0,t),this.model=Object.assign({},i,{models:s});const r=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[o+1];this._setCurrentSelection(o+1,r),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:i,newModel:this.model}})),this.requestUpdate()}_moveModelUp(e){e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);if(0===o)return;const i=this.model,s=Array.from(this.model.models);s.splice(o,1),s.splice(o-1,0,t),this.model=Object.assign({},i,{models:s});const r=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[o-1];this._setCurrentSelection(o-1,r),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:i,newModel:this.model}}))}handleModelChanged(e){console.log("handleModelChanged ",e,this),e.stopPropagation();const t=this.model,o=this.model.models.indexOf(e.detail.oldModel),i=Array.from(this.model.models);i.splice(o,1,e.detail.newModel),this.model=Object.assign({},t,{models:i}),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:t,newModel:this.model}}))}setCurrentSelection(e,t){e.preventDefault(),e.stopPropagation(),this._setCurrentSelection(t,e.target)}_setCurrentSelection(e,t){const o=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[e];o&&(o.hasAttribute("currentselection")||(this.dispatchEvent(new CustomEvent("current-changed",{composed:!0,bubbles:!0,detail:{target:t}})),this.requestUpdate()))}_inputDesc(e){this.desc=e.composedPath()[0].value,this._fireModelChanged("desc",this.desc)}_selectOutput(e){this.output=e.composedPath()[0].selected,this._fireModelChanged("output",this.output)}_updatePredicate(e){this.predicate=this.shadowRoot.getElementById("predicate").getSource(),console.log("_updatePredicate ",this.predicate),this._fireModelChanged("predicate",this.predicate)}_selectBehaviour(e){this.behaviour=e.composedPath()[0].selected,this._fireModelChanged("behaviour",this.behaviour)}_inputCss(e){this.css=e.composedPath()[0].value,this._fireModelChanged("css",this.css)}_inputMode(e){this.mode=e.composedPath()[0].value,this._fireModelChanged("mode",this.mode)}_updateTemplate(e){this.template=this.shadowRoot.getElementById("template").getSource(),this._fireModelChanged("template",this.template)}_addParameter(e){this.parameters.push({name:"",value:""}),this._fireModelChanged("parameters",this.parameters)}_updateParam(e,t){this.parameters[t].name=e.detail.name,this.parameters[t].value=e.detail.value,this.parameters[t].set=e.detail.set,this._fireModelChanged("parameters",this.parameters)}_removeParam(e,t){this.parameters.splice(t,1),this._fireModelChanged("parameters",this.parameters)}_addRendition(e){this.renditions.push({scope:"",css:""}),this._fireModelChanged("renditions",this.renditions)}_updateRendition(e,t){this.renditions[t].css=e.detail.css,this.renditions[t].scope=e.detail.scope,this._fireModelChanged("renditions",this.renditions)}_removeRendition(e,t){this.renditions.splice(t,1),this._fireModelChanged("renditions",this.renditions)}_fireModelChanged(e,t){const o=this.model;this.model=Object.assign({},this.model,{[e]:t}),console.log("model changed for %s: %o - %o",e,t,this.model),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:o,newModel:this.model}})),this.requestUpdate()}_copy(e){e.preventDefault(),e.stopPropagation(),console.log("odd-model.copy ",e),console.log("odd-model.copy data",this.model),this.dispatchEvent(new CustomEvent("odd-copy",{composed:!0,bubbles:!0,detail:{model:this.model}}))}_paste(e){console.log("model _paste ",e),this.dispatchEvent(new CustomEvent("odd-paste",{composed:!0,bubbles:!0,detail:{target:this}}))}_handleCustomBehaviour(e){this.behaviour=e.composedPath()[0].value,this._fireModelChanged("behaviour",this.behaviour),""===this.behaviour?(this.behaviour="inline",this.hasCustomBehaviour=!1):this.hasCustomBehaviour=!0,this.requestUpdate()}}customElements.define("pb-odd-model-editor",F);class H extends y{static get styles(){return _`
|
|
1020
|
+
`}firstUpdated(){super.firstUpdated(),this.hasCustomBehaviour=this.behaviours.indexOf(this.behaviour)<0,this.hasCustomBehaviour&&(this.shadowRoot.getElementById("custombehaviour").value=this.behaviour)}updated(e){e.has("show")&&this.show&&this.refreshEditors()}refreshEditors(){if(console.log("refreshEditors"),this.shadowRoot.getElementById("predicate").refresh(),this._isGroupOrSequence())return console.log("asfdfa");this.shadowRoot.getElementById("template").refresh();const e=this.shadowRoot.querySelectorAll("pb-odd-model-editor");for(let t=0;t<e.length;t++)e[t].refreshEditors();const t=this.shadowRoot.querySelectorAll("pb-odd-rendition-editor");for(let e=0;e<t.length;e++)t[e].refreshEditor();const o=this.shadowRoot.querySelectorAll("pb-odd-parameter-editor");for(let e=0;e<o.length;e++)o[e].refreshEditor()}toggle(e){this.show=!this.show,this.toggleButtonIcon();const t=this.model,o=Object.assign({},t,{show:this.show});this.model=o,this.refreshEditors(),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:t,newModel:o}}))}toggleButtonIcon(){this.show?this.icon="expand-less":this.icon="expand-more"}_isModel(){return"model"===this.type}_isGroupOrSequence(){return"model"!==this.type}static _templateMode(e){switch(e){case"latex":return"latex";case"web":default:return"xml"}}_changeSelection(e){if(e.detail.target==this)return;e.preventDefault(),e.stopPropagation(),null!=this.currentSelection&&this.currentSelection.removeAttribute("currentselection");const t=e.detail.target;t.setAttribute("currentselection","true"),this.currentSelection=t}_requestRemoval(e){e.preventDefault(),this.dispatchEvent(new CustomEvent("model-remove"))}_moveDown(e){e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent("model-move-down",{composed:!0,bubbles:!0,detail:{model:this}}))}_moveUp(e){e.preventDefault(),e.stopPropagation(),this.dispatchEvent(new CustomEvent("model-move-up"))}_addNested(e){const t={behaviour:"inline",css:"",desc:"",predicate:"",type:e.detail.item.getAttribute("value"),output:"",sourcerend:!1,models:[],mode:"",parameters:[],renditions:[],template:"",show:!0},o=this.model,i=Array.from(this.model.models);i.unshift(t),this.model=Object.assign({},o,{models:i});this.shadowRoot.querySelector("#modelType").select(""),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:o,newModel:this.model}}))}_removeModel(e){console.log("_removeModel ",e),e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);this.shadowRoot.getElementById("dialog").confirm(l("odd.editor.model.delete-model-label"),l("odd.editor.model.delete-model-message")).then(()=>{const e=this.model,t=Array.from(this.model.models);t.splice(o,1),this.model=Object.assign({},e,{models:t}),this.models=t,this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:e,newModel:this.model}}))},()=>null)}_moveModelDown(e){console.log("MODEL._moveModelDown ",e),e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);if(o===this.model.models.length)return;const i=this.model,s=Array.from(this.model.models);s.splice(o,1),s.splice(o+1,0,t),this.model=Object.assign({},i,{models:s});const r=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[o+1];this._setCurrentSelection(o+1,r),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:i,newModel:this.model}})),this.requestUpdate()}_moveModelUp(e){e.stopPropagation();const{model:t}=e.target,o=this.model.models.indexOf(t);if(0===o)return;const i=this.model,s=Array.from(this.model.models);s.splice(o,1),s.splice(o-1,0,t),this.model=Object.assign({},i,{models:s});const r=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[o-1];this._setCurrentSelection(o-1,r),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:i,newModel:this.model}}))}handleModelChanged(e){console.log("handleModelChanged ",e,this),e.stopPropagation();const t=this.model,o=this.model.models.indexOf(e.detail.oldModel),i=Array.from(this.model.models);i.splice(o,1,e.detail.newModel),this.model=Object.assign({},t,{models:i}),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:t,newModel:this.model}}))}setCurrentSelection(e,t){e.preventDefault(),e.stopPropagation(),this._setCurrentSelection(t,e.target)}_setCurrentSelection(e,t){const o=this.shadowRoot.querySelectorAll("pb-odd-model-editor")[e];o&&(o.hasAttribute("currentselection")||(this.dispatchEvent(new CustomEvent("current-changed",{composed:!0,bubbles:!0,detail:{target:t}})),this.requestUpdate()))}_inputDesc(e){this.desc=e.composedPath()[0].value,this._fireModelChanged("desc",this.desc)}_selectOutput(e){this.output=e.composedPath()[0].selected,this._fireModelChanged("output",this.output)}_updatePredicate(e){this.predicate=this.shadowRoot.getElementById("predicate").getSource(),console.log("_updatePredicate ",this.predicate),this._fireModelChanged("predicate",this.predicate)}_selectBehaviour(e){this.behaviour=e.composedPath()[0].selected,this._fireModelChanged("behaviour",this.behaviour)}_inputCss(e){this.css=e.composedPath()[0].value,this._fireModelChanged("css",this.css)}_inputMode(e){this.mode=e.composedPath()[0].value,this._fireModelChanged("mode",this.mode)}_updateTemplate(e){this.template=this.shadowRoot.getElementById("template").getSource(),this._fireModelChanged("template",this.template)}_addParameter(e){this.parameters.push({name:"",value:""}),this._fireModelChanged("parameters",this.parameters)}_updateParam(e,t){this.parameters[t].name=e.detail.name,this.parameters[t].value=e.detail.value,this.parameters[t].set=e.detail.set,this._fireModelChanged("parameters",this.parameters)}_removeParam(e,t){this.parameters.splice(t,1),this._fireModelChanged("parameters",this.parameters)}_addRendition(e){this.renditions.push({scope:"",css:""}),this._fireModelChanged("renditions",this.renditions)}_updateRendition(e,t){this.renditions[t].css=e.detail.css,this.renditions[t].scope=e.detail.scope,this._fireModelChanged("renditions",this.renditions)}_removeRendition(e,t){this.renditions.splice(t,1),this._fireModelChanged("renditions",this.renditions)}_fireModelChanged(e,t){const o=this.model;this.model=Object.assign({},this.model,{[e]:t}),console.log("model changed for %s: %o - %o",e,t,this.model),this.dispatchEvent(new CustomEvent("model-changed",{composed:!0,bubbles:!0,detail:{oldModel:o,newModel:this.model}})),this.requestUpdate()}_copy(e){e.preventDefault(),e.stopPropagation(),console.log("odd-model.copy ",e),console.log("odd-model.copy data",this.model),this.dispatchEvent(new CustomEvent("odd-copy",{composed:!0,bubbles:!0,detail:{model:this.model}}))}_paste(e){console.log("model _paste ",e),this.dispatchEvent(new CustomEvent("odd-paste",{composed:!0,bubbles:!0,detail:{target:this}}))}_handleCustomBehaviour(e){this.behaviour=e.composedPath()[0].value,this._fireModelChanged("behaviour",this.behaviour),""===this.behaviour?(this.behaviour="inline",this.hasCustomBehaviour=!1):this.hasCustomBehaviour=!0,this.requestUpdate()}}customElements.define("pb-odd-model-editor",F);class H extends y{static get styles(){return _`
|
|
1011
1021
|
:host {
|
|
1012
1022
|
display: block;
|
|
1013
1023
|
padding: 4px 10px;
|
|
@@ -1325,7 +1335,7 @@ This program is available under Apache License Version 2.0, available at https:/
|
|
|
1325
1335
|
<paper-input id="titleShort" name="short-title" .value="${this.titleShort}" label="${d("odd.editor.title-short")}"
|
|
1326
1336
|
placeholder="[${d("odd.editor.title-short-placeholder")}]"
|
|
1327
1337
|
@change="${e=>this.titleShort=e.composedPath()[0].value}"></paper-input>
|
|
1328
|
-
<paper-input id="description" name="description" .value="${
|
|
1338
|
+
<paper-input id="description" name="description" .value="${z(this.description)}" label="${d("odd.editor.description-label")}"
|
|
1329
1339
|
placeholder="[${d("odd.editor.description-placeholder")}]"
|
|
1330
1340
|
@change="${e=>this.description=e.composedPath()[0].value}"></paper-input>
|
|
1331
1341
|
<paper-input id="source" name="source" ?value="${this.source}" label="${d("odd.editor.source-label")}"
|
package/i18n/common/de.json
CHANGED
|
@@ -162,7 +162,9 @@
|
|
|
162
162
|
"custom-behaviour-placeholder": "[Selbstdefiniertes Behaviour]",
|
|
163
163
|
"template-placeholder": "[Code Vorlage für den Inhalt angeben]",
|
|
164
164
|
"param-name-placeholder": "[Name des Parameters]",
|
|
165
|
-
"empty": "[Leer]"
|
|
165
|
+
"empty": "[Leer]",
|
|
166
|
+
"mode-placeholder": "[Modus setzen für nachfolgende Modelle]",
|
|
167
|
+
"set-param": "setze"
|
|
166
168
|
},
|
|
167
169
|
"css-source": "CSS Datei öffnen"
|
|
168
170
|
}
|
|
@@ -252,5 +254,25 @@
|
|
|
252
254
|
"model": "Wähle ein Modell",
|
|
253
255
|
"denied": "Ungespeicherte Änderungen gefunden: bitte zuerst speichern oder verwerfen."
|
|
254
256
|
}
|
|
257
|
+
},
|
|
258
|
+
"ner": {
|
|
259
|
+
"title": "Trainiere ein Modell zur Entitätenerkennung",
|
|
260
|
+
"not-found": "Dieses Feature benötigt einen laufenden TEI Publisher NER Server, aber der Dienst antwortet nicht.",
|
|
261
|
+
"found": "TEI Publisher NER gefunden. spaCy Version:",
|
|
262
|
+
"name-placeholder": "Name des zu erstellenden Modells",
|
|
263
|
+
"name": "Name",
|
|
264
|
+
"path": "Pfad",
|
|
265
|
+
"path-placeholder": "Relativer Pfad zu einer Sammlung oder Datei",
|
|
266
|
+
"path-info": "Pfad zu einem Dokument oder einer Sammlung eingeben. Diese wird als Eingabe für das Training verwendet. Sollte relativ zum TEI Publisher Datenverzeichnis sein.",
|
|
267
|
+
"lang-info": "Es kann entweder ein neues Modell trainiert oder ein bestehendes Basismodell erweitert werden. Falls kein Basismodell unten ausgewählt wird, ist die Sprache anzugeben.",
|
|
268
|
+
"language-placeholder": "Sprache für die das Modell erstellt wird",
|
|
269
|
+
"language": "Sprache",
|
|
270
|
+
"language-error": "Benötige entweder eine Sprache oder ein Basismodell",
|
|
271
|
+
"model": "Basismodell",
|
|
272
|
+
"model-placeholder": "Zu erweiterndes Basismodell",
|
|
273
|
+
"vectors": "nur die Vektoren aus Basismodell kopieren",
|
|
274
|
+
"output": "Trainingsausgabe",
|
|
275
|
+
"prepare": "Trainingsdaten vorbereiten",
|
|
276
|
+
"start": "Ausführen"
|
|
255
277
|
}
|
|
256
278
|
}
|
package/i18n/common/en.json
CHANGED
|
@@ -163,7 +163,8 @@
|
|
|
163
163
|
"template-placeholder": "[Define code template to apply to content]",
|
|
164
164
|
"param-name-placeholder": "[Param name]",
|
|
165
165
|
"empty": "[Empty]",
|
|
166
|
-
"mode-placeholder": "Processing mode - passed to subsequent models"
|
|
166
|
+
"mode-placeholder": "[Processing mode - passed to subsequent models]",
|
|
167
|
+
"set-param": "set"
|
|
167
168
|
},
|
|
168
169
|
"css-source": "Open CSS file"
|
|
169
170
|
}
|
|
@@ -253,5 +254,25 @@
|
|
|
253
254
|
"model": "Select a model",
|
|
254
255
|
"denied": "Unsaved changes found: please store or discard them first."
|
|
255
256
|
}
|
|
257
|
+
},
|
|
258
|
+
"ner": {
|
|
259
|
+
"title": "Train a Named Entity Recognition Model",
|
|
260
|
+
"not-found": "This feature requires the TEI Publisher NER service to be running! Failed to contact the service.",
|
|
261
|
+
"found": "Found TEI Publisher NER with spaCy version",
|
|
262
|
+
"name-placeholder": "Name of the model to create",
|
|
263
|
+
"name": "Name",
|
|
264
|
+
"path": "Path",
|
|
265
|
+
"path-placeholder": "Relative path to document or collection",
|
|
266
|
+
"path-info": "Enter path to a document or collection to use as training input. Should be relative to TEI Publisher's data root.",
|
|
267
|
+
"lang-info": "You may either train a new model for a language or select an existing model to extend below. If not extending an existing model, you must specify a language. Otherwise leave it empty.",
|
|
268
|
+
"language-placeholder": "Language to create the model for",
|
|
269
|
+
"language": "Language",
|
|
270
|
+
"language-error": "Either a language or a base model are required",
|
|
271
|
+
"model": "Base Model",
|
|
272
|
+
"model-placeholder": "Base model to extend or copy from",
|
|
273
|
+
"vectors": "Only copy vectors from base model",
|
|
274
|
+
"output": "Training Output",
|
|
275
|
+
"prepare": "Preparing training data",
|
|
276
|
+
"start": "Run"
|
|
256
277
|
}
|
|
257
278
|
}
|
package/package.json
CHANGED
package/pb-elements.json
CHANGED
|
@@ -3738,6 +3738,11 @@
|
|
|
3738
3738
|
"type": "string",
|
|
3739
3739
|
"default": "\"mouseover\""
|
|
3740
3740
|
},
|
|
3741
|
+
{
|
|
3742
|
+
"name": "auto",
|
|
3743
|
+
"type": "boolean",
|
|
3744
|
+
"default": "false"
|
|
3745
|
+
},
|
|
3741
3746
|
{
|
|
3742
3747
|
"name": "key",
|
|
3743
3748
|
"description": "The key to which this element is connected.",
|
|
@@ -3819,6 +3824,12 @@
|
|
|
3819
3824
|
"type": "string",
|
|
3820
3825
|
"default": "\"mouseover\""
|
|
3821
3826
|
},
|
|
3827
|
+
{
|
|
3828
|
+
"name": "auto",
|
|
3829
|
+
"attribute": "auto",
|
|
3830
|
+
"type": "boolean",
|
|
3831
|
+
"default": "false"
|
|
3832
|
+
},
|
|
3822
3833
|
{
|
|
3823
3834
|
"name": "key",
|
|
3824
3835
|
"attribute": "key",
|
package/src/pb-geolocation.js
CHANGED
|
@@ -32,6 +32,9 @@ export class PbGeolocation extends PbHighlight {
|
|
|
32
32
|
},
|
|
33
33
|
event: {
|
|
34
34
|
type: String
|
|
35
|
+
},
|
|
36
|
+
auto: {
|
|
37
|
+
type: Boolean
|
|
35
38
|
}
|
|
36
39
|
};
|
|
37
40
|
}
|
|
@@ -39,22 +42,38 @@ export class PbGeolocation extends PbHighlight {
|
|
|
39
42
|
constructor() {
|
|
40
43
|
super();
|
|
41
44
|
this.event = 'mouseover';
|
|
45
|
+
this.auto = false;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
connectedCallback() {
|
|
45
49
|
super.connectedCallback();
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
if (this.event) {
|
|
52
|
+
this.addEventListener(this.event, () =>
|
|
53
|
+
this.emitTo('pb-geolocation', {
|
|
54
|
+
coordinates: {
|
|
55
|
+
latitude: this.latitude,
|
|
56
|
+
longitude: this.longitude
|
|
57
|
+
},
|
|
58
|
+
label: this.label,
|
|
59
|
+
popup: this.popup,
|
|
60
|
+
element: this
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
if (this.auto) {
|
|
65
|
+
this.waitForChannel(() => {
|
|
66
|
+
this.emitTo('pb-geolocation', {
|
|
67
|
+
coordinates: {
|
|
68
|
+
latitude: this.latitude,
|
|
69
|
+
longitude: this.longitude
|
|
70
|
+
},
|
|
71
|
+
label: this.label,
|
|
72
|
+
popup: this.popup,
|
|
73
|
+
element: this
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
58
77
|
}
|
|
59
78
|
|
|
60
79
|
render() {
|
package/src/pb-leaflet-map.js
CHANGED
|
@@ -12,7 +12,6 @@ import './pb-map-layer.js';
|
|
|
12
12
|
* @fires pb-update-map - When received, redraws the map to fit markers passed in with the event
|
|
13
13
|
* @fires pb-update - When received, redraws the map to show markers for all pb-geolocation elements
|
|
14
14
|
* @fires pb-geolocation - When received, focuses the map on the geocoordinates passed in with the event
|
|
15
|
-
|
|
16
15
|
*/
|
|
17
16
|
export class PbLeafletMap extends pbMixin(LitElement) {
|
|
18
17
|
static get properties() {
|
|
@@ -143,7 +142,7 @@ export class PbLeafletMap extends pbMixin(LitElement) {
|
|
|
143
142
|
});
|
|
144
143
|
});
|
|
145
144
|
// this._map.invalidateSize();
|
|
146
|
-
if (locations.length
|
|
145
|
+
if (locations.length >= 1) {
|
|
147
146
|
this._map.fitBounds(bounds);
|
|
148
147
|
} else {
|
|
149
148
|
this._map.fitWorld();
|
|
@@ -214,6 +214,16 @@ export class PbOddModelEditor extends LitElement {
|
|
|
214
214
|
pb-code-editor {
|
|
215
215
|
margin-bottom: 20px;
|
|
216
216
|
}
|
|
217
|
+
|
|
218
|
+
.horizontal {
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-wrap: wrap;
|
|
221
|
+
justify-content: space-between;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#mode {
|
|
225
|
+
min-width: 18em;
|
|
226
|
+
}
|
|
217
227
|
`;
|
|
218
228
|
}
|
|
219
229
|
|
|
@@ -435,18 +445,23 @@ export class PbOddModelEditor extends LitElement {
|
|
|
435
445
|
</p>
|
|
436
446
|
</header>
|
|
437
447
|
<iron-collapse id="details" ?opened="${this.show}" class="details">
|
|
438
|
-
<
|
|
439
|
-
<paper-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
${this.outputs.map((item) =>
|
|
443
|
-
html`
|
|
444
|
-
<paper-item value="${item}">${item}</paper-item>
|
|
445
|
-
`)}
|
|
448
|
+
<div class="horizontal">
|
|
449
|
+
<paper-dropdown-menu class="selectOutput" label="Output">
|
|
450
|
+
<paper-listbox id="output" slot="dropdown-content" attr-for-selected="value"
|
|
451
|
+
selected="${this.output}" @iron-select="${this._selectOutput}">
|
|
446
452
|
|
|
447
|
-
|
|
448
|
-
|
|
453
|
+
${this.outputs.map((item) =>
|
|
454
|
+
html`
|
|
455
|
+
<paper-item value="${item}">${item}</paper-item>
|
|
456
|
+
`)}
|
|
449
457
|
|
|
458
|
+
</paper-listbox>
|
|
459
|
+
</paper-dropdown-menu>
|
|
460
|
+
<paper-input id="mode" .value="${this.mode}"
|
|
461
|
+
placeholder="${translate('odd.editor.model.mode-placeholder')}"
|
|
462
|
+
label="Mode"
|
|
463
|
+
@change="${this._inputMode}"></paper-input>
|
|
464
|
+
</div>
|
|
450
465
|
<paper-input id="desc" .value="${this.desc}" placeholder="${translate('odd.editor.model.description-placeholder')}"
|
|
451
466
|
label="Description" @change="${this._inputDesc}"></paper-input>
|
|
452
467
|
|
|
@@ -483,11 +498,6 @@ export class PbOddModelEditor extends LitElement {
|
|
|
483
498
|
placeholder="${translate('odd.editor.model.css-class-placeholder')}"
|
|
484
499
|
label="CSS Class"
|
|
485
500
|
@change="${this._inputCss}"></paper-input>
|
|
486
|
-
|
|
487
|
-
<paper-input id="mode" .value="${this.mode}"
|
|
488
|
-
placeholder="${translate('odd.editor.model.mode-placeholder')}"
|
|
489
|
-
label="Mode"
|
|
490
|
-
@change="${this._inputMode}"></paper-input>
|
|
491
501
|
|
|
492
502
|
<pb-code-editor id="template"
|
|
493
503
|
code="${this.template}"
|
|
@@ -708,6 +718,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
708
718
|
output: '',
|
|
709
719
|
sourcerend: false,
|
|
710
720
|
models: [],
|
|
721
|
+
mode: '',
|
|
711
722
|
parameters: [],
|
|
712
723
|
renditions: [],
|
|
713
724
|
template: '',
|
|
@@ -57,7 +57,7 @@ export class PbOddParameterEditor extends LitElement {
|
|
|
57
57
|
code="${this.value}"
|
|
58
58
|
linter="${this.endpoint}/${cmpVersion(this.apiVersion, '1.0.0') ? 'modules/editor.xql' : 'api/lint'}"
|
|
59
59
|
apiVersion="${this.apiVersion}"></pb-code-editor>
|
|
60
|
-
<paper-checkbox id="set" ?checked="${this.setParam}" @change="${this._handleCodeChange}"
|
|
60
|
+
<paper-checkbox id="set" ?checked="${this.setParam}" @change="${this._handleCodeChange}">${translate('odd.editor.model.set-param')}</paper-checkbox>
|
|
61
61
|
<paper-icon-button @click="${this._delete}" icon="delete" title="delete this parameter"></paper-icon-button>
|
|
62
62
|
</div>
|
|
63
63
|
|
package/src/pb-select-feature.js
CHANGED
package/src/pb-view-annotate.js
CHANGED
|
@@ -323,7 +323,7 @@ class PbViewAnnotate extends PbView {
|
|
|
323
323
|
|
|
324
324
|
set annotations(annoData) {
|
|
325
325
|
this._ranges = annoData;
|
|
326
|
-
this.updateAnnotations();
|
|
326
|
+
this.updateAnnotations(true);
|
|
327
327
|
this._initAnnotationColors();
|
|
328
328
|
this._annotationStyles();
|
|
329
329
|
}
|
|
@@ -413,7 +413,7 @@ class PbViewAnnotate extends PbView {
|
|
|
413
413
|
}, 300));
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
_updateAnnotation(teiRange, batch = false) {
|
|
416
|
+
_updateAnnotation(teiRange, silent = false, batch = false) {
|
|
417
417
|
const view = this.shadowRoot.getElementById('view');
|
|
418
418
|
const context = Array.from(view.querySelectorAll(`[data-tei="${teiRange.context}"]`)).filter(
|
|
419
419
|
node => node.closest('pb-popover') === null && node.getAttribute('rel') !== 'footnote',
|
|
@@ -467,6 +467,9 @@ class PbViewAnnotate extends PbView {
|
|
|
467
467
|
try {
|
|
468
468
|
range.surroundContents(span);
|
|
469
469
|
} catch (e) {
|
|
470
|
+
if (silent) {
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
470
473
|
throw new Error('An error occurred. The annotation may not be displayed. You should consider saving and reloading the document.');
|
|
471
474
|
}
|
|
472
475
|
this._rangesMap.set(span, teiRange);
|
|
@@ -478,7 +481,7 @@ class PbViewAnnotate extends PbView {
|
|
|
478
481
|
return span;
|
|
479
482
|
}
|
|
480
483
|
|
|
481
|
-
updateAnnotations() {
|
|
484
|
+
updateAnnotations(silent = false) {
|
|
482
485
|
this._ranges.forEach((teiRange) => {
|
|
483
486
|
let span;
|
|
484
487
|
switch (teiRange.type) {
|
|
@@ -495,7 +498,7 @@ class PbViewAnnotate extends PbView {
|
|
|
495
498
|
span.dataset.annotation = JSON.stringify(teiRange.properties);
|
|
496
499
|
break;
|
|
497
500
|
default:
|
|
498
|
-
this._updateAnnotation(teiRange, true);
|
|
501
|
+
this._updateAnnotation(teiRange, silent, true);
|
|
499
502
|
break;
|
|
500
503
|
}
|
|
501
504
|
});
|