@operato/process 1.4.41 → 1.4.42

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.42",
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.42",
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": "3e8f072f9711f2a72892a757bfdd13e4057f1c69"
132
132
  }
@@ -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()
@@ -320,17 +328,30 @@ export class SceneInspector extends LitElement {
320
328
  selectComponent(component: Component) {
321
329
  this.scene!.selected = [component]
322
330
 
331
+ component.trigger('reactionreset')
332
+ component.trigger('reaction')
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))}