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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/package.json +14 -14
  3. package/.storybook/main.js +0 -3
  4. package/.storybook/server.mjs +0 -8
  5. package/db.sqlite +0 -0
  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/logs/.08636eb59927f12972f6774f5947c8507b3564c2-audit.json +0 -15
  11. package/logs/.5e5d741d8b7784a2fbad65eedc0fd46946aaf6f2-audit.json +0 -15
  12. package/logs/application-2023-03-12-02.log +0 -14
  13. package/logs/connections-2023-03-12-02.log +0 -70
  14. package/src/component/3d.ts +0 -29
  15. package/src/component/chart-and-gauge.ts +0 -28
  16. package/src/component/container.ts +0 -63
  17. package/src/component/data-source.ts +0 -30
  18. package/src/component/etc.ts +0 -88
  19. package/src/component/form.ts +0 -42
  20. package/src/component/index.ts +0 -12
  21. package/src/component/iot.ts +0 -52
  22. package/src/component/line.ts +0 -156
  23. package/src/component/register-default-groups.ts +0 -28
  24. package/src/component/shape.ts +0 -156
  25. package/src/component/table.ts +0 -28
  26. package/src/component/text-and-media.ts +0 -125
  27. package/src/component/warehouse.ts +0 -26
  28. package/src/data-storage/data-storage.ts +0 -76
  29. package/src/graphql/board.ts +0 -144
  30. package/src/graphql/data-subscription.ts +0 -30
  31. package/src/graphql/favorite-board.ts +0 -25
  32. package/src/graphql/group.ts +0 -138
  33. package/src/graphql/index.ts +0 -4
  34. package/src/graphql/play-group.ts +0 -225
  35. package/src/graphql/scenario.ts +0 -79
  36. package/src/index.ts +0 -10
  37. package/src/modeller/component-toolbar/component-detail.ts +0 -52
  38. package/src/modeller/component-toolbar/component-menu.ts +0 -196
  39. package/src/modeller/component-toolbar/component-toolbar.ts +0 -196
  40. package/src/modeller/component-toolbar/mode-icons.ts +0 -88
  41. package/src/modeller/edit-toolbar-style.ts +0 -232
  42. package/src/modeller/edit-toolbar.ts +0 -587
  43. package/src/modeller/property-sidebar/abstract-property.ts +0 -69
  44. package/src/modeller/property-sidebar/data-binding/data-binding-mapper.ts +0 -475
  45. package/src/modeller/property-sidebar/data-binding/data-binding-value-map.ts +0 -19
  46. package/src/modeller/property-sidebar/data-binding/data-binding-value-range.ts +0 -19
  47. package/src/modeller/property-sidebar/data-binding/data-binding.ts +0 -480
  48. package/src/modeller/property-sidebar/effects/effects-shared-style.ts +0 -62
  49. package/src/modeller/property-sidebar/effects/effects.ts +0 -69
  50. package/src/modeller/property-sidebar/effects/property-animation.ts +0 -146
  51. package/src/modeller/property-sidebar/effects/property-animations.ts +0 -93
  52. package/src/modeller/property-sidebar/effects/property-event-hover.ts +0 -200
  53. package/src/modeller/property-sidebar/effects/property-event-tap.ts +0 -251
  54. package/src/modeller/property-sidebar/effects/property-event.ts +0 -73
  55. package/src/modeller/property-sidebar/effects/property-shadow.ts +0 -114
  56. package/src/modeller/property-sidebar/effects/value-converter.ts +0 -23
  57. package/src/modeller/property-sidebar/inspector/inspector.ts +0 -404
  58. package/src/modeller/property-sidebar/property-shared-style.ts +0 -136
  59. package/src/modeller/property-sidebar/property-sidebar.ts +0 -326
  60. package/src/modeller/property-sidebar/shapes/box-padding-editor-styles.ts +0 -94
  61. package/src/modeller/property-sidebar/shapes/shapes.ts +0 -432
  62. package/src/modeller/property-sidebar/specifics/specific-properties-builder.ts +0 -152
  63. package/src/modeller/property-sidebar/specifics/specifics.ts +0 -81
  64. package/src/modeller/property-sidebar/styles/styles.ts +0 -577
  65. package/src/modeller/scene-viewer/confidential-overlay.ts +0 -18
  66. package/src/modeller/scene-viewer/ox-scene-handler.ts +0 -40
  67. package/src/modeller/scene-viewer/ox-scene-layer.ts +0 -42
  68. package/src/modeller/scene-viewer/ox-scene-property.ts +0 -10
  69. package/src/modeller/scene-viewer/ox-scene-viewer.ts +0 -263
  70. package/src/ox-board-component-info.ts +0 -236
  71. package/src/ox-board-list.ts +0 -401
  72. package/src/ox-board-modeller.ts +0 -408
  73. package/src/ox-board-player-style.ts +0 -200
  74. package/src/ox-board-player.ts +0 -333
  75. package/src/ox-board-template-list.ts +0 -267
  76. package/src/ox-board-template-viewer.ts +0 -198
  77. package/src/ox-board-viewer.ts +0 -727
  78. package/src/ox-editor-board-selector.ts +0 -91
  79. package/src/ox-property-editor-board-selector.ts +0 -23
  80. package/src/player/ox-board-player-carousel.ts +0 -197
  81. package/src/player/ox-board-player-grid.ts +0 -78
  82. package/src/player/ox-board-wrapper.ts +0 -152
  83. package/src/selector/board-creation-popup.ts +0 -151
  84. package/src/selector/board-thumbnail-card.ts +0 -175
  85. package/src/selector/ox-board-creation-card.ts +0 -98
  86. package/src/selector/ox-board-selector.ts +0 -382
  87. package/src/types.ts +0 -63
  88. package/stories/property-data-binding.stories.ts +0 -34
  89. package/tsconfig.json +0 -24
  90. package/web-dev-server.config.mjs +0 -30
  91. package/web-test-runner.config.mjs +0 -29
@@ -1,333 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import './player/ox-board-wrapper'
3
- import './player/ox-board-player-carousel'
4
-
5
- import { html, LitElement, PropertyValues } from 'lit'
6
- import { customElement, property, query, state } from 'lit/decorators.js'
7
-
8
- import { exitfullscreen, SwipeListener, togglefullscreen } from '@operato/utils'
9
-
10
- import { PlaylistStorage } from './data-storage/data-storage.js'
11
- import { style } from './ox-board-player-style'
12
-
13
- const DEFAULT_PLAYLIST = String('__default__')
14
-
15
- @customElement('ox-board-player')
16
- export class BoardPlayer extends LitElement {
17
- static styles = style
18
-
19
- @property({ type: String }) playlist: string = DEFAULT_PLAYLIST
20
- @property({ type: Array }) boards: Array<any> = []
21
- @property({ type: Number }) playtime = 30
22
- @property({ type: Number }) columns = 1
23
- @property({ type: Number }) rows = 1
24
- @property({ type: Boolean }) started = false
25
- @property({ type: Boolean }) playing = false
26
- @property({ type: Object }) provider: any
27
- @property({ type: Object }) data: any
28
-
29
- @state() _controlAnimation?: Animation
30
- @state() _transferTimer?: any
31
- @state() _currentPlayer?: any
32
- @state() _fullscreened = false
33
-
34
- @query('#control') _control!: HTMLElement
35
-
36
- private playlistStorage: PlaylistStorage = new PlaylistStorage()
37
-
38
- render() {
39
- return html`
40
- <slot @mousemove=${() => this.onMousemove()} @transform=${() => this.onTransform()} tabindex="-1">
41
- ${this.started
42
- ? html`
43
- <ox-board-player-carousel axis="y" .rows=${this.rows} .columns=${this.columns} player>
44
- ${this.boards.map(
45
- item => html`
46
- <ox-board-wrapper page .board=${item} .data=${this.data} .provider=${this.provider}>
47
- </ox-board-wrapper>
48
- `
49
- )}
50
- </ox-board-player-carousel>
51
- `
52
- : html``}
53
- </slot>
54
-
55
- <div id="control" @mouseover=${() => this.onMouseoverControl()} hidden>
56
- <div id="joystick">
57
- <md-icon id="up" @click=${() => this.moveUp()}>keyboard_arrow_up</md-icon>
58
- <md-icon id="left" @click=${() => this.moveLeft()}>keyboard_arrow_left</md-icon>
59
- <md-icon id="play" @click=${() => this.play()} ?hidden=${this.playing}>play_arrow</md-icon>
60
- <md-icon id="pause" @click=${() => this.pause()} ?hidden=${!this.playing}>pause</md-icon>
61
- <md-icon id="right" @click=${() => this.moveRight()}>keyboard_arrow_right</md-icon>
62
- <md-icon id="down" @click=${() => this.moveDown()}>keyboard_arrow_down</md-icon>
63
- </div>
64
-
65
- <div id="setting-container">
66
- <div id="setting">
67
- <label id="schedule-container">
68
- <md-icon id="schedule">schedule</md-icon>
69
- <input
70
- .value=${String(this.playtime)}
71
- @change=${(e: Event) => {
72
- this.playtime = Number((e.target as HTMLInputElement).value)
73
- this.playlistStorage.save(this.playlist, {
74
- playtime: this.playtime,
75
- columns: this.columns,
76
- rows: this.rows
77
- })
78
- }}
79
- />
80
- sec.
81
- </label>
82
- <div id="grid-setting-container">
83
- <md-icon id="view_module">view_module</md-icon>
84
- <select
85
- .value=${String(this.rows)}
86
- @change=${(e: Event) => {
87
- this.rows = Number((e.target as HTMLInputElement).value)
88
- this.playlistStorage.save(this.playlist, {
89
- playtime: this.playtime,
90
- columns: this.columns,
91
- rows: this.rows
92
- })
93
- }}
94
- >
95
- ${[1, 2, 3, 4, 5].map(row => html` <option>${row}</option> `)}
96
- </select>
97
- x
98
- <select
99
- .value=${String(this.columns)}
100
- @change=${(e: Event) => {
101
- this.columns = Number((e.target as HTMLInputElement).value)
102
- this.playlistStorage.save(this.playlist, {
103
- playtime: this.playtime,
104
- columns: this.columns,
105
- rows: this.rows
106
- })
107
- }}
108
- >
109
- ${[1, 2, 3, 4, 5].map(column => html` <option>${column}</option> `)}
110
- </select>
111
- </div>
112
- </div>
113
-
114
- <div id="etc">
115
- <md-icon id="fullscreen" @click=${() => this.onTapFullscreen()} ?hidden=${this._fullscreened}
116
- >fullscreen</md-icon
117
- >
118
- <md-icon id="fullscreen-exit" @click=${() => this.onTapFullscreen()} ?hidden=${!this._fullscreened}
119
- >fullscreen_exit</md-icon
120
- >
121
- <md-icon id="close" @click=${() => this.onTapClose()}>close</md-icon>
122
- </div>
123
- </div>
124
- </div>
125
- `
126
- }
127
-
128
- async firstUpdated() {
129
- const setting = await this.playlistStorage.load(this.playlist)
130
-
131
- if (setting) {
132
- const { playtime = 30, columns = 1, rows = 1 } = setting || {}
133
-
134
- this.playtime = playtime
135
- this.columns = columns
136
- this.rows = rows
137
- }
138
-
139
- SwipeListener(this)
140
-
141
- this.addEventListener('swipe', (e: Event) => {
142
- var directions = (e as any).detail.directions
143
-
144
- if (directions.left) {
145
- this.moveRight()
146
- } else if (directions.right) {
147
- this.moveLeft()
148
- } else if (directions.top) {
149
- this.moveDown()
150
- } else if (directions.bottom) {
151
- this.moveUp()
152
- }
153
- })
154
-
155
- this.setAttribute('tabindex', '0')
156
- this.addEventListener('keydown', (e: KeyboardEvent) => {
157
- switch (e.key) {
158
- case 'Right': // for IE/Edge
159
- case 'ArrowRight':
160
- e.stopPropagation()
161
- this.moveRight()
162
- break
163
-
164
- case 'Left': // for IE/Edge
165
- case 'ArrowLeft':
166
- e.stopPropagation()
167
- this.moveLeft()
168
- break
169
-
170
- case 'Up': // for IE/Edge
171
- case 'ArrowUp':
172
- e.stopPropagation()
173
- this.moveUp()
174
- break
175
-
176
- case 'Down': // for IE/Edge
177
- case 'ArrowDown':
178
- e.stopPropagation()
179
- this.moveDown()
180
- break
181
- }
182
- })
183
-
184
- this.focus()
185
- }
186
-
187
- updated(changes: PropertyValues<this>) {
188
- if (changes.has('boards') || changes.has('columns') || changes.has('rows')) {
189
- this.boards && this.boards.length > 0 ? this.restart() : this.stop()
190
- } else if (changes.has('playtime') && this.playing) {
191
- this._resetTransformTimer()
192
- }
193
- }
194
-
195
- async _resetFadeTimer(stop?: boolean) {
196
- if (!this._controlAnimation) {
197
- this._controlAnimation = this._control.animate(
198
- [
199
- {
200
- opacity: 1,
201
- easing: 'ease-in'
202
- },
203
- { opacity: 0 }
204
- ],
205
- { delay: 1000, duration: 2000 }
206
- )
207
- }
208
-
209
- this._control.hidden = false
210
-
211
- this._controlAnimation.cancel()
212
- if (stop) return
213
-
214
- try {
215
- this._controlAnimation.play()
216
- await this._controlAnimation.finished
217
- this._control.hidden = true
218
- } catch (e) {
219
- /* cancelled */
220
- }
221
- }
222
-
223
- _resetTransformTimer() {
224
- clearTimeout(this._transferTimer)
225
-
226
- this.playing = true
227
-
228
- if (this._currentPlayer) {
229
- this._transferTimer = setTimeout(() => {
230
- if (this._transferTimer) this._currentPlayer.next()
231
- }, this.playtime * 1000)
232
- }
233
- }
234
-
235
- onMousemove() {
236
- this._resetFadeTimer()
237
- }
238
-
239
- onMouseoverControl() {
240
- this._resetFadeTimer(true)
241
- }
242
-
243
- onTapFullscreen() {
244
- togglefullscreen(
245
- this,
246
- () => {
247
- this._fullscreened = true
248
- this.focus()
249
- },
250
- () => {
251
- this._fullscreened = false
252
- this.focus()
253
- }
254
- )
255
- }
256
-
257
- onTransform() {
258
- requestAnimationFrame(() => this.started && this.playing && this._resetTransformTimer())
259
- }
260
-
261
- play() {
262
- this._resetTransformTimer()
263
- }
264
-
265
- pause() {
266
- clearTimeout(this._transferTimer)
267
- this.playing = false
268
- }
269
-
270
- moveLeft() {
271
- this._currentPlayer.axis = 'y'
272
- this._currentPlayer.previous()
273
- }
274
-
275
- moveRight() {
276
- this._currentPlayer.axis = 'y'
277
- this._currentPlayer.next()
278
- }
279
-
280
- moveUp() {
281
- this._currentPlayer.axis = 'x'
282
- this._currentPlayer.next()
283
- }
284
-
285
- moveDown() {
286
- this._currentPlayer.axis = 'x'
287
- this._currentPlayer.previous()
288
- }
289
-
290
- onTapClose() {
291
- if (this._fullscreened) {
292
- exitfullscreen()
293
- }
294
-
295
- window.history.back()
296
- }
297
-
298
- async restart() {
299
- await this.stop()
300
- await this.start()
301
- }
302
-
303
- async start() {
304
- if (!this.boards || this.boards.length == 0) {
305
- return
306
- }
307
-
308
- this.started = true
309
- this.playing = true
310
-
311
- await this.updateComplete
312
-
313
- this._currentPlayer = this.renderRoot.querySelector(':not([style*="display: none"])[player]')
314
-
315
- this._resetTransformTimer()
316
- this._resetFadeTimer()
317
-
318
- this.focus()
319
- }
320
-
321
- async stop() {
322
- clearTimeout(this._transferTimer)
323
-
324
- this._currentPlayer && this._currentPlayer.stop()
325
- this.started = false
326
-
327
- /**
328
- * this.started = false 로 인한 update를 강제하기 위함임.
329
- * this.start() 가 바로 호출되어 this.started 의 변화가 render에 반영되지 않을 수 있으므로.
330
- */
331
- await this.updateComplete
332
- }
333
- }
@@ -1,267 +0,0 @@
1
- import '@operato/data-grist'
2
- import '@operato/input/ox-input-file.js'
3
-
4
- import gql from 'graphql-tag'
5
- import { css, html, LitElement } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
7
-
8
- import { DataGrist, FetchOption, FilterValue, PaginationConfig, SortersConfig } from '@operato/data-grist'
9
- import { buildArgs, client } from '@operato/graphql'
10
- import { ScrollbarStyles } from '@operato/styles'
11
- import { i18next } from '@operato/i18n'
12
-
13
- const FETCH_BOARD_TEMPLATE_LIST_GQL = (listParam: any) => {
14
- return gql`
15
- {
16
- boardTemplates(${buildArgs(listParam)}) {
17
- items {
18
- id
19
- name
20
- description
21
- visibility
22
- thumbnail
23
- }
24
- total
25
- }
26
- }
27
- `
28
- }
29
-
30
- const FETCH_BOARD_TEMPLATE_GQL = (id: string) => {
31
- return gql`
32
- {
33
- boardTemplate(id: "${id}") {
34
- id
35
- name
36
- description
37
- visibility
38
- model
39
- thumbnail
40
- }
41
- }
42
- `
43
- }
44
-
45
- @customElement('ox-board-template-list')
46
- export class OxBoardTemplateList extends LitElement {
47
- static styles = [
48
- ScrollbarStyles,
49
- css`
50
- :host {
51
- display: flex;
52
-
53
- width: 100%;
54
- }
55
-
56
- ox-grist {
57
- flex: 1;
58
- overflow-y: auto;
59
- }
60
-
61
- #headroom {
62
- align-items: center;
63
- padding: var(--padding-default) var(--spacing-large);
64
- border-top: 2px solid rgba(0, 0, 0, 0.2);
65
- color: var(--md-sys-color-on-surface-variant);
66
- background-color: var(--md-sys-color-surface-variant);
67
- box-shadow: var(--box-shadow);
68
- }
69
-
70
- #filters {
71
- display: flex;
72
- flex-direction: row;
73
- place-content: space-between;
74
- margin: var(--margin-default) 0;
75
- }
76
-
77
- select {
78
- border: 0;
79
- outline: none;
80
- text-align: right;
81
- }
82
-
83
- @media only screen and (max-width: 460px) {
84
- #filters {
85
- flex-direction: column;
86
- }
87
- }
88
- `
89
- ]
90
-
91
- @property({ type: Boolean, attribute: 'without-search' }) withoutSearch: boolean = false
92
-
93
- @query('ox-grist') grist!: DataGrist
94
-
95
- render() {
96
- return html`
97
- <ox-grist .config=${this.gristConfig} .mode=${'CARD'} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
98
- <div slot="headroom" id="headroom">
99
- <div id="filters">
100
- <ox-filters-form autofocus .withoutSearch=${this.withoutSearch}></ox-filters-form>
101
- </div>
102
- </div>
103
- </ox-grist>
104
- `
105
- }
106
-
107
- async fetchHandler({ page = 1, limit = 100, sortings = [], filters = [] }: FetchOption) {
108
- const { items: records, total } = await this.getBoardTemplates({ page, limit, filters, sortings })
109
-
110
- return {
111
- total,
112
- records
113
- }
114
- }
115
-
116
- get gristConfig() {
117
- const PRIVATE = i18next.t('label.visibility-private')
118
- const DOMAIN = i18next.t('label.visibility-domain')
119
- const PUBLIC = i18next.t('label.visibility-public')
120
-
121
- const visibilities = window.location.pathname.startsWith('/domain/')
122
- ? [
123
- { display: PRIVATE, value: 'private' },
124
- { display: DOMAIN, value: 'domain' },
125
- { display: PUBLIC, value: 'public' }
126
- ]
127
- : [
128
- { display: PRIVATE, value: 'private' },
129
- { display: PUBLIC, value: 'public' }
130
- ]
131
-
132
- return {
133
- list: {
134
- thumbnail: 'thumbnail',
135
- fields: ['name'],
136
- details: ['description']
137
- },
138
- columns: [
139
- {
140
- type: 'string',
141
- name: 'id',
142
- hidden: true
143
- },
144
- {
145
- type: 'string',
146
- name: 'name',
147
- header: 'name',
148
- record: {
149
- editable: true,
150
- align: 'left'
151
- },
152
- width: 200,
153
- filter: 'search',
154
- sortable: true
155
- },
156
- {
157
- type: 'string',
158
- name: 'description',
159
- header: 'description',
160
- record: {
161
- editable: true,
162
- align: 'left'
163
- },
164
- width: 200,
165
- filter: 'search'
166
- },
167
- {
168
- type: 'select-buttons',
169
- name: 'visibility',
170
- header: 'visibility',
171
- record: {
172
- editable: false
173
- },
174
- hidden: true,
175
- filter: {
176
- operator: 'in',
177
- options: visibilities,
178
- label: ''
179
- }
180
- },
181
- {
182
- type: 'image',
183
- name: 'thumbnail',
184
- hidden: true,
185
- record: {
186
- editable: false
187
- },
188
- width: 120
189
- }
190
- ],
191
- rows: {
192
- appendable: false,
193
- selectable: {
194
- multiple: false
195
- },
196
- handlers: {
197
- click: 'select-row-toggle'
198
- }
199
- },
200
- sorters: [
201
- {
202
- name: 'name',
203
- desc: false
204
- }
205
- ],
206
- pagination: {
207
- pages: [20, 30, 50, 100, 200]
208
- }
209
- }
210
- }
211
-
212
- async firstUpdated() {
213
- this.refreshBoardTemplates()
214
- }
215
-
216
- async getSelected() {
217
- const selected = this.grist.selected
218
- const templateId = selected && selected[0]?.id
219
-
220
- if (!templateId) {
221
- return
222
- }
223
-
224
- var boardTemplateResponse = await client.query({
225
- query: FETCH_BOARD_TEMPLATE_GQL(templateId)
226
- })
227
-
228
- var template = boardTemplateResponse.data?.boardTemplate
229
-
230
- if (template) {
231
- template = {
232
- ...template,
233
- model: JSON.parse(template.model)
234
- }
235
- }
236
-
237
- return template
238
- }
239
-
240
- async refreshBoardTemplates() {
241
- this.grist.fetch()
242
- }
243
-
244
- async getBoardTemplates({
245
- page = 1,
246
- limit = 30,
247
- filters = [],
248
- sortings = []
249
- }: { page?: number; limit?: number; filters?: FilterValue[]; sortings?: SortersConfig } = {}) {
250
- var pagination: PaginationConfig = {
251
- limit,
252
- page
253
- }
254
-
255
- var params = {
256
- filters,
257
- sortings,
258
- pagination
259
- }
260
-
261
- var boardTemplateListResponse = await client.query({
262
- query: FETCH_BOARD_TEMPLATE_LIST_GQL(params)
263
- })
264
-
265
- return boardTemplateListResponse?.data?.boardTemplates || {}
266
- }
267
- }