@operato/board 8.0.0-beta.0 → 8.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.
Files changed (92) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +14 -14
  4. package/.storybook/main.js +0 -3
  5. package/.storybook/server.mjs +0 -8
  6. package/db.sqlite +0 -0
  7. package/demo/index-modeller.html +0 -112
  8. package/demo/index-player.html +0 -112
  9. package/demo/index-viewer.html +0 -112
  10. package/demo/index.html +0 -112
  11. package/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
  12. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
  13. package/logs/application-2023-03-12-02.log +0 -14
  14. package/logs/connections-2023-03-12-02.log +0 -70
  15. package/src/component/3d.ts +0 -29
  16. package/src/component/chart-and-gauge.ts +0 -28
  17. package/src/component/container.ts +0 -63
  18. package/src/component/data-source.ts +0 -30
  19. package/src/component/etc.ts +0 -88
  20. package/src/component/form.ts +0 -42
  21. package/src/component/index.ts +0 -12
  22. package/src/component/iot.ts +0 -52
  23. package/src/component/line.ts +0 -156
  24. package/src/component/register-default-groups.ts +0 -28
  25. package/src/component/shape.ts +0 -156
  26. package/src/component/table.ts +0 -28
  27. package/src/component/text-and-media.ts +0 -125
  28. package/src/component/warehouse.ts +0 -26
  29. package/src/data-storage/data-storage.ts +0 -76
  30. package/src/graphql/board.ts +0 -144
  31. package/src/graphql/data-subscription.ts +0 -30
  32. package/src/graphql/favorite-board.ts +0 -25
  33. package/src/graphql/group.ts +0 -138
  34. package/src/graphql/index.ts +0 -4
  35. package/src/graphql/play-group.ts +0 -225
  36. package/src/graphql/scenario.ts +0 -79
  37. package/src/index.ts +0 -10
  38. package/src/modeller/component-toolbar/component-detail.ts +0 -52
  39. package/src/modeller/component-toolbar/component-menu.ts +0 -196
  40. package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
  41. package/src/modeller/component-toolbar/mode-icons.ts +0 -88
  42. package/src/modeller/edit-toolbar-style.ts +0 -232
  43. package/src/modeller/edit-toolbar.ts +0 -587
  44. package/src/modeller/property-sidebar/abstract-property.ts +0 -69
  45. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
  46. package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
  47. package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
  48. package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
  49. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
  50. package/src/modeller/property-sidebar/effects/effects.ts +0 -69
  51. package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
  52. package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
  53. package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
  54. package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
  55. package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
  56. package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
  57. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
  58. package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
  59. package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
  60. package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
  61. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
  62. package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
  63. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
  64. package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
  65. package/src/modeller/property-sidebar/styles/styles.ts +0 -577
  66. package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
  67. package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
  68. package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
  69. package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
  70. package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
  71. package/src/ox-board-component-info.ts +0 -236
  72. package/src/ox-board-list.ts +0 -401
  73. package/src/ox-board-modeller.ts +0 -408
  74. package/src/ox-board-player-style.ts +0 -200
  75. package/src/ox-board-player.ts +0 -333
  76. package/src/ox-board-template-list.ts +0 -267
  77. package/src/ox-board-template-viewer.ts +0 -198
  78. package/src/ox-board-viewer.ts +0 -727
  79. package/src/ox-editor-board-selector.ts +0 -91
  80. package/src/ox-property-editor-board-selector.ts +0 -23
  81. package/src/player/ox-board-player-carousel.ts +0 -197
  82. package/src/player/ox-board-player-grid.ts +0 -78
  83. package/src/player/ox-board-wrapper.ts +0 -152
  84. package/src/selector/board-creation-popup.ts +0 -151
  85. package/src/selector/board-thumbnail-card.ts +0 -175
  86. package/src/selector/ox-board-creation-card.ts +0 -98
  87. package/src/selector/ox-board-selector.ts +0 -382
  88. package/src/types.ts +0 -63
  89. package/stories/property-data-binding.stories.ts +0 -34
  90. package/tsconfig.json +0 -24
  91. package/web-dev-server.config.mjs +0 -30
  92. package/web-test-runner.config.mjs +0 -29
@@ -1,146 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/input/ox-input-angle.js'
6
- import '@operato/i18n/ox-i18n.js'
7
-
8
- import { html, LitElement } from 'lit'
9
- import { property, query } from 'lit/decorators.js'
10
-
11
- import { Properties, Scene } from '@hatiolab/things-scene'
12
-
13
- import { EffectsSharedStyle } from './effects-shared-style.js'
14
- import { convert } from './value-converter.js'
15
-
16
- /**
17
- * 컴포넌트의 animation 속성을 편집하는 element
18
-
19
- Example:
20
-
21
- <property-animation .value=${animation}>
22
- </property-animation>
23
- */
24
-
25
- export class PropertyAnimation extends LitElement {
26
- static styles = [EffectsSharedStyle]
27
-
28
- @property({ type: Object }) value?: Properties
29
- @property({ type: Object }) scene?: Scene
30
-
31
- firstUpdated() {
32
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
33
- }
34
-
35
- render() {
36
- const value = this.value || {}
37
-
38
- return html`
39
- <label>Animation Type</label>
40
- <select value-key="type" .value=${value.type}>
41
- <option value="">None</option>
42
- <option value="rotation">Rotation</option>
43
- <option value="vibration">Vibration</option>
44
- <option value="heartbeat">Heartbeat</option>
45
- <option value="moving">Moving</option>
46
- <option value="fade">Fade</option>
47
- <option value="outline">Outline</option>
48
- </select>
49
-
50
- <label> <ox-i18n msgid="label.waiting-time">waiting time</ox-i18n> </label>
51
- <input type="number" value-key="delay" .value=${value.delay} placeholder="ms" />
52
-
53
- <label> <ox-i18n msgid="label.duration">duration</ox-i18n> </label>
54
- <input type="number" value-key="duration" .value=${value.duration} placeholder="ms" />
55
-
56
- <label> <ox-i18n msgid="label.animation-interval">interval</ox-i18n> </label>
57
- <input type="number" value-key="interval" .value=${value.interval} placeholder="ms" />
58
-
59
- ${value.type == 'rotation' || value.type == 'vibration'
60
- ? html`
61
- <label> <ox-i18n msgid="label.theta">theta</ox-i18n> </label>
62
- <ox-input-angle value-key="theta" .value=${value.theta}> </ox-input-angle>
63
- `
64
- : html``}
65
- ${value.type == 'heartbeat'
66
- ? html`
67
- <label> <ox-i18n msgid="label.scale">scale</ox-i18n> </label>
68
- <input type="number" value-key="scale" .value=${value.scale} />
69
- `
70
- : html``}
71
- ${value.type == 'moving'
72
- ? html`
73
- <label> <ox-i18n msgid="label.x-axes">X-axes</ox-i18n> </label>
74
- <input type="number" value-key="x" .value=${value.x} />
75
-
76
- <label> <ox-i18n msgid="label.y-axes">Y-axes</ox-i18n> </label>
77
- <input type="number" value-key="y" .value=${value.y} />
78
- `
79
- : html``}
80
- ${value.type == 'fade'
81
- ? html`
82
- <label> <ox-i18n msgid="label.start-alpha">start alpha</ox-i18n> </label>
83
- <input type="number" value-key="startAlpha" .value=${value.startAlpha} />
84
-
85
- <label> <ox-i18n msgid="label.end-alpha">end alpha</ox-i18n> </label>
86
- <input type="number" value-key="endAlpha" .value=${value.endAlpha} />
87
- `
88
- : html``}
89
- ${value.type == 'outline'
90
- ? html`
91
- <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
92
- <input value-key="rideOn" .value=${value.rideOn || ''} list="target-list" />
93
- <datalist id="target-list">
94
- ${this.scene!.ids.map(info => info.key).map(id => html` <option value=${id}></option> `)}
95
- </datalist>
96
- `
97
- : html``}
98
-
99
- <input id="checkbox-repeat" value-key="repeat" type="checkbox" .checked=${value.repeat} />
100
- <label for="checkbox-repeat" class="checkbox-label"> <ox-i18n msgid="label.repeat">repeat</ox-i18n> </label>
101
-
102
- <input
103
- id="checkbox-autoplay"
104
- value-key="autoplay"
105
- type="checkbox"
106
- .checked=${value.autoplay || (value.autoplay ?? true)}
107
- />
108
- <label for="checkbox-autoplay" class="checkbox-label">
109
- <ox-i18n msgid="label.autoplay">autoplay</ox-i18n>
110
- </label>
111
-
112
- <label>delta</label>
113
- <select value-key="delta" .value=${value.delta}>
114
- <option value="linear">linear</option>
115
- <option value="quad">quad</option>
116
- <option value="circ">circ</option>
117
- <option value="back">back</option>
118
- <option value="bounce">bounce</option>
119
- <option value="elastic">elastic</option>
120
- </select>
121
-
122
- <label>ease</label>
123
- <select value-key="ease" .value=${value.ease}>
124
- <option value="in">in</option>
125
- <option value="out">out</option>
126
- <option value="inout">inout</option>
127
- </select>
128
- `
129
- }
130
-
131
- _onValueChange(e: Event) {
132
- var element = e.target as HTMLElement
133
- var key = element.getAttribute('value-key')
134
-
135
- if (!key) {
136
- return
137
- }
138
-
139
- this.value = {
140
- ...this.value,
141
- [key]: convert(element)
142
- }
143
-
144
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
145
- }
146
- }
@@ -1,93 +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
-
11
- import { Properties, Scene } from '@hatiolab/things-scene'
12
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
13
-
14
- import { PropertySharedStyle } from '../property-shared-style.js'
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 = [
20
- PropertySharedStyle,
21
- css`
22
- fieldset[collapsable] legend {
23
- box-sizing: border-box;
24
- width: 100%;
25
- }
26
-
27
- fieldset[collapsable] legend md-icon {
28
- float: right;
29
- font-size: medium;
30
- margin: 0;
31
- cursor: pointer;
32
- }
33
-
34
- fieldset[collapsable][collapsed] > :not(legend) {
35
- display: none;
36
- }
37
- `
38
- ]
39
-
40
- @property({ type: Object }) value?: Properties
41
- @property({ type: Object }) scene!: Scene
42
-
43
- @state() _expanded: boolean = false
44
-
45
- firstUpdated() {
46
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
47
- }
48
-
49
- static get scopedElements() {
50
- return {
51
- 'property-animation': PropertyAnimation
52
- }
53
- }
54
-
55
- render() {
56
- const value = this.value || {}
57
-
58
- return html`
59
- <fieldset collapsable ?collapsed=${!this._expanded}>
60
- <legend>
61
- <ox-title-with-help topic="board-modeller/effects/animation" msgid="label.animation"
62
- >animation</ox-title-with-help
63
- >
64
- <md-icon
65
- @click=${() => {
66
- this._expanded = !this._expanded
67
- }}
68
- >${this._expanded ? 'expand_less' : 'expand_more'}</md-icon
69
- >
70
- </legend>
71
-
72
- <property-animation value-key="oncreate" .scene=${this.scene} .value=${value.oncreate || {}}>
73
- </property-animation>
74
- </fieldset>
75
- `
76
- }
77
-
78
- _onValueChange(e: Event) {
79
- var element = e.target as HTMLElement
80
- var key = element.getAttribute('value-key')
81
-
82
- if (!key) {
83
- return
84
- }
85
-
86
- this.value = {
87
- ...this.value,
88
- [key]: convert(element)
89
- }
90
-
91
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
92
- }
93
- }
@@ -1,200 +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 } from 'lit/decorators.js'
10
- import { ifDefined } from 'lit/directives/if-defined.js'
11
-
12
- import { Properties, Scene } from '@hatiolab/things-scene'
13
-
14
- import { EffectsSharedStyle } from './effects-shared-style.js'
15
- import { convert } from './value-converter'
16
-
17
- const SETS_ACTION = ['data-set', 'partial-data-set', 'value-set', 'partial-value-set']
18
-
19
- export class PropertyEventHover extends LitElement {
20
- static styles = [
21
- EffectsSharedStyle,
22
- css`
23
- datalist option.cursor-auto {
24
- cursor: auto;
25
- }
26
-
27
- datalist option.cursor-pointer {
28
- cursor: pointer;
29
- }
30
-
31
- datalist option.cursor-default {
32
- cursor: default;
33
- }
34
-
35
- datalist option.cursor-move {
36
- cursor: move;
37
- }
38
-
39
- datalist option.cursor-text {
40
- cursor: text;
41
- }
42
-
43
- datalist option.cursor-wait {
44
- cursor: wait;
45
- }
46
-
47
- datalist option.cursor-help {
48
- cursor: help;
49
- }
50
-
51
- datalist option.cursor-crosshair {
52
- cursor: crosshair;
53
- }
54
-
55
- datalist option.cursor-not-allowed {
56
- cursor: not-allowed;
57
- }
58
-
59
- datalist option.cursor-grab {
60
- cursor: grab;
61
- }
62
- `
63
- ]
64
-
65
- @property({ type: Object }) value?: Properties
66
- @property({ type: Object }) scene?: Scene
67
-
68
- firstUpdated() {
69
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
70
- }
71
-
72
- render() {
73
- var { action, value = '', target = '', emphasize, restore } = this.value || {}
74
-
75
- return html`
76
- <input id="checkbox-emphasize" type="checkbox" value-key="emphasize" .checked=${emphasize} />
77
- <label for="checkbox-emphasize" class="checkbox-label">
78
- <ox-i18n msgid="label.emphasize">emphasize</ox-i18n>
79
- </label>
80
-
81
- <label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
82
- <select id="tap-select" value-key="action" .value=${action || ''}>
83
- <option value=""></option>
84
- <option value="popup">popup target board</option>
85
- <option value="info-window">open infowindow</option>
86
- <option value="data-toggle">toggle(true/false) target component data</option>
87
- <option value="data-tristate">tristate(0/1/2) target component data</option>
88
- <option value="data-set">set value to target component data</option>
89
- <option value="value-set">set value to target component value</option>
90
- <option value="mouse-cursor">change mouse cursor to target style</option>
91
- </select>
92
-
93
- <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
94
-
95
- ${action == 'popup'
96
- ? html`
97
- <ox-editor-board-selector value-key="target" .value=${target} custom-editor></ox-editor-board-selector>
98
- `
99
- : html`
100
- <input
101
- value-key="target"
102
- .value=${target || ''}
103
- list="target-list"
104
- .placeholder="${this._getPlaceHoder(action)}"
105
- />
106
-
107
- <datalist id="target-list">
108
- ${this._getTargetList(action).map(
109
- ({ value, description, class: clazz }) =>
110
- html` <option .value=${value} class=${ifDefined(clazz)}>${description}</option> `
111
- )}
112
- </datalist>
113
- `}
114
- ${SETS_ACTION.indexOf(action) != -1
115
- ? html`
116
- <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
117
- <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
118
- `
119
- : html``}
120
-
121
- <input id="checkbox-restore" type="checkbox" value-key="restore" .checked=${restore} />
122
- <label for="checkbox-restore" class="checkbox-label">
123
- <ox-i18n msgid="label.restore-on-leave">restore on leave</ox-i18n>
124
- </label>
125
- `
126
- }
127
-
128
- _getPlaceHoder(action: string) {
129
- switch (action) {
130
- case 'popup':
131
- case 'goto':
132
- return 'SCENE-100'
133
- case 'link-open':
134
- case 'link-move':
135
- return 'http://www.hatiolab.com/'
136
- default:
137
- return ''
138
- }
139
- }
140
-
141
- _getTargetList(action: string): { value: string; description?: string; class?: string }[] {
142
- switch (action) {
143
- case 'data-toggle':
144
- case 'data-tristate':
145
- case 'data-set':
146
- case 'value-set':
147
- case 'partial-data-set':
148
- case 'partial-value-set':
149
- let ids =
150
- (this.scene &&
151
- this.scene.ids.map(i => {
152
- const id = i.key
153
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
154
- })) ||
155
- []
156
- ids.unshift({ value: '(self)', description: 'self component' })
157
- return ids
158
-
159
- case 'info-window':
160
- return (
161
- (this.scene &&
162
- this.scene.ids
163
- .filter(i => {
164
- return this.scene!.findById(i.key).get('type') == 'info-window'
165
- })
166
- .map(i => {
167
- const id = i.key
168
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
169
- })) ||
170
- []
171
- )
172
-
173
- case 'mouse-cursor':
174
- return ['auto', 'pointer', 'default', 'move', 'text', 'wait', 'help', 'crosshair', 'not-allowed', 'grab'].map(
175
- style => {
176
- return { value: style, class: `cursor-${style}` }
177
- }
178
- )
179
-
180
- default:
181
- return []
182
- }
183
- }
184
-
185
- _onValueChange(e: Event) {
186
- var element = e.target as HTMLElement
187
- var key = element.getAttribute('value-key')
188
-
189
- if (!key) {
190
- return
191
- }
192
-
193
- this.value = {
194
- ...this.value,
195
- [key]: convert(element)
196
- }
197
-
198
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
199
- }
200
- }
@@ -1,251 +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 { html, LitElement } from 'lit'
9
- import { property, state } from 'lit/decorators.js'
10
-
11
- import { Properties, Scene } from '@hatiolab/things-scene'
12
-
13
- import { scenarios } from '../../../graphql/scenario'
14
- import { playlists } from '../../../graphql/play-group'
15
- import { EffectsSharedStyle } from './effects-shared-style'
16
- import { convert } from './value-converter'
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 = [EffectsSharedStyle]
22
-
23
- @property({ type: Object }) value?: Properties
24
- @property({ type: Object }) scene?: Scene
25
-
26
- @state() scenarios: { value: string; description: string }[] = []
27
- @state() playlists: { value: string; description: string }[] = []
28
- @state() targetList: { value: string; description: string }[] = []
29
-
30
- async firstUpdated() {
31
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
32
- }
33
-
34
- render() {
35
- var { action, value = '', target = '', pressed, options } = this.value || {}
36
- var { input = '(self)', output = true } = options || {}
37
-
38
- return html`
39
- <input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
40
- <label for="checkbox-pressed" class="checkbox-label"> <ox-i18n msgid="label.pressed">pressed</ox-i18n> </label>
41
-
42
- <label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
43
- <select
44
- id="tap-select"
45
- value-key="action"
46
- .value=${action || ''}
47
- @change=${async (e: Event) => {
48
- if ((e.target as HTMLSelectElement).value.includes('scenario')) {
49
- this.scenarios = (await scenarios()).map(({ name, description }) => {
50
- return { value: name, description }
51
- })
52
- } else if ((e.target as HTMLSelectElement).value == 'goto-playlist') {
53
- this.playlists = (await playlists()).map(({ name, description }) => {
54
- return { value: name, description }
55
- })
56
- }
57
- }}
58
- >
59
- <option value=""></option>
60
- <option value="goto">go to target board</option>
61
- <option value="goto-playlist">go to target playlist</option>
62
- <option value="link-open">open new window for target link</option>
63
- <option value="link-move">move to target link</option>
64
- <option value="route-page">route to page</option>
65
- <option value="popup">popup target board</option>
66
- <option value="modal-popup">modal popup target board</option>
67
- <option value="close-scene">close current board</option>
68
- <option value="infoWindow">open infowindow</option>
69
- <option value="toggle-info-window">toggle infowindow</option>
70
- <option value="data-toggle">toggle(true/false) target component data</option>
71
- <option value="data-tristate">tristate(0/1/2) target component data</option>
72
- <option value="data-spreading">forcely execute data spreading of target component</option>
73
- <option value="data-set">set value to target component data</option>
74
- <option value="partial-data-set">set partial value to target component data</option>
75
- <option value="value-set">set value to target component value</option>
76
- <option value="partial-value-set">set partial value to target component value</option>
77
- <option value="start-scenario">start the given scenario</option>
78
- <option value="run-scenario">run the given scenario</option>
79
- <option value="export-data">export data</option>
80
- <option value="import-data">import data</option>
81
- </select>
82
-
83
- <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
84
-
85
- ${action === 'goto' || action?.includes('popup')
86
- ? html`
87
- <ox-editor-board-selector value-key="target" .value=${target} custom-editor></ox-editor-board-selector>
88
- `
89
- : html`
90
- <input
91
- value-key="target"
92
- .value=${target}
93
- list="target-list"
94
- .placeholder=${this._getPlaceHoder(action)}
95
- @focusin=${() => {
96
- this.targetList = this._getTargetList(action)
97
- }}
98
- />
99
-
100
- <datalist id="target-list">
101
- ${this.targetList.map(
102
- ({ value, description }) => html` <option .value=${value}>${description}</option> `
103
- )}
104
- </datalist>
105
- `}
106
- ${action === 'goto' || action === 'goto-playlist' || action?.includes('popup')
107
- ? html`
108
- <label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
109
- <input
110
- id="input"
111
- value-key="input"
112
- .value=${input}
113
- list="input-list"
114
- @focusin=${() => {
115
- this.targetList = this._getInputList(action)
116
- }}
117
- />
118
- <datalist id="input-list">
119
- ${this.targetList.map(
120
- ({ value, description }) => html` <option .value=${value}>${description}</option> `
121
- )}
122
- </datalist>
123
- ${
124
- /* currently 'goto' does not support returning result */
125
- action?.includes('popup')
126
- ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
127
- <label for="checkbox-output" class="checkbox-label">
128
- <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
129
- </label>`
130
- : html``
131
- }
132
- `
133
- : SETS_ACTION.indexOf(action) != -1
134
- ? html`
135
- <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
136
- <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
137
- `
138
- : html``}
139
- `
140
- }
141
-
142
- _getPlaceHoder(action: string) {
143
- switch (action) {
144
- case 'link-open':
145
- case 'link-move':
146
- return 'http://www.hatiolab.com/'
147
- case 'export-data':
148
- return 'abc.xlsx'
149
- default:
150
- return ''
151
- }
152
- }
153
-
154
- _getTargetList(action: string): { value: string; description: string }[] {
155
- switch (action) {
156
- case 'data-toggle':
157
- case 'data-tristate':
158
- case 'data-set':
159
- case 'value-set':
160
- case 'popup':
161
- case 'modal-popup':
162
- case 'data-spreading':
163
- let ids =
164
- (this.scene &&
165
- this.scene.ids.map(i => {
166
- const id = i.key
167
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
168
- })) ||
169
- []
170
- ids.unshift({ value: '(self)', description: 'self component' })
171
- return ids
172
- case 'infoWindow':
173
- case 'toggle-info-window':
174
- return (
175
- (this.scene &&
176
- this.scene.ids
177
- .filter(i => {
178
- return this.scene!.findById(i.key).get('type') == 'info-window'
179
- })
180
- .map(i => {
181
- const id = i.key
182
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
183
- })) ||
184
- []
185
- )
186
- case 'start-scenario':
187
- case 'run-scenario':
188
- return this.scenarios
189
- case 'goto-playlist':
190
- return this.playlists
191
- case 'export-data':
192
- default:
193
- return []
194
- }
195
- }
196
-
197
- _getInputList(action: string): { value: string; description: string }[] {
198
- switch (action) {
199
- case 'popup':
200
- case 'modal-popup':
201
- case 'data-spreading':
202
- case 'goto':
203
- case 'goto-playlist':
204
- let ids =
205
- (this.scene &&
206
- this.scene.ids.map(i => {
207
- const id = i.key
208
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
209
- })) ||
210
- []
211
- ids.unshift({ value: '(self)', description: 'self component' })
212
- return ids
213
- default:
214
- return []
215
- }
216
- }
217
-
218
- _onValueChange(e: Event) {
219
- var element = e.target as HTMLElement
220
- var key = element.getAttribute('value-key')
221
-
222
- if (!key) {
223
- return
224
- }
225
-
226
- if (key === 'input' || key === 'output') {
227
- var { options = {} } = this.value || {}
228
-
229
- this.value = {
230
- ...this.value,
231
- options: {
232
- ...options,
233
- [key]: convert(element)
234
- }
235
- }
236
- } else {
237
- this.value = {
238
- ...this.value,
239
- [key]: convert(element)
240
- }
241
- }
242
-
243
- var { action } = this.value
244
- if (action !== 'goto' && action !== 'goto-playlist' && !action?.includes('popup')) {
245
- /* clear unused options */
246
- delete this.value.options
247
- }
248
-
249
- this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
250
- }
251
- }