@things-factory/board-ui 4.0.9 → 4.0.13

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.
@@ -1,12 +1,13 @@
1
1
  import '@material/mwc-fab'
2
2
  import '@operato/board' // ox-board-viewer
3
- import '@polymer/paper-dialog/paper-dialog'
4
3
  import './scene-viewer/things-scene-viewer'
5
4
  import './component-toolbar/component-toolbar'
6
5
  import './property-sidebar/property-sidebar'
7
6
 
8
7
  import { LitElement, css, html } from 'lit-element'
9
8
 
9
+ import { OxPopup } from '@operato/popup'
10
+
10
11
  export class BoardModeller extends LitElement {
11
12
  constructor() {
12
13
  super()
@@ -63,6 +64,7 @@ export class BoardModeller extends LitElement {
63
64
  flex-direction: row;
64
65
  height: 100%;
65
66
  overflow: hidden;
67
+ position: relative;
66
68
  }
67
69
 
68
70
  #scene-wrap {
@@ -84,6 +86,26 @@ export class BoardModeller extends LitElement {
84
86
  right: 15px;
85
87
  bottom: 15px;
86
88
  }
89
+
90
+ ox-popup {
91
+ width: 90%;
92
+ height: 90%;
93
+ left: 50%;
94
+ top: 50%;
95
+ transform: translateX(-50%) translateY(-50%);
96
+ background: var(--secondary-color, black);
97
+
98
+ display: flex;
99
+ justify-content: center;
100
+ flex-direction: column;
101
+ }
102
+
103
+ ox-board-viewer {
104
+ width: 98%;
105
+ height: 98%;
106
+ margin: auto;
107
+ padding: 0;
108
+ }
87
109
  `
88
110
  ]
89
111
  }
@@ -182,45 +204,15 @@ export class BoardModeller extends LitElement {
182
204
  }
183
205
 
184
206
  preview() {
185
- this.previewModel = this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null
186
-
187
- /*
188
- * paper-dialog appears behind backdrop when inside a <app-header-layout ..
189
- * https://github.com/PolymerElements/paper-dialog/issues/152
190
- **/
191
-
192
- var preview = document.createElement('ox-board-viewer')
193
-
194
- preview.style.width = '100%'
195
- preview.style.height = '100%'
196
- preview.style.margin = '0'
197
- preview.style.padding = '0'
198
- preview.style.flex = 1
199
- preview.provider = this.provider
200
- preview.board = {
207
+ const board = {
201
208
  id: 'preview',
202
- model: this.previewModel
209
+ model: this.scene?.model ? JSON.parse(JSON.stringify(this.scene.model)) : null
203
210
  }
204
- preview.baseUrl = this.baseUrl
205
-
206
- var dialog = document.createElement('paper-dialog')
207
-
208
- dialog.style.width = '100%'
209
- dialog.style.height = '100%'
210
- dialog.style.display = 'flex'
211
- dialog.style['flex-direction'] = 'column'
212
- dialog.setAttribute('with-backdrop', true)
213
- dialog.setAttribute('auto-fit-on-attach', true)
214
- dialog.setAttribute('always-on-top', true)
215
- dialog.addEventListener('iron-overlay-closed', () => {
216
- preview.board = null
217
- dialog.parentNode.removeChild(dialog)
218
- })
219
211
 
220
- dialog.appendChild(preview)
221
- document.body.appendChild(dialog)
222
-
223
- dialog.open()
212
+ OxPopup.open({
213
+ template: html` <ox-board-viewer .provider=${this.provider} .board=${board}></ox-board-viewer> `,
214
+ parent: this.renderRoot
215
+ })
224
216
 
225
217
  requestAnimationFrame(() => {
226
218
  dispatchEvent(new Event('resize'))
@@ -2,16 +2,15 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import { html } from 'lit-element'
6
5
  import '@things-factory/i18n-base'
7
-
8
6
  import './things-editor-board-selector'
9
7
 
10
- import { ThingsEditorProperty, ThingsEditorPropertyStyles } from '@things-factory/modeller-ui'
8
+ import { OxPropertyEditor } from '@operato/property-editor'
9
+ import { html } from 'lit-element'
11
10
 
12
- class PropertyEditorBoardSelector extends ThingsEditorProperty {
11
+ class PropertyEditorBoardSelector extends OxPropertyEditor {
13
12
  static get styles() {
14
- return [ThingsEditorPropertyStyles]
13
+ return [...OxPropertyEditor.styles]
15
14
  }
16
15
 
17
16
  editorTemplate(props) {
@@ -2,9 +2,11 @@
2
2
  * @license Copyright © HatioLab Inc. All rights reserved.
3
3
  */
4
4
 
5
- import { LitElement } from 'lit-element'
6
5
  import '@things-factory/modeller-ui/client/editors/things-editor-property'
7
6
 
7
+ import { LitElement } from 'lit-element'
8
+ import { OxPropertyEditor } from '@operato/property-editor'
9
+
8
10
  /**
9
11
  모든 에디터들은 change 이벤트를 지원해야 한다. 또한, 모든 에디터들은 value속성에 값을 가져야 한다.
10
12
 
@@ -83,7 +85,7 @@ class SpecificPropertiesBuilder extends LitElement {
83
85
  _onPropsChanged(props) {
84
86
  this.renderRoot.textContent = ''
85
87
  ;(props || []).forEach(prop => {
86
- let elementType = this.propertyEditor[prop.type]
88
+ let elementType = OxPropertyEditor.getEditor(prop.type)
87
89
  if (!elementType) {
88
90
  console.warn('Property Editor not defined', prop.type)
89
91
  return
@@ -1,14 +1,12 @@
1
- import { store } from '@things-factory/shell'
1
+ import './board-modeller/editors/board-editor-property'
2
2
 
3
- import { ADD_MODELLER_EDITORS } from '@things-factory/modeller-ui'
4
3
  import { registerEditor, registerRenderer } from '@things-factory/grist-ui'
5
4
 
6
- import board from './reducers/board'
7
-
8
- import { BoardRenderer } from './data-grist/board-renderer'
9
5
  import { BoardEditor } from './data-grist/board-editor'
10
-
11
- import './board-modeller/editors/board-editor-property'
6
+ import { BoardRenderer } from './data-grist/board-renderer'
7
+ import { OxPropertyEditor } from '@operato/property-editor'
8
+ import board from './reducers/board'
9
+ import { store } from '@things-factory/shell'
12
10
 
13
11
  export default function bootstrap() {
14
12
  registerRenderer('board', BoardRenderer)
@@ -16,10 +14,7 @@ export default function bootstrap() {
16
14
 
17
15
  store.addReducers({ board })
18
16
 
19
- store.dispatch({
20
- type: ADD_MODELLER_EDITORS,
21
- editors: {
22
- 'board-selector': 'property-editor-board-selector'
23
- }
17
+ OxPropertyEditor.register({
18
+ 'board-selector': 'property-editor-board-selector'
24
19
  })
25
20
  }
@@ -1,23 +1,19 @@
1
- import { html, css } from 'lit-element'
2
- import { gqlContext } from '@things-factory/shell'
3
- import { connect } from 'pwa-helpers/connect-mixin.js'
4
- import gql from 'graphql-tag'
5
-
6
- import { saveAs } from 'file-saver'
7
-
8
- import { store, PageView, client } from '@things-factory/shell'
9
- import { togglefullscreen, isMacOS } from '@things-factory/utils'
10
-
11
- import { provider } from '../board-provider'
12
-
13
- import { ADD_MODELLER_EDITORS } from '@things-factory/modeller-ui'
14
- import { ADD_BOARD_COMPONENTS } from '../actions/board'
15
-
16
1
  import '../board-modeller/board-modeller'
17
2
  import '../board-modeller/edit-toolbar'
18
-
19
3
  import './things-scene-components.import'
4
+
5
+ import { PageView, client, store } from '@things-factory/shell'
6
+ import { css, html } from 'lit-element'
7
+ import { isMacOS, togglefullscreen } from '@things-factory/utils'
8
+
9
+ import { ADD_BOARD_COMPONENTS } from '../actions/board'
10
+ import { OxPropertyEditor } from '@operato/property-editor'
20
11
  import components from './things-scene-components-with-tools.import'
12
+ import { connect } from 'pwa-helpers/connect-mixin.js'
13
+ import gql from 'graphql-tag'
14
+ import { gqlContext } from '@things-factory/shell'
15
+ import { provider } from '../board-provider'
16
+ import { saveAs } from 'file-saver'
21
17
 
22
18
  const NOOP = () => {}
23
19
 
@@ -43,10 +39,7 @@ export class BoardModellerPage extends connect(store)(PageView) {
43
39
  })
44
40
  }
45
41
 
46
- store.dispatch({
47
- type: ADD_MODELLER_EDITORS,
48
- editors: addedEditors
49
- })
42
+ OxPropertyEditor.register(addedEditors)
50
43
 
51
44
  this.boardName = ''
52
45
  this.model = null
@@ -59,7 +52,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
59
52
  this.componentGroupList = []
60
53
  this.fonts = []
61
54
  this.board = null
62
- this.propertyEditor = []
63
55
  }
64
56
 
65
57
  static get properties() {
@@ -220,7 +212,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
220
212
 
221
213
  stateChanged(state) {
222
214
  this.baseUrl = state.route.rootPath
223
- this.propertyEditor = state.modeller.editors
224
215
 
225
216
  this.componentGroupList = state.board.templates
226
217
  this.fonts = state.font
@@ -274,7 +265,6 @@ export class BoardModellerPage extends connect(store)(PageView) {
274
265
  @save-model=${e => this.saveBoard()}
275
266
  .componentGroupList=${this.componentGroupList}
276
267
  .fonts=${this.fonts}
277
- .propertyEditor=${this.propertyEditor}
278
268
  .hideProperty=${this.hideProperty}
279
269
  >
280
270
  </board-modeller>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/board-ui",
3
- "version": "4.0.9",
3
+ "version": "4.0.13",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,25 +26,24 @@
26
26
  "dependencies": {
27
27
  "@material/mwc-list": "^0.25.3",
28
28
  "@material/mwc-select": "^0.25.3",
29
- "@operato/board": "^0.2.35",
29
+ "@operato/board": "^0.2.43",
30
+ "@operato/popup": "^0.2.43",
30
31
  "@polymer/iron-icon": "^3.0.1",
31
32
  "@polymer/iron-icons": "^3.0.1",
32
33
  "@polymer/paper-button": "^3.0.1",
33
- "@polymer/paper-dialog": "^3.0.1",
34
- "@polymer/paper-dialog-scrollable": "^3.0.1",
35
34
  "@polymer/paper-dropdown-menu": "^3.0.1",
36
35
  "@polymer/paper-icon-button": "^3.0.2",
37
36
  "@polymer/paper-item": "^3.0.1",
38
37
  "@polymer/paper-listbox": "^3.0.1",
39
38
  "@polymer/paper-menu-button": "^3.0.1",
40
39
  "@polymer/paper-slider": "^3.0.1",
41
- "@things-factory/barcode-base": "^4.0.9",
42
- "@things-factory/grist-ui": "^4.0.9",
43
- "@things-factory/help": "^4.0.9",
44
- "@things-factory/i18n-base": "^4.0.9",
45
- "@things-factory/modeller-ui": "^4.0.9",
40
+ "@things-factory/barcode-base": "^4.0.13",
41
+ "@things-factory/grist-ui": "^4.0.13",
42
+ "@things-factory/help": "^4.0.13",
43
+ "@things-factory/i18n-base": "^4.0.13",
44
+ "@things-factory/modeller-ui": "^4.0.13",
46
45
  "file-saver": "^2.0.2",
47
46
  "sortablejs": "^1.10.2"
48
47
  },
49
- "gitHead": "81c8ae24487cfe79da62717f12bb6752761911ae"
48
+ "gitHead": "a542fdd4e7c447c3b571fe91c92f5919561bdc2c"
50
49
  }
@@ -1,3 +0,0 @@
1
- console.warn('deprecated, use @things-factory/modeller-ui')
2
-
3
- export { ThingsEditorProperty, ThingsEditorPropertyStyles } from '@things-factory/modeller-ui'