@operato/board 0.2.45 → 0.2.46

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 (138) hide show
  1. package/@types/global/index.d.ts +1 -0
  2. package/CHANGELOG.md +19 -0
  3. package/assets/images/components/no-image.png +0 -0
  4. package/custom-elements.json +4419 -365
  5. package/dist/src/index.d.ts +1 -0
  6. package/dist/src/index.js +1 -0
  7. package/dist/src/index.js.map +1 -1
  8. package/dist/src/modeller/component-toolbar/component-menu.d.ts +4 -0
  9. package/dist/src/modeller/component-toolbar/component-menu.js +148 -0
  10. package/dist/src/modeller/component-toolbar/component-menu.js.map +1 -0
  11. package/dist/src/modeller/component-toolbar/component-toolbar.d.ts +4 -0
  12. package/dist/src/modeller/component-toolbar/component-toolbar.js +176 -0
  13. package/dist/src/modeller/component-toolbar/component-toolbar.js.map +1 -0
  14. package/dist/src/modeller/edit-toolbar-style.d.ts +4 -0
  15. package/dist/src/modeller/edit-toolbar-style.js +227 -0
  16. package/dist/src/modeller/edit-toolbar-style.js.map +1 -0
  17. package/dist/src/modeller/edit-toolbar.d.ts +61 -0
  18. package/dist/src/modeller/edit-toolbar.js +644 -0
  19. package/dist/src/modeller/edit-toolbar.js.map +1 -0
  20. package/dist/src/modeller/property-sidebar/abstract-property.d.ts +10 -0
  21. package/dist/src/modeller/property-sidebar/abstract-property.js +58 -0
  22. package/dist/src/modeller/property-sidebar/abstract-property.js.map +1 -0
  23. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.d.ts +49 -0
  24. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js +348 -0
  25. package/dist/src/modeller/property-sidebar/data-binding/data-binding-mapper.js.map +1 -0
  26. package/dist/src/modeller/property-sidebar/data-binding/data-binding.d.ts +8 -0
  27. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js +428 -0
  28. package/dist/src/modeller/property-sidebar/data-binding/data-binding.js.map +1 -0
  29. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.d.ts +4 -0
  30. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js +57 -0
  31. package/dist/src/modeller/property-sidebar/effects/effects-shared-style.js.map +1 -0
  32. package/dist/src/modeller/property-sidebar/effects/effects.d.ts +7 -0
  33. package/dist/src/modeller/property-sidebar/effects/effects.js +59 -0
  34. package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -0
  35. package/dist/src/modeller/property-sidebar/effects/property-animation.d.ts +23 -0
  36. package/dist/src/modeller/property-sidebar/effects/property-animation.js +131 -0
  37. package/dist/src/modeller/property-sidebar/effects/property-animation.js.map +1 -0
  38. package/dist/src/modeller/property-sidebar/effects/property-animations.d.ts +6 -0
  39. package/dist/src/modeller/property-sidebar/effects/property-animations.js +84 -0
  40. package/dist/src/modeller/property-sidebar/effects/property-animations.js.map +1 -0
  41. package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +4 -0
  42. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +128 -0
  43. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -0
  44. package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +4 -0
  45. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +124 -0
  46. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -0
  47. package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +6 -0
  48. package/dist/src/modeller/property-sidebar/effects/property-event.js +63 -0
  49. package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -0
  50. package/dist/src/modeller/property-sidebar/effects/property-shadow.d.ts +23 -0
  51. package/dist/src/modeller/property-sidebar/effects/property-shadow.js +110 -0
  52. package/dist/src/modeller/property-sidebar/effects/property-shadow.js.map +1 -0
  53. package/dist/src/modeller/property-sidebar/effects/value-converter.d.ts +1 -0
  54. package/dist/src/modeller/property-sidebar/effects/value-converter.js +23 -0
  55. package/dist/src/modeller/property-sidebar/effects/value-converter.js.map +1 -0
  56. package/dist/src/modeller/property-sidebar/inspector/inspector.d.ts +24 -0
  57. package/dist/src/modeller/property-sidebar/inspector/inspector.js +290 -0
  58. package/dist/src/modeller/property-sidebar/inspector/inspector.js.map +1 -0
  59. package/dist/src/modeller/property-sidebar/property-shared-style.d.ts +4 -0
  60. package/dist/src/modeller/property-sidebar/property-shared-style.js +131 -0
  61. package/dist/src/modeller/property-sidebar/property-shared-style.js.map +1 -0
  62. package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +10 -0
  63. package/dist/src/modeller/property-sidebar/property-sidebar.js +313 -0
  64. package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -0
  65. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.d.ts +1 -0
  66. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js +94 -0
  67. package/dist/src/modeller/property-sidebar/shapes/box-padding-editor-styles.js.map +1 -0
  68. package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +7 -0
  69. package/dist/src/modeller/property-sidebar/shapes/shapes.js +409 -0
  70. package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -0
  71. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.d.ts +4 -0
  72. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js +127 -0
  73. package/dist/src/modeller/property-sidebar/specifics/specific-properties-builder.js.map +1 -0
  74. package/dist/src/modeller/property-sidebar/specifics/specifics.d.ts +5 -0
  75. package/dist/src/modeller/property-sidebar/specifics/specifics.js +78 -0
  76. package/dist/src/modeller/property-sidebar/specifics/specifics.js.map +1 -0
  77. package/dist/src/modeller/property-sidebar/styles/styles.d.ts +9 -0
  78. package/dist/src/modeller/property-sidebar/styles/styles.js +563 -0
  79. package/dist/src/modeller/property-sidebar/styles/styles.js.map +1 -0
  80. package/dist/src/modeller/scene-viewer/confidential-overlay.d.ts +4 -0
  81. package/dist/src/modeller/scene-viewer/confidential-overlay.js +14 -0
  82. package/dist/src/modeller/scene-viewer/confidential-overlay.js.map +1 -0
  83. package/dist/src/modeller/scene-viewer/ox-scene-handler.d.ts +11 -0
  84. package/dist/src/modeller/scene-viewer/ox-scene-handler.js +36 -0
  85. package/dist/src/modeller/scene-viewer/ox-scene-handler.js.map +1 -0
  86. package/dist/src/modeller/scene-viewer/ox-scene-layer.d.ts +10 -0
  87. package/dist/src/modeller/scene-viewer/ox-scene-layer.js +42 -0
  88. package/dist/src/modeller/scene-viewer/ox-scene-layer.js.map +1 -0
  89. package/dist/src/modeller/scene-viewer/ox-scene-player.d.ts +1 -0
  90. package/dist/src/modeller/scene-viewer/ox-scene-player.js +99 -0
  91. package/dist/src/modeller/scene-viewer/ox-scene-player.js.map +1 -0
  92. package/dist/src/modeller/scene-viewer/ox-scene-property.d.ts +6 -0
  93. package/dist/src/modeller/scene-viewer/ox-scene-property.js +19 -0
  94. package/dist/src/modeller/scene-viewer/ox-scene-property.js.map +1 -0
  95. package/dist/src/modeller/scene-viewer/ox-scene-viewer.d.ts +39 -0
  96. package/dist/src/modeller/scene-viewer/ox-scene-viewer.js +245 -0
  97. package/dist/src/modeller/scene-viewer/ox-scene-viewer.js.map +1 -0
  98. package/dist/src/ox-board-modeller.d.ts +12 -3
  99. package/dist/src/ox-board-modeller.js +128 -39
  100. package/dist/src/ox-board-modeller.js.map +1 -1
  101. package/dist/src/types.d.ts +12 -0
  102. package/dist/src/types.js +2 -0
  103. package/dist/src/types.js.map +1 -0
  104. package/dist/tsconfig.tsbuildinfo +1 -1
  105. package/package.json +26 -5
  106. package/src/index.ts +1 -0
  107. package/src/modeller/component-toolbar/component-menu.ts +142 -0
  108. package/src/modeller/component-toolbar/component-toolbar.ts +169 -0
  109. package/src/modeller/edit-toolbar-style.ts +228 -0
  110. package/src/modeller/edit-toolbar.ts +640 -0
  111. package/src/modeller/property-sidebar/abstract-property.ts +73 -0
  112. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +368 -0
  113. package/src/modeller/property-sidebar/data-binding/data-binding.ts +447 -0
  114. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +58 -0
  115. package/src/modeller/property-sidebar/effects/effects.ts +55 -0
  116. package/src/modeller/property-sidebar/effects/property-animation.ts +131 -0
  117. package/src/modeller/property-sidebar/effects/property-animations.ts +82 -0
  118. package/src/modeller/property-sidebar/effects/property-event-hover.ts +133 -0
  119. package/src/modeller/property-sidebar/effects/property-event-tap.ts +129 -0
  120. package/src/modeller/property-sidebar/effects/property-event.ts +63 -0
  121. package/src/modeller/property-sidebar/effects/property-shadow.ts +112 -0
  122. package/src/modeller/property-sidebar/effects/value-converter.ts +26 -0
  123. package/src/modeller/property-sidebar/inspector/inspector.ts +327 -0
  124. package/src/modeller/property-sidebar/property-shared-style.ts +132 -0
  125. package/src/modeller/property-sidebar/property-sidebar.ts +308 -0
  126. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +94 -0
  127. package/src/modeller/property-sidebar/shapes/shapes.ts +411 -0
  128. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +135 -0
  129. package/src/modeller/property-sidebar/specifics/specifics.ts +72 -0
  130. package/src/modeller/property-sidebar/styles/styles.ts +578 -0
  131. package/src/modeller/scene-viewer/confidential-overlay.ts +18 -0
  132. package/src/modeller/scene-viewer/ox-scene-handler.ts +40 -0
  133. package/src/modeller/scene-viewer/ox-scene-layer.ts +42 -0
  134. package/src/modeller/scene-viewer/ox-scene-player.ts +104 -0
  135. package/src/modeller/scene-viewer/ox-scene-property.ts +10 -0
  136. package/src/modeller/scene-viewer/ox-scene-viewer.ts +248 -0
  137. package/src/ox-board-modeller.ts +134 -39
  138. package/src/types.ts +26 -0
@@ -0,0 +1,447 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@things-factory/i18n-base'
6
+ import './data-binding-mapper'
7
+ import '@material/mwc-icon'
8
+ import '@things-factory/help'
9
+ import '@operato/input/dist/src/ox-buttons-radio.js'
10
+
11
+ import { Properties, Scene } from '@hatiolab/things-scene'
12
+ import { PropertyValues, css, html } from 'lit'
13
+ import { customElement, property, query, state } from 'lit/decorators'
14
+
15
+ import { AbstractProperty } from '../abstract-property'
16
+ import { PropertySharedStyle } from '../property-shared-style'
17
+
18
+ var clipboard = '{}'
19
+
20
+ const PROPS = [
21
+ '',
22
+ 'text',
23
+ ['fillStyle', 'fill style'],
24
+ ['strokeStyle', 'stroke style'],
25
+ ['fontColor', 'font color'],
26
+ 'value',
27
+ 'data',
28
+ 'source',
29
+ 'hidden',
30
+ 'started',
31
+ 'play',
32
+ ['ref', 'reference'],
33
+ 'options',
34
+ 'rotate',
35
+ 'scale',
36
+ 'translate',
37
+ 'dimension',
38
+ 'location',
39
+ 'accessor'
40
+ ].map(prop => {
41
+ return typeof prop == 'string' ? { name: prop, label: prop } : { name: prop[0], label: prop[1] }
42
+ })
43
+
44
+ @customElement('property-data-binding')
45
+ class PropertyDataBinding extends AbstractProperty {
46
+ static styles = [
47
+ PropertySharedStyle,
48
+ css`
49
+ #tab-header {
50
+ display: flex;
51
+ align-items: center;
52
+ justify-content: space-between;
53
+ }
54
+
55
+ #tab-header > mwc-icon {
56
+ padding: 0;
57
+ margin: 0;
58
+ width: 25px;
59
+ height: 25px;
60
+ font-size: x-large;
61
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
62
+ }
63
+
64
+ fieldset[collapsable] legend {
65
+ box-sizing: border-box;
66
+ width: 100%;
67
+ }
68
+
69
+ fieldset[collapsable] legend mwc-icon {
70
+ float: right;
71
+ font-size: medium;
72
+ margin: 0;
73
+ }
74
+
75
+ fieldset[collapsable][collapsed] > :not(legend) {
76
+ display: none;
77
+ }
78
+
79
+ ox-buttons-radio {
80
+ flex: 1;
81
+ height: 25px;
82
+ border: 1px solid rgba(0, 0, 0, 0.2);
83
+ border-width: 1px 1px 0 1px;
84
+ text-align: center;
85
+
86
+ display: flex;
87
+ padding: 0;
88
+ box-sizing: border-box;
89
+
90
+ width: 0; /* limit width */
91
+ overflow-x: hidden;
92
+ }
93
+
94
+ ox-buttons-radio > div {
95
+ background-color: rgba(0, 0, 0, 0.2);
96
+ border: 1px solid rgba(0, 0, 0, 0.07);
97
+ border-width: 0 0 2px 0;
98
+ padding: 0;
99
+ color: #fff;
100
+ font-size: 13px;
101
+ max-width: 25px;
102
+ min-width: 25px;
103
+ }
104
+
105
+ ox-buttons-radio > div[disabled] {
106
+ background-color: rgba(0, 0, 0, 0.1);
107
+ }
108
+
109
+ ox-buttons-radio > div[active] {
110
+ border-color: rgb(242, 71, 28);
111
+ }
112
+
113
+ ox-buttons-radio > div.iron-selected {
114
+ background-color: rgba(255, 255, 255, 0.5);
115
+ color: #585858;
116
+ }
117
+
118
+ div[binding] {
119
+ display: flex;
120
+ flex-direction: row-reverse;
121
+ background-color: rgba(255, 255, 255, 0.5);
122
+ overflow: hidden;
123
+ border-style: solid;
124
+ border-color: rgba(0, 0, 0, 0.2);
125
+ border-image: initial;
126
+ border-width: 0px 1px;
127
+ padding: 7px 5px 2px 5px;
128
+ }
129
+
130
+ mwc-icon {
131
+ margin-left: 5px;
132
+ color: var(--secondary-color);
133
+ opacity: 0.8;
134
+ cursor: pointer;
135
+ --mdc-icon-size: 18px;
136
+ }
137
+
138
+ mwc-icon:hover {
139
+ color: var(--primary-color);
140
+ opacity: 1;
141
+ }
142
+
143
+ mwc-icon[disabled] {
144
+ color: rgba(0, 0, 0, 0.1);
145
+ }
146
+
147
+ data-binding-mapper {
148
+ --things-select: {
149
+ min-width: 50%;
150
+ margin-bottom: 10px;
151
+ padding: 3px 20px 2px 5px;
152
+ -webkit-border-radius: 4px;
153
+ -moz-border-radius: 4px;
154
+ border-radius: 4px;
155
+ border: 1px solid rgba(0, 0, 0, 0.15);
156
+ font-size: 15px;
157
+ font-weight: 300;
158
+ -webkit-appearance: none;
159
+ }
160
+ }
161
+ `
162
+ ]
163
+
164
+ @property({ type: Object }) value: Properties = {
165
+ mappings: []
166
+ }
167
+ @property({ type: Object }) scene?: Scene
168
+
169
+ @state() mappingIndex: number = 0
170
+ @state() _afterRender?: Function | null
171
+ @state() _dataExpanded: boolean = false
172
+
173
+ @query('#tabs') tabs!: HTMLElement
174
+ @query('#tab-nav-left-button') tabNavLeftButton!: HTMLElement
175
+ @query('#tab-nav-right-button') tabNavRightButton!: HTMLElement
176
+
177
+ private mapping: Properties = {}
178
+
179
+ get mappings() {
180
+ return this.value.mappings || []
181
+ }
182
+
183
+ firstUpdated() {
184
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
185
+
186
+ this.tabContainer.addEventListener('scroll', () => {
187
+ this._onTabScroll()
188
+ })
189
+ }
190
+
191
+ updated(changes: PropertyValues<this>) {
192
+ if (changes.has('value')) {
193
+ this._onValueChanged()
194
+ }
195
+ }
196
+
197
+ render() {
198
+ return html`
199
+ <fieldset>
200
+ <legend>
201
+ <title-with-help topic="board-modeller/data-binding" msgid="label.identifier">identifier</title-with-help>
202
+ </legend>
203
+ <div class="property-grid">
204
+ <label> <i18n-msg msgid="label.id">ID</i18n-msg> </label>
205
+ <input value-key="id" .value=${this.value.id || ''} />
206
+
207
+ <label> <i18n-msg msgid="label.class">Class</i18n-msg> </label>
208
+ <input value-key="class" .value=${this.value.class || ''} />
209
+
210
+ <label> <i18n-msg msgid="label.template-prefix">Template Prefix</i18n-msg> </label>
211
+ <input value-key="templatePrefix" .value=${this.value.templatePrefix || ''} />
212
+
213
+ <div class="checkbox-row">
214
+ <input id="checkbox-ndns" type="checkbox" value-key="ndns" .checked=${this.value.ndns} />
215
+ <label for="checkbox-ndns"> <i18n-msg msgid="label.ndns">No Data No Show</i18n-msg> </label>
216
+ </div>
217
+
218
+ <div class="checkbox-row">
219
+ <input id="checkbox-sensitive" type="checkbox" value-key="sensitive" .checked=${this.value.sensitive} />
220
+ <label for="checkbox-sensitive">
221
+ <i18n-msg msgid="label.intent-sensitive">Intent Sensitive</i18n-msg>
222
+ </label>
223
+ </div>
224
+ </div>
225
+ </fieldset>
226
+
227
+ <fieldset collapsable ?collapsed=${!this._dataExpanded}>
228
+ <legend>
229
+ <i18n-msg msgid="label.initial-data">initial value</i18n-msg>
230
+ <mwc-icon
231
+ @click=${() => {
232
+ this._dataExpanded = !this._dataExpanded
233
+ }}
234
+ >${this._dataExpanded ? 'expand_less' : 'expand_more'}</mwc-icon
235
+ >
236
+ </legend>
237
+ <things-editor-data value-key="data" .value=${this.value.data}> </things-editor-data>
238
+ </fieldset>
239
+
240
+ <fieldset>
241
+ <legend><i18n-msg msgid="label.data-spread">Data Spread</i18n-msg></legend>
242
+ <div id="tab-header">
243
+ <mwc-icon
244
+ id="tab-nav-left-button"
245
+ @click=${() => {
246
+ this._onTabScrollNavLeft()
247
+ }}
248
+ disabled
249
+ >chevron_left</mwc-icon
250
+ >
251
+
252
+ <ox-buttons-radio
253
+ id="tabs"
254
+ .value=${String(this.mappingIndex)}
255
+ @change=${(e: Event) => {
256
+ e.stopPropagation()
257
+ this._setMappingIndex((e.target as any).value)
258
+ }}
259
+ >
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
+ </ox-buttons-radio>
263
+
264
+ <mwc-icon
265
+ id="tab-nav-right-button"
266
+ @click=${(e: Event) => {
267
+ this._onTabScrollNavRight()
268
+ }}
269
+ disabled
270
+ >chevron_right</mwc-icon
271
+ >
272
+ </div>
273
+
274
+ <div binding>
275
+ <mwc-icon style="font-size:19px" @click=${() => this._clearDataBindingMapper()} title="delete"
276
+ >delete_forever</mwc-icon
277
+ >
278
+ <mwc-icon @click=${() => this._pasteDataBindingMapper()} title="past">content_paste</mwc-icon>
279
+ <mwc-icon style="font-size:17px" @click=${() => this._copyDataBindingMapper()} title="copy"
280
+ >content_copy</mwc-icon
281
+ >
282
+ </div>
283
+
284
+ <data-binding-mapper
285
+ @value-change=${(e: CustomEvent) => this._onMappingChanged(e)}
286
+ .scene=${this.scene}
287
+ .mapping=${(this.value.mappings && this.value.mappings[this.mappingIndex]) || {}}
288
+ .properties=${PROPS}
289
+ >
290
+ </data-binding-mapper>
291
+ </fieldset>
292
+ `
293
+ }
294
+
295
+ _setMappingIndex(idx: number) {
296
+ this.mappingIndex = isNaN(Number(idx)) ? 0 : Number(idx)
297
+
298
+ this._onTabScroll()
299
+ }
300
+
301
+ _clearDataBindingMapper() {
302
+ var mappings = [...(this.value.mappings || [])]
303
+ mappings.splice(this.mappingIndex, 1)
304
+ this._onAfterValueChange(
305
+ 'mappings',
306
+ mappings.filter(m => !!m)
307
+ )
308
+ }
309
+
310
+ _copyDataBindingMapper() {
311
+ clipboard = JSON.stringify(this.mappings[this.mappingIndex])
312
+ }
313
+
314
+ async _pasteDataBindingMapper() {
315
+ var index = this.mappingIndex
316
+ var mappings = [...(this.value.mappings || [])]
317
+ mappings[this.mappingIndex] = JSON.parse(clipboard)
318
+
319
+ this._onAfterValueChange('mappings', mappings)
320
+
321
+ setTimeout(() => {
322
+ this._setMappingIndex(index)
323
+ }, 100)
324
+ }
325
+
326
+ async _onValueChanged() {
327
+ await this.updateComplete
328
+
329
+ if (this._afterRender) {
330
+ this._afterRender()
331
+ } else {
332
+ this._setMappingIndex(0)
333
+ }
334
+
335
+ this._afterRender = null
336
+ }
337
+
338
+ _onValueChange(e: Event) {
339
+ var element = e.target as HTMLElement
340
+ var key = element.getAttribute('value-key')
341
+
342
+ var value = this._getValueFromEventTarget(element)
343
+
344
+ if (!key) {
345
+ return
346
+ }
347
+
348
+ this.value = {
349
+ ...this.value,
350
+ [key]: value
351
+ }
352
+
353
+ this._onAfterValueChange(key, value)
354
+ }
355
+
356
+ get tabContainer() {
357
+ return this.tabs
358
+ }
359
+
360
+ async _onMappingChanged(e: CustomEvent) {
361
+ var mapping = (e.target as any).mapping
362
+
363
+ /* data spread target의 변경이 있는 경우, target 컴포넌트들의 태그를 블링크 시킨다 */
364
+ if (mapping && mapping.target) {
365
+ this.scene &&
366
+ this.scene.findAll(mapping.target, this.scene.selected && this.scene.selected[0]).forEach((c, i) => {
367
+ if (i == 0) c.trigger('tagreset')
368
+ c.trigger('tag', {})
369
+ })
370
+ }
371
+
372
+ /* mapping의 모든 속성이 편집되면, 모델에 반영한다. */
373
+ var mappings = [...(this.value.mappings || [])]
374
+
375
+ if (mapping.target && mapping.property && mapping.rule) {
376
+ mappings[this.mappingIndex] = mapping
377
+
378
+ var mappingIdx = this.mappingIndex
379
+ this._afterRender = () => {
380
+ this._setMappingIndex(mappingIdx)
381
+ this.tabContainer.scrollLeft = this.tabContainer.scrollWidth
382
+ }
383
+
384
+ this.dispatchEvent(
385
+ new CustomEvent('property-change', {
386
+ bubbles: true,
387
+ composed: true,
388
+ detail: {
389
+ mappings: mappings.filter(m => !!m)
390
+ }
391
+ })
392
+ )
393
+
394
+ await this.requestUpdate()
395
+ } else if (!mapping.target && !mapping.property) {
396
+ // accessor를 입력중인 경우 tabIndex Change 방지
397
+ if (e.detail && e.detail.changed && !e.detail.changed.accessor) {
398
+ mappings[this.mappingIndex] = null
399
+ var nextMappingIdx = Math.max(this.mappingIndex - 1, 0)
400
+ this._afterRender = () => {
401
+ this._setMappingIndex(nextMappingIdx)
402
+ }
403
+ this.dispatchEvent(
404
+ new CustomEvent('property-change', {
405
+ bubbles: true,
406
+ composed: true,
407
+ detail: {
408
+ mappings: mappings.filter(m => !!m)
409
+ }
410
+ })
411
+ )
412
+ }
413
+ }
414
+ }
415
+
416
+ _onTabScroll() {
417
+ if (this.tabContainer.clientWidth == this.tabContainer.scrollWidth) {
418
+ this.tabNavLeftButton.setAttribute('disabled', '')
419
+ this.tabNavRightButton.setAttribute('disabled', '')
420
+ }
421
+ // left-end
422
+ else if (this.tabContainer.scrollLeft == 0) {
423
+ this.tabNavLeftButton.setAttribute('disabled', '')
424
+ this.tabNavRightButton.removeAttribute('disabled')
425
+ }
426
+ // right-end
427
+ else if (this.tabContainer.scrollLeft + this.tabContainer.clientWidth >= this.tabContainer.scrollWidth) {
428
+ this.tabNavLeftButton.removeAttribute('disabled')
429
+ this.tabNavRightButton.setAttribute('disabled', '')
430
+ } else {
431
+ this.tabNavLeftButton.removeAttribute('disabled')
432
+ this.tabNavRightButton.removeAttribute('disabled')
433
+ }
434
+ }
435
+
436
+ _onTabScrollNavLeft() {
437
+ this.tabContainer.style.scrollBehavior = 'smooth'
438
+ this.tabContainer.scrollLeft -= this.tabContainer.clientWidth
439
+ this.tabContainer.style.scrollBehavior = 'auto'
440
+ }
441
+
442
+ _onTabScrollNavRight() {
443
+ this.tabContainer.style.scrollBehavior = 'smooth'
444
+ this.tabContainer.scrollLeft += this.tabContainer.clientWidth
445
+ this.tabContainer.style.scrollBehavior = 'auto'
446
+ }
447
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import { css } from 'lit'
6
+
7
+ export const EffectsSharedStyle = css`
8
+ :host {
9
+ display: grid;
10
+ grid-template-columns: repeat(10, 1fr);
11
+ grid-gap: 5px;
12
+ grid-auto-rows: minmax(24px, auto);
13
+
14
+ align-items: center;
15
+ }
16
+
17
+ * {
18
+ align-self: stretch;
19
+ }
20
+
21
+ label {
22
+ grid-column: span 3;
23
+ text-align: right;
24
+ text-transform: capitalize;
25
+
26
+ align-self: center;
27
+ }
28
+
29
+ input,
30
+ select,
31
+ things-editor-angle-input,
32
+ things-editor-color,
33
+ [custom-editor] {
34
+ grid-column: span 7;
35
+ }
36
+
37
+ input,
38
+ select,
39
+ things-editor-angle-input input,
40
+ things-editor-color input,
41
+ [custom-editor] input {
42
+ border: var(--property-sidebar-fieldset-border);
43
+ }
44
+
45
+ input[type='checkbox'] {
46
+ grid-column: 4 / 5;
47
+ align-self: center;
48
+ }
49
+
50
+ label.checkbox-label {
51
+ grid-column: span 6;
52
+ text-align: left;
53
+ }
54
+
55
+ [fullwidth] {
56
+ grid-column: 1 / -1;
57
+ }
58
+ `
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@things-factory/i18n-base'
6
+ import './property-animations'
7
+ import './property-event'
8
+ import './property-shadow'
9
+
10
+ import { customElement, property } from 'lit/decorators'
11
+
12
+ import { AbstractProperty } from '../abstract-property'
13
+ import { PropertySharedStyle } from '../property-shared-style'
14
+ import { Scene } from '@hatiolab/things-scene'
15
+ import { html } from 'lit'
16
+
17
+ @customElement('property-effect')
18
+ class PropertyEffects extends AbstractProperty {
19
+ static styles = [PropertySharedStyle]
20
+
21
+ @property({ type: Object }) value: any = {}
22
+ @property({ type: Object }) scene?: Scene
23
+
24
+ firstUpdated() {
25
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
26
+ }
27
+
28
+ render() {
29
+ return html`
30
+ <fieldset>
31
+ <legend>
32
+ <title-with-help topic="board-modeller/effects/shadow" msgid="label.shadow">shadow</title-with-help>
33
+ </legend>
34
+
35
+ <property-shadow value-key="shadow" .value=${this.value.shadow || {}}> </property-shadow>
36
+ </fieldset>
37
+
38
+ <fieldset>
39
+ <legend>
40
+ <title-with-help topic="board-modeller/effects/retention" msgid="label.retention">retention</title-with-help>
41
+ </legend>
42
+
43
+ <div class="property-grid">
44
+ <label> <i18n-msg msgid="label.retention">retention</i18n-msg> </label>
45
+ <input type="number" value-key="retention" .value=${this.value.retention} placeholder="ms" />
46
+ </div>
47
+ </fieldset>
48
+
49
+ <property-animations value-key="animation" .scene=${this.scene} .value=${this.value.animation || {}}>
50
+ </property-animations>
51
+
52
+ <property-event value-key="event" .scene=${this.scene} .value=${this.value.event || {}}> </property-event>
53
+ `
54
+ }
55
+ }
@@ -0,0 +1,131 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@things-factory/i18n-base'
6
+ import '@things-factory/modeller-ui/client/editors/things-editor-angle-input'
7
+
8
+ import { LitElement, html } from 'lit'
9
+ import { Properties, Scene } from '@hatiolab/things-scene'
10
+ import { customElement, property } from 'lit/decorators'
11
+
12
+ import { EffectsSharedStyle } from './effects-shared-style'
13
+ import { convert } from './value-converter'
14
+
15
+ /**
16
+ * 컴포넌트의 animation 속성을 편집하는 element
17
+
18
+ Example:
19
+
20
+ <property-animation .value=${animation}>
21
+ </property-animation>
22
+ */
23
+
24
+ @customElement('property-animation')
25
+ export default 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
+ return html`
37
+ <label>Animation Type</label>
38
+ <select value-key="type" .value=${this.value && this.value.type}>
39
+ <option value="">None</option>
40
+ <option value="rotation">Rotation</option>
41
+ <option value="vibration">Vibration</option>
42
+ <option value="heartbeat">Heartbeat</option>
43
+ <option value="moving">Moving</option>
44
+ <option value="fade">Fade</option>
45
+ <option value="outline">Outline</option>
46
+ </select>
47
+
48
+ <label> <i18n-msg msgid="label.waiting-time">waiting time</i18n-msg> </label>
49
+ <input type="number" value-key="delay" .value=${this.value.delay} placeholder="ms" />
50
+
51
+ <label> <i18n-msg msgid="label.duration">duration</i18n-msg> </label>
52
+ <input type="number" value-key="duration" .value=${this.value.duration} placeholder="ms" />
53
+
54
+ ${this.value.type == 'rotation' || this.value.type == 'vibration'
55
+ ? html`
56
+ <label> <i18n-msg msgid="label.theta">theta</i18n-msg> </label>
57
+ <things-editor-angle-input value-key="theta" .radian=${this.value.theta}> </things-editor-angle-input>
58
+ `
59
+ : html``}
60
+ ${this.value.type == 'heartbeat'
61
+ ? html`
62
+ <label> <i18n-msg msgid="label.scale">scale</i18n-msg> </label>
63
+ <input type="number" value-key="scale" .value=${this.value.scale} />
64
+ `
65
+ : html``}
66
+ ${this.value.type == 'moving'
67
+ ? html`
68
+ <label> <i18n-msg msgid="label.x-axes">X-axes</i18n-msg> </label>
69
+ <input type="number" value-key="x" .value=${this.value.x} />
70
+
71
+ <label> <i18n-msg msgid="label.y-axes">Y-axes</i18n-msg> </label>
72
+ <input type="number" value-key="y" .value=${this.value.y} />
73
+ `
74
+ : html``}
75
+ ${this.value.type == 'fade'
76
+ ? html`
77
+ <label> <i18n-msg msgid="label.start-alpha">start alpha</i18n-msg> </label>
78
+ <input type="number" value-key="startAlpha" .value=${this.value.startAlpha} />
79
+
80
+ <label> <i18n-msg msgid="label.end-alpha">end alpha</i18n-msg> </label>
81
+ <input type="number" value-key="endAlpha" .value=${this.value.endAlpha} />
82
+ `
83
+ : html``}
84
+ ${this.value.type == 'outline'
85
+ ? html`
86
+ <label> <i18n-msg msgid="label.target">target</i18n-msg> </label>
87
+ <input value-key="rideOn" .value=${this.value.rideOn || ''} list="target-list" />
88
+ <datalist id="target-list">
89
+ ${this.scene!.ids.map(info => info.key).map(id => html` <option value=${id}></option> `)}
90
+ </datalist>
91
+ `
92
+ : html``}
93
+
94
+ <input id="checkbox-repeat" value-key="repeat" type="checkbox" .checked=${this.value.repeat} />
95
+ <label for="checkbox-repeat" class="checkbox-label"> <i18n-msg msgid="label.repeat">repeat</i18n-msg> </label>
96
+
97
+ <label>delta</label>
98
+ <select value-key="delta" .value=${this.value.delta}>
99
+ <option value="linear">linear</option>
100
+ <option value="quad">quad</option>
101
+ <option value="circ">circ</option>
102
+ <option value="back">back</option>
103
+ <option value="bounce">bounce</option>
104
+ <option value="elastic">elastic</option>
105
+ </select>
106
+
107
+ <label>ease</label>
108
+ <select value-key="ease" .value=${this.value.ease}>
109
+ <option value="in">in</option>
110
+ <option value="out">out</option>
111
+ <option value="inout">inout</option>
112
+ </select>
113
+ `
114
+ }
115
+
116
+ _onValueChange(e: Event) {
117
+ var element = e.target as HTMLElement
118
+ var key = element.getAttribute('value-key')
119
+
120
+ if (!key) {
121
+ return
122
+ }
123
+
124
+ this.value = {
125
+ ...this.value,
126
+ [key]: convert(element)
127
+ }
128
+
129
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
130
+ }
131
+ }