@operato/process 1.1.4 → 1.1.6

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/src/modeller/property-sidebar/effects/effects.d.ts +2 -0
  3. package/dist/src/modeller/property-sidebar/effects/effects.js +6 -1
  4. package/dist/src/modeller/property-sidebar/effects/effects.js.map +1 -1
  5. package/dist/src/modeller/property-sidebar/effects/property-event-hover.d.ts +20 -0
  6. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js +127 -0
  7. package/dist/src/modeller/property-sidebar/effects/property-event-hover.js.map +1 -0
  8. package/dist/src/modeller/property-sidebar/effects/property-event-tap.d.ts +28 -0
  9. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js +199 -0
  10. package/dist/src/modeller/property-sidebar/effects/property-event-tap.js.map +1 -0
  11. package/dist/src/modeller/property-sidebar/effects/property-event.d.ts +22 -0
  12. package/dist/src/modeller/property-sidebar/effects/property-event.js +67 -0
  13. package/dist/src/modeller/property-sidebar/effects/property-event.js.map +1 -0
  14. package/dist/src/modeller/property-sidebar/property-sidebar.d.ts +2 -0
  15. package/dist/src/modeller/property-sidebar/property-sidebar.js +7 -0
  16. package/dist/src/modeller/property-sidebar/property-sidebar.js.map +1 -1
  17. package/dist/src/modeller/property-sidebar/shapes/shapes.d.ts +5 -7
  18. package/dist/src/modeller/property-sidebar/shapes/shapes.js +84 -17
  19. package/dist/src/modeller/property-sidebar/shapes/shapes.js.map +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +7 -7
  22. package/src/modeller/property-sidebar/effects/effects.ts +6 -1
  23. package/src/modeller/property-sidebar/effects/property-event-hover.ts +140 -0
  24. package/src/modeller/property-sidebar/effects/property-event-tap.ts +208 -0
  25. package/src/modeller/property-sidebar/effects/property-event.ts +76 -0
  26. package/src/modeller/property-sidebar/property-sidebar.ts +7 -0
  27. package/src/modeller/property-sidebar/shapes/shapes.ts +85 -18
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/process",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Webcomponent for business process modeling following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -52,15 +52,15 @@
52
52
  },
53
53
  "dependencies": {
54
54
  "@open-wc/scoped-elements": "^2.1.3",
55
- "@operato/app": "^1.1.4",
56
- "@operato/data-grist": "^1.1.4",
57
- "@operato/font": "^1.1.4",
55
+ "@operato/app": "^1.1.5",
56
+ "@operato/data-grist": "^1.1.5",
57
+ "@operato/font": "^1.1.5",
58
58
  "@operato/graphql": "^1.1.1",
59
59
  "@operato/i18n": "^1.1.4",
60
- "@operato/input": "^1.1.4",
60
+ "@operato/input": "^1.1.5",
61
61
  "@operato/markdown": "^1.1.1",
62
62
  "@operato/popup": "^1.1.1",
63
- "@operato/property-editor": "^1.1.4",
63
+ "@operato/property-editor": "^1.1.5",
64
64
  "@operato/styles": "^1.1.1",
65
65
  "@operato/utils": "^1.1.1",
66
66
  "@polymer/paper-dropdown-menu": "^3.2.0",
@@ -111,5 +111,5 @@
111
111
  "prettier --write"
112
112
  ]
113
113
  },
114
- "gitHead": "5e8f9e367988de6a19794b287c616afca11d9092"
114
+ "gitHead": "a9107bdc1b3e5e0cb0a345f45d41a4077a515bfe"
115
115
  }
@@ -13,6 +13,7 @@ import { ScopedElementsMixin } from '@open-wc/scoped-elements'
13
13
 
14
14
  import { AbstractProperty } from '../abstract-property.js'
15
15
  import { PropertySharedStyle } from '../property-shared-style.js'
16
+ import { PropertyEvent } from './property-event.js'
16
17
  import { PropertyShadow } from './property-shadow.js'
17
18
 
18
19
  export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
@@ -27,7 +28,8 @@ export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
27
28
 
28
29
  static get scopedElements() {
29
30
  return {
30
- 'process-property-shadow': PropertyShadow
31
+ 'process-property-shadow': PropertyShadow,
32
+ 'process-property-event': PropertyEvent
31
33
  }
32
34
  }
33
35
 
@@ -42,6 +44,9 @@ export class PropertyEffects extends ScopedElementsMixin(AbstractProperty) {
42
44
 
43
45
  <process-property-shadow value-key="shadow" .value=${value.shadow || {}}> </process-property-shadow>
44
46
  </fieldset>
47
+
48
+ <process-property-event value-key="event" .scene=${this.scene} .value=${value.event || {}}>
49
+ </process-property-event>
45
50
  `
46
51
  }
47
52
  }
@@ -0,0 +1,140 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/input/ox-input-data.js'
6
+ import '@operato/i18n/ox-i18n.js'
7
+
8
+ import { html, LitElement } from 'lit'
9
+ import { property } from 'lit/decorators.js'
10
+
11
+ import { Properties, Scene } from '@hatiolab/things-scene'
12
+
13
+ import { EffectsSharedStyle } from './effects-shared-style.js'
14
+ import { convert } from './value-converter'
15
+
16
+ export class PropertyEventHover extends LitElement {
17
+ static styles = [EffectsSharedStyle]
18
+
19
+ @property({ type: Object }) value?: Properties
20
+ @property({ type: Object }) scene?: Scene
21
+
22
+ firstUpdated() {
23
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
24
+ }
25
+
26
+ render() {
27
+ var { action, value = '', target = '', emphasize, restore } = this.value || {}
28
+
29
+ return html`
30
+ <input id="checkbox-emphasize" type="checkbox" value-key="emphasize" .checked=${emphasize} />
31
+ <label for="checkbox-emphasize" class="checkbox-label">
32
+ <ox-i18n msgid="label.emphasize">emphasize</ox-i18n>
33
+ </label>
34
+
35
+ <label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
36
+ <select id="tap-select" value-key="action" .value=${action || ''}>
37
+ <option value=""></option>
38
+ <option value="popup">popup target board</option>
39
+ </select>
40
+
41
+ <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
42
+
43
+ ${action == 'popup'
44
+ ? html`
45
+ <things-editor-board-selector
46
+ value-key="target"
47
+ .value=${target}
48
+ custom-editor
49
+ ></things-editor-board-selector>
50
+ `
51
+ : html`
52
+ <input
53
+ value-key="target"
54
+ .value=${target || ''}
55
+ list="target-list"
56
+ .placeholder="${this._getPlaceHoder(action)}"
57
+ />
58
+
59
+ <datalist id="target-list">
60
+ ${this._getTargetList(action).map(
61
+ ({ value, description }) => html` <option .value=${value}>${description}</option> `
62
+ )}
63
+ </datalist>
64
+ `}
65
+ ${action == 'data-set' || action == 'value-set'
66
+ ? html`
67
+ <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
68
+ <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
69
+ `
70
+ : html``}
71
+
72
+ <input id="checkbox-restore" type="checkbox" value-key="restore" .checked=${restore} />
73
+ <label for="checkbox-restore" class="checkbox-label">
74
+ <ox-i18n msgid="label.restore-on-leave">restore on leave</ox-i18n>
75
+ </label>
76
+ `
77
+ }
78
+
79
+ _getPlaceHoder(action: string) {
80
+ switch (action) {
81
+ case 'popup':
82
+ case 'goto':
83
+ return 'SCENE-100'
84
+ case 'link-open':
85
+ case 'link-move':
86
+ return 'http://www.hatiolab.com/'
87
+ default:
88
+ return ''
89
+ }
90
+ }
91
+
92
+ _getTargetList(action: string): { value: string; description: string }[] {
93
+ switch (action) {
94
+ case 'data-toggle':
95
+ case 'data-tristate':
96
+ case 'data-set':
97
+ case 'value-set':
98
+ let ids =
99
+ (this.scene &&
100
+ this.scene.ids.map(i => {
101
+ const id = i.key
102
+ return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
103
+ })) ||
104
+ []
105
+ ids.unshift({ value: '(self)', description: 'self component' })
106
+ return ids
107
+ case 'infoWindow':
108
+ return (
109
+ (this.scene &&
110
+ this.scene.ids
111
+ .filter(i => {
112
+ return this.scene!.findById(i.key).get('type') == 'info-window'
113
+ })
114
+ .map(i => {
115
+ const id = i.key
116
+ return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
117
+ })) ||
118
+ []
119
+ )
120
+ default:
121
+ return []
122
+ }
123
+ }
124
+
125
+ _onValueChange(e: Event) {
126
+ var element = e.target as HTMLElement
127
+ var key = element.getAttribute('value-key')
128
+
129
+ if (!key) {
130
+ return
131
+ }
132
+
133
+ this.value = {
134
+ ...this.value,
135
+ [key]: convert(element)
136
+ }
137
+
138
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
139
+ }
140
+ }
@@ -0,0 +1,208 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/input/ox-input-data.js'
6
+ import '@operato/i18n/ox-i18n.js'
7
+
8
+ import { html, LitElement } from 'lit'
9
+ import { property, state } from 'lit/decorators.js'
10
+
11
+ import { Properties, Scene } from '@hatiolab/things-scene'
12
+
13
+ import { scenarios } from '../../../graphql/scenario'
14
+ import { EffectsSharedStyle } from './effects-shared-style'
15
+ import { convert } from './value-converter'
16
+
17
+ export class PropertyEventTap extends LitElement {
18
+ static styles = [EffectsSharedStyle]
19
+
20
+ @property({ type: Object }) value?: Properties
21
+ @property({ type: Object }) scene?: Scene
22
+
23
+ @state() scenarios: { value: string; description: string }[] = []
24
+ @state() targetList: { value: string; description: string }[] = []
25
+
26
+ async firstUpdated() {
27
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
28
+ }
29
+
30
+ render() {
31
+ var { action, value = '', target = '', pressed, options } = this.value || {}
32
+ var { input = '(self)', output = true } = options || {}
33
+
34
+ return html`
35
+ <input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
36
+ <label for="checkbox-pressed" class="checkbox-label"> <ox-i18n msgid="label.pressed">pressed</ox-i18n> </label>
37
+
38
+ <label> <ox-i18n msgid="label.action">action</ox-i18n> </label>
39
+ <select
40
+ id="tap-select"
41
+ value-key="action"
42
+ .value=${action || ''}
43
+ @change=${async (e: Event) => {
44
+ if ((e.target as HTMLSelectElement).value === 'start-scenario') {
45
+ this.scenarios = (await scenarios()).map(({ name, description }) => {
46
+ return { value: name, description }
47
+ })
48
+ }
49
+ }}
50
+ >
51
+ <option value=""></option>
52
+ <option value="goto">go to target board</option>
53
+ <option value="link-open">open new window for target link</option>
54
+ <option value="link-move">move to target link</option>
55
+ <option value="route-page">route to page</option>
56
+ <option value="popup">popup target board</option>
57
+ <option value="modal-popup">modal popup target board</option>
58
+ <option value="close-scene">close current board</option>
59
+ <option value="infoWindow">open infowindow</option>
60
+ <option value="toggle-info-window">toggle infowindow</option>
61
+ </select>
62
+
63
+ <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
64
+
65
+ ${action === 'goto' || action?.includes('popup')
66
+ ? html`
67
+ <things-editor-board-selector
68
+ value-key="target"
69
+ .value=${target}
70
+ custom-editor
71
+ ></things-editor-board-selector>
72
+ `
73
+ : html`
74
+ <input
75
+ value-key="target"
76
+ .value=${target}
77
+ list="target-list"
78
+ .placeholder=${this._getPlaceHoder(action)}
79
+ @focusin=${() => {
80
+ this.targetList = this._getInputList(action)
81
+ }}
82
+ />
83
+
84
+ <datalist id="target-list">
85
+ ${this.targetList.map(
86
+ ({ value, description }) => html` <option .value=${value}>${description}</option> `
87
+ )}
88
+ </datalist>
89
+ `}
90
+ ${action === 'goto' || action?.includes('popup')
91
+ ? html`
92
+ <label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
93
+ <input
94
+ id="input"
95
+ value-key="input"
96
+ .value=${input}
97
+ list="input-list"
98
+ @focusin=${() => {
99
+ this.targetList = this._getInputList(action)
100
+ }}
101
+ />
102
+ <datalist id="input-list">
103
+ ${this.targetList.map(
104
+ ({ value, description }) => html` <option .value=${value}>${description}</option> `
105
+ )}
106
+ </datalist>
107
+ ${
108
+ /* currently 'goto' does not support returning result */
109
+ action?.includes('popup')
110
+ ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
111
+ <label for="checkbox-output" class="checkbox-label">
112
+ <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
113
+ </label>`
114
+ : html``
115
+ }
116
+ `
117
+ : action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
118
+ ? html`
119
+ <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
120
+ <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
121
+ `
122
+ : html``}
123
+ `
124
+ }
125
+
126
+ _getPlaceHoder(action: string) {
127
+ switch (action) {
128
+ case 'link-open':
129
+ case 'link-move':
130
+ return 'http://www.hatiolab.com/'
131
+ default:
132
+ return ''
133
+ }
134
+ }
135
+
136
+ _getInputList(action: string): { value: string; description: string }[] {
137
+ switch (action) {
138
+ case 'data-toggle':
139
+ case 'data-tristate':
140
+ case 'data-set':
141
+ case 'value-set':
142
+ case 'popup':
143
+ case 'modal-popup':
144
+ let ids =
145
+ (this.scene &&
146
+ this.scene.ids.map(i => {
147
+ const id = i.key
148
+ return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
149
+ })) ||
150
+ []
151
+ ids.unshift({ value: '(self)', description: 'self component' })
152
+ return ids
153
+ case 'infoWindow':
154
+ case 'toggle-info-window':
155
+ return (
156
+ (this.scene &&
157
+ this.scene.ids
158
+ .filter(i => {
159
+ return this.scene!.findById(i.key).get('type') == 'info-window'
160
+ })
161
+ .map(i => {
162
+ const id = i.key
163
+ return { value: `#${id}`, description: this.scene!.findById(id)?.get('type') }
164
+ })) ||
165
+ []
166
+ )
167
+ case 'start-scenario':
168
+ case 'run-scenario':
169
+ return this.scenarios
170
+ default:
171
+ return []
172
+ }
173
+ }
174
+
175
+ _onValueChange(e: Event) {
176
+ var element = e.target as HTMLElement
177
+ var key = element.getAttribute('value-key')
178
+
179
+ if (!key) {
180
+ return
181
+ }
182
+
183
+ if (key === 'input' || key === 'output') {
184
+ var { options = {} } = this.value || {}
185
+
186
+ this.value = {
187
+ ...this.value,
188
+ options: {
189
+ ...options,
190
+ [key]: convert(element)
191
+ }
192
+ }
193
+ } else {
194
+ this.value = {
195
+ ...this.value,
196
+ [key]: convert(element)
197
+ }
198
+ }
199
+
200
+ var { action } = this.value
201
+ if (action !== 'goto' && !action?.includes('popup')) {
202
+ /* clear unused options */
203
+ delete this.value.options
204
+ }
205
+
206
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
207
+ }
208
+ }
@@ -0,0 +1,76 @@
1
+ /**
2
+ * @license Copyright © HatioLab Inc. All rights reserved.
3
+ */
4
+
5
+ import '@operato/help/ox-title-with-help.js'
6
+
7
+ import { html, LitElement } from 'lit'
8
+ import { property } from 'lit/decorators.js'
9
+
10
+ import { Properties, Scene } from '@hatiolab/things-scene'
11
+ import { ScopedElementsMixin } from '@open-wc/scoped-elements'
12
+
13
+ import { PropertySharedStyle } from '../property-shared-style'
14
+ import { PropertyEventHover } from './property-event-hover'
15
+ import { PropertyEventTap } from './property-event-tap'
16
+ import { convert } from './value-converter'
17
+
18
+ export class PropertyEvent extends ScopedElementsMixin(LitElement) {
19
+ static styles = [PropertySharedStyle]
20
+
21
+ @property({ type: Object }) value?: Properties
22
+ @property({ type: Object }) scene?: Scene
23
+
24
+ firstUpdated() {
25
+ this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
26
+ }
27
+
28
+ static get scopedElements() {
29
+ return {
30
+ 'property-event-hover': PropertyEventHover,
31
+ 'property-event-tap': PropertyEventTap
32
+ }
33
+ }
34
+
35
+ render() {
36
+ const value = this.value || {}
37
+
38
+ return html`
39
+ <fieldset>
40
+ <legend>
41
+ <ox-title-with-help
42
+ msgid="label.hover-event"
43
+ topic="process-modeller/effects/hover-event"
44
+ ></ox-title-with-help>
45
+ </legend>
46
+
47
+ <property-event-hover value-key="hover" .scene=${this.scene} .value=${value.hover || {}}>
48
+ </property-event-hover>
49
+ </fieldset>
50
+
51
+ <fieldset>
52
+ <legend>
53
+ <ox-title-with-help msgid="label.tap-event" topic="process-modeller/effects/tap-event"></ox-title-with-help>
54
+ </legend>
55
+
56
+ <property-event-tap value-key="tap" .scene=${this.scene} .value=${value.tap || {}}> </property-event-tap>
57
+ </fieldset>
58
+ `
59
+ }
60
+
61
+ _onValueChange(e: Event) {
62
+ var element = e.target as HTMLElement
63
+ var key = element.getAttribute('value-key')
64
+
65
+ if (!key) {
66
+ return
67
+ }
68
+
69
+ this.value = {
70
+ ...this.value,
71
+ [key]: convert(element)
72
+ }
73
+
74
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
75
+ }
76
+ }
@@ -12,6 +12,7 @@ import { BOUNDS, Component, Model, Scene } from '@hatiolab/things-scene'
12
12
  import { ScopedElementsMixin } from '@open-wc/scoped-elements'
13
13
  import { ScrollbarStyles } from '@operato/styles'
14
14
 
15
+ import { PropertyEffects } from './effects/effects.js'
15
16
  import { PropertyShapes } from './shapes/shapes.js'
16
17
  import { PropertySpecific } from './specifics/specifics.js'
17
18
  import { PropertyStyles } from './styles/styles.js'
@@ -96,6 +97,7 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
96
97
  return {
97
98
  'process-property-shape': PropertyShapes,
98
99
  'process-property-style': PropertyStyles,
100
+ 'process-property-effect': PropertyEffects,
99
101
  'process-property-specific': PropertySpecific,
100
102
  'process-scene-inspector': SceneInspector
101
103
  }
@@ -114,6 +116,7 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
114
116
  <mwc-icon name="specific" ?selected=${tabName == 'specific'}>tune</mwc-icon>
115
117
  <mwc-icon name="shape" ?selected=${tabName == 'shape'}>format_shapes</mwc-icon>
116
118
  <mwc-icon name="style" ?selected=${tabName == 'style'}>palette</mwc-icon>
119
+ <mwc-icon name="effect" ?selected=${tabName == 'effect'}>movie_filter</mwc-icon>
117
120
  <mwc-icon name="inspector" ?selected=${tabName == 'inspector'}>visibility</mwc-icon>
118
121
  </div>
119
122
 
@@ -149,6 +152,10 @@ export class PropertySidebar extends ScopedElementsMixin(LitElement) {
149
152
  >
150
153
  </process-property-style>
151
154
  `,
155
+ effect: html`
156
+ <process-property-effect .value=${this.model} .scene=${this.scene} ?active=${tabName == 'effect'}>
157
+ </process-property-effect>
158
+ `,
152
159
  inspector: html`
153
160
  <process-scene-inspector .scene=${this.scene} ?active=${tabName == 'inspector'}></process-scene-inspector>
154
161
  `