@teipublisher/pb-components 2.26.0-next-3.9 → 2.26.0-next-3.10
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/CHANGELOG.md +7 -0
- package/dist/{iron-form-b76df6d4.js → iron-form-277f9d42.js} +1 -1
- package/dist/{paper-listbox-9b2edde9.js → paper-listbox-c2468542.js} +46 -46
- package/dist/pb-components-bundle.js +2 -2
- package/dist/pb-edit-app.js +1 -1
- package/dist/pb-elements.json +14 -37
- package/dist/pb-odd-editor.js +60 -56
- package/dist/{vaadin-element-mixin-497e09e1.js → vaadin-element-mixin-6633322b.js} +111 -70
- package/package.json +1 -2
- package/pb-elements.json +14 -37
- package/src/pb-collapse.js +106 -51
- package/src/pb-odd-editor.js +24 -26
- package/src/pb-odd-elementspec-editor.js +3 -3
- package/src/pb-odd-model-editor.js +31 -25
package/pb-elements.json
CHANGED
|
@@ -2587,15 +2587,9 @@
|
|
|
2587
2587
|
"path": "./src/pb-collapse.js",
|
|
2588
2588
|
"description": "A collapsible block: in collapsed state it only shows a header and expands if clicked.\nThe header should go into slot `collapse-trigger`, the content into `collapse-content`.\nExample:\n\n```html\n<pb-collapse>\n <div slot=\"collapse-trigger\">\n Metadata\n </div>\n <pb-view slot=\"collapse-content\" src=\"document1\" subscribe=\"transcription\" xpath=\"//teiHeader\"></pb-view>\n</pb-collapse>\n```\n\nBy adding a CSS 'icon-right' to a `pb-collapse` the icon can be placed on the right side\n```\n<pb-collapse class='icon-right'>\n```",
|
|
2589
2589
|
"attributes": [
|
|
2590
|
-
{
|
|
2591
|
-
"name": "horizontal",
|
|
2592
|
-
"type": "boolean",
|
|
2593
|
-
"default": "false",
|
|
2594
|
-
"deprecatedMessage": "Corresponds to the iron-collapse's horizontal property."
|
|
2595
|
-
},
|
|
2596
2590
|
{
|
|
2597
2591
|
"name": "no-animation",
|
|
2598
|
-
"description": "
|
|
2592
|
+
"description": "Whether to disable animations.",
|
|
2599
2593
|
"type": "boolean",
|
|
2600
2594
|
"default": "false"
|
|
2601
2595
|
},
|
|
@@ -2605,24 +2599,6 @@
|
|
|
2605
2599
|
"type": "boolean",
|
|
2606
2600
|
"default": "false"
|
|
2607
2601
|
},
|
|
2608
|
-
{
|
|
2609
|
-
"name": "expand-icon",
|
|
2610
|
-
"description": "The iron-icon when collapsed. Value must be one of the icons defined by iron-icons",
|
|
2611
|
-
"type": "string",
|
|
2612
|
-
"default": "\"icons:expand-more\""
|
|
2613
|
-
},
|
|
2614
|
-
{
|
|
2615
|
-
"name": "collapse-icon",
|
|
2616
|
-
"description": "The icon when expanded.",
|
|
2617
|
-
"type": "string",
|
|
2618
|
-
"default": "\"icons:expand-less\""
|
|
2619
|
-
},
|
|
2620
|
-
{
|
|
2621
|
-
"name": "no-icons",
|
|
2622
|
-
"description": "Whether to hide the expand/collapse icon.",
|
|
2623
|
-
"type": "boolean",
|
|
2624
|
-
"default": "false"
|
|
2625
|
-
},
|
|
2626
2602
|
{
|
|
2627
2603
|
"name": "toggles",
|
|
2628
2604
|
"description": "By default, an open collapse is closed if another pb-collapse is expanded on the same event channel.\nSet to true to keep multiple pb-collapse open at the same time.",
|
|
@@ -2664,15 +2640,13 @@
|
|
|
2664
2640
|
"properties": [
|
|
2665
2641
|
{
|
|
2666
2642
|
"name": "horizontal",
|
|
2667
|
-
"attribute": "horizontal",
|
|
2668
2643
|
"type": "boolean",
|
|
2669
|
-
"default": "false"
|
|
2670
|
-
"deprecatedMessage": "Corresponds to the iron-collapse's horizontal property."
|
|
2644
|
+
"default": "false"
|
|
2671
2645
|
},
|
|
2672
2646
|
{
|
|
2673
2647
|
"name": "noAnimation",
|
|
2674
2648
|
"attribute": "no-animation",
|
|
2675
|
-
"description": "
|
|
2649
|
+
"description": "Whether to disable animations.",
|
|
2676
2650
|
"type": "boolean",
|
|
2677
2651
|
"default": "false"
|
|
2678
2652
|
},
|
|
@@ -2685,22 +2659,16 @@
|
|
|
2685
2659
|
},
|
|
2686
2660
|
{
|
|
2687
2661
|
"name": "expandIcon",
|
|
2688
|
-
"attribute": "expand-icon",
|
|
2689
|
-
"description": "The iron-icon when collapsed. Value must be one of the icons defined by iron-icons",
|
|
2690
2662
|
"type": "string",
|
|
2691
2663
|
"default": "\"icons:expand-more\""
|
|
2692
2664
|
},
|
|
2693
2665
|
{
|
|
2694
2666
|
"name": "collapseIcon",
|
|
2695
|
-
"attribute": "collapse-icon",
|
|
2696
|
-
"description": "The icon when expanded.",
|
|
2697
2667
|
"type": "string",
|
|
2698
2668
|
"default": "\"icons:expand-less\""
|
|
2699
2669
|
},
|
|
2700
2670
|
{
|
|
2701
2671
|
"name": "noIcons",
|
|
2702
|
-
"attribute": "no-icons",
|
|
2703
|
-
"description": "Whether to hide the expand/collapse icon.",
|
|
2704
2672
|
"type": "boolean",
|
|
2705
2673
|
"default": "false"
|
|
2706
2674
|
},
|
|
@@ -2768,8 +2736,17 @@
|
|
|
2768
2736
|
"cssProperties": [
|
|
2769
2737
|
{
|
|
2770
2738
|
"name": "--pb-collapse-icon-padding",
|
|
2771
|
-
"description": "padding
|
|
2772
|
-
"default": "\"
|
|
2739
|
+
"description": "padding left or right of the \"caret\" icon left to the collapsible item",
|
|
2740
|
+
"default": "\".5rem\""
|
|
2741
|
+
},
|
|
2742
|
+
{
|
|
2743
|
+
"name": "--pb-collapse-icon-size",
|
|
2744
|
+
"description": "size of the \"caret\" icon left to the collapsible item",
|
|
2745
|
+
"default": "\".75rem\""
|
|
2746
|
+
},
|
|
2747
|
+
{
|
|
2748
|
+
"name": "--pb-collapse-icon-image",
|
|
2749
|
+
"description": "image of the \"caret\" icon left to the collapsible item"
|
|
2773
2750
|
}
|
|
2774
2751
|
]
|
|
2775
2752
|
},
|
package/src/pb-collapse.js
CHANGED
|
@@ -3,7 +3,6 @@ import {pbMixin} from './pb-mixin.js';
|
|
|
3
3
|
import {themableMixin} from "./theming.js";
|
|
4
4
|
import '@polymer/iron-icon';
|
|
5
5
|
import '@polymer/iron-icons';
|
|
6
|
-
import '@polymer/iron-collapse';
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -27,7 +26,9 @@ import '@polymer/iron-collapse';
|
|
|
27
26
|
*
|
|
28
27
|
* @slot collapse-trigger - trigger toggling collapsed content on/off
|
|
29
28
|
* @slot collapse-content - content to be collapsed
|
|
30
|
-
* @cssprop [--pb-collapse-icon-padding
|
|
29
|
+
* @cssprop [--pb-collapse-icon-padding=.5rem] - padding left or right of the "caret" icon left to the collapsible item
|
|
30
|
+
* @cssprop [--pb-collapse-icon-size=.75rem] - size of the "caret" icon left to the collapsible item
|
|
31
|
+
* @cssprop [--pb-collapse-icon-image] - image of the "caret" icon left to the collapsible item
|
|
31
32
|
* @fires pb-collapse-open - Fires opening the collapsed section
|
|
32
33
|
*/
|
|
33
34
|
export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
@@ -35,14 +36,7 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
35
36
|
return {
|
|
36
37
|
...super.properties,
|
|
37
38
|
/**
|
|
38
|
-
*
|
|
39
|
-
* Corresponds to the iron-collapse's horizontal property.
|
|
40
|
-
*/
|
|
41
|
-
horizontal: {
|
|
42
|
-
type: Boolean
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* Corresponds to the iron-collapse's noAnimation property.
|
|
39
|
+
* Whether to disable animations.
|
|
46
40
|
*
|
|
47
41
|
*/
|
|
48
42
|
noAnimation: {
|
|
@@ -62,27 +56,6 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
62
56
|
*/
|
|
63
57
|
toggles: {
|
|
64
58
|
type: Boolean
|
|
65
|
-
},
|
|
66
|
-
/**
|
|
67
|
-
* The iron-icon when collapsed. Value must be one of the icons defined by iron-icons
|
|
68
|
-
*/
|
|
69
|
-
expandIcon: {
|
|
70
|
-
type: String,
|
|
71
|
-
attribute: 'expand-icon'
|
|
72
|
-
},
|
|
73
|
-
/**
|
|
74
|
-
* The icon when expanded.
|
|
75
|
-
*/
|
|
76
|
-
collapseIcon: {
|
|
77
|
-
type: String,
|
|
78
|
-
attribute: 'collapse-icon'
|
|
79
|
-
},
|
|
80
|
-
/**
|
|
81
|
-
* Whether to hide the expand/collapse icon.
|
|
82
|
-
*/
|
|
83
|
-
noIcons: {
|
|
84
|
-
type: Boolean,
|
|
85
|
-
attribute: 'no-icons'
|
|
86
59
|
}
|
|
87
60
|
};
|
|
88
61
|
}
|
|
@@ -118,6 +91,16 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
118
91
|
}
|
|
119
92
|
}
|
|
120
93
|
|
|
94
|
+
updated(changedProperties) {
|
|
95
|
+
super.updated(changedProperties);
|
|
96
|
+
if (changedProperties.has('opened')) {
|
|
97
|
+
const details = this.shadowRoot.querySelector('details');
|
|
98
|
+
if (details) {
|
|
99
|
+
details.open = this.opened;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
121
104
|
/**
|
|
122
105
|
* opens the collapsible section
|
|
123
106
|
*/
|
|
@@ -149,19 +132,21 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
149
132
|
}
|
|
150
133
|
}
|
|
151
134
|
|
|
135
|
+
_handleToggle(e) {
|
|
136
|
+
e.preventDefault();
|
|
137
|
+
this.toggle();
|
|
138
|
+
}
|
|
139
|
+
|
|
152
140
|
render() {
|
|
153
141
|
return html`
|
|
154
|
-
<
|
|
155
|
-
${
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
</
|
|
162
|
-
<iron-collapse id="collapse" horizontal="${this.horizontal}" no-animation="${this.noAnimation}" .opened="${this.opened}">
|
|
163
|
-
<slot name="collapse-content"></slot>
|
|
164
|
-
</iron-collapse>
|
|
142
|
+
<details ?open="${this.opened}" class="${this.horizontal ? 'horizontal' : ''}">
|
|
143
|
+
<summary @click="${this._handleToggle}" class="collapse-trigger">
|
|
144
|
+
<slot id="collapseTrigger" name="collapse-trigger"></slot>
|
|
145
|
+
</summary>
|
|
146
|
+
<div class="collapse-content ${this.noAnimation ? 'no-animation' : ''}">
|
|
147
|
+
<slot name="collapse-content"></slot>
|
|
148
|
+
</div>
|
|
149
|
+
</details>
|
|
165
150
|
`;
|
|
166
151
|
}
|
|
167
152
|
|
|
@@ -172,21 +157,91 @@ export class PbCollapse extends themableMixin(pbMixin(LitElement)) {
|
|
|
172
157
|
position: relative;
|
|
173
158
|
}
|
|
174
159
|
|
|
175
|
-
|
|
176
|
-
display:
|
|
177
|
-
align-items:center;
|
|
178
|
-
grid-template-columns:min-content auto;
|
|
160
|
+
details {
|
|
161
|
+
display: block;
|
|
179
162
|
}
|
|
180
163
|
|
|
181
|
-
|
|
182
|
-
|
|
164
|
+
summary {
|
|
165
|
+
display: inline-flex;
|
|
166
|
+
align-items: center;
|
|
167
|
+
cursor: pointer;
|
|
168
|
+
list-style: none;
|
|
169
|
+
outline: none;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
user-select: none;
|
|
172
|
+
gap: var(--pb-collapse-icon-padding, .5rem);
|
|
183
173
|
}
|
|
184
174
|
|
|
185
|
-
:host(.icon-right)
|
|
186
|
-
|
|
187
|
-
|
|
175
|
+
:host(:not(.icon-right)) summary::before {
|
|
176
|
+
display: block;
|
|
177
|
+
content: "";
|
|
178
|
+
background-image: var(--pb-collapse-icon-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E"));
|
|
179
|
+
transform: none;
|
|
180
|
+
height: var(--pb-collapse-icon-size, .75rem);
|
|
181
|
+
width: var(--pb-collapse-icon-size, .75rem);
|
|
182
|
+
background-size: var(--pb-collapse-icon-size, .75rem) auto;
|
|
183
|
+
background-position: left center;
|
|
184
|
+
background-repeat: no-repeat;
|
|
188
185
|
}
|
|
189
186
|
|
|
187
|
+
:host(.icon-right) summary::after {
|
|
188
|
+
display: block;
|
|
189
|
+
content: "";
|
|
190
|
+
background-image: var(--pb-collapse-icon-image, url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-chevron-down' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E"));
|
|
191
|
+
transform: none;
|
|
192
|
+
height: var(--pb-collapse-icon-size, .75rem);
|
|
193
|
+
width: var(--pb-collapse-icon-size, .75rem);
|
|
194
|
+
background-size: var(--pb-collapse-icon-size, .75rem) auto;
|
|
195
|
+
background-position: right center;
|
|
196
|
+
background-repeat: no-repeat;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.dropdown-button[open]>summary::after {
|
|
200
|
+
transform: rotate(180deg);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.collapse-content {
|
|
204
|
+
overflow: hidden;
|
|
205
|
+
transition: max-height 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.collapse-content.no-animation {
|
|
209
|
+
transition: none;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
details[open] .collapse-content {
|
|
213
|
+
animation: slideDown 0.3s ease-in-out;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
details:not([open]) .collapse-content {
|
|
217
|
+
animation: slideUp 0.3s ease-in-out;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.horizontal .collapse-content {
|
|
221
|
+
transition: max-width 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@keyframes slideDown {
|
|
225
|
+
from {
|
|
226
|
+
opacity: 0;
|
|
227
|
+
max-height: 0;
|
|
228
|
+
}
|
|
229
|
+
to {
|
|
230
|
+
opacity: 1;
|
|
231
|
+
max-height: 1000px;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
@keyframes slideUp {
|
|
236
|
+
from {
|
|
237
|
+
opacity: 1;
|
|
238
|
+
max-height: 1000px;
|
|
239
|
+
}
|
|
240
|
+
to {
|
|
241
|
+
opacity: 0;
|
|
242
|
+
max-height: 0;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
190
245
|
`;
|
|
191
246
|
}
|
|
192
247
|
}
|
package/src/pb-odd-editor.js
CHANGED
|
@@ -45,7 +45,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
45
45
|
padding:0;
|
|
46
46
|
height:auto;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
|
|
49
49
|
#layout {
|
|
50
50
|
width: 100%;
|
|
51
51
|
display: grid;
|
|
@@ -131,15 +131,13 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
131
131
|
white-space: nowrap;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
/*height:56px;*/
|
|
134
|
+
details {
|
|
135
|
+
--details-transition-duration:0.8s;
|
|
137
136
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
--iron-collapse-transition-duration:0.8s;
|
|
137
|
+
details[open] {
|
|
138
|
+
padding: 0;
|
|
141
139
|
}
|
|
142
|
-
|
|
140
|
+
|
|
143
141
|
pb-message#errorMsg{
|
|
144
142
|
background: var(--paper-red-500);
|
|
145
143
|
color:white;
|
|
@@ -148,19 +146,19 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
148
146
|
height:100%;
|
|
149
147
|
overflow:auto;
|
|
150
148
|
}
|
|
151
|
-
|
|
149
|
+
|
|
152
150
|
paper-tab{
|
|
153
151
|
width:100px;
|
|
154
152
|
}
|
|
155
|
-
|
|
153
|
+
|
|
156
154
|
.editingView {
|
|
157
155
|
width:100%;
|
|
158
156
|
}
|
|
159
|
-
|
|
157
|
+
|
|
160
158
|
vaadin-tabs{
|
|
161
159
|
margin-top:10px;
|
|
162
160
|
}
|
|
163
|
-
|
|
161
|
+
|
|
164
162
|
vaadin-tab{
|
|
165
163
|
background:var(--paper-grey-200);
|
|
166
164
|
padding:0 6px;
|
|
@@ -300,7 +298,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
300
298
|
handle-as="json" content-type="application/x-www-form-urlencoded"
|
|
301
299
|
with-credentials
|
|
302
300
|
method="GET"></iron-ajax>
|
|
303
|
-
|
|
301
|
+
|
|
304
302
|
<iron-ajax id="saveOdd"
|
|
305
303
|
handle-as="json"
|
|
306
304
|
with-credentials></iron-ajax>
|
|
@@ -315,7 +313,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
315
313
|
<pb-edit-xml id="editSource"><paper-icon-button icon="code" title="${translate('odd.editor.odd-source')}"></paper-icon-button></pb-edit-xml>
|
|
316
314
|
<paper-icon-button @click="${() => this.save(true)}" icon="icons:cloud-download" title="${fsSupported ? translate('odd.editor.save-as'): translate('odd.editor.download')}"></paper-icon-button>
|
|
317
315
|
<paper-icon-button @click="${this._reload}" icon="refresh" title="${translate('odd.editor.reload')}"></paper-icon-button>
|
|
318
|
-
<paper-icon-button @click="${() => this.save(false)}" icon="save" title="${translate('odd.editor.save')} ${this.display('save')}"
|
|
316
|
+
<paper-icon-button @click="${() => this.save(false)}" icon="save" title="${translate('odd.editor.save')} ${this.display('save')}"
|
|
319
317
|
?disabled="${!this.loggedIn}"></paper-icon-button>
|
|
320
318
|
</span>
|
|
321
319
|
</h3>
|
|
@@ -328,7 +326,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
328
326
|
<div id="jump-to">
|
|
329
327
|
<paper-autocomplete id="jumpTo" label="${translate('odd.editor.jump-to')}" always-float-label="always-float-label"></paper-autocomplete>
|
|
330
328
|
</div>
|
|
331
|
-
|
|
329
|
+
|
|
332
330
|
<h3>${translate('odd.editor.specs')}</h3>
|
|
333
331
|
</div>
|
|
334
332
|
<div id="navlist">
|
|
@@ -340,7 +338,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
340
338
|
`)}
|
|
341
339
|
</div>
|
|
342
340
|
<section class="specs" id="specs">
|
|
343
|
-
|
|
341
|
+
|
|
344
342
|
<paper-card class="metadata">
|
|
345
343
|
<pb-collapse id="meta">
|
|
346
344
|
<h4 slot="collapse-trigger" class="panel-title">
|
|
@@ -372,21 +370,21 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
372
370
|
</div>
|
|
373
371
|
</pb-collapse>
|
|
374
372
|
</paper-card>
|
|
375
|
-
|
|
373
|
+
|
|
376
374
|
<!-- todo: import elementspec to make it function -->
|
|
377
|
-
|
|
375
|
+
|
|
378
376
|
<div class="editingView">
|
|
379
377
|
<vaadin-tabs id="tabs" selected="${this.tabIndex}">
|
|
380
378
|
${repeat(this.tabs, (i) => i.id, (i, index) =>
|
|
381
379
|
html`
|
|
382
380
|
<vaadin-tab name="${i}" @click="${(e) => this._selectTab(e, i)}"><span style="padding-right:20px;">${i}</span><paper-icon-button icon="close" @click="${(ev) => this._closeTabHandler(ev, index)}"></paper-icon-button></vaadin-tab>
|
|
383
|
-
`)}
|
|
381
|
+
`)}
|
|
384
382
|
</vaadin-tabs>
|
|
385
|
-
|
|
383
|
+
|
|
386
384
|
<div id="currentElement"></div>
|
|
387
385
|
</div>
|
|
388
386
|
</section>
|
|
389
|
-
|
|
387
|
+
|
|
390
388
|
</div>
|
|
391
389
|
|
|
392
390
|
|
|
@@ -921,7 +919,7 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
921
919
|
"output-root": this.outputRoot,};
|
|
922
920
|
saveOdd.body = data;
|
|
923
921
|
}
|
|
924
|
-
|
|
922
|
+
|
|
925
923
|
const request = saveOdd.generateRequest();
|
|
926
924
|
request.completes
|
|
927
925
|
.then((req) => {
|
|
@@ -956,9 +954,9 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
956
954
|
document.dispatchEvent(new CustomEvent('pb-end-update'));
|
|
957
955
|
return;
|
|
958
956
|
}
|
|
959
|
-
|
|
957
|
+
|
|
960
958
|
let msg;
|
|
961
|
-
|
|
959
|
+
|
|
962
960
|
if (this.lessThanApiVersion('1.0.0')) {
|
|
963
961
|
const report = data.report.map(PbOddEditor._renderReport);
|
|
964
962
|
msg = `<div class="list-group">${report.join('')}</div>`;
|
|
@@ -966,9 +964,9 @@ export class PbOddEditor extends pbHotkeys(pbMixin(LitElement)) {
|
|
|
966
964
|
const report = data.report;
|
|
967
965
|
msg = `<div class="list-group">${report}</div>`;
|
|
968
966
|
}
|
|
969
|
-
|
|
967
|
+
|
|
970
968
|
this.shadowRoot.getElementById('dialog').set(i18n("odd.editor.saved"), msg);
|
|
971
|
-
|
|
969
|
+
|
|
972
970
|
this._hasChanges = false;
|
|
973
971
|
document.dispatchEvent(new CustomEvent('pb-end-update'));
|
|
974
972
|
|
|
@@ -12,7 +12,7 @@ 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
|
|
|
@@ -95,8 +95,8 @@ export class PbOddElementspecEditor extends LitElement {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/*todo: this does not take effect*/
|
|
98
|
-
|
|
99
|
-
--
|
|
98
|
+
details.models{
|
|
99
|
+
--details-transition-duration:0.4s;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
.models{
|
|
@@ -13,7 +13,7 @@ import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
|
|
|
13
13
|
import '@polymer/paper-listbox/paper-listbox.js';
|
|
14
14
|
import '@polymer/paper-item/paper-item.js';
|
|
15
15
|
import '@polymer/paper-styles/color.js';
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
import "@jinntec/jinn-codemirror/dist/src/jinn-codemirror";
|
|
18
18
|
|
|
19
19
|
import { cmpVersion } from './utils.js';
|
|
@@ -149,7 +149,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
149
149
|
display:inline;
|
|
150
150
|
align-self:stretch;
|
|
151
151
|
}
|
|
152
|
-
|
|
152
|
+
|
|
153
153
|
.group {
|
|
154
154
|
margin: 0;
|
|
155
155
|
font-size: 16px;
|
|
@@ -199,20 +199,25 @@ export class PbOddModelEditor extends LitElement {
|
|
|
199
199
|
:host([currentselection]) > form > header > h4 > .btn-group{
|
|
200
200
|
display: inline-block;
|
|
201
201
|
}
|
|
202
|
-
|
|
202
|
+
details {
|
|
203
|
+
display: block;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
details summary {
|
|
207
|
+
display: none;
|
|
203
208
|
}
|
|
204
209
|
|
|
205
210
|
.renditions{
|
|
206
211
|
margin-top:10px;
|
|
207
212
|
}
|
|
208
|
-
|
|
213
|
+
|
|
209
214
|
.details{
|
|
210
215
|
padding:0px 50px 20px 20px;
|
|
211
216
|
background:var(--paper-grey-200);
|
|
212
217
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
218
|
+
|
|
219
|
+
details:not([open]) {
|
|
220
|
+
padding: 0;
|
|
216
221
|
}
|
|
217
222
|
|
|
218
223
|
.editor label {
|
|
@@ -425,12 +430,12 @@ export class PbOddModelEditor extends LitElement {
|
|
|
425
430
|
}
|
|
426
431
|
return html`
|
|
427
432
|
<form>
|
|
428
|
-
<header>
|
|
433
|
+
<header>
|
|
429
434
|
<h4>
|
|
430
435
|
<paper-icon-button id="toggle"
|
|
431
436
|
icon="${this.icon}" @click="${this.toggle}"
|
|
432
437
|
class="model-collapse"></paper-icon-button>
|
|
433
|
-
|
|
438
|
+
|
|
434
439
|
<span class="modelType">${this.type}<span class="behaviour" ?hidden="${this._isGroupOrSequence()}">${this.behaviour}</span></span>
|
|
435
440
|
|
|
436
441
|
<span class="btn-group">
|
|
@@ -470,7 +475,8 @@ export class PbOddModelEditor extends LitElement {
|
|
|
470
475
|
<div class="predicate">${this.predicate}</div>
|
|
471
476
|
</p>
|
|
472
477
|
</header>
|
|
473
|
-
<
|
|
478
|
+
<details ?open="${this.show}" class="details">
|
|
479
|
+
<summary style="display: none;"></summary>
|
|
474
480
|
<div class="horizontal">
|
|
475
481
|
<paper-dropdown-menu class="selectOutput" label="Output">
|
|
476
482
|
<paper-listbox id="output" slot="dropdown-content" attr-for-selected="value"
|
|
@@ -494,13 +500,13 @@ export class PbOddModelEditor extends LitElement {
|
|
|
494
500
|
<div class="editor">
|
|
495
501
|
<label>Predicate</label>
|
|
496
502
|
<jinn-codemirror id="predicate"
|
|
497
|
-
code="${this.predicate}"
|
|
503
|
+
code="${this.predicate}"
|
|
498
504
|
mode="xquery"
|
|
499
505
|
linter="${this.endpoint}/${cmpVersion(this.apiVersion, '1.0.0') < 0 ? 'modules/editor.xql' : 'api/lint'}"
|
|
500
506
|
placeholder="${translate('odd.editor.model.predicate-placeholder')}"
|
|
501
507
|
@update="${this._updatePredicate}"></jinn-codemirror>
|
|
502
508
|
</div>
|
|
503
|
-
|
|
509
|
+
|
|
504
510
|
${this._isModel()
|
|
505
511
|
? html`
|
|
506
512
|
<div>
|
|
@@ -519,13 +525,13 @@ export class PbOddModelEditor extends LitElement {
|
|
|
519
525
|
<span></span>
|
|
520
526
|
</div>
|
|
521
527
|
|
|
522
|
-
|
|
523
|
-
|
|
528
|
+
|
|
529
|
+
|
|
524
530
|
<paper-input id="css" .value="${this.css}"
|
|
525
531
|
placeholder="${translate('odd.editor.model.css-class-placeholder')}"
|
|
526
532
|
label="CSS Class"
|
|
527
533
|
@change="${this._inputCss}"></paper-input>
|
|
528
|
-
|
|
534
|
+
|
|
529
535
|
<div class="editor">
|
|
530
536
|
<label>Template</label>
|
|
531
537
|
<jinn-codemirror id="template"
|
|
@@ -538,20 +544,20 @@ export class PbOddModelEditor extends LitElement {
|
|
|
538
544
|
title="Select element around current cursor position"><|></paper-button>
|
|
539
545
|
<paper-button data-mode="xml" data-command="encloseWith" data-key="mod-e mod-e"
|
|
540
546
|
title="Enclose selection in new element"><...></paper-button>
|
|
541
|
-
<paper-button data-mode="xml" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
547
|
+
<paper-button data-mode="xml" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
542
548
|
data-key="mod-e mod-r" class="sep"><X></paper-button>
|
|
543
549
|
<paper-button data-mode="html" data-command="selectElement" data-key="mod-e mod-s"
|
|
544
550
|
title="Select element around current cursor position"><|></paper-button>
|
|
545
551
|
<paper-button data-mode="html" data-command="encloseWith" data-key="mod-e mod-e"
|
|
546
552
|
title="Enclose selection in new element"><...></paper-button>
|
|
547
|
-
<paper-button data-mode="html" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
553
|
+
<paper-button data-mode="html" data-command="removeEnclosing" title="Remove enclosing tags"
|
|
548
554
|
data-key="mod-e mod-r" class="sep"><X></paper-button>
|
|
549
555
|
<paper-button data-key="mod-e mod-p" data-command="snippet" data-params="[[\${_}]]" title="Insert template variable">[[...]]</paper-button>
|
|
550
556
|
</div>
|
|
551
557
|
</jinn-codemirror>
|
|
552
558
|
</div>
|
|
553
559
|
</div>
|
|
554
|
-
|
|
560
|
+
|
|
555
561
|
<div class="parameters">
|
|
556
562
|
<div class="group">
|
|
557
563
|
<span class="title">Parameters</span>
|
|
@@ -560,7 +566,7 @@ export class PbOddModelEditor extends LitElement {
|
|
|
560
566
|
</div>
|
|
561
567
|
${repeat(this.parameters, (parameter) => parameter.name, (parameter, index) =>
|
|
562
568
|
html`
|
|
563
|
-
<pb-odd-parameter-editor
|
|
569
|
+
<pb-odd-parameter-editor
|
|
564
570
|
behaviour="${this.behaviour}"
|
|
565
571
|
name="${parameter.name}"
|
|
566
572
|
value="${parameter.value}"
|
|
@@ -597,11 +603,11 @@ export class PbOddModelEditor extends LitElement {
|
|
|
597
603
|
`
|
|
598
604
|
: ''
|
|
599
605
|
}
|
|
600
|
-
</
|
|
601
|
-
|
|
606
|
+
</details>
|
|
607
|
+
|
|
602
608
|
<div class="models">
|
|
603
609
|
${repeat(this.model.models, (model, index) => html`
|
|
604
|
-
<pb-odd-model-editor
|
|
610
|
+
<pb-odd-model-editor
|
|
605
611
|
behaviour="${model.behaviour || 'inline'}"
|
|
606
612
|
predicate="${model.predicate}"
|
|
607
613
|
type="${model.type}"
|
|
@@ -625,9 +631,9 @@ export class PbOddModelEditor extends LitElement {
|
|
|
625
631
|
hasParent
|
|
626
632
|
></pb-odd-model-editor>
|
|
627
633
|
`)}
|
|
628
|
-
|
|
629
|
-
</div>
|
|
630
|
-
</form>
|
|
634
|
+
|
|
635
|
+
</div>
|
|
636
|
+
</form>
|
|
631
637
|
<pb-message id="dialog"></pb-message>
|
|
632
638
|
`;
|
|
633
639
|
}
|