@teipublisher/pb-components 2.26.1-next.3 → 3.0.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/main.yml +3 -3
- package/.github/workflows/node.js.yml +3 -3
- package/.github/workflows/release.js.yml +4 -4
- package/.releaserc.json +2 -2
- package/CHANGELOG.md +262 -11
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- package/css/leaflet/images/layers.png +0 -0
- package/dist/demo/components.css +46 -1
- package/dist/demo/pb-browse-docs2.html +1 -1
- package/dist/demo/pb-dialog.html +3 -5
- package/dist/demo/pb-drawer2.html +1 -1
- package/dist/demo/pb-facsimile.html +2 -2
- package/dist/demo/pb-grid.html +19 -6
- package/dist/demo/pb-leaflet-map.html +1 -1
- package/dist/demo/pb-login.html +0 -2
- package/dist/demo/pb-message.html +1 -2
- package/dist/demo/pb-progress.html +2 -2
- package/dist/demo/pb-repeat.html +1 -3
- package/dist/demo/pb-search.html +7 -4
- package/dist/demo/pb-search3.html +1 -1
- package/dist/demo/pb-search4.html +2 -2
- package/dist/demo/pb-view3.html +1 -1
- package/dist/{iron-form-3b8dcaa7.js → iron-form-dfb3e3b1.js} +95 -95
- package/dist/paper-checkbox-645e1077.js +200 -0
- package/dist/{paper-icon-button-b1d31571.js → paper-icon-button-984162bd.js} +1 -1
- package/dist/{paper-checkbox-515a5284.js → paper-inky-focus-behavior-fa16796b.js} +58 -247
- package/dist/{paper-listbox-a3b7175c.js → paper-listbox-5f5d1cec.js} +152 -162
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +68 -64
- package/dist/pb-components-bundle.js +1983 -2293
- package/dist/pb-edit-app.js +167 -107
- package/dist/pb-elements.json +176 -120
- 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 +1023 -782
- package/dist/pb-tify.js +2 -2
- package/dist/vaadin-element-mixin-beb74ffd.js +545 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/lib/openseadragon.min.js +6 -6
- package/package.json +3 -3
- package/pb-elements.json +176 -120
- 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 +50 -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 +158 -171
- package/src/pb-authority-lookup.js +191 -156
- 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 +211 -151
- package/src/pb-combo-box.js +190 -190
- package/src/pb-components-bundle.js +1 -1
- package/src/pb-components.js +1 -0
- package/src/pb-custom-form.js +173 -153
- package/src/pb-dialog.js +98 -62
- package/src/pb-document.js +89 -90
- package/src/pb-download.js +212 -196
- package/src/pb-drawer.js +145 -148
- package/src/pb-edit-app.js +301 -229
- package/src/pb-edit-xml.js +100 -97
- package/src/pb-events.js +114 -107
- package/src/pb-facs-link.js +104 -102
- package/src/pb-facsimile.js +474 -410
- 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 +142 -57
- package/src/pb-leaflet-map.js +488 -485
- package/src/pb-link.js +126 -124
- package/src/pb-load.js +431 -429
- package/src/pb-login.js +299 -244
- package/src/pb-manage-odds.js +352 -336
- 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 +139 -97
- package/src/pb-mixin.js +269 -264
- package/src/pb-navigation.js +80 -95
- package/src/pb-observable.js +38 -38
- package/src/pb-odd-editor.js +1054 -958
- package/src/pb-odd-elementspec-editor.js +349 -298
- package/src/pb-odd-model-editor.js +1075 -909
- package/src/pb-odd-parameter-editor.js +200 -178
- package/src/pb-odd-rendition-editor.js +136 -124
- package/src/pb-page.js +431 -422
- package/src/pb-paginate.js +228 -179
- package/src/pb-panel.js +198 -182
- package/src/pb-popover-themes.js +15 -8
- 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 +256 -228
- 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 +382 -249
- package/src/pb-toggle-feature.js +195 -187
- package/src/pb-upload.js +184 -174
- package/src/pb-version.js +30 -30
- package/src/pb-view-annotate.js +135 -98
- package/src/pb-view.js +1282 -1270
- package/src/pb-zoom.js +127 -45
- 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 +98 -91
- package/src/urls.js +289 -289
- package/src/utils.js +53 -51
- package/css/pb-styles.css +0 -51
- package/dist/vaadin-element-mixin-fe4a4883.js +0 -527
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -41
package/src/pb-select.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { LitElement, html, css } from 'lit-element';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { translate } from
|
|
2
|
+
import '@polymer/paper-dropdown-menu/paper-dropdown-menu';
|
|
3
|
+
import '@polymer/paper-listbox';
|
|
4
|
+
import '@polymer/paper-item';
|
|
5
|
+
import '@polymer/iron-label/iron-label.js';
|
|
6
|
+
import { translate } from './pb-i18n.js';
|
|
7
7
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Replacement for an HTML select element with additional features:
|
|
12
11
|
*
|
|
@@ -19,256 +18,281 @@ import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
|
19
18
|
* @csspart label - the label shown above a multi-selection box (does not apply to single-selection)
|
|
20
19
|
*/
|
|
21
20
|
export class PbSelect extends pbMixin(LitElement) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
21
|
+
static get properties() {
|
|
22
|
+
return {
|
|
23
|
+
/**
|
|
24
|
+
* Label to display above the select or inside if nothing is selected
|
|
25
|
+
*/
|
|
26
|
+
label: {
|
|
27
|
+
type: String,
|
|
28
|
+
},
|
|
29
|
+
/**
|
|
30
|
+
* Initial value to select. If not set, no item will be selected
|
|
31
|
+
*/
|
|
32
|
+
value: {
|
|
33
|
+
type: String,
|
|
34
|
+
reflect: true,
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* If `multi` is set, specify initial values via this property
|
|
38
|
+
* instead of using `value`
|
|
39
|
+
*/
|
|
40
|
+
values: {
|
|
41
|
+
type: Array,
|
|
42
|
+
reflect: true,
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* name used when submitted inside a form
|
|
46
|
+
*/
|
|
47
|
+
name: {
|
|
48
|
+
type: String,
|
|
49
|
+
},
|
|
50
|
+
/**
|
|
51
|
+
* Optional URL to query for suggestions. If relative, it is interpreted
|
|
52
|
+
* relative to the endpoint defined on a surrounding `pb-page`.
|
|
53
|
+
*/
|
|
54
|
+
source: {
|
|
55
|
+
type: String,
|
|
56
|
+
},
|
|
57
|
+
multi: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
},
|
|
60
|
+
_items: {
|
|
61
|
+
type: Array,
|
|
62
|
+
},
|
|
63
|
+
_selected: {
|
|
64
|
+
type: Array,
|
|
65
|
+
},
|
|
66
|
+
...super.properties,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
70
69
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
70
|
+
constructor() {
|
|
71
|
+
super();
|
|
72
|
+
this.value = null;
|
|
73
|
+
this.values = [];
|
|
74
|
+
this._items = [];
|
|
75
|
+
this._selected = [];
|
|
76
|
+
this._inIronForm = false;
|
|
77
|
+
}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
super.connectedCallback();
|
|
82
81
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
82
|
+
this.subscribeTo('pb-i18n-update', this._refresh.bind(this));
|
|
83
|
+
// in multi-select mode, copy any value set via 'value' to 'values'
|
|
84
|
+
if (this.multi) {
|
|
85
|
+
if (this.values.length === 0 && this.value) {
|
|
86
|
+
this.values = [this.value];
|
|
87
|
+
}
|
|
88
|
+
// delete this.value so it is not picked up by iron-form
|
|
89
|
+
this.value = undefined;
|
|
92
90
|
}
|
|
91
|
+
}
|
|
93
92
|
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
firstUpdated() {
|
|
94
|
+
super.firstUpdated();
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
this._inIronForm = this.closest('iron-form, pb-search,pb-custom-form');
|
|
98
97
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
const inputs = node.querySelectorAll('[name]');
|
|
106
|
-
inputs.forEach((input) => {
|
|
107
|
-
input.addEventListener('change', this._loadRemote.bind(this));
|
|
108
|
-
});
|
|
109
|
-
});
|
|
98
|
+
const slot = this.shadowRoot.querySelector('[name="subform"]');
|
|
99
|
+
if (slot) {
|
|
100
|
+
slot.assignedNodes().forEach(node => {
|
|
101
|
+
if (this.name) {
|
|
102
|
+
node.addEventListener('change', this._loadRemote.bind(this));
|
|
110
103
|
}
|
|
111
|
-
|
|
112
|
-
|
|
104
|
+
const inputs = node.querySelectorAll('[name]');
|
|
105
|
+
inputs.forEach(input => {
|
|
106
|
+
input.addEventListener('change', this._loadRemote.bind(this));
|
|
113
107
|
});
|
|
108
|
+
});
|
|
114
109
|
}
|
|
110
|
+
waitOnce('pb-page-ready', () => {
|
|
111
|
+
this._loadRemote();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
115
114
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
115
|
+
_refresh() {
|
|
116
|
+
const listbox = this.shadowRoot.getElementById('list');
|
|
117
|
+
if (listbox) {
|
|
118
|
+
setTimeout(() => {
|
|
119
|
+
const old = listbox.selected;
|
|
120
|
+
listbox.selected = undefined;
|
|
121
|
+
listbox.selected = old;
|
|
122
|
+
});
|
|
125
123
|
}
|
|
124
|
+
}
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
126
|
+
_clear(selector) {
|
|
127
|
+
const slot = this.shadowRoot.querySelector(selector);
|
|
128
|
+
if (slot) {
|
|
129
|
+
slot.assignedNodes().forEach(node => {
|
|
130
|
+
node.parentNode.removeChild(node);
|
|
131
|
+
});
|
|
134
132
|
}
|
|
133
|
+
}
|
|
135
134
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
_loadRemote() {
|
|
136
|
+
if (!this.source) {
|
|
137
|
+
return; // nothing to do
|
|
138
|
+
}
|
|
140
139
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
let url = this.toAbsoluteURL(this.source);
|
|
141
|
+
url += url.includes('?') ? '&' : '?';
|
|
142
|
+
url += this._getParameters();
|
|
144
143
|
|
|
145
|
-
|
|
144
|
+
console.log('<pb-select> loading items from %s', url);
|
|
146
145
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
146
|
+
fetch(url, {
|
|
147
|
+
method: 'GET',
|
|
148
|
+
mode: 'cors',
|
|
149
|
+
credentials: 'same-origin',
|
|
150
|
+
})
|
|
151
|
+
.then(response => response.json())
|
|
152
|
+
.then(json => {
|
|
153
|
+
this._clear('slot:not([name])');
|
|
154
|
+
const items = json.map(PbSelect.jsonEntry2item);
|
|
155
|
+
console.log('<pb-select> loaded %d items', items.length);
|
|
156
|
+
this._items = items;
|
|
157
|
+
})
|
|
158
|
+
.catch(() => console.error('<pb-select> request to %s failed', url));
|
|
159
|
+
}
|
|
161
160
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
161
|
+
static jsonEntry2item(item) {
|
|
162
|
+
return {
|
|
163
|
+
label: item.text,
|
|
164
|
+
value: item.value,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
return params.join('&');
|
|
168
|
+
_getParameters() {
|
|
169
|
+
const slot = this.shadowRoot.querySelector('[name="subform"]');
|
|
170
|
+
const params = [];
|
|
171
|
+
if (slot) {
|
|
172
|
+
slot.assignedNodes().forEach(node => {
|
|
173
|
+
const inputs = node.querySelectorAll('[name]');
|
|
174
|
+
inputs.forEach(input => {
|
|
175
|
+
params.push(`${input.name}=${encodeURIComponent(input.value)}`);
|
|
176
|
+
});
|
|
177
|
+
});
|
|
181
178
|
}
|
|
179
|
+
return params.join('&');
|
|
180
|
+
}
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
</paper-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
182
|
+
render() {
|
|
183
|
+
if (this.multi) {
|
|
184
|
+
return html`
|
|
185
|
+
<slot name="subform"></slot>
|
|
186
|
+
<iron-label for="list" part="label">${translate(this.label)}</iron-label>
|
|
187
|
+
${this.multi
|
|
188
|
+
? html`<paper-listbox
|
|
189
|
+
id="list"
|
|
190
|
+
slot="dropdown-content"
|
|
191
|
+
class="dropdown-content"
|
|
192
|
+
.selectedValues="${this.values}"
|
|
193
|
+
multi
|
|
194
|
+
attr-for-selected="value"
|
|
195
|
+
@iron-select="${this._changed}"
|
|
196
|
+
@iron-deselect="${this._changed}"
|
|
197
|
+
>
|
|
198
|
+
<slot></slot>
|
|
199
|
+
${this._items.map(
|
|
200
|
+
item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
|
|
201
|
+
)}
|
|
202
|
+
</paper-listbox>`
|
|
203
|
+
: html`<paper-listbox
|
|
204
|
+
id="list"
|
|
205
|
+
slot="dropdown-content"
|
|
206
|
+
class="dropdown-content"
|
|
207
|
+
.selected="${this.value}"
|
|
208
|
+
attr-for-selected="value"
|
|
209
|
+
@iron-select="${this._changed}"
|
|
210
|
+
@iron-deselect="${this._changed}"
|
|
211
|
+
>
|
|
212
|
+
<slot></slot>
|
|
213
|
+
${this._items.map(
|
|
214
|
+
item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
|
|
215
|
+
)}
|
|
216
|
+
</paper-listbox>`}
|
|
217
|
+
<slot name="output"></slot>
|
|
218
|
+
`;
|
|
217
219
|
}
|
|
220
|
+
return html`
|
|
221
|
+
<slot name="subform"></slot>
|
|
222
|
+
<paper-dropdown-menu label="${translate(this.label)}">
|
|
223
|
+
<paper-listbox
|
|
224
|
+
id="list"
|
|
225
|
+
slot="dropdown-content"
|
|
226
|
+
class="dropdown-content"
|
|
227
|
+
.selected="${this.value}"
|
|
228
|
+
attr-for-selected="value"
|
|
229
|
+
@iron-select="${this._changed}"
|
|
230
|
+
>
|
|
231
|
+
<slot></slot>
|
|
232
|
+
${this._items.map(
|
|
233
|
+
item => html`<paper-item value="${item.value}">${item.label}</paper-item>`,
|
|
234
|
+
)}
|
|
235
|
+
</paper-listbox>
|
|
236
|
+
</paper-dropdown-menu>
|
|
237
|
+
<slot name="output"></slot>
|
|
238
|
+
`;
|
|
239
|
+
}
|
|
218
240
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
241
|
+
_changed() {
|
|
242
|
+
const list = this.shadowRoot.getElementById('list');
|
|
243
|
+
const oldSelected = Array.of(this._selected);
|
|
244
|
+
if (this.multi) {
|
|
245
|
+
this._selected = list.selectedValues;
|
|
246
|
+
this.values = this._selected;
|
|
247
|
+
} else {
|
|
248
|
+
this._selected = [list.selected];
|
|
249
|
+
this.value = list.selected;
|
|
250
|
+
}
|
|
229
251
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
252
|
+
// check if selected items really changed
|
|
253
|
+
if (
|
|
254
|
+
this._selected.length === oldSelected.length &&
|
|
255
|
+
this._selected.every((val, index) => val === oldSelected[index])
|
|
256
|
+
) {
|
|
257
|
+
return;
|
|
258
|
+
}
|
|
235
259
|
|
|
236
|
-
|
|
237
|
-
|
|
260
|
+
if (!this._inIronForm || this.multi) {
|
|
261
|
+
this._clear('[name="output"]');
|
|
238
262
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
this.dispatchEvent(new CustomEvent('change'));
|
|
263
|
+
const vals = this.multi ? this.values : [this.value];
|
|
264
|
+
vals.forEach(val => {
|
|
265
|
+
const hidden = document.createElement('input');
|
|
266
|
+
hidden.type = 'hidden';
|
|
267
|
+
hidden.name = this.name;
|
|
268
|
+
hidden.value = val;
|
|
269
|
+
hidden.slot = 'output';
|
|
270
|
+
this.appendChild(hidden);
|
|
271
|
+
});
|
|
250
272
|
}
|
|
273
|
+
this.dispatchEvent(new CustomEvent('change'));
|
|
274
|
+
}
|
|
251
275
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
276
|
+
static get styles() {
|
|
277
|
+
return css`
|
|
278
|
+
:host {
|
|
279
|
+
display: flex;
|
|
280
|
+
flex-direction: column;
|
|
281
|
+
position: relative;
|
|
282
|
+
margin-top: 1rem;
|
|
283
|
+
}
|
|
260
284
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
285
|
+
iron-label {
|
|
286
|
+
font: var(--pb-base-font);
|
|
287
|
+
font-size: var(--pb-font-caption);
|
|
288
|
+
font-weight: 400;
|
|
289
|
+
color: var(--pb-color-lighter);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
paper-listbox {
|
|
293
|
+
overflow: auto;
|
|
294
|
+
}
|
|
295
|
+
`;
|
|
296
|
+
}
|
|
273
297
|
}
|
|
274
298
|
customElements.define('pb-select', PbSelect);
|