@teipublisher/pb-components 2.26.0-next-3.12 → 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 +30 -0
- package/Dockerfile +78 -70
- package/css/components.css +5 -5
- 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-49ab4037.js → vaadin-element-mixin-84fb7d82.js} +178 -163
- 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 +94 -85
- 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-manage-odds.js
CHANGED
|
@@ -23,330 +23,376 @@ import { cmpVersion } from './utils.js';
|
|
|
23
23
|
* @fires pb-refresh-odds When received, refresh the list of ODDs
|
|
24
24
|
*/
|
|
25
25
|
export class PbManageOdds extends pbMixin(LitElement) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
static get properties() {
|
|
27
|
+
return {
|
|
28
|
+
...super.properties,
|
|
29
|
+
/**
|
|
30
|
+
* array of ODD-files to be listed
|
|
31
|
+
*/
|
|
32
|
+
odds: {
|
|
33
|
+
type: Array,
|
|
34
|
+
},
|
|
35
|
+
target: {
|
|
36
|
+
type: String,
|
|
37
|
+
},
|
|
38
|
+
_valid: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
},
|
|
41
|
+
_current: {
|
|
42
|
+
type: String,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
this.odds = [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
super.connectedCallback();
|
|
54
|
+
|
|
55
|
+
this.subscribeTo('pb-refresh-odds', ev => {
|
|
56
|
+
this._refresh();
|
|
57
|
+
|
|
58
|
+
// regenerate newly uploaded ODDs
|
|
59
|
+
const regenAjax = this.shadowRoot.getElementById('regenerate');
|
|
60
|
+
const params = ev.detail.odds.map(odd => `odd=${odd}`).join('&');
|
|
61
|
+
if (this.minApiVersion('1.0.0')) {
|
|
62
|
+
regenAjax.url = `api/odd?${params}`;
|
|
63
|
+
} else {
|
|
64
|
+
regenAjax.url = `modules/lib/regenerate.xql?${params}`;
|
|
65
|
+
}
|
|
66
|
+
regenAjax.trigger();
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
firstUpdated() {
|
|
71
|
+
super.firstUpdated();
|
|
72
|
+
|
|
73
|
+
this._loader = this.shadowRoot.getElementById('load');
|
|
74
|
+
|
|
75
|
+
waitOnce('pb-page-ready', options => {
|
|
76
|
+
if (cmpVersion(options.apiVersion, '1.0.0') < 0) {
|
|
77
|
+
this._loader.url = `${options.endpoint}/modules/lib/components-odd.xql`;
|
|
78
|
+
} else {
|
|
79
|
+
this._loader.url = `${options.endpoint}/api/odd`;
|
|
80
|
+
}
|
|
81
|
+
this._refresh();
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
_refresh(params) {
|
|
86
|
+
this.emitTo('pb-start-update');
|
|
87
|
+
|
|
88
|
+
this._loader.params = params;
|
|
89
|
+
this._loader.generateRequest();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_update() {
|
|
93
|
+
this.emitTo('pb-end-update');
|
|
94
|
+
|
|
95
|
+
this.odds = this._loader.lastResponse;
|
|
96
|
+
this.requestUpdate();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_selectODD(ev) {
|
|
100
|
+
const selected = ev.model.itemsIndex;
|
|
101
|
+
this.odds.forEach((odd, index) => {
|
|
102
|
+
if (index !== selected && odd.current) {
|
|
103
|
+
this.set(`odds.${index}.current`, false);
|
|
104
|
+
this.set(`odds.${selected}.current`, true);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const params = { odd: `${ev.model.item.name}.odd` };
|
|
108
|
+
console.log('<pb-manage-odds> selected ODD: %o', params);
|
|
109
|
+
|
|
110
|
+
this.emitTo('pb-load', {
|
|
111
|
+
params,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
_createODD() {
|
|
116
|
+
const name = this.shadowRoot.querySelector('paper-input[name="new_odd"]').value;
|
|
117
|
+
const title = this.shadowRoot.querySelector('paper-input[name="title"]').value;
|
|
118
|
+
console.log('<pb-manage-odds> create ODD: %s, %s', name, title);
|
|
119
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
120
|
+
this._refresh({ new_odd: name, title });
|
|
121
|
+
} else {
|
|
122
|
+
const createRequest = this.shadowRoot.getElementById('create');
|
|
123
|
+
createRequest.url = `${this.getEndpoint()}/api/odd/${name}`;
|
|
124
|
+
createRequest.params = {
|
|
125
|
+
title,
|
|
126
|
+
};
|
|
127
|
+
this.emitTo('pb-start-update');
|
|
128
|
+
createRequest.generateRequest();
|
|
45
129
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
this.subscribeTo('pb-refresh-odds', (ev) => {
|
|
56
|
-
this._refresh();
|
|
57
|
-
|
|
58
|
-
// regenerate newly uploaded ODDs
|
|
59
|
-
const regenAjax = this.shadowRoot.getElementById('regenerate');
|
|
60
|
-
const params = ev.detail.odds.map(odd => `odd=${odd}`).join('&');
|
|
61
|
-
if (this.minApiVersion('1.0.0')) {
|
|
62
|
-
regenAjax.url = `api/odd?${params}`;
|
|
63
|
-
} else {
|
|
64
|
-
regenAjax.url = `modules/lib/regenerate.xql?${params}`;
|
|
65
|
-
}
|
|
66
|
-
regenAjax.trigger();
|
|
67
|
-
});
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
_created(ev) {
|
|
133
|
+
this.emitTo('pb-end-update');
|
|
134
|
+
if (ev.detail.status === 201) {
|
|
135
|
+
this._refresh();
|
|
136
|
+
} else {
|
|
137
|
+
console.log('<pb-manage-odds> unexpected response for create odd: %o', ev.detail);
|
|
68
138
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
} else {
|
|
79
|
-
this._loader.url = `${options.endpoint}/api/odd`;
|
|
80
|
-
}
|
|
81
|
-
this._refresh();
|
|
82
|
-
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
_createByExample() {
|
|
142
|
+
const name = this.shadowRoot.querySelector('paper-input[name="new_odd"]').value;
|
|
143
|
+
const title = this.shadowRoot.querySelector('paper-input[name="title"]').value;
|
|
144
|
+
const params = { new_odd: name, title };
|
|
145
|
+
const fileBrowser = document.getElementById(this.target);
|
|
146
|
+
if (!(fileBrowser || fileBrowser.getSelected)) {
|
|
147
|
+
console.error('<pb-manage-odds> target %s not found', this.target);
|
|
83
148
|
}
|
|
84
|
-
|
|
85
|
-
|
|
149
|
+
const selected = fileBrowser.getSelected();
|
|
150
|
+
document.querySelectorAll('.document-select paper-checkbox[checked]').forEach(checkbox => {
|
|
151
|
+
selected.push(checkbox.value);
|
|
152
|
+
});
|
|
153
|
+
console.log('<pb-manage-odds> create ODD by example: %o', selected);
|
|
154
|
+
params.byExample = selected;
|
|
155
|
+
this._refresh(params);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
_delete(odd) {
|
|
159
|
+
this._current = odd;
|
|
160
|
+
this.shadowRoot.getElementById('deleteDialog').open();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
_confirmDelete() {
|
|
164
|
+
if (this._current) {
|
|
165
|
+
console.log('<pb-manage-odds> deleting ODD: %s', this._current);
|
|
166
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
167
|
+
this._refresh({ delete: this._current });
|
|
168
|
+
} else {
|
|
86
169
|
this.emitTo('pb-start-update');
|
|
87
|
-
|
|
88
|
-
this._loader.params = params;
|
|
89
|
-
this._loader.generateRequest();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
_update() {
|
|
93
|
-
this.emitTo('pb-end-update');
|
|
94
|
-
|
|
95
|
-
this.odds = this._loader.lastResponse;
|
|
96
|
-
this.requestUpdate();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
_selectODD(ev) {
|
|
100
|
-
const selected = ev.model.itemsIndex;
|
|
101
|
-
this.odds.forEach((odd, index) => {
|
|
102
|
-
if (index !== selected && odd.current) {
|
|
103
|
-
this.set('odds.' + index + '.current', false);
|
|
104
|
-
this.set('odds.' + selected + '.current', true);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
const params = { odd: ev.model.item.name + '.odd' };
|
|
108
|
-
console.log('<pb-manage-odds> selected ODD: %o', params);
|
|
109
|
-
|
|
110
|
-
this.emitTo('pb-load', {
|
|
111
|
-
"params": params
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
_createODD() {
|
|
116
|
-
const name = this.shadowRoot.querySelector('paper-input[name="new_odd"]').value;
|
|
117
|
-
const title = this.shadowRoot.querySelector('paper-input[name="title"]').value;
|
|
118
|
-
console.log('<pb-manage-odds> create ODD: %s, %s', name, title);
|
|
119
|
-
if (this.lessThanApiVersion('1.0.0')) {
|
|
120
|
-
this._refresh({ new_odd: name, title });
|
|
121
|
-
} else {
|
|
122
|
-
const createRequest = this.shadowRoot.getElementById('create');
|
|
123
|
-
createRequest.url = `${this.getEndpoint()}/api/odd/${name}`;
|
|
124
|
-
createRequest.params = {
|
|
125
|
-
title
|
|
126
|
-
};
|
|
127
|
-
this.emitTo('pb-start-update');
|
|
128
|
-
createRequest.generateRequest();
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
_created(ev) {
|
|
133
|
-
this.emitTo('pb-end-update');
|
|
134
|
-
if (ev.detail.status === 201) {
|
|
135
|
-
this._refresh();
|
|
136
|
-
} else {
|
|
137
|
-
console.log('<pb-manage-odds> unexpected response for create odd: %o', ev.detail);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
_createByExample() {
|
|
142
|
-
const name = this.shadowRoot.querySelector('paper-input[name="new_odd"]').value;
|
|
143
|
-
const title = this.shadowRoot.querySelector('paper-input[name="title"]').value;
|
|
144
|
-
const params = { new_odd: name, title };
|
|
145
|
-
const fileBrowser = document.getElementById(this.target);
|
|
146
|
-
if (!(fileBrowser || fileBrowser.getSelected)) {
|
|
147
|
-
console.error('<pb-manage-odds> target %s not found', this.target);
|
|
148
|
-
}
|
|
149
|
-
const selected = fileBrowser.getSelected();
|
|
150
|
-
document.querySelectorAll('.document-select paper-checkbox[checked]').forEach((checkbox) => {
|
|
151
|
-
selected.push(checkbox.value);
|
|
152
|
-
});
|
|
153
|
-
console.log('<pb-manage-odds> create ODD by example: %o', selected);
|
|
154
|
-
params['byExample'] = selected;
|
|
155
|
-
this._refresh(params);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
_delete(odd) {
|
|
159
|
-
this._current = odd;
|
|
160
|
-
this.shadowRoot.getElementById('deleteDialog').open();
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
_confirmDelete() {
|
|
164
|
-
if (this._current) {
|
|
165
|
-
console.log('<pb-manage-odds> deleting ODD: %s', this._current);
|
|
166
|
-
if (this.lessThanApiVersion('1.0.0')) {
|
|
167
|
-
this._refresh({ 'delete': this._current });
|
|
168
|
-
} else {
|
|
169
|
-
this.emitTo('pb-start-update');
|
|
170
|
-
const deleteRequest = this.shadowRoot.getElementById('delete');
|
|
171
|
-
deleteRequest.url = `${this.getEndpoint()}/api/odd/${this._current}`;
|
|
172
|
-
deleteRequest.generateRequest();
|
|
173
|
-
}
|
|
174
|
-
this._current = null;
|
|
175
|
-
} else {
|
|
176
|
-
console.error('<pb-manage-odds> no file marked for deletion');
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
_deleted() {
|
|
181
170
|
const deleteRequest = this.shadowRoot.getElementById('delete');
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
171
|
+
deleteRequest.url = `${this.getEndpoint()}/api/odd/${this._current}`;
|
|
172
|
+
deleteRequest.generateRequest();
|
|
173
|
+
}
|
|
174
|
+
this._current = null;
|
|
175
|
+
} else {
|
|
176
|
+
console.error('<pb-manage-odds> no file marked for deletion');
|
|
189
177
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
_deleted() {
|
|
181
|
+
const deleteRequest = this.shadowRoot.getElementById('delete');
|
|
182
|
+
const error = deleteRequest.lastError;
|
|
183
|
+
if (error.status === 410) {
|
|
184
|
+
this._refresh();
|
|
185
|
+
} else {
|
|
186
|
+
console.error('<pb-manage-odds> failed to delete odd: %d %o', error.status, error.response);
|
|
187
|
+
this.emitTo('pb-end-update');
|
|
196
188
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
_validate() {
|
|
192
|
+
// Validate the entire form to see if we should enable the `Submit` button.
|
|
193
|
+
const valid = this.shadowRoot.getElementById('ironform').validate();
|
|
194
|
+
this.shadowRoot.getElementById('createBtn').disabled = !valid;
|
|
195
|
+
this.shadowRoot.getElementById('createByEx').disabled = !valid;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
render() {
|
|
199
|
+
if (!this.odds) {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
const regenUrl = this.lessThanApiVersion('1.0.0') ? 'modules/lib/regenerate.xql' : 'api/odd';
|
|
203
|
+
return html`
|
|
204
|
+
<pb-restricted login="login">
|
|
205
|
+
<pb-ajax
|
|
206
|
+
id="regenerateAll"
|
|
207
|
+
url="${regenUrl}"
|
|
208
|
+
method="post"
|
|
209
|
+
title="${translate('odd.manage.regenerate-all')}"
|
|
210
|
+
emit="${this.emit ? this.emit : ''}"
|
|
211
|
+
.emitConfig="${this.emitConfig}"
|
|
212
|
+
>
|
|
213
|
+
<h3 slot="title">${translate('odd.manage.regenerate-all')}</h3>
|
|
214
|
+
<paper-button raised="raised"
|
|
215
|
+
><a href="#">${translate('odd.manage.regenerate-all')}</a></paper-button
|
|
216
|
+
>
|
|
217
|
+
</pb-ajax>
|
|
218
|
+
</pb-restricted>
|
|
219
|
+
${this.odds.map(
|
|
220
|
+
odd =>
|
|
221
|
+
html`
|
|
222
|
+
<div class="odd">
|
|
223
|
+
<a
|
|
224
|
+
href="odd-editor.html?odd=${odd.name}.odd"
|
|
225
|
+
target="_blank"
|
|
226
|
+
title="edit ODD in graphical editor"
|
|
227
|
+
>${odd.label}</a
|
|
228
|
+
>
|
|
229
|
+
<!-- TODO this toolbar should only appear once per ODD files papercard -->
|
|
230
|
+
<app-toolbar>
|
|
231
|
+
${odd.canWrite
|
|
232
|
+
? html`
|
|
233
|
+
<pb-restricted login="login">
|
|
234
|
+
<pb-ajax
|
|
235
|
+
url="${regenUrl}?odd=${odd.name}.odd"
|
|
236
|
+
method="post"
|
|
237
|
+
class="editor-link"
|
|
238
|
+
emit="${this.emit ? this.emit : ''}"
|
|
239
|
+
.emitConfig="${this.emitConfig}"
|
|
240
|
+
>
|
|
241
|
+
<h2 slot="title">${translate('menu.admin.recompile')}</h2>
|
|
242
|
+
<paper-icon-button
|
|
243
|
+
title="Regenerate ODD"
|
|
244
|
+
icon="update"
|
|
245
|
+
></paper-icon-button>
|
|
246
|
+
</pb-ajax>
|
|
247
|
+
<paper-icon-button
|
|
248
|
+
title="Delete ODD"
|
|
249
|
+
icon="delete"
|
|
250
|
+
@click="${() => this._delete(`${odd.name}.odd`)}"
|
|
251
|
+
class="editor-link"
|
|
252
|
+
></paper-icon-button>
|
|
253
|
+
</pb-restricted>
|
|
254
|
+
`
|
|
255
|
+
: null}
|
|
256
|
+
<a
|
|
257
|
+
href="odd-editor.html?odd=${odd.name}.odd"
|
|
258
|
+
target="_blank"
|
|
259
|
+
class="editor-link"
|
|
260
|
+
title="edit ODD in graphical editor"
|
|
261
|
+
><iron-icon icon="reorder"></iron-icon
|
|
262
|
+
></a>
|
|
263
|
+
<pb-edit-xml path="${odd.path}" class="editor-link">
|
|
264
|
+
<paper-icon-button title="Edit XML" icon="create"></paper-icon-button>
|
|
265
|
+
</pb-edit-xml>
|
|
266
|
+
</app-toolbar>
|
|
267
|
+
</div>
|
|
268
|
+
<div class="odd-description">${odd.description}</div>
|
|
269
|
+
`,
|
|
270
|
+
)}
|
|
271
|
+
<pb-restricted login="login">
|
|
272
|
+
<form action="" method="GET">
|
|
273
|
+
<paper-input
|
|
274
|
+
name="new_odd"
|
|
275
|
+
label="${translate('odd.manage.filename')}"
|
|
276
|
+
required
|
|
277
|
+
auto-validate
|
|
278
|
+
pattern="[a-zA-Z0-9-_]+"
|
|
279
|
+
error-message="${translate('odd.manage.filename-error')}"
|
|
280
|
+
></paper-input>
|
|
281
|
+
<paper-input
|
|
282
|
+
name="title"
|
|
283
|
+
label="${translate('odd.manage.title')}"
|
|
284
|
+
auto-validate
|
|
285
|
+
required
|
|
286
|
+
minlength="1"
|
|
287
|
+
error-message="${translate('odd.manage.title-error')}"
|
|
288
|
+
></paper-input>
|
|
289
|
+
<paper-button id="createBtn" @click="${this._createODD}">
|
|
290
|
+
<iron-icon icon="create"></iron-icon>${translate('odd.manage.create')}
|
|
291
|
+
</paper-button>
|
|
292
|
+
<!--paper-button id="createByEx" @click="${this._createByExample}">
|
|
251
293
|
<iron-icon icon="build"></iron-icon>
|
|
252
294
|
${translate('odd.manage.create-from-example')}
|
|
253
295
|
</paper-button-->
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
296
|
+
</form>
|
|
297
|
+
</pb-restricted>
|
|
298
|
+
<pb-ajax id="regenerate" url="${regenUrl}" method="post"></pb-ajax>
|
|
299
|
+
<iron-ajax
|
|
300
|
+
id="load"
|
|
301
|
+
verbose
|
|
302
|
+
handle-as="json"
|
|
303
|
+
method="get"
|
|
304
|
+
with-credentials
|
|
305
|
+
@response="${this._update}"
|
|
306
|
+
>
|
|
307
|
+
</iron-ajax>
|
|
308
|
+
<iron-ajax id="delete" method="delete" with-credentials @error="${this._deleted}"></iron-ajax>
|
|
309
|
+
<iron-ajax
|
|
310
|
+
id="create"
|
|
311
|
+
method="post"
|
|
312
|
+
with-credentials
|
|
313
|
+
@response="${this._created}"
|
|
314
|
+
@error="${this._created}"
|
|
315
|
+
></iron-ajax>
|
|
316
|
+
<paper-dialog id="deleteDialog">
|
|
317
|
+
<h2>${translate('browse.delete')}</h2>
|
|
318
|
+
<paper-dialog-scrollable>
|
|
319
|
+
<p>${translate('odd.manage.delete', { file: this.file })}</p>
|
|
320
|
+
</paper-dialog-scrollable>
|
|
321
|
+
<div class="buttons">
|
|
322
|
+
<paper-button dialog-confirm="dialog-confirm" autofocus @click="${this._confirmDelete}">
|
|
323
|
+
${translate('dialogs.yes')}
|
|
324
|
+
</paper-button>
|
|
325
|
+
<paper-button dialog-confirm="dialog-cancel"> ${translate('dialogs.no')} </paper-button>
|
|
326
|
+
</div>
|
|
327
|
+
</paper-dialog>
|
|
328
|
+
`;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
static get styles() {
|
|
332
|
+
return css`
|
|
333
|
+
:host {
|
|
334
|
+
display: block;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.odd {
|
|
338
|
+
display: flex;
|
|
339
|
+
flex-direction: row;
|
|
340
|
+
align-items: center;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
.odd paper-checkbox {
|
|
344
|
+
display: block;
|
|
345
|
+
flex: 0 0;
|
|
346
|
+
margin-right: 1em;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.odd a,
|
|
350
|
+
.odd a:link,
|
|
351
|
+
.odd a:visited {
|
|
352
|
+
display: block;
|
|
353
|
+
flex: 10 0;
|
|
354
|
+
color: var(--pb-manage-odds-link-color);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.odd app-toolbar {
|
|
358
|
+
flex: 1 0;
|
|
359
|
+
justify-content: flex-end;
|
|
360
|
+
padding: 0;
|
|
361
|
+
min-height: 0.25rem;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
pb-restricted {
|
|
365
|
+
display: flex;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.odd-description {
|
|
369
|
+
color: #888888;
|
|
370
|
+
font-size: 0.8em;
|
|
371
|
+
margin-bottom: 0.25rem;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
#regenerateAll {
|
|
375
|
+
display: block;
|
|
376
|
+
width: 100%;
|
|
377
|
+
margin-top: 10px;
|
|
378
|
+
text-align: right;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
#regenerateAll a {
|
|
382
|
+
text-decoration: none;
|
|
383
|
+
color: inherit;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
[icon] {
|
|
387
|
+
color: var(--pb-manage-odds-icon-color);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
[icon='reorder'] {
|
|
391
|
+
width: 24px;
|
|
392
|
+
height: 24px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/* @media (hover:hover) and (pointer: fine){
|
|
350
396
|
.odd app-toolbar .editor-link{
|
|
351
397
|
opacity: 0;
|
|
352
398
|
}
|
|
@@ -355,9 +401,9 @@ export class PbManageOdds extends pbMixin(LitElement) {
|
|
|
355
401
|
transition: opacity 0.6s;
|
|
356
402
|
}
|
|
357
403
|
} */
|
|
358
|
-
|
|
359
|
-
|
|
404
|
+
`;
|
|
405
|
+
}
|
|
360
406
|
}
|
|
361
|
-
if(!customElements.get('pb-manage-odds')){
|
|
362
|
-
|
|
407
|
+
if (!customElements.get('pb-manage-odds')) {
|
|
408
|
+
customElements.define('pb-manage-odds', PbManageOdds);
|
|
363
409
|
}
|