@operato/process 1.4.41 → 1.4.43

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/process",
3
- "version": "1.4.41",
3
+ "version": "1.4.43",
4
4
  "description": "Webcomponent for business process modeling following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "main": "dist/src/index.js",
@@ -69,7 +69,7 @@
69
69
  "dependencies": {
70
70
  "@open-wc/scoped-elements": "^2.1.3",
71
71
  "@operato/app": "^1.4.39",
72
- "@operato/board": "^1.4.41",
72
+ "@operato/board": "^1.4.43",
73
73
  "@operato/data-grist": "^1.4.39",
74
74
  "@operato/font": "^1.4.39",
75
75
  "@operato/graphql": "^1.4.20",
@@ -128,5 +128,5 @@
128
128
  "prettier --write"
129
129
  ]
130
130
  },
131
- "gitHead": "f08abc45b71c195fb3b8e4db2d001acc8f7fe40a"
131
+ "gitHead": "5d18365d3ce6a8832a78bb3cfdca6c25947604d6"
132
132
  }
@@ -72,16 +72,6 @@ export class EditToolbar extends LitElement {
72
72
  .addEventListener('tap', this.onTapFontDecrease.bind(this) as EventListener)
73
73
  this.renderRoot.querySelector('#group')!.addEventListener('tap', this.onTapGroup.bind(this) as EventListener)
74
74
  this.renderRoot.querySelector('#ungroup')!.addEventListener('tap', this.onTapUngroup.bind(this) as EventListener)
75
- this.renderRoot
76
- .querySelector('#symmetry-x')!
77
- .addEventListener('tap', this.onTapSymmetryX.bind(this) as EventListener)
78
- this.renderRoot
79
- .querySelector('#symmetry-y')!
80
- .addEventListener('tap', this.onTapSymmetryY.bind(this) as EventListener)
81
- this.renderRoot.querySelector('#rotate-cw')!.addEventListener('tap', this.onTapRotateCW.bind(this) as EventListener)
82
- this.renderRoot
83
- .querySelector('#rotate-ccw')!
84
- .addEventListener('tap', this.onTapRotateCCW.bind(this) as EventListener)
85
75
  this.renderRoot
86
76
  .querySelector('#toggle-property')!
87
77
  .addEventListener('tap', this.onTapToggle.bind(this) as EventListener)
@@ -194,14 +184,6 @@ export class EditToolbar extends LitElement {
194
184
 
195
185
  <span class="vline"></span>
196
186
 
197
- <span button id="symmetry-x" title="symmetry-x (${this.getShortcutString('alt', 'shift', 'x')})"> </span>
198
- <span button id="symmetry-y" title="symmetry-y (${this.getShortcutString('alt', 'shift', 'y')})"> </span>
199
- <span button id="rotate-cw" title="rotate clockwise (${this.getShortcutString('alt', 'shift', 'e')})"> </span>
200
- <span button id="rotate-ccw" title="rotate counter clockwise (${this.getShortcutString('alt', 'shift', 'w')})">
201
- </span>
202
-
203
- <span class="vline"></span>
204
-
205
187
  <span button id="group" title="group (${this.getShortcutString('cmd', 'g')})"> </span>
206
188
  <span button id="ungroup" title="ungroup (${this.getShortcutString('cmd', 'shift', 'g')})"> </span>
207
189
 
@@ -292,7 +274,6 @@ export class EditToolbar extends LitElement {
292
274
  break
293
275
  case 'KeyY':
294
276
  if (ctrlKey && !shiftKey) this.onTapRedo()
295
- else if (altKey && shiftKey) this.onTapSymmetryY()
296
277
  break
297
278
  case 'KeyC':
298
279
  if (ctrlKey && !shiftKey) this.onTapCopy()
@@ -300,7 +281,6 @@ export class EditToolbar extends LitElement {
300
281
  break
301
282
  case 'KeyX':
302
283
  if (ctrlKey && !shiftKey) this.onTapCut()
303
- else if (altKey && shiftKey) this.onTapSymmetryX()
304
284
  break
305
285
  case 'KeyV':
306
286
  if (ctrlKey && !shiftKey) {
@@ -361,9 +341,6 @@ export class EditToolbar extends LitElement {
361
341
  case 'KeyT':
362
342
  if (altKey && shiftKey) this.onTapAlign('top')
363
343
  break
364
- case 'KeyY':
365
- if (altKey && shiftKey) this.onTapSymmetryY()
366
- break
367
344
  case 'KeyD':
368
345
  if (ctrlKey) {
369
346
  this.onTapFitScene()
@@ -371,11 +348,7 @@ export class EditToolbar extends LitElement {
371
348
  }
372
349
  break
373
350
  case 'KeyE':
374
- if (altKey && shiftKey) this.onTapRotateCW()
375
- else if (ctrlKey && shiftKey) this.onTapDownloadModel()
376
- break
377
- case 'KeyW':
378
- if (altKey && shiftKey) this.onTapRotateCCW()
351
+ if (ctrlKey && shiftKey) this.onTapDownloadModel()
379
352
  break
380
353
  case 'Digit1':
381
354
  if (ctrlKey) {
@@ -550,48 +523,6 @@ export class EditToolbar extends LitElement {
550
523
  zorder && this.scene.zorder(zorder)
551
524
  }
552
525
 
553
- onTapSymmetryX() {
554
- this.scene && this.scene.symmetryX()
555
- }
556
-
557
- onTapSymmetryY() {
558
- this.scene && this.scene.symmetryY()
559
- }
560
-
561
- onTapRotateCW() {
562
- if (!this.scene) return
563
-
564
- var selected = this.scene.selected
565
- if (selected.length && selected[0].isRootModel()) return
566
-
567
- this.scene.undoableChange(function () {
568
- selected.forEach(function (component) {
569
- var rotation = component.get('rotation')
570
-
571
- if (!rotation) rotation = 0
572
-
573
- component.set('rotation', (rotation + Math.PI / 2) % (Math.PI * 2))
574
- })
575
- })
576
- }
577
-
578
- onTapRotateCCW() {
579
- if (!this.scene) return
580
-
581
- var selected = this.scene.selected
582
- if (selected.length && selected[0].isRootModel()) return
583
-
584
- this.scene.undoableChange(function () {
585
- selected.forEach(function (component) {
586
- var rotation = component.get('rotation')
587
-
588
- if (!rotation) rotation = 0
589
-
590
- component.set('rotation', (rotation - Math.PI / 2) % (Math.PI * 2))
591
- })
592
- })
593
- }
594
-
595
526
  onTapGroup() {
596
527
  this.scene && this.scene.group()
597
528
  }
@@ -2,9 +2,11 @@ import '@operato/input/ox-input-search.js'
2
2
 
3
3
  import { css, html, LitElement, PropertyValues, TemplateResult } from 'lit'
4
4
  import { property, state } from 'lit/decorators.js'
5
- import Sortable from 'sortablejs'
6
5
 
6
+ // TODO test Sortable
7
+ // import Sortable from 'sortablejs'
7
8
  import { i18next } from '@operato/i18n'
9
+
8
10
  import { Component, Container, Scene } from '@hatiolab/things-scene'
9
11
 
10
12
  export class SceneInspector extends LitElement {
@@ -122,6 +124,7 @@ export class SceneInspector extends LitElement {
122
124
 
123
125
  private _extendedMap: any
124
126
  private show: boolean = false
127
+ private count: number = -1
125
128
 
126
129
  disconnectScene(scene?: Scene) {
127
130
  if (scene) {
@@ -140,11 +143,13 @@ export class SceneInspector extends LitElement {
140
143
  }
141
144
 
142
145
  render() {
146
+ this.count = 0
147
+
143
148
  return html`
144
149
  <ox-input-search
145
150
  .placeholder=${i18next.t('text.search with type, id or tag')}
146
151
  autofocus
147
- @change=${(e: Event) => (this.searchText = (e.target as HTMLInputElement).value)}
152
+ @change=${(e: Event) => (this.searchText = ((e.target as HTMLInputElement).value || '').toLowerCase())}
148
153
  ></ox-input-search>
149
154
 
150
155
  <div result>${!this.scene ? html`` : this.renderComponent(this.scene.root, 0)}</div>
@@ -191,35 +196,38 @@ export class SceneInspector extends LitElement {
191
196
  }
192
197
  }
193
198
 
194
- this.updateComplete.then(() => {
195
- this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {
196
- new Sortable(sortable as HTMLElement, this.sortableConfig)
197
- })
198
- })
199
+ // TODO test Sortable
200
+ // this.updateComplete.then(() => {
201
+ // this.renderRoot.querySelectorAll('[sortable]').forEach(sortable => {
202
+ // new Sortable(sortable as HTMLElement, this.sortableConfig)
203
+ // })
204
+ // })
199
205
  }
200
206
 
201
- sortableConfig: Sortable.Options = {
202
- group: 'inspector',
203
- animation: 150,
204
- draggable: '.component',
205
- swapThreshold: 1,
206
- onSort: this.onSort.bind(this)
207
- }
207
+ // TODO test Sortable
208
+ // sortableConfig: Sortable.Options = {
209
+ // group: 'inspector',
210
+ // animation: 150,
211
+ // draggable: '.component',
212
+ // swapThreshold: 1,
213
+ // onSort: this.onSort.bind(this)
214
+ // }
208
215
 
209
- onSort(e: Sortable.SortableEvent) {
210
- if (!this.scene) return
216
+ // TODO test Sortable
217
+ // onSort(e: Sortable.SortableEvent) {
218
+ // if (!this.scene) return
211
219
 
212
- var component = (e.item as HTMLElement & { component: Component }).component
213
- var to_container = (e.to as HTMLElement & { component: Component }).component as Container
214
- var to_index = e.newIndex! - 1
220
+ // var component = (e.item as HTMLElement & { component: Component }).component
221
+ // var to_container = (e.to as HTMLElement & { component: Component }).component as Container
222
+ // var to_index = e.newIndex! - 1
215
223
 
216
- this.scene.move(component, to_container, to_index)
224
+ // this.scene.move(component, to_container, to_index)
217
225
 
218
- this.show = false
219
- this.updateComplete.then(() => {
220
- this.show = true
221
- })
222
- }
226
+ // this.show = false
227
+ // this.updateComplete.then(() => {
228
+ // this.show = true
229
+ // })
230
+ // }
223
231
 
224
232
  _onclick(e: MouseEvent) {
225
233
  e.stopPropagation()
@@ -245,7 +253,7 @@ export class SceneInspector extends LitElement {
245
253
  this.toggleExtended(component)
246
254
  }
247
255
 
248
- this.selectComponent(component)
256
+ this.selectComponent(component, e.shiftKey)
249
257
  } else {
250
258
  if (classList.contains('inspector')) {
251
259
  this.show = !this.show
@@ -317,20 +325,33 @@ export class SceneInspector extends LitElement {
317
325
  this.requestUpdate()
318
326
  }
319
327
 
320
- selectComponent(component: Component) {
321
- this.scene!.selected = [component]
328
+ selectComponent(component: Component, append: boolean = false) {
329
+ this.scene!.selected = append ? [...this.scene!.selected, component] : [component]
330
+
331
+ component.trigger('reactionreset')
332
+ component.trigger('reaction')
322
333
 
323
334
  this.requestUpdate()
324
335
  }
325
336
 
326
- shouldBeShown(component: Component): boolean {
337
+ shouldBeShown(component: Component, counting: boolean = false): boolean {
327
338
  const { type, name, id, tag } = component.state
339
+ const found =
340
+ !this.searchText || `${type} ${name || ''} ${id || ''} ${tag || ''}`.toLowerCase().search(this.searchText) > -1
341
+
342
+ if (counting && found) {
343
+ this.count++
344
+ }
345
+
346
+ if (counting) {
347
+ console.log(found)
348
+ }
349
+
350
+ const foundChildren = ((component as Container).components || []).filter((child: Component) =>
351
+ this.shouldBeShown(child, counting)
352
+ ).length
328
353
 
329
- return !!(
330
- !this.searchText ||
331
- `${type} ${name || ''} ${id || ''} ${tag || ''}`.search(this.searchText) > -1 ||
332
- ((component as Container).components || []).find((child: Component) => this.shouldBeShown(child))
333
- )
354
+ return !!(found || foundChildren > 0)
334
355
  }
335
356
 
336
357
  renderComponent(component: Component, depth: number): TemplateResult {
@@ -338,7 +359,7 @@ export class SceneInspector extends LitElement {
338
359
  return html``
339
360
  }
340
361
 
341
- if (!this.shouldBeShown(component)) {
362
+ if (!this.shouldBeShown(component, depth == 0)) {
342
363
  return html``
343
364
  }
344
365
 
@@ -365,9 +386,8 @@ export class SceneInspector extends LitElement {
365
386
 
366
387
  <span class=${this.getNodeHandleClass(component)}> </span>
367
388
 
368
- <span class="type">${depth == 0 ? 'ROOT' : type}</span> ${name
369
- ? html` <span class="name">${name}</span> `
370
- : html``}
389
+ <span class="type">${depth == 0 ? html`ROOT(count: ${this.count})` : type}</span>
390
+ ${name ? html` <span class="name">${name}</span> ` : html``}
371
391
  </span>
372
392
 
373
393
  ${extended.map(child => this.renderComponent(child, depth + 1))}