@operato/board 1.0.10 → 1.0.11

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.11",
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": "5c27775cfd67303afdfaa6f0838287c987ec0f3e"
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"
@@ -96,7 +94,24 @@ 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 id="input" value-key="input" .value=${input} list="input-list" />
101
+ <datalist id="input-list">
102
+ ${this._getTargetList(action).map(item => html` <option .value=${item}></option> `)}
103
+ </datalist>
104
+ ${
105
+ /* currently 'goto' does not support returning result */
106
+ action?.includes('popup')
107
+ ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
108
+ <label for="checkbox-output" class="checkbox-label">
109
+ <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
110
+ </label>`
111
+ : html``
112
+ }
113
+ `
114
+ : action === 'data-set' || action === 'value-set' || action === 'start-scenario' || action === 'run-scenario'
100
115
  ? html`
101
116
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
102
117
  <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
@@ -107,9 +122,6 @@ class PropertyEventTap extends LitElement {
107
122
 
108
123
  _getPlaceHoder(action: string) {
109
124
  switch (action) {
110
- case 'popup':
111
- case 'goto':
112
- return 'SCENE-100'
113
125
  case 'link-open':
114
126
  case 'link-move':
115
127
  return 'http://www.hatiolab.com/'
@@ -135,6 +147,8 @@ class PropertyEventTap extends LitElement {
135
147
  return ids
136
148
  case 'infoWindow':
137
149
  case 'toggle-info-window':
150
+ case 'popup':
151
+ case 'modal-popup':
138
152
  return (
139
153
  (this.scene &&
140
154
  this.scene.ids
@@ -163,9 +177,27 @@ class PropertyEventTap extends LitElement {
163
177
  return
164
178
  }
165
179
 
166
- this.value = {
167
- ...this.value,
168
- [key]: convert(element)
180
+ if (key === 'input' || key === 'output') {
181
+ var { options = {} } = this.value || {}
182
+
183
+ this.value = {
184
+ ...this.value,
185
+ options: {
186
+ ...options,
187
+ [key]: convert(element)
188
+ }
189
+ }
190
+ } else {
191
+ this.value = {
192
+ ...this.value,
193
+ [key]: convert(element)
194
+ }
195
+ }
196
+
197
+ var { action } = this.value
198
+ if (action !== 'goto' && !action?.includes('popup')) {
199
+ /* clear unused options */
200
+ delete this.value.options
169
201
  }
170
202
 
171
203
  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) {