@things-factory/board-ui 4.0.17 → 4.0.22

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.
@@ -5,14 +5,13 @@ import { registerEditor, registerRenderer } from '@things-factory/grist-ui'
5
5
  import { BoardEditor } from './data-grist/board-editor'
6
6
  import { BoardRenderer } from './data-grist/board-renderer'
7
7
  import { OxPropertyEditor } from '@operato/property-editor'
8
- import board from './reducers/board'
9
- import { store } from '@things-factory/shell'
8
+ import { registerDefaultGroups } from '@operato/board/dist/src/component/register-default-groups'
10
9
 
11
10
  export default function bootstrap() {
12
11
  registerRenderer('board', BoardRenderer)
13
12
  registerEditor('board', BoardEditor)
14
13
 
15
- store.addReducers({ board })
14
+ registerDefaultGroups()
16
15
 
17
16
  OxPropertyEditor.register({
18
17
  'board-selector': 'property-editor-board-selector'
package/client/index.js CHANGED
@@ -1,5 +1,3 @@
1
- export * from './actions/board'
2
-
3
1
  export * from './board-provider'
4
2
  export * from './viewparts/board-selector'
5
3
  export * from './viewparts/board-creation-card'
@@ -4,7 +4,7 @@ import '@operato/board/dist/src/ox-board-modeller.js'
4
4
  import { PageView, client, gqlContext, store } from '@things-factory/shell'
5
5
  import { css, html } from 'lit-element'
6
6
 
7
- import { ADD_BOARD_COMPONENTS } from '../actions/board'
7
+ import { BoardModeller } from '@operato/board/dist/src/ox-board-modeller.js'
8
8
  import { OxPropertyEditor } from '@operato/property-editor'
9
9
  import components from './things-scene-components-with-tools.import'
10
10
  import { connect } from 'pwa-helpers/connect-mixin.js'
@@ -17,9 +17,8 @@ export class BoardModellerPage extends connect(store)(PageView) {
17
17
  constructor() {
18
18
  super()
19
19
 
20
- store.dispatch({
21
- type: ADD_BOARD_COMPONENTS,
22
- components
20
+ components.forEach(component => {
21
+ BoardModeller.registerTemplate(component.templates)
23
22
  })
24
23
 
25
24
  /* 컴포넌트에서 정의된 에디터들을 MODELLER_EDITORS에 등록 */
@@ -45,9 +44,9 @@ export class BoardModellerPage extends connect(store)(PageView) {
45
44
  this.hideProperty = false
46
45
  this.overlay = null
47
46
  this.scene = null
48
- this.componentGroupList = []
49
47
  this.fonts = []
50
48
  this.board = null
49
+ this.componentGroupList = BoardModeller.groups
51
50
  }
52
51
 
53
52
  static get properties() {
@@ -201,8 +200,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
201
200
 
202
201
  stateChanged(state) {
203
202
  this.baseUrl = state.route.rootPath
204
-
205
- this.componentGroupList = state.board.templates
206
203
  this.fonts = state.font
207
204
  }
208
205
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/board-ui",
3
- "version": "4.0.17",
3
+ "version": "4.0.22",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,8 +26,8 @@
26
26
  "dependencies": {
27
27
  "@material/mwc-list": "^0.25.3",
28
28
  "@material/mwc-select": "^0.25.3",
29
- "@operato/board": "^0.2.49",
30
- "@operato/popup": "^0.2.49",
29
+ "@operato/board": "^0.2.50",
30
+ "@operato/popup": "^0.2.50",
31
31
  "@polymer/iron-icon": "^3.0.1",
32
32
  "@polymer/iron-icons": "^3.0.1",
33
33
  "@polymer/paper-button": "^3.0.1",
@@ -37,13 +37,13 @@
37
37
  "@polymer/paper-listbox": "^3.0.1",
38
38
  "@polymer/paper-menu-button": "^3.0.1",
39
39
  "@polymer/paper-slider": "^3.0.1",
40
- "@things-factory/barcode-base": "^4.0.17",
41
- "@things-factory/grist-ui": "^4.0.17",
42
- "@things-factory/help": "^4.0.17",
43
- "@things-factory/i18n-base": "^4.0.17",
44
- "@things-factory/modeller-ui": "^4.0.17",
40
+ "@things-factory/barcode-base": "^4.0.22",
41
+ "@things-factory/grist-ui": "^4.0.22",
42
+ "@things-factory/help": "^4.0.22",
43
+ "@things-factory/i18n-base": "^4.0.22",
44
+ "@things-factory/modeller-ui": "^4.0.22",
45
45
  "file-saver": "^2.0.2",
46
46
  "sortablejs": "^1.10.2"
47
47
  },
48
- "gitHead": "a82db9fc895f18855244c3d09383758608e03e19"
48
+ "gitHead": "8267638c3bd77dfc8fa9629b490d681c6854e423"
49
49
  }
@@ -1,2 +0,0 @@
1
- export const ADD_BOARD_COMPONENTS = 'ADD_BOARD_COMPONENTS'
2
- export const ADD_BOARD_EDITORS = 'ADD_BOARD_EDITORS'
@@ -1,527 +0,0 @@
1
- import { ADD_BOARD_COMPONENTS } from '../actions/board.js'
2
- import audio from '../../assets/images/components/audio.png'
3
- import bothArrow from '../../assets/images/components/both-arrow.png'
4
- import colorImage from '../../assets/images/components/color-image.png'
5
- import container from '../../assets/images/components/container.png'
6
- import dash from '../../assets/images/components/dash.png'
7
- import donut from '../../assets/images/components/donut.png'
8
- import ellipse from '../../assets/images/components/ellipse.png'
9
- import gifImage from '../../assets/images/components/gif-image.png'
10
- import globalReference from '../../assets/images/components/global-reference.png'
11
- import grayImage from '../../assets/images/components/gray-image.png'
12
- import infoWindow from '../../assets/images/components/info-window.png'
13
- import line from '../../assets/images/components/line.png'
14
- import localReference from '../../assets/images/components/local-reference.png'
15
- import polygon from '../../assets/images/components/polygon.png'
16
- import polyline from '../../assets/images/components/polyline.png'
17
- import popup from '../../assets/images/components/popup.png'
18
- import rect from '../../assets/images/components/rect.png'
19
- import singleArrow from '../../assets/images/components/single-arrow.png'
20
- import star from '../../assets/images/components/star.png'
21
- import text from '../../assets/images/components/text.png'
22
- import triangle from '../../assets/images/components/triangle.png'
23
-
24
- function shapes() {
25
- return [
26
- {
27
- type: 'rect',
28
- description: 'rectangle shape',
29
- icon: rect,
30
- model: {
31
- type: 'rect',
32
- left: 100,
33
- top: 100,
34
- width: 100,
35
- height: 100,
36
- fillStyle: '#fff',
37
- strokeStyle: '#000',
38
- alpha: 1,
39
- hidden: false,
40
- lineWidth: 1,
41
- lineDash: 'solid',
42
- lineCap: 'butt'
43
- }
44
- },
45
- {
46
- type: 'ellipse',
47
- description: 'ellipse shape',
48
- icon: ellipse,
49
- model: {
50
- type: 'ellipse',
51
- rx: 50,
52
- ry: 50,
53
- cx: 150,
54
- cy: 150,
55
- fillStyle: '#fff',
56
- strokeStyle: '#000',
57
- alpha: 1,
58
- hidden: false,
59
- lineWidth: 1,
60
- lineDash: 'solid',
61
- lineCap: 'butt'
62
- }
63
- },
64
- {
65
- type: 'donut',
66
- description: 'donut shape',
67
- icon: donut,
68
- model: {
69
- type: 'donut',
70
- rx: 50,
71
- ry: 50,
72
- cx: 150,
73
- cy: 150,
74
- ratio: 30,
75
- fillStyle: '#fff',
76
- strokeStyle: '#000',
77
- alpha: 1,
78
- hidden: false,
79
- lineWidth: 1,
80
- lineDash: 'solid',
81
- lineCap: 'butt'
82
- }
83
- },
84
- {
85
- type: 'triangle',
86
- description: 'triangle shape',
87
- icon: triangle,
88
- model: {
89
- type: 'triangle',
90
- x1: 150,
91
- y1: 100,
92
- x2: 100,
93
- y2: 200,
94
- x3: 200,
95
- y3: 200,
96
- fillStyle: '#fff',
97
- strokeStyle: '#000',
98
- alpha: 1,
99
- hidden: false,
100
- lineWidth: 1,
101
- lineDash: 'solid',
102
- lineCap: 'butt'
103
- }
104
- },
105
- {
106
- type: 'polygon',
107
- description: 'polygon shape',
108
- icon: polygon,
109
- model: {
110
- type: 'polygon',
111
- path: [
112
- { x: 100, y: 100 },
113
- { x: 200, y: 100 },
114
- { x: 200, y: 200 },
115
- { x: 100, y: 200 }
116
- ],
117
- fillStyle: '#fff',
118
- strokeStyle: '#000',
119
- alpha: 1,
120
- hidden: false,
121
- lineWidth: 1,
122
- lineDash: 'solid',
123
- lineCap: 'butt'
124
- }
125
- },
126
- {
127
- type: 'star',
128
- description: 'star shape',
129
- icon: star,
130
- model: {
131
- type: 'star',
132
- rx: 50,
133
- ry: 50,
134
- cx: 150,
135
- cy: 150,
136
- ratio: 30,
137
- wing: 5,
138
- fillStyle: '#fff',
139
- strokeStyle: '#000',
140
- alpha: 1,
141
- hidden: false,
142
- lineWidth: 1,
143
- lineDash: 'solid',
144
- lineCap: 'butt'
145
- }
146
- }
147
- ]
148
- }
149
-
150
- function lines() {
151
- return [
152
- {
153
- type: 'line',
154
- description: 'simple line',
155
- icon: line,
156
- model: {
157
- type: 'line',
158
- x1: 100,
159
- y1: 100,
160
- x2: 200,
161
- y2: 200,
162
- fillStyle: '#fff',
163
- strokeStyle: '#000',
164
- alpha: 1,
165
- hidden: false,
166
- lineWidth: 3,
167
- lineDash: 'solid',
168
- lineCap: 'butt'
169
- }
170
- },
171
- {
172
- type: 'dash',
173
- description: 'dash line',
174
- icon: dash,
175
- model: {
176
- type: 'line',
177
- x1: 100,
178
- y1: 100,
179
- x2: 200,
180
- y2: 200,
181
- fillStyle: '#fff',
182
- strokeStyle: '#000',
183
- alpha: 1,
184
- hidden: false,
185
- lineWidth: 3,
186
- lineDash: 'round-dot',
187
- lineCap: 'butt'
188
- }
189
- },
190
- {
191
- type: 'single arrow',
192
- description: 'single arrow tip line',
193
- icon: singleArrow,
194
- model: {
195
- type: 'line',
196
- x1: 100,
197
- y1: 100,
198
- x2: 200,
199
- y2: 200,
200
- fillStyle: '#fff',
201
- strokeStyle: '#000',
202
- alpha: 3,
203
- hidden: false,
204
- lineWidth: 3,
205
- lineDash: 'solid',
206
- begin: 'arrow',
207
- lineCap: 'butt'
208
- }
209
- },
210
- {
211
- type: 'both arrow',
212
- description: 'both arrow tip line',
213
- icon: bothArrow,
214
- model: {
215
- type: 'line',
216
- x1: 100,
217
- y1: 100,
218
- x2: 200,
219
- y2: 200,
220
- fillStyle: '#fff',
221
- strokeStyle: '#000',
222
- alpha: 1,
223
- hidden: false,
224
- lineWidth: 3,
225
- lineDash: 'solid',
226
- begin: 'arrow',
227
- end: 'arrow',
228
- lineCap: 'butt'
229
- }
230
- },
231
- {
232
- type: 'polyline',
233
- description: 'polyline',
234
- icon: polyline,
235
- model: {
236
- type: 'polyline',
237
- path: [
238
- { x: 100, y: 100 },
239
- { x: 200, y: 100 },
240
- { x: 200, y: 200 },
241
- { x: 100, y: 200 }
242
- ],
243
- fillStyle: '#fff',
244
- strokeStyle: '#000',
245
- alpha: 1,
246
- hidden: false,
247
- lineWidth: 1,
248
- lineDash: 'solid',
249
- lineCap: 'butt'
250
- }
251
- }
252
- ]
253
- }
254
-
255
- function textAndMedias() {
256
- return [
257
- {
258
- type: 'text',
259
- description: 'text',
260
- icon: text,
261
- model: {
262
- type: 'text',
263
- left: 100,
264
- top: 100,
265
- width: 200,
266
- height: 50,
267
- text: 'Text',
268
- fillStyle: '#fff',
269
- strokeStyle: '#000',
270
- alpha: 1,
271
- hidden: false,
272
- lineWidth: 5,
273
- lineDash: 'solid',
274
- lineCap: 'butt',
275
- textAlign: 'left',
276
- textBaseline: 'top',
277
- textWrap: false,
278
- fontFamily: 'serif',
279
- fontSize: 30
280
- }
281
- },
282
- {
283
- type: 'color image',
284
- description: 'color image',
285
- icon: colorImage,
286
- model: {
287
- type: 'image-view',
288
- left: 100,
289
- top: 100,
290
- width: 100,
291
- height: 100,
292
- isGray: false,
293
- fillStyle: '#fff',
294
- strokeStyle: '#000',
295
- alpha: 1,
296
- hidden: false,
297
- lineWidth: 1,
298
- lineDash: 'solid',
299
- lineCap: 'butt'
300
- }
301
- },
302
- {
303
- type: 'gray image',
304
- description: 'gray image',
305
- icon: grayImage,
306
- model: {
307
- type: 'image-view',
308
- left: 100,
309
- top: 100,
310
- width: 100,
311
- height: 100,
312
- isGray: true,
313
- fillStyle: '#fff',
314
- strokeStyle: '#000',
315
- alpha: 1,
316
- hidden: false,
317
- lineWidth: 1,
318
- lineDash: 'solid',
319
- lineCap: 'butt'
320
- }
321
- },
322
- {
323
- type: 'gif image',
324
- description: 'gif image',
325
- icon: gifImage,
326
- model: {
327
- type: 'gif-view',
328
- left: 100,
329
- top: 100,
330
- width: 100,
331
- height: 100
332
- }
333
- },
334
- {
335
- type: 'audio',
336
- description: 'audio',
337
- icon: audio,
338
- model: {
339
- type: 'audio',
340
- left: 100,
341
- top: 100,
342
- width: 100,
343
- height: 100
344
- }
345
- }
346
- ]
347
- }
348
-
349
- function groupContainer() {
350
- return [
351
- {
352
- type: 'container',
353
- description: 'general container',
354
- icon: container,
355
- model: {
356
- type: 'container',
357
- left: 100,
358
- top: 100,
359
- width: 100,
360
- height: 100,
361
- fillStyle: '#fff',
362
- strokeStyle: '#999',
363
- alpha: 1,
364
- hidden: false,
365
- lineWidth: 1,
366
- lineDash: 'solid',
367
- lineCap: 'butt'
368
- }
369
- },
370
- {
371
- type: 'popup',
372
- description: 'popup window',
373
- icon: popup,
374
- model: {
375
- type: 'popup',
376
- left: 100,
377
- top: 100,
378
- width: 100,
379
- height: 100,
380
- fillStyle: '#fff',
381
- strokeStyle: 'DarkGoldenRod',
382
- hidden: true
383
- }
384
- }
385
- ]
386
- }
387
-
388
- function etc() {
389
- return [
390
- {
391
- type: 'info-window',
392
- description: 'information window',
393
- icon: infoWindow,
394
- model: {
395
- type: 'info-window',
396
- left: 10,
397
- top: 10,
398
- width: 50,
399
- height: 50,
400
- fillStyle: '#fff',
401
- strokeStyle: 'DarkGoldenRod',
402
- hidden: true,
403
- frontSideTemplate:
404
- "<h2 id='xxx'>\n\t<%= text %>\n</h2>\n<img src='https://www.tutorialspoint.com/images/html.gif' alt='HTML Tutorial' height='150' width='140' />",
405
- backSideTemplate:
406
- "<h2 id='yyy'>\n\t<%= text %>\n</h2>\n<img src='https://www.tutorialspoint.com/images/html.gif' alt='HTML Tutorial' height='150' width='140' />",
407
- style:
408
- '#yyy {\n\tbackground-color:navy;\n\tcolor:white\n}\n#xxx, #yyy {\n\twhite-space:nowrap;\n\tmin-width:200px;\n}'
409
- }
410
- },
411
- {
412
- type: 'local reference',
413
- description: 'local reference',
414
- icon: localReference,
415
- model: {
416
- type: 'local-ref',
417
- left: 100,
418
- top: 100,
419
- width: 100,
420
- height: 100,
421
- fillStyle: '#fff',
422
- strokeStyle: '#000',
423
- alpha: 1,
424
- hidden: false,
425
- lineWidth: 1,
426
- lineDash: 'solid',
427
- lineCap: 'butt'
428
- }
429
- },
430
- {
431
- type: 'global reference',
432
- description: 'global reference',
433
- icon: globalReference,
434
- model: {
435
- type: 'global-ref',
436
- left: 100,
437
- top: 100,
438
- width: 100,
439
- height: 100,
440
- fillStyle: '#fff',
441
- strokeStyle: '#000',
442
- alpha: 1,
443
- hidden: false,
444
- lineWidth: 1,
445
- lineDash: 'solid',
446
- lineCap: 'butt'
447
- }
448
- }
449
- ]
450
- }
451
-
452
- const TEMPLATES = {
453
- shape: shapes(),
454
- line: lines(),
455
- textAndMedia: textAndMedias(),
456
- chartAndGauge: [],
457
- table: [],
458
- container: groupContainer(),
459
- dataSource: [],
460
- IoT: [],
461
- '3D': [],
462
- warehouse: [],
463
- form: [],
464
- etc: etc()
465
- }
466
-
467
- const INITIAL_STATE = {
468
- components: [],
469
- templates: [
470
- 'line',
471
- 'shape',
472
- 'textAndMedia',
473
- 'chartAndGauge',
474
- 'table',
475
- 'container',
476
- 'dataSource',
477
- 'IoT',
478
- '3D',
479
- 'warehouse',
480
- 'form',
481
- 'etc'
482
- ].map(group => {
483
- return {
484
- name: group,
485
- description: 'Group ' + group,
486
- templates: TEMPLATES[group]
487
- }
488
- })
489
- }
490
-
491
- const board = (state = INITIAL_STATE, action) => {
492
- switch (action.type) {
493
- case ADD_BOARD_COMPONENTS:
494
- let components = action.components
495
-
496
- let addedTemplates = [...state.templates]
497
-
498
- for (let component in components) {
499
- let { templates } = components[component]
500
-
501
- templates &&
502
- templates.forEach(template => {
503
- var group = addedTemplates.find(group => group.name == template.group)
504
-
505
- if (!group) {
506
- console.warn('Invalid group', group, template)
507
- return
508
- }
509
-
510
- if (!group.templates.find(inGroupTemplate => inGroupTemplate.type == template.type)) {
511
- group.templates.push(template)
512
- }
513
- })
514
- }
515
-
516
- return {
517
- ...state,
518
- components: [...state.components, ...action.components],
519
- templates: addedTemplates
520
- }
521
-
522
- default:
523
- return state
524
- }
525
- }
526
-
527
- export default board