@operato/board 7.1.30 → 7.1.32

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 (87) hide show
  1. package/CHANGELOG.md +18 -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/demo/index-modeller.html +0 -112
  7. package/demo/index-player.html +0 -112
  8. package/demo/index-viewer.html +0 -112
  9. package/demo/index.html +0 -112
  10. package/src/component/3d.ts +0 -29
  11. package/src/component/chart-and-gauge.ts +0 -28
  12. package/src/component/container.ts +0 -63
  13. package/src/component/data-source.ts +0 -30
  14. package/src/component/etc.ts +0 -88
  15. package/src/component/form.ts +0 -42
  16. package/src/component/index.ts +0 -12
  17. package/src/component/iot.ts +0 -52
  18. package/src/component/line.ts +0 -156
  19. package/src/component/register-default-groups.ts +0 -28
  20. package/src/component/shape.ts +0 -156
  21. package/src/component/table.ts +0 -28
  22. package/src/component/text-and-media.ts +0 -125
  23. package/src/component/warehouse.ts +0 -26
  24. package/src/data-storage/data-storage.ts +0 -76
  25. package/src/graphql/board.ts +0 -144
  26. package/src/graphql/data-subscription.ts +0 -30
  27. package/src/graphql/favorite-board.ts +0 -25
  28. package/src/graphql/group.ts +0 -138
  29. package/src/graphql/index.ts +0 -4
  30. package/src/graphql/play-group.ts +0 -225
  31. package/src/graphql/scenario.ts +0 -79
  32. package/src/index.ts +0 -10
  33. package/src/modeller/component-toolbar/component-detail.ts +0 -52
  34. package/src/modeller/component-toolbar/component-menu.ts +0 -196
  35. package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
  36. package/src/modeller/component-toolbar/mode-icons.ts +0 -88
  37. package/src/modeller/edit-toolbar-style.ts +0 -232
  38. package/src/modeller/edit-toolbar.ts +0 -587
  39. package/src/modeller/property-sidebar/abstract-property.ts +0 -69
  40. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
  41. package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
  42. package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
  43. package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
  44. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
  45. package/src/modeller/property-sidebar/effects/effects.ts +0 -69
  46. package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
  47. package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
  48. package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
  49. package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
  50. package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
  51. package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
  52. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
  53. package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
  54. package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
  55. package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
  56. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
  57. package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
  58. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
  59. package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
  60. package/src/modeller/property-sidebar/styles/styles.ts +0 -577
  61. package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
  62. package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
  63. package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
  64. package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
  65. package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
  66. package/src/ox-board-component-info.ts +0 -236
  67. package/src/ox-board-list.ts +0 -401
  68. package/src/ox-board-modeller.ts +0 -408
  69. package/src/ox-board-player-style.ts +0 -200
  70. package/src/ox-board-player.ts +0 -333
  71. package/src/ox-board-template-list.ts +0 -267
  72. package/src/ox-board-template-viewer.ts +0 -198
  73. package/src/ox-board-viewer.ts +0 -727
  74. package/src/ox-editor-board-selector.ts +0 -91
  75. package/src/ox-property-editor-board-selector.ts +0 -23
  76. package/src/player/ox-board-player-carousel.ts +0 -197
  77. package/src/player/ox-board-player-grid.ts +0 -78
  78. package/src/player/ox-board-wrapper.ts +0 -152
  79. package/src/selector/board-creation-popup.ts +0 -151
  80. package/src/selector/board-thumbnail-card.ts +0 -175
  81. package/src/selector/ox-board-creation-card.ts +0 -98
  82. package/src/selector/ox-board-selector.ts +0 -382
  83. package/src/types.ts +0 -63
  84. package/stories/property-data-binding.stories.ts +0 -34
  85. package/tsconfig.json +0 -24
  86. package/web-dev-server.config.mjs +0 -30
  87. package/web-test-runner.config.mjs +0 -29
@@ -1,432 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/input/ox-input-angle.js'
6
- import '@operato/input/ox-buttons-radio.js'
7
- import '@material/web/icon/icon.js'
8
- import '@operato/i18n/ox-i18n.js'
9
- import '@operato/help/ox-title-with-help.js'
10
-
11
- import { css, html } from 'lit'
12
- import { property, state } from 'lit/decorators.js'
13
- import { keyed } from 'lit/directives/keyed.js'
14
-
15
- import { BOUNDS, Component, Properties } from '@hatiolab/things-scene'
16
-
17
- import { AbstractProperty } from '../abstract-property'
18
- import { PropertySharedStyle } from '../property-shared-style'
19
- import { BoxPaddingEditorStyles } from './box-padding-editor-styles'
20
-
21
- export class PropertyShapes extends AbstractProperty {
22
- static styles = [
23
- PropertySharedStyle,
24
- BoxPaddingEditorStyles,
25
- css`
26
- fieldset[collapsable] legend {
27
- box-sizing: border-box;
28
- width: 100%;
29
- }
30
-
31
- fieldset[collapsable] legend md-icon {
32
- float: right;
33
- font-size: medium;
34
- margin: 0;
35
- cursor: pointer;
36
- }
37
-
38
- fieldset[collapsable][collapsed] > :not(legend) {
39
- display: none;
40
- }
41
- `,
42
- css`
43
- .icon-label label {
44
- background: var(--url-icon-properties-label) 7px -900px no-repeat;
45
- }
46
-
47
- .icon-label label.width {
48
- background-position: 7px -96px;
49
- }
50
-
51
- .icon-label label.height {
52
- background-position: 7px 4px;
53
- }
54
-
55
- .icon-label label.rotate {
56
- background-position: 7px -198px;
57
- }
58
-
59
- .icon-label label.twidth {
60
- background-position: 7px -296px;
61
- }
62
-
63
- .icon-label label.theight {
64
- background-position: 7px -396px;
65
- }
66
-
67
- .icon-label label.zPos {
68
- background-position: 5px -1098px;
69
- }
70
-
71
- .icon-label label.depth {
72
- background-position: 5px -1198px;
73
- }
74
-
75
- .icon-label label.rotationX {
76
- background-position: 5px -1296px;
77
- }
78
-
79
- .icon-label label.rotationY {
80
- background-position: 5px -1396px;
81
- }
82
-
83
- .icon-label label.rotationZ {
84
- background-position: 5px -1496px;
85
- }
86
-
87
- ox-buttons-radio > * {
88
- width: 30px;
89
- height: 25px;
90
- min-width: initial;
91
- margin: 0 4px 0 0;
92
- padding: 0;
93
- border-radius: 0;
94
- display: inline-block;
95
- border-bottom: 2px solid #fff;
96
- }
97
-
98
- ox-buttons-radio div {
99
- background: var(--url-icon-properties) no-repeat;
100
- }
101
-
102
- ox-buttons-radio div[data-value='left'] {
103
- background-position: 50% 3px;
104
- }
105
-
106
- ox-buttons-radio div[data-value='center'] {
107
- background-position: 50% -47px;
108
- }
109
-
110
- ox-buttons-radio div[data-value='right'] {
111
- background-position: 50% -97px;
112
- }
113
-
114
- ox-buttons-radio div[data-value='justify'] {
115
- background-position: 50% -147px;
116
- }
117
-
118
- ox-buttons-radio div[data-value='top'] {
119
- background-position: 50% -197px;
120
- }
121
-
122
- ox-buttons-radio div[data-value='middle'] {
123
- background-position: 50% -193px;
124
- }
125
-
126
- ox-buttons-radio div[data-value='bottom'] {
127
- background-position: 50% -188px;
128
- }
129
-
130
- ox-buttons-radio div[active] {
131
- border-color: #f2471c;
132
- }
133
- `
134
- ]
135
-
136
- @property({ type: Object }) value?: Properties
137
- @property({ type: Object }) bounds: BOUNDS | null = null
138
- @property({ type: Array }) selected: Component[] = []
139
-
140
- @state() private _3dExpanded: boolean = false
141
-
142
- firstUpdated() {
143
- this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
144
- }
145
-
146
- render() {
147
- const value = this.value || {}
148
- const { width, height } = this.bounds || {}
149
-
150
- return html`
151
- <fieldset>
152
- <div class="property-grid">
153
- ${this._isIdentifiable(this.selected)
154
- ? html`
155
- <label> <ox-i18n msgid="label.id">ID</ox-i18n> </label>
156
- <input value-key="id" .value=${value.id || ''} />
157
- `
158
- : html``}
159
- ${this._isClassIdentifiable(this.selected)
160
- ? html`
161
- <label> <ox-i18n msgid="label.class">Class</ox-i18n> </label>
162
- <input value-key="class" .value=${value.class || ''} />
163
- `
164
- : html``}
165
- ${this._hasTextProperty(this.selected)
166
- ? html`
167
- <label> <ox-i18n msgid="label.text">Text</ox-i18n> </label>
168
- <input value-key="text" .value=${value.text || ''} />
169
- <label> <ox-i18n msgid="label.text-format">Text Format</ox-i18n> </label>
170
- <input value-key="textFormat" .value=${value.textFormat || ''} list="format-list" />
171
- <datalist id="format-list">
172
- <option value="#,###."></option>
173
- <option value="#,###.#"></option>
174
- <option value="#,###.0"></option>
175
- <option value="#,##0.#"></option>
176
- <option value="#,##0.0"></option>
177
- <option value="#,##0.0%"></option>
178
- </datalist>
179
- `
180
- : html``}
181
- ${this._hasProperties(this.selected)
182
- ? html`
183
- <div class="checkbox-row">
184
- <input id="checkbox-hidden" value-key="hidden" type="checkbox" .checked=${value.hidden} />
185
- <label for="checkbox-hidden"> <ox-i18n msgid="label.item-hidden">Item Hidden</ox-i18n> </label>
186
-
187
- <input id="checkbox-locked" value-key="locked" type="checkbox" .checked=${value.locked} />
188
- <label for="checkbox-locked"> <ox-i18n msgid="label.locked">Locked</ox-i18n> </label>
189
- </div>
190
- `
191
- : html``}
192
- </div>
193
- </fieldset>
194
-
195
- ${!this._isLine(this.selected)
196
- ? keyed(
197
- this.selected,
198
- html`
199
- <fieldset class="icon-label unit ratio">
200
- <legend>
201
- <ox-title-with-help topic="board-modeller/shapes/size" msgid="label.size">size</ox-title-with-help>
202
- </legend>
203
-
204
- <div class="property-grid">
205
- <label class="width"> <ox-i18n msgid="label.width">width</ox-i18n> </label>
206
- <input type="number" value-key="bounds.width" .value=${String(width)} />
207
- <label class="height"> <ox-i18n msgid="label.height">height</ox-i18n> </label>
208
- <input type="number" value-key="bounds.height" .value=${String(height)} />
209
-
210
- ${this.selected.length && this.selected[0].isRootModel()
211
- ? html``
212
- : html`
213
- <label class="rotate"> <ox-i18n msgid="label.rotate">rotate</ox-i18n> </label>
214
- <ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
215
- `}
216
- </div>
217
- </fieldset>
218
- `
219
- )
220
- : html``}
221
- ${this._is3dish(this.selected)
222
- ? html`
223
- <fieldset class="icon-label unit ratio" collapsable ?collapsed=${!this._3dExpanded}>
224
- <legend>
225
- <ox-title-with-help topic="board-modeller/shapes/3dish" msgid="label.3dish">3D</ox-title-with-help>
226
- <md-icon
227
- @click=${(e: Event) => {
228
- this._3dExpanded = !this._3dExpanded
229
- }}
230
- >${this._3dExpanded ? 'expand_less' : 'expand_more'}</md-icon
231
- >
232
- </legend>
233
-
234
- <div class="property-grid">
235
- <label class="zPos"> <ox-i18n msgid="label.z-pos">pos. Z</ox-i18n> </label>
236
- <input type="number" value-key="zPos" .value=${value.zPos} />
237
- <label class="depth"> <ox-i18n msgid="label.depth">depth</ox-i18n> </label>
238
- <input type="number" value-key="depth" .value=${value.depth} />
239
-
240
- <label class="rotationX"> <ox-i18n msgid="label.rotation-x">rot. X</ox-i18n> </label>
241
- <ox-input-angle value-key="rotationX" .value=${value.rotationX}> </ox-input-angle>
242
-
243
- <label class="rotationY"> <ox-i18n msgid="label.rotation-y">rot. Y</ox-i18n> </label>
244
- <ox-input-angle value-key="rotationY" .value=${value.rotationY}> </ox-input-angle>
245
-
246
- <label class="rotationZ"> <ox-i18n msgid="label.rotation-z">rot. Z</ox-i18n> </label>
247
- <ox-input-angle value-key="rotation" .value=${value.rotation}> </ox-input-angle>
248
- </div>
249
- </fieldset>
250
- `
251
- : html``}
252
- ${this._hasTextProperty(this.selected)
253
- ? html`
254
- <fieldset>
255
- <legend>
256
- <ox-title-with-help topic="board-modeller/shapes/text-box" msgid="label.text-box"
257
- >text box</ox-title-with-help
258
- >
259
- </legend>
260
-
261
- <div class="property-grid">
262
- <label> <ox-i18n msgid="label.horizontal">horizontal</ox-i18n> </label>
263
- <ox-buttons-radio value-key="textAlign" .value=${value.textAlign}>
264
- <div data-value="left"></div>
265
- <div data-value="center"></div>
266
- <div data-value="right"></div>
267
- <div data-value="justify"></div>
268
- </ox-buttons-radio>
269
-
270
- <label> <ox-i18n msgid="label.vertical">vertical</ox-i18n> </label>
271
- <ox-buttons-radio value-key="textBaseline" .value=${value.textBaseline}>
272
- <div data-value="top"></div>
273
- <div data-value="middle"></div>
274
- <div data-value="bottom"></div>
275
- </ox-buttons-radio>
276
-
277
- <div class="checkbox-row">
278
- <input id="checkbox-support-markdown" type="checkbox" value-key="supportMarkdown" .checked=${value.supportMarkdown} />
279
- <label for="checkbox-support-markdown"> <ox-i18n msgid="label.support-markdown">Support Markdown</ox-i18n> </label>
280
- </div>
281
-
282
- <div class="checkbox-row">
283
- <input id="checkbox-textwrap" type="checkbox" value-key="textWrap" .checked=${value.textWrap} />
284
- <label for="checkbox-textwrap"> <ox-i18n msgid="label.text-wrap">Text Wrap</ox-i18n> </label>
285
- </div>
286
-
287
- ${!value.textWrap
288
- ? html` <label for="checkbox-textOverflow">
289
- <ox-i18n msgid="label.text-overflow">Text Overflow</ox-i18n>
290
- </label>
291
- <select value-key="textOverflow" .value=${value.textOverflow || ''}>
292
- <option value="" selected>none</option>
293
- <option value="ellipsis">ellipsis</option>
294
- <option value="clip">clip</option>
295
- </select>`
296
- : ''}
297
-
298
- <label> <ox-i18n msgid="label.padding">padding</ox-i18n> </label>
299
- <table class="box-padding">
300
- <tr>
301
- <td class="slide1"></td>
302
- <td class="slide2"></td>
303
- <td class="slide3"></td>
304
- </tr>
305
- <tr>
306
- <td class="slide4"></td>
307
- <td class="slide5">
308
- <input type="number" value-key="paddingTop" .value=${value.paddingTop || 0} />
309
- <input type="number" value-key="paddingLeft" .value=${value.paddingLeft || 0} />
310
- <input type="number" value-key="paddingRight" .value=${value.paddingRight || 0} />
311
- <input type="number" value-key="paddingBottom" .value=${value.paddingBottom || 0} />
312
- </td>
313
- <td class="slide6"></td>
314
- </tr>
315
- <tr>
316
- <td class="slide7"></td>
317
- <td class="slide8"></td>
318
- <td class="slide9"></td>
319
- </tr>
320
- </table>
321
- </div>
322
- </fieldset>
323
- `
324
- : html``}
325
- ${this.selected.length && this.selected[0].isRootModel()
326
- ? html`
327
- <fieldset class="icon-label">
328
- <legend>
329
- <ox-title-with-help topic="board-modeller/shapes/viewer-option" msgid="label.viewer-option"
330
- >Viewer Option</ox-title-with-help
331
- >
332
- </legend>
333
-
334
- <div class="property-grid">
335
- <label><ox-i18n msgid="label.fit">Fit</ox-i18n></label>
336
- <select value-key="fitMode" .value=${value.fitMode || 'ratio'}>
337
- <option value="none">none</option>
338
- <option value="center">center</option>
339
- <option value="ratio" selected>ratio</option>
340
- <option value="both">both</option>
341
- <option value="width">width</option>
342
- <option value="height">height</option>
343
- </select>
344
- </div>
345
- </fieldset>
346
- <fieldset class="icon-label">
347
- <legend>
348
- <ox-title-with-help topic="board-modeller/shapes/print-option" msgid="label.label-print"
349
- >Print Option</ox-title-with-help
350
- >
351
- </legend>
352
-
353
- <div class="property-grid">
354
- <label class="rotate"><ox-i18n msgid="label.label-rotation">Label Rotation</ox-i18n></label>
355
- <select value-key="labelRotation" .value=${value.labelRotation || 'N'}>
356
- <option value="N" selected>0°</option>
357
- <option value="B">90°</option>
358
- <option value="I">180°</option>
359
- <option value="R">270°</option>
360
- </select>
361
- </div>
362
- </fieldset>
363
- `
364
- : html``}
365
- `
366
- }
367
-
368
- _onValueChange(e: Event) {
369
- var element = e.target as HTMLElement
370
- var key = element.getAttribute('value-key')
371
-
372
- if (!key) {
373
- return
374
- }
375
-
376
- var value = this._getValueFromEventTarget(element)
377
-
378
- if (key.indexOf('bounds.') == 0) {
379
- if (isNaN(value)) return
380
- this.dispatchEvent(
381
- new CustomEvent('bounds-change', {
382
- bubbles: true,
383
- composed: true,
384
- detail: {
385
- [key.substr(7)]: value
386
- }
387
- })
388
- )
389
- } else {
390
- this._onAfterValueChange(key, value)
391
- }
392
- }
393
-
394
- _hasTextProperty(selected: Component[]) {
395
- for (let i = 0; i < selected.length; i++) {
396
- if (!selected[i].hasTextProperty) return false
397
- }
398
-
399
- return true
400
- }
401
-
402
- _hasProperties(selected: Component[]) {
403
- if (!selected || selected.length == 0 || (selected[0] && selected[0].isLayer && selected[0].isLayer())) return false
404
-
405
- return true
406
- }
407
-
408
- _isIdentifiable(selected: Component[]) {
409
- if (!selected || selected.length == 0 || selected.length > 1 || (selected[0].isLayer && selected[0].isLayer()))
410
- return false
411
-
412
- return true
413
- }
414
-
415
- _isClassIdentifiable(selected: Component[]) {
416
- if (!selected || (selected[0] && selected[0].isLayer())) return false
417
-
418
- return true
419
- }
420
-
421
- _isLine(selected: Component[]) {
422
- if (!selected || !(selected[0] && selected[0].isLine())) return false
423
-
424
- return true
425
- }
426
-
427
- _is3dish(selected: Component[]) {
428
- if (!selected || !(selected[0] && selected[0].is3dish())) return false
429
-
430
- return true
431
- }
432
- }
@@ -1,152 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/app/property-editor.js' /* for registering property editors */
6
-
7
- import { html, LitElement, PropertyValues } from 'lit'
8
- import { property } from 'lit/decorators.js'
9
-
10
- import { Properties } from '@hatiolab/things-scene'
11
- import { OxPropertyEditor, PropertySpec } from '@operato/property-editor'
12
-
13
- /**
14
- 모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
15
-
16
- Example:
17
-
18
- <specific-properties-builder value="{{value}}">
19
- <label>Center X</label>
20
- <input type="number" .value="${value.cx}">
21
- <label>Width</label>
22
- <input type="number" .value="${value.width}">
23
- </specific-properties-builder>
24
- */
25
-
26
- const DEFAULT_VALUE = {
27
- legend: '',
28
- // number: 0, // should be undefined
29
- angle: 0,
30
- string: '',
31
- password: '',
32
- textarea: '',
33
- checkbox: false,
34
- select: '',
35
- color: '#000000',
36
- 'solidcolor-stops': null,
37
- 'gradientcolor-stops': null,
38
- 'gltf-selector': '',
39
- 'image-selector': '',
40
- multiplecolor: null,
41
- editortable: null,
42
- imageselector: '',
43
- options: null,
44
- date: null
45
- }
46
-
47
- function convertValue(type: string, value: any) {
48
- var converted = String(value).trim() == '' ? undefined : value
49
- switch (type) {
50
- case 'number':
51
- case 'angle':
52
- converted = parseFloat(value)
53
- converted = isNaN(converted) ? undefined : converted
54
- break
55
- }
56
-
57
- return converted
58
- }
59
-
60
- export class SpecificPropertiesBuilder extends LitElement {
61
- @property({ type: Object }) value: any
62
- @property({ type: Array }) props: any[] = []
63
- @property({ type: Object }) propertyEditor: any
64
-
65
- render() {
66
- return html`<slot></slot>`
67
- }
68
-
69
- firstUpdated() {
70
- this.addEventListener('change', this._onValueChanged.bind(this))
71
- }
72
-
73
- updated(changes: PropertyValues<this>) {
74
- changes.has('props') && this._onPropsChanged(this.props)
75
- changes.has('value') && this._setValues()
76
- }
77
-
78
- _onPropsChanged(props: any[]) {
79
- this.textContent = ''
80
- ;(props || []).forEach((spec: PropertySpec) => {
81
- const { label, type, placeholder, name, observe, property, editor, quantifier, defaultValue, disabled } = spec
82
-
83
- let elementType = OxPropertyEditor.getEditor(type)
84
- if (!elementType) {
85
- console.warn('Property Editor not defined', type)
86
- return
87
- }
88
- let element = document.createElement(elementType) as OxPropertyEditor
89
-
90
- element.label = label
91
- element.type = type
92
- element.placeholder = placeholder
93
- element.name = name
94
- element.setAttribute('name', name)
95
-
96
- if (observe) {
97
- element.observeHandler = observe
98
- }
99
- element.property = property
100
- element.editor = editor
101
- element.quantifier = quantifier
102
- element.defaultValue = defaultValue
103
- element.setAttribute('property-editor', 'true')
104
- element.disabled = disabled
105
-
106
- this.appendChild(element)
107
- })
108
- }
109
-
110
- _setValues() {
111
- this.value &&
112
- Array.from(this.querySelectorAll('[name]')).forEach((prop: Properties) => {
113
- let name = prop.getAttribute('name')
114
- if (!name) {
115
- return
116
- }
117
- var convertedValue = convertValue(prop.type, this.value[name])
118
- if (convertedValue === undefined) {
119
- convertedValue = (DEFAULT_VALUE as any)[prop.type]
120
- }
121
- prop.value = convertedValue
122
- prop.observe.call(prop, prop.value)
123
- })
124
- }
125
-
126
- _onValueChanged(e: Event) {
127
- e.stopPropagation()
128
- var target = e.target as Element
129
-
130
- const prop = target.closest('[property-editor]') as OxPropertyEditor
131
-
132
- var name = prop.getAttribute('name')
133
- if (!name) {
134
- return
135
- }
136
-
137
- this.value[name] = prop.value
138
-
139
- prop.observe(prop.value)
140
- this._setValues()
141
-
142
- this.dispatchEvent(
143
- new CustomEvent('property-change', {
144
- bubbles: true,
145
- composed: true,
146
- detail: {
147
- [name]: prop.value
148
- }
149
- })
150
- )
151
- }
152
- }
@@ -1,81 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/help/ox-help-icon.js'
6
-
7
- import { css, html, LitElement } from 'lit'
8
- import { property } from 'lit/decorators.js'
9
-
10
- import { Component, Scene } from '@hatiolab/things-scene'
11
- import { ScopedElementsMixin } from '@open-wc/scoped-elements'
12
-
13
- import { i18next } from '@operato/i18n'
14
-
15
- import { PropertySharedStyle } from '../property-shared-style'
16
- import { SpecificPropertiesBuilder } from './specific-properties-builder.js'
17
-
18
- export class PropertySpecific extends ScopedElementsMixin(LitElement) {
19
- static styles = [
20
- PropertySharedStyle,
21
- css`
22
- label {
23
- display: block;
24
- margin: 10px;
25
-
26
- text-align: right;
27
- font: bold 14px var(--theme-font);
28
- color: var(--md-sys-color-on-primary-container);
29
- text-transform: capitalize;
30
- }
31
- `
32
- ]
33
-
34
- @property({ type: Object }) value: any
35
- @property({ type: Object }) scene: Scene | null = null
36
- @property({ type: Array }) selected: Component[] = []
37
- @property({ type: Array }) props: any[] = []
38
- @property({ type: Array }) propertyEditor: any[] = []
39
-
40
- private boundINeedSelected: any = this._onINeedSelected.bind(this)
41
-
42
- connectedCallback() {
43
- super.connectedCallback()
44
-
45
- this.addEventListener('i-need-selected', this.boundINeedSelected)
46
- }
47
-
48
- disconnectedCallback() {
49
- super.disconnectedCallback()
50
-
51
- this.removeEventListener('i-need-selected', this.boundINeedSelected)
52
- }
53
- static get scopedElements() {
54
- return {
55
- 'specific-properties-builder': SpecificPropertiesBuilder
56
- }
57
- }
58
- render() {
59
- const selected = this.selected && this.selected[0]
60
- const value = this.value || {}
61
-
62
- return html`
63
- <label
64
- >${i18next.t(`component.${value.type}`)}<ox-help-icon .topic=${selected?.nature?.help}></ox-help-icon
65
- ></label>
66
-
67
- <specific-properties-builder .value=${value} .props=${this.props} .propertyEditor=${this.propertyEditor}>
68
- </specific-properties-builder>
69
- `
70
- }
71
-
72
- _onINeedSelected(e: CustomEvent) {
73
- e.stopPropagation()
74
-
75
- var { callback } = e.detail
76
-
77
- this.scene!.undoableChange(() => {
78
- callback.call(null, this.selected)
79
- })
80
- }
81
- }