@operato/property-panel 9.2.1 → 10.0.0-beta.2

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.
Files changed (77) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/src/index.d.ts +1 -0
  3. package/dist/src/index.js +1 -0
  4. package/dist/src/index.js.map +1 -1
  5. package/dist/src/ox-property-panel.d.ts +8 -0
  6. package/dist/src/ox-property-panel.js +44 -3
  7. package/dist/src/ox-property-panel.js.map +1 -1
  8. package/dist/src/property-panel/abstract-property.js +1 -0
  9. package/dist/src/property-panel/abstract-property.js.map +1 -1
  10. package/dist/src/property-panel/data-binding/data-binding-mapper.js +1 -1
  11. package/dist/src/property-panel/data-binding/data-binding-mapper.js.map +1 -1
  12. package/dist/src/property-panel/data-binding/data-binding.js.map +1 -1
  13. package/dist/src/property-panel/effects/property-animation.js +1 -1
  14. package/dist/src/property-panel/effects/property-animation.js.map +1 -1
  15. package/dist/src/property-panel/effects/property-event-hover.js +3 -3
  16. package/dist/src/property-panel/effects/property-event-hover.js.map +1 -1
  17. package/dist/src/property-panel/effects/property-event-tap.js +4 -4
  18. package/dist/src/property-panel/effects/property-event-tap.js.map +1 -1
  19. package/dist/src/property-panel/inspector/inspector.js +6 -6
  20. package/dist/src/property-panel/inspector/inspector.js.map +1 -1
  21. package/dist/src/property-panel/shapes/shapes.d.ts +0 -2
  22. package/dist/src/property-panel/shapes/shapes.js +5 -44
  23. package/dist/src/property-panel/shapes/shapes.js.map +1 -1
  24. package/dist/src/property-panel/threed/property-material3d.d.ts +27 -0
  25. package/dist/src/property-panel/threed/property-material3d.js +189 -0
  26. package/dist/src/property-panel/threed/property-material3d.js.map +1 -0
  27. package/dist/src/property-panel/threed/property-scene3d.d.ts +26 -0
  28. package/dist/src/property-panel/threed/property-scene3d.js +314 -0
  29. package/dist/src/property-panel/threed/property-scene3d.js.map +1 -0
  30. package/dist/src/property-panel/threed/threed.d.ts +17 -0
  31. package/dist/src/property-panel/threed/threed.js +98 -0
  32. package/dist/src/property-panel/threed/threed.js.map +1 -0
  33. package/dist/src/types.d.ts +1 -1
  34. package/dist/src/types.js.map +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +13 -9
  37. package/.editorconfig +0 -29
  38. package/.storybook/main.js +0 -5
  39. package/.storybook/preview.js +0 -52
  40. package/.storybook/server.mjs +0 -8
  41. package/demo/index.html +0 -30
  42. package/dist/stories/index.stories.d.ts +0 -22
  43. package/dist/stories/index.stories.js +0 -121
  44. package/dist/stories/index.stories.js.map +0 -1
  45. package/src/graphql/board.ts +0 -144
  46. package/src/graphql/data-subscription.ts +0 -30
  47. package/src/graphql/favorite-board.ts +0 -25
  48. package/src/graphql/group.ts +0 -138
  49. package/src/graphql/index.ts +0 -4
  50. package/src/graphql/play-group.ts +0 -225
  51. package/src/graphql/scenario.ts +0 -79
  52. package/src/index.ts +0 -8
  53. package/src/ox-property-panel.ts +0 -347
  54. package/src/property-panel/abstract-property.ts +0 -65
  55. package/src/property-panel/data-binding/data-binding-mapper.ts +0 -408
  56. package/src/property-panel/data-binding/data-binding-value-map.ts +0 -19
  57. package/src/property-panel/data-binding/data-binding-value-range.ts +0 -19
  58. package/src/property-panel/data-binding/data-binding.ts +0 -470
  59. package/src/property-panel/effects/effects.ts +0 -77
  60. package/src/property-panel/effects/property-animation.ts +0 -155
  61. package/src/property-panel/effects/property-animations.ts +0 -73
  62. package/src/property-panel/effects/property-event-hover-emphasize.ts +0 -74
  63. package/src/property-panel/effects/property-event-hover.ts +0 -255
  64. package/src/property-panel/effects/property-event-tap.ts +0 -269
  65. package/src/property-panel/effects/property-event.ts +0 -73
  66. package/src/property-panel/effects/property-shadow.ts +0 -77
  67. package/src/property-panel/effects/value-converter.ts +0 -17
  68. package/src/property-panel/inspector/inspector.ts +0 -376
  69. package/src/property-panel/shapes/shapes.ts +0 -379
  70. package/src/property-panel/specifics/specific-properties-builder.ts +0 -160
  71. package/src/property-panel/specifics/specifics.ts +0 -81
  72. package/src/property-panel/styles/styles.ts +0 -285
  73. package/src/types.ts +0 -63
  74. package/stories/index.stories.ts +0 -134
  75. package/tsconfig.json +0 -26
  76. package/web-dev-server.config.mjs +0 -27
  77. package/web-test-runner.config.mjs +0 -41
@@ -1,73 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@material/web/icon/icon.js'
6
- import '@operato/help/ox-title-with-help.js'
7
-
8
- import { css, html, LitElement } from 'lit'
9
- import { property, state } from 'lit/decorators.js'
10
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
11
-
12
- import { Properties, Scene } from '@hatiolab/things-scene'
13
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
14
-
15
- import { PropertyAnimation } from './property-animation.js'
16
- import { convert } from './value-converter.js'
17
-
18
- export class PropertyAnimations extends ScopedElementsMixin(LitElement) {
19
- static styles = [PropertyGridStyles]
20
-
21
- @property({ type: Object }) value?: Properties
22
- @property({ type: Object }) scene!: Scene
23
-
24
- @state() _expanded: boolean = false
25
-
26
- firstUpdated() {
27
- this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
28
- }
29
-
30
- static get scopedElements() {
31
- return {
32
- 'property-animation': PropertyAnimation
33
- }
34
- }
35
-
36
- render() {
37
- const value = this.value || {}
38
-
39
- return html`
40
- <fieldset collapsable ?collapsed=${!this._expanded}>
41
- <legend
42
- @click=${() => {
43
- this._expanded = !this._expanded
44
- }}
45
- >
46
- <ox-title-with-help topic="board-modeller/effects/animation" msgid="label.animation"
47
- >animation</ox-title-with-help
48
- >
49
- <md-icon>${this._expanded ? 'expand_less' : 'expand_more'}</md-icon>
50
- </legend>
51
-
52
- <property-animation value-key="oncreate" .scene=${this.scene} .value=${value.oncreate || {}}>
53
- </property-animation>
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,74 +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
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
13
-
14
- import { convert } from './value-converter.js'
15
-
16
- /**
17
- * 컴포넌트의 강조 속성을 편집하는 element
18
- *
19
- * Example:
20
- * <property-event-hover-emphasize
21
- * @change="${e => { this.emphasize = e.target.value }}"
22
- * value="${this.emphasize}"
23
- * ></property-event-hover-emphasize>
24
- */
25
-
26
- export class PropertyEventHoverEmphasize extends LitElement {
27
- static styles = [
28
- PropertyGridStyles,
29
- css`
30
- :host {
31
- display: flex;
32
- }
33
- `
34
- ]
35
-
36
- @property({ type: Object }) value?: Properties
37
-
38
- firstUpdated() {
39
- this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
40
- }
41
-
42
- render() {
43
- const { lineWidth, strokeStyle, fillStyle } = this.value || {}
44
-
45
- return html`
46
- <div class="property-grid">
47
- <label class="icon-only-label color"><md-icon>format_color_fill</md-icon></label>
48
- <ox-input-color value-key="fillStyle" .value=${fillStyle}> </ox-input-color>
49
-
50
- <label class="icon-only-label color"><md-icon>border_color</md-icon></label>
51
- <ox-input-color value-key="strokeStyle" .value=${strokeStyle}> </ox-input-color>
52
-
53
- <label> <ox-i18n msgid="label.emphasize-line-width">line width</ox-i18n> </label>
54
- <input type="number" value-key="lineWidth" .value=${lineWidth} />
55
- </div>
56
- `
57
- }
58
-
59
- onValueChange(e: Event) {
60
- var element = e.target as HTMLElement
61
- var key = element.getAttribute('value-key')
62
-
63
- if (!key) {
64
- return
65
- }
66
-
67
- this.value = {
68
- ...this.value,
69
- [key]: convert(element)
70
- }
71
-
72
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
73
- }
74
- }
@@ -1,255 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/input/ox-input-data.js'
6
- import '@operato/i18n/ox-i18n.js'
7
-
8
- import { css, html, LitElement, nothing } from 'lit'
9
- import { property } from 'lit/decorators.js'
10
- import { ifDefined } from 'lit/directives/if-defined.js'
11
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
12
-
13
- import { Properties, Scene } from '@hatiolab/things-scene'
14
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
15
-
16
- import { convert } from './value-converter.js'
17
- import { PropertyEventHoverEmphasize } from './property-event-hover-emphasize.js'
18
-
19
- const SETS_ACTION = ['data-set', 'partial-data-set', 'value-set', 'partial-value-set']
20
-
21
- export class PropertyEventHover extends ScopedElementsMixin(LitElement) {
22
- static styles = [
23
- PropertyGridStyles,
24
- css`
25
- property-event-hover-emphasize {
26
- padding-bottom: var(--spacing-large);
27
- }
28
-
29
- datalist option.cursor-auto {
30
- cursor: auto;
31
- }
32
-
33
- datalist option.cursor-pointer {
34
- cursor: pointer;
35
- }
36
-
37
- datalist option.cursor-default {
38
- cursor: default;
39
- }
40
-
41
- datalist option.cursor-move {
42
- cursor: move;
43
- }
44
-
45
- datalist option.cursor-text {
46
- cursor: text;
47
- }
48
-
49
- datalist option.cursor-wait {
50
- cursor: wait;
51
- }
52
-
53
- datalist option.cursor-help {
54
- cursor: help;
55
- }
56
-
57
- datalist option.cursor-crosshair {
58
- cursor: crosshair;
59
- }
60
-
61
- datalist option.cursor-not-allowed {
62
- cursor: not-allowed;
63
- }
64
-
65
- datalist option.cursor-grab {
66
- cursor: grab;
67
- }
68
- `
69
- ]
70
-
71
- @property({ type: Object }) value?: Properties
72
- @property({ type: Object }) scene?: Scene
73
-
74
- private useEmphasize: boolean = false
75
-
76
- static get scopedElements() {
77
- return {
78
- 'property-event-hover-emphasize': PropertyEventHoverEmphasize
79
- }
80
- }
81
-
82
- firstUpdated() {
83
- this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
84
- }
85
-
86
- render() {
87
- var { action, value = '', target = '', emphasize, restore } = this.value || {}
88
-
89
- if (emphasize === true) {
90
- emphasize = {
91
- distance: 0,
92
- animation: false
93
- }
94
- } else if (emphasize === false) {
95
- emphasize = null
96
- }
97
-
98
- this.useEmphasize = !!emphasize
99
-
100
- return html`
101
- <div class="property-grid">
102
- <input id="checkbox-use-emphasize" type="checkbox" value-key="use-emphasize" .checked=${!!this.useEmphasize} />
103
- <label for="checkbox-use-emphasize" class="checkbox-label">
104
- <ox-i18n msgid="label.emphasize">emphasize</ox-i18n>
105
- </label>
106
-
107
- ${!!this.useEmphasize
108
- ? html`
109
- <property-event-hover-emphasize
110
- id="emphasize"
111
- class="fullwidth"
112
- value-key="emphasize"
113
- .value=${emphasize}
114
- ></property-event-hover-emphasize>
115
- `
116
- : nothing}
117
-
118
- <label> <ox-i18n msgid="label.hover-action">hover action</ox-i18n> </label>
119
- <select id="tap-select" value-key="action" .value=${action || ''}>
120
- <option value=""></option>
121
- <option value="popup">popup target board</option>
122
- <option value="info-window">open infowindow</option>
123
- <option value="data-toggle">toggle(true/false) target component data</option>
124
- <option value="data-tristate">tristate(0/1/2) target component data</option>
125
- <option value="data-set">set value to target component data</option>
126
- <option value="value-set">set value to target component value</option>
127
- <option value="mouse-cursor">change mouse cursor to target style</option>
128
- </select>
129
-
130
- <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
131
-
132
- ${action == 'popup'
133
- ? html`
134
- <ox-editor-board-selector
135
- class="custom-editor"
136
- value-key="target"
137
- .value=${target}
138
- ></ox-editor-board-selector>
139
- `
140
- : html`
141
- <input
142
- value-key="target"
143
- .value=${target || ''}
144
- list="target-list"
145
- .placeholder="${this._getPlaceHoder(action)}"
146
- />
147
-
148
- <datalist id="target-list">
149
- ${this._getTargetList(action).map(
150
- ({ value, description, class: clazz }) => html`
151
- <option .value=${value} class=${ifDefined(clazz)}>${description}</option>
152
- `
153
- )}
154
- </datalist>
155
- `}
156
- ${SETS_ACTION.indexOf(action) != -1
157
- ? html`
158
- <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
159
- <ox-input-data
160
- class="custom-editor fullwidth"
161
- value-key="value"
162
- .value=${value}
163
- fullwidth
164
- ></ox-input-data>
165
- `
166
- : html``}
167
-
168
- <input id="checkbox-restore" type="checkbox" value-key="restore" .checked=${restore} />
169
- <label for="checkbox-restore" class="checkbox-label">
170
- <ox-i18n msgid="label.reset-on-leave">restore on leave</ox-i18n>
171
- </label>
172
- </div>
173
- `
174
- }
175
-
176
- _getPlaceHoder(action: string) {
177
- switch (action) {
178
- case 'popup':
179
- case 'goto':
180
- return 'SCENE-100'
181
- case 'link-open':
182
- case 'link-move':
183
- return 'http://www.hatiolab.com/'
184
- default:
185
- return ''
186
- }
187
- }
188
-
189
- _getTargetList(action: string): { value: string; description?: string; class?: string }[] {
190
- switch (action) {
191
- case 'data-toggle':
192
- case 'data-tristate':
193
- case 'data-set':
194
- case 'value-set':
195
- case 'partial-data-set':
196
- case 'partial-value-set':
197
- let ids =
198
- (this.scene &&
199
- this.scene.ids.map(i => {
200
- const id = i.key
201
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
202
- })) ||
203
- []
204
- ids.unshift({ value: '(self)', description: 'self component' })
205
- return ids
206
-
207
- case 'info-window':
208
- return (
209
- (this.scene &&
210
- this.scene.ids
211
- .filter(i => {
212
- return this.scene!.findById(i.key).get('type') == 'info-window'
213
- })
214
- .map(i => {
215
- const id = i.key
216
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
217
- })) ||
218
- []
219
- )
220
-
221
- case 'mouse-cursor':
222
- return ['auto', 'pointer', 'default', 'move', 'text', 'wait', 'help', 'crosshair', 'not-allowed', 'grab'].map(
223
- style => {
224
- return { value: style, class: `cursor-${style}` }
225
- }
226
- )
227
-
228
- default:
229
- return []
230
- }
231
- }
232
-
233
- onValueChange(e: Event) {
234
- var element = e.target as HTMLElement
235
- var key = element.getAttribute('value-key')
236
-
237
- if (!key) {
238
- return
239
- }
240
-
241
- if (key == 'use-emphasize') {
242
- this.value = {
243
- ...this.value,
244
- emphasize: (element as HTMLInputElement).checked ? {} : null
245
- }
246
- } else {
247
- this.value = {
248
- ...this.value,
249
- [key]: convert(element)
250
- }
251
- }
252
-
253
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
254
- }
255
- }
@@ -1,269 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/input/ox-input-data.js'
6
- import '@operato/i18n/ox-i18n.js'
7
-
8
- import { css, html, LitElement } from 'lit'
9
- import { property, state } from 'lit/decorators.js'
10
-
11
- import { Properties, Scene } from '@hatiolab/things-scene'
12
- import { PropertyGridStyles } from '@operato/styles/property-grid-styles.js'
13
-
14
- import { scenarios } from '../../graphql/scenario.js'
15
- import { playlists } from '../../graphql/play-group.js'
16
- import { convert } from './value-converter.js'
17
-
18
- const SETS_ACTION = ['data-set', 'partial-data-set', 'value-set', 'partial-value-set', 'start-scenario', 'run-scenario']
19
-
20
- export class PropertyEventTap extends LitElement {
21
- static styles = [
22
- PropertyGridStyles,
23
- css`
24
- :host {
25
- display: flex;
26
- }
27
- `
28
- ]
29
-
30
- @property({ type: Object }) value?: Properties
31
- @property({ type: Object }) scene?: Scene
32
-
33
- @state() scenarios: { value: string; description: string }[] = []
34
- @state() playlists: { value: string; description: string }[] = []
35
- @state() targetList: { value: string; description: string }[] = []
36
-
37
- async firstUpdated() {
38
- this.renderRoot.addEventListener('change', this.onValueChange.bind(this))
39
- }
40
-
41
- render() {
42
- var { action, value = '', target = '', pressed, options } = this.value || {}
43
- var { input = '(self)', output = true } = options || {}
44
-
45
- return html`
46
- <div class="property-grid">
47
- <input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
48
- <label for="checkbox-pressed" class="checkbox-label"> <ox-i18n msgid="label.pressed">pressed</ox-i18n> </label>
49
-
50
- <label> <ox-i18n msgid="label.tap-action">tap action</ox-i18n> </label>
51
- <select
52
- id="tap-select"
53
- value-key="action"
54
- .value=${action || ''}
55
- @change=${async (e: Event) => {
56
- if ((e.target as HTMLSelectElement).value.includes('scenario')) {
57
- this.scenarios = (await scenarios()).map(({ name, description }) => {
58
- return { value: name, description }
59
- })
60
- } else if ((e.target as HTMLSelectElement).value == 'goto-playlist') {
61
- this.playlists = (await playlists()).map(({ name, description }) => {
62
- return { value: name, description }
63
- })
64
- }
65
- }}
66
- >
67
- <option value=""></option>
68
- <option value="goto">go to target board</option>
69
- <option value="goto-playlist">go to target playlist</option>
70
- <option value="link-open">open new window for target link</option>
71
- <option value="link-move">move to target link</option>
72
- <option value="route-page">route to page</option>
73
- <option value="popup">popup target board</option>
74
- <option value="modal-popup">modal popup target board</option>
75
- <option value="close-scene">close current board</option>
76
- <option value="infoWindow">open infowindow</option>
77
- <option value="toggle-info-window">toggle infowindow</option>
78
- <option value="data-toggle">toggle(true/false) target component data</option>
79
- <option value="data-tristate">tristate(0/1/2) target component data</option>
80
- <option value="data-spreading">forcely execute data spreading of target component</option>
81
- <option value="data-set">set value to target component data</option>
82
- <option value="partial-data-set">set partial value to target component data</option>
83
- <option value="value-set">set value to target component value</option>
84
- <option value="partial-value-set">set partial value to target component value</option>
85
- <option value="start-scenario">start the given scenario</option>
86
- <option value="run-scenario">run the given scenario</option>
87
- <option value="export-data">export data</option>
88
- <option value="import-data">import data</option>
89
- </select>
90
-
91
- <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
92
-
93
- ${action === 'goto' || action?.includes('popup')
94
- ? html`
95
- <ox-editor-board-selector
96
- class="custom-editor"
97
- value-key="target"
98
- .value=${target}
99
- ></ox-editor-board-selector>
100
- `
101
- : html`
102
- <input
103
- value-key="target"
104
- .value=${target}
105
- list="target-list"
106
- .placeholder=${this._getPlaceHoder(action)}
107
- @focusin=${() => {
108
- this.targetList = this._getTargetList(action)
109
- }}
110
- />
111
-
112
- <datalist id="target-list">
113
- ${this.targetList.map(
114
- ({ value, description }) => html` <option .value=${value}>${description}</option> `
115
- )}
116
- </datalist>
117
- `}
118
- ${action === 'goto' || action === 'goto-playlist' || action?.includes('popup')
119
- ? html`
120
- <label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
121
- <input
122
- id="input"
123
- value-key="input"
124
- .value=${input}
125
- list="input-list"
126
- @focusin=${() => {
127
- this.targetList = this._getInputList(action)
128
- }}
129
- />
130
- <datalist id="input-list">
131
- ${this.targetList.map(
132
- ({ value, description }) => html` <option .value=${value}>${description}</option> `
133
- )}
134
- </datalist>
135
- ${
136
- /* currently 'goto' does not support returning result */
137
- action?.includes('popup')
138
- ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
139
- <label for="checkbox-output" class="checkbox-label">
140
- <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
141
- </label>`
142
- : html``
143
- }
144
- `
145
- : SETS_ACTION.indexOf(action) != -1
146
- ? html`
147
- <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
148
- <ox-input-data
149
- class="custom-editor fullwidth"
150
- value-key="value"
151
- .value=${value}
152
- fullwidth
153
- ></ox-input-data>
154
- `
155
- : html``}
156
- </div>
157
- `
158
- }
159
-
160
- _getPlaceHoder(action: string) {
161
- switch (action) {
162
- case 'link-open':
163
- case 'link-move':
164
- return 'http://www.hatiolab.com/'
165
- case 'export-data':
166
- return 'abc.xlsx'
167
- default:
168
- return ''
169
- }
170
- }
171
-
172
- _getTargetList(action: string): { value: string; description: string }[] {
173
- switch (action) {
174
- case 'data-toggle':
175
- case 'data-tristate':
176
- case 'data-set':
177
- case 'value-set':
178
- case 'popup':
179
- case 'modal-popup':
180
- case 'data-spreading':
181
- let ids =
182
- (this.scene &&
183
- this.scene.ids.map(i => {
184
- const id = i.key
185
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
186
- })) ||
187
- []
188
- ids.unshift({ value: '(self)', description: 'self component' })
189
- return ids
190
- case 'infoWindow':
191
- case 'toggle-info-window':
192
- return (
193
- (this.scene &&
194
- this.scene.ids
195
- .filter(i => {
196
- return this.scene!.findById(i.key).get('type') == 'info-window'
197
- })
198
- .map(i => {
199
- const id = i.key
200
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
201
- })) ||
202
- []
203
- )
204
- case 'start-scenario':
205
- case 'run-scenario':
206
- return this.scenarios
207
- case 'goto-playlist':
208
- return this.playlists
209
- case 'export-data':
210
- default:
211
- return []
212
- }
213
- }
214
-
215
- _getInputList(action: string): { value: string; description: string }[] {
216
- switch (action) {
217
- case 'popup':
218
- case 'modal-popup':
219
- case 'data-spreading':
220
- case 'goto':
221
- case 'goto-playlist':
222
- let ids =
223
- (this.scene &&
224
- this.scene.ids.map(i => {
225
- const id = i.key
226
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
227
- })) ||
228
- []
229
- ids.unshift({ value: '(self)', description: 'self component' })
230
- return ids
231
- default:
232
- return []
233
- }
234
- }
235
-
236
- onValueChange(e: Event) {
237
- var element = e.target as HTMLElement
238
- var key = element.getAttribute('value-key')
239
-
240
- if (!key) {
241
- return
242
- }
243
-
244
- if (key === 'input' || key === 'output') {
245
- var { options = {} } = this.value || {}
246
-
247
- this.value = {
248
- ...this.value,
249
- options: {
250
- ...options,
251
- [key]: convert(element)
252
- }
253
- }
254
- } else {
255
- this.value = {
256
- ...this.value,
257
- [key]: convert(element)
258
- }
259
- }
260
-
261
- var { action } = this.value
262
- if (action !== 'goto' && action !== 'goto-playlist' && !action?.includes('popup')) {
263
- /* clear unused options */
264
- delete this.value.options
265
- }
266
-
267
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
268
- }
269
- }