@operato/board 1.0.0-alpha.9 → 1.0.0-beta.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 +650 -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/component-toolbar/component-menu.js +2 -2
- package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js +1 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -1
- package/dist/src/modeller/edit-toolbar.d.ts +1 -1
- package/dist/src/modeller/edit-toolbar.js +3 -3
- package/dist/src/modeller/edit-toolbar.js.map +1 -1
- 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/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 +1 -1
- 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/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 +1 -1
- package/dist/src/modeller/property-sidebar/styles/styles.js +3 -3
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -1
- package/dist/src/modeller/scene-viewer/ox-scene-viewer.js +3 -0
- package/dist/src/modeller/scene-viewer/ox-scene-viewer.js.map +1 -1
- package/dist/src/ox-board-modeller.d.ts +2 -2
- package/dist/src/ox-board-modeller.js +6 -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 -15
- package/src/graphql/data-subscription.ts +30 -0
- package/src/graphql/scenario.ts +79 -0
- package/src/modeller/component-toolbar/component-menu.ts +3 -4
- package/src/modeller/component-toolbar/component-toolbar.ts +1 -1
- package/src/modeller/edit-toolbar.ts +3 -3
- 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/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 +1 -1
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -3
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +3 -3
- package/src/modeller/property-sidebar/styles/styles.ts +3 -3
- package/src/modeller/scene-viewer/ox-scene-viewer.ts +2 -0
- package/src/ox-board-modeller.ts +7 -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.10",
|
|
4
4
|
"description": "Webcomponent for board following open-wc recommendations",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,29 +49,29 @@
|
|
|
49
49
|
"storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@operato/app": "^1.0.0-
|
|
53
|
-
"@operato/data-grist": "^1.0.0-
|
|
54
|
-
"@operato/
|
|
55
|
-
"@operato/
|
|
56
|
-
"@operato/
|
|
57
|
-
"@operato/
|
|
58
|
-
"@operato/
|
|
59
|
-
"@operato/
|
|
60
|
-
"@operato/
|
|
61
|
-
"@operato/
|
|
52
|
+
"@operato/app": "^1.0.0-beta.10",
|
|
53
|
+
"@operato/data-grist": "^1.0.0-beta.10",
|
|
54
|
+
"@operato/font": "^1.0.0-beta.10",
|
|
55
|
+
"@operato/graphql": "^1.0.0-beta.10",
|
|
56
|
+
"@operato/i18n": "^1.0.0-beta.10",
|
|
57
|
+
"@operato/input": "^1.0.0-beta.10",
|
|
58
|
+
"@operato/markdown": "^1.0.0-beta.10",
|
|
59
|
+
"@operato/popup": "^1.0.0-beta.10",
|
|
60
|
+
"@operato/property-editor": "^1.0.0-beta.10",
|
|
61
|
+
"@operato/styles": "^1.0.0-beta.10",
|
|
62
|
+
"@operato/utils": "^1.0.0-beta.10",
|
|
62
63
|
"@polymer/paper-dropdown-menu": "^3.2.0",
|
|
63
|
-
"@things-factory/modeller-ui": "^5.0.0-alpha.5",
|
|
64
64
|
"@types/file-saver": "^2.0.4",
|
|
65
65
|
"@types/sortablejs": "^1.10.7",
|
|
66
66
|
"file-saver": "^2.0.5",
|
|
67
|
-
"lit": "^2.2.
|
|
67
|
+
"lit": "^2.2.1",
|
|
68
68
|
"lodash-es": "^4.17.21",
|
|
69
69
|
"sortablejs": "^1.14.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
73
73
|
"@hatiolab/prettier-config": "^1.0.0",
|
|
74
|
-
"@hatiolab/things-scene": "^
|
|
74
|
+
"@hatiolab/things-scene": "^3.0.5",
|
|
75
75
|
"@material/mwc-fab": "^0.25.3",
|
|
76
76
|
"@material/mwc-icon": "^0.25.3",
|
|
77
77
|
"@open-wc/eslint-config": "^4.3.0",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"prettier --write"
|
|
108
108
|
]
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "90fef9c72ab5a9fec0c03bbfb0f49d31408ecb24"
|
|
111
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
|
+
}
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import './component-detail'
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
8
|
+
import { Pallet, PalletItem } from '../../types'
|
|
8
9
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
9
10
|
|
|
10
11
|
import { Scene } from '@hatiolab/things-scene'
|
|
11
12
|
import { ScrollbarStyles } from '@operato/styles'
|
|
12
13
|
|
|
13
|
-
import { Pallet, PalletItem } from '../../types'
|
|
14
|
-
|
|
15
14
|
const noImage = new URL('../../../../icons/components/no-image.png', import.meta.url).href
|
|
16
15
|
|
|
17
16
|
@customElement('component-menu')
|
|
@@ -177,7 +176,7 @@ class ComponentMenu extends LitElement {
|
|
|
177
176
|
|
|
178
177
|
if (this.scene) {
|
|
179
178
|
this.template = this.templates.find(template => template.type == type)
|
|
180
|
-
this.template && this.scene.
|
|
179
|
+
this.template && this.scene.startAddMode(JSON.parse(JSON.stringify(this.template.model)))
|
|
181
180
|
}
|
|
182
181
|
|
|
183
182
|
this.group = null
|
|
@@ -98,7 +98,7 @@ class ComponentToolbar extends LitElement {
|
|
|
98
98
|
|
|
99
99
|
render() {
|
|
100
100
|
const componentList = this.componentGroupList || []
|
|
101
|
-
const modeIcon = this.icons[this.mode === SCENE_MODE.
|
|
101
|
+
const modeIcon = this.icons[this.mode === SCENE_MODE.SHIFT ? 'mode-shift' : 'mode-edit']
|
|
102
102
|
|
|
103
103
|
return html`
|
|
104
104
|
<img id="shift" .src=${modeIcon} @click=${(e: MouseEvent) => this._onClickShift(e)} />
|
|
@@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues } from 'lit'
|
|
|
6
6
|
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
|
7
7
|
|
|
8
8
|
import { Component, Scene } from '@hatiolab/things-scene'
|
|
9
|
-
import { isMacOS } from '@operato/utils'
|
|
9
|
+
import { copyToClipboard, isMacOS } from '@operato/utils'
|
|
10
10
|
|
|
11
11
|
import { style } from './edit-toolbar-style'
|
|
12
12
|
|
|
@@ -461,12 +461,12 @@ export class EditToolbar extends LitElement {
|
|
|
461
461
|
this.scene?.cut()
|
|
462
462
|
}
|
|
463
463
|
|
|
464
|
-
onTapCopy() {
|
|
464
|
+
async onTapCopy() {
|
|
465
465
|
var copied = this.scene?.copy()
|
|
466
466
|
|
|
467
467
|
if (!copied) return
|
|
468
468
|
|
|
469
|
-
|
|
469
|
+
await copyToClipboard(copied)
|
|
470
470
|
this.cliped = copied
|
|
471
471
|
}
|
|
472
472
|
|
|
@@ -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
|
|
|
@@ -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,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속성에 값을 가져야 한다.
|
|
@@ -6,7 +6,7 @@ import '@polymer/paper-dropdown-menu/paper-dropdown-menu'
|
|
|
6
6
|
import '@operato/help/ox-title-with-help.js'
|
|
7
7
|
import '@operato/input/ox-input-color.js'
|
|
8
8
|
import '@operato/app/input/ox-input-fill-style.js'
|
|
9
|
-
import '@
|
|
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'
|
|
@@ -373,12 +373,12 @@ class PropertyStyles extends AbstractProperty {
|
|
|
373
373
|
<ox-i18n msgid="label.font-family">Font Family</ox-i18n>
|
|
374
374
|
</label>
|
|
375
375
|
|
|
376
|
-
<
|
|
376
|
+
<ox-font-selector
|
|
377
377
|
value-key="fontFamily"
|
|
378
378
|
.value=${fontFamily}
|
|
379
379
|
class="property-full-input"
|
|
380
380
|
custom-editor
|
|
381
|
-
></
|
|
381
|
+
></ox-font-selector>
|
|
382
382
|
|
|
383
383
|
<label class="property-half-label icon-only-label font-size"></label>
|
|
384
384
|
<input type="number" value-key="fontSize" .value=${fontSize} class="property-half-input" />
|
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
|
|
|
@@ -242,6 +241,7 @@ export class BoardModeller extends LitElement {
|
|
|
242
241
|
>
|
|
243
242
|
<ox-scene-layer type="selection-layer"></ox-scene-layer>
|
|
244
243
|
<ox-scene-layer type="modeling-layer"></ox-scene-layer>
|
|
244
|
+
<ox-scene-layer type="add-layer"> </ox-scene-layer>
|
|
245
245
|
<ox-scene-layer type="guide-layer">
|
|
246
246
|
<ox-scene-property name="ruler" value="disabled"></ox-scene-property>
|
|
247
247
|
</ox-scene-layer>
|
|
@@ -256,7 +256,7 @@ export class BoardModeller extends LitElement {
|
|
|
256
256
|
<ox-scene-property name="paddingTop" value="50" type="number"></ox-scene-property>
|
|
257
257
|
<ox-scene-property name="paddingLeft" value="50" type="number"></ox-scene-property>
|
|
258
258
|
</ox-scene-layer>
|
|
259
|
-
<ox-scene-layer type="
|
|
259
|
+
<ox-scene-layer type="decotag-layer"></ox-scene-layer>
|
|
260
260
|
<ox-scene-handler type="text-editor"></ox-scene-handler>
|
|
261
261
|
<ox-scene-handler type="move-handler"></ox-scene-handler>
|
|
262
262
|
</ox-scene-viewer>
|