@operato/board 8.0.0-beta.0 → 8.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 +9 -0
- package/package.json +14 -14
- package/.storybook/main.js +0 -3
- package/.storybook/server.mjs +0 -8
- package/src/component/3d.ts +0 -29
- package/src/component/chart-and-gauge.ts +0 -28
- package/src/component/container.ts +0 -63
- package/src/component/data-source.ts +0 -30
- package/src/component/etc.ts +0 -88
- package/src/component/form.ts +0 -42
- package/src/component/index.ts +0 -12
- package/src/component/iot.ts +0 -52
- package/src/component/line.ts +0 -156
- package/src/component/register-default-groups.ts +0 -28
- package/src/component/shape.ts +0 -156
- package/src/component/table.ts +0 -28
- package/src/component/text-and-media.ts +0 -125
- package/src/component/warehouse.ts +0 -26
- package/src/data-storage/data-storage.ts +0 -76
- package/src/graphql/board.ts +0 -144
- package/src/graphql/data-subscription.ts +0 -30
- package/src/graphql/favorite-board.ts +0 -25
- package/src/graphql/group.ts +0 -138
- package/src/graphql/index.ts +0 -4
- package/src/graphql/play-group.ts +0 -225
- package/src/graphql/scenario.ts +0 -79
- package/src/index.ts +0 -10
- package/src/modeller/component-toolbar/component-detail.ts +0 -52
- package/src/modeller/component-toolbar/component-menu.ts +0 -196
- package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
- package/src/modeller/component-toolbar/mode-icons.ts +0 -88
- package/src/modeller/edit-toolbar-style.ts +0 -232
- package/src/modeller/edit-toolbar.ts +0 -587
- package/src/modeller/property-sidebar/abstract-property.ts +0 -69
- package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
- package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
- package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
- package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
- package/src/modeller/property-sidebar/effects/effects.ts +0 -69
- package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
- package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
- package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
- package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
- package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
- package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
- package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
- package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
- package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
- package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
- package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
- package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
- package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
- package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
- package/src/modeller/property-sidebar/styles/styles.ts +0 -577
- package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
- package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
- package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
- package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
- package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
- package/src/ox-board-component-info.ts +0 -236
- package/src/ox-board-list.ts +0 -401
- package/src/ox-board-modeller.ts +0 -408
- package/src/ox-board-player-style.ts +0 -200
- package/src/ox-board-player.ts +0 -333
- package/src/ox-board-template-list.ts +0 -267
- package/src/ox-board-template-viewer.ts +0 -198
- package/src/ox-board-viewer.ts +0 -727
- package/src/ox-editor-board-selector.ts +0 -91
- package/src/ox-property-editor-board-selector.ts +0 -23
- package/src/player/ox-board-player-carousel.ts +0 -197
- package/src/player/ox-board-player-grid.ts +0 -78
- package/src/player/ox-board-wrapper.ts +0 -152
- package/src/selector/board-creation-popup.ts +0 -151
- package/src/selector/board-thumbnail-card.ts +0 -175
- package/src/selector/ox-board-creation-card.ts +0 -98
- package/src/selector/ox-board-selector.ts +0 -382
- package/src/types.ts +0 -63
- package/stories/property-data-binding.stories.ts +0 -34
- package/tsconfig.json +0 -24
- package/web-dev-server.config.mjs +0 -30
- package/web-test-runner.config.mjs +0 -29
@@ -1,73 +0,0 @@
|
|
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 msgid="label.hover-event" topic="board-modeller/effects/hover-event"></ox-title-with-help>
|
42
|
-
</legend>
|
43
|
-
|
44
|
-
<property-event-hover value-key="hover" .scene=${this.scene} .value=${value.hover || {}}>
|
45
|
-
</property-event-hover>
|
46
|
-
</fieldset>
|
47
|
-
|
48
|
-
<fieldset>
|
49
|
-
<legend>
|
50
|
-
<ox-title-with-help msgid="label.tap-event" topic="board-modeller/effects/tap-event"></ox-title-with-help>
|
51
|
-
</legend>
|
52
|
-
|
53
|
-
<property-event-tap value-key="tap" .scene=${this.scene} .value=${value.tap || {}}> </property-event-tap>
|
54
|
-
</fieldset>
|
55
|
-
`
|
56
|
-
}
|
57
|
-
|
58
|
-
_onValueChange(e: Event) {
|
59
|
-
var element = e.target as HTMLElement
|
60
|
-
var key = element.getAttribute('value-key')
|
61
|
-
|
62
|
-
if (!key) {
|
63
|
-
return
|
64
|
-
}
|
65
|
-
|
66
|
-
this.value = {
|
67
|
-
...this.value,
|
68
|
-
[key]: convert(element)
|
69
|
-
}
|
70
|
-
|
71
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
72
|
-
}
|
73
|
-
}
|
@@ -1,114 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import '@operato/i18n/ox-i18n.js'
|
6
|
-
import '@operato/input/ox-input-color.js'
|
7
|
-
|
8
|
-
import { css, html, LitElement } from 'lit'
|
9
|
-
import { property } from 'lit/decorators.js'
|
10
|
-
|
11
|
-
import { Properties } from '@hatiolab/things-scene'
|
12
|
-
|
13
|
-
import { convert } from './value-converter'
|
14
|
-
|
15
|
-
/**
|
16
|
-
* 컴포넌트의 그림자 속성을 편집하는 element
|
17
|
-
*
|
18
|
-
* Example:
|
19
|
-
* <property-shadow
|
20
|
-
* @change="${e => { this.shadow = e.target.value }}"
|
21
|
-
* value="${this.shadow}"
|
22
|
-
* ></property-shadow>
|
23
|
-
*/
|
24
|
-
|
25
|
-
export class PropertyShadow extends LitElement {
|
26
|
-
static styles = [
|
27
|
-
css`
|
28
|
-
:host {
|
29
|
-
display: grid;
|
30
|
-
grid-template-columns: repeat(10, 1fr);
|
31
|
-
grid-gap: 5px;
|
32
|
-
grid-auto-rows: minmax(24px, auto);
|
33
|
-
|
34
|
-
align-items: center;
|
35
|
-
}
|
36
|
-
|
37
|
-
* {
|
38
|
-
align-self: stretch;
|
39
|
-
}
|
40
|
-
|
41
|
-
label {
|
42
|
-
grid-column: span 3;
|
43
|
-
text-align: right;
|
44
|
-
text-transform: capitalize;
|
45
|
-
|
46
|
-
align-self: center;
|
47
|
-
}
|
48
|
-
|
49
|
-
input[type='number'],
|
50
|
-
ox-input-color {
|
51
|
-
grid-column: span 7;
|
52
|
-
}
|
53
|
-
input[type='number'] {
|
54
|
-
border: var(--property-sidebar-fieldset-border);
|
55
|
-
}
|
56
|
-
|
57
|
-
.icon-only-label {
|
58
|
-
grid-column: span 3;
|
59
|
-
background: var(--url-icon-properties-label) no-repeat;
|
60
|
-
float: left;
|
61
|
-
margin: 0;
|
62
|
-
align-self: stretch;
|
63
|
-
}
|
64
|
-
|
65
|
-
.icon-only-label.color {
|
66
|
-
background-position: 100% -500px;
|
67
|
-
}
|
68
|
-
`
|
69
|
-
]
|
70
|
-
|
71
|
-
@property({ type: Object }) value?: Properties
|
72
|
-
|
73
|
-
firstUpdated() {
|
74
|
-
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
75
|
-
}
|
76
|
-
|
77
|
-
render() {
|
78
|
-
const value = this.value || {}
|
79
|
-
|
80
|
-
return html`
|
81
|
-
<label> <ox-i18n msgid="label.shadowOffsetX">offset-X</ox-i18n> </label>
|
82
|
-
|
83
|
-
<input type="number" value-key="left" .value=${value.left} />
|
84
|
-
|
85
|
-
<label> <ox-i18n msgid="label.shadowOffsetY">offset-Y</ox-i18n> </label>
|
86
|
-
|
87
|
-
<input type="number" value-key="top" .value=${value.top} />
|
88
|
-
|
89
|
-
<label> <ox-i18n msgid="label.shadowSize">Size</ox-i18n> </label>
|
90
|
-
|
91
|
-
<input type="number" value-key="blurSize" .value=${value.blurSize} />
|
92
|
-
|
93
|
-
<label class="icon-only-label color"></label>
|
94
|
-
|
95
|
-
<ox-input-color value-key="color" .value=${value.color}> </ox-input-color>
|
96
|
-
`
|
97
|
-
}
|
98
|
-
|
99
|
-
_onValueChange(e: Event) {
|
100
|
-
var element = e.target as HTMLElement
|
101
|
-
var key = element.getAttribute('value-key')
|
102
|
-
|
103
|
-
if (!key) {
|
104
|
-
return
|
105
|
-
}
|
106
|
-
|
107
|
-
this.value = {
|
108
|
-
...this.value,
|
109
|
-
[key]: convert(element)
|
110
|
-
}
|
111
|
-
|
112
|
-
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
113
|
-
}
|
114
|
-
}
|
@@ -1,23 +0,0 @@
|
|
1
|
-
export function convert(element: any) {
|
2
|
-
switch (element.tagName) {
|
3
|
-
case 'INPUT':
|
4
|
-
switch (element.type) {
|
5
|
-
case 'checkbox':
|
6
|
-
return element.checked
|
7
|
-
case 'number':
|
8
|
-
return Number(element.value) || 0
|
9
|
-
case 'text':
|
10
|
-
return String(element.value)
|
11
|
-
}
|
12
|
-
break
|
13
|
-
|
14
|
-
case 'PAPER-BUTTON':
|
15
|
-
return element.active
|
16
|
-
|
17
|
-
case 'PAPER-LISTBOX':
|
18
|
-
return element.selected
|
19
|
-
|
20
|
-
default:
|
21
|
-
return element.value
|
22
|
-
}
|
23
|
-
}
|
@@ -1,404 +0,0 @@
|
|
1
|
-
import '@operato/input/ox-input-search.js'
|
2
|
-
|
3
|
-
import { css, html, LitElement, PropertyValues, TemplateResult } from 'lit'
|
4
|
-
import { property, state } from 'lit/decorators.js'
|
5
|
-
|
6
|
-
// TODO test Sortable
|
7
|
-
// import Sortable from 'sortablejs'
|
8
|
-
import { i18next } from '@operato/i18n'
|
9
|
-
|
10
|
-
import { Component, Container, Scene } from '@hatiolab/things-scene'
|
11
|
-
|
12
|
-
export class SceneInspector extends LitElement {
|
13
|
-
static styles = [
|
14
|
-
css`
|
15
|
-
:host {
|
16
|
-
display: flex;
|
17
|
-
flex-direction: column;
|
18
|
-
|
19
|
-
color: var(--scene-inspector-color);
|
20
|
-
}
|
21
|
-
|
22
|
-
ox-input-search {
|
23
|
-
--input-search-padding: 3px;
|
24
|
-
--input-search-focus-border-bottom: none;
|
25
|
-
--input-search-font: normal 16px var(--theme-font);
|
26
|
-
|
27
|
-
border-radius: 999px;
|
28
|
-
box-sizing: border-box;
|
29
|
-
border: 1px solid var(--md-sys-color-on-secondary-container);
|
30
|
-
padding: 0 10px;
|
31
|
-
margin: 5px;
|
32
|
-
}
|
33
|
-
|
34
|
-
div[result] {
|
35
|
-
flex: 1;
|
36
|
-
|
37
|
-
display: flex;
|
38
|
-
flex-direction: column;
|
39
|
-
|
40
|
-
overflow-y: auto;
|
41
|
-
}
|
42
|
-
|
43
|
-
.component {
|
44
|
-
display: block;
|
45
|
-
overflow: hidden;
|
46
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
47
|
-
font-size: 14px;
|
48
|
-
}
|
49
|
-
|
50
|
-
.component[selected] {
|
51
|
-
background-color: var(--scene-inspector-selected-background-color);
|
52
|
-
border-top: var(--scene-inspector-selected-border);
|
53
|
-
border-bottom: var(--scene-inspector-selected-border);
|
54
|
-
}
|
55
|
-
[selected] .type {
|
56
|
-
font-weight: bold;
|
57
|
-
}
|
58
|
-
|
59
|
-
span,
|
60
|
-
i {
|
61
|
-
display: inline-block;
|
62
|
-
}
|
63
|
-
|
64
|
-
span.type {
|
65
|
-
text-overflow: ellipses;
|
66
|
-
}
|
67
|
-
|
68
|
-
span.name {
|
69
|
-
background-color: var(--scene-inspector-name-background-color);
|
70
|
-
border-radius: var(--border-radius);
|
71
|
-
padding: 0 4px;
|
72
|
-
color: #fff;
|
73
|
-
font-size: 0.8em;
|
74
|
-
}
|
75
|
-
|
76
|
-
.eye {
|
77
|
-
margin: 0 0 0 5px;
|
78
|
-
vertical-align: middle;
|
79
|
-
opacity: 0.7;
|
80
|
-
font-size: 1.1em;
|
81
|
-
color: var(--scene-inspector-eye-icon-color);
|
82
|
-
}
|
83
|
-
|
84
|
-
.collapsed::before,
|
85
|
-
.extended::before,
|
86
|
-
.collapsespace::before {
|
87
|
-
background: var(--url-icon-shell-inspector) no-repeat;
|
88
|
-
width: 16px;
|
89
|
-
height: 18px;
|
90
|
-
display: inline-block;
|
91
|
-
content: '';
|
92
|
-
opacity: 0.6;
|
93
|
-
}
|
94
|
-
|
95
|
-
.collapsed::before {
|
96
|
-
background-position: 100% -195px;
|
97
|
-
}
|
98
|
-
|
99
|
-
.extended::before {
|
100
|
-
background-position: 100% -295px;
|
101
|
-
}
|
102
|
-
|
103
|
-
.collapsespace::before {
|
104
|
-
background-position: 100% -395px;
|
105
|
-
opacity: 0.9;
|
106
|
-
width: 16px;
|
107
|
-
}
|
108
|
-
.collapsed,
|
109
|
-
.extended,
|
110
|
-
.collapsespace {
|
111
|
-
border-left: 1px dotted rgba(0, 0, 0, 0.1);
|
112
|
-
}
|
113
|
-
|
114
|
-
pre {
|
115
|
-
display: inline;
|
116
|
-
}
|
117
|
-
`
|
118
|
-
]
|
119
|
-
|
120
|
-
@property({ type: Object }) scene?: Scene
|
121
|
-
|
122
|
-
@state() private searchText: string = ''
|
123
|
-
|
124
|
-
private _extendedMap: any
|
125
|
-
private show: boolean = false
|
126
|
-
private count: number = -1
|
127
|
-
|
128
|
-
disconnectScene(scene?: Scene) {
|
129
|
-
if (scene) {
|
130
|
-
scene.off('selected', undefined, this)
|
131
|
-
scene.off('execute', undefined, this)
|
132
|
-
scene.off('undo', undefined, this)
|
133
|
-
scene.off('redo', undefined, this)
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
disconnectedCallback() {
|
138
|
-
super.disconnectedCallback()
|
139
|
-
|
140
|
-
this.disconnectScene(this.scene)
|
141
|
-
delete this._extendedMap
|
142
|
-
}
|
143
|
-
|
144
|
-
render() {
|
145
|
-
this.count = 0
|
146
|
-
|
147
|
-
return html`
|
148
|
-
<ox-input-search
|
149
|
-
.placeholder=${i18next.t('text.search with type, id or tag')}
|
150
|
-
autofocus
|
151
|
-
@change=${(e: Event) => (this.searchText = ((e.target as HTMLInputElement).value || '').toLowerCase())}
|
152
|
-
></ox-input-search>
|
153
|
-
|
154
|
-
<div result>${!this.scene ? html`` : this.renderComponent(this.scene.root, 0)}</div>
|
155
|
-
`
|
156
|
-
}
|
157
|
-
|
158
|
-
firstUpdated() {
|
159
|
-
dispatchEvent(new Event('resize'))
|
160
|
-
|
161
|
-
this.renderRoot.addEventListener('click', this._onclick.bind(this) as EventListener)
|
162
|
-
this.renderRoot.addEventListener('dblclick', this._ondblclick.bind(this) as EventListener)
|
163
|
-
}
|
164
|
-
|
165
|
-
refresh() {
|
166
|
-
let selected = this.scene?.selected || []
|
167
|
-
|
168
|
-
selected.forEach(component => {
|
169
|
-
let parent = component.parent
|
170
|
-
while (parent && !this.extendedMap.get(parent)) {
|
171
|
-
this.extendedMap.set(parent, true)
|
172
|
-
parent = parent.parent
|
173
|
-
}
|
174
|
-
})
|
175
|
-
|
176
|
-
this.requestUpdate()
|
177
|
-
}
|
178
|
-
|
179
|
-
updated(change: PropertyValues<this>) {
|
180
|
-
if (change.has('scene')) {
|
181
|
-
let oldScene = change.get('scene') as Scene
|
182
|
-
|
183
|
-
if (oldScene) {
|
184
|
-
this.disconnectScene(oldScene)
|
185
|
-
delete this._extendedMap
|
186
|
-
}
|
187
|
-
|
188
|
-
if (this.scene && this.scene.root) {
|
189
|
-
this.scene.on('selected', this.refresh, this)
|
190
|
-
this.scene.on('execute', this.refresh, this)
|
191
|
-
this.scene.on('undo', this.refresh, this)
|
192
|
-
this.scene.on('redo', this.refresh, this)
|
193
|
-
|
194
|
-
this.refresh()
|
195
|
-
}
|
196
|
-
}
|
197
|
-
|
198
|
-
// TODO test Sortable
|
199
|
-
// this.updateComplete.then(() => {
|
200
|
-
// this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {
|
201
|
-
// new Sortable(sortable as HTMLElement, this.sortableConfig)
|
202
|
-
// })
|
203
|
-
// })
|
204
|
-
}
|
205
|
-
|
206
|
-
// TODO test Sortable
|
207
|
-
// sortableConfig: Sortable.Options = {
|
208
|
-
// group: 'inspector',
|
209
|
-
// animation: 150,
|
210
|
-
// draggable: '.component',
|
211
|
-
// swapThreshold: 1,
|
212
|
-
// onSort: this.onSort.bind(this)
|
213
|
-
// }
|
214
|
-
|
215
|
-
// TODO test Sortable
|
216
|
-
// onSort(e: Sortable.SortableEvent) {
|
217
|
-
// if (!this.scene) return
|
218
|
-
|
219
|
-
// var component = (e.item as HTMLElement & { component: Component }).component
|
220
|
-
// var to_container = (e.to as HTMLElement & { component: Component }).component as Container
|
221
|
-
// var to_index = e.newIndex! - 1
|
222
|
-
|
223
|
-
// this.scene.move(component, to_container, to_index)
|
224
|
-
|
225
|
-
// this.show = false
|
226
|
-
// this.updateComplete.then(() => {
|
227
|
-
// this.show = true
|
228
|
-
// })
|
229
|
-
// }
|
230
|
-
|
231
|
-
_onclick(e: MouseEvent) {
|
232
|
-
e.stopPropagation()
|
233
|
-
|
234
|
-
var targetElement = e.target as HTMLElement & { component: Component }
|
235
|
-
var classList = targetElement.classList
|
236
|
-
var component
|
237
|
-
|
238
|
-
while (!component && targetElement) {
|
239
|
-
component = targetElement.component
|
240
|
-
|
241
|
-
if (component) break
|
242
|
-
|
243
|
-
targetElement = targetElement.parentNode as HTMLElement & { component: Component }
|
244
|
-
|
245
|
-
if (!targetElement || targetElement === this.renderRoot) break
|
246
|
-
}
|
247
|
-
|
248
|
-
if (component) {
|
249
|
-
if (classList.contains('eye')) {
|
250
|
-
this.toggleHidden(component)
|
251
|
-
} else if (classList.contains('extended') || classList.contains('collapsed')) {
|
252
|
-
this.toggleExtended(component)
|
253
|
-
}
|
254
|
-
|
255
|
-
this.selectComponent(component, e.shiftKey)
|
256
|
-
} else {
|
257
|
-
if (classList.contains('inspector')) {
|
258
|
-
this.show = !this.show
|
259
|
-
this.style.height = this.show ? '100%' : ''
|
260
|
-
}
|
261
|
-
}
|
262
|
-
|
263
|
-
this.requestUpdate()
|
264
|
-
}
|
265
|
-
|
266
|
-
_ondblclick(e: MouseEvent) {
|
267
|
-
e.stopPropagation()
|
268
|
-
|
269
|
-
var targetElement = e.target as HTMLElement & { component: Component }
|
270
|
-
var component
|
271
|
-
|
272
|
-
while (!component && targetElement) {
|
273
|
-
component = targetElement.component
|
274
|
-
|
275
|
-
if (component) break
|
276
|
-
|
277
|
-
targetElement = targetElement.parentNode as HTMLElement & { component: Component }
|
278
|
-
|
279
|
-
if (!targetElement || targetElement === this.renderRoot) break
|
280
|
-
}
|
281
|
-
|
282
|
-
if (component && component.isContainer()) {
|
283
|
-
this.toggleExtended(component)
|
284
|
-
}
|
285
|
-
|
286
|
-
this.requestUpdate()
|
287
|
-
}
|
288
|
-
|
289
|
-
get extendedMap() {
|
290
|
-
if (!this._extendedMap) {
|
291
|
-
this._extendedMap = new WeakMap()
|
292
|
-
}
|
293
|
-
|
294
|
-
return this._extendedMap
|
295
|
-
}
|
296
|
-
|
297
|
-
getNodeHandleClass(component: Component) {
|
298
|
-
if (component.isContainer() && (component as Container).components.length > 0) {
|
299
|
-
return !!this.extendedMap.get(component) ? 'extended' : 'collapsed'
|
300
|
-
} else {
|
301
|
-
return 'collapsespace'
|
302
|
-
}
|
303
|
-
}
|
304
|
-
|
305
|
-
isExtended(component: Component) {
|
306
|
-
return !!this.extendedMap.get(component)
|
307
|
-
}
|
308
|
-
|
309
|
-
toggleExtended(component: Component) {
|
310
|
-
var extended = this.isExtended(component)
|
311
|
-
|
312
|
-
if (extended) {
|
313
|
-
this.extendedMap.delete(component)
|
314
|
-
} else {
|
315
|
-
this.extendedMap.set(component, !extended)
|
316
|
-
}
|
317
|
-
|
318
|
-
this.requestUpdate()
|
319
|
-
}
|
320
|
-
|
321
|
-
toggleHidden(component: Component) {
|
322
|
-
component.set('hidden', !component.hidden)
|
323
|
-
|
324
|
-
this.requestUpdate()
|
325
|
-
}
|
326
|
-
|
327
|
-
selectComponent(component: Component, append: boolean = false) {
|
328
|
-
const selected = this.scene!.selected
|
329
|
-
|
330
|
-
if (append) {
|
331
|
-
const idx = selected.findIndex(s => s === component)
|
332
|
-
if (idx != -1) {
|
333
|
-
selected.splice(idx, 1)
|
334
|
-
this.scene!.selected = [...selected]
|
335
|
-
} else {
|
336
|
-
this.scene!.selected = [...selected, component]
|
337
|
-
}
|
338
|
-
} else {
|
339
|
-
this.scene!.selected = [component]
|
340
|
-
}
|
341
|
-
|
342
|
-
component.trigger('reactionreset')
|
343
|
-
component.trigger('reaction')
|
344
|
-
|
345
|
-
this.requestUpdate()
|
346
|
-
}
|
347
|
-
|
348
|
-
shouldBeShown(component: Component, counting: boolean = false): boolean {
|
349
|
-
const { type, name, id, tag } = component.state
|
350
|
-
const found =
|
351
|
-
!this.searchText || `${type} ${name || ''} ${id || ''} ${tag || ''}`.toLowerCase().search(this.searchText) > -1
|
352
|
-
|
353
|
-
if (counting && found) {
|
354
|
-
this.count++
|
355
|
-
}
|
356
|
-
|
357
|
-
const foundChildren = ((component as Container).components || []).filter((child: Component) =>
|
358
|
-
this.shouldBeShown(child, counting)
|
359
|
-
).length
|
360
|
-
|
361
|
-
return !!(found || foundChildren > 0)
|
362
|
-
}
|
363
|
-
|
364
|
-
renderComponent(component: Component, depth: number): TemplateResult {
|
365
|
-
if (!component) {
|
366
|
-
return html``
|
367
|
-
}
|
368
|
-
|
369
|
-
if (!this.shouldBeShown(component, depth == 0)) {
|
370
|
-
return html``
|
371
|
-
}
|
372
|
-
|
373
|
-
const children = (component.isContainer() && (component as Container).components) || []
|
374
|
-
const extended = this.isExtended(component) ? children.filter(child => this.shouldBeShown(child)) : []
|
375
|
-
const { type, id, tag, class: clazz } = component.state
|
376
|
-
|
377
|
-
const name = (id ? `#${id}` : '') + (tag ? `@${tag}` : '') + (clazz ? `.(${clazz})` : '')
|
378
|
-
|
379
|
-
return html`
|
380
|
-
<div
|
381
|
-
class="component"
|
382
|
-
?selected=${(this.scene?.selected || []).indexOf(component) > -1}
|
383
|
-
.component=${component}
|
384
|
-
?sortable=${component.isContainer()}
|
385
|
-
>
|
386
|
-
<span>
|
387
|
-
${depth > 0
|
388
|
-
? html`
|
389
|
-
<md-icon class="eye">${component.get('hidden') ? 'visibility_off' : 'visibility'}</md-icon>
|
390
|
-
<pre>${' '.repeat(depth)}</pre>
|
391
|
-
`
|
392
|
-
: html` <pre>${' '.repeat(depth + 2)}</pre> `}
|
393
|
-
|
394
|
-
<span class=${this.getNodeHandleClass(component)}> </span>
|
395
|
-
|
396
|
-
<span class="type">${depth == 0 ? html`ROOT(count: ${this.count})` : type}</span>
|
397
|
-
${name ? html` <span class="name">${name}</span> ` : html``}
|
398
|
-
</span>
|
399
|
-
|
400
|
-
${extended.map(child => this.renderComponent(child, depth + 1))}
|
401
|
-
</div>
|
402
|
-
`
|
403
|
-
}
|
404
|
-
}
|