@operato/board 0.2.46 → 0.2.50
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 +49 -0
- package/assets/images/components/audio.png +0 -0
- package/assets/images/components/both-arrow.png +0 -0
- package/assets/images/components/color-image.png +0 -0
- package/assets/images/components/container.png +0 -0
- package/assets/images/components/dash.png +0 -0
- package/assets/images/components/donut.png +0 -0
- package/assets/images/components/ellipse.png +0 -0
- package/assets/images/components/forklift.png +0 -0
- package/assets/images/components/gif-image.png +0 -0
- package/assets/images/components/global-reference.png +0 -0
- package/assets/images/components/gray-image.png +0 -0
- package/assets/images/components/humidity-sensor.png +0 -0
- package/assets/images/components/info-window.png +0 -0
- package/assets/images/components/line.png +0 -0
- package/assets/images/components/local-reference.png +0 -0
- package/assets/images/components/person.png +0 -0
- package/assets/images/components/polygon.png +0 -0
- package/assets/images/components/polyline.png +0 -0
- package/assets/images/components/popup.png +0 -0
- package/assets/images/components/rect.png +0 -0
- package/assets/images/components/single-arrow.png +0 -0
- package/assets/images/components/star.png +0 -0
- package/assets/images/components/text.png +0 -0
- package/assets/images/components/triangle.png +0 -0
- package/assets/images/icon-vtoolbar.png +0 -0
- package/custom-elements.json +1647 -1130
- package/demo/index-modeller.html +101 -0
- package/demo/index.html +3 -3
- package/dist/src/component/3d.d.ts +2 -0
- package/dist/src/component/3d.js +27 -0
- package/dist/src/component/3d.js.map +1 -0
- package/dist/src/component/chart-and-gauge.d.ts +2 -0
- package/dist/src/component/chart-and-gauge.js +26 -0
- package/dist/src/component/chart-and-gauge.js.map +1 -0
- package/dist/src/component/container.d.ts +2 -0
- package/dist/src/component/container.js +60 -0
- package/dist/src/component/container.js.map +1 -0
- package/dist/src/component/data-source.d.ts +2 -0
- package/dist/src/component/data-source.js +28 -0
- package/dist/src/component/data-source.js.map +1 -0
- package/dist/src/component/etc.d.ts +2 -0
- package/dist/src/component/etc.js +82 -0
- package/dist/src/component/etc.js.map +1 -0
- package/dist/src/component/form.d.ts +2 -0
- package/dist/src/component/form.js +40 -0
- package/dist/src/component/form.js.map +1 -0
- package/dist/src/component/index.d.ts +12 -0
- package/dist/src/component/index.js +13 -0
- package/dist/src/component/index.js.map +1 -0
- package/dist/src/component/iot.d.ts +2 -0
- package/dist/src/component/iot.js +50 -0
- package/dist/src/component/iot.js.map +1 -0
- package/dist/src/component/line.d.ts +2 -0
- package/dist/src/component/line.js +130 -0
- package/dist/src/component/line.js.map +1 -0
- package/dist/src/component/register-default-groups.d.ts +1 -0
- package/dist/src/component/register-default-groups.js +28 -0
- package/dist/src/component/register-default-groups.js.map +1 -0
- package/dist/src/component/shape.d.ts +2 -0
- package/dist/src/component/shape.js +152 -0
- package/dist/src/component/shape.js.map +1 -0
- package/dist/src/component/table.d.ts +2 -0
- package/dist/src/component/table.js +26 -0
- package/dist/src/component/table.js.map +1 -0
- package/dist/src/component/text-and-media.d.ts +2 -0
- package/dist/src/component/text-and-media.js +122 -0
- package/dist/src/component/text-and-media.js.map +1 -0
- package/dist/src/component/warehouse.d.ts +2 -0
- package/dist/src/component/warehouse.js +24 -0
- package/dist/src/component/warehouse.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-detail.d.ts +4 -0
- package/dist/src/modeller/component-toolbar/component-detail.js +56 -0
- package/dist/src/modeller/component-toolbar/component-detail.js.map +1 -0
- package/dist/src/modeller/component-toolbar/component-menu.d.ts +1 -1
- package/dist/src/modeller/component-toolbar/component-menu.js +55 -10
- package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -1
- package/dist/src/modeller/component-toolbar/component-toolbar.js +44 -89
- package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +2 -3
- package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +25 -22
- 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.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +21 -17
- 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/effects.d.ts +0 -1
- package/dist/src/modeller/property-sidebar/effects/effects.js +6 -10
- package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animation.d.ts +2 -3
- package/dist/src/modeller/property-sidebar/effects/property-animation.js +21 -25
- package/dist/src/modeller/property-sidebar/effects/property-animation.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-animations.d.ts +0 -1
- package/dist/src/modeller/property-sidebar/effects/property-animations.js +3 -4
- package/dist/src/modeller/property-sidebar/effects/property-animations.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +3 -7
- package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +3 -7
- package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +0 -1
- package/dist/src/modeller/property-sidebar/effects/property-event.js +4 -8
- package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -1
- package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +1 -2
- package/dist/src/modeller/property-sidebar/effects/property-shadow.js +6 -10
- package/dist/src/modeller/property-sidebar/effects/property-shadow.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 +2 -2
- package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -1
- package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +2 -3
- package/dist/src/modeller/property-sidebar/shapes/shapes.js +27 -30
- package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
- package/dist/src/modeller/property-sidebar/styles/styles.d.ts +0 -1
- package/dist/src/modeller/property-sidebar/styles/styles.js +0 -1
- package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -1
- package/dist/src/ox-board-modeller.d.ts +5 -0
- package/dist/src/ox-board-modeller.js +33 -0
- package/dist/src/ox-board-modeller.js.map +1 -1
- package/dist/src/types.d.ts +13 -0
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
- package/src/component/3d.ts +29 -0
- package/src/component/chart-and-gauge.ts +28 -0
- package/src/component/container.ts +62 -0
- package/src/component/data-source.ts +30 -0
- package/src/component/etc.ts +87 -0
- package/src/component/form.ts +42 -0
- package/src/component/index.ts +12 -0
- package/src/component/iot.ts +52 -0
- package/src/component/line.ts +132 -0
- package/src/component/register-default-groups.ts +28 -0
- package/src/component/shape.ts +154 -0
- package/src/component/table.ts +28 -0
- package/src/component/text-and-media.ts +124 -0
- package/src/component/warehouse.ts +26 -0
- package/src/modeller/component-toolbar/component-detail.ts +53 -0
- package/src/modeller/component-toolbar/component-menu.ts +56 -11
- package/src/modeller/component-toolbar/component-toolbar.ts +54 -94
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +26 -23
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +19 -17
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +2 -2
- package/src/modeller/property-sidebar/effects/effects.ts +10 -8
- package/src/modeller/property-sidebar/effects/property-animation.ts +25 -23
- package/src/modeller/property-sidebar/effects/property-animations.ts +7 -5
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +4 -4
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +4 -4
- package/src/modeller/property-sidebar/effects/property-event.ts +8 -6
- package/src/modeller/property-sidebar/effects/property-shadow.ts +9 -7
- package/src/modeller/property-sidebar/property-shared-style.ts +2 -2
- package/src/modeller/property-sidebar/shapes/shapes.ts +29 -31
- package/src/modeller/property-sidebar/styles/styles.ts +2 -2
- package/src/ox-board-modeller.ts +46 -6
- package/src/types.ts +28 -0
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import './component-detail'
|
|
6
|
+
|
|
5
7
|
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
6
8
|
import { Pallet, PalletItem } from '../../types'
|
|
7
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
9
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
8
10
|
|
|
9
11
|
import { Scene } from '@hatiolab/things-scene'
|
|
10
12
|
import { ScrollbarStyles } from '@operato/styles'
|
|
@@ -27,7 +29,7 @@ class ComponentMenu extends LitElement {
|
|
|
27
29
|
width: 180px;
|
|
28
30
|
height: 100%;
|
|
29
31
|
|
|
30
|
-
overflow:
|
|
32
|
+
overflow: visible;
|
|
31
33
|
|
|
32
34
|
border: 2px solid var(--component-menu-border-color);
|
|
33
35
|
box-sizing: border-box;
|
|
@@ -80,20 +82,40 @@ class ComponentMenu extends LitElement {
|
|
|
80
82
|
width: var(--component-menu-item-icon-size);
|
|
81
83
|
height: var(--component-menu-item-icon-size);
|
|
82
84
|
}
|
|
85
|
+
|
|
86
|
+
component-detail {
|
|
87
|
+
position: absolute;
|
|
88
|
+
top: 0;
|
|
89
|
+
left: 180px;
|
|
90
|
+
height: 100%;
|
|
91
|
+
outline: none;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
component-detail[hidden] {
|
|
95
|
+
display: none;
|
|
96
|
+
}
|
|
83
97
|
`
|
|
84
98
|
]
|
|
85
99
|
|
|
86
100
|
@property({ type: Object }) groups: Pallet[] = []
|
|
87
101
|
@property({ type: Object }) scene: Scene | null = null
|
|
88
102
|
@property({ type: String }) group: string | null = ''
|
|
89
|
-
|
|
103
|
+
|
|
104
|
+
@state() templates: PalletItem[] = []
|
|
105
|
+
@state() template: PalletItem | any
|
|
106
|
+
|
|
107
|
+
@query('component-detail') detail!: HTMLElement
|
|
90
108
|
|
|
91
109
|
render() {
|
|
92
110
|
return this.group
|
|
93
111
|
? html`
|
|
94
112
|
<h2 onclick=${(e: MouseEvent) => e.stopPropagation()}>${this.group} list</h2>
|
|
95
113
|
|
|
96
|
-
<div
|
|
114
|
+
<div
|
|
115
|
+
templates
|
|
116
|
+
@mouseover=${(e: MouseEvent) => this.onHoverComponent(e)}
|
|
117
|
+
@mouseout=${(e: MouseEvent) => (this.template = null)}
|
|
118
|
+
>
|
|
97
119
|
${(this.templates || []).map(
|
|
98
120
|
template => html`
|
|
99
121
|
<div @click=${this.onClickTemplate} data-type=${template.type} template>
|
|
@@ -102,6 +124,16 @@ class ComponentMenu extends LitElement {
|
|
|
102
124
|
`
|
|
103
125
|
)}
|
|
104
126
|
</div>
|
|
127
|
+
|
|
128
|
+
<component-detail
|
|
129
|
+
tabindex="-1"
|
|
130
|
+
@focusout=${() => {
|
|
131
|
+
this.template = null
|
|
132
|
+
}}
|
|
133
|
+
.template=${this.template}
|
|
134
|
+
hidden
|
|
135
|
+
>
|
|
136
|
+
</component-detail>
|
|
105
137
|
`
|
|
106
138
|
: html``
|
|
107
139
|
}
|
|
@@ -109,13 +141,28 @@ class ComponentMenu extends LitElement {
|
|
|
109
141
|
updated(changes: PropertyValues<this>) {
|
|
110
142
|
if (changes.has('group')) {
|
|
111
143
|
if (!this.group) {
|
|
112
|
-
this.style.display = 'none'
|
|
113
144
|
this.templates = []
|
|
145
|
+
this.setAttribute('hidden', '')
|
|
114
146
|
} else {
|
|
115
|
-
this.style.display = 'flex'
|
|
116
147
|
this.templates = this.groups.find((g: Pallet) => g.name === this.group)?.templates || []
|
|
148
|
+
this.removeAttribute('active')
|
|
117
149
|
}
|
|
118
150
|
}
|
|
151
|
+
|
|
152
|
+
if (changes.has('template')) {
|
|
153
|
+
this.template && this.template.about
|
|
154
|
+
? this.detail.removeAttribute('hidden')
|
|
155
|
+
: this.detail.setAttribute('hidden', '')
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
findTemplate(type: string | null | undefined) {
|
|
160
|
+
this.template = type && this.templates.find(template => template.type == type)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
onHoverComponent(e: MouseEvent) {
|
|
164
|
+
const button = e.target as HTMLElement
|
|
165
|
+
this.findTemplate(button!.closest('[data-type]')?.getAttribute('data-type'))
|
|
119
166
|
}
|
|
120
167
|
|
|
121
168
|
onClickTemplate(e: MouseEvent) {
|
|
@@ -126,11 +173,9 @@ class ComponentMenu extends LitElement {
|
|
|
126
173
|
return
|
|
127
174
|
}
|
|
128
175
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var template = group.templates.find(template => template.type == type)
|
|
133
|
-
template && this.scene.add(JSON.parse(JSON.stringify(template.model)), { cx: 200, cy: 200 })
|
|
176
|
+
if (this.scene) {
|
|
177
|
+
this.template = this.templates.find(template => template.type == type)
|
|
178
|
+
this.template && this.scene.add(JSON.parse(JSON.stringify(this.template.model)), { cx: 200, cy: 200 })
|
|
134
179
|
}
|
|
135
180
|
|
|
136
181
|
this.group = null
|
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import './component-menu'
|
|
6
6
|
|
|
7
|
-
import { LitElement, css, html } from 'lit'
|
|
7
|
+
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
8
8
|
import { SCENE_MODE, Scene } from '@hatiolab/things-scene'
|
|
9
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
9
|
+
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
|
10
|
+
|
|
11
|
+
import { Group } from '../../types'
|
|
10
12
|
|
|
11
13
|
@customElement('component-toolbar')
|
|
12
14
|
class ComponentToolbar extends LitElement {
|
|
@@ -21,7 +23,7 @@ class ComponentToolbar extends LitElement {
|
|
|
21
23
|
background-color: var(--component-toolbar-background-color);
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
img {
|
|
25
27
|
display: flex;
|
|
26
28
|
flex-direction: row;
|
|
27
29
|
|
|
@@ -31,130 +33,88 @@ class ComponentToolbar extends LitElement {
|
|
|
31
33
|
|
|
32
34
|
border-bottom: var(--component-toolbar-border);
|
|
33
35
|
margin: 0;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
span[data-group='line'] {
|
|
38
|
-
background-position: 50% -186px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
span[data-group='shape'] {
|
|
42
|
-
background-position: 0px -284px;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
span[data-group='textAndMedia'] {
|
|
46
|
-
background-position: 50% -385px;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
span[data-group='chartAndGauge'] {
|
|
50
|
-
background-position: 50% -488px;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
span[data-group='table'] {
|
|
54
|
-
background-position: 50% -585px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
span[data-group='container'] {
|
|
58
|
-
background-position: 50% -685px;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
span[data-group='dataSource'] {
|
|
62
|
-
background-position: 50% -888px;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
span[data-group='IoT'] {
|
|
66
|
-
background-position: -3px -788px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
span[data-group='3D'] {
|
|
70
|
-
background-position: 50% -992px;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
span[data-group='warehouse'] {
|
|
74
|
-
background-position: -2px -1089px;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
span[data-group='form'] {
|
|
78
|
-
background-position: -2px -1287px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
span[data-group='etc'] {
|
|
82
|
-
background-position: -1px -1189px;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.pressed {
|
|
86
|
-
background-position: 0 15px;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.pressed[pressed],
|
|
90
|
-
.pressed[active] {
|
|
91
|
-
background-position: -3px -88px;
|
|
92
|
-
background-color: #beb9b3;
|
|
36
|
+
padding: 6px;
|
|
37
|
+
box-sizing: border-box;
|
|
93
38
|
}
|
|
94
39
|
|
|
95
40
|
component-menu {
|
|
96
|
-
display: none;
|
|
97
41
|
position: absolute;
|
|
98
42
|
top: 0;
|
|
99
43
|
left: var(--component-toolbar-icon-size);
|
|
100
44
|
height: 100%;
|
|
101
45
|
outline: none;
|
|
102
46
|
}
|
|
47
|
+
|
|
48
|
+
component-menu[hidden] {
|
|
49
|
+
display: none;
|
|
50
|
+
}
|
|
103
51
|
`
|
|
104
52
|
]
|
|
105
53
|
|
|
106
|
-
@property({ type: Array }) componentGroupList:
|
|
54
|
+
@property({ type: Array }) componentGroupList: Group[] = []
|
|
107
55
|
@property({ type: String }) group?: string | null
|
|
108
56
|
@property({ type: Object }) scene!: Scene
|
|
109
57
|
@property({ type: Number }) mode: SCENE_MODE = SCENE_MODE.VIEW
|
|
110
58
|
|
|
111
|
-
@query('
|
|
59
|
+
@query('component-menu') private menu!: HTMLElement
|
|
60
|
+
@queryAll('[data-group]') private groups!: NodeListOf<HTMLElement>
|
|
61
|
+
|
|
62
|
+
private icons: { [name: string]: string } = {}
|
|
63
|
+
|
|
64
|
+
updated(changes: PropertyValues<this>) {
|
|
65
|
+
if (changes.has('componentGroupList')) {
|
|
66
|
+
const color = getComputedStyle(this, null).getPropertyValue('--primary-color')
|
|
67
|
+
|
|
68
|
+
this.icons = (this.componentGroupList || [])
|
|
69
|
+
.filter(group => group.templates?.length > 0)
|
|
70
|
+
.reduce((sum, group: Group) => {
|
|
71
|
+
sum[group.name] =
|
|
72
|
+
'data:image/svg+xml;charset=UTF-8;base64,' + btoa(group.icon.replace(/{{strokeColor}}/g, color))
|
|
73
|
+
return sum
|
|
74
|
+
}, {} as { [name: string]: string })
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (changes.has('group')) {
|
|
78
|
+
this.groups.forEach(group => {
|
|
79
|
+
group.getAttribute('data-group') === this.group
|
|
80
|
+
? group.setAttribute('active', '')
|
|
81
|
+
: group.removeAttribute('active')
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
this.group ? this.menu.removeAttribute('hidden') : this.menu.setAttribute('hidden', '')
|
|
85
|
+
}
|
|
86
|
+
}
|
|
112
87
|
|
|
113
88
|
render() {
|
|
114
|
-
|
|
115
|
-
<span id="shift" class="pressed" @click=${() => this._onClickShift()}> </span>
|
|
89
|
+
const componentList = this.componentGroupList || []
|
|
116
90
|
|
|
117
|
-
|
|
91
|
+
return html`
|
|
92
|
+
${componentList
|
|
118
93
|
.filter(group => group.templates?.length > 0)
|
|
119
|
-
.map(
|
|
94
|
+
.map(
|
|
95
|
+
group => html`
|
|
96
|
+
<img
|
|
97
|
+
data-group=${group.name}
|
|
98
|
+
@click=${(e: MouseEvent) => this._onClickGroup(e)}
|
|
99
|
+
.src=${this.icons[group.name]}
|
|
100
|
+
/>
|
|
101
|
+
`
|
|
102
|
+
)}
|
|
120
103
|
|
|
121
104
|
<component-menu
|
|
122
105
|
tabindex="-1"
|
|
123
106
|
@focusout=${() => {
|
|
124
107
|
this.group = null
|
|
125
108
|
}}
|
|
126
|
-
id="menu"
|
|
127
109
|
.scene=${this.scene}
|
|
128
110
|
.group=${this.group}
|
|
129
|
-
.groups=${
|
|
130
|
-
|
|
111
|
+
.groups=${componentList}
|
|
112
|
+
hidden
|
|
131
113
|
>
|
|
132
114
|
</component-menu>
|
|
133
115
|
`
|
|
134
116
|
}
|
|
135
117
|
|
|
136
|
-
_setMode(mode: SCENE_MODE) {
|
|
137
|
-
this.mode = mode
|
|
138
|
-
this.dispatchEvent(
|
|
139
|
-
new CustomEvent('mode-changed', {
|
|
140
|
-
bubbles: true,
|
|
141
|
-
composed: true,
|
|
142
|
-
detail: { value: mode }
|
|
143
|
-
})
|
|
144
|
-
)
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
_onClickShift() {
|
|
148
|
-
var shift = this.renderRoot.querySelector('#shift')
|
|
149
|
-
if (shift?.hasAttribute('active')) {
|
|
150
|
-
shift.removeAttribute('active')
|
|
151
|
-
this._setMode(SCENE_MODE.EDIT)
|
|
152
|
-
} else {
|
|
153
|
-
shift!.setAttribute('active', '')
|
|
154
|
-
this._setMode(SCENE_MODE.SHIFT)
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
|
|
158
118
|
async _onClickGroup(e: MouseEvent) {
|
|
159
119
|
var button = e.target as HTMLElement
|
|
160
120
|
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@things-factory/
|
|
6
|
-
import '@things-factory/modeller-ui/client/editors/things-editor-code'
|
|
5
|
+
// import '@things-factory/modeller-ui/client/editors/things-editor-code'
|
|
7
6
|
import '@things-factory/modeller-ui/client/editors/things-editor-value-map'
|
|
8
7
|
import '@things-factory/modeller-ui/client/editors/things-editor-value-range'
|
|
9
|
-
import '@
|
|
8
|
+
import '@operato/input/dist/src/ox-buttons-radio'
|
|
9
|
+
import '@operato/input/dist/src/ox-input-code'
|
|
10
10
|
|
|
11
11
|
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
12
12
|
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
@@ -70,7 +70,7 @@ export default class DataBindingMapper extends LitElement {
|
|
|
70
70
|
|
|
71
71
|
input,
|
|
72
72
|
select,
|
|
73
|
-
|
|
73
|
+
ox-buttons-radio,
|
|
74
74
|
[mapping-rule] {
|
|
75
75
|
grid-column: span 7;
|
|
76
76
|
}
|
|
@@ -79,19 +79,19 @@ export default class DataBindingMapper extends LitElement {
|
|
|
79
79
|
border: var(--property-sidebar-fieldset-border);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
ox-buttons-radio {
|
|
83
83
|
display: flex;
|
|
84
84
|
padding: 0 4px;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
ox-buttons-radio > * {
|
|
88
88
|
text-align: center;
|
|
89
89
|
flex: 1;
|
|
90
90
|
margin: 2px;
|
|
91
91
|
border-bottom: 2px solid #fff;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
ox-buttons-radio div[active] {
|
|
95
95
|
border-color: #f2471c;
|
|
96
96
|
}
|
|
97
97
|
|
|
@@ -121,7 +121,7 @@ export default class DataBindingMapper extends LitElement {
|
|
|
121
121
|
display: none;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
|
|
124
|
+
ox-input-code {
|
|
125
125
|
height: 300px;
|
|
126
126
|
overflow: auto;
|
|
127
127
|
}
|
|
@@ -169,6 +169,10 @@ export default class DataBindingMapper extends LitElement {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
render() {
|
|
172
|
+
const mapping = this.mapping || {
|
|
173
|
+
rule: 'value'
|
|
174
|
+
}
|
|
175
|
+
|
|
172
176
|
return html`
|
|
173
177
|
<label for="accessor-input"> <i18n-msg msgid="label.accessor">accessor</i18n-msg> </label>
|
|
174
178
|
<input
|
|
@@ -176,7 +180,7 @@ export default class DataBindingMapper extends LitElement {
|
|
|
176
180
|
value-key="accessor"
|
|
177
181
|
type="text"
|
|
178
182
|
data-mapping-accessor
|
|
179
|
-
.value=${
|
|
183
|
+
.value=${mapping.accessor || ''}
|
|
180
184
|
/>
|
|
181
185
|
|
|
182
186
|
<label for="target-input"> <i18n-msg msgid="label.target">target</i18n-msg> </label>
|
|
@@ -185,7 +189,7 @@ export default class DataBindingMapper extends LitElement {
|
|
|
185
189
|
type="text"
|
|
186
190
|
value-key="target"
|
|
187
191
|
list="target-list"
|
|
188
|
-
.value=${
|
|
192
|
+
.value=${mapping.target || ''}
|
|
189
193
|
@focusin=${() => {
|
|
190
194
|
if (!this.scene) this._componentIds = []
|
|
191
195
|
this._componentIds = this.scene!.ids.map(info => info.key).filter(id => !!id)
|
|
@@ -200,45 +204,44 @@ export default class DataBindingMapper extends LitElement {
|
|
|
200
204
|
</datalist>
|
|
201
205
|
|
|
202
206
|
<label for="property-input"> <i18n-msg msgid="label.property">property</i18n-msg> </label>
|
|
203
|
-
<select id="property-input" value-key="property" .value=${
|
|
207
|
+
<select id="property-input" value-key="property" .value=${mapping.property}>
|
|
204
208
|
${this.properties.map(
|
|
205
|
-
item =>
|
|
206
|
-
html` <option .value=${item.name} ?selected=${item.name == this.mapping.property}>${item.label}</option> `
|
|
209
|
+
item => html` <option .value=${item.name} ?selected=${item.name == mapping.property}>${item.label}</option> `
|
|
207
210
|
)}
|
|
208
211
|
</select>
|
|
209
212
|
|
|
210
213
|
<label> <i18n-msg msgid="label.rule-type">rule type</i18n-msg> </label>
|
|
211
|
-
<
|
|
214
|
+
<ox-buttons-radio .value=${mapping.rule} @change=${(e: Event) => this._onChangeRule(e)}>
|
|
212
215
|
<div data-value="value"><i18n-msg msgid="label.value"></i18n-msg></div>
|
|
213
216
|
<div data-value="map"><i18n-msg msgid="label.map"></i18n-msg></div>
|
|
214
217
|
<div data-value="range"><i18n-msg msgid="label.range"></i18n-msg></div>
|
|
215
218
|
<div data-value="eval"><i18n-msg msgid="label.eval"></i18n-msg></div>
|
|
216
|
-
</
|
|
219
|
+
</ox-buttons-radio>
|
|
217
220
|
|
|
218
|
-
<div rule-editors class="content" ?hidden=${
|
|
221
|
+
<div rule-editors class="content" ?hidden=${mapping.rule == 'value'}>
|
|
219
222
|
<things-editor-value-map
|
|
220
223
|
value-key="map"
|
|
221
224
|
.value=${this.rule.map || {}}
|
|
222
|
-
.valuetype=${this._valuetype(
|
|
223
|
-
?active=${
|
|
225
|
+
.valuetype=${this._valuetype(mapping.property!)}
|
|
226
|
+
?active=${mapping.rule == 'map'}
|
|
224
227
|
>
|
|
225
228
|
</things-editor-value-map>
|
|
226
229
|
|
|
227
230
|
<things-editor-value-range
|
|
228
231
|
value-key="range"
|
|
229
232
|
.value=${this.rule.range || []}
|
|
230
|
-
.valuetype=${this._valuetype(
|
|
231
|
-
?active=${
|
|
233
|
+
.valuetype=${this._valuetype(mapping.property!)}
|
|
234
|
+
?active=${mapping.rule == 'range'}
|
|
232
235
|
>
|
|
233
236
|
</things-editor-value-range>
|
|
234
237
|
|
|
235
|
-
<
|
|
238
|
+
<ox-input-code
|
|
236
239
|
value-key="eval"
|
|
237
240
|
id="eval-editor"
|
|
238
241
|
.value=${this.rule.eval || ''}
|
|
239
|
-
?active=${
|
|
242
|
+
?active=${mapping.rule == 'eval'}
|
|
240
243
|
>
|
|
241
|
-
</
|
|
244
|
+
</ox-input-code>
|
|
242
245
|
</div>
|
|
243
246
|
`
|
|
244
247
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@things-factory/i18n-base'
|
|
6
5
|
import './data-binding-mapper'
|
|
7
6
|
import '@material/mwc-icon'
|
|
8
7
|
import '@things-factory/help'
|
|
9
8
|
import '@operato/input/dist/src/ox-buttons-radio.js'
|
|
9
|
+
import '@operato/input/dist/src/ox-input-data'
|
|
10
10
|
|
|
11
11
|
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
12
12
|
import { PropertyValues, css, html } from 'lit'
|
|
@@ -161,9 +161,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
161
161
|
`
|
|
162
162
|
]
|
|
163
163
|
|
|
164
|
-
@property({ type: Object }) value
|
|
165
|
-
mappings: []
|
|
166
|
-
}
|
|
164
|
+
@property({ type: Object }) value?: Properties
|
|
167
165
|
@property({ type: Object }) scene?: Scene
|
|
168
166
|
|
|
169
167
|
@state() mappingIndex: number = 0
|
|
@@ -177,7 +175,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
177
175
|
private mapping: Properties = {}
|
|
178
176
|
|
|
179
177
|
get mappings() {
|
|
180
|
-
return this.value
|
|
178
|
+
return this.value?.mappings || []
|
|
181
179
|
}
|
|
182
180
|
|
|
183
181
|
firstUpdated() {
|
|
@@ -195,6 +193,10 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
195
193
|
}
|
|
196
194
|
|
|
197
195
|
render() {
|
|
196
|
+
const value = this.value || {
|
|
197
|
+
mappings: []
|
|
198
|
+
}
|
|
199
|
+
|
|
198
200
|
return html`
|
|
199
201
|
<fieldset>
|
|
200
202
|
<legend>
|
|
@@ -202,21 +204,21 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
202
204
|
</legend>
|
|
203
205
|
<div class="property-grid">
|
|
204
206
|
<label> <i18n-msg msgid="label.id">ID</i18n-msg> </label>
|
|
205
|
-
<input value-key="id" .value=${
|
|
207
|
+
<input value-key="id" .value=${value.id || ''} />
|
|
206
208
|
|
|
207
209
|
<label> <i18n-msg msgid="label.class">Class</i18n-msg> </label>
|
|
208
|
-
<input value-key="class" .value=${
|
|
210
|
+
<input value-key="class" .value=${value.class || ''} />
|
|
209
211
|
|
|
210
212
|
<label> <i18n-msg msgid="label.template-prefix">Template Prefix</i18n-msg> </label>
|
|
211
|
-
<input value-key="templatePrefix" .value=${
|
|
213
|
+
<input value-key="templatePrefix" .value=${value.templatePrefix || ''} />
|
|
212
214
|
|
|
213
215
|
<div class="checkbox-row">
|
|
214
|
-
<input id="checkbox-ndns" type="checkbox" value-key="ndns" .checked=${
|
|
216
|
+
<input id="checkbox-ndns" type="checkbox" value-key="ndns" .checked=${value.ndns} />
|
|
215
217
|
<label for="checkbox-ndns"> <i18n-msg msgid="label.ndns">No Data No Show</i18n-msg> </label>
|
|
216
218
|
</div>
|
|
217
219
|
|
|
218
220
|
<div class="checkbox-row">
|
|
219
|
-
<input id="checkbox-sensitive" type="checkbox" value-key="sensitive" .checked=${
|
|
221
|
+
<input id="checkbox-sensitive" type="checkbox" value-key="sensitive" .checked=${value.sensitive} />
|
|
220
222
|
<label for="checkbox-sensitive">
|
|
221
223
|
<i18n-msg msgid="label.intent-sensitive">Intent Sensitive</i18n-msg>
|
|
222
224
|
</label>
|
|
@@ -234,7 +236,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
234
236
|
>${this._dataExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
|
|
235
237
|
>
|
|
236
238
|
</legend>
|
|
237
|
-
<
|
|
239
|
+
<ox-input-data value-key="data" .value=${value.data}> </ox-input-data>
|
|
238
240
|
</fieldset>
|
|
239
241
|
|
|
240
242
|
<fieldset>
|
|
@@ -257,8 +259,8 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
257
259
|
this._setMappingIndex((e.target as any).value)
|
|
258
260
|
}}
|
|
259
261
|
>
|
|
260
|
-
${this.mappings.map((m: string, i: number) => html` <div value=${i} data-mapping>${i + 1}</div> `)}
|
|
261
|
-
<div value=${this.mappings.length} data-mapping disabled>${this.mappings.length + 1}</div>
|
|
262
|
+
${this.mappings.map((m: string, i: number) => html` <div data-value=${i} data-mapping>${i + 1}</div> `)}
|
|
263
|
+
<div data-value=${this.mappings.length} data-mapping disabled>${this.mappings.length + 1}</div>
|
|
262
264
|
</ox-buttons-radio>
|
|
263
265
|
|
|
264
266
|
<mwc-icon
|
|
@@ -284,7 +286,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
284
286
|
<data-binding-mapper
|
|
285
287
|
@value-change=${(e: CustomEvent) => this._onMappingChanged(e)}
|
|
286
288
|
.scene=${this.scene}
|
|
287
|
-
.mapping=${(
|
|
289
|
+
.mapping=${(value.mappings && value.mappings[this.mappingIndex]) || {}}
|
|
288
290
|
.properties=${PROPS}
|
|
289
291
|
>
|
|
290
292
|
</data-binding-mapper>
|
|
@@ -299,7 +301,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
299
301
|
}
|
|
300
302
|
|
|
301
303
|
_clearDataBindingMapper() {
|
|
302
|
-
var mappings = [...(this.value
|
|
304
|
+
var mappings = [...(this.value?.mappings || [])]
|
|
303
305
|
mappings.splice(this.mappingIndex, 1)
|
|
304
306
|
this._onAfterValueChange(
|
|
305
307
|
'mappings',
|
|
@@ -313,7 +315,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
313
315
|
|
|
314
316
|
async _pasteDataBindingMapper() {
|
|
315
317
|
var index = this.mappingIndex
|
|
316
|
-
var mappings = [...(this.value
|
|
318
|
+
var mappings = [...(this.value?.mappings || [])]
|
|
317
319
|
mappings[this.mappingIndex] = JSON.parse(clipboard)
|
|
318
320
|
|
|
319
321
|
this._onAfterValueChange('mappings', mappings)
|
|
@@ -370,7 +372,7 @@ class PropertyDataBinding extends AbstractProperty {
|
|
|
370
372
|
}
|
|
371
373
|
|
|
372
374
|
/* mapping의 모든 속성이 편집되면, 모델에 반영한다. */
|
|
373
|
-
var mappings = [...(this.value
|
|
375
|
+
var mappings = [...(this.value?.mappings || [])]
|
|
374
376
|
|
|
375
377
|
if (mapping.target && mapping.property && mapping.rule) {
|
|
376
378
|
mappings[this.mappingIndex] = mapping
|
|
@@ -28,7 +28,7 @@ export const EffectsSharedStyle = css`
|
|
|
28
28
|
|
|
29
29
|
input,
|
|
30
30
|
select,
|
|
31
|
-
|
|
31
|
+
ox-input-angle,
|
|
32
32
|
things-editor-color,
|
|
33
33
|
[custom-editor] {
|
|
34
34
|
grid-column: span 7;
|
|
@@ -36,7 +36,7 @@ export const EffectsSharedStyle = css`
|
|
|
36
36
|
|
|
37
37
|
input,
|
|
38
38
|
select,
|
|
39
|
-
|
|
39
|
+
ox-input-angle input,
|
|
40
40
|
things-editor-color input,
|
|
41
41
|
[custom-editor] input {
|
|
42
42
|
border: var(--property-sidebar-fieldset-border);
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
* @license Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import '@things-factory/i18n-base'
|
|
6
5
|
import './property-animations'
|
|
7
6
|
import './property-event'
|
|
8
7
|
import './property-shadow'
|
|
9
8
|
|
|
9
|
+
import { html } from 'lit'
|
|
10
10
|
import { customElement, property } from 'lit/decorators'
|
|
11
11
|
|
|
12
|
+
import { Properties, Scene } from '@hatiolab/things-scene'
|
|
13
|
+
|
|
12
14
|
import { AbstractProperty } from '../abstract-property'
|
|
13
15
|
import { PropertySharedStyle } from '../property-shared-style'
|
|
14
|
-
import { Scene } from '@hatiolab/things-scene'
|
|
15
|
-
import { html } from 'lit'
|
|
16
16
|
|
|
17
17
|
@customElement('property-effect')
|
|
18
18
|
class PropertyEffects extends AbstractProperty {
|
|
19
19
|
static styles = [PropertySharedStyle]
|
|
20
20
|
|
|
21
|
-
@property({ type: Object }) value
|
|
21
|
+
@property({ type: Object }) value?: Properties
|
|
22
22
|
@property({ type: Object }) scene?: Scene
|
|
23
23
|
|
|
24
24
|
firstUpdated() {
|
|
@@ -26,13 +26,15 @@ class PropertyEffects extends AbstractProperty {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
render() {
|
|
29
|
+
const value = this.value || {}
|
|
30
|
+
|
|
29
31
|
return html`
|
|
30
32
|
<fieldset>
|
|
31
33
|
<legend>
|
|
32
34
|
<title-with-help topic="board-modeller/effects/shadow" msgid="label.shadow">shadow</title-with-help>
|
|
33
35
|
</legend>
|
|
34
36
|
|
|
35
|
-
<property-shadow value-key="shadow" .value=${
|
|
37
|
+
<property-shadow value-key="shadow" .value=${value.shadow || {}}> </property-shadow>
|
|
36
38
|
</fieldset>
|
|
37
39
|
|
|
38
40
|
<fieldset>
|
|
@@ -42,14 +44,14 @@ class PropertyEffects extends AbstractProperty {
|
|
|
42
44
|
|
|
43
45
|
<div class="property-grid">
|
|
44
46
|
<label> <i18n-msg msgid="label.retention">retention</i18n-msg> </label>
|
|
45
|
-
<input type="number" value-key="retention" .value=${
|
|
47
|
+
<input type="number" value-key="retention" .value=${value.retention} placeholder="ms" />
|
|
46
48
|
</div>
|
|
47
49
|
</fieldset>
|
|
48
50
|
|
|
49
|
-
<property-animations value-key="animation" .scene=${this.scene} .value=${
|
|
51
|
+
<property-animations value-key="animation" .scene=${this.scene} .value=${value.animation || {}}>
|
|
50
52
|
</property-animations>
|
|
51
53
|
|
|
52
|
-
<property-event value-key="event" .scene=${this.scene} .value=${
|
|
54
|
+
<property-event value-key="event" .scene=${this.scene} .value=${value.event || {}}> </property-event>
|
|
53
55
|
`
|
|
54
56
|
}
|
|
55
57
|
}
|