@operato/board 1.0.8 → 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.8",
3
+ "version": "1.0.11",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
56
56
  },
57
57
  "dependencies": {
58
- "@operato/app": "^1.0.8",
58
+ "@operato/app": "^1.0.9",
59
59
  "@operato/data-grist": "^1.0.8",
60
60
  "@operato/font": "^1.0.8",
61
61
  "@operato/graphql": "^1.0.6",
@@ -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": "21e1f15f77957ad9121075758fc5be9513baa945"
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} />
@@ -68,7 +69,7 @@ class PropertyEventTap extends LitElement {
68
69
 
69
70
  <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
70
71
 
71
- ${action === 'goto' || action === 'popup'
72
+ ${action === 'goto' || action?.includes('popup')
72
73
  ? html`
73
74
  <things-editor-board-selector
74
75
  value-key="target"
@@ -93,7 +94,24 @@ class PropertyEventTap extends LitElement {
93
94
  )}
94
95
  </datalist>
95
96
  `}
96
- ${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'
97
115
  ? html`
98
116
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
99
117
  <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
@@ -104,9 +122,6 @@ class PropertyEventTap extends LitElement {
104
122
 
105
123
  _getPlaceHoder(action: string) {
106
124
  switch (action) {
107
- case 'popup':
108
- case 'goto':
109
- return 'SCENE-100'
110
125
  case 'link-open':
111
126
  case 'link-move':
112
127
  return 'http://www.hatiolab.com/'
@@ -132,6 +147,8 @@ class PropertyEventTap extends LitElement {
132
147
  return ids
133
148
  case 'infoWindow':
134
149
  case 'toggle-info-window':
150
+ case 'popup':
151
+ case 'modal-popup':
135
152
  return (
136
153
  (this.scene &&
137
154
  this.scene.ids
@@ -160,9 +177,27 @@ class PropertyEventTap extends LitElement {
160
177
  return
161
178
  }
162
179
 
163
- this.value = {
164
- ...this.value,
165
- [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
166
201
  }
167
202
 
168
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) {