@operato/board 1.0.0-alpha.8 → 1.0.0-beta.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/CHANGELOG.md +394 -0
- package/dist/src/graphql/data-subscription.d.ts +7 -0
- package/dist/src/graphql/data-subscription.js +24 -0
- package/dist/src/graphql/data-subscription.js.map +1 -0
- package/dist/src/graphql/scenario.d.ts +6 -0
- package/dist/src/graphql/scenario.js +69 -0
- package/dist/src/graphql/scenario.js.map +1 -0
- package/dist/src/modeller/property-sidebar/abstract-property.js +0 -3
- package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +6 -3
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +17 -10
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +5 -2
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +2 -2
- package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +14 -4
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +56 -10
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +4 -4
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/value-converter.js +0 -2
- package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -1
- package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/property-shared-style.js +1 -1
- package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +2 -2
- package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -1
- package/dist/src/modeller/property-sidebar/styles/styles.d.ts +3 -3
- package/dist/src/modeller/property-sidebar/styles/styles.js +8 -10
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -1
- package/dist/src/ox-board-modeller.d.ts +2 -2
- package/dist/src/ox-board-modeller.js +5 -5
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/ox-board-viewer.d.ts +8 -4
- package/dist/src/ox-board-viewer.js +39 -5
- package/dist/src/ox-board-viewer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -14
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/modeller/property-sidebar/abstract-property.ts +0 -4
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +19 -10
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +7 -5
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +2 -2
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +16 -5
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +50 -11
- package/src/modeller/property-sidebar/effects/property-shadow.ts +4 -5
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -3
- package/src/modeller/property-sidebar/property-shared-style.ts +1 -1
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +3 -3
- package/src/modeller/property-sidebar/styles/styles.ts +9 -12
- package/src/ox-board-modeller.ts +6 -7
- package/src/ox-board-viewer.ts +47 -11
- package/yarn-error.log +0 -16185
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/board",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "Webcomponent for board following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,28 +49,29 @@
|
|
|
49
49
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@operato/
|
|
53
|
-
"@operato/
|
|
54
|
-
"@operato/
|
|
55
|
-
"@operato/
|
|
56
|
-
"@operato/
|
|
57
|
-
"@operato/
|
|
58
|
-
"@operato/
|
|
59
|
-
"@operato/
|
|
60
|
-
"@operato/
|
|
52
|
+
"@operato/app": "^1.0.0-beta.1",
|
|
53
|
+
"@operato/data-grist": "^1.0.0-beta.1",
|
|
54
|
+
"@operato/font": "^1.0.0-beta.1",
|
|
55
|
+
"@operato/graphql": "^1.0.0-beta.1",
|
|
56
|
+
"@operato/i18n": "^1.0.0-beta.1",
|
|
57
|
+
"@operato/input": "^1.0.0-beta.1",
|
|
58
|
+
"@operato/markdown": "^1.0.0-beta.1",
|
|
59
|
+
"@operato/popup": "^1.0.0-beta.1",
|
|
60
|
+
"@operato/property-editor": "^1.0.0-beta.1",
|
|
61
|
+
"@operato/styles": "^1.0.0-beta.1",
|
|
62
|
+
"@operato/utils": "^1.0.0-beta.1",
|
|
61
63
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
62
|
-
"@things-factory/modeller-ui": "^5.0.0-alpha.3",
|
|
63
64
|
"@types/file-saver": "^2.0.4",
|
|
64
65
|
"@types/sortablejs": "^1.10.7",
|
|
65
66
|
"file-saver": "^2.0.5",
|
|
66
|
-
"lit": "^2.2.
|
|
67
|
+
"lit": "^2.2.1",
|
|
67
68
|
"lodash-es": "^4.17.21",
|
|
68
69
|
"sortablejs": "^1.14.0"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
72
73
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
73
|
-
"@hatiolab/things-scene": "^2.
|
|
74
|
+
"@hatiolab/things-scene": "^2.8.1",
|
|
74
75
|
"@material/mwc-fab": "^0.25.3",
|
|
75
76
|
"@material/mwc-icon": "^0.25.3",
|
|
76
77
|
"@open-wc/eslint-config": "^4.3.0",
|
|
@@ -106,5 +107,5 @@
|
|
|
106
107
|
"prettier --write"
|
|
107
108
|
]
|
|
108
109
|
},
|
|
109
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "cfa0be4c72d93b2bf3f851c09b5c62c6025edf0f"
|
|
110
111
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component, DataSubscriptionProvider } from '@hatiolab/things-scene'
|
|
2
|
+
|
|
3
|
+
import gql from 'graphql-tag'
|
|
4
|
+
import { subscribe } from '@operato/graphql'
|
|
5
|
+
|
|
6
|
+
export class DataSubscriptionProviderImpl implements DataSubscriptionProvider {
|
|
7
|
+
async subscribe(tag: string, component: Component) {
|
|
8
|
+
return await subscribe(
|
|
9
|
+
{
|
|
10
|
+
query: gql`
|
|
11
|
+
subscription {
|
|
12
|
+
data(tag: "${tag}") {
|
|
13
|
+
tag
|
|
14
|
+
data
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
next: async ({ data }: { data: any }) => {
|
|
21
|
+
if (data) {
|
|
22
|
+
component.data = data.data.data
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
dispose() {}
|
|
30
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
|
|
5
|
+
export const scenarios = async (): Promise<{ name: string; description: string }[]> => {
|
|
6
|
+
var response = await client.query({
|
|
7
|
+
query: gql`
|
|
8
|
+
query {
|
|
9
|
+
scenarios {
|
|
10
|
+
items {
|
|
11
|
+
name
|
|
12
|
+
description
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
`
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
if (response.errors) {
|
|
20
|
+
return []
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return response.data.scenarios.items
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const startScenario = async (
|
|
27
|
+
scenarioName: string,
|
|
28
|
+
instanceName: string,
|
|
29
|
+
variables: string | number | object
|
|
30
|
+
) => {
|
|
31
|
+
if (!scenarioName) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (client) {
|
|
36
|
+
var response = await client.query({
|
|
37
|
+
query: gql`
|
|
38
|
+
mutation ($instanceName: String, $scenarioName: String!, $variables: Object) {
|
|
39
|
+
startScenario(instanceName: $instanceName, scenarioName: $scenarioName, variables: $variables) {
|
|
40
|
+
state
|
|
41
|
+
message
|
|
42
|
+
data
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`,
|
|
46
|
+
variables: {
|
|
47
|
+
instanceName: instanceName,
|
|
48
|
+
scenarioName: scenarioName,
|
|
49
|
+
variables
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return response?.data?.startScenario?.data
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const runScenario = async (scenarioName: string, variables: string | number | object) => {
|
|
58
|
+
if (!scenarioName) return
|
|
59
|
+
|
|
60
|
+
if (client) {
|
|
61
|
+
var response = await client.query({
|
|
62
|
+
query: gql`
|
|
63
|
+
mutation ($scenarioName: String!, $variables: Object) {
|
|
64
|
+
runScenario(scenarioName: $scenarioName, variables: $variables) {
|
|
65
|
+
state
|
|
66
|
+
message
|
|
67
|
+
data
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`,
|
|
71
|
+
variables: {
|
|
72
|
+
scenarioName: scenarioName,
|
|
73
|
+
variables
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return response?.data?.runScenario?.data
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -26,10 +26,6 @@ export class AbstractProperty extends LitElement {
|
|
|
26
26
|
var value
|
|
27
27
|
|
|
28
28
|
switch (element.tagName) {
|
|
29
|
-
case 'THINGS-EDITOR-ANGLE-INPUT':
|
|
30
|
-
value = Number((element as any).radian) || 0
|
|
31
|
-
break
|
|
32
|
-
|
|
33
29
|
case 'INPUT':
|
|
34
30
|
switch ((element as any).type) {
|
|
35
31
|
case 'checkbox':
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
import '@
|
|
5
|
+
import '@operato/input/ox-input-value-map.js'
|
|
6
|
+
import '@operato/input/ox-input-value-ranges.js'
|
|
7
7
|
import '@operato/input/ox-buttons-radio.js'
|
|
8
8
|
import '@operato/input/ox-input-code.js'
|
|
9
9
|
import '@operato/i18n/ox-i18n.js'
|
|
@@ -156,7 +156,7 @@ export default class DataBindingMapper extends LitElement {
|
|
|
156
156
|
text: 'string',
|
|
157
157
|
ref: 'string'
|
|
158
158
|
}
|
|
159
|
-
@state() _componentIds:
|
|
159
|
+
@state() _componentIds: { value: string; description: string }[] = []
|
|
160
160
|
|
|
161
161
|
@query('#eval-editor') editor!: HTMLInputElement
|
|
162
162
|
@query('#target-input') target!: HTMLInputElement
|
|
@@ -192,15 +192,24 @@ export default class DataBindingMapper extends LitElement {
|
|
|
192
192
|
list="target-list"
|
|
193
193
|
.value=${mapping.target || ''}
|
|
194
194
|
@focusin=${() => {
|
|
195
|
-
|
|
196
|
-
|
|
195
|
+
this._componentIds =
|
|
196
|
+
(this.scene &&
|
|
197
|
+
this.scene.ids.map(i => {
|
|
198
|
+
const id = i.key
|
|
199
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
200
|
+
})) ||
|
|
201
|
+
[]
|
|
197
202
|
}}
|
|
198
203
|
/>
|
|
199
204
|
<datalist id="target-list">
|
|
200
205
|
<option value="(self)"></option>
|
|
201
206
|
<option value="(key)"></option>
|
|
202
207
|
${this._componentIds.length
|
|
203
|
-
? html`
|
|
208
|
+
? html`
|
|
209
|
+
${this._componentIds.map(
|
|
210
|
+
({ value, description }) => html` <option value=${value}>${description}</option> `
|
|
211
|
+
)}
|
|
212
|
+
`
|
|
204
213
|
: html``}
|
|
205
214
|
</datalist>
|
|
206
215
|
|
|
@@ -220,21 +229,21 @@ export default class DataBindingMapper extends LitElement {
|
|
|
220
229
|
</ox-buttons-radio>
|
|
221
230
|
|
|
222
231
|
<div rule-editors class="content" ?hidden=${mapping.rule == 'value'}>
|
|
223
|
-
<
|
|
232
|
+
<ox-input-value-map
|
|
224
233
|
value-key="map"
|
|
225
234
|
.value=${this.rule.map || {}}
|
|
226
235
|
.valuetype=${this._valuetype(mapping.property!)}
|
|
227
236
|
?active=${mapping.rule == 'map'}
|
|
228
237
|
>
|
|
229
|
-
</
|
|
238
|
+
</ox-input-value-map>
|
|
230
239
|
|
|
231
|
-
<
|
|
240
|
+
<ox-input-value-ranges
|
|
232
241
|
value-key="range"
|
|
233
242
|
.value=${this.rule.range || []}
|
|
234
243
|
.valuetype=${this._valuetype(mapping.property!)}
|
|
235
244
|
?active=${mapping.rule == 'range'}
|
|
236
245
|
>
|
|
237
|
-
</
|
|
246
|
+
</ox-input-value-ranges>
|
|
238
247
|
|
|
239
248
|
<ox-input-code
|
|
240
249
|
value-key="eval"
|
|
@@ -9,10 +9,9 @@ import '@operato/input/ox-buttons-radio.js'
|
|
|
9
9
|
import '@operato/input/ox-input-data.js'
|
|
10
10
|
import '@operato/i18n/ox-i18n.js'
|
|
11
11
|
|
|
12
|
-
import { css, html, PropertyValues } from 'lit'
|
|
13
|
-
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
14
|
-
|
|
15
12
|
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
13
|
+
import { PropertyValues, css, html } from 'lit'
|
|
14
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
16
15
|
|
|
17
16
|
import { AbstractProperty } from '../abstract-property'
|
|
18
17
|
import { PropertySharedStyle } from '../property-shared-style'
|
|
@@ -213,6 +212,9 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
213
212
|
<label> <ox-i18n msgid="label.class">Class</ox-i18n> </label>
|
|
214
213
|
<input value-key="class" .value=${value.class || ''} />
|
|
215
214
|
|
|
215
|
+
<label> <ox-i18n msgid="label.tag">Tag</ox-i18n> </label>
|
|
216
|
+
<input value-key="tag" .value=${value.tag || ''} />
|
|
217
|
+
|
|
216
218
|
<label> <ox-i18n msgid="label.template-prefix">Template Prefix</ox-i18n> </label>
|
|
217
219
|
<input value-key="templatePrefix" .value=${value.templatePrefix || ''} />
|
|
218
220
|
|
|
@@ -370,8 +372,8 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
370
372
|
if (mapping && mapping.target) {
|
|
371
373
|
this.scene &&
|
|
372
374
|
this.scene.findAll(mapping.target, this.scene.selected && this.scene.selected[0]).forEach((c, i) => {
|
|
373
|
-
if (i == 0) c.trigger('
|
|
374
|
-
c.trigger('
|
|
375
|
+
if (i == 0) c.trigger('decotagreset')
|
|
376
|
+
c.trigger('decotag', {})
|
|
375
377
|
})
|
|
376
378
|
}
|
|
377
379
|
|
|
@@ -29,7 +29,7 @@ export const EffectsSharedStyle = css`
|
|
|
29
29
|
input,
|
|
30
30
|
select,
|
|
31
31
|
ox-input-angle,
|
|
32
|
-
|
|
32
|
+
ox-input-color,
|
|
33
33
|
[custom-editor] {
|
|
34
34
|
grid-column: span 7;
|
|
35
35
|
}
|
|
@@ -37,7 +37,7 @@ export const EffectsSharedStyle = css`
|
|
|
37
37
|
input,
|
|
38
38
|
select,
|
|
39
39
|
ox-input-angle input,
|
|
40
|
-
|
|
40
|
+
ox-input-color input,
|
|
41
41
|
[custom-editor] input {
|
|
42
42
|
border: var(--property-sidebar-fieldset-border);
|
|
43
43
|
}
|
|
@@ -63,7 +63,9 @@ class PropertyEventHover extends LitElement {
|
|
|
63
63
|
/>
|
|
64
64
|
|
|
65
65
|
<datalist id="target-list">
|
|
66
|
-
${this._getTargetList(action).map(
|
|
66
|
+
${this._getTargetList(action).map(
|
|
67
|
+
({ value, description }) => html` <option .value=${value}>${description}</option> `
|
|
68
|
+
)}
|
|
67
69
|
</datalist>
|
|
68
70
|
`}
|
|
69
71
|
${action == 'data-set' || action == 'value-set'
|
|
@@ -93,14 +95,20 @@ class PropertyEventHover extends LitElement {
|
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
_getTargetList(action: string) {
|
|
98
|
+
_getTargetList(action: string): { value: string; description: string }[] {
|
|
97
99
|
switch (action) {
|
|
98
100
|
case 'data-toggle':
|
|
99
101
|
case 'data-tristate':
|
|
100
102
|
case 'data-set':
|
|
101
103
|
case 'value-set':
|
|
102
|
-
let ids =
|
|
103
|
-
|
|
104
|
+
let ids =
|
|
105
|
+
(this.scene &&
|
|
106
|
+
this.scene.ids.map(i => {
|
|
107
|
+
const id = i.key
|
|
108
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
109
|
+
})) ||
|
|
110
|
+
[]
|
|
111
|
+
ids.unshift({ value: '(self)', description: 'self component' })
|
|
104
112
|
return ids
|
|
105
113
|
case 'infoWindow':
|
|
106
114
|
return (
|
|
@@ -109,7 +117,10 @@ class PropertyEventHover extends LitElement {
|
|
|
109
117
|
.filter(i => {
|
|
110
118
|
return this.scene!.findById(i.key).get('type') == 'info-window'
|
|
111
119
|
})
|
|
112
|
-
.map(i =>
|
|
120
|
+
.map(i => {
|
|
121
|
+
const id = i.key
|
|
122
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
123
|
+
})) ||
|
|
113
124
|
[]
|
|
114
125
|
)
|
|
115
126
|
default:
|
|
@@ -6,10 +6,11 @@ import '@operato/input/ox-input-data.js'
|
|
|
6
6
|
import '@operato/i18n/ox-i18n.js'
|
|
7
7
|
|
|
8
8
|
import { html, LitElement } from 'lit'
|
|
9
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
|
10
10
|
|
|
11
11
|
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
12
12
|
|
|
13
|
+
import { scenarios } from '../../../graphql/scenario'
|
|
13
14
|
import { EffectsSharedStyle } from './effects-shared-style'
|
|
14
15
|
import { convert } from './value-converter'
|
|
15
16
|
|
|
@@ -20,7 +21,10 @@ class PropertyEventTap extends LitElement {
|
|
|
20
21
|
@property({ type: Object }) value?: Properties
|
|
21
22
|
@property({ type: Object }) scene?: Scene
|
|
22
23
|
|
|
23
|
-
|
|
24
|
+
@state() scenarios: { value: string; description: string }[] = []
|
|
25
|
+
@state() targetList: { value: string; description: string }[] = []
|
|
26
|
+
|
|
27
|
+
async firstUpdated() {
|
|
24
28
|
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -32,7 +36,18 @@ class PropertyEventTap extends LitElement {
|
|
|
32
36
|
<label for="checkbox-pressed" class="checkbox-label"> <ox-i18n msgid="label.pressed">pressed</ox-i18n> </label>
|
|
33
37
|
|
|
34
38
|
<label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
|
|
35
|
-
<select
|
|
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
|
+
>
|
|
36
51
|
<option value=""></option>
|
|
37
52
|
<option value="goto">go to target board</option>
|
|
38
53
|
<option value="link-open">open new window for target link</option>
|
|
@@ -47,11 +62,13 @@ class PropertyEventTap extends LitElement {
|
|
|
47
62
|
<option value="data-tristate">tristate(0/1/2) target component data</option>
|
|
48
63
|
<option value="data-set">set value to target component data</option>
|
|
49
64
|
<option value="value-set">set value to target component value</option>
|
|
65
|
+
<option value="start-scenario">start the given scenario</option>
|
|
66
|
+
<option value="run-scenario">run the given scenario</option>
|
|
50
67
|
</select>
|
|
51
68
|
|
|
52
69
|
<label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
|
|
53
70
|
|
|
54
|
-
${action
|
|
71
|
+
${action === 'goto' || action === 'popup'
|
|
55
72
|
? html`
|
|
56
73
|
<things-editor-board-selector
|
|
57
74
|
value-key="target"
|
|
@@ -60,13 +77,23 @@ class PropertyEventTap extends LitElement {
|
|
|
60
77
|
></things-editor-board-selector>
|
|
61
78
|
`
|
|
62
79
|
: html`
|
|
63
|
-
<input
|
|
80
|
+
<input
|
|
81
|
+
value-key="target"
|
|
82
|
+
.value=${target}
|
|
83
|
+
list="target-list"
|
|
84
|
+
.placeholder=${this._getPlaceHoder(action)}
|
|
85
|
+
@focusin=${() => {
|
|
86
|
+
this.targetList = this._getTargetList(action)
|
|
87
|
+
}}
|
|
88
|
+
/>
|
|
64
89
|
|
|
65
90
|
<datalist id="target-list">
|
|
66
|
-
${this.
|
|
91
|
+
${this.targetList.map(
|
|
92
|
+
({ value, description }) => html` <option .value=${value}>${description}</option> `
|
|
93
|
+
)}
|
|
67
94
|
</datalist>
|
|
68
95
|
`}
|
|
69
|
-
${action
|
|
96
|
+
${action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
|
|
70
97
|
? html`
|
|
71
98
|
<label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
|
|
72
99
|
<ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
|
|
@@ -88,14 +115,20 @@ class PropertyEventTap extends LitElement {
|
|
|
88
115
|
}
|
|
89
116
|
}
|
|
90
117
|
|
|
91
|
-
_getTargetList(action: string) {
|
|
118
|
+
_getTargetList(action: string): { value: string; description: string }[] {
|
|
92
119
|
switch (action) {
|
|
93
120
|
case 'data-toggle':
|
|
94
121
|
case 'data-tristate':
|
|
95
122
|
case 'data-set':
|
|
96
123
|
case 'value-set':
|
|
97
|
-
let ids =
|
|
98
|
-
|
|
124
|
+
let ids =
|
|
125
|
+
(this.scene &&
|
|
126
|
+
this.scene.ids.map(i => {
|
|
127
|
+
const id = i.key
|
|
128
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
129
|
+
})) ||
|
|
130
|
+
[]
|
|
131
|
+
ids.unshift({ value: '(self)', description: 'self component' })
|
|
99
132
|
return ids
|
|
100
133
|
case 'infoWindow':
|
|
101
134
|
case 'toggle-info-window':
|
|
@@ -105,9 +138,15 @@ class PropertyEventTap extends LitElement {
|
|
|
105
138
|
.filter(i => {
|
|
106
139
|
return this.scene!.findById(i.key).get('type') == 'info-window'
|
|
107
140
|
})
|
|
108
|
-
.map(i =>
|
|
141
|
+
.map(i => {
|
|
142
|
+
const id = i.key
|
|
143
|
+
return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
|
|
144
|
+
})) ||
|
|
109
145
|
[]
|
|
110
146
|
)
|
|
147
|
+
case 'start-scenario':
|
|
148
|
+
case 'run-scenario':
|
|
149
|
+
return this.scenarios
|
|
111
150
|
default:
|
|
112
151
|
return []
|
|
113
152
|
}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@things-factory/modeller-ui/client/editors/things-editor-color'
|
|
6
5
|
import '@operato/i18n/ox-i18n.js'
|
|
6
|
+
import '@operato/input/ox-input-color.js'
|
|
7
7
|
|
|
8
|
-
import { css, html
|
|
8
|
+
import { LitElement, css, html } from 'lit'
|
|
9
9
|
import { customElement, property } from 'lit/decorators.js'
|
|
10
10
|
|
|
11
11
|
import { Properties } from '@hatiolab/things-scene'
|
|
12
|
-
|
|
13
12
|
import { convert } from './value-converter'
|
|
14
13
|
|
|
15
14
|
/**
|
|
@@ -48,7 +47,7 @@ export default class PropertyShadow extends LitElement {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
input[type='number'],
|
|
51
|
-
|
|
50
|
+
ox-input-color {
|
|
52
51
|
grid-column: span 7;
|
|
53
52
|
}
|
|
54
53
|
input[type='number'] {
|
|
@@ -93,7 +92,7 @@ export default class PropertyShadow extends LitElement {
|
|
|
93
92
|
|
|
94
93
|
<label class="icon-only-label color"></label>
|
|
95
94
|
|
|
96
|
-
<
|
|
95
|
+
<ox-input-color value-key="color" .value=${value.color}> </ox-input-color>
|
|
97
96
|
`
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -52,7 +52,7 @@ export const PropertySharedStyle = css`
|
|
|
52
52
|
.property-grid > select,
|
|
53
53
|
.property-grid > ox-input-angle,
|
|
54
54
|
.property-grid > ox-buttons-radio,
|
|
55
|
-
.property-grid >
|
|
55
|
+
.property-grid > ox-input-color,
|
|
56
56
|
[custom-editor] {
|
|
57
57
|
grid-column: span 7;
|
|
58
58
|
align-self: stretch;
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@
|
|
5
|
+
import '@operato/app/property-editor.js' /* for registering property editors */
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LitElement, PropertyValues, html } from 'lit'
|
|
8
8
|
import { customElement, property } from 'lit/decorators.js'
|
|
9
9
|
|
|
10
|
-
import { Properties } from '@hatiolab/things-scene'
|
|
11
10
|
import { OxPropertyEditor } from '@operato/property-editor'
|
|
11
|
+
import { Properties } from '@hatiolab/things-scene'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
|
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
|
|
6
6
|
import '@operato/help/ox-title-with-help.js'
|
|
7
|
-
import '@
|
|
8
|
-
import '@
|
|
9
|
-
import '@
|
|
7
|
+
import '@operato/input/ox-input-color.js'
|
|
8
|
+
import '@operato/app/input/ox-input-fill-style.js'
|
|
9
|
+
import '@operato/font/ox-font-selector.js'
|
|
10
10
|
import '@operato/i18n/ox-i18n.js'
|
|
11
11
|
|
|
12
12
|
import { css, html } from 'lit'
|
|
13
13
|
import { customElement, property } from 'lit/decorators.js'
|
|
14
14
|
|
|
15
|
-
import { Component } from '@hatiolab/things-scene'
|
|
16
|
-
|
|
17
15
|
import { AbstractProperty } from '../abstract-property'
|
|
16
|
+
import { Component } from '@hatiolab/things-scene'
|
|
18
17
|
import { PropertySharedStyle } from '../property-shared-style'
|
|
19
18
|
|
|
20
19
|
@customElement('property-style')
|
|
@@ -374,12 +373,12 @@ class PropertyStyles extends AbstractProperty {
|
|
|
374
373
|
<ox-i18n msgid="label.font-family">Font Family</ox-i18n>
|
|
375
374
|
</label>
|
|
376
375
|
|
|
377
|
-
<
|
|
376
|
+
<ox-font-selector
|
|
378
377
|
value-key="fontFamily"
|
|
379
378
|
.value=${fontFamily}
|
|
380
379
|
class="property-full-input"
|
|
381
380
|
custom-editor
|
|
382
|
-
></
|
|
381
|
+
></ox-font-selector>
|
|
383
382
|
|
|
384
383
|
<label class="property-half-label icon-only-label font-size"></label>
|
|
385
384
|
<input type="number" value-key="fontSize" .value=${fontSize} class="property-half-input" />
|
|
@@ -388,8 +387,7 @@ class PropertyStyles extends AbstractProperty {
|
|
|
388
387
|
<input type="number" value-key="lineHeight" .value=${lineHeight} class="property-half-input" />
|
|
389
388
|
|
|
390
389
|
<label class="property-half-label icon-only-label color"></label>
|
|
391
|
-
<
|
|
392
|
-
</things-editor-color>
|
|
390
|
+
<ox-input-color value-key="fontColor" .value=${fontColor} class="property-half-input"> </ox-input-color>
|
|
393
391
|
|
|
394
392
|
<label class="property-half-label"></label>
|
|
395
393
|
<div class="property-half-input btn-group">
|
|
@@ -406,7 +404,7 @@ class PropertyStyles extends AbstractProperty {
|
|
|
406
404
|
>
|
|
407
405
|
</legend>
|
|
408
406
|
|
|
409
|
-
<
|
|
407
|
+
<ox-input-fill-style value-key="fillStyle" .value=${fillStyle}> </ox-input-fill-style>
|
|
410
408
|
</fieldset>
|
|
411
409
|
|
|
412
410
|
<fieldset>
|
|
@@ -419,8 +417,7 @@ class PropertyStyles extends AbstractProperty {
|
|
|
419
417
|
<input type="number" value-key="lineWidth" .value=${lineWidth} class="property-half-input" />
|
|
420
418
|
|
|
421
419
|
<label class="property-half-label icon-only-label color"></label>
|
|
422
|
-
<
|
|
423
|
-
</things-editor-color>
|
|
420
|
+
<ox-input-color value-key="strokeStyle" .value=${strokeStyle} class="property-half-input"> </ox-input-color>
|
|
424
421
|
|
|
425
422
|
<label class="property-full-label">
|
|
426
423
|
<ox-i18n msgid="label.line-type">line type</ox-i18n>
|
package/src/ox-board-modeller.ts
CHANGED
|
@@ -6,16 +6,15 @@ import './modeller/edit-toolbar'
|
|
|
6
6
|
import '@hatiolab/things-scene'
|
|
7
7
|
import './ox-board-viewer'
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
import { css, html
|
|
9
|
+
import { ComponentGroup, ComponentTemplate } from './types'
|
|
10
|
+
import { LitElement, css, html } from 'lit'
|
|
11
|
+
import { SCENE_MODE, Scene } from '@hatiolab/things-scene'
|
|
11
12
|
import { customElement, property, query } from 'lit/decorators.js'
|
|
12
|
-
|
|
13
|
-
import { Scene, SCENE_MODE } from '@hatiolab/things-scene'
|
|
14
|
-
import { OxPopup } from '@operato/popup'
|
|
15
13
|
import { isMacOS, togglefullscreen } from '@operato/utils'
|
|
16
14
|
|
|
17
15
|
import { EditToolbar } from './modeller/edit-toolbar'
|
|
18
|
-
import {
|
|
16
|
+
import { OxPopup } from '@operato/popup'
|
|
17
|
+
import { saveAs } from 'file-saver'
|
|
19
18
|
|
|
20
19
|
const MACOS = isMacOS()
|
|
21
20
|
|
|
@@ -256,7 +255,7 @@ export class BoardModeller extends LitElement {
|
|
|
256
255
|
<ox-scene-property name="paddingTop" value="50" type="number"></ox-scene-property>
|
|
257
256
|
<ox-scene-property name="paddingLeft" value="50" type="number"></ox-scene-property>
|
|
258
257
|
</ox-scene-layer>
|
|
259
|
-
<ox-scene-layer type="
|
|
258
|
+
<ox-scene-layer type="decotag-layer"></ox-scene-layer>
|
|
260
259
|
<ox-scene-handler type="text-editor"></ox-scene-handler>
|
|
261
260
|
<ox-scene-handler type="move-handler"></ox-scene-handler>
|
|
262
261
|
</ox-scene-viewer>
|