@operato/process 1.1.5 → 1.1.6
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 +9 -0
- package/dist/src/modeller/property-sidebar/effects/effects.d.ts +2 -0
- package/dist/src/modeller/property-sidebar/effects/effects.js +6 -1
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +20 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +127 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +28 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +199 -0
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +22 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.js +67 -0
- package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +2 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js +7 -0
- package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -1
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +5 -7
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +84 -17
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/modeller/property-sidebar/effects/effects.ts +6 -1
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +140 -0
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +208 -0
- package/src/modeller/property-sidebar/effects/property-event.ts +76 -0
- package/src/modeller/property-sidebar/property-sidebar.ts +7 -0
- package/src/modeller/property-sidebar/shapes/shapes.ts +85 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/process",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Webcomponent for business process modeling following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"prettier --write"
|
|
112
112
|
]
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "a9107bdc1b3e5e0cb0a345f45d41a4077a515bfe"
|
|
115
115
|
}
|
|
@@ -13,6 +13,7 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
|
13
13
|
|
|
14
14
|
import { AbstractProperty } from '../abstract-property.js'
|
|
15
15
|
import { PropertySharedStyle } from '../property-shared-style.js'
|
|
16
|
+
import { PropertyEvent } from './property-event.js'
|
|
16
17
|
import { PropertyShadow } from './property-shadow.js'
|
|
17
18
|
|
|
18
19
|
export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
|
|
@@ -27,7 +28,8 @@ export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
|
|
|
27
28
|
|
|
28
29
|
static get scopedElements() {
|
|
29
30
|
return {
|
|
30
|
-
'process-property-shadow': PropertyShadow
|
|
31
|
+
'process-property-shadow': PropertyShadow,
|
|
32
|
+
'process-property-event': PropertyEvent
|
|
31
33
|
}
|
|
32
34
|
}
|
|
33
35
|
|
|
@@ -42,6 +44,9 @@ export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
|
|
|
42
44
|
|
|
43
45
|
<process-property-shadow value-key="shadow" .value=${value.shadow || {}}> </process-property-shadow>
|
|
44
46
|
</fieldset>
|
|
47
|
+
|
|
48
|
+
<process-property-event value-key="event" .scene=${this.scene} .value=${value.event || {}}>
|
|
49
|
+
</process-property-event>
|
|
45
50
|
`
|
|
46
51
|
}
|
|
47
52
|
}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@operato/input/ox-input-data.js'
|
|
6
|
+
import '@operato/i18n/ox-i18n.js'
|
|
7
|
+
|
|
8
|
+
import { html, LitElement } from 'lit'
|
|
9
|
+
import { property } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
12
|
+
|
|
13
|
+
import { EffectsSharedStyle } from './effects-shared-style.js'
|
|
14
|
+
import { convert } from './value-converter'
|
|
15
|
+
|
|
16
|
+
export class PropertyEventHover extends LitElement {
|
|
17
|
+
static styles = [EffectsSharedStyle]
|
|
18
|
+
|
|
19
|
+
@property({ type: Object }) value?: Properties
|
|
20
|
+
@property({ type: Object }) scene?: Scene
|
|
21
|
+
|
|
22
|
+
firstUpdated() {
|
|
23
|
+
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
render() {
|
|
27
|
+
var { action, value = '', target = '', emphasize, restore } = this.value || {}
|
|
28
|
+
|
|
29
|
+
return html`
|
|
30
|
+
<input id="checkbox-emphasize" type="checkbox" value-key="emphasize" .checked=${emphasize} />
|
|
31
|
+
<label for="checkbox-emphasize" class="checkbox-label">
|
|
32
|
+
<ox-i18n msgid="label.emphasize">emphasize</ox-i18n>
|
|
33
|
+
</label>
|
|
34
|
+
|
|
35
|
+
<label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
|
|
36
|
+
<select id="tap-select" value-key="action" .value=${action || ''}>
|
|
37
|
+
<option value=""></option>
|
|
38
|
+
<option value="popup">popup target board</option>
|
|
39
|
+
</select>
|
|
40
|
+
|
|
41
|
+
<label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
|
|
42
|
+
|
|
43
|
+
${action == 'popup'
|
|
44
|
+
? html`
|
|
45
|
+
<things-editor-board-selector
|
|
46
|
+
value-key="target"
|
|
47
|
+
.value=${target}
|
|
48
|
+
custom-editor
|
|
49
|
+
></things-editor-board-selector>
|
|
50
|
+
`
|
|
51
|
+
: html`
|
|
52
|
+
<input
|
|
53
|
+
value-key="target"
|
|
54
|
+
.value=${target || ''}
|
|
55
|
+
list="target-list"
|
|
56
|
+
.placeholder="${this._getPlaceHoder(action)}"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<datalist id="target-list">
|
|
60
|
+
${this._getTargetList(action).map(
|
|
61
|
+
({ value, description }) => html` <option .value=${value}>${description}</option> `
|
|
62
|
+
)}
|
|
63
|
+
</datalist>
|
|
64
|
+
`}
|
|
65
|
+
${action == 'data-set' || action == 'value-set'
|
|
66
|
+
? html`
|
|
67
|
+
<label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
|
|
68
|
+
<ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
|
|
69
|
+
`
|
|
70
|
+
: html``}
|
|
71
|
+
|
|
72
|
+
<input id="checkbox-restore" type="checkbox" value-key="restore" .checked=${restore} />
|
|
73
|
+
<label for="checkbox-restore" class="checkbox-label">
|
|
74
|
+
<ox-i18n msgid="label.restore-on-leave">restore on leave</ox-i18n>
|
|
75
|
+
</label>
|
|
76
|
+
`
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_getPlaceHoder(action: string) {
|
|
80
|
+
switch (action) {
|
|
81
|
+
case 'popup':
|
|
82
|
+
case 'goto':
|
|
83
|
+
return 'SCENE-100'
|
|
84
|
+
case 'link-open':
|
|
85
|
+
case 'link-move':
|
|
86
|
+
return 'http://www.hatiolab.com/'
|
|
87
|
+
default:
|
|
88
|
+
return ''
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_getTargetList(action: string): { value: string; description: string }[] {
|
|
93
|
+
switch (action) {
|
|
94
|
+
case 'data-toggle':
|
|
95
|
+
case 'data-tristate':
|
|
96
|
+
case 'data-set':
|
|
97
|
+
case 'value-set':
|
|
98
|
+
let ids =
|
|
99
|
+
(this.scene &&
|
|
100
|
+
this.scene.ids.map(i => {
|
|
101
|
+
const id = i.key
|
|
102
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
103
|
+
})) ||
|
|
104
|
+
[]
|
|
105
|
+
ids.unshift({ value: '(self)', description: 'self component' })
|
|
106
|
+
return ids
|
|
107
|
+
case 'infoWindow':
|
|
108
|
+
return (
|
|
109
|
+
(this.scene &&
|
|
110
|
+
this.scene.ids
|
|
111
|
+
.filter(i => {
|
|
112
|
+
return this.scene!.findById(i.key).get('type') == 'info-window'
|
|
113
|
+
})
|
|
114
|
+
.map(i => {
|
|
115
|
+
const id = i.key
|
|
116
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
117
|
+
})) ||
|
|
118
|
+
[]
|
|
119
|
+
)
|
|
120
|
+
default:
|
|
121
|
+
return []
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
_onValueChange(e: Event) {
|
|
126
|
+
var element = e.target as HTMLElement
|
|
127
|
+
var key = element.getAttribute('value-key')
|
|
128
|
+
|
|
129
|
+
if (!key) {
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
this.value = {
|
|
134
|
+
...this.value,
|
|
135
|
+
[key]: convert(element)
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@operato/input/ox-input-data.js'
|
|
6
|
+
import '@operato/i18n/ox-i18n.js'
|
|
7
|
+
|
|
8
|
+
import { html, LitElement } from 'lit'
|
|
9
|
+
import { property, state } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
12
|
+
|
|
13
|
+
import { scenarios } from '../../../graphql/scenario'
|
|
14
|
+
import { EffectsSharedStyle } from './effects-shared-style'
|
|
15
|
+
import { convert } from './value-converter'
|
|
16
|
+
|
|
17
|
+
export class PropertyEventTap extends LitElement {
|
|
18
|
+
static styles = [EffectsSharedStyle]
|
|
19
|
+
|
|
20
|
+
@property({ type: Object }) value?: Properties
|
|
21
|
+
@property({ type: Object }) scene?: Scene
|
|
22
|
+
|
|
23
|
+
@state() scenarios: { value: string; description: string }[] = []
|
|
24
|
+
@state() targetList: { value: string; description: string }[] = []
|
|
25
|
+
|
|
26
|
+
async firstUpdated() {
|
|
27
|
+
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
render() {
|
|
31
|
+
var { action, value = '', target = '', pressed, options } = this.value || {}
|
|
32
|
+
var { input = '(self)', output = true } = options || {}
|
|
33
|
+
|
|
34
|
+
return html`
|
|
35
|
+
<input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
|
|
36
|
+
<label for="checkbox-pressed" class="checkbox-label"> <ox-i18n msgid="label.pressed">pressed</ox-i18n> </label>
|
|
37
|
+
|
|
38
|
+
<label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
|
|
39
|
+
<select
|
|
40
|
+
id="tap-select"
|
|
41
|
+
value-key="action"
|
|
42
|
+
.value=${action || ''}
|
|
43
|
+
@change=${async (e: Event) => {
|
|
44
|
+
if ((e.target as HTMLSelectElement).value === 'start-scenario') {
|
|
45
|
+
this.scenarios = (await scenarios()).map(({ name, description }) => {
|
|
46
|
+
return { value: name, description }
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}}
|
|
50
|
+
>
|
|
51
|
+
<option value=""></option>
|
|
52
|
+
<option value="goto">go to target board</option>
|
|
53
|
+
<option value="link-open">open new window for target link</option>
|
|
54
|
+
<option value="link-move">move to target link</option>
|
|
55
|
+
<option value="route-page">route to page</option>
|
|
56
|
+
<option value="popup">popup target board</option>
|
|
57
|
+
<option value="modal-popup">modal popup target board</option>
|
|
58
|
+
<option value="close-scene">close current board</option>
|
|
59
|
+
<option value="infoWindow">open infowindow</option>
|
|
60
|
+
<option value="toggle-info-window">toggle infowindow</option>
|
|
61
|
+
</select>
|
|
62
|
+
|
|
63
|
+
<label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
|
|
64
|
+
|
|
65
|
+
${action === 'goto' || action?.includes('popup')
|
|
66
|
+
? html`
|
|
67
|
+
<things-editor-board-selector
|
|
68
|
+
value-key="target"
|
|
69
|
+
.value=${target}
|
|
70
|
+
custom-editor
|
|
71
|
+
></things-editor-board-selector>
|
|
72
|
+
`
|
|
73
|
+
: html`
|
|
74
|
+
<input
|
|
75
|
+
value-key="target"
|
|
76
|
+
.value=${target}
|
|
77
|
+
list="target-list"
|
|
78
|
+
.placeholder=${this._getPlaceHoder(action)}
|
|
79
|
+
@focusin=${() => {
|
|
80
|
+
this.targetList = this._getInputList(action)
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<datalist id="target-list">
|
|
85
|
+
${this.targetList.map(
|
|
86
|
+
({ value, description }) => html` <option .value=${value}>${description}</option> `
|
|
87
|
+
)}
|
|
88
|
+
</datalist>
|
|
89
|
+
`}
|
|
90
|
+
${action === 'goto' || action?.includes('popup')
|
|
91
|
+
? html`
|
|
92
|
+
<label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
|
|
93
|
+
<input
|
|
94
|
+
id="input"
|
|
95
|
+
value-key="input"
|
|
96
|
+
.value=${input}
|
|
97
|
+
list="input-list"
|
|
98
|
+
@focusin=${() => {
|
|
99
|
+
this.targetList = this._getInputList(action)
|
|
100
|
+
}}
|
|
101
|
+
/>
|
|
102
|
+
<datalist id="input-list">
|
|
103
|
+
${this.targetList.map(
|
|
104
|
+
({ value, description }) => html` <option .value=${value}>${description}</option> `
|
|
105
|
+
)}
|
|
106
|
+
</datalist>
|
|
107
|
+
${
|
|
108
|
+
/* currently 'goto' does not support returning result */
|
|
109
|
+
action?.includes('popup')
|
|
110
|
+
? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
|
|
111
|
+
<label for="checkbox-output" class="checkbox-label">
|
|
112
|
+
<ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
|
|
113
|
+
</label>`
|
|
114
|
+
: html``
|
|
115
|
+
}
|
|
116
|
+
`
|
|
117
|
+
: action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
|
|
118
|
+
? html`
|
|
119
|
+
<label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
|
|
120
|
+
<ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
|
|
121
|
+
`
|
|
122
|
+
: html``}
|
|
123
|
+
`
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
_getPlaceHoder(action: string) {
|
|
127
|
+
switch (action) {
|
|
128
|
+
case 'link-open':
|
|
129
|
+
case 'link-move':
|
|
130
|
+
return 'http://www.hatiolab.com/'
|
|
131
|
+
default:
|
|
132
|
+
return ''
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
_getInputList(action: string): { value: string; description: string }[] {
|
|
137
|
+
switch (action) {
|
|
138
|
+
case 'data-toggle':
|
|
139
|
+
case 'data-tristate':
|
|
140
|
+
case 'data-set':
|
|
141
|
+
case 'value-set':
|
|
142
|
+
case 'popup':
|
|
143
|
+
case 'modal-popup':
|
|
144
|
+
let ids =
|
|
145
|
+
(this.scene &&
|
|
146
|
+
this.scene.ids.map(i => {
|
|
147
|
+
const id = i.key
|
|
148
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
149
|
+
})) ||
|
|
150
|
+
[]
|
|
151
|
+
ids.unshift({ value: '(self)', description: 'self component' })
|
|
152
|
+
return ids
|
|
153
|
+
case 'infoWindow':
|
|
154
|
+
case 'toggle-info-window':
|
|
155
|
+
return (
|
|
156
|
+
(this.scene &&
|
|
157
|
+
this.scene.ids
|
|
158
|
+
.filter(i => {
|
|
159
|
+
return this.scene!.findById(i.key).get('type') == 'info-window'
|
|
160
|
+
})
|
|
161
|
+
.map(i => {
|
|
162
|
+
const id = i.key
|
|
163
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
164
|
+
})) ||
|
|
165
|
+
[]
|
|
166
|
+
)
|
|
167
|
+
case 'start-scenario':
|
|
168
|
+
case 'run-scenario':
|
|
169
|
+
return this.scenarios
|
|
170
|
+
default:
|
|
171
|
+
return []
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
_onValueChange(e: Event) {
|
|
176
|
+
var element = e.target as HTMLElement
|
|
177
|
+
var key = element.getAttribute('value-key')
|
|
178
|
+
|
|
179
|
+
if (!key) {
|
|
180
|
+
return
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (key === 'input' || key === 'output') {
|
|
184
|
+
var { options = {} } = this.value || {}
|
|
185
|
+
|
|
186
|
+
this.value = {
|
|
187
|
+
...this.value,
|
|
188
|
+
options: {
|
|
189
|
+
...options,
|
|
190
|
+
[key]: convert(element)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
} else {
|
|
194
|
+
this.value = {
|
|
195
|
+
...this.value,
|
|
196
|
+
[key]: convert(element)
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var { action } = this.value
|
|
201
|
+
if (action !== 'goto' && !action?.includes('popup')) {
|
|
202
|
+
/* clear unused options */
|
|
203
|
+
delete this.value.options
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@operato/help/ox-title-with-help.js'
|
|
6
|
+
|
|
7
|
+
import { html, LitElement } from 'lit'
|
|
8
|
+
import { property } from 'lit/decorators.js'
|
|
9
|
+
|
|
10
|
+
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
11
|
+
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
12
|
+
|
|
13
|
+
import { PropertySharedStyle } from '../property-shared-style'
|
|
14
|
+
import { PropertyEventHover } from './property-event-hover'
|
|
15
|
+
import { PropertyEventTap } from './property-event-tap'
|
|
16
|
+
import { convert } from './value-converter'
|
|
17
|
+
|
|
18
|
+
export class PropertyEvent extends ScopedElementsMixin(LitElement) {
|
|
19
|
+
static styles = [PropertySharedStyle]
|
|
20
|
+
|
|
21
|
+
@property({ type: Object }) value?: Properties
|
|
22
|
+
@property({ type: Object }) scene?: Scene
|
|
23
|
+
|
|
24
|
+
firstUpdated() {
|
|
25
|
+
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static get scopedElements() {
|
|
29
|
+
return {
|
|
30
|
+
'property-event-hover': PropertyEventHover,
|
|
31
|
+
'property-event-tap': PropertyEventTap
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
render() {
|
|
36
|
+
const value = this.value || {}
|
|
37
|
+
|
|
38
|
+
return html`
|
|
39
|
+
<fieldset>
|
|
40
|
+
<legend>
|
|
41
|
+
<ox-title-with-help
|
|
42
|
+
msgid="label.hover-event"
|
|
43
|
+
topic="process-modeller/effects/hover-event"
|
|
44
|
+
></ox-title-with-help>
|
|
45
|
+
</legend>
|
|
46
|
+
|
|
47
|
+
<property-event-hover value-key="hover" .scene=${this.scene} .value=${value.hover || {}}>
|
|
48
|
+
</property-event-hover>
|
|
49
|
+
</fieldset>
|
|
50
|
+
|
|
51
|
+
<fieldset>
|
|
52
|
+
<legend>
|
|
53
|
+
<ox-title-with-help msgid="label.tap-event" topic="process-modeller/effects/tap-event"></ox-title-with-help>
|
|
54
|
+
</legend>
|
|
55
|
+
|
|
56
|
+
<property-event-tap value-key="tap" .scene=${this.scene} .value=${value.tap || {}}> </property-event-tap>
|
|
57
|
+
</fieldset>
|
|
58
|
+
`
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
_onValueChange(e: Event) {
|
|
62
|
+
var element = e.target as HTMLElement
|
|
63
|
+
var key = element.getAttribute('value-key')
|
|
64
|
+
|
|
65
|
+
if (!key) {
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.value = {
|
|
70
|
+
...this.value,
|
|
71
|
+
[key]: convert(element)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -12,6 +12,7 @@ import { BOUNDS, Component, Model, Scene } from '@hatiolab/things-scene'
|
|
|
12
12
|
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
13
13
|
import { ScrollbarStyles } from '@operato/styles'
|
|
14
14
|
|
|
15
|
+
import { PropertyEffects } from './effects/effects.js'
|
|
15
16
|
import { PropertyShapes } from './shapes/shapes.js'
|
|
16
17
|
import { PropertySpecific } from './specifics/specifics.js'
|
|
17
18
|
import { PropertyStyles } from './styles/styles.js'
|
|
@@ -96,6 +97,7 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
|
|
|
96
97
|
return {
|
|
97
98
|
'process-property-shape': PropertyShapes,
|
|
98
99
|
'process-property-style': PropertyStyles,
|
|
100
|
+
'process-property-effect': PropertyEffects,
|
|
99
101
|
'process-property-specific': PropertySpecific,
|
|
100
102
|
'process-scene-inspector': SceneInspector
|
|
101
103
|
}
|
|
@@ -114,6 +116,7 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
|
|
|
114
116
|
<mwc-icon name="specific" ?selected=${tabName == 'specific'}>tune</mwc-icon>
|
|
115
117
|
<mwc-icon name="shape" ?selected=${tabName == 'shape'}>format_shapes</mwc-icon>
|
|
116
118
|
<mwc-icon name="style" ?selected=${tabName == 'style'}>palette</mwc-icon>
|
|
119
|
+
<mwc-icon name="effect" ?selected=${tabName == 'effect'}>movie_filter</mwc-icon>
|
|
117
120
|
<mwc-icon name="inspector" ?selected=${tabName == 'inspector'}>visibility</mwc-icon>
|
|
118
121
|
</div>
|
|
119
122
|
|
|
@@ -149,6 +152,10 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
|
|
|
149
152
|
>
|
|
150
153
|
</process-property-style>
|
|
151
154
|
`,
|
|
155
|
+
effect: html`
|
|
156
|
+
<process-property-effect .value=${this.model} .scene=${this.scene} ?active=${tabName == 'effect'}>
|
|
157
|
+
</process-property-effect>
|
|
158
|
+
`,
|
|
152
159
|
inspector: html`
|
|
153
160
|
<process-scene-inspector .scene=${this.scene} ?active=${tabName == 'inspector'}></process-scene-inspector>
|
|
154
161
|
`
|
|
@@ -9,17 +9,15 @@ import '@operato/i18n/ox-i18n.js'
|
|
|
9
9
|
import '@operato/help/ox-title-with-help.js'
|
|
10
10
|
|
|
11
11
|
import { css, html } from 'lit'
|
|
12
|
-
import { property } from 'lit/decorators.js'
|
|
12
|
+
import { property, state } from 'lit/decorators.js'
|
|
13
13
|
|
|
14
14
|
import { BOUNDS, Component, Properties } from '@hatiolab/things-scene'
|
|
15
|
-
import { ScopedElementsMixin } from '@open-wc/scoped-elements'
|
|
16
15
|
|
|
17
16
|
import { AbstractProperty } from '../abstract-property'
|
|
18
|
-
import { PropertyShadow } from '../effects/property-shadow.js'
|
|
19
17
|
import { PropertySharedStyle } from '../property-shared-style'
|
|
20
18
|
import { BoxPaddingEditorStyles } from './box-padding-editor-styles'
|
|
21
19
|
|
|
22
|
-
export class PropertyShapes extends
|
|
20
|
+
export class PropertyShapes extends AbstractProperty {
|
|
23
21
|
static styles = [
|
|
24
22
|
PropertySharedStyle,
|
|
25
23
|
BoxPaddingEditorStyles,
|
|
@@ -138,16 +136,12 @@ export class PropertyShapes extends ScopedElementsMixin(AbstractProperty) {
|
|
|
138
136
|
@property({ type: Object }) bounds: BOUNDS | null = null
|
|
139
137
|
@property({ type: Array }) selected: Component[] = []
|
|
140
138
|
|
|
139
|
+
@state() private _3dExpanded: boolean = false
|
|
140
|
+
|
|
141
141
|
firstUpdated() {
|
|
142
142
|
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
static get scopedElements() {
|
|
146
|
-
return {
|
|
147
|
-
'process-property-shadow': PropertyShadow
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
145
|
render() {
|
|
152
146
|
const value = this.value || {}
|
|
153
147
|
|
|
@@ -160,18 +154,45 @@ export class PropertyShapes extends ScopedElementsMixin(AbstractProperty) {
|
|
|
160
154
|
<input value-key="id" .value=${value.id || ''} />
|
|
161
155
|
`
|
|
162
156
|
: html``}
|
|
157
|
+
${this._isClassIdentifiable(this.selected)
|
|
158
|
+
? html`
|
|
159
|
+
<label> <ox-i18n msgid="label.class">Class</ox-i18n> </label>
|
|
160
|
+
<input value-key="class" .value=${value.class || ''} />
|
|
161
|
+
`
|
|
162
|
+
: html``}
|
|
163
163
|
${this._hasTextProperty(this.selected)
|
|
164
164
|
? html`
|
|
165
165
|
<label> <ox-i18n msgid="label.text">Text</ox-i18n> </label>
|
|
166
166
|
<input value-key="text" .value=${value.text || ''} />
|
|
167
|
+
<label> <ox-i18n msgid="label.text-format">Text Format</ox-i18n> </label>
|
|
168
|
+
<input value-key="textFormat" .value=${value.textFormat || ''} list="format-list" />
|
|
169
|
+
<datalist id="format-list">
|
|
170
|
+
<option value="#,###."></option>
|
|
171
|
+
<option value="#,###.#"></option>
|
|
172
|
+
<option value="#,###.0"></option>
|
|
173
|
+
<option value="#,##0.#"></option>
|
|
174
|
+
<option value="#,##0.0"></option>
|
|
175
|
+
<option value="#,##0.0%"></option>
|
|
176
|
+
</datalist>
|
|
177
|
+
`
|
|
178
|
+
: html``}
|
|
179
|
+
${this._hasProperties(this.selected)
|
|
180
|
+
? html`
|
|
181
|
+
<div class="checkbox-row">
|
|
182
|
+
<input id="checkbox-hidden" value-key="hidden" type="checkbox" .checked=${value.hidden} />
|
|
183
|
+
<label for="checkbox-hidden"> <ox-i18n msgid="label.item-hidden">Item Hidden</ox-i18n> </label>
|
|
184
|
+
|
|
185
|
+
<input id="checkbox-locked" value-key="locked" type="checkbox" .checked=${value.locked} />
|
|
186
|
+
<label for="checkbox-locked"> <ox-i18n msgid="label.locked">Locked</ox-i18n> </label>
|
|
187
|
+
</div>
|
|
167
188
|
`
|
|
168
189
|
: html``}
|
|
169
190
|
</div>
|
|
170
191
|
</fieldset>
|
|
171
192
|
|
|
172
|
-
${this.
|
|
193
|
+
${!this._isLine(this.selected)
|
|
173
194
|
? html`
|
|
174
|
-
<fieldset class="icon-label unit">
|
|
195
|
+
<fieldset class="icon-label unit ratio">
|
|
175
196
|
<legend>
|
|
176
197
|
<ox-title-with-help topic="process-modeller/shapes/size" msgid="label.size">size</ox-title-with-help>
|
|
177
198
|
</legend>
|
|
@@ -181,20 +202,48 @@ export class PropertyShapes extends ScopedElementsMixin(AbstractProperty) {
|
|
|
181
202
|
<input type="number" value-key="bounds.width" .value=${this.bounds?.width} />
|
|
182
203
|
<label class="height"> <ox-i18n msgid="label.height">height</ox-i18n> </label>
|
|
183
204
|
<input type="number" value-key="bounds.height" .value=${this.bounds?.height} />
|
|
205
|
+
|
|
206
|
+
${this.selected.length && this.selected[0].isRootModel()
|
|
207
|
+
? html``
|
|
208
|
+
: html`
|
|
209
|
+
<label class="rotate"> <ox-i18n msgid="label.rotate">rotate</ox-i18n> </label>
|
|
210
|
+
<ox-input-angle value-key="rotation" .radian=${value.rotation}> </ox-input-angle>
|
|
211
|
+
`}
|
|
184
212
|
</div>
|
|
185
213
|
</fieldset>
|
|
186
214
|
`
|
|
187
|
-
: html
|
|
188
|
-
|
|
215
|
+
: html``}
|
|
216
|
+
${this._is3dish(this.selected)
|
|
217
|
+
? html`
|
|
218
|
+
<fieldset class="icon-label unit ratio" collapsable ?collapsed=${!this._3dExpanded}>
|
|
189
219
|
<legend>
|
|
190
|
-
<ox-title-with-help topic="process-modeller/
|
|
191
|
-
|
|
220
|
+
<ox-title-with-help topic="process-modeller/shapes/3dish" msgid="label.3dish">3D</ox-title-with-help>
|
|
221
|
+
<mwc-icon
|
|
222
|
+
@click=${(e: Event) => {
|
|
223
|
+
this._3dExpanded = !this._3dExpanded
|
|
224
|
+
}}
|
|
225
|
+
>${this._3dExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
|
|
192
226
|
>
|
|
193
227
|
</legend>
|
|
194
228
|
|
|
195
|
-
<
|
|
229
|
+
<div class="property-grid">
|
|
230
|
+
<label class="zPos"> <ox-i18n msgid="label.z-pos">pos. Z</ox-i18n> </label>
|
|
231
|
+
<input type="number" value-key="zPos" .value=${value.zPos} />
|
|
232
|
+
<label class="depth"> <ox-i18n msgid="label.depth">depth</ox-i18n> </label>
|
|
233
|
+
<input type="number" value-key="depth" .value=${value.depth} />
|
|
234
|
+
|
|
235
|
+
<label class="rotationX"> <ox-i18n msgid="label.rotation-x">rot. X</ox-i18n> </label>
|
|
236
|
+
<ox-input-angle value-key="rotationX" .radian=${value.rotationX}> </ox-input-angle>
|
|
237
|
+
|
|
238
|
+
<label class="rotationY"> <ox-i18n msgid="label.rotation-y">rot. Y</ox-i18n> </label>
|
|
239
|
+
<ox-input-angle value-key="rotationY" .radian=${value.rotationY}> </ox-input-angle>
|
|
240
|
+
|
|
241
|
+
<label class="rotationZ"> <ox-i18n msgid="label.rotation-z">rot. Z</ox-i18n> </label>
|
|
242
|
+
<ox-input-angle value-key="rotation" .radian=${value.rotation}> </ox-input-angle>
|
|
243
|
+
</div>
|
|
196
244
|
</fieldset>
|
|
197
|
-
`
|
|
245
|
+
`
|
|
246
|
+
: html``}
|
|
198
247
|
${this._hasTextProperty(this.selected)
|
|
199
248
|
? html`
|
|
200
249
|
<fieldset>
|
|
@@ -311,6 +360,12 @@ export class PropertyShapes extends ScopedElementsMixin(AbstractProperty) {
|
|
|
311
360
|
return true
|
|
312
361
|
}
|
|
313
362
|
|
|
363
|
+
_hasProperties(selected: Component[]) {
|
|
364
|
+
if (!selected || selected.length == 0 || (selected[0] && selected[0].isLayer && selected[0].isLayer())) return false
|
|
365
|
+
|
|
366
|
+
return true
|
|
367
|
+
}
|
|
368
|
+
|
|
314
369
|
_isIdentifiable(selected: Component[]) {
|
|
315
370
|
if (!selected || selected.length == 0 || selected.length > 1 || (selected[0].isLayer && selected[0].isLayer()))
|
|
316
371
|
return false
|
|
@@ -318,9 +373,21 @@ export class PropertyShapes extends ScopedElementsMixin(AbstractProperty) {
|
|
|
318
373
|
return true
|
|
319
374
|
}
|
|
320
375
|
|
|
376
|
+
_isClassIdentifiable(selected: Component[]) {
|
|
377
|
+
if (!selected || (selected[0] && selected[0].isLayer())) return false
|
|
378
|
+
|
|
379
|
+
return true
|
|
380
|
+
}
|
|
381
|
+
|
|
321
382
|
_isLine(selected: Component[]) {
|
|
322
383
|
if (!selected || !(selected[0] && selected[0].isLine())) return false
|
|
323
384
|
|
|
324
385
|
return true
|
|
325
386
|
}
|
|
387
|
+
|
|
388
|
+
_is3dish(selected: Component[]) {
|
|
389
|
+
if (!selected || !(selected[0] && selected[0].is3dish())) return false
|
|
390
|
+
|
|
391
|
+
return true
|
|
392
|
+
}
|
|
326
393
|
}
|