@operato/board 1.0.10 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@operato/board",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -78,7 +78,7 @@
78
78
  "devDependencies": {
79
79
  "@custom-elements-manifest/analyzer": "^0.4.17",
80
80
  "@hatiolab/prettier-config": "^1.0.0",
81
- "@hatiolab/things-scene": "^3.0.19",
81
+ "@hatiolab/things-scene": "^3.0.22",
82
82
  "@material/mwc-fab": "^0.26.1",
83
83
  "@material/mwc-icon": "^0.26.1",
84
84
  "@open-wc/eslint-config": "^4.3.0",
@@ -114,5 +114,5 @@
114
114
  "prettier --write"
115
115
  ]
116
116
  },
117
- "gitHead": "94b3293141c884cf9d05303e4232cceacbffc577"
117
+ "gitHead": "708bac1eb001bd2aad5b289056031b841558eba6"
118
118
  }
@@ -224,7 +224,8 @@ export default class DataBindingMapper extends LitElement {
224
224
  />
225
225
  <datalist id="target-list">
226
226
  <option value="(self)"></option>
227
- <option value="[key]"></option>
227
+ <option value="(key)"></option>
228
+ <option value="[propkey]"></option>
228
229
  ${this._componentIds.length
229
230
  ? html`
230
231
  ${this._componentIds.map(
@@ -29,7 +29,8 @@ class PropertyEventTap extends LitElement {
29
29
  }
30
30
 
31
31
  render() {
32
- var { action, value = '', target = '', pressed } = this.value || {}
32
+ var { action, value = '', target = '', pressed, options } = this.value || {}
33
+ var { input = '(self)', output = true } = options || {}
33
34
 
34
35
  return html`
35
36
  <input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
@@ -53,12 +54,9 @@ class PropertyEventTap extends LitElement {
53
54
  <option value="link-open">open new window for target link</option>
54
55
  <option value="link-move">move to target link</option>
55
56
  <option value="route-page">route to page</option>
56
- <option value="popup">popup target board with data</option>
57
- <option value="popup-with-value">popup target board with value</option>
58
- <option value="modal-popup">modal popup target board with data</option>
59
- <option value="modal-popup-with-value">modal popup target board with value</option>
57
+ <option value="popup">popup target board</option>
58
+ <option value="modal-popup">modal popup target board</option>
60
59
  <option value="close-scene">close current board</option>
61
- <option value="close-scene-silently">close current board silently</option>
62
60
  <option value="infoWindow">open infowindow</option>
63
61
  <option value="toggle-info-window">toggle infowindow</option>
64
62
  <option value="data-toggle">toggle(true/false) target component data</option>
@@ -71,7 +69,7 @@ class PropertyEventTap extends LitElement {
71
69
 
72
70
  <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
73
71
 
74
- ${action === 'goto' || action.includes('popup')
72
+ ${action === 'goto' || action?.includes('popup')
75
73
  ? html`
76
74
  <things-editor-board-selector
77
75
  value-key="target"
@@ -86,7 +84,7 @@ class PropertyEventTap extends LitElement {
86
84
  list="target-list"
87
85
  .placeholder=${this._getPlaceHoder(action)}
88
86
  @focusin=${() => {
89
- this.targetList = this._getTargetList(action)
87
+ this.targetList = this._getInputList(action)
90
88
  }}
91
89
  />
92
90
 
@@ -96,7 +94,34 @@ class PropertyEventTap extends LitElement {
96
94
  )}
97
95
  </datalist>
98
96
  `}
99
- ${action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
97
+ ${action === 'goto' || action?.includes('popup')
98
+ ? html`
99
+ <label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
100
+ <input
101
+ id="input"
102
+ value-key="input"
103
+ .value=${input}
104
+ list="input-list"
105
+ @focusin=${() => {
106
+ this.targetList = this._getInputList(action)
107
+ }}
108
+ />
109
+ <datalist id="input-list">
110
+ ${this.targetList.map(
111
+ ({ value, description }) => html` <option .value=${value}>${description}</option> `
112
+ )}
113
+ </datalist>
114
+ ${
115
+ /* currently 'goto' does not support returning result */
116
+ action?.includes('popup')
117
+ ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
118
+ <label for="checkbox-output" class="checkbox-label">
119
+ <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
120
+ </label>`
121
+ : html``
122
+ }
123
+ `
124
+ : action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
100
125
  ? html`
101
126
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
102
127
  <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
@@ -107,9 +132,6 @@ class PropertyEventTap extends LitElement {
107
132
 
108
133
  _getPlaceHoder(action: string) {
109
134
  switch (action) {
110
- case 'popup':
111
- case 'goto':
112
- return 'SCENE-100'
113
135
  case 'link-open':
114
136
  case 'link-move':
115
137
  return 'http://www.hatiolab.com/'
@@ -118,12 +140,14 @@ class PropertyEventTap extends LitElement {
118
140
  }
119
141
  }
120
142
 
121
- _getTargetList(action: string): { value: string; description: string }[] {
143
+ _getInputList(action: string): { value: string; description: string }[] {
122
144
  switch (action) {
123
145
  case 'data-toggle':
124
146
  case 'data-tristate':
125
147
  case 'data-set':
126
148
  case 'value-set':
149
+ case 'popup':
150
+ case 'modal-popup':
127
151
  let ids =
128
152
  (this.scene &&
129
153
  this.scene.ids.map(i => {
@@ -163,9 +187,27 @@ class PropertyEventTap extends LitElement {
163
187
  return
164
188
  }
165
189
 
166
- this.value = {
167
- ...this.value,
168
- [key]: convert(element)
190
+ if (key === 'input' || key === 'output') {
191
+ var { options = {} } = this.value || {}
192
+
193
+ this.value = {
194
+ ...this.value,
195
+ options: {
196
+ ...options,
197
+ [key]: convert(element)
198
+ }
199
+ }
200
+ } else {
201
+ this.value = {
202
+ ...this.value,
203
+ [key]: convert(element)
204
+ }
205
+ }
206
+
207
+ var { action } = this.value
208
+ if (action !== 'goto' && !action?.includes('popup')) {
209
+ /* clear unused options */
210
+ delete this.value.options
169
211
  }
170
212
 
171
213
  this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
@@ -422,8 +422,10 @@ export class BoardViewer extends LitElement {
422
422
  )
423
423
  }
424
424
 
425
- onLinkGoto(targetBoardId: string, value: any, fromComponent: Component) {
426
- this.showScene(targetBoardId, fromComponent.data)
425
+ onLinkGoto(targetBoardId: string, options: any, fromComponent: any) {
426
+ const { input, output } = options || { input: '(self)' }
427
+ const data = input && fromComponent.root.findFirst(input, fromComponent)?.data
428
+ this.showScene(targetBoardId, data)
427
429
  }
428
430
 
429
431
  onLinkOpen(url: string, value: any, fromComponent: Component) {