@teipublisher/pb-components 2.26.0-next-3.11 → 2.26.0-next-3.13
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/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +3 -3
- package/CHANGELOG.md +38 -0
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/dist/demo/components.css +2 -8
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-progress.html +2 -2
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{paper-icon-button-0fb125c4.js → paper-icon-button-72125e67.js} +1 -1
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +58 -54
- package/dist/pb-components-bundle.js +1937 -1782
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +45 -45
- package/dist/{pb-i18n-0611135a.js → pb-i18n-4cc00bfe.js} +1 -1
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +56 -41
- package/dist/{pb-mixin-b1caa22e.js → pb-mixin-886ece32.js} +1 -1
- package/dist/pb-odd-editor.js +923 -756
- package/dist/pb-tify.js +2 -2
- package/dist/{vaadin-element-mixin-6633322b.js → vaadin-element-mixin-84fb7d82.js} +181 -143
- package/gh-pages.js +5 -3
- package/i18n/common/pl.json +2 -2
- package/lib/openseadragon.min.js +1 -1
- package/package.json +2 -2
- package/pb-elements.json +45 -45
- package/src/assets/components.css +5 -5
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +23 -21
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +47 -42
- package/src/authority/kbga.js +137 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -67
- package/src/authority/registry.js +4 -4
- package/src/docs/pb-component-docs.js +2 -2
- package/src/docs/pb-component-view.js +5 -5
- package/src/docs/pb-components-list.js +2 -2
- package/src/docs/pb-demo-snippet.js +2 -2
- package/src/dts-client.js +299 -297
- package/src/dts-select-endpoint.js +90 -82
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +150 -146
- package/src/pb-authority-lookup.js +183 -146
- package/src/pb-autocomplete.js +292 -280
- package/src/pb-blacklab-highlight.js +264 -259
- package/src/pb-blacklab-results.js +236 -221
- package/src/pb-browse-docs.js +540 -475
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +79 -76
- package/src/pb-code-editor.js +110 -102
- package/src/pb-code-highlight.js +209 -204
- package/src/pb-codepen.js +79 -72
- package/src/pb-collapse.js +212 -207
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-custom-form.js +151 -149
- package/src/pb-dialog.js +96 -60
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +210 -198
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +98 -96
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +411 -413
- package/src/pb-formula.js +151 -153
- package/src/pb-geolocation.js +129 -131
- package/src/pb-grid-action.js +53 -56
- package/src/pb-grid.js +231 -228
- package/src/pb-highlight.js +140 -140
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +101 -104
- package/src/pb-image-strip.js +84 -78
- package/src/pb-lang.js +132 -128
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -426
- package/src/pb-login.js +291 -248
- package/src/pb-manage-odds.js +364 -318
- package/src/pb-map-icon.js +89 -89
- package/src/pb-map-layer.js +85 -85
- package/src/pb-markdown.js +90 -99
- package/src/pb-media-query.js +74 -72
- package/src/pb-mei.js +306 -295
- package/src/pb-message.js +144 -144
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -82
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1053 -955
- package/src/pb-odd-elementspec-editor.js +348 -297
- package/src/pb-odd-model-editor.js +1061 -901
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +431 -421
- package/src/pb-paginate.js +202 -190
- package/src/pb-panel.js +191 -179
- package/src/pb-popover-themes.js +7 -5
- package/src/pb-popover.js +296 -287
- package/src/pb-print-preview.js +127 -127
- package/src/pb-progress.js +51 -51
- package/src/pb-repeat.js +105 -104
- package/src/pb-restricted.js +84 -77
- package/src/pb-search.js +252 -241
- package/src/pb-select-feature.js +127 -120
- package/src/pb-select-odd.js +132 -124
- package/src/pb-select-template.js +89 -78
- package/src/pb-select.js +251 -227
- package/src/pb-split-list.js +179 -174
- package/src/pb-svg.js +80 -79
- package/src/pb-table-column.js +54 -54
- package/src/pb-table-grid.js +221 -203
- package/src/pb-tabs.js +61 -63
- package/src/pb-tify.js +154 -154
- package/src/pb-timeline.js +271 -229
- package/src/pb-toggle-feature.js +182 -175
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +132 -98
- package/src/pb-view.js +1289 -1270
- package/src/pb-zoom.js +75 -59
- package/src/polymer-hack.js +1 -1
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +13 -20
- package/src/settings.js +4 -4
- package/src/theming.js +96 -96
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
package/src/pb-toggle-feature.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { LitElement, html } from 'lit-element';
|
|
2
2
|
import '@polymer/paper-checkbox';
|
|
3
3
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
4
|
-
import { registry } from
|
|
5
|
-
import {themableMixin} from
|
|
4
|
+
import { registry } from './urls.js';
|
|
5
|
+
import { themableMixin } from './theming.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @param {{ selector: any; command: string; state: boolean; }} newConfig
|
|
9
9
|
* @param {any[]} configs
|
|
10
10
|
*/
|
|
11
11
|
export function addSelector(newConfig, configs) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
const idx = configs.findIndex(item => item.selector === newConfig.selector);
|
|
13
|
+
if (idx > -1) {
|
|
14
|
+
configs[idx] = newConfig;
|
|
15
|
+
} else {
|
|
16
|
+
configs.push(newConfig);
|
|
17
|
+
}
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
/**
|
|
@@ -90,193 +90,200 @@ export function addSelector(newConfig, configs) {
|
|
|
90
90
|
* @fires pb-update - When received, sets the features passed from the event
|
|
91
91
|
*/
|
|
92
92
|
export class PbToggleFeature extends themableMixin(pbMixin(LitElement)) {
|
|
93
|
+
static get properties() {
|
|
94
|
+
return {
|
|
95
|
+
...super.properties,
|
|
96
|
+
/**
|
|
97
|
+
* The name of the feature (required). This will correspond to the name of the custom parameter
|
|
98
|
+
* passed to the ODD.
|
|
99
|
+
*/
|
|
100
|
+
name: {
|
|
101
|
+
type: String,
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* (optional) CSS selector: selects the elements to toggle client side (sets or unsets a
|
|
105
|
+
* CSS class `.toggled`). Setting this property will not trigger a reload as everything is
|
|
106
|
+
* handled by javascript.
|
|
107
|
+
*/
|
|
108
|
+
selector: {
|
|
109
|
+
type: String,
|
|
110
|
+
},
|
|
111
|
+
/**
|
|
112
|
+
* In combination with a selector specifies the action to be taken, currently one of
|
|
113
|
+
* `toggle` (default) or `disable`.
|
|
114
|
+
*/
|
|
115
|
+
action: {
|
|
116
|
+
type: String,
|
|
117
|
+
},
|
|
118
|
+
/**
|
|
119
|
+
* Value to set the parameter to when the feature is enabled.
|
|
120
|
+
*/
|
|
121
|
+
on: {
|
|
122
|
+
type: String,
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Value to set the parameter to when the feature is disabled.
|
|
126
|
+
*/
|
|
127
|
+
off: {
|
|
128
|
+
type: String,
|
|
129
|
+
},
|
|
130
|
+
/**
|
|
131
|
+
* The default setting: either 'on' or 'off'
|
|
132
|
+
*/
|
|
133
|
+
default: {
|
|
134
|
+
type: String,
|
|
135
|
+
},
|
|
136
|
+
/**
|
|
137
|
+
* Additional properties to set on the pb-view if toggle is in 'on' state.
|
|
138
|
+
* Possible properties are 'view', 'odd' and 'columnSeparator'.
|
|
139
|
+
*/
|
|
140
|
+
propertiesOn: {
|
|
141
|
+
type: Object,
|
|
142
|
+
attribute: 'properties-on',
|
|
143
|
+
},
|
|
144
|
+
/**
|
|
145
|
+
* Additional properties to set on the pb-view if toggle is in 'off' state.
|
|
146
|
+
* Possible properties are 'view', 'odd' and 'columnSeparator'.
|
|
147
|
+
*/
|
|
148
|
+
propertiesOff: {
|
|
149
|
+
type: Object,
|
|
150
|
+
attribute: 'properties-off',
|
|
151
|
+
},
|
|
152
|
+
checked: {
|
|
153
|
+
type: Boolean,
|
|
154
|
+
},
|
|
155
|
+
/**
|
|
156
|
+
* If set to false (the default), `pb-toggle-feature` will pass its properties to the
|
|
157
|
+
* connected view before this loads content for the first time. If true,
|
|
158
|
+
* `pb-toggle-feature` will initialize its state depending on the setting of the view.
|
|
159
|
+
* This only makes sense for the special properties 'view' and 'odd' though.
|
|
160
|
+
*/
|
|
161
|
+
initFromView: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
attribute: 'init-from-view',
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* If set, toggle the state of elements which reside
|
|
167
|
+
* in the surrounding HTML context below `pb-page`
|
|
168
|
+
* (means: elements which are not inside a `pb-view` or `pb-load`).
|
|
169
|
+
*/
|
|
170
|
+
global: {
|
|
171
|
+
type: Boolean,
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
93
175
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
* (optional) CSS selector: selects the elements to toggle client side (sets or unsets a
|
|
106
|
-
* CSS class `.toggled`). Setting this property will not trigger a reload as everything is
|
|
107
|
-
* handled by javascript.
|
|
108
|
-
*/
|
|
109
|
-
selector: {
|
|
110
|
-
type: String
|
|
111
|
-
},
|
|
112
|
-
/**
|
|
113
|
-
* In combination with a selector specifies the action to be taken, currently one of
|
|
114
|
-
* `toggle` (default) or `disable`.
|
|
115
|
-
*/
|
|
116
|
-
action: {
|
|
117
|
-
type: String
|
|
118
|
-
},
|
|
119
|
-
/**
|
|
120
|
-
* Value to set the parameter to when the feature is enabled.
|
|
121
|
-
*/
|
|
122
|
-
on: {
|
|
123
|
-
type: String
|
|
124
|
-
},
|
|
125
|
-
/**
|
|
126
|
-
* Value to set the parameter to when the feature is disabled.
|
|
127
|
-
*/
|
|
128
|
-
off: {
|
|
129
|
-
type: String
|
|
130
|
-
},
|
|
131
|
-
/**
|
|
132
|
-
* The default setting: either 'on' or 'off'
|
|
133
|
-
*/
|
|
134
|
-
default: {
|
|
135
|
-
type: String
|
|
136
|
-
},
|
|
137
|
-
/**
|
|
138
|
-
* Additional properties to set on the pb-view if toggle is in 'on' state.
|
|
139
|
-
* Possible properties are 'view', 'odd' and 'columnSeparator'.
|
|
140
|
-
*/
|
|
141
|
-
propertiesOn: {
|
|
142
|
-
type: Object,
|
|
143
|
-
attribute: 'properties-on'
|
|
144
|
-
},
|
|
145
|
-
/**
|
|
146
|
-
* Additional properties to set on the pb-view if toggle is in 'off' state.
|
|
147
|
-
* Possible properties are 'view', 'odd' and 'columnSeparator'.
|
|
148
|
-
*/
|
|
149
|
-
propertiesOff: {
|
|
150
|
-
type: Object,
|
|
151
|
-
attribute: 'properties-off'
|
|
152
|
-
},
|
|
153
|
-
checked: {
|
|
154
|
-
type: Boolean
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* If set to false (the default), `pb-toggle-feature` will pass its properties to the
|
|
158
|
-
* connected view before this loads content for the first time. If true,
|
|
159
|
-
* `pb-toggle-feature` will initialize its state depending on the setting of the view.
|
|
160
|
-
* This only makes sense for the special properties 'view' and 'odd' though.
|
|
161
|
-
*/
|
|
162
|
-
initFromView: {
|
|
163
|
-
type: Boolean,
|
|
164
|
-
attribute: 'init-from-view'
|
|
165
|
-
},
|
|
166
|
-
/**
|
|
167
|
-
* If set, toggle the state of elements which reside
|
|
168
|
-
* in the surrounding HTML context below `pb-page`
|
|
169
|
-
* (means: elements which are not inside a `pb-view` or `pb-load`).
|
|
170
|
-
*/
|
|
171
|
-
global: {
|
|
172
|
-
type: Boolean
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
constructor() {
|
|
178
|
-
super();
|
|
179
|
-
this.default = 'on';
|
|
180
|
-
this.on = 'on';
|
|
181
|
-
this.off = 'off';
|
|
182
|
-
this.action = 'toggle';
|
|
183
|
-
this.propertiesOn = {};
|
|
184
|
-
this.propertiesOff = {};
|
|
185
|
-
this.initFromView = false;
|
|
186
|
-
this.global = false;
|
|
187
|
-
}
|
|
176
|
+
constructor() {
|
|
177
|
+
super();
|
|
178
|
+
this.default = 'on';
|
|
179
|
+
this.on = 'on';
|
|
180
|
+
this.off = 'off';
|
|
181
|
+
this.action = 'toggle';
|
|
182
|
+
this.propertiesOn = {};
|
|
183
|
+
this.propertiesOff = {};
|
|
184
|
+
this.initFromView = false;
|
|
185
|
+
this.global = false;
|
|
186
|
+
}
|
|
188
187
|
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
render() {
|
|
189
|
+
return html`
|
|
191
190
|
<input type="checkbox" id="checkbox" @change="${this._changed}" .checked="${this.checked}" .disabled="${this.disabled}"></input>
|
|
192
191
|
<label for="checkbox"><slot></slot></label>
|
|
193
192
|
`;
|
|
194
|
-
|
|
193
|
+
}
|
|
195
194
|
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
connectedCallback() {
|
|
196
|
+
super.connectedCallback();
|
|
198
197
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
198
|
+
registry.subscribe(this, state => {
|
|
199
|
+
const param = state[this.name];
|
|
200
|
+
this._setChecked(param);
|
|
201
|
+
});
|
|
203
202
|
|
|
204
|
-
|
|
205
|
-
|
|
203
|
+
const param = registry.state[this.name];
|
|
204
|
+
this._setChecked(param);
|
|
206
205
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
const newState = {};
|
|
207
|
+
newState[this.name] = this.checked ? this.on : this.off;
|
|
208
|
+
registry.replace(this, newState);
|
|
209
|
+
this._saveState();
|
|
211
210
|
|
|
212
|
-
|
|
211
|
+
this.signalReady();
|
|
213
212
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
213
|
+
waitOnce('pb-page-ready', () => {
|
|
214
|
+
if (this.global) {
|
|
215
|
+
this.dispatchEvent(
|
|
216
|
+
new CustomEvent('pb-global-toggle', {
|
|
217
|
+
detail: {
|
|
218
|
+
selector: this.selector,
|
|
219
|
+
command: this.action,
|
|
220
|
+
state: this.checked,
|
|
221
|
+
},
|
|
222
|
+
bubbles: true,
|
|
223
|
+
composed: true,
|
|
224
|
+
}),
|
|
225
|
+
);
|
|
226
|
+
} else if (this.selector) {
|
|
227
|
+
this.emitTo('pb-toggle', { refresh: false });
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
226
231
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
232
|
+
_setChecked(param) {
|
|
233
|
+
if (typeof param !== 'undefined') {
|
|
234
|
+
this.checked = param === this.on;
|
|
235
|
+
} else {
|
|
236
|
+
this.checked = this.default === this.on;
|
|
233
237
|
}
|
|
238
|
+
}
|
|
234
239
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
240
|
+
attributeChangedCallback(name, oldVal, newVal) {
|
|
241
|
+
super.attributeChangedCallback(name, oldVal, newVal);
|
|
242
|
+
switch (name) {
|
|
243
|
+
case this.on:
|
|
244
|
+
this.propertiesOn[this.name] = newVal;
|
|
245
|
+
break;
|
|
246
|
+
case this.off:
|
|
247
|
+
this.propertiesOff[this.name] = newVal;
|
|
248
|
+
break;
|
|
249
|
+
default:
|
|
250
|
+
break;
|
|
247
251
|
}
|
|
252
|
+
}
|
|
248
253
|
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
_changed() {
|
|
255
|
+
this.checked = this.shadowRoot.getElementById('checkbox').checked;
|
|
251
256
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
257
|
+
this._saveState();
|
|
258
|
+
if (!this.global) {
|
|
259
|
+
this.emitTo('pb-toggle', { refresh: !this.selector });
|
|
260
|
+
} else {
|
|
261
|
+
const state = {};
|
|
262
|
+
state[this.name] = this.checked ? this.on : this.off;
|
|
263
|
+
registry.commit(this, state);
|
|
260
264
|
}
|
|
265
|
+
}
|
|
261
266
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
267
|
+
_saveState() {
|
|
268
|
+
const state = registry.getState(this);
|
|
269
|
+
state[this.name] = this.checked ? this.on : this.off;
|
|
270
|
+
Object.assign(state, this.checked ? this.propertiesOn : this.propertiesOff);
|
|
271
|
+
if (this.selector) {
|
|
272
|
+
const config = {
|
|
273
|
+
selector: this.selector,
|
|
274
|
+
command: this.action,
|
|
275
|
+
state: this.checked,
|
|
276
|
+
};
|
|
277
|
+
if (this.global) {
|
|
278
|
+
this.dispatchEvent(
|
|
279
|
+
new CustomEvent('pb-global-toggle', { detail: config, bubbles: true, composed: true }),
|
|
280
|
+
);
|
|
281
|
+
} else {
|
|
282
|
+
state.selectors = state.selectors || [];
|
|
283
|
+
addSelector(config, state.selectors);
|
|
284
|
+
}
|
|
279
285
|
}
|
|
286
|
+
}
|
|
280
287
|
}
|
|
281
288
|
|
|
282
289
|
customElements.define('pb-toggle-feature', PbToggleFeature);
|