@teipublisher/pb-components 2.26.1-next.2 → 3.0.0-next-4.1
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/docker-cypress.yml +54 -0
- package/.github/workflows/main.yml +6 -4
- package/.github/workflows/node.js.yml +56 -21
- package/.github/workflows/release.js.yml +19 -17
- package/.releaserc.json +1 -1
- package/CHANGELOG.md +351 -9
- package/Dockerfile +78 -70
- package/README.md +112 -4
- package/css/components.css +5 -5
- package/css/gridjs/mermaid.min.css +1 -1
- package/css/leaflet/Control.Geocoder.css +1 -126
- package/css/leaflet/images/layers.png +0 -0
- package/css/tify/tify.css +6 -5
- package/css/tom-select/tom-select.bootstrap4.min.css +1 -1
- package/css/tom-select/tom-select.bootstrap5.min.css +1 -1
- package/css/tom-select/tom-select.default.min.css +1 -1
- package/css/tom-select/tom-select.default.min.css.map +1 -0
- package/css/tom-select/tom-select.min.css +1 -1
- package/cypress.config.js +84 -0
- package/dist/api.html +1 -1
- package/dist/css/design-system.css +607 -0
- package/dist/demo/bundle-test.html +4 -3
- package/dist/demo/components.css +46 -1
- package/dist/demo/design-system.html +710 -0
- package/dist/demo/dts-client.html +2 -2
- package/dist/demo/pb-autocomplete.html +23 -11
- package/dist/demo/pb-autocomplete2.html +66 -55
- package/dist/demo/pb-autocomplete3.html +17 -8
- package/dist/demo/pb-blacklab-highlight.html +28 -11
- package/dist/demo/pb-blacklab-results.html +3 -2
- package/dist/demo/pb-browse-docs.html +24 -24
- package/dist/demo/pb-browse-docs2.html +3 -3
- package/dist/demo/pb-clipboard.html +32 -28
- package/dist/demo/pb-code-editor.html +6 -6
- package/dist/demo/pb-code-highlight.html +63 -63
- package/dist/demo/pb-codepen.html +1 -1
- package/dist/demo/pb-collapse.html +1 -1
- package/dist/demo/pb-collapse2.html +2 -2
- package/dist/demo/pb-combo-box.html +135 -130
- package/dist/demo/pb-custom-form.html +64 -55
- package/dist/demo/pb-dialog.html +12 -6
- package/dist/demo/pb-document.html +1 -1
- package/dist/demo/pb-download.html +68 -59
- package/dist/demo/pb-drawer.html +67 -46
- package/dist/demo/pb-drawer2.html +65 -58
- package/dist/demo/pb-edit-app.html +2 -2
- package/dist/demo/pb-edit-xml.html +1 -1
- package/dist/demo/pb-facsimile-2.html +26 -11
- package/dist/demo/pb-facsimile-3.html +25 -10
- package/dist/demo/pb-facsimile-dedup-test-2.html +48 -0
- package/dist/demo/pb-facsimile-dedup-test.html +48 -0
- package/dist/demo/pb-facsimile.html +4 -4
- package/dist/demo/pb-formula.html +1 -1
- package/dist/demo/pb-grid.html +22 -8
- package/dist/demo/pb-highlight.html +2 -2
- package/dist/demo/pb-i18n-simple.html +1 -0
- package/dist/demo/pb-i18n.html +15 -5
- package/dist/demo/pb-image-strip-standalone.html +2 -2
- package/dist/demo/pb-image-strip-view.html +2 -2
- package/dist/demo/pb-leaflet-map.html +3 -3
- package/dist/demo/pb-leaflet-map2.html +2 -2
- package/dist/demo/pb-leaflet-map3.html +3 -3
- package/dist/demo/pb-link.html +1 -1
- package/dist/demo/pb-load.html +2 -6
- package/dist/demo/pb-login.html +1 -3
- package/dist/demo/pb-manage-odds.html +9 -4
- package/dist/demo/pb-markdown.html +1 -1
- package/dist/demo/pb-media-query.html +2 -2
- package/dist/demo/pb-mei.html +2 -2
- package/dist/demo/pb-mei2.html +2 -2
- package/dist/demo/pb-message.html +2 -3
- package/dist/demo/pb-odd-editor.html +54 -52
- package/dist/demo/pb-page-header.html +27 -0
- package/dist/demo/pb-popover.html +1 -1
- package/dist/demo/pb-print-preview.html +2 -2
- package/dist/demo/pb-progress.html +4 -4
- package/dist/demo/pb-repeat.html +32 -36
- package/dist/demo/pb-search.html +16 -5
- package/dist/demo/pb-search2.html +4 -4
- package/dist/demo/pb-search3.html +3 -3
- package/dist/demo/pb-search4.html +3 -3
- package/dist/demo/pb-select-feature.html +4 -4
- package/dist/demo/pb-select-feature2.html +4 -4
- package/dist/demo/pb-select-feature3.html +2 -2
- package/dist/demo/pb-select-i18n.html +58 -53
- package/dist/demo/pb-select-odd.html +1 -1
- package/dist/demo/pb-select.html +190 -75
- package/dist/demo/pb-select2.html +91 -37
- package/dist/demo/pb-select3.html +109 -41
- package/dist/demo/pb-svg.html +1 -1
- package/dist/demo/pb-table-grid.html +26 -15
- package/dist/demo/pb-tabs.html +15 -7
- package/dist/demo/pb-tify.html +7 -7
- package/dist/demo/pb-timeline.html +1 -1
- package/dist/demo/pb-timeline2.html +1 -1
- package/dist/demo/pb-toggle-feature.html +26 -23
- package/dist/demo/pb-toggle-feature2.html +4 -4
- package/dist/demo/pb-toggle-feature3.html +2 -2
- package/dist/demo/pb-toggle-feature4.html +56 -54
- package/dist/demo/pb-version.html +2 -2
- package/dist/demo/pb-view.html +78 -40
- package/dist/demo/pb-view2.html +69 -46
- package/dist/demo/pb-view3.html +53 -48
- package/dist/demo/pb-view4.html +70 -49
- package/dist/demo/pb-zoom.html +2 -2
- package/dist/{es-global-bridge-d8ce175d.js → es-global-bridge-D8ZcUcx_.js} +0 -4
- package/dist/focus-mixin-VCsFap6b.js +768 -0
- package/dist/images/icons.svg +217 -0
- package/dist/jinn-codemirror-DETLdm08.js +1 -0
- package/dist/lib/openseadragon.min.js +80 -0
- package/dist/lib/openseadragon.min.js.map +1 -0
- package/dist/pb-code-editor.js +25 -20
- package/dist/pb-component-docs.js +414 -3225
- package/dist/pb-components-bundle.js +3046 -4402
- package/dist/pb-dialog-tklYGWfc.js +121 -0
- package/dist/pb-edit-app.js +208 -107
- package/dist/pb-elements.json +716 -249
- package/dist/pb-facsimile.js +46 -0
- package/dist/pb-i18n-C0NDma4h.js +1 -0
- package/dist/pb-leaflet-map.js +23 -23
- package/dist/pb-mei.js +152 -134
- package/dist/pb-mixin-DHoWQheB.js +1 -0
- package/dist/pb-odd-editor.js +1671 -1231
- package/dist/pb-tify.js +1 -27
- package/dist/unsafe-html-D5VGo9Oq.js +1 -0
- package/dist/urls-BEONu_g4.js +1 -0
- package/eslint.config.mjs +92 -0
- package/gh-pages.js +5 -3
- package/i18n/common/en.json +6 -0
- package/i18n/common/pl.json +2 -2
- package/images/icons.svg +217 -0
- package/index.html +0 -5
- package/lib/leaflet-src.js.map +1 -0
- package/lib/leaflet.markercluster-src.js.map +1 -0
- package/lib/openseadragon.min.js +6 -6
- package/package.json +56 -81
- package/pb-elements.json +716 -249
- package/rollup.config.mjs +312 -0
- package/src/assets/components.css +5 -5
- package/src/assets/design-system.css +607 -0
- package/src/authority/airtable.js +20 -21
- package/src/authority/anton.js +129 -129
- package/src/authority/custom.js +70 -27
- package/src/authority/geonames.js +38 -32
- package/src/authority/gnd.js +50 -42
- package/src/authority/kbga.js +136 -134
- package/src/authority/metagrid.js +44 -46
- package/src/authority/reconciliation.js +66 -68
- package/src/authority/registry.js +4 -4
- package/src/docs/demo-utils.js +91 -0
- package/src/docs/pb-component-docs.js +287 -147
- package/src/docs/pb-component-view.js +380 -273
- package/src/docs/pb-components-list.js +115 -51
- package/src/docs/pb-demo-snippet.js +199 -174
- package/src/dts-client.js +306 -303
- package/src/dts-select-endpoint.js +125 -85
- package/src/parse-date-service.js +184 -135
- package/src/pb-ajax.js +175 -173
- package/src/pb-authority-lookup.js +198 -158
- package/src/pb-autocomplete.js +731 -313
- package/src/pb-blacklab-highlight.js +266 -260
- package/src/pb-blacklab-results.js +230 -225
- package/src/pb-browse-docs.js +601 -484
- package/src/pb-browse.js +68 -65
- package/src/pb-clipboard.js +97 -76
- package/src/pb-code-editor.js +111 -103
- package/src/pb-code-highlight.js +234 -204
- package/src/pb-codepen.js +81 -73
- package/src/pb-collapse.js +265 -152
- package/src/pb-combo-box.js +191 -191
- package/src/pb-components-bundle.js +1 -7
- package/src/pb-components.js +2 -6
- package/src/pb-custom-form.js +230 -141
- package/src/pb-dialog.js +99 -63
- package/src/pb-document.js +118 -91
- package/src/pb-download.js +214 -198
- package/src/pb-drawer.js +146 -149
- package/src/pb-edit-app.js +471 -240
- package/src/pb-edit-xml.js +101 -98
- package/src/pb-events.js +126 -107
- package/src/pb-facs-link.js +130 -101
- package/src/pb-facsimile.js +494 -410
- package/src/pb-fetch.js +389 -0
- package/src/pb-formula.js +152 -154
- package/src/pb-geolocation.js +130 -132
- package/src/pb-grid-action.js +59 -56
- package/src/pb-grid.js +388 -228
- package/src/pb-highlight.js +142 -142
- package/src/pb-hotkeys.js +40 -42
- package/src/pb-i18n.js +115 -127
- package/src/pb-icon-button.js +108 -0
- package/src/pb-icon.js +283 -0
- package/src/pb-image-strip.js +85 -79
- package/src/pb-lang.js +142 -57
- package/src/pb-leaflet-map.js +551 -483
- package/src/pb-link.js +132 -126
- package/src/pb-load.js +495 -428
- package/src/pb-login.js +303 -248
- package/src/pb-manage-odds.js +384 -338
- package/src/pb-map-icon.js +90 -90
- package/src/pb-map-layer.js +86 -86
- package/src/pb-markdown.js +107 -110
- package/src/pb-media-query.js +75 -73
- package/src/pb-mei.js +523 -303
- package/src/pb-message.js +144 -98
- package/src/pb-mixin.js +268 -265
- package/src/pb-navigation.js +83 -96
- package/src/pb-observable.js +39 -39
- package/src/pb-odd-editor.js +1209 -948
- package/src/pb-odd-elementspec-editor.js +375 -310
- package/src/pb-odd-model-editor.js +1189 -941
- package/src/pb-odd-parameter-editor.js +269 -170
- package/src/pb-odd-rendition-editor.js +184 -131
- package/src/pb-page.js +451 -422
- package/src/pb-paginate.js +260 -178
- package/src/pb-panel.js +217 -183
- package/src/pb-popover-themes.js +16 -9
- package/src/pb-popover.js +297 -288
- package/src/pb-print-preview.js +128 -128
- package/src/pb-progress.js +52 -52
- package/src/pb-repeat.js +141 -108
- package/src/pb-restricted.js +85 -78
- package/src/pb-search.js +258 -230
- package/src/pb-select-feature.js +210 -126
- package/src/pb-select-odd.js +184 -118
- package/src/pb-select-template.js +113 -78
- package/src/pb-select.js +330 -229
- package/src/pb-split-list.js +181 -176
- package/src/pb-svg.js +81 -80
- package/src/pb-table-column.js +55 -55
- package/src/pb-table-grid.js +334 -205
- package/src/pb-tabs.js +238 -61
- package/src/pb-tify.js +3331 -126
- package/src/pb-timeline.js +394 -255
- package/src/pb-toggle-feature.js +196 -188
- package/src/pb-upload.js +201 -176
- package/src/pb-version.js +22 -34
- package/src/pb-view-annotate.js +138 -102
- package/src/pb-view.js +1722 -1272
- package/src/pb-zoom.js +144 -46
- package/src/search-result-service.js +256 -223
- package/src/seed-element.js +14 -22
- package/src/settings.js +4 -4
- package/src/theming.js +98 -91
- package/src/urls.js +403 -289
- package/src/utils.js +53 -51
- package/vite.config.js +86 -0
- package/css/pb-styles.css +0 -51
- package/dist/iron-form-3b8dcaa7.js +0 -210
- package/dist/jinn-codemirror-da0e2d1f.js +0 -1
- package/dist/paper-checkbox-515a5284.js +0 -1597
- package/dist/paper-icon-button-b1d31571.js +0 -398
- package/dist/paper-listbox-a3b7175c.js +0 -1265
- package/dist/pb-i18n-0611135a.js +0 -1
- package/dist/pb-mixin-b1caa22e.js +0 -158
- package/dist/polymer-hack.js +0 -1
- package/dist/vaadin-element-mixin-6e4cee3a.js +0 -527
- package/lib/Control.Geocoder.min.js +0 -2
- package/lib/Control.Geocoder.min.js.map +0 -1
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -40
- package/src/polymer-hack.js +0 -6
package/src/pb-manage-odds.js
CHANGED
|
@@ -1,18 +1,13 @@
|
|
|
1
|
-
import { LitElement, html, css } from 'lit
|
|
2
|
-
import '
|
|
3
|
-
import '
|
|
4
|
-
import '@polymer/iron-ajax';
|
|
5
|
-
import '@polymer/paper-checkbox';
|
|
6
|
-
import '@polymer/paper-button';
|
|
7
|
-
import '@polymer/paper-icon-button';
|
|
8
|
-
import '@polymer/paper-input/paper-input.js';
|
|
9
|
-
import '@polymer/app-layout/app-toolbar/app-toolbar.js';
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import './pb-dialog.js';
|
|
3
|
+
import './pb-fetch.js';
|
|
10
4
|
import { pbMixin, waitOnce } from './pb-mixin.js';
|
|
11
5
|
import { translate } from './pb-i18n.js';
|
|
12
6
|
import './pb-restricted.js';
|
|
13
7
|
import './pb-ajax.js';
|
|
14
8
|
import './pb-edit-xml.js';
|
|
15
9
|
import { cmpVersion } from './utils.js';
|
|
10
|
+
import { themableMixin } from './theming.js';
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
13
|
* High-level component implementing the ODD management panel
|
|
@@ -22,342 +17,393 @@ import { cmpVersion } from './utils.js';
|
|
|
22
17
|
* @fires pb-load - Sending the ODD to be used
|
|
23
18
|
* @fires pb-refresh-odds When received, refresh the list of ODDs
|
|
24
19
|
*/
|
|
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
|
-
|
|
20
|
+
export class PbManageOdds extends themableMixin(pbMixin(LitElement)) {
|
|
21
|
+
static get properties() {
|
|
22
|
+
return {
|
|
23
|
+
...super.properties,
|
|
24
|
+
/**
|
|
25
|
+
* array of ODD-files to be listed
|
|
26
|
+
*/
|
|
27
|
+
odds: {
|
|
28
|
+
type: Array,
|
|
29
|
+
},
|
|
30
|
+
target: {
|
|
31
|
+
type: String,
|
|
32
|
+
},
|
|
33
|
+
_valid: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
},
|
|
36
|
+
_current: {
|
|
37
|
+
type: String,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
constructor() {
|
|
43
|
+
super();
|
|
44
|
+
this.odds = [];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
connectedCallback() {
|
|
48
|
+
super.connectedCallback();
|
|
49
|
+
|
|
50
|
+
this.subscribeTo('pb-refresh-odds', ev => {
|
|
51
|
+
this._refresh();
|
|
52
|
+
|
|
53
|
+
// regenerate newly uploaded ODDs
|
|
54
|
+
const regenAjax = this.shadowRoot.getElementById('regenerate');
|
|
55
|
+
const params = ev.detail.odds.map(odd => `odd=${odd}`).join('&');
|
|
56
|
+
if (this.minApiVersion('1.0.0')) {
|
|
57
|
+
regenAjax.url = `api/odd?${params}`;
|
|
58
|
+
} else {
|
|
59
|
+
regenAjax.url = `modules/lib/regenerate.xql?${params}`;
|
|
60
|
+
}
|
|
61
|
+
regenAjax.trigger();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
firstUpdated() {
|
|
66
|
+
super.firstUpdated();
|
|
67
|
+
|
|
68
|
+
this._loader = this.shadowRoot.getElementById('load');
|
|
69
|
+
|
|
70
|
+
waitOnce('pb-page-ready', options => {
|
|
71
|
+
if (cmpVersion(options.apiVersion, '1.0.0') < 0) {
|
|
72
|
+
this._loader.url = `${options.endpoint}/modules/lib/components-odd.xql`;
|
|
73
|
+
} else {
|
|
74
|
+
this._loader.url = `${options.endpoint}/api/odd`;
|
|
75
|
+
}
|
|
76
|
+
this._refresh();
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
_refresh(params) {
|
|
81
|
+
this.emitTo('pb-start-update');
|
|
82
|
+
|
|
83
|
+
this._loader.params = params;
|
|
84
|
+
this._loader.generateRequest();
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
_update() {
|
|
88
|
+
this.emitTo('pb-end-update');
|
|
89
|
+
|
|
90
|
+
this.odds = this._loader.lastResponse;
|
|
91
|
+
this.requestUpdate();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_selectODD(ev) {
|
|
95
|
+
const selected = ev.model.itemsIndex;
|
|
96
|
+
this.odds.forEach((odd, index) => {
|
|
97
|
+
if (index !== selected && odd.current) {
|
|
98
|
+
this.set(`odds.${index}.current`, false);
|
|
99
|
+
this.set(`odds.${selected}.current`, true);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
const params = { odd: `${ev.model.item.name}.odd` };
|
|
103
|
+
console.log('<pb-manage-odds> selected ODD: %o', params);
|
|
104
|
+
|
|
105
|
+
this.emitTo('pb-load', {
|
|
106
|
+
params,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_createODD(ev) {
|
|
111
|
+
ev.preventDefault();
|
|
112
|
+
|
|
113
|
+
const name = this.shadowRoot.querySelector('input[name="new_odd"]').value;
|
|
114
|
+
const title = this.shadowRoot.querySelector('input[name="title"]').value;
|
|
115
|
+
console.log('<pb-manage-odds> create ODD: %s, %s', name, title);
|
|
116
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
117
|
+
this._refresh({ new_odd: name, title });
|
|
118
|
+
} else {
|
|
119
|
+
const createRequest = this.shadowRoot.getElementById('create');
|
|
120
|
+
createRequest.url = `${this.getEndpoint()}/api/odd/${name}`;
|
|
121
|
+
createRequest.params = {
|
|
122
|
+
title,
|
|
123
|
+
};
|
|
124
|
+
this.emitTo('pb-start-update');
|
|
125
|
+
createRequest.generateRequest();
|
|
45
126
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_created(ev) {
|
|
130
|
+
this.emitTo('pb-end-update');
|
|
131
|
+
if (ev.detail.status === 201) {
|
|
132
|
+
this._refresh();
|
|
133
|
+
} else {
|
|
134
|
+
console.log('<pb-manage-odds> unexpected response for create odd: %o', ev.detail);
|
|
50
135
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
_createByExample() {
|
|
139
|
+
const name = this.shadowRoot.querySelector('input[name="new_odd"]').value;
|
|
140
|
+
const title = this.shadowRoot.querySelector('input[name="title"]').value;
|
|
141
|
+
const params = { new_odd: name, title };
|
|
142
|
+
const fileBrowser = document.getElementById(this.target);
|
|
143
|
+
if (!(fileBrowser || fileBrowser.getSelected)) {
|
|
144
|
+
console.error('<pb-manage-odds> target %s not found', this.target);
|
|
68
145
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
146
|
+
const selected = fileBrowser.getSelected();
|
|
147
|
+
document.querySelectorAll('.document-select paper-checkbox[checked]').forEach(checkbox => {
|
|
148
|
+
selected.push(checkbox.value);
|
|
149
|
+
});
|
|
150
|
+
console.log('<pb-manage-odds> create ODD by example: %o', selected);
|
|
151
|
+
params.byExample = selected;
|
|
152
|
+
this._refresh(params);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
_delete(odd) {
|
|
156
|
+
this._current = odd;
|
|
157
|
+
this.shadowRoot.getElementById('deleteDialog').openDialog();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
_confirmDelete() {
|
|
161
|
+
if (this._current) {
|
|
162
|
+
console.log('<pb-manage-odds> deleting ODD: %s', this._current);
|
|
163
|
+
if (this.lessThanApiVersion('1.0.0')) {
|
|
164
|
+
this._refresh({ delete: this._current });
|
|
165
|
+
} else {
|
|
86
166
|
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
167
|
const deleteRequest = this.shadowRoot.getElementById('delete');
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
}
|
|
168
|
+
deleteRequest.url = `${this.getEndpoint()}/api/odd/${this._current}`;
|
|
169
|
+
deleteRequest.generateRequest();
|
|
170
|
+
}
|
|
171
|
+
this._current = null;
|
|
172
|
+
} else {
|
|
173
|
+
console.error('<pb-manage-odds> no file marked for deletion');
|
|
189
174
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
_deleted() {
|
|
178
|
+
const deleteRequest = this.shadowRoot.getElementById('delete');
|
|
179
|
+
const error = deleteRequest.lastError;
|
|
180
|
+
if (error.status === 410) {
|
|
181
|
+
this._refresh();
|
|
182
|
+
} else {
|
|
183
|
+
console.error('<pb-manage-odds> failed to delete odd: %d %o', error.status, error.response);
|
|
184
|
+
this.emitTo('pb-end-update');
|
|
196
185
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
</pb-ajax>
|
|
210
|
-
</pb-restricted>
|
|
211
|
-
${this.odds.map((odd) =>
|
|
212
|
-
html`
|
|
213
|
-
<div class="odd">
|
|
214
|
-
<a href="odd-editor.html?odd=${odd.name}.odd" target="_blank"
|
|
215
|
-
title="edit ODD in graphical editor">${odd.label}</a>
|
|
216
|
-
<!-- TODO this toolbar should only appear once per ODD files papercard -->
|
|
217
|
-
<app-toolbar>
|
|
218
|
-
${
|
|
219
|
-
odd.canWrite ?
|
|
220
|
-
html`
|
|
221
|
-
<pb-restricted login="login">
|
|
222
|
-
<pb-ajax url="${regenUrl}?odd=${odd.name}.odd" method="post" class="editor-link"
|
|
223
|
-
emit="${this.emit ? this.emit : ''}" .emitConfig="${this.emitConfig}">
|
|
224
|
-
<h2 slot="title">${translate('menu.admin.recompile')}</h2>
|
|
225
|
-
<paper-icon-button title="Regenerate ODD" icon="update"></paper-icon-button>
|
|
226
|
-
</pb-ajax>
|
|
227
|
-
<paper-icon-button title="Delete ODD" icon="delete" @click="${() => this._delete(`${odd.name}.odd`)}"
|
|
228
|
-
class="editor-link"></paper-icon-button>
|
|
229
|
-
</pb-restricted>
|
|
230
|
-
` : null
|
|
231
|
-
}
|
|
232
|
-
<a href="odd-editor.html?odd=${odd.name}.odd" target="_blank" class="editor-link"
|
|
233
|
-
title="edit ODD in graphical editor"><iron-icon icon="reorder"></iron-icon></a>
|
|
234
|
-
<pb-edit-xml path="${odd.path}" class="editor-link">
|
|
235
|
-
<paper-icon-button title="Edit XML" icon="create"></paper-icon-button>
|
|
236
|
-
</pb-edit-xml>
|
|
237
|
-
</app-toolbar>
|
|
238
|
-
</div>
|
|
239
|
-
<div class="odd-description">${odd.description}</div>
|
|
240
|
-
`)}
|
|
241
|
-
<pb-restricted login="login">
|
|
242
|
-
<form action="" method="GET">
|
|
243
|
-
<paper-input name="new_odd" label="${translate('odd.manage.filename')}" required auto-validate pattern="[a-zA-Z0-9-_]+"
|
|
244
|
-
error-message="${translate('odd.manage.filename-error')}"></paper-input>
|
|
245
|
-
<paper-input name="title" label="${translate('odd.manage.title')}" auto-validate required minlength="1"
|
|
246
|
-
error-message="${translate('odd.manage.title-error')}"></paper-input>
|
|
247
|
-
<paper-button id="createBtn" @click="${this._createODD}">
|
|
248
|
-
<iron-icon icon="create"></iron-icon>${translate('odd.manage.create')}
|
|
249
|
-
</paper-button>
|
|
250
|
-
<!--paper-button id="createByEx" @click="${this._createByExample}">
|
|
251
|
-
<iron-icon icon="build"></iron-icon>
|
|
252
|
-
${translate('odd.manage.create-from-example')}
|
|
253
|
-
</paper-button-->
|
|
254
|
-
</form>
|
|
255
|
-
</pb-restricted>
|
|
256
|
-
<pb-ajax id="regenerate" url="${regenUrl}" method="post"></pb-ajax>
|
|
257
|
-
<iron-ajax
|
|
258
|
-
id="load"
|
|
259
|
-
verbose
|
|
260
|
-
handle-as="json"
|
|
261
|
-
method="get"
|
|
262
|
-
with-credentials
|
|
263
|
-
@response="${this._update}">
|
|
264
|
-
</iron-ajax>
|
|
265
|
-
<iron-ajax id="delete" method="delete" with-credentials @error="${this._deleted}"></iron-ajax>
|
|
266
|
-
<iron-ajax id="create" method="post" with-credentials @response="${this._created}" @error="${this._created}"></iron-ajax>
|
|
267
|
-
<paper-dialog id="deleteDialog">
|
|
268
|
-
<h2>${translate('browse.delete')}</h2>
|
|
269
|
-
<paper-dialog-scrollable>
|
|
270
|
-
<p>${translate('odd.manage.delete', { file: this.file })}</p>
|
|
271
|
-
</paper-dialog-scrollable>
|
|
272
|
-
<div class="buttons">
|
|
273
|
-
<paper-button dialog-confirm="dialog-confirm" autofocus @click="${this._confirmDelete}">
|
|
274
|
-
${translate('dialogs.yes')}
|
|
275
|
-
</paper-button>
|
|
276
|
-
<paper-button dialog-confirm="dialog-cancel">
|
|
277
|
-
${translate('dialogs.no')}
|
|
278
|
-
</paper-button>
|
|
279
|
-
</div>
|
|
280
|
-
</paper-dialog>
|
|
281
|
-
`;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
static get styles() {
|
|
285
|
-
return css`
|
|
286
|
-
:host {
|
|
287
|
-
display: block;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.odd {
|
|
291
|
-
display: flex;
|
|
292
|
-
flex-direction: row;
|
|
293
|
-
align-items: center;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
.odd paper-checkbox {
|
|
297
|
-
display: block;
|
|
298
|
-
flex: 0 0;
|
|
299
|
-
margin-right: 1em;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
.odd a,
|
|
303
|
-
.odd a:link,
|
|
304
|
-
.odd a:visited{
|
|
305
|
-
display: block;
|
|
306
|
-
flex: 10 0;
|
|
307
|
-
color:var(--pb-manage-odds-link-color);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
.odd app-toolbar {
|
|
311
|
-
flex: 1 0;
|
|
312
|
-
justify-content: flex-end;
|
|
313
|
-
padding: 0;
|
|
314
|
-
min-height:0.25rem;
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
pb-restricted {
|
|
318
|
-
display: flex;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.odd-description {
|
|
322
|
-
color: #888888;
|
|
323
|
-
font-size: 0.8em;
|
|
324
|
-
margin-bottom: 0.25rem;
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
#regenerateAll {
|
|
328
|
-
display: block;
|
|
329
|
-
width: 100%;
|
|
330
|
-
margin-top: 10px;
|
|
331
|
-
text-align: right;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
#regenerateAll a{
|
|
335
|
-
text-decoration: none;
|
|
336
|
-
color: inherit;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
[icon]{
|
|
340
|
-
color:var(--pb-manage-odds-icon-color);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
[icon='reorder']
|
|
344
|
-
{
|
|
345
|
-
width:24px;
|
|
346
|
-
height: 24px;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
/* @media (hover:hover) and (pointer: fine){
|
|
350
|
-
.odd app-toolbar .editor-link{
|
|
351
|
-
opacity: 0;
|
|
352
|
-
}
|
|
353
|
-
.odd:hover .editor-link{
|
|
354
|
-
opacity: 1;
|
|
355
|
-
transition: opacity 0.6s;
|
|
356
|
-
}
|
|
357
|
-
} */
|
|
358
|
-
`;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
_validate() {
|
|
189
|
+
// Validate the entire form to see if we should enable the `Submit` button.
|
|
190
|
+
const valid = this.shadowRoot.getElementById('ironform').validate();
|
|
191
|
+
this.shadowRoot.getElementById('createBtn').disabled = !valid;
|
|
192
|
+
this.shadowRoot.getElementById('createByEx').disabled = !valid;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
render() {
|
|
196
|
+
if (!this.odds) {
|
|
197
|
+
return null;
|
|
359
198
|
}
|
|
199
|
+
const regenUrl = this.lessThanApiVersion('1.0.0') ? 'modules/lib/regenerate.xql' : 'api/odd';
|
|
200
|
+
return html`
|
|
201
|
+
${this.odds.map(
|
|
202
|
+
odd =>
|
|
203
|
+
html`
|
|
204
|
+
<div class="odd-container">
|
|
205
|
+
<div class="odd">
|
|
206
|
+
<a
|
|
207
|
+
href="odd-editor.html?odd=${odd.name}.odd"
|
|
208
|
+
target="_blank"
|
|
209
|
+
title="edit ODD in graphical editor"
|
|
210
|
+
>${odd.label}</a
|
|
211
|
+
>
|
|
212
|
+
<!-- TODO this toolbar should only appear once per ODD files papercard -->
|
|
213
|
+
<header role="group">
|
|
214
|
+
${odd.canWrite
|
|
215
|
+
? html`
|
|
216
|
+
<pb-restricted login="login">
|
|
217
|
+
<pb-ajax
|
|
218
|
+
url="${regenUrl}?odd=${odd.name}.odd"
|
|
219
|
+
method="post"
|
|
220
|
+
class="editor-link"
|
|
221
|
+
emit="${this.emit ? this.emit : ''}"
|
|
222
|
+
.emitConfig="${this.emitConfig}"
|
|
223
|
+
>
|
|
224
|
+
<h2 slot="title">${translate('menu.admin.recompile')}</h2>
|
|
225
|
+
<button title="Regenerate ODD" type="button">
|
|
226
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
|
|
227
|
+
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2z"/>
|
|
228
|
+
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466"/>
|
|
229
|
+
</svg>
|
|
230
|
+
</button
|
|
231
|
+
</pb-ajax>
|
|
232
|
+
</pb-restricted>
|
|
233
|
+
<pb-restricted login="login">
|
|
234
|
+
<button title="Delete ODD" @click="${() =>
|
|
235
|
+
this._delete(`${odd.name}.odd`)}" type="button">
|
|
236
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash3" viewBox="0 0 16 16">
|
|
237
|
+
<path d="M6.5 1h3a.5.5 0 0 1 .5.5v1H6v-1a.5.5 0 0 1 .5-.5M11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3A1.5 1.5 0 0 0 5 1.5v1H1.5a.5.5 0 0 0 0 1h.538l.853 10.66A2 2 0 0 0 4.885 16h6.23a2 2 0 0 0 1.994-1.84l.853-10.66h.538a.5.5 0 0 0 0-1zm1.958 1-.846 10.58a1 1 0 0 1-.997.92h-6.23a1 1 0 0 1-.997-.92L3.042 3.5zm-7.487 1a.5.5 0 0 1 .528.47l.5 8.5a.5.5 0 0 1-.998.06L5 5.03a.5.5 0 0 1 .47-.53Zm5.058 0a.5.5 0 0 1 .47.53l-.5 8.5a.5.5 0 1 1-.998-.06l.5-8.5a.5.5 0 0 1 .528-.47M8 4.5a.5.5 0 0 1 .5.5v8.5a.5.5 0 0 1-1 0V5a.5.5 0 0 1 .5-.5"/>
|
|
238
|
+
</svg>
|
|
239
|
+
</button>
|
|
240
|
+
</pb-restricted>
|
|
241
|
+
`
|
|
242
|
+
: null}
|
|
243
|
+
<a
|
|
244
|
+
href="odd-editor.html?odd=${odd.name}.odd"
|
|
245
|
+
target="_blank"
|
|
246
|
+
class="editor-link"
|
|
247
|
+
title="edit ODD in graphical editor"
|
|
248
|
+
>
|
|
249
|
+
<button type="button">
|
|
250
|
+
<svg
|
|
251
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
252
|
+
width="16"
|
|
253
|
+
height="16"
|
|
254
|
+
fill="currentColor"
|
|
255
|
+
class="bi bi-card-heading"
|
|
256
|
+
viewBox="0 0 16 16"
|
|
257
|
+
>
|
|
258
|
+
<path
|
|
259
|
+
d="M14.5 3a.5.5 0 0 1 .5.5v9a.5.5 0 0 1-.5.5h-13a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5zm-13-1A1.5 1.5 0 0 0 0 3.5v9A1.5 1.5 0 0 0 1.5 14h13a1.5 1.5 0 0 0 1.5-1.5v-9A1.5 1.5 0 0 0 14.5 2z"
|
|
260
|
+
/>
|
|
261
|
+
<path
|
|
262
|
+
d="M3 8.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0 2a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5m0-5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5z"
|
|
263
|
+
/>
|
|
264
|
+
</svg>
|
|
265
|
+
</button>
|
|
266
|
+
</a>
|
|
267
|
+
<pb-edit-xml path="${odd.path}" class="editor-link">
|
|
268
|
+
<button title="Edit XML" type="button">
|
|
269
|
+
<svg
|
|
270
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
271
|
+
width="16"
|
|
272
|
+
height="16"
|
|
273
|
+
fill="currentColor"
|
|
274
|
+
class="bi bi-pencil"
|
|
275
|
+
viewBox="0 0 16 16"
|
|
276
|
+
>
|
|
277
|
+
<path
|
|
278
|
+
d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10l.293.293 6.5-6.5zm-9.761 5.175-.106.106-1.528 3.881 3.881-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z"
|
|
279
|
+
/>
|
|
280
|
+
</svg>
|
|
281
|
+
</button>
|
|
282
|
+
</pb-edit-xml>
|
|
283
|
+
</header>
|
|
284
|
+
</div>
|
|
285
|
+
<div class="odd-description">${odd.description}</div>
|
|
286
|
+
</div>
|
|
287
|
+
`,
|
|
288
|
+
)}
|
|
289
|
+
<pb-restricted login="login">
|
|
290
|
+
<form action="" method="GET">
|
|
291
|
+
<input
|
|
292
|
+
id="new_odd"
|
|
293
|
+
name="new_odd"
|
|
294
|
+
type="text"
|
|
295
|
+
required
|
|
296
|
+
pattern="[a-zA-Z0-9-_]+"
|
|
297
|
+
placeholder="${translate('odd.manage.filename')}"
|
|
298
|
+
/>
|
|
299
|
+
<input
|
|
300
|
+
id="title"
|
|
301
|
+
name="title"
|
|
302
|
+
type="text"
|
|
303
|
+
required
|
|
304
|
+
minlength="1"
|
|
305
|
+
placeholder="${translate('odd.manage.title')}"
|
|
306
|
+
/>
|
|
307
|
+
<button id="createBtn" @click="${this._createODD}" type="button">
|
|
308
|
+
<svg
|
|
309
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
310
|
+
width="16"
|
|
311
|
+
height="16"
|
|
312
|
+
fill="currentColor"
|
|
313
|
+
class="bi bi-file-earmark-plus"
|
|
314
|
+
viewBox="0 0 16 16"
|
|
315
|
+
>
|
|
316
|
+
<path
|
|
317
|
+
d="M8 6.5a.5.5 0 0 1 .5.5v1.5H10a.5.5 0 0 1 0 1H8.5V11a.5.5 0 0 1-1 0V9.5H6a.5.5 0 0 1 0-1h1.5V7a.5.5 0 0 1 .5-.5"
|
|
318
|
+
/>
|
|
319
|
+
<path
|
|
320
|
+
d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z"
|
|
321
|
+
/>
|
|
322
|
+
</svg>
|
|
323
|
+
<span>${translate('odd.manage.create')}</span>
|
|
324
|
+
</button>
|
|
325
|
+
</form>
|
|
326
|
+
</pb-restricted>
|
|
327
|
+
<pb-ajax id="regenerate" url="${regenUrl}" method="post"></pb-ajax>
|
|
328
|
+
<pb-fetch
|
|
329
|
+
id="load"
|
|
330
|
+
verbose
|
|
331
|
+
handle-as="json"
|
|
332
|
+
method="get"
|
|
333
|
+
with-credentials
|
|
334
|
+
@response="${this._update}"
|
|
335
|
+
>
|
|
336
|
+
</pb-fetch>
|
|
337
|
+
<pb-fetch id="delete" method="delete" with-credentials @error="${this._deleted}"></pb-fetch>
|
|
338
|
+
<pb-fetch
|
|
339
|
+
id="create"
|
|
340
|
+
method="post"
|
|
341
|
+
with-credentials
|
|
342
|
+
@response="${this._created}"
|
|
343
|
+
@error="${this._created}"
|
|
344
|
+
></pb-fetch>
|
|
345
|
+
<pb-dialog id="deleteDialog" title="${translate('browse.delete')}">
|
|
346
|
+
<p>${translate('odd.manage.delete', { file: this.file })}</p>
|
|
347
|
+
<div slot="footer">
|
|
348
|
+
<button autofocus @click="${this._confirmDelete}" rel="prev" type="button">
|
|
349
|
+
${translate('dialogs.yes')}
|
|
350
|
+
</button>
|
|
351
|
+
<button rel="prev" type="button">${translate('dialogs.no')}</button>
|
|
352
|
+
</div>
|
|
353
|
+
</pb-dialog>
|
|
354
|
+
`;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
static get styles() {
|
|
358
|
+
return css`
|
|
359
|
+
:host {
|
|
360
|
+
display: block;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.odd-container {
|
|
364
|
+
margin-bottom: 0.5rem;
|
|
365
|
+
border-bottom: 1px solid var(--pb-manage-odds-border-color, #e0e0e0);
|
|
366
|
+
padding-bottom: 0.5rem;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.odd {
|
|
370
|
+
display: flex;
|
|
371
|
+
flex-direction: row;
|
|
372
|
+
align-items: center;
|
|
373
|
+
justify-content: space-between;
|
|
374
|
+
gap: 0.5rem;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.odd a,
|
|
378
|
+
.odd a:link,
|
|
379
|
+
.odd a:visited {
|
|
380
|
+
display: block;
|
|
381
|
+
color: var(--pb-manage-odds-link-color);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
.odd > header {
|
|
385
|
+
display: inline-flex;
|
|
386
|
+
column-gap: 0.25rem;
|
|
387
|
+
justify-content: flex-end;
|
|
388
|
+
align-items: center;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
pb-restricted {
|
|
392
|
+
display: inline-block;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.odd-description {
|
|
396
|
+
color: #888888;
|
|
397
|
+
font-size: 0.8em;
|
|
398
|
+
margin-top: 0.5rem;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
form {
|
|
402
|
+
margin-top: 1rem;
|
|
403
|
+
}
|
|
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
|
}
|