@operato/board 0.4.7 → 0.4.10

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": "0.4.7",
3
+ "version": "0.4.10",
4
4
  "description": "Webcomponent for board following open-wc recommendations",
5
5
  "author": "heartyoh",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "@operato/input": "^0.4.6",
56
56
  "@operato/markdown": "^0.4.6",
57
57
  "@operato/popup": "^0.4.6",
58
- "@operato/property-editor": "^0.4.6",
58
+ "@operato/property-editor": "^0.4.9",
59
59
  "@operato/styles": "^0.4.6",
60
60
  "@operato/utils": "^0.4.6",
61
61
  "@polymer/paper-dropdown-menu": "^3.2.0",
@@ -70,7 +70,7 @@
70
70
  "devDependencies": {
71
71
  "@custom-elements-manifest/analyzer": "^0.4.17",
72
72
  "@hatiolab/prettier-config": "^1.0.0",
73
- "@hatiolab/things-scene": "^2.8.2",
73
+ "@hatiolab/things-scene": "^2.8.6",
74
74
  "@material/mwc-fab": "^0.25.3",
75
75
  "@material/mwc-icon": "^0.25.3",
76
76
  "@open-wc/eslint-config": "^4.3.0",
@@ -106,5 +106,5 @@
106
106
  "prettier --write"
107
107
  ]
108
108
  },
109
- "gitHead": "abeb819898114d2d128a49906df8b289b83e0fa6"
109
+ "gitHead": "7cb0c0a4081888c3ba474376f2dce1d39d25b130"
110
110
  }
@@ -25,7 +25,8 @@ class PropertyEventTap extends LitElement {
25
25
  }
26
26
 
27
27
  render() {
28
- var { action, value = '', target = '', pressed } = this.value || {}
28
+ var { action, value = '', target = '', pressed, options } = this.value || {}
29
+ var { input = '(self)', output = true } = options || {}
29
30
 
30
31
  return html`
31
32
  <input id="checkbox-pressed" type="checkbox" value-key="pressed" .checked=${pressed} />
@@ -38,12 +39,9 @@ class PropertyEventTap extends LitElement {
38
39
  <option value="link-open">open new window for target link</option>
39
40
  <option value="link-move">move to target link</option>
40
41
  <option value="route-page">route to page</option>
41
- <option value="popup">popup target board with data</option>
42
- <option value="popup-with-value">popup target board with value</option>
43
- <option value="modal-popup">modal popup target board with data</option>
44
- <option value="modal-popup-with-value">modal popup target board with value</option>
42
+ <option value="popup">popup target board</option>
43
+ <option value="modal-popup">modal popup target board</option>
45
44
  <option value="close-scene">close current board</option>
46
- <option value="close-scene-silently">close current board silently</option>
47
45
  <option value="infoWindow">open infowindow</option>
48
46
  <option value="toggle-info-window">toggle infowindow</option>
49
47
  <option value="data-toggle">toggle(true/false) target component data</option>
@@ -54,7 +52,7 @@ class PropertyEventTap extends LitElement {
54
52
 
55
53
  <label> <ox-i18n msgid="label.target">target</ox-i18n> </label>
56
54
 
57
- ${action === 'goto' || action.includes('popup')
55
+ ${action === 'goto' || action?.includes('popup')
58
56
  ? html`
59
57
  <things-editor-board-selector
60
58
  value-key="target"
@@ -69,7 +67,27 @@ class PropertyEventTap extends LitElement {
69
67
  ${this._getTargetList(action).map(item => html` <option .value=${item}></option> `)}
70
68
  </datalist>
71
69
  `}
72
- ${action == 'data-set' || action == 'value-set'
70
+ ${action === 'goto' || action?.includes('popup')
71
+ ? html`
72
+ <label for="input"> <ox-i18n msgid="label.input-data">input</ox-i18n> </label>
73
+
74
+ <input id="input" value-key="input" .value=${input} list="input-list" />
75
+
76
+ <datalist id="input-list">
77
+ ${this._getTargetList(action).map(item => html` <option .value=${item}></option> `)}
78
+ </datalist>
79
+
80
+ ${
81
+ /* currently 'goto' does not support returning result */
82
+ action?.includes('popup')
83
+ ? html` <input id="checkbox-output" type="checkbox" value-key="output" .checked=${output} />
84
+ <label for="checkbox-output" class="checkbox-label">
85
+ <ox-i18n msgid="label.will-get-return">will-get-return</ox-i18n>
86
+ </label>`
87
+ : html``
88
+ }
89
+ `
90
+ : action == 'data-set' || action == 'value-set'
73
91
  ? html`
74
92
  <label> <ox-i18n msgid="label.value">value</ox-i18n> </label>
75
93
  <ox-input-data value-key="value" .value=${value} custom-editor fullwidth></ox-input-data>
@@ -80,9 +98,6 @@ class PropertyEventTap extends LitElement {
80
98
 
81
99
  _getPlaceHoder(action: string) {
82
100
  switch (action) {
83
- case 'popup':
84
- case 'goto':
85
- return 'SCENE-100'
86
101
  case 'link-open':
87
102
  case 'link-move':
88
103
  return 'http://www.hatiolab.com/'
@@ -97,6 +112,8 @@ class PropertyEventTap extends LitElement {
97
112
  case 'data-tristate':
98
113
  case 'data-set':
99
114
  case 'value-set':
115
+ case 'popup':
116
+ case 'modal-popup':
100
117
  let ids = (this.scene && this.scene.ids.map(i => `#${i.key}`)) || []
101
118
  ids.unshift('(self)')
102
119
  return ids
@@ -124,9 +141,27 @@ class PropertyEventTap extends LitElement {
124
141
  return
125
142
  }
126
143
 
127
- this.value = {
128
- ...this.value,
129
- [key]: convert(element)
144
+ if (key === 'input' || key === 'output') {
145
+ var { options = {} } = this.value || {}
146
+
147
+ this.value = {
148
+ ...this.value,
149
+ options: {
150
+ ...options,
151
+ [key]: convert(element)
152
+ }
153
+ }
154
+ } else {
155
+ this.value = {
156
+ ...this.value,
157
+ [key]: convert(element)
158
+ }
159
+ }
160
+
161
+ var { action } = this.value
162
+ if (action !== 'goto' && !action?.includes('popup')) {
163
+ /* clear unused options */
164
+ delete this.value.options
130
165
  }
131
166
 
132
167
  this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
@@ -352,7 +352,7 @@ class PropertyStyles extends AbstractProperty {
352
352
  beginSize,
353
353
  end,
354
354
  endSize
355
- } = this.value
355
+ } = this.value || {}
356
356
 
357
357
  return html`
358
358
  <fieldset>
@@ -401,8 +401,10 @@ export class BoardViewer extends LitElement {
401
401
  )
402
402
  }
403
403
 
404
- onLinkGoto(targetBoardId: string, value: any, fromComponent: any) {
405
- this.showScene(targetBoardId, fromComponent.data)
404
+ onLinkGoto(targetBoardId: string, options: any, fromComponent: any) {
405
+ const { input, output } = options || { input: '(self)' }
406
+ const data = input && fromComponent.root.findFirst(input, fromComponent)?.data
407
+ this.showScene(targetBoardId, data)
406
408
  }
407
409
 
408
410
  onLinkOpen(url: string, value: any, fromComponent: any) {