@teipublisher/pb-components 2.26.1-next.2 → 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 +267 -9
- 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-6e4cee3a.js +0 -527
- package/src/assets/pb-styles.css +0 -51
- package/src/pb-light-dom.js +0 -40
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/* eslint-disable import/extensions */
|
|
3
|
-
import { LitElement, html, css } from 'lit-element'
|
|
3
|
+
import { LitElement, html, css } from 'lit-element';
|
|
4
4
|
|
|
5
5
|
import { repeat } from 'lit-html/directives/repeat';
|
|
6
6
|
|
|
@@ -12,11 +12,11 @@ import '@polymer/paper-menu-button/paper-menu-button';
|
|
|
12
12
|
import '@polymer/paper-listbox/paper-listbox';
|
|
13
13
|
import '@polymer/paper-styles/color';
|
|
14
14
|
import '@polymer/paper-item/paper-item';
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
import './pb-message.js';
|
|
17
17
|
import './pb-odd-model-editor.js';
|
|
18
18
|
|
|
19
|
-
import { get as i18n, translate } from
|
|
19
|
+
import { get as i18n, translate } from './pb-i18n.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* A wrapper for the popular codemirror code editor.
|
|
@@ -26,305 +26,356 @@ import { get as i18n, translate } from "./pb-i18n.js";
|
|
|
26
26
|
* @polymer
|
|
27
27
|
*/
|
|
28
28
|
export class PbOddElementspecEditor extends LitElement {
|
|
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
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
29
|
+
static get styles() {
|
|
30
|
+
return css`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
padding: 4px 10px;
|
|
34
|
+
height: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
h1,
|
|
38
|
+
h2,
|
|
39
|
+
h3,
|
|
40
|
+
h4,
|
|
41
|
+
h5,
|
|
42
|
+
h6 {
|
|
43
|
+
font-family: 'Oswald', Verdana, 'Helvetica', sans-serif;
|
|
44
|
+
font-weight: 400 !important;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
input {
|
|
48
|
+
vertical-align: middle;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.ident {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
font-size: 26px;
|
|
54
|
+
position: relative;
|
|
55
|
+
}
|
|
56
|
+
.mode {
|
|
57
|
+
font-size: 10px;
|
|
58
|
+
display: inline-block;
|
|
59
|
+
text-transform: uppercase;
|
|
60
|
+
border-radius: 12px;
|
|
61
|
+
color: var(--paper-grey-700);
|
|
62
|
+
background: var(--paper-grey-300);
|
|
63
|
+
padding: 2px 6px;
|
|
64
|
+
border: thin solid var(--paper-grey-500);
|
|
65
|
+
margin-left: 6px;
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 8px;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
:host([currentselection]) {
|
|
71
|
+
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12),
|
|
72
|
+
0 3px 5px -1px rgba(0, 0, 0, 0.4);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
:host([currentSelection]) > h3,
|
|
76
|
+
:host([currentSelection]) > header {
|
|
77
|
+
border-left: thin solid var(--paper-blue-500);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
h3 {
|
|
81
|
+
display: grid;
|
|
82
|
+
grid-template-columns: 260px auto 160px;
|
|
83
|
+
align-items: center;
|
|
84
|
+
}
|
|
85
|
+
h3 .controls {
|
|
86
|
+
text-align: right;
|
|
87
|
+
margin-right: 10px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
h3 .ident {
|
|
91
|
+
align-self: center;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
paper-menu-button paper-icon-button {
|
|
95
|
+
margin-left: -10px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/*todo: this does not take effect*/
|
|
99
|
+
details.models {
|
|
100
|
+
--details-transition-duration: 0.4s;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.models {
|
|
104
|
+
padding: 10px;
|
|
105
|
+
}
|
|
106
|
+
`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static get properties() {
|
|
110
|
+
return {
|
|
111
|
+
// identifier for this ´element-spec´
|
|
112
|
+
ident: {
|
|
113
|
+
type: String,
|
|
114
|
+
},
|
|
115
|
+
/**
|
|
116
|
+
* mode for an ´elementSpec` may be 'add', 'remove' or being undefined
|
|
117
|
+
*/
|
|
118
|
+
mode: {
|
|
119
|
+
type: String,
|
|
120
|
+
},
|
|
121
|
+
/**
|
|
122
|
+
* array of ODD `model` elements
|
|
123
|
+
*/
|
|
124
|
+
models: {
|
|
125
|
+
type: Array,
|
|
126
|
+
},
|
|
127
|
+
endpoint: {
|
|
128
|
+
type: String,
|
|
129
|
+
},
|
|
130
|
+
apiVersion: {
|
|
131
|
+
type: String,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
constructor() {
|
|
137
|
+
super();
|
|
138
|
+
this.ident = '';
|
|
139
|
+
this.mode = '';
|
|
140
|
+
this.models = [];
|
|
141
|
+
this.icon = 'expand-more';
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
render() {
|
|
145
|
+
return html`
|
|
146
|
+
<h3>
|
|
147
|
+
<span class="ident">${this.ident}<span class="mode">mode: ${this.mode}</span></span>
|
|
148
|
+
<span class="spacer"></span>
|
|
149
|
+
|
|
150
|
+
<span class="controls">
|
|
151
|
+
<paper-icon-button @click="${this._remove}" icon="delete"></paper-icon-button>
|
|
152
|
+
<paper-icon-button @click="${this._paste}" icon="content-paste"></paper-icon-button>
|
|
153
|
+
<paper-menu-button horizontal-align="right">
|
|
154
|
+
<paper-icon-button icon="add" slot="dropdown-trigger"></paper-icon-button>
|
|
155
|
+
<paper-listbox
|
|
156
|
+
id="addModel"
|
|
157
|
+
slot="dropdown-content"
|
|
158
|
+
@iron-select="${this._addModel}"
|
|
159
|
+
attr-for-selected="value"
|
|
160
|
+
>
|
|
161
|
+
<paper-item value="model">model</paper-item>
|
|
162
|
+
<paper-item value="modelSequence">modelSequence</paper-item>
|
|
163
|
+
<paper-item value="modelGrp">modelGrp</paper-item>
|
|
164
|
+
</paper-listbox>
|
|
165
|
+
</paper-menu-button>
|
|
166
|
+
</span>
|
|
167
|
+
</h3>
|
|
168
|
+
|
|
169
|
+
<div>
|
|
170
|
+
${repeat(
|
|
171
|
+
this.models,
|
|
172
|
+
(model, index) => html`
|
|
168
173
|
<pb-odd-model-editor
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
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
|
-
|
|
174
|
+
behaviour="${model.behaviour || ''}"
|
|
175
|
+
predicate="${model.predicate}"
|
|
176
|
+
type="${model.type}"
|
|
177
|
+
output="${model.output}"
|
|
178
|
+
css="${model.css}"
|
|
179
|
+
mode="${model.mode}"
|
|
180
|
+
.model="${model}"
|
|
181
|
+
.parameters="${model.parameters}"
|
|
182
|
+
desc="${model.desc}"
|
|
183
|
+
.sourcerend="${model.sourcerend}"
|
|
184
|
+
.renditions="${model.renditions}"
|
|
185
|
+
.template="${model.template}"
|
|
186
|
+
.show="${model.show}"
|
|
187
|
+
.endpoint="${this.endpoint}"
|
|
188
|
+
.apiVersion="${this.apiVersion}"
|
|
189
|
+
@model-remove="${this._removeModel}"
|
|
190
|
+
@model-move-down="${this._moveModelDown}"
|
|
191
|
+
@model-move-up="${this._moveModelUp}"
|
|
192
|
+
@model-changed="${this.handleModelChanged}"
|
|
193
|
+
@click="${e => this.setCurrentSelection(e, index)}"
|
|
194
|
+
></pb-odd-model-editor>
|
|
195
|
+
`,
|
|
196
|
+
)}
|
|
197
|
+
</div>
|
|
198
|
+
<pb-message id="dialog"></pb-message>
|
|
199
|
+
`;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
addModel(newModel) {
|
|
203
|
+
this.models.unshift(newModel);
|
|
204
|
+
this.requestUpdate();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
_addModel(e) {
|
|
208
|
+
console.log('ELEMENTSPEC._addModel ', e);
|
|
209
|
+
const addModel = this.shadowRoot.getElementById('addModel');
|
|
210
|
+
const newModel = {
|
|
211
|
+
behaviour: 'inline',
|
|
212
|
+
css: '',
|
|
213
|
+
mode: '',
|
|
214
|
+
predicate: '',
|
|
215
|
+
desc: '',
|
|
216
|
+
type: addModel.selected,
|
|
217
|
+
output: '',
|
|
218
|
+
template: '',
|
|
219
|
+
sourcerend: false,
|
|
220
|
+
models: [],
|
|
221
|
+
parameters: [],
|
|
222
|
+
renditions: [],
|
|
223
|
+
show: true,
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const models = Array.from(this.models);
|
|
227
|
+
models.unshift(newModel);
|
|
228
|
+
this.models = models;
|
|
229
|
+
this.dispatchEvent(
|
|
230
|
+
new CustomEvent('element-spec-changed', {
|
|
231
|
+
composed: true,
|
|
232
|
+
bubbles: true,
|
|
233
|
+
detail: { action: 'models', ident: this.ident, models: this.models },
|
|
234
|
+
}),
|
|
235
|
+
);
|
|
236
|
+
addModel.selected = '';
|
|
237
|
+
this.requestUpdate();
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
_remove(ev) {
|
|
241
|
+
this.dispatchEvent(
|
|
242
|
+
new CustomEvent('element-spec-removed', {
|
|
243
|
+
composed: true,
|
|
244
|
+
bubbles: true,
|
|
245
|
+
detail: { target: this },
|
|
246
|
+
}),
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
_paste(ev) {
|
|
251
|
+
console.log('_paste ', ev);
|
|
252
|
+
// const editor = document.querySelector('pb-odd-editor');
|
|
253
|
+
this.dispatchEvent(
|
|
254
|
+
new CustomEvent('odd-paste', { composed: true, bubbles: true, detail: { target: this } }),
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
setCurrentSelection(e, index) {
|
|
259
|
+
e.preventDefault();
|
|
260
|
+
e.stopPropagation();
|
|
261
|
+
|
|
262
|
+
// prevent event if model is already the current one
|
|
263
|
+
this._setCurrentSelection(index, e.target);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
_setCurrentSelection(index, target) {
|
|
267
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index];
|
|
268
|
+
if (!targetModel) {
|
|
269
|
+
return;
|
|
241
270
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
271
|
+
if (targetModel.hasAttribute('currentselection')) return;
|
|
272
|
+
|
|
273
|
+
this.dispatchEvent(
|
|
274
|
+
new CustomEvent('current-changed', { composed: true, bubbles: true, detail: { target } }),
|
|
275
|
+
);
|
|
276
|
+
this.requestUpdate();
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
_removeModel(ev) {
|
|
280
|
+
console.log('_removeModel ', ev);
|
|
281
|
+
ev.stopPropagation();
|
|
282
|
+
const { model } = ev.target;
|
|
283
|
+
const index = this.models.indexOf(model);
|
|
284
|
+
|
|
285
|
+
this.shadowRoot
|
|
286
|
+
.getElementById('dialog')
|
|
287
|
+
.confirm(
|
|
288
|
+
i18n('odd.editor.model.delete-model-label'),
|
|
289
|
+
i18n('odd.editor.model.delete-model-message'),
|
|
290
|
+
)
|
|
291
|
+
.then(
|
|
292
|
+
() => {
|
|
293
|
+
const models = Array.from(this.models);
|
|
294
|
+
models.splice(index, 1);
|
|
295
|
+
this.models = models;
|
|
296
|
+
this.dispatchEvent(
|
|
297
|
+
new CustomEvent('element-spec-changed', {
|
|
298
|
+
composed: true,
|
|
299
|
+
bubbles: true,
|
|
300
|
+
detail: { action: 'models', ident: this.ident, models: this.models },
|
|
301
|
+
}),
|
|
302
|
+
);
|
|
303
|
+
},
|
|
304
|
+
() => null,
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
_moveModelDown(ev) {
|
|
309
|
+
console.log('ELEMENTSPEC._moveModelDown ', ev);
|
|
310
|
+
ev.stopPropagation();
|
|
311
|
+
const { model } = ev.target;
|
|
312
|
+
const index = this.models.indexOf(model);
|
|
313
|
+
if (index === this.models.length) {
|
|
314
|
+
return;
|
|
249
315
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
316
|
+
const models = Array.from(this.models);
|
|
317
|
+
models.splice(index, 1);
|
|
318
|
+
models.splice(index + 1, 0, model);
|
|
319
|
+
this.models = models;
|
|
320
|
+
|
|
321
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index + 1];
|
|
322
|
+
if (!targetModel) {
|
|
323
|
+
return;
|
|
258
324
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
325
|
+
this._setCurrentSelection(index + 1, targetModel);
|
|
326
|
+
|
|
327
|
+
this.dispatchEvent(
|
|
328
|
+
new CustomEvent('element-spec-changed', {
|
|
329
|
+
composed: true,
|
|
330
|
+
bubbles: true,
|
|
331
|
+
detail: { action: 'models', ident: this.ident, models: this.models },
|
|
332
|
+
}),
|
|
333
|
+
);
|
|
334
|
+
// this.requestUpdate();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
_moveModelUp(ev) {
|
|
338
|
+
ev.stopPropagation();
|
|
339
|
+
const { model } = ev.target;
|
|
340
|
+
const index = this.models.indexOf(model);
|
|
341
|
+
if (index === 0) {
|
|
342
|
+
return;
|
|
274
343
|
}
|
|
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
|
-
models.
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index - 1];
|
|
312
|
-
this._setCurrentSelection(index - 1, targetModel);
|
|
313
|
-
|
|
314
|
-
this.dispatchEvent(new CustomEvent('element-spec-changed', { composed: true, bubbles: true, detail: { action: "models", ident: this.ident, models: this.models } }));
|
|
315
|
-
// this.requestUpdate();
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
handleModelChanged(ev) {
|
|
319
|
-
// console.log('ELEMENTSPEC.handleModelChanged ', ev.detail);
|
|
320
|
-
ev.stopPropagation();
|
|
321
|
-
const index = this.models.indexOf(ev.detail.oldModel);
|
|
322
|
-
const models = Array.from(this.models);
|
|
323
|
-
models.splice(index, 1, ev.detail.newModel);
|
|
324
|
-
this.models = models;
|
|
325
|
-
this.dispatchEvent(new CustomEvent('element-spec-changed', { composed: true, bubbles: true, detail: { action: "models", ident: this.ident, models: this.models } }));
|
|
326
|
-
this.requestUpdate();
|
|
327
|
-
}
|
|
328
|
-
|
|
344
|
+
const models = Array.from(this.models);
|
|
345
|
+
// remove element from models
|
|
346
|
+
models.splice(index, 1);
|
|
347
|
+
// add element to new index
|
|
348
|
+
models.splice(index - 1, 0, model);
|
|
349
|
+
this.models = models;
|
|
350
|
+
|
|
351
|
+
const targetModel = this.shadowRoot.querySelectorAll('pb-odd-model-editor')[index - 1];
|
|
352
|
+
this._setCurrentSelection(index - 1, targetModel);
|
|
353
|
+
|
|
354
|
+
this.dispatchEvent(
|
|
355
|
+
new CustomEvent('element-spec-changed', {
|
|
356
|
+
composed: true,
|
|
357
|
+
bubbles: true,
|
|
358
|
+
detail: { action: 'models', ident: this.ident, models: this.models },
|
|
359
|
+
}),
|
|
360
|
+
);
|
|
361
|
+
// this.requestUpdate();
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
handleModelChanged(ev) {
|
|
365
|
+
// console.log('ELEMENTSPEC.handleModelChanged ', ev.detail);
|
|
366
|
+
ev.stopPropagation();
|
|
367
|
+
const index = this.models.indexOf(ev.detail.oldModel);
|
|
368
|
+
const models = Array.from(this.models);
|
|
369
|
+
models.splice(index, 1, ev.detail.newModel);
|
|
370
|
+
this.models = models;
|
|
371
|
+
this.dispatchEvent(
|
|
372
|
+
new CustomEvent('element-spec-changed', {
|
|
373
|
+
composed: true,
|
|
374
|
+
bubbles: true,
|
|
375
|
+
detail: { action: 'models', ident: this.ident, models: this.models },
|
|
376
|
+
}),
|
|
377
|
+
);
|
|
378
|
+
this.requestUpdate();
|
|
379
|
+
}
|
|
329
380
|
}
|
|
330
381
|
customElements.define('pb-odd-elementspec-editor', PbOddElementspecEditor);
|