@operato/board 8.0.0-beta.0 → 8.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +14 -14
  3. package/.storybook/main.js +0 -3
  4. package/.storybook/server.mjs +0 -8
  5. package/src/component/3d.ts +0 -29
  6. package/src/component/chart-and-gauge.ts +0 -28
  7. package/src/component/container.ts +0 -63
  8. package/src/component/data-source.ts +0 -30
  9. package/src/component/etc.ts +0 -88
  10. package/src/component/form.ts +0 -42
  11. package/src/component/index.ts +0 -12
  12. package/src/component/iot.ts +0 -52
  13. package/src/component/line.ts +0 -156
  14. package/src/component/register-default-groups.ts +0 -28
  15. package/src/component/shape.ts +0 -156
  16. package/src/component/table.ts +0 -28
  17. package/src/component/text-and-media.ts +0 -125
  18. package/src/component/warehouse.ts +0 -26
  19. package/src/data-storage/data-storage.ts +0 -76
  20. package/src/graphql/board.ts +0 -144
  21. package/src/graphql/data-subscription.ts +0 -30
  22. package/src/graphql/favorite-board.ts +0 -25
  23. package/src/graphql/group.ts +0 -138
  24. package/src/graphql/index.ts +0 -4
  25. package/src/graphql/play-group.ts +0 -225
  26. package/src/graphql/scenario.ts +0 -79
  27. package/src/index.ts +0 -10
  28. package/src/modeller/component-toolbar/component-detail.ts +0 -52
  29. package/src/modeller/component-toolbar/component-menu.ts +0 -196
  30. package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
  31. package/src/modeller/component-toolbar/mode-icons.ts +0 -88
  32. package/src/modeller/edit-toolbar-style.ts +0 -232
  33. package/src/modeller/edit-toolbar.ts +0 -587
  34. package/src/modeller/property-sidebar/abstract-property.ts +0 -69
  35. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
  36. package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
  37. package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
  38. package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
  39. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
  40. package/src/modeller/property-sidebar/effects/effects.ts +0 -69
  41. package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
  42. package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
  43. package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
  44. package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
  45. package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
  46. package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
  47. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
  48. package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
  49. package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
  50. package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
  51. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
  52. package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
  53. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
  54. package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
  55. package/src/modeller/property-sidebar/styles/styles.ts +0 -577
  56. package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
  57. package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
  58. package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
  59. package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
  60. package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
  61. package/src/ox-board-component-info.ts +0 -236
  62. package/src/ox-board-list.ts +0 -401
  63. package/src/ox-board-modeller.ts +0 -408
  64. package/src/ox-board-player-style.ts +0 -200
  65. package/src/ox-board-player.ts +0 -333
  66. package/src/ox-board-template-list.ts +0 -267
  67. package/src/ox-board-template-viewer.ts +0 -198
  68. package/src/ox-board-viewer.ts +0 -727
  69. package/src/ox-editor-board-selector.ts +0 -91
  70. package/src/ox-property-editor-board-selector.ts +0 -23
  71. package/src/player/ox-board-player-carousel.ts +0 -197
  72. package/src/player/ox-board-player-grid.ts +0 -78
  73. package/src/player/ox-board-wrapper.ts +0 -152
  74. package/src/selector/board-creation-popup.ts +0 -151
  75. package/src/selector/board-thumbnail-card.ts +0 -175
  76. package/src/selector/ox-board-creation-card.ts +0 -98
  77. package/src/selector/ox-board-selector.ts +0 -382
  78. package/src/types.ts +0 -63
  79. package/stories/property-data-binding.stories.ts +0 -34
  80. package/tsconfig.json +0 -24
  81. package/web-dev-server.config.mjs +0 -30
  82. package/web-test-runner.config.mjs +0 -29
@@ -1,475 +0,0 @@
1
- /**
2
- * @license Copyright © HatioLab Inc. All rights reserved.
3
- */
4
-
5
- import '@operato/input/ox-buttons-radio.js'
6
- import '@operato/input/ox-input-code.js'
7
- import '@operato/i18n/ox-i18n.js'
8
- import '@operato/help/ox-help-icon.js'
9
- import './data-binding-value-map.js'
10
- import './data-binding-value-range.js'
11
-
12
- import { css, html, LitElement, PropertyValues } from 'lit'
13
- import { property, query, state } from 'lit/decorators.js'
14
-
15
- import { Properties, Scene } from '@hatiolab/things-scene'
16
-
17
- export type Rule =
18
- | {
19
- map?: Properties
20
- range?: Properties[]
21
- eval?: string
22
- }
23
- | any
24
-
25
- export type Mapping = {
26
- source?: string
27
- rule: 'map' | 'range' | 'eval' | 'value'
28
- accessor?: string
29
- target?: string
30
- property?: string
31
- param?: Rule
32
- ndnsp?: boolean
33
- partial?: boolean
34
- }
35
-
36
- /**
37
- element for mapping data value editing
38
-
39
- Example:
40
-
41
- <data-binding-mapper mapping=${mapping}>
42
- </data-binding-mapper>
43
- */
44
-
45
- export class DataBindingMapper extends LitElement {
46
- static styles = [
47
- css`
48
- :host {
49
- background-color: var(--md-sys-color-surface);
50
- color: var(--md-sys-color-on-surface);
51
- overflow: hidden;
52
- padding: 7px 0 0 0;
53
- border: 1px solid rgba(0, 0, 0, 0.2);
54
- border-width: 0 1px 1px 1px;
55
- padding: 4px;
56
- line-height: 2;
57
-
58
- display: grid;
59
- grid-template-columns: repeat(10, 1fr);
60
- grid-gap: 4px;
61
- grid-auto-rows: minmax(24px, auto);
62
-
63
- align-items: center;
64
- }
65
-
66
- :host > * {
67
- align-self: stretch;
68
- }
69
-
70
- label {
71
- grid-column: span 3;
72
- text-align: right;
73
- text-transform: capitalize;
74
- }
75
-
76
- input,
77
- select,
78
- ox-buttons-radio,
79
- [mapping-rule] {
80
- grid-column: span 7;
81
- }
82
- input,
83
- select {
84
- border: var(--property-sidebar-fieldset-border);
85
- }
86
-
87
- ox-buttons-radio {
88
- display: flex;
89
- padding: 0 4px;
90
- }
91
-
92
- ox-buttons-radio > * {
93
- text-align: center;
94
- flex: 1;
95
- margin: 2px;
96
- border-bottom: 2px solid #fff;
97
- }
98
-
99
- ox-buttons-radio div[active] {
100
- border-color: #f2471c;
101
- }
102
-
103
- select {
104
- height: 22px;
105
- }
106
-
107
- [mapping-rule] {
108
- display: flex;
109
- }
110
-
111
- [mapping-rule] * {
112
- flex: auto;
113
- margin: 0;
114
- text-align: left;
115
- align-self: center;
116
- }
117
-
118
- [rule-editors] {
119
- grid-column: span 10;
120
-
121
- display: 'flex';
122
- align-content: auto;
123
- }
124
-
125
- [rule-editors] :not([active]) {
126
- display: none;
127
- }
128
-
129
- ox-input-code {
130
- height: 300px;
131
- overflow: auto;
132
- }
133
-
134
- /* checkbox-row */
135
- .checkbox-row {
136
- grid-column: span 10;
137
-
138
- display: grid;
139
- grid-template-columns: repeat(10, 1fr);
140
- grid-gap: 5px;
141
- grid-auto-rows: minmax(24px, auto);
142
- align-items: center;
143
- }
144
-
145
- .checkbox-row > input {
146
- grid-column: 4 / 5;
147
- }
148
-
149
- .checkbox-row > label {
150
- grid-column: span 6;
151
- text-align: left;
152
- }
153
- `
154
- ]
155
-
156
- @property({ type: Object }) mapping: Mapping = {
157
- rule: 'value'
158
- }
159
- @property({ type: Object }) rule: Rule = {}
160
- @property({ type: Array }) properties: Properties[] = []
161
- @property({ type: Object }) scene?: Scene
162
-
163
- @state() _valueTypes: any = {
164
- play: 'boolean',
165
- hidden: 'boolean',
166
- started: 'boolean',
167
-
168
- rotation: 'number',
169
- value: 'number',
170
-
171
- fillStyle: 'color',
172
- strokeStyle: 'color',
173
- fontColor: 'color',
174
-
175
- data: 'object',
176
- source: 'attachment',
177
- location: 'object',
178
- dimension: 'object',
179
-
180
- text: 'string',
181
- ref: 'string'
182
- }
183
- @state() _componentIds: { value: string; description: string }[] = []
184
-
185
- @query('#eval-editor') editor!: HTMLInputElement
186
- @query('#source-input') source!: HTMLInputElement
187
- @query('#target-input') target!: HTMLInputElement
188
-
189
- firstUpdated() {
190
- this.renderRoot.addEventListener('change', e => this._onChange(e))
191
- }
192
-
193
- updated(changes: PropertyValues<this>) {
194
- changes.has('mapping') && this._onChangedMapping()
195
- }
196
-
197
- findComponentIds() {
198
- this._componentIds =
199
- (this.scene &&
200
- this.scene.ids.map(i => {
201
- const id = i.key
202
- return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
203
- })) ||
204
- []
205
- }
206
-
207
- render() {
208
- const mapping = this.mapping || {
209
- rule: 'value'
210
- }
211
-
212
- return html`
213
- <label for="source-input"> <ox-i18n msgid="label.source">source</ox-i18n> </label>
214
- <input
215
- id="source-input"
216
- type="text"
217
- value-key="source"
218
- list="source-list"
219
- .value=${mapping.source || ''}
220
- @focusin=${() => this.findComponentIds()}
221
- />
222
-
223
- <label for="accessor-input">
224
- <ox-i18n msgid="label.accessor">accessor</ox-i18n><ox-help-icon topic="board-modeller/accessor"></ox-help-icon>
225
- </label>
226
- <input
227
- id="accessor-input"
228
- value-key="accessor"
229
- type="text"
230
- data-mapping-accessor
231
- .value=${mapping.accessor || ''}
232
- />
233
-
234
- <label for="target-input"> <ox-i18n msgid="label.target">target</ox-i18n> </label>
235
- <input
236
- id="target-input"
237
- type="text"
238
- value-key="target"
239
- list="target-list"
240
- .value=${mapping.target || ''}
241
- @focusin=${() => this.findComponentIds()}
242
- />
243
-
244
- <datalist id="source-list">
245
- <option value="(self)"></option>
246
- ${this._componentIds.length
247
- ? html`
248
- ${this._componentIds.map(
249
- ({ value, description }) => html` <option value=${value}>${description}</option> `
250
- )}
251
- `
252
- : html``}
253
- </datalist>
254
-
255
- <datalist id="target-list">
256
- <option value="(self)"></option>
257
- <option value="(children)"></option>
258
- <option value="(key)"></option>
259
- <option value="[propkey]"></option>
260
- ${this._componentIds.length
261
- ? html`
262
- ${this._componentIds.map(
263
- ({ value, description }) => html` <option value=${value}>${description}</option> `
264
- )}
265
- `
266
- : html``}
267
- </datalist>
268
-
269
- <label for="property-input">
270
- <ox-i18n msgid="label.property">property</ox-i18n
271
- ><ox-help-icon topic="board-modeller/data-binding-property"></ox-help-icon
272
- ></label>
273
- <select id="property-input" value-key="property" .value=${mapping.property || ''}>
274
- ${this.properties.map(
275
- item => html` <option .value=${item.name} ?selected=${item.name == mapping.property}>${item.label}</option> `
276
- )}
277
- </select>
278
-
279
- <label> <ox-i18n msgid="label.rule-type">rule type</ox-i18n> </label>
280
- <ox-buttons-radio .value=${mapping.rule} @change=${(e: Event) => this._onChangeRule(e)}>
281
- <div data-value="value"><ox-i18n msgid="label.value"></ox-i18n></div>
282
- <div data-value="map"><ox-i18n msgid="label.map"></ox-i18n></div>
283
- <div data-value="range"><ox-i18n msgid="label.range"></ox-i18n></div>
284
- <div data-value="eval"><ox-i18n msgid="label.eval"></ox-i18n></div>
285
- </ox-buttons-radio>
286
-
287
- <div rule-editors ?hidden=${mapping.rule == 'value'}>
288
- <data-binding-value-map
289
- value-key="map"
290
- .value=${this.rule.map || {}}
291
- .valuetype=${this._valuetype(mapping.property!)}
292
- ?active=${mapping.rule == 'map'}
293
- >
294
- </data-binding-value-map>
295
-
296
- <data-binding-value-range
297
- value-key="range"
298
- .value=${this.rule.range || []}
299
- .valuetype=${this._valuetype(mapping.property!)}
300
- ?active=${mapping.rule == 'range'}
301
- >
302
- </data-binding-value-range>
303
-
304
- <ox-input-code
305
- value-key="eval"
306
- id="eval-editor"
307
- .value=${this.rule.eval || ''}
308
- ?active=${mapping.rule == 'eval'}
309
- language="javascript"
310
- >
311
- </ox-input-code>
312
- </div>
313
-
314
- <div class="checkbox-row">
315
- <input id="checkbox-partial" type="checkbox" value-key="partial" .checked=${mapping.partial === true} />
316
- <label for="checkbox-partial"> <ox-i18n msgid="label.partial-spreading">Partial Spreading</ox-i18n> </label>
317
- </div>
318
-
319
- <div class="checkbox-row">
320
- <input id="checkbox-ndnsp" type="checkbox" value-key="ndnsp" .checked=${mapping.ndnsp === true} />
321
- <label for="checkbox-ndnsp"> <ox-i18n msgid="label.ndnsp">No Data No Spreading</ox-i18n> </label>
322
- </div>
323
- `
324
- }
325
-
326
- _valuetype(property: string) {
327
- return this._valueTypes[property] || 'string'
328
- }
329
-
330
- private _keep_saved_rule_params: boolean = false
331
-
332
- async _onChangedMapping() {
333
- if (this._keep_saved_rule_params) {
334
- this._keep_saved_rule_params = false
335
- } else {
336
- await this.updateComplete
337
-
338
- var rule: Rule = {}
339
-
340
- if (this.mapping) {
341
- switch (this.mapping.rule) {
342
- case 'map':
343
- rule.map = this.mapping.param || {}
344
- break
345
- case 'range':
346
- rule.range = this.mapping.param || []
347
- break
348
- case 'eval':
349
- rule.eval = this.mapping.param || ''
350
- break
351
- default:
352
- this.mapping.rule = 'value'
353
- break
354
- }
355
- }
356
-
357
- this.rule = rule
358
- this.requestUpdate()
359
- }
360
- }
361
-
362
- _onChangeRule(e: Event) {
363
- var element = e.target as HTMLInputElement
364
- var value = element.value
365
-
366
- let param
367
-
368
- switch (value) {
369
- case 'map':
370
- param = this.rule.map
371
- break
372
- case 'range':
373
- param = this.rule.range
374
- break
375
- case 'eval':
376
- param = this.rule.eval || ''
377
-
378
- // rule.eval에 값이 없을 때, ace-editor 내용이 초기화되지 않는 문제때문에 처리함.
379
- if (!param) {
380
- this.editor.value = 'return'
381
- }
382
- break
383
- default:
384
- }
385
-
386
- this.mapping = {
387
- ...this.mapping,
388
- rule: value as 'value' | 'map' | 'range' | 'eval',
389
- param
390
- }
391
-
392
- this._keep_saved_rule_params = true
393
- this.dispatchEvent(new CustomEvent('value-change', { bubbles: true, composed: true }))
394
- }
395
-
396
- _onChange(e: Event) {
397
- var element = e.target as HTMLInputElement
398
- var key = element.getAttribute('value-key')
399
-
400
- if (!key) return
401
-
402
- var value: string | boolean = element.value
403
-
404
- if (key === 'source') {
405
- if (value.length > 0) {
406
- value = value.trim()
407
-
408
- this.source.value = value
409
- }
410
-
411
- this.mapping = {
412
- ...this.mapping,
413
- source: value
414
- }
415
- } else if (key === 'target') {
416
- if (value.length > 0 && !/^[.#(\[]/.test(value)) {
417
- value = '#' + value.trim()
418
-
419
- this.target.value = value
420
- }
421
-
422
- this.mapping = {
423
- ...this.mapping,
424
- target: value
425
- }
426
- } else if (key === 'accessor') {
427
- this.mapping = {
428
- ...this.mapping,
429
- accessor: (value || '').trim()
430
- }
431
- } else if (key === 'property') {
432
- this.mapping = {
433
- ...this.mapping,
434
- property: (value || '').trim()
435
- }
436
- } else if (key === 'map' || key === 'range' || key === 'eval') {
437
- this.rule[key] = value
438
- this.mapping = {
439
- ...this.mapping,
440
- param: value
441
- }
442
- } else if (key === 'ndnsp' /* no data no spreading */) {
443
- value = element.checked
444
-
445
- this.mapping = {
446
- ...this.mapping,
447
- ndnsp: value
448
- }
449
- } else if (key === 'partial' /* partial spreading */) {
450
- value = element.checked
451
-
452
- this.mapping = {
453
- ...this.mapping,
454
- partial: value
455
- }
456
- }
457
-
458
- if (!this.mapping.rule) {
459
- this.mapping.rule = 'value'
460
- }
461
-
462
- this._keep_saved_rule_params = true
463
- this.dispatchEvent(
464
- new CustomEvent('value-change', {
465
- bubbles: true,
466
- composed: true,
467
- detail: {
468
- changed: {
469
- [key]: value
470
- }
471
- }
472
- })
473
- )
474
- }
475
- }
@@ -1,19 +0,0 @@
1
- import { html } from 'lit'
2
- import { customElement } from 'lit/decorators.js'
3
- import { ifDefined } from 'lit/directives/if-defined.js'
4
-
5
- import { OxInputValueMap } from '@operato/input'
6
-
7
- import '@operato/attachment/ox-attachment-selector.js'
8
-
9
- @customElement('data-binding-value-map')
10
- export class DataBindingValueMap extends OxInputValueMap {
11
- static styles = OxInputValueMap.styles
12
-
13
- valueInputTemplate(value?: any) {
14
- if (this.valuetype == 'attachment') {
15
- return html`<ox-attachment-selector data-value value=${ifDefined(value)}></ox-attachment-selector>`
16
- }
17
- return super.valueInputTemplate(value)
18
- }
19
- }
@@ -1,19 +0,0 @@
1
- import { html } from 'lit'
2
- import { customElement } from 'lit/decorators.js'
3
- import { ifDefined } from 'lit/directives/if-defined.js'
4
-
5
- import { OxInputValueRange } from '@operato/input'
6
-
7
- import '@operato/attachment/ox-attachment-selector.js'
8
-
9
- @customElement('data-binding-value-range')
10
- export class DataBindingValueRange extends OxInputValueRange {
11
- static styles = OxInputValueRange.styles
12
-
13
- valueInputTemplate(value?: any) {
14
- if (this.valuetype == 'attachment') {
15
- return html`<ox-attachment-selector data-value value=${ifDefined(value)}></ox-attachment-selector>`
16
- }
17
- return super.valueInputTemplate(value)
18
- }
19
- }