@things-factory/scene-form 5.0.0-alpha.9 → 5.0.0-zeta.1
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 +3 -3
- package/README.md +0 -15
- package/assets/button.png +0 -0
- package/assets/fieldset.png +0 -0
- package/assets/form.png +0 -0
- package/assets/icon-embed.png +0 -0
- package/assets/icon-radio-group.png +0 -0
- package/assets/icon-video.png +0 -0
- package/assets/iframe.png +0 -0
- package/assets/img.png +0 -0
- package/assets/input-checkbox.png +0 -0
- package/assets/input-color.png +0 -0
- package/assets/input-date.png +0 -0
- package/assets/input-email.png +0 -0
- package/assets/input-file.png +0 -0
- package/assets/input-number.png +0 -0
- package/assets/input-password.png +0 -0
- package/assets/input-radio.png +0 -0
- package/assets/input-range.png +0 -0
- package/assets/input-reset.png +0 -0
- package/assets/input-search.png +0 -0
- package/assets/input-submit.png +0 -0
- package/assets/input-text.png +0 -0
- package/assets/link.png +0 -0
- package/assets/select.png +0 -0
- package/assets/textarea.png +0 -0
- package/helps/scene/component/input.ko.md +0 -59
- package/helps/scene/component/input.md +0 -59
- package/helps/scene/component/input.zh.md +0 -58
- package/src/button.js +0 -34
- package/src/checkbox.js +0 -103
- package/src/div.js +0 -27
- package/src/embed.js +0 -47
- package/src/fieldset.js +0 -48
- package/src/form.js +0 -245
- package/src/iframe.js +0 -41
- package/src/img.js +0 -41
- package/src/index.js +0 -27
- package/src/input-color.js +0 -53
- package/src/input-date.js +0 -62
- package/src/input-file.js +0 -44
- package/src/input-number.js +0 -69
- package/src/input-submit.js +0 -39
- package/src/input.js +0 -204
- package/src/layout/grid-layout.js +0 -116
- package/src/link.js +0 -75
- package/src/radio-group.js +0 -70
- package/src/radio.js +0 -102
- package/src/select.js +0 -172
- package/src/soap-client.js +0 -213
- package/src/template.js +0 -99
- package/src/textarea.js +0 -85
- package/src/video.js +0 -139
- package/templates/index.js +0 -271
- package/test/basic-test.html +0 -61
- package/test/index.html +0 -20
- package/test/soap/broker.js +0 -22
- package/test/soap/sample.wsdl +0 -94
- package/test/soap/soap-client.js +0 -13
- package/test/soap/soap-server.js +0 -51
- package/test/unit/test-form.js +0 -33
- package/test/unit/util.js +0 -22
- package/things-scene.config.js +0 -5
- package/translations/en.json +0 -15
- package/translations/ko.json +0 -16
- package/translations/ms.json +0 -14
- package/translations/zh.json +0 -15
package/src/form.js
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright � HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'select',
|
|
12
|
-
label: 'method',
|
|
13
|
-
name: 'method',
|
|
14
|
-
property: {
|
|
15
|
-
options: [
|
|
16
|
-
{
|
|
17
|
-
display: 'GET',
|
|
18
|
-
value: 'GET'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
display: 'POST',
|
|
22
|
-
value: 'POST'
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: 'string',
|
|
29
|
-
label: 'action',
|
|
30
|
-
name: 'action'
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: 'number',
|
|
34
|
-
label: 'period',
|
|
35
|
-
name: 'period'
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: 'string',
|
|
39
|
-
label: 'name',
|
|
40
|
-
name: 'name'
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: 'string',
|
|
44
|
-
label: 'authorization',
|
|
45
|
-
name: 'authorization'
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
type: 'select',
|
|
49
|
-
label: 'format',
|
|
50
|
-
name: 'format',
|
|
51
|
-
property: {
|
|
52
|
-
options: [
|
|
53
|
-
{
|
|
54
|
-
display: 'JSON',
|
|
55
|
-
value: 'JSON'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
display: 'XML',
|
|
59
|
-
value: 'XML'
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
display: 'TEXT',
|
|
63
|
-
value: 'TEXT'
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: 'select',
|
|
70
|
-
label: 'content-type',
|
|
71
|
-
name: 'contentType',
|
|
72
|
-
property: {
|
|
73
|
-
options: [
|
|
74
|
-
{
|
|
75
|
-
display: 'JSON',
|
|
76
|
-
value: 'application/json'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
display: 'FORM',
|
|
80
|
-
value: 'application/x-www-form-urlencoded'
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
display: 'TEXT',
|
|
84
|
-
value: 'text/plain'
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: 'checkbox',
|
|
91
|
-
label: 'with-credentials',
|
|
92
|
-
name: 'withCredentials'
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: 'checkbox',
|
|
96
|
-
label: 'submit-on-load',
|
|
97
|
-
name: 'submitOnLoad'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: 'checkbox',
|
|
101
|
-
label: 'debug',
|
|
102
|
-
name: 'debug'
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
'value-property': 'action'
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
import { Component, HTMLOverlayContainer, warn } from '@hatiolab/things-scene'
|
|
109
|
-
import { xml2js } from 'xml-js'
|
|
110
|
-
|
|
111
|
-
export default class Form extends HTMLOverlayContainer {
|
|
112
|
-
dispose() {
|
|
113
|
-
super.dispose()
|
|
114
|
-
this._stopRepeater()
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
setElementProperties(form) {
|
|
118
|
-
var { action = '', method = 'POST', name = '', contentType = '' } = this.state
|
|
119
|
-
|
|
120
|
-
form.action = action
|
|
121
|
-
form.method = method
|
|
122
|
-
form.contentType = contentType
|
|
123
|
-
form.name = name
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
get action() {
|
|
127
|
-
return this.state.action
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
set action(action) {
|
|
131
|
-
this.setState('action', action)
|
|
132
|
-
this._startRepeater()
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
get period() {
|
|
136
|
-
return this.state.period * 1000
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
set period(period) {
|
|
140
|
-
this.setState('period', period)
|
|
141
|
-
this._startRepeater()
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
_startRepeater() {
|
|
145
|
-
this._stopRepeater()
|
|
146
|
-
|
|
147
|
-
if (!this.app.isViewMode) return
|
|
148
|
-
|
|
149
|
-
if (this.period) {
|
|
150
|
-
this._repeatInterval = setInterval(this._submit.bind(this), this.period)
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
_stopRepeater() {
|
|
155
|
-
if (this._repeatInterval) clearInterval(this._repeatInterval)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
_onload(e) {
|
|
159
|
-
var result = e.target.response
|
|
160
|
-
try {
|
|
161
|
-
switch (this.get('format')) {
|
|
162
|
-
case 'JSON':
|
|
163
|
-
result = JSON.parse(result)
|
|
164
|
-
break
|
|
165
|
-
case 'XML':
|
|
166
|
-
result = xml2js(result, {
|
|
167
|
-
compact: true
|
|
168
|
-
})
|
|
169
|
-
break
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (this.state.debug) {
|
|
173
|
-
console.log('[FORM-RESULT]', result)
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
this.setState('data', result)
|
|
177
|
-
} catch (e) {
|
|
178
|
-
console.error(e)
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
oncreate_element(form) {
|
|
183
|
-
if (!this.app.isViewMode) return
|
|
184
|
-
|
|
185
|
-
var _ = e => {
|
|
186
|
-
e.preventDefault()
|
|
187
|
-
var url = form.action
|
|
188
|
-
var xhr = new XMLHttpRequest()
|
|
189
|
-
|
|
190
|
-
var params = [].filter
|
|
191
|
-
.call(form.elements, function(el) {
|
|
192
|
-
if (el.type == 'radio' || el.type == 'checkbox') return el.checked
|
|
193
|
-
return true
|
|
194
|
-
})
|
|
195
|
-
.filter(function(el) {
|
|
196
|
-
return !!el.name
|
|
197
|
-
})
|
|
198
|
-
.filter(function(el) {
|
|
199
|
-
return !el.disabled
|
|
200
|
-
})
|
|
201
|
-
.map(function(el) {
|
|
202
|
-
return encodeURIComponent(el.name) + '=' + encodeURIComponent(el.value)
|
|
203
|
-
})
|
|
204
|
-
.join('&')
|
|
205
|
-
|
|
206
|
-
xhr.onloadend = this._onload.bind(this)
|
|
207
|
-
|
|
208
|
-
if (form.method == 'get') xhr.open(form.method, url + '?' + params)
|
|
209
|
-
else xhr.open(form.method, url)
|
|
210
|
-
|
|
211
|
-
if (form.contentType) xhr.setRequestHeader('Content-Type', form.contentType)
|
|
212
|
-
|
|
213
|
-
if (this.get('authorization')) xhr.setRequestHeader('Authorization', this.get('authorization'))
|
|
214
|
-
|
|
215
|
-
if (this.get('withCredentials')) xhr.withCredentials = true
|
|
216
|
-
|
|
217
|
-
if (form.method == 'get') xhr.send()
|
|
218
|
-
else xhr.send(params)
|
|
219
|
-
|
|
220
|
-
return false
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
form.onsubmit = _
|
|
224
|
-
|
|
225
|
-
if (this.getState('submitOnLoad')) {
|
|
226
|
-
setTimeout(this._submit.bind(this), 100)
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
this._startRepeater()
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
_submit() {
|
|
233
|
-
this.element.dispatchEvent(
|
|
234
|
-
new Event('submit', {
|
|
235
|
-
cancelable: true
|
|
236
|
-
})
|
|
237
|
-
)
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
get nature() {
|
|
241
|
-
return NATURE
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
Component.register('form', Form)
|
package/src/iframe.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'src',
|
|
13
|
-
name: 'src'
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
'value-property': 'src'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
import { Component, HTMLOverlayElement } from '@hatiolab/things-scene'
|
|
20
|
-
|
|
21
|
-
export default class IFrame extends HTMLOverlayElement {
|
|
22
|
-
get src() {
|
|
23
|
-
return this.getState('src')
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
set src(src) {
|
|
27
|
-
this.setState('src', src)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
setElementProperties(iframe) {
|
|
31
|
-
var { src = '' } = this.state
|
|
32
|
-
|
|
33
|
-
if (iframe.src != src) iframe.src = src
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get nature() {
|
|
37
|
-
return NATURE
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Component.register('iframe', IFrame)
|
package/src/img.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'src',
|
|
13
|
-
name: 'src'
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
'value-property': 'src'
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
import { Component, HTMLOverlayElement } from '@hatiolab/things-scene'
|
|
20
|
-
|
|
21
|
-
export default class Img extends HTMLOverlayElement {
|
|
22
|
-
setElementProperties(img) {
|
|
23
|
-
var { src = '' } = this.state
|
|
24
|
-
|
|
25
|
-
if (img.src != src) img.src = src
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
get src() {
|
|
29
|
-
return this.get('src')
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
set src(src) {
|
|
33
|
-
this.set('src', src)
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
get nature() {
|
|
37
|
-
return NATURE
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
Component.register('img', Img)
|
package/src/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export { default as Form } from './form'
|
|
6
|
-
export { default as FieldSet } from './fieldset'
|
|
7
|
-
export { default as Select } from './select'
|
|
8
|
-
export { default as TextArea } from './textarea'
|
|
9
|
-
export { default as Button } from './button'
|
|
10
|
-
export { default as Radio } from './radio'
|
|
11
|
-
export { default as CheckBox } from './checkbox'
|
|
12
|
-
export { default as IFrame } from './iframe'
|
|
13
|
-
export { default as Img } from './img'
|
|
14
|
-
export { default as Video } from './video'
|
|
15
|
-
export { default as Embed } from './embed'
|
|
16
|
-
export { default as Link } from './link'
|
|
17
|
-
export { default as Div } from './div'
|
|
18
|
-
|
|
19
|
-
export { default as Input } from './input'
|
|
20
|
-
export { default as InputNumber } from './input-number'
|
|
21
|
-
export { default as InputDate } from './input-date'
|
|
22
|
-
export { default as InputFile } from './input-file'
|
|
23
|
-
export { default as InputColor } from './input-color'
|
|
24
|
-
export { default as InputSubmit } from './input-submit'
|
|
25
|
-
export { default as RadioGroup } from './radio-group'
|
|
26
|
-
|
|
27
|
-
export { default as Template } from './template'
|
package/src/input-color.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'name',
|
|
13
|
-
name: 'name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'color',
|
|
17
|
-
label: 'value',
|
|
18
|
-
name: 'text',
|
|
19
|
-
property: {
|
|
20
|
-
withoutAlpha: true,
|
|
21
|
-
valueType: 'hex'
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: 'checkbox',
|
|
26
|
-
label: 'submit-on-change',
|
|
27
|
-
name: 'submitOnChange'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: 'checkbox',
|
|
31
|
-
label: 'spread-on-init',
|
|
32
|
-
name: 'spreadOnInit'
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
'value-property': 'text'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
import { Component } from '@hatiolab/things-scene'
|
|
39
|
-
import Input from './input'
|
|
40
|
-
import TinyColor from 'tinycolor2'
|
|
41
|
-
|
|
42
|
-
export default class InputColor extends Input {
|
|
43
|
-
get nature() {
|
|
44
|
-
return NATURE
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
setElementProperties(element) {
|
|
48
|
-
this.value = TinyColor(this.value || '#000000').toHexString()
|
|
49
|
-
super.setElementProperties(element)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
Component.register('input-color', InputColor)
|
package/src/input-date.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'name',
|
|
13
|
-
name: 'name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'date',
|
|
17
|
-
label: 'value',
|
|
18
|
-
name: 'text'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'date',
|
|
22
|
-
label: 'min',
|
|
23
|
-
name: 'min'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'date',
|
|
27
|
-
label: 'max',
|
|
28
|
-
name: 'max'
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: 'checkbox',
|
|
32
|
-
label: 'submit-on-change',
|
|
33
|
-
name: 'submitOnChange'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'checkbox',
|
|
37
|
-
label: 'spread-on-init',
|
|
38
|
-
name: 'spreadOnInit'
|
|
39
|
-
}
|
|
40
|
-
],
|
|
41
|
-
'value-property': 'text'
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
import { Component } from '@hatiolab/things-scene'
|
|
45
|
-
import Input from './input'
|
|
46
|
-
|
|
47
|
-
export default class InputDate extends Input {
|
|
48
|
-
get nature() {
|
|
49
|
-
return NATURE
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
setElementProperties(element) {
|
|
53
|
-
super.setElementProperties(element)
|
|
54
|
-
|
|
55
|
-
var { min, max } = this.state
|
|
56
|
-
|
|
57
|
-
element.min = min
|
|
58
|
-
element.max = max
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
Component.register('input-date', InputDate)
|
package/src/input-file.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'name',
|
|
13
|
-
name: 'name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'string',
|
|
17
|
-
label: 'value',
|
|
18
|
-
name: 'text'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'checkbox',
|
|
22
|
-
label: 'multiple',
|
|
23
|
-
name: 'multiple'
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
'value-property': 'text'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
import { Component } from '@hatiolab/things-scene'
|
|
30
|
-
import Input from './input'
|
|
31
|
-
|
|
32
|
-
export default class InputFile extends Input {
|
|
33
|
-
get nature() {
|
|
34
|
-
return NATURE
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
setElementProperties(element) {
|
|
38
|
-
super.setElementProperties(element)
|
|
39
|
-
|
|
40
|
-
element.multiple = !!this.state.multiple
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
Component.register('input-file', InputFile)
|
package/src/input-number.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'name',
|
|
13
|
-
name: 'name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'number',
|
|
17
|
-
label: 'value',
|
|
18
|
-
name: 'text'
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: 'number',
|
|
22
|
-
label: 'min',
|
|
23
|
-
name: 'min'
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
type: 'number',
|
|
27
|
-
label: 'max',
|
|
28
|
-
name: 'max'
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
type: 'number',
|
|
32
|
-
label: 'step',
|
|
33
|
-
name: 'step'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
type: 'checkbox',
|
|
37
|
-
label: 'submit-on-change',
|
|
38
|
-
name: 'submitOnChange'
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
type: 'checkbox',
|
|
42
|
-
label: 'spread-on-init',
|
|
43
|
-
name: 'spreadOnInit'
|
|
44
|
-
}
|
|
45
|
-
],
|
|
46
|
-
'value-property': 'text'
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
import { Component } from '@hatiolab/things-scene'
|
|
50
|
-
import Input from './input'
|
|
51
|
-
|
|
52
|
-
export default class InputNumber extends Input {
|
|
53
|
-
get nature() {
|
|
54
|
-
return NATURE
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
setElementProperties(element) {
|
|
58
|
-
super.setElementProperties(element)
|
|
59
|
-
|
|
60
|
-
var { min = 0, max = 100, step = 1 } = this.state
|
|
61
|
-
|
|
62
|
-
element.min = min
|
|
63
|
-
element.max = max
|
|
64
|
-
element.step = step
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
Component.register('input-number', InputNumber)
|
|
69
|
-
Component.register('input-range', InputNumber)
|
package/src/input-submit.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
const NATURE = {
|
|
6
|
-
mutable: false,
|
|
7
|
-
resizable: true,
|
|
8
|
-
rotatable: true,
|
|
9
|
-
properties: [
|
|
10
|
-
{
|
|
11
|
-
type: 'string',
|
|
12
|
-
label: 'name',
|
|
13
|
-
name: 'name'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'string',
|
|
17
|
-
label: 'value',
|
|
18
|
-
name: 'text'
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
'value-property': 'text'
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
import { Component } from '@hatiolab/things-scene'
|
|
25
|
-
import Input from './input'
|
|
26
|
-
|
|
27
|
-
export default class InputSubmit extends Input {
|
|
28
|
-
get nature() {
|
|
29
|
-
return NATURE
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
setElementProperties(element) {
|
|
33
|
-
super.setElementProperties(element)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
Component.register('input-button', InputSubmit)
|
|
38
|
-
Component.register('input-submit', InputSubmit)
|
|
39
|
-
Component.register('input-reset', InputSubmit)
|