@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,401 +0,0 @@
1
- import '@operato/popup/ox-popup.js'
2
- import '@operato/data-grist'
3
-
4
- import { css, html, LitElement } from 'lit'
5
- import { customElement, property, query, state } from 'lit/decorators.js'
6
-
7
- import { ColumnConfig, DataGrist, FetchOption, GristData, GristRecord, SortersConfig } from '@operato/data-grist'
8
- import { OxPopup } from '@operato/popup'
9
-
10
- import { createBoard, fetchBoardList } from './graphql/board'
11
- import { fetchFavoriteBoardList } from './graphql/favorite-board'
12
- import { fetchGroupList } from './graphql/group'
13
- import { Board } from './types'
14
-
15
- @customElement('ox-board-list')
16
- class BoardList extends LitElement {
17
- static styles = css`
18
- :host {
19
- display: flex;
20
-
21
- width: 100%;
22
-
23
- --grid-record-emphasized-background-color: red;
24
- --grid-record-emphasized-color: yellow;
25
- }
26
-
27
- ox-grist {
28
- flex: 1;
29
- overflow-y: auto;
30
-
31
- --grid-record-emphasized-background-color: red;
32
- --grid-record-emphasized-color: yellow;
33
- }
34
-
35
- #headroom {
36
- display: flex;
37
- flex-direction: row;
38
- align-items: center;
39
- padding: var(--padding-default) var(--spacing-large);
40
- border-top: 2px solid rgba(0, 0, 0, 0.2);
41
- background-color: var(--md-sys-color-surface);
42
- box-shadow: var(--box-shadow);
43
- }
44
-
45
- #filters {
46
- flex: 1;
47
- --md-icon-size: 20px;
48
- }
49
- #mode {
50
- width: 100px;
51
- }
52
- #add {
53
- width: 50px;
54
- text-align: right;
55
- }
56
-
57
- #modes > * {
58
- padding: var(--spacing-small);
59
- font-size: 1em;
60
- opacity: 0.5;
61
- color: var(--md-sys-color-on-primary-container);
62
- cursor: pointer;
63
- }
64
-
65
- #modes > md-icon[active] {
66
- border-radius: 9px;
67
- background-color: rgba(var(--primary-color-rgb), 0.05);
68
- opacity: 1;
69
- color: var(--md-sys-color-on-secondary-container);
70
- cursor: default;
71
- }
72
- #modes > md-icon:hover {
73
- opacity: 1;
74
- color: var(--md-sys-color-on-secondary-container);
75
- }
76
-
77
- #add button {
78
- display: flex;
79
- align-items: center;
80
- justify-content: center;
81
-
82
- background-color: var(--md-sys-color-primary-container);
83
- color: var(--md-sys-color-on-primary-container);
84
- border: 0;
85
- border-radius: 50%;
86
- padding: 5px;
87
- width: 32px;
88
- height: 32px;
89
- cursor: pointer;
90
- }
91
-
92
- #add button:hover {
93
- background-color: var(--md-sys-color-on-primary-container);
94
- color: var(--md-sys-color-primary-container);
95
- box-shadow: var(--box-shadow);
96
- }
97
-
98
- #add button md-icon {
99
- font-size: 1.5em;
100
- }
101
-
102
- #filters {
103
- position: relative;
104
- }
105
- #filters [type='text'] {
106
- background-color: transparent;
107
- border: 0;
108
- border-bottom: var(--border-dim-color);
109
- padding: var(--spacing-small) var(--spacing-small) 7px 25px;
110
- font-size: var(--fontsize-large);
111
- }
112
- #filters [type='text']:focus {
113
- outline: none;
114
- }
115
- #filters md-icon {
116
- position: absolute;
117
- top: 3px;
118
- color: var(--md-sys-color-on-secondary-container);
119
- }
120
- #filters * {
121
- margin-right: var(--spacing-medium);
122
- }
123
-
124
- @media only screen and (max-width: 460px) {
125
- #modes {
126
- display: none;
127
- }
128
- }
129
- `
130
-
131
- @property({ type: Boolean }) creatable: boolean = false
132
- @property({ type: Object }) config: any
133
- @property({ type: Object }) data: any
134
- @property({ type: String }) mode: 'GRID' | 'LIST' | 'CARD' = 'CARD'
135
- @property({ type: String }) groupId?: string
136
- @property({ type: Array }) groups: any[] = []
137
- @property({ type: Array }) favorites: any[] = []
138
-
139
- @query('ox-grist') grist!: DataGrist
140
-
141
- render() {
142
- const mode = this.mode || 'CARD'
143
-
144
- return html`
145
- <ox-grist .config=${this.config} .mode=${mode} auto-fetch .fetchHandler=${this.fetchHandler.bind(this)}>
146
- <div slot="headroom" id="headroom">
147
- <div id="filters">
148
- <md-icon>search</md-icon>
149
- <input type="text" />
150
-
151
- <select
152
- @change=${(e: Event) => {
153
- this.groupId = (e.currentTarget as HTMLInputElement).value
154
- this.requestUpdate()
155
- }}
156
- >
157
- <option value="">*</option>
158
- ${this.groups.map(
159
- group => html`
160
- <option value=${group.id} ?selected=${group.id === this.groupId}>${group.description}</option>
161
- `
162
- )}
163
- </select>
164
- </div>
165
-
166
- <div id="modes">
167
- <md-icon @click=${() => (this.mode = 'GRID')} ?active=${mode == 'GRID'}>grid_on</md-icon>
168
- <md-icon @click=${() => (this.mode = 'LIST')} ?active=${mode == 'LIST'}>format_list_bulleted</md-icon>
169
- <md-icon @click=${() => (this.mode = 'CARD')} ?active=${mode == 'CARD'}>apps</md-icon>
170
- </div>
171
-
172
- ${this.creatable
173
- ? html`
174
- <div id="add">
175
- <button><md-icon @click=${() => this.onCreateBoard()}>add</md-icon></button>
176
- </div>
177
- `
178
- : undefined}
179
- </div>
180
- </ox-grist>
181
- `
182
- }
183
-
184
- async fetchHandler({ page, limit, sorters = [] }: FetchOption) {
185
- const { items: records, total } = await this.getBoards({ page, limit, sorters })
186
-
187
- return {
188
- total,
189
- records
190
- }
191
- }
192
-
193
- get gristConfig() {
194
- return {
195
- list: {
196
- thumbnail: function (record: GristRecord, rowIndex: number) {
197
- return html` <img src=${record.thumbnail} style="width: 100%; height: 100%;" /> `
198
- },
199
- fields: ['name', 'description'],
200
- details: ['updatedAt']
201
- },
202
- columns: [
203
- {
204
- type: 'gutter',
205
- gutterName: 'dirty'
206
- },
207
- {
208
- type: 'gutter',
209
- gutterName: 'sequence'
210
- },
211
- {
212
- type: 'string',
213
- name: 'id',
214
- hidden: true
215
- },
216
- {
217
- type: 'string',
218
- name: 'name',
219
- header: 'name',
220
- record: {
221
- editable: true,
222
- align: 'left'
223
- },
224
- width: 200,
225
- sortable: true
226
- },
227
- {
228
- type: 'string',
229
- name: 'description',
230
- header: 'description',
231
- record: {
232
- editable: true,
233
- align: 'left'
234
- },
235
- width: 200
236
- },
237
- {
238
- type: 'boolean',
239
- name: 'active',
240
- header: 'active',
241
- record: {
242
- editable: true
243
- },
244
- sortable: true,
245
- width: 60
246
- },
247
- {
248
- type: 'datetime',
249
- name: 'updatedAt',
250
- header: 'updated at',
251
- record: {
252
- editable: true
253
- },
254
- sortable: true,
255
- width: 180
256
- },
257
- {
258
- type: 'datetime',
259
- name: 'createdAt',
260
- header: 'created at',
261
- record: {
262
- editable: true
263
- },
264
- sortable: true,
265
- width: 180
266
- }
267
- ],
268
- rows: {
269
- selectable: {
270
- multiple: true
271
- }
272
- },
273
- sorters: [
274
- {
275
- name: 'name',
276
- desc: false
277
- }
278
- ],
279
- pagination: {
280
- pages: [20, 30, 50, 100, 200]
281
- }
282
- }
283
- }
284
-
285
- async refresh() {
286
- this.groups = (await fetchGroupList()).groups.items
287
-
288
- if (this.groups) {
289
- await this.refreshBoards()
290
- }
291
- }
292
-
293
- async getBoards({
294
- page = 1,
295
- limit = 30,
296
- sorters = []
297
- }: { page?: number; limit?: number; sorters?: SortersConfig } = {}) {
298
- if (this.groupId && this.groupId == 'favor')
299
- return await this.getFavoriteBoards({
300
- page,
301
- limit
302
- })
303
-
304
- var listParam = {
305
- filters: this.groupId
306
- ? [
307
- {
308
- name: 'groupId',
309
- operator: 'eq',
310
- value: this.groupId
311
- }
312
- ]
313
- : [],
314
- sortings: sorters,
315
- pagination: {
316
- page,
317
- limit
318
- }
319
- }
320
-
321
- return (await fetchBoardList(listParam)).boards
322
- }
323
-
324
- async getFavoriteBoards({ page = 1, limit = 30 } = {}) {
325
- var listParam = {
326
- pagination: {
327
- page,
328
- limit
329
- }
330
- }
331
-
332
- return (await fetchFavoriteBoardList(listParam)).favoriteBoards
333
- }
334
-
335
- async refreshBoards() {
336
- if (!this.groups) {
337
- await this.refresh()
338
- return
339
- }
340
-
341
- this.grist.fetch()
342
- }
343
-
344
- async onCreateBoard() {
345
- /*
346
- * 기존 설정된 이미지가 선택된 상태가 되게 하기 위해서는 selector에 value를 전달해줄 필요가 있음.
347
- * 주의. value는 object일 수도 있고, string일 수도 있다.
348
- * string인 경우에는 해당 보드의 id로 해석한다.
349
- */
350
- var template = html`
351
- <board-creation-popup
352
- .defaultGroup=${this.groupId}
353
- .groups=${this.groups}
354
- @create-board=${async (e: CustomEvent) => {
355
- try {
356
- var { name, description, groupId, model, thumbnail } = e.detail
357
-
358
- var board: Board = {
359
- name,
360
- description,
361
- groupId,
362
- model: model || {
363
- width: 1200,
364
- height: 800
365
- },
366
- thumbnail
367
- }
368
-
369
- await createBoard(board)
370
-
371
- this.notify('info', 'new board created')
372
- } catch (ex: Error | any) {
373
- console.error(ex)
374
- this.notify('error', ex, ex)
375
- }
376
- }}
377
- ></board-creation-popup>
378
- `
379
-
380
- OxPopup.open({
381
- template,
382
- parent: this
383
- })
384
-
385
- requestAnimationFrame(() => {
386
- dispatchEvent(new Event('resize'))
387
- })
388
- }
389
-
390
- notify(level: 'warn' | 'error' | 'info', message: any, ex?: Error) {
391
- document.dispatchEvent(
392
- new CustomEvent('notify', {
393
- detail: {
394
- level,
395
- message,
396
- ex
397
- }
398
- })
399
- )
400
- }
401
- }