@operato/board 1.0.26 → 1.0.28

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -56,15 +56,15 @@
56
56
  },
57
57
  "dependencies": {
58
58
  "@open-wc/scoped-elements": "^2.0.0-next.6",
59
- "@operato/app": "^1.0.25",
59
+ "@operato/app": "^1.0.28",
60
60
  "@operato/data-grist": "^1.0.25",
61
- "@operato/font": "^1.0.25",
61
+ "@operato/font": "^1.0.28",
62
62
  "@operato/graphql": "^1.0.23",
63
63
  "@operato/i18n": "^1.0.6",
64
64
  "@operato/input": "^1.0.25",
65
65
  "@operato/markdown": "^1.0.23",
66
66
  "@operato/popup": "^1.0.23",
67
- "@operato/property-editor": "^1.0.25",
67
+ "@operato/property-editor": "^1.0.28",
68
68
  "@operato/styles": "^1.0.23",
69
69
  "@operato/utils": "^1.0.6",
70
70
  "@polymer/paper-dropdown-menu": "^3.2.0",
@@ -116,5 +116,5 @@
116
116
  "prettier --write"
117
117
  ]
118
118
  },
119
- "gitHead": "b8aa0bf37d1f502c3937880b5965c273486258f4"
119
+ "gitHead": "06f098c3f958a4014d0de62069ff9e9f8cb050e7"
120
120
  }
@@ -410,11 +410,11 @@ export class EditToolbar extends LitElement {
410
410
  }
411
411
 
412
412
  onSceneChanged(after?: Scene, before?: Scene) {
413
- // if (before) {
414
- // before.off('execute', this.onExecute, this)
415
- // before.off('undo', this.onUndo, this)
416
- // before.off('redo', this.onRedo, this)
417
- // }
413
+ if (before) {
414
+ before.off('execute', this.onExecute, this)
415
+ before.off('undo', this.onUndo, this)
416
+ before.off('redo', this.onRedo, this)
417
+ }
418
418
 
419
419
  if (after) {
420
420
  after.on('execute', this.onExecute, this)
@@ -7,6 +7,7 @@ import '@operato/input/ox-input-value-ranges.js'
7
7
  import '@operato/input/ox-buttons-radio.js'
8
8
  import '@operato/input/ox-input-code.js'
9
9
  import '@operato/i18n/ox-i18n.js'
10
+ import '@operato/help/ox-help-icon.js'
10
11
 
11
12
  import { css, html, LitElement, PropertyValues } from 'lit'
12
13
  import { property, query, state } from 'lit/decorators.js'
@@ -195,7 +196,7 @@ export class DataBindingMapper extends LitElement {
195
196
  }
196
197
 
197
198
  return html`
198
- <label for="accessor-input"> <ox-i18n msgid="label.accessor">accessor</ox-i18n> </label>
199
+ <label for="accessor-input"> <ox-i18n msgid="label.accessor">accessor</ox-i18n><ox-help-icon topic="board-modeller/accessor"> </label>
199
200
  <input
200
201
  id="accessor-input"
201
202
  value-key="accessor"
@@ -225,13 +226,15 @@ export class DataBindingMapper extends LitElement {
225
226
  <option value="(self)"></option>
226
227
  <option value="(key)"></option>
227
228
  <option value="[propkey]"></option>
228
- ${this._componentIds.length
229
- ? html`
230
- ${this._componentIds.map(
231
- ({ value, description }) => html` <option value=${value}>${description}</option> `
232
- )}
233
- `
234
- : html``}
229
+ ${
230
+ this._componentIds.length
231
+ ? html`
232
+ ${this._componentIds.map(
233
+ ({ value, description }) => html` <option value=${value}>${description}</option> `
234
+ )}
235
+ `
236
+ : html``
237
+ }
235
238
  </datalist>
236
239
 
237
240
  <label for="property-input"> <ox-i18n msgid="label.property">property</ox-i18n> </label>
@@ -109,65 +109,69 @@ export class SceneInspector extends LitElement {
109
109
  private _extendedMap: any
110
110
  private show: boolean = false
111
111
 
112
+ disconnectScene(scene?: Scene) {
113
+ if (scene) {
114
+ scene.off('selected', undefined, this)
115
+ scene.off('execute', undefined, this)
116
+ scene.off('undo', undefined, this)
117
+ scene.off('redo', undefined, this)
118
+ }
119
+ }
120
+
121
+ disconnectedCallback() {
122
+ super.disconnectedCallback()
123
+
124
+ this.disconnectScene(this.scene)
125
+ delete this._extendedMap
126
+ }
127
+
112
128
  render() {
113
129
  return html`
114
130
  <ox-input-search
115
131
  @change=${(e: Event) => (this.searchText = (e.target as HTMLInputElement).value)}
116
132
  ></ox-input-search>
133
+
117
134
  <div result>${!this.scene ? html`` : this.renderComponent(this.scene.root, 0)}</div>
118
135
  `
119
136
  }
120
137
 
121
138
  firstUpdated() {
122
139
  dispatchEvent(new Event('resize'))
140
+
123
141
  this.renderRoot.addEventListener('click', this._onclick.bind(this) as EventListener)
124
142
  this.renderRoot.addEventListener('dblclick', this._ondblclick.bind(this) as EventListener)
125
143
  }
126
144
 
145
+ refresh() {
146
+ let selected = this.scene?.selected || []
147
+
148
+ selected.forEach(component => {
149
+ let parent = component.parent
150
+ while (parent && !this.extendedMap.get(parent)) {
151
+ this.extendedMap.set(parent, true)
152
+ parent = parent.parent
153
+ }
154
+ })
155
+
156
+ this.requestUpdate()
157
+ }
158
+
127
159
  updated(change: PropertyValues<this>) {
128
160
  if (change.has('scene')) {
129
161
  let oldScene = change.get('scene') as Scene
130
162
 
131
163
  if (oldScene) {
132
- oldScene.off('selected')
133
- oldScene.off('execute')
134
- oldScene.off('undo')
135
- oldScene.off('redo')
136
-
164
+ this.disconnectScene(oldScene)
137
165
  delete this._extendedMap
138
166
  }
139
167
 
140
168
  if (this.scene && this.scene.root) {
141
- // root 는 기본상태가 extended 되도록 하기위해서임.
142
- this.extendedMap.set(this.scene.root, true)
143
-
144
- this.scene.on('selected', (after: Component[], before: Component[]) => {
145
- let selected = after
146
-
147
- selected.forEach(component => {
148
- let parent = component.parent
149
- while (parent && !this.extendedMap.get(parent)) {
150
- this.extendedMap.set(parent, true)
151
- parent = parent.parent
152
- }
153
- })
154
-
155
- this.refresh()
156
- })
157
-
158
- this.scene.on('execute', () => {
159
- this.refresh()
160
- })
161
-
162
- this.scene.on('undo', () => {
163
- this.extendedMap.set(this.scene!.root, true)
164
- this.refresh()
165
- })
166
-
167
- this.scene.on('redo', () => {
168
- this.extendedMap.set(this.scene!.root, true)
169
- this.refresh()
170
- })
169
+ this.scene.on('selected', this.refresh, this)
170
+ this.scene.on('execute', this.refresh, this)
171
+ this.scene.on('undo', this.refresh, this)
172
+ this.scene.on('redo', this.refresh, this)
173
+
174
+ this.refresh()
171
175
  }
172
176
  }
173
177
 
@@ -178,10 +182,6 @@ export class SceneInspector extends LitElement {
178
182
  })
179
183
  }
180
184
 
181
- refresh() {
182
- this.scene && this.requestUpdate()
183
- }
184
-
185
185
  sortableConfig: Sortable.Options = {
186
186
  group: 'inspector',
187
187
  animation: 150,
@@ -205,13 +205,6 @@ export class SceneInspector extends LitElement {
205
205
  })
206
206
  }
207
207
 
208
- disconnectedCallback() {
209
- super.disconnectedCallback()
210
-
211
- this.scene = undefined
212
- this._extendedMap = undefined
213
- }
214
-
215
208
  _onclick(e: MouseEvent) {
216
209
  e.stopPropagation()
217
210
 
@@ -244,7 +237,7 @@ export class SceneInspector extends LitElement {
244
237
  }
245
238
  }
246
239
 
247
- this.refresh()
240
+ this.requestUpdate()
248
241
  }
249
242
 
250
243
  _ondblclick(e: MouseEvent) {
@@ -267,13 +260,12 @@ export class SceneInspector extends LitElement {
267
260
  this.toggleExtended(component)
268
261
  }
269
262
 
270
- this.refresh()
263
+ this.requestUpdate()
271
264
  }
272
265
 
273
266
  get extendedMap() {
274
267
  if (!this._extendedMap) {
275
268
  this._extendedMap = new WeakMap()
276
- this._extendedMap.set(this.scene!.root, true)
277
269
  }
278
270
 
279
271
  return this._extendedMap
@@ -300,19 +292,19 @@ export class SceneInspector extends LitElement {
300
292
  this.extendedMap.set(component, !extended)
301
293
  }
302
294
 
303
- this.refresh()
295
+ this.requestUpdate()
304
296
  }
305
297
 
306
298
  toggleHidden(component: Component) {
307
299
  component.set('hidden', !component.hidden)
308
300
 
309
- this.refresh()
301
+ this.requestUpdate()
310
302
  }
311
303
 
312
304
  selectComponent(component: Component) {
313
305
  this.scene!.selected = [component]
314
306
 
315
- this.refresh()
307
+ this.requestUpdate()
316
308
  }
317
309
 
318
310
  shouldBeShown(component: Component): boolean {