@teipublisher/pb-components 1.44.2 → 2.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/CHANGELOG.md +76 -0
- package/dist/demo/demos.json +6 -1
- package/dist/demo/pb-browse-docs.html +2 -1
- package/dist/demo/pb-combo-box.html +1 -1
- package/dist/demo/pb-document.html +2 -2
- package/dist/demo/pb-image-strip-standalone.html +94 -0
- package/dist/demo/pb-image-strip-view.html +92 -0
- package/dist/demo/pb-load.html +2 -2
- package/dist/demo/pb-select-feature.html +1 -1
- package/dist/demo/pb-select-feature2.html +10 -3
- package/dist/demo/pb-select-feature3.html +1 -1
- package/dist/demo/pb-select-odd.html +1 -1
- package/dist/demo/pb-table-grid.html +1 -1
- package/dist/demo/pb-tabs.html +8 -2
- package/dist/demo/pb-toggle-feature.html +2 -2
- package/dist/demo/pb-toggle-feature2.html +2 -2
- package/dist/demo/pb-toggle-feature3.html +2 -2
- package/dist/demo/pb-view.html +1 -1
- package/dist/demo/pb-view4.html +86 -0
- package/dist/pb-code-editor.js +1 -1
- package/dist/pb-component-docs.js +33 -33
- package/dist/pb-components-bundle.js +271 -261
- package/dist/pb-edit-app.js +6 -6
- package/dist/pb-elements.json +248 -29
- package/dist/{pb-i18n-3963b098.js → pb-i18n-8a90c591.js} +1 -1
- package/dist/pb-leaflet-map.js +1 -1
- package/dist/pb-mixin-8a593923.js +158 -0
- package/dist/pb-odd-editor.js +47 -47
- package/dist/{vaadin-element-mixin-08cf11b5.js → vaadin-element-mixin-672938e3.js} +18 -18
- package/i18n/common/en.json +9 -1
- package/package.json +4 -3
- package/pb-elements.json +248 -29
- package/src/dts-client.js +14 -14
- package/src/dts-select-endpoint.js +5 -5
- package/src/pb-ajax.js +4 -4
- package/src/pb-authority-lookup.js +2 -2
- package/src/pb-autocomplete.js +9 -11
- package/src/pb-blacklab-highlight.js +3 -3
- package/src/pb-browse-docs.js +44 -27
- package/src/pb-browse.js +9 -3
- package/src/pb-combo-box.js +2 -2
- package/src/pb-components.js +1 -0
- package/src/pb-document.js +15 -1
- package/src/pb-download.js +2 -2
- package/src/pb-edit-app.js +2 -2
- package/src/pb-edit-xml.js +2 -2
- package/src/pb-events.js +26 -18
- package/src/pb-facs-link.js +33 -9
- package/src/pb-facsimile.js +34 -31
- package/src/pb-grid.js +55 -53
- package/src/pb-image-strip.js +97 -0
- package/src/pb-lang.js +2 -2
- package/src/pb-link.js +10 -16
- package/src/pb-load.js +35 -25
- package/src/pb-login.js +2 -2
- package/src/pb-manage-odds.js +2 -2
- package/src/pb-markdown.js +2 -2
- package/src/pb-mei.js +2 -2
- package/src/pb-mixin.js +103 -196
- package/src/pb-odd-editor.js +2 -2
- package/src/pb-page.js +30 -21
- package/src/pb-paginate.js +24 -19
- package/src/pb-print-preview.js +2 -2
- package/src/pb-repeat.js +2 -1
- package/src/pb-search.js +34 -8
- package/src/pb-select-feature.js +62 -39
- package/src/pb-select-odd.js +8 -7
- package/src/pb-select-template.js +5 -4
- package/src/pb-select.js +31 -28
- package/src/pb-split-list.js +18 -11
- package/src/pb-table-grid.js +9 -8
- package/src/pb-tabs.js +29 -12
- package/src/pb-toggle-feature.js +51 -55
- package/src/pb-upload.js +10 -3
- package/src/pb-view.js +118 -95
- package/src/theming.js +148 -149
- package/src/urls.js +233 -0
- package/dist/pb-mixin-88125cb2.js +0 -158
package/src/pb-grid.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import { pbMixin } from './pb-mixin.js';
|
|
3
|
+
import { registry } from "./urls.js";
|
|
3
4
|
import './pb-panel.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
@@ -54,6 +55,7 @@ export class PbGrid extends pbMixin(LitElement) {
|
|
|
54
55
|
|
|
55
56
|
constructor() {
|
|
56
57
|
super();
|
|
58
|
+
this.panels = [];
|
|
57
59
|
this.direction = 'ltr';
|
|
58
60
|
this.animated = 'pb-view';
|
|
59
61
|
this.animation = false;
|
|
@@ -63,34 +65,35 @@ export class PbGrid extends pbMixin(LitElement) {
|
|
|
63
65
|
super.connectedCallback();
|
|
64
66
|
|
|
65
67
|
this.subscribeTo('pb-panel', ev => {
|
|
66
|
-
const idx =
|
|
67
|
-
if (idx
|
|
68
|
-
|
|
69
|
-
this.panels[this.direction === 'rtl' ? this.panels.length - idx - 1 : idx] = ev.detail.active;
|
|
70
|
-
|
|
71
|
-
localStorage.setItem('pb-grid.panels', this.panels.join('.'));
|
|
72
|
-
this.setParameter('panels', this.panels.join('.'));
|
|
73
|
-
this.pushHistory('added panel');
|
|
68
|
+
const idx = this._getPanelIndex(ev.detail.panel);
|
|
69
|
+
if (idx < 0) {
|
|
70
|
+
return // panel not found
|
|
74
71
|
}
|
|
72
|
+
console.log('<pb-grid> Updating panel %d to show %s', idx, ev.detail.active);
|
|
73
|
+
this.panels[this.direction === 'rtl' ? this.panels.length - idx - 1 : idx] = ev.detail.active;
|
|
74
|
+
|
|
75
|
+
registry.commit(this, this._getState())
|
|
75
76
|
});
|
|
76
|
-
|
|
77
|
+
|
|
78
|
+
const panelsParam = registry.get('panels');
|
|
77
79
|
if (panelsParam) {
|
|
78
80
|
this.panels = panelsParam.split('.').map(param => parseInt(param));
|
|
79
|
-
localStorage.setItem('pb-grid.panels', this.panels.join('.'));
|
|
80
|
-
} else {
|
|
81
|
-
const panelsStored = localStorage.getItem('pb-grid.panels');
|
|
82
|
-
if (panelsStored) {
|
|
83
|
-
this.panels = panelsStored.split('.').map(param => parseInt(param));
|
|
84
|
-
}
|
|
85
81
|
}
|
|
86
82
|
|
|
83
|
+
registry.subscribe(this, (state) => {
|
|
84
|
+
const newState = state.panels ? state.panels.split('.') : [];
|
|
85
|
+
this.panels = newState;
|
|
86
|
+
this.innerHTML=''; // hard reset of child DOM
|
|
87
|
+
this.panels.forEach(panelNum => this._insertPanel(panelNum));
|
|
88
|
+
this._update();
|
|
89
|
+
});
|
|
87
90
|
this._columns = this.panels.length;
|
|
88
91
|
this.template = this.querySelector('template');
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
firstUpdated() {
|
|
92
95
|
this.panels.forEach(panelNum => this._insertPanel(panelNum));
|
|
93
|
-
|
|
96
|
+
registry.commit(this, this._getState())
|
|
94
97
|
this._animate();
|
|
95
98
|
this._update();
|
|
96
99
|
}
|
|
@@ -132,41 +135,32 @@ export class PbGrid extends pbMixin(LitElement) {
|
|
|
132
135
|
}
|
|
133
136
|
|
|
134
137
|
addPanel(initial) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
initial = 0;
|
|
143
|
-
}
|
|
138
|
+
let value = initial
|
|
139
|
+
if (!initial && !this.panels.length) {
|
|
140
|
+
value = 0
|
|
141
|
+
}
|
|
142
|
+
if (!initial && this.panels.length) {
|
|
143
|
+
const max = this.panels.reduce((result, next) => Math.max(result, next), 0);
|
|
144
|
+
value = max + 1;
|
|
144
145
|
}
|
|
145
|
-
this._columns++;
|
|
146
|
-
this.panels.push(initial);
|
|
147
|
-
|
|
148
|
-
localStorage.setItem('pb-grid.panels', this.panels.join('.'));
|
|
149
|
-
this.setParameter('panels', this.panels.join('.'));
|
|
150
|
-
this.pushHistory('added panel');
|
|
151
146
|
|
|
152
|
-
this.
|
|
147
|
+
this._columns += 1;
|
|
148
|
+
this.panels.push(value);
|
|
153
149
|
|
|
150
|
+
this._insertPanel(value);
|
|
151
|
+
registry.commit(this, this._getState())
|
|
154
152
|
this._update();
|
|
155
|
-
|
|
156
153
|
this.emitTo('pb-refresh', null);
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
removePanel(panel) {
|
|
160
|
-
const idx =
|
|
157
|
+
const idx = this._getPanelIndex(panel);
|
|
161
158
|
console.log('<pb-grid> Removing panel %d', idx);
|
|
162
159
|
this.panels.splice(this.direction === 'rtl' ? this.panels.length - idx - 1 : idx, 1);
|
|
163
160
|
|
|
164
|
-
this.setParameter('panels', this.panels.join('.'));
|
|
165
|
-
localStorage.setItem('pb-grid.panels', this.panels.join('.'));
|
|
166
|
-
this.pushHistory('removed panel');
|
|
167
|
-
|
|
168
161
|
panel.parentNode.removeChild(panel);
|
|
169
|
-
this._columns
|
|
162
|
+
this._columns -= 1;
|
|
163
|
+
registry.commit(this, this._getState() )
|
|
170
164
|
this._update();
|
|
171
165
|
}
|
|
172
166
|
|
|
@@ -182,22 +176,28 @@ export class PbGrid extends pbMixin(LitElement) {
|
|
|
182
176
|
}
|
|
183
177
|
|
|
184
178
|
_update() {
|
|
185
|
-
const widths =
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
195
|
-
widths.push('1fr');
|
|
196
|
-
}
|
|
197
|
-
});
|
|
179
|
+
const widths = Array.from(this.children)
|
|
180
|
+
.filter(child => !(child instanceof HTMLTemplateElement))
|
|
181
|
+
.map(child => {
|
|
182
|
+
const styles = window.getComputedStyle(child);
|
|
183
|
+
const width = styles.getPropertyValue('max-width');
|
|
184
|
+
if (width && width !== 'none') {
|
|
185
|
+
return width;
|
|
186
|
+
}
|
|
187
|
+
return '1fr';
|
|
188
|
+
});
|
|
198
189
|
this.style.setProperty('--pb-computed-column-widths', widths.join(' '));
|
|
199
190
|
}
|
|
200
191
|
|
|
192
|
+
_getPanelIndex(panel) {
|
|
193
|
+
const panels = Array.from(this.querySelectorAll('._grid_panel'));
|
|
194
|
+
return panels.indexOf(panel);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
_getState() {
|
|
198
|
+
return { panels: this.panels.join('.') };
|
|
199
|
+
}
|
|
200
|
+
|
|
201
201
|
render() {
|
|
202
202
|
return html`<slot></slot>`;
|
|
203
203
|
}
|
|
@@ -214,4 +214,6 @@ export class PbGrid extends pbMixin(LitElement) {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
}
|
|
217
|
-
customElements.
|
|
217
|
+
if (!customElements.get('pb-grid')) {
|
|
218
|
+
customElements.define('pb-grid', PbGrid);
|
|
219
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit-element';
|
|
2
|
+
import { pbMixin } from './pb-mixin.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
* @returns {CustomElementConstructor} pb-image-strip
|
|
8
|
+
* @appliesMixin pbMixin
|
|
9
|
+
*/
|
|
10
|
+
export class PbImageStrip extends pbMixin(LitElement) {
|
|
11
|
+
static get properties() {
|
|
12
|
+
return {
|
|
13
|
+
...super.properties,
|
|
14
|
+
/**
|
|
15
|
+
* Array of image
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
items: {
|
|
19
|
+
type: Array
|
|
20
|
+
},
|
|
21
|
+
imageWidth: {
|
|
22
|
+
attribute: 'image-width',
|
|
23
|
+
type: Number
|
|
24
|
+
},
|
|
25
|
+
imageHeight: {
|
|
26
|
+
attribute: 'image-height',
|
|
27
|
+
type: Number
|
|
28
|
+
},
|
|
29
|
+
baseUri: {
|
|
30
|
+
attribute: 'base-uri',
|
|
31
|
+
type: String
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.items = []
|
|
39
|
+
this.urls = new Set()
|
|
40
|
+
this.imageHeight = 80
|
|
41
|
+
this.imageWidth = 64
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
connectedCallback() {
|
|
45
|
+
super.connectedCallback();
|
|
46
|
+
this.subscribeTo('pb-start-update', () => {
|
|
47
|
+
this.items = []
|
|
48
|
+
this.urls = new Set()
|
|
49
|
+
this.requestUpdate(this.items)
|
|
50
|
+
});
|
|
51
|
+
this.subscribeTo('pb-load-facsimile', e => {
|
|
52
|
+
const { element, order } = e.detail
|
|
53
|
+
const url = element.getImage()
|
|
54
|
+
if (this.urls.has(url)) { return }
|
|
55
|
+
|
|
56
|
+
this.urls.add(url)
|
|
57
|
+
const itemOrder = this.items.map(item => item.getOrder())
|
|
58
|
+
const insertAt = itemOrder.reduce((result, next, index) => {
|
|
59
|
+
if (order < next) return result;
|
|
60
|
+
if (order === next) return index;
|
|
61
|
+
return index + 1;
|
|
62
|
+
}, 0)
|
|
63
|
+
|
|
64
|
+
this.items.splice(insertAt, 0, element)
|
|
65
|
+
this.requestUpdate()
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
showIt(element) {
|
|
70
|
+
this.emitTo('pb-show-annotation', { file: element.getImage(), element })
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
renderItem(item) {
|
|
74
|
+
return html`
|
|
75
|
+
<figure class="strip-item" @click="${() => this.showIt(item)}">
|
|
76
|
+
<img height="${this.imageHeight}" width="${this.imageWidth}"
|
|
77
|
+
src="${this.baseUri}${item.getImage()}/full/${this.imageWidth},${this.imageHeight}/0/default.jpg">
|
|
78
|
+
<figcaption>${item.getLabel()}</figcaption>
|
|
79
|
+
</figure>
|
|
80
|
+
`
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
render() {
|
|
84
|
+
return html`${this.items.map(item => this.renderItem(item))}`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
static get styles() {
|
|
88
|
+
return css`
|
|
89
|
+
:host {
|
|
90
|
+
display: block;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (!customElements.get('pb-image-strip')) {
|
|
96
|
+
customElements.define('pb-image-strip', PbImageStrip);
|
|
97
|
+
}
|
package/src/pb-lang.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
|
|
3
3
|
import '@polymer/paper-listbox';
|
|
4
|
-
import { pbMixin } from './pb-mixin.js';
|
|
4
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
5
5
|
import { translate } from "./pb-i18n.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -46,7 +46,7 @@ export class PbLang extends pbMixin(LitElement) {
|
|
|
46
46
|
this.subscribeTo('pb-i18n-update', (ev) => {
|
|
47
47
|
this.selected = ev.detail.language.replace(/^([^-]+).*$/, '$1');
|
|
48
48
|
}, []);
|
|
49
|
-
|
|
49
|
+
waitOnce('pb-i18n-update', (options) => {
|
|
50
50
|
this.selected = options.language.replace(/^([^-]+).*$/, '$1');
|
|
51
51
|
});
|
|
52
52
|
}
|
package/src/pb-link.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit-element';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
3
|
import { pbMixin } from './pb-mixin.js';
|
|
4
|
+
import { registry } from "./urls.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Create an internal link: clicking it will cause connected views to
|
|
@@ -88,37 +89,30 @@ export class PbLink extends pbMixin(LitElement) {
|
|
|
88
89
|
_onClick(ev) {
|
|
89
90
|
ev.preventDefault();
|
|
90
91
|
|
|
91
|
-
const params = {
|
|
92
|
-
|
|
92
|
+
const params = {
|
|
93
|
+
id: null,
|
|
94
|
+
root: null
|
|
93
95
|
};
|
|
94
96
|
if (this.xmlId) {
|
|
95
97
|
params.id = this.xmlId;
|
|
96
|
-
this.history && this.setParameter('id', this.xmlId);
|
|
97
98
|
} else if (this.nodeId) {
|
|
98
|
-
params.
|
|
99
|
-
this.history && this.setParameter('root', this.nodeId);
|
|
99
|
+
params.root = this.nodeId;
|
|
100
100
|
}
|
|
101
101
|
if (this.path) {
|
|
102
102
|
params.path = this.path;
|
|
103
|
-
this.history && this.setPath(this.path);
|
|
104
103
|
}
|
|
105
104
|
if (this.odd) {
|
|
106
105
|
params.odd = this.odd;
|
|
107
|
-
|
|
106
|
+
}
|
|
107
|
+
if (this.hash) {
|
|
108
|
+
params.hash = this.hash;
|
|
108
109
|
}
|
|
109
110
|
if (this.view) {
|
|
110
111
|
params.view = this.view;
|
|
111
|
-
this.history && this.setParameter('view', this.view);
|
|
112
112
|
}
|
|
113
|
-
if (this.
|
|
114
|
-
|
|
115
|
-
if (this.history) {
|
|
116
|
-
this.getUrl().hash = this.hash;
|
|
117
|
-
}
|
|
118
|
-
} else if (this.history) {
|
|
119
|
-
this.getUrl().hash = '';
|
|
113
|
+
if (this.history) {
|
|
114
|
+
registry.commit(this, params);
|
|
120
115
|
}
|
|
121
|
-
this.pushHistory('link click');
|
|
122
116
|
|
|
123
117
|
this.emitTo('pb-refresh', params);
|
|
124
118
|
}
|
package/src/pb-load.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
import { pbMixin } from './pb-mixin.js';
|
|
2
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
3
3
|
import { translate } from "./pb-i18n.js";
|
|
4
4
|
import { typesetMath } from "./pb-formula.js";
|
|
5
|
+
import { registry } from "./urls.js";
|
|
5
6
|
import '@polymer/iron-ajax';
|
|
6
7
|
import '@polymer/paper-dialog';
|
|
7
8
|
import '@polymer/paper-dialog-scrollable';
|
|
@@ -138,30 +139,27 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
138
139
|
connectedCallback() {
|
|
139
140
|
super.connectedCallback();
|
|
140
141
|
this.subscribeTo(this.event, (ev) => {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
waitOnce('pb-page-ready', () => {
|
|
143
|
+
if (this.history) {
|
|
144
|
+
if (ev.detail && ev.detail.params) {
|
|
145
|
+
const start = ev.detail.params.start;
|
|
146
|
+
if (start) {
|
|
147
|
+
registry.commit(this, { start });
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
this.userParams = registry.state;
|
|
151
|
+
registry.subscribe(this, (state) => {
|
|
152
|
+
if (state.start) {
|
|
153
|
+
this.start = state.start;
|
|
154
|
+
this.load();
|
|
155
|
+
}
|
|
147
156
|
});
|
|
157
|
+
registry.replace(this, this.userParams);
|
|
148
158
|
}
|
|
149
|
-
}
|
|
150
|
-
PbLoad.waitOnce('pb-page-ready', () => {
|
|
151
159
|
this.load(ev);
|
|
152
160
|
});
|
|
153
161
|
});
|
|
154
162
|
|
|
155
|
-
if (this.history) {
|
|
156
|
-
window.addEventListener('popstate', (ev) => {
|
|
157
|
-
ev.preventDefault();
|
|
158
|
-
if (ev.state && ev.state.start && ev.state.start !== this.start) {
|
|
159
|
-
this.start = ev.state.start;
|
|
160
|
-
this.load();
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
|
|
165
163
|
this.subscribeTo('pb-toggle', ev => {
|
|
166
164
|
this.toggleFeature(ev);
|
|
167
165
|
});
|
|
@@ -174,20 +172,28 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
174
172
|
}
|
|
175
173
|
}, []);
|
|
176
174
|
|
|
175
|
+
if (this.history) {
|
|
176
|
+
registry.subscribe(this, (state) => {
|
|
177
|
+
this.start = state.start;
|
|
178
|
+
this.userParams = state;
|
|
179
|
+
this.load();
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
|
|
177
183
|
this.signalReady();
|
|
178
184
|
}
|
|
179
185
|
|
|
180
186
|
firstUpdated() {
|
|
181
187
|
if (this.auto) {
|
|
182
|
-
this.start =
|
|
183
|
-
|
|
188
|
+
this.start = registry.state.start || 1;
|
|
189
|
+
waitOnce('pb-page-ready', (data) => {
|
|
184
190
|
if (data && data.language) {
|
|
185
191
|
this.language = data.language;
|
|
186
192
|
}
|
|
187
193
|
this.wait(() => this.load());
|
|
188
194
|
});
|
|
189
195
|
} else {
|
|
190
|
-
|
|
196
|
+
waitOnce('pb-page-ready', (data) => {
|
|
191
197
|
if (data && data.language) {
|
|
192
198
|
this.language = data.language;
|
|
193
199
|
}
|
|
@@ -203,7 +209,7 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
203
209
|
case 'userParams':
|
|
204
210
|
case 'start':
|
|
205
211
|
if (this.auto && this.loader) {
|
|
206
|
-
|
|
212
|
+
waitOnce('pb-page-ready', () => {
|
|
207
213
|
this.wait(() => this.load());
|
|
208
214
|
});
|
|
209
215
|
}
|
|
@@ -246,9 +252,12 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
246
252
|
}
|
|
247
253
|
|
|
248
254
|
toggleFeature(ev) {
|
|
249
|
-
this.userParams =
|
|
255
|
+
this.userParams = registry.getState(this);
|
|
250
256
|
console.log('<pb-load> toggle feature %o', this.userParams);
|
|
251
|
-
if (ev.detail.
|
|
257
|
+
if (ev.detail.refresh) {
|
|
258
|
+
if (this.history) {
|
|
259
|
+
registry.commit(this, this.userParams);
|
|
260
|
+
}
|
|
252
261
|
this.load();
|
|
253
262
|
}
|
|
254
263
|
}
|
|
@@ -410,6 +419,7 @@ export class PbLoad extends pbMixin(LitElement) {
|
|
|
410
419
|
this.emitTo('pb-results-received', {
|
|
411
420
|
"count": total ? parseInt(total, 10) : 0,
|
|
412
421
|
"start": this.start,
|
|
422
|
+
"content": content,
|
|
413
423
|
"params": this.shadowRoot.getElementById('loadContent').params
|
|
414
424
|
});
|
|
415
425
|
}
|
package/src/pb-login.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
import { pbMixin } from './pb-mixin.js';
|
|
2
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
3
3
|
import { translate } from "./pb-i18n.js";
|
|
4
4
|
import '@polymer/iron-ajax';
|
|
5
5
|
import '@polymer/paper-dialog';
|
|
@@ -117,7 +117,7 @@ export class PbLogin extends pbMixin(LitElement) {
|
|
|
117
117
|
this._checkLogin.generateRequest();
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
|
-
|
|
120
|
+
waitOnce('pb-page-ready', (detail) => {
|
|
121
121
|
if (minVersion(detail.apiVersion, '1.0.0')) {
|
|
122
122
|
this._checkLogin.url = `${detail.endpoint}/api/login/`;
|
|
123
123
|
} else {
|
package/src/pb-manage-odds.js
CHANGED
|
@@ -7,7 +7,7 @@ import '@polymer/paper-button';
|
|
|
7
7
|
import '@polymer/paper-icon-button';
|
|
8
8
|
import '@polymer/paper-input/paper-input.js';
|
|
9
9
|
import '@polymer/app-layout/app-toolbar/app-toolbar.js';
|
|
10
|
-
import { pbMixin } from './pb-mixin.js';
|
|
10
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
11
11
|
import { translate } from './pb-i18n.js';
|
|
12
12
|
import './pb-restricted.js';
|
|
13
13
|
import './pb-ajax.js';
|
|
@@ -73,7 +73,7 @@ export class PbManageOdds extends pbMixin(LitElement) {
|
|
|
73
73
|
|
|
74
74
|
this._loader = this.shadowRoot.getElementById('load');
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
waitOnce('pb-page-ready', (options) => {
|
|
77
77
|
if (cmpVersion(options.apiVersion, '1.0.0') < 0) {
|
|
78
78
|
this._loader.url = `${options.endpoint}/modules/lib/components-odd.xql`;
|
|
79
79
|
} else {
|
package/src/pb-markdown.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
|
-
import { pbMixin } from './pb-mixin';
|
|
3
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
4
|
import * as marked from 'marked/lib/marked.js';
|
|
5
5
|
import './pb-code-highlight.js';
|
|
6
6
|
|
|
@@ -71,7 +71,7 @@ export class PbMarkdown extends pbMixin(LitElement) {
|
|
|
71
71
|
|
|
72
72
|
set url(value) {
|
|
73
73
|
this._url = value;
|
|
74
|
-
|
|
74
|
+
waitOnce("pb-page-ready", (options) => {
|
|
75
75
|
this._load(options.endpoint);
|
|
76
76
|
});
|
|
77
77
|
}
|
package/src/pb-mei.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
2
|
import { unsafeHTML } from 'lit-html/directives/unsafe-html.js';
|
|
3
3
|
import "@lrnwebcomponents/es-global-bridge";
|
|
4
|
-
import { pbMixin } from './pb-mixin.js';
|
|
4
|
+
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
5
5
|
import { translate } from './pb-i18n.js';
|
|
6
6
|
import '@polymer/paper-icon-button';
|
|
7
7
|
import '@polymer/paper-checkbox';
|
|
@@ -145,7 +145,7 @@ export class PbMei extends pbMixin(LitElement) {
|
|
|
145
145
|
.then(() => {
|
|
146
146
|
this._verovio = new window.verovio.toolkit();
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
waitOnce('pb-page-ready', () => {
|
|
149
149
|
this.load();
|
|
150
150
|
});
|
|
151
151
|
});
|