@things-factory/scene-restful 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 -13
- package/assets/restful.png +0 -0
- package/boards/boards.json +0 -12
- package/boards/groups.json +0 -7
- package/boards/models/SAMPLE.json +0 -70
- package/demo/index.html +0 -116
- package/demo/things-scene-restful.html +0 -5
- package/demo/things-theme.html +0 -178
- package/helps/scene/component/restful.ko.md +0 -12
- package/helps/scene/component/restful.md +0 -11
- package/helps/scene/component/restful.zh.md +0 -13
- package/src/index.js +0 -5
- package/src/jsonp.js +0 -79
- package/src/restful.js +0 -254
- package/test/basic-test.html +0 -67
- package/test/index.html +0 -24
- package/test/unit/test-restful.js +0 -33
- package/test/unit/util.js +0 -22
- package/things-scene.config.js +0 -21
- package/translations/en.json +0 -6
- package/translations/ko.json +0 -6
- package/translations/zh.json +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/scene-restful",
|
|
3
|
-
"version": "5.0.0-
|
|
3
|
+
"version": "5.0.0-zeta.1",
|
|
4
4
|
"description": "Restful Client Component for Things Scene",
|
|
5
5
|
"things-scene": true,
|
|
6
6
|
"browser": "src/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"directory": "packages/scene-restful"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@hatiolab/things-scene": "^2.
|
|
19
|
+
"@hatiolab/things-scene": "^2.8.2"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "7b69e48d7a0441c5dda884cc895914a6ae3b1c27"
|
|
22
22
|
}
|
package/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
## build
|
|
2
|
-
|
|
3
|
-
`$ yarn build`
|
|
4
|
-
|
|
5
|
-
| type | filename | for | tested |
|
|
6
|
-
| ---- | -------------------------- | -------------- | ------ |
|
|
7
|
-
| UMD | things-scene-restful.js | modern browser | O |
|
|
8
|
-
| UMD | things-scene-restful-ie.js | ie 11 | O |
|
|
9
|
-
| ESM | things-scene-restful.mjs | modern browser | O |
|
|
10
|
-
|
|
11
|
-
## publish
|
|
12
|
-
|
|
13
|
-
`$ yarn publish`
|
package/assets/restful.png
DELETED
|
Binary file
|
package/boards/boards.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"SAMPLE": {
|
|
3
|
-
"name": "SAMPLE",
|
|
4
|
-
"description": "",
|
|
5
|
-
"width": 1920,
|
|
6
|
-
"height": 1080,
|
|
7
|
-
"updatedAt": 1524117648813,
|
|
8
|
-
"createdAt": 1524110268095,
|
|
9
|
-
"group": "DEFAULT-GROUP",
|
|
10
|
-
"thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAADhCAYAAADmtuMcAAARIklEQVR4Xu3dbZCV5XkH8Os8uyiyy7KCWqqiVihirVA0MYzVRsmL1peQEF/itH7yJW2d6NhOtdRMRzqZdKJVnIk2mjGfbILRKio0VUuwppmYVjSjQpgoajA6JYq47LLI2zmnc7YBlUEXnt1z7r23v53xg+65n+vi93/kP885K1bCFwECBAgQKCFQKXHGEQIECBAgEArETUCAAAECpQQUSCk2hwgQIEBAgbgHCBAgQKCUgAIpxeYQAQIECCgQ9wABAgQIlBJQIKXYHCJAgAABBeIeIECAAIFSAgqkFJtDBAgQIKBA3AMECBAgUEpAgZRic4gAAQIEFIh7gAABAgRKCSiQUmwOESBAgIACcQ8QIECAQCkBBVKKzSECBAgQUCDuAQIECBAoJaBASrE5RIAAAQIKxD1AgAABAqUEFEgpNocIECBAQIG4BwgQIECglIACKcXmEAECBAgoEPcAAQIECJQSUCCl2BwiQIAAAQXiHiBAgACBUgIKpBSbQwQIECCgQNwDBAgQIFBKQIGUYnOIAAECBBSIe4AAAQIESgkokFJsDhEgQICAA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mnTpm91dnZ+MiLWbN68ua+zs/OUoiheaHy/t7e3p6Oj47D+/v71Dx5x7PT5b7zy4g8mTzu0Wmzpr7YfeE5tW/Gj+b9++c2P+qUrkIQ3htEECBAYTKBRILVqvf28l1bH8391fbz5k5/E9o3vPRyc9/KaeOXbd9c7p0+v/PdlX95dIF3d3dfWdu58LCIOrRXFuPai+ETUav/a29v7dFdX11X1SqWjb9OmmyNi3INHHHtEo0CWTJn22aISp9ajuurzr736Lw8fNfW6ea+9fNOH7ahABkvP9wkQIJBQYNcTyOfWvRS17dvjB8edUK/VYvfv3Y1/vvaf7oztPT2x9q7vvFcgXV1f6e3t/WbnhAlzi3r9D6Mo2urV6jcrlcofR8TESqWyPiJ+Z9OmTd94aMrUGyqVSi0q9faoV9qiEi9F1A+PHbVH6m2Vcz7/q1cW7Y1AgSS8MYwmQIDAYAK7CmTn9q0RtV0fWzQ+wmh81d77JKOIaB87bneBDHbd4fi+AhkORdcgQIBAkwQenjL1S2c8vmxGz/M/r3fNmFYZe8gh9a09PZX2sWPjgK7uOOCQibG9tzciilh23PHxxfWvD3wGctFFF51ZrxfjKpVaX0TbofV6vTsi1lerxaq2tvitoqhOKori6cWLF2+48MILJxdFMbvx97Va7aharX1HRG1CUdS2FUUxbvHixU96AmlSwC5LgACBZgo8OvPkk477m+tO7D7hhBjTPT6q/VtrbWPHVA7o6qqMmTSpWu3vj9rWHW0PHT/9gYveemvz/uxyySWXnLB48eLVe545//xLDlm6dPGGj7qWJ5D9kfZaAgQIENgtoEDcDAQIECBQSkCBlGJziAABAgQUiHuAAAECBEoJKJBSbA4RIECAgAJxDxAgQIBAKYH/Bc5VOg+wNnUeAAAAAElFTkSuQmCC"
|
|
11
|
-
}
|
|
12
|
-
}
|
package/boards/groups.json
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"width": 1920,
|
|
3
|
-
"height": 1080,
|
|
4
|
-
"type": "model-layer",
|
|
5
|
-
"translate": {
|
|
6
|
-
"x": 0,
|
|
7
|
-
"y": 264.53125
|
|
8
|
-
},
|
|
9
|
-
"scale": {
|
|
10
|
-
"x": 0.37864583333333335,
|
|
11
|
-
"y": 0.37864583333333335
|
|
12
|
-
},
|
|
13
|
-
"event": {
|
|
14
|
-
"hover": {},
|
|
15
|
-
"tap": {
|
|
16
|
-
"value": ""
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
|
-
"components": [
|
|
20
|
-
{
|
|
21
|
-
"type": "restful",
|
|
22
|
-
"xx": 0,
|
|
23
|
-
"left": 615.5295735900962,
|
|
24
|
-
"top": 281.36176066024746,
|
|
25
|
-
"width": 100,
|
|
26
|
-
"height": 100,
|
|
27
|
-
"hidden": false,
|
|
28
|
-
"dataFormat": "json",
|
|
29
|
-
"rotation": 0,
|
|
30
|
-
"url": "http://services.groupkt.com/country/get/iso2code/IN",
|
|
31
|
-
"withCredentials": true,
|
|
32
|
-
"period": 10,
|
|
33
|
-
"id": "rest"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"type": "rect",
|
|
37
|
-
"xx": 0,
|
|
38
|
-
"left": 1183.1636863823933,
|
|
39
|
-
"top": 270.79779917469045,
|
|
40
|
-
"width": 538.5832187070155,
|
|
41
|
-
"height": 100,
|
|
42
|
-
"fillStyle": "#fff",
|
|
43
|
-
"strokeStyle": "#000",
|
|
44
|
-
"alpha": 1,
|
|
45
|
-
"hidden": false,
|
|
46
|
-
"lineWidth": 1,
|
|
47
|
-
"lineDash": "solid",
|
|
48
|
-
"lineCap": "butt",
|
|
49
|
-
"rotation": 0,
|
|
50
|
-
"text": "URL",
|
|
51
|
-
"fontSize": 36,
|
|
52
|
-
"data": "https://httpbin.org/get",
|
|
53
|
-
"mappings": [
|
|
54
|
-
{
|
|
55
|
-
"rule": "value",
|
|
56
|
-
"target": "#rest",
|
|
57
|
-
"property": "value"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
"id": "url",
|
|
61
|
-
"event": {
|
|
62
|
-
"hover": {},
|
|
63
|
-
"tap": {
|
|
64
|
-
"target": "$url",
|
|
65
|
-
"value": "https://httpbin.org/get"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
}
|
package/demo/index.html
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
-->
|
|
5
|
-
<!doctype html>
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
-
<title>restful Demo</title>
|
|
11
|
-
<script src="../../webcomponentsjs/webcomponents-lite.min.js"></script>
|
|
12
|
-
|
|
13
|
-
<link rel="import" href="../../things-scene-viewer/things-scene-viewer.html">
|
|
14
|
-
<link rel="import" href="../../things-scene-viewer/things-scene-layer.html">
|
|
15
|
-
<link rel="import" href="../../things-scene-viewer/things-scene-handler.html">
|
|
16
|
-
|
|
17
|
-
<link rel="import" href="../../things-designer-elements/things-editor-properties.html">
|
|
18
|
-
|
|
19
|
-
<link rel="import" href="./things-scene-restful.html">
|
|
20
|
-
|
|
21
|
-
<link rel="import" href="./things-theme.html">
|
|
22
|
-
|
|
23
|
-
<style is="custom-style" include="things-theme">
|
|
24
|
-
things-scene-viewer {
|
|
25
|
-
display: block;
|
|
26
|
-
width: 640px;
|
|
27
|
-
height: 480px;
|
|
28
|
-
}
|
|
29
|
-
</style>
|
|
30
|
-
</head>
|
|
31
|
-
<body unresolved>
|
|
32
|
-
|
|
33
|
-
<template is="dom-bind" id="app">
|
|
34
|
-
<p>An example of <code><restful></code>:</p>
|
|
35
|
-
|
|
36
|
-
<things-scene-viewer id='scene'
|
|
37
|
-
scene='{{scene}}'
|
|
38
|
-
selected='{{selected}}'
|
|
39
|
-
model='[[model]]'
|
|
40
|
-
mode="0">
|
|
41
|
-
<things-scene-layer type="selection-layer"></things-scene-layer>
|
|
42
|
-
<things-scene-layer type="modeling-layer"></things-scene-layer>
|
|
43
|
-
<things-scene-handler type="text-editor"></things-scene-handler>
|
|
44
|
-
<things-scene-handler type="move-handler"></things-scene-handler>
|
|
45
|
-
</things-scene-viewer>
|
|
46
|
-
|
|
47
|
-
<p>Properties</p>
|
|
48
|
-
<things-editor-properties id='props' target="{{props}}" props="[[selected.0.nature.properties]]">
|
|
49
|
-
</things-editor-properties>
|
|
50
|
-
|
|
51
|
-
</template>
|
|
52
|
-
|
|
53
|
-
<script>
|
|
54
|
-
window.addEventListener('WebComponentsReady', function(e) {
|
|
55
|
-
var app = document.querySelector('#app')
|
|
56
|
-
|
|
57
|
-
app.props = {}
|
|
58
|
-
|
|
59
|
-
setTimeout(function() {
|
|
60
|
-
app.scene.on('selected', function(after) {
|
|
61
|
-
var target = after[0]
|
|
62
|
-
var props = {}
|
|
63
|
-
if(target) {
|
|
64
|
-
target.nature.properties.forEach(function(prop) {
|
|
65
|
-
var property = prop.property
|
|
66
|
-
props[property] = target.model[property]
|
|
67
|
-
})
|
|
68
|
-
}
|
|
69
|
-
app.props = props
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
app.$.props.addEventListener('change', function() {
|
|
74
|
-
app.selected[0].set(app.props)
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
app.model = {
|
|
78
|
-
width: 640,
|
|
79
|
-
height: 480,
|
|
80
|
-
components: [{
|
|
81
|
-
type: 'restful',
|
|
82
|
-
top: 100,
|
|
83
|
-
left: 100,
|
|
84
|
-
width:200,
|
|
85
|
-
height: 70,
|
|
86
|
-
fontSize: 40,
|
|
87
|
-
fillStyle: '#00ff00',
|
|
88
|
-
fontColor: '#FF0000',
|
|
89
|
-
strokeStyle: '#000',
|
|
90
|
-
lineWidth: 5,
|
|
91
|
-
value: 40,
|
|
92
|
-
text: '#{value}',
|
|
93
|
-
lineCap: 'round',
|
|
94
|
-
url: 'http://factory.hatiolab.com/rest/publishers/initData?subject=/elidom/stomp/topic/hatiolab-hq/smart/SCENE-22',
|
|
95
|
-
period: 60
|
|
96
|
-
}, {
|
|
97
|
-
type: 'rect',
|
|
98
|
-
id: 'ss3Text',
|
|
99
|
-
top: 100,
|
|
100
|
-
left: 100,
|
|
101
|
-
width:200,
|
|
102
|
-
height: 70,
|
|
103
|
-
fontSize: 40,
|
|
104
|
-
fillStyle: '#00ff00',
|
|
105
|
-
fontColor: '#FF0000',
|
|
106
|
-
strokeStyle: '#000',
|
|
107
|
-
lineWidth: 5,
|
|
108
|
-
value: 40,
|
|
109
|
-
text: '#{data}',
|
|
110
|
-
lineCap: 'round'
|
|
111
|
-
}]
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
</script>
|
|
115
|
-
</body>
|
|
116
|
-
</html>
|
package/demo/things-theme.html
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
-->
|
|
5
|
-
<dom-module id="things-theme">
|
|
6
|
-
<template>
|
|
7
|
-
<style>
|
|
8
|
-
:root {
|
|
9
|
-
/* element reset style */
|
|
10
|
-
--paper-badge-background: rgba(0, 0, 0, 0.2);
|
|
11
|
-
--paper-badge-margin-left: -25px;
|
|
12
|
-
--paper-fab-background: var(--things-secondary-color);
|
|
13
|
-
--paper-fab-background: tomato;
|
|
14
|
-
--paper-input-container-focus-color: var(--things-secondary-color);
|
|
15
|
-
--paper-toolbar-background: transparent;
|
|
16
|
-
|
|
17
|
-
/* common style */
|
|
18
|
-
--border-radius-clear: {
|
|
19
|
-
-webkit-border-radius: 0px;
|
|
20
|
-
-moz-border-radius: 0px;
|
|
21
|
-
border-radius: 0px;
|
|
22
|
-
}
|
|
23
|
-
--things-default-padding: {
|
|
24
|
-
padding: 15px;
|
|
25
|
-
}
|
|
26
|
-
--things-tight-padding: {
|
|
27
|
-
padding: 7px;
|
|
28
|
-
}
|
|
29
|
-
--things-loose-padding: {
|
|
30
|
-
padding: 30px;
|
|
31
|
-
}
|
|
32
|
-
--things-table-padding: {
|
|
33
|
-
padding: 15px 15px 0 15px;
|
|
34
|
-
}
|
|
35
|
-
--things-padding-clear: {
|
|
36
|
-
padding: 0;
|
|
37
|
-
}
|
|
38
|
-
--things-default-margin: {
|
|
39
|
-
margin: 15px;
|
|
40
|
-
}
|
|
41
|
-
--things-margin-clear: {
|
|
42
|
-
margin: 0;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/* color style */
|
|
46
|
-
--things-primary-color: #826960;
|
|
47
|
-
--things-secondary-color: #aa866a;
|
|
48
|
-
--things-focus-background-color: #867f7c;
|
|
49
|
-
--things-primary-background-color: #826960;
|
|
50
|
-
--things-secondary-background-color: #aa866a;
|
|
51
|
-
--things-lightgrey-background-color: rgba(0, 0, 0, 0.15);
|
|
52
|
-
--things-white-color: #fff;
|
|
53
|
-
--things-error-color: var(--paper-deep-orange-700);
|
|
54
|
-
--things-primary-text-color: #726765;
|
|
55
|
-
--things-green-text-color: var(--paper-green-600);
|
|
56
|
-
--things-dark-text-color: #585858;
|
|
57
|
-
|
|
58
|
-
/* properties panel style */
|
|
59
|
-
--things-properties-panel: {
|
|
60
|
-
display: block;
|
|
61
|
-
width: 270px;
|
|
62
|
-
min-width: 270px;
|
|
63
|
-
background-color: var(--paper-blue-grey-50);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/* form style */
|
|
67
|
-
--things-label: {
|
|
68
|
-
position: relative;
|
|
69
|
-
top: -3px;
|
|
70
|
-
width: 25%;
|
|
71
|
-
min-height: 20px;
|
|
72
|
-
display: inline-block;
|
|
73
|
-
margin-bottom: 10px;
|
|
74
|
-
color: var(--things-primary-text-color);
|
|
75
|
-
font-size: 12px;
|
|
76
|
-
text-align: right;
|
|
77
|
-
font-weight: 100;
|
|
78
|
-
line-height: 1.6;
|
|
79
|
-
}
|
|
80
|
-
--things-input: {
|
|
81
|
-
width: 65%;
|
|
82
|
-
margin-bottom: 10px;
|
|
83
|
-
padding: 3px 5px 2px 5px;
|
|
84
|
-
-webkit-border-radius: 4px;
|
|
85
|
-
-moz-border-radius: 4px;
|
|
86
|
-
border-radius: 4px;
|
|
87
|
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
88
|
-
font-size: 15px;
|
|
89
|
-
font-weight: 300;
|
|
90
|
-
}
|
|
91
|
-
--things-input-readonly-important: {
|
|
92
|
-
background-color: transparent;
|
|
93
|
-
padding: 0 0 0 3px;
|
|
94
|
-
position: relative;
|
|
95
|
-
top: -2px;
|
|
96
|
-
border-color: transparent;
|
|
97
|
-
font-weight: 600;
|
|
98
|
-
color: var(--things-primary-text-color);
|
|
99
|
-
}
|
|
100
|
-
--things-textarea-label-width: 12.25%;
|
|
101
|
-
--things-textarea-width: 94.5%;
|
|
102
|
-
--things-textarea: {
|
|
103
|
-
-webkit-border-radius: 4px;
|
|
104
|
-
-moz-border-radius: 4px;
|
|
105
|
-
border-radius: 4px;
|
|
106
|
-
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
107
|
-
color: var(--things-primary-text-color);
|
|
108
|
-
font-size: 13px;
|
|
109
|
-
width: 100%;
|
|
110
|
-
height: 84%;
|
|
111
|
-
padding: 1%;
|
|
112
|
-
}
|
|
113
|
-
--things-fieldset: {
|
|
114
|
-
border: none;
|
|
115
|
-
margin: 0;
|
|
116
|
-
padding: 9px 0 0 0;
|
|
117
|
-
border-bottom: 1px solid #cfd8dc;
|
|
118
|
-
color: var(--things-primary-text-color);
|
|
119
|
-
font-size: 12px;
|
|
120
|
-
}
|
|
121
|
-
--things-fieldset-legend: {
|
|
122
|
-
padding: 9px 0 0 7px;
|
|
123
|
-
font-size: 11px;
|
|
124
|
-
color: #e46c2e;
|
|
125
|
-
font-weight: bold;
|
|
126
|
-
text-transform: capitalize;
|
|
127
|
-
}
|
|
128
|
-
--things-select: {
|
|
129
|
-
max-width: 69%;
|
|
130
|
-
min-width: 50%;
|
|
131
|
-
margin-bottom: 10px;
|
|
132
|
-
padding: 3px 20px 2px 5px;
|
|
133
|
-
-webkit-border-radius: 4px;
|
|
134
|
-
-moz-border-radius: 4px;
|
|
135
|
-
border-radius: 4px;
|
|
136
|
-
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
137
|
-
font-size: 15px;
|
|
138
|
-
font-weight: 300;
|
|
139
|
-
-webkit-appearance: none;
|
|
140
|
-
}
|
|
141
|
-
--things-input-color: {
|
|
142
|
-
position: relative;
|
|
143
|
-
margin-left: -30px;
|
|
144
|
-
width: 25px;
|
|
145
|
-
height: 21px;
|
|
146
|
-
border: none;
|
|
147
|
-
padding: 0;
|
|
148
|
-
}
|
|
149
|
-
--things-properties-icon-only-label: {
|
|
150
|
-
width: 30px;
|
|
151
|
-
height: 24px;
|
|
152
|
-
margin-top: 2px;
|
|
153
|
-
margin-bottom: 5px;
|
|
154
|
-
}
|
|
155
|
-
--things-editor-colorbar: {
|
|
156
|
-
border: 1px solid #ccc;
|
|
157
|
-
}
|
|
158
|
-
--things-editor-color-input-text: {
|
|
159
|
-
@apply (--things-input);
|
|
160
|
-
}
|
|
161
|
-
--things-editor-color-input-color: {
|
|
162
|
-
border: none;
|
|
163
|
-
background-color: transparent;
|
|
164
|
-
margin-left: -27px;
|
|
165
|
-
position: relative;
|
|
166
|
-
width: 20px;
|
|
167
|
-
}
|
|
168
|
-
--things-dropdown-item: {
|
|
169
|
-
min-height: 30px;
|
|
170
|
-
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
171
|
-
padding: 0 10px;
|
|
172
|
-
font-size: 13px;
|
|
173
|
-
color: var(--things-primary-text-color);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
</style>
|
|
177
|
-
</template>
|
|
178
|
-
</dom-module>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# restful
|
|
2
|
-
URL를 제공 받고 URL로만 데이터를 조회할 경우 사용하는 컴포넌트.
|
|
3
|
-
|
|
4
|
-
## properties
|
|
5
|
-
|
|
6
|
-
- url : 데이터 조회 URL
|
|
7
|
-
- period : 데이터 조회 주기
|
|
8
|
-
- data format : Plain Text, JSON, JSONP등 데이터 포멧
|
|
9
|
-
- Plain Text : 서버에서 데이터를 Plain Text로 반환할 경우 사용
|
|
10
|
-
- JSON : 서버에서 데이터를 JSON으로 제공할 경우
|
|
11
|
-
- JSONP : 데이터를 function형태로 전달 받을 경우 해당 function을 받아서 처리해 주는 기능
|
|
12
|
-
- with credentials : Cross site request 설정
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# restful
|
|
2
|
-
A component used when a URL is provided and data is retrieved only with a URL.
|
|
3
|
-
|
|
4
|
-
## properties
|
|
5
|
-
- url : Data inquiry URL
|
|
6
|
-
- period : Data inquiry cycle
|
|
7
|
-
- data format : Plain Text, JSON, JSONP Data format
|
|
8
|
-
- Plain Text : Used when the server returns data in Plain Text.
|
|
9
|
-
- JSON : When the server provides data as JSON
|
|
10
|
-
- JSONP : When data is received in the form of a function, the function is received and processed.
|
|
11
|
-
- with credentials : Cross site request
|
package/src/index.js
DELETED
package/src/jsonp.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { debug } from '@hatiolab/things-scene'
|
|
2
|
-
|
|
3
|
-
var count = 0;
|
|
4
|
-
|
|
5
|
-
function noop(){}
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* JSONP handler
|
|
9
|
-
*
|
|
10
|
-
* Options:
|
|
11
|
-
* - param {String} qs parameter (`callback`)
|
|
12
|
-
* - prefix {String} qs parameter (`__jp`)
|
|
13
|
-
* - name {String} qs parameter (`prefix` + incr)
|
|
14
|
-
* - timeout {Number} how long after a timeout error is emitted (`60000`)
|
|
15
|
-
*
|
|
16
|
-
* @param {String} url
|
|
17
|
-
* @param {Object|Function} optional options / callback
|
|
18
|
-
* @param {Function} optional callback
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
export default function jsonp(url, opts, fn){
|
|
22
|
-
if ('function' == typeof opts) {
|
|
23
|
-
fn = opts;
|
|
24
|
-
opts = {};
|
|
25
|
-
}
|
|
26
|
-
if (!opts) opts = {};
|
|
27
|
-
|
|
28
|
-
var prefix = opts.prefix || '__jp';
|
|
29
|
-
|
|
30
|
-
// use the callback name that was passed if one was provided.
|
|
31
|
-
// otherwise generate a unique name by incrementing our counter.
|
|
32
|
-
var id = opts.name || (prefix + (count++));
|
|
33
|
-
|
|
34
|
-
var param = opts.param || 'callback';
|
|
35
|
-
var timeout = null != opts.timeout ? opts.timeout : 60000;
|
|
36
|
-
var enc = encodeURIComponent;
|
|
37
|
-
var target = document.getElementsByTagName('script')[0] || document.head;
|
|
38
|
-
var script;
|
|
39
|
-
var timer;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (timeout) {
|
|
43
|
-
timer = setTimeout(function(){
|
|
44
|
-
cleanup();
|
|
45
|
-
if (fn) fn(new Error('Timeout'));
|
|
46
|
-
}, timeout);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function cleanup(){
|
|
50
|
-
if (script.parentNode) script.parentNode.removeChild(script);
|
|
51
|
-
window[id] = noop;
|
|
52
|
-
if (timer) clearTimeout(timer);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function cancel(){
|
|
56
|
-
if (window[id]) {
|
|
57
|
-
cleanup();
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
window[id] = function(data){
|
|
62
|
-
debug('jsonp got', data);
|
|
63
|
-
cleanup();
|
|
64
|
-
if (fn) fn(null, data);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
// add qs component
|
|
68
|
-
url += (~url.indexOf('?') ? '&' : '?') + param + '=' + enc(id);
|
|
69
|
-
url = url.replace('?&', '?');
|
|
70
|
-
|
|
71
|
-
debug('jsonp req "%s"', url);
|
|
72
|
-
|
|
73
|
-
// create script
|
|
74
|
-
script = document.createElement('script');
|
|
75
|
-
script.src = url;
|
|
76
|
-
target.parentNode.insertBefore(script, target);
|
|
77
|
-
|
|
78
|
-
return cancel;
|
|
79
|
-
}
|
package/src/restful.js
DELETED
|
@@ -1,254 +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: 'url',
|
|
13
|
-
name: 'url'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
type: 'number',
|
|
17
|
-
label: 'period',
|
|
18
|
-
name: 'period',
|
|
19
|
-
placeholder: 'SECONDS'
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
type: 'select',
|
|
23
|
-
label: 'data-format',
|
|
24
|
-
name: 'dataFormat',
|
|
25
|
-
property: {
|
|
26
|
-
options: [
|
|
27
|
-
{
|
|
28
|
-
display: 'Plain Text',
|
|
29
|
-
value: 'text'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
display: 'JSON',
|
|
33
|
-
value: 'json'
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
display: 'JSONP',
|
|
37
|
-
value: 'jsonp'
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: 'checkbox',
|
|
44
|
-
label: 'with-credentials',
|
|
45
|
-
name: 'withCredentials'
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
'value-property': 'url',
|
|
49
|
-
help: 'scene/component/restful'
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const REST_IMAGE =
|
|
53
|
-
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKIAAACWCAMAAABqx6OSAAAABGdBTUEAALGPC/x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ofApZ6UK7cXNVJ2HvjSCOQDQW0q4YQxQBDiPulWBswHezsc7Av7VeJzGKuPLZ6RX7gC1cjnRwGP2WFj5OryTEeLU/c+lc9MMDgvhMRdQ9vdI1SQU3zWbzjHRvMVaX/i4C9rI5oIeMAOFp8br68FC7LiXY929mpLt3H9fpjE5S9U31hfe4XgTS36IS9/cl4lm0tBKAxQ3Wmajc1YdIneq7YMHEDctOLli8c8ESqAsWkl2wHD98U6N4JFixqSEcFYdtavwyujXUzsfjUbO3hqLxeL5tdGtoxAZb+7F5Zu4G21nzsW18g422TZnsb1N2zd2m7Pa3KZMGtimpm70ZZSKoDgG+utnbCzVaGUObvdQt82ip0pBUM3vLvIZLrZSixrbM3XDwwAXHN1xwCGZqPmw/4ZijRC44kOWGY23Tzj8caP8Ry8Xxr5Hv2Eu4o+MldBcc93XBoWk3HD13wQF+2jxrQtL9GoQLXiZxwys5bnixyQWvh7nhJTs3vKrohhc+p+b2Jkm496nUB85/+dgNr3BLS2UTmmyFF6c+LeenE3BDUgY3pLawPkHIgQnJqJyfZsXiZDUmJexzfsofNyROsij91K7JSfqcn8RrygWp0HBFrpm2BhC0JqEc3mvdMGlVxKq0fGSscXpywyk3pIgkNenwRJuyl3R6ulKyXOH0pK9ydOHw1LmycALisaN3yL4ExIqFOzyNc3/N9EMy7IOAs5Jh/5M79D8U6UTFcE/VFgAAAABJRU5ErkJggg=='
|
|
54
|
-
|
|
55
|
-
const WARN_NO_URL = 'Valid URL property required'
|
|
56
|
-
|
|
57
|
-
import { Component, DataSource, RectPath, Shape, warn } from '@hatiolab/things-scene'
|
|
58
|
-
import jsonp from './jsonp'
|
|
59
|
-
|
|
60
|
-
export default class Restful extends DataSource(RectPath(Shape)) {
|
|
61
|
-
static get image() {
|
|
62
|
-
if (!Restful._image) {
|
|
63
|
-
Restful._image = new Image()
|
|
64
|
-
Restful._image.src = REST_IMAGE
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return Restful._image
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get url() {
|
|
71
|
-
return this.getState('url')
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
set url(url) {
|
|
75
|
-
this.setState('url', url)
|
|
76
|
-
this._initRestful()
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get period() {
|
|
80
|
-
return this.state.period * 1000
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
set period(period) {
|
|
84
|
-
this.setState('period', period)
|
|
85
|
-
this._initRestful()
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get withCredentials() {
|
|
89
|
-
return !!this.getState('withCredentials')
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
set withCredentials(withCredentials) {
|
|
93
|
-
this.setState('withCredentials', withCredentials)
|
|
94
|
-
this._initRestful()
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
get repeatTimer() {
|
|
98
|
-
return this._repeatTimer
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
set repeatTimer(repeatTimer) {
|
|
102
|
-
this._stopRepeater()
|
|
103
|
-
this._repeatTimer = repeatTimer
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
get httpRequest() {
|
|
107
|
-
return this._httpRequest
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
set httpRequest(httpRequest) {
|
|
111
|
-
this._httpRequest = httpRequest
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
ready() {
|
|
115
|
-
this._initRestful()
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
_initRestful() {
|
|
119
|
-
if (!this.app.isViewMode) return
|
|
120
|
-
|
|
121
|
-
if (!this.url) {
|
|
122
|
-
warn(WARN_NO_URL)
|
|
123
|
-
return
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
this._stopRepeater()
|
|
127
|
-
this._startRepeater()
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
dispose() {
|
|
131
|
-
super.dispose()
|
|
132
|
-
this._stopRepeater()
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
_startRepeater() {
|
|
136
|
-
this._isStarted = true
|
|
137
|
-
|
|
138
|
-
var self = this
|
|
139
|
-
|
|
140
|
-
// requestAnimationFrame 이 호출되지 않을 때는 ajax 호출도 하지 않도록 함.
|
|
141
|
-
function _() {
|
|
142
|
-
if (!self._isStarted) {
|
|
143
|
-
return
|
|
144
|
-
}
|
|
145
|
-
self.callAjax()
|
|
146
|
-
|
|
147
|
-
if (!self.period) {
|
|
148
|
-
self._stopRepeater()
|
|
149
|
-
return
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
self._repeatTimer = setTimeout(() => {
|
|
153
|
-
requestAnimationFrame(_)
|
|
154
|
-
}, self.period)
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
requestAnimationFrame(_)
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
_stopRepeater() {
|
|
161
|
-
this._abortRequest()
|
|
162
|
-
|
|
163
|
-
if (this.repeatTimer) clearTimeout(this._repeatTimer)
|
|
164
|
-
this._isStarted = false
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
_makeRequest(url) {
|
|
168
|
-
if (window.XMLHttpRequest) {
|
|
169
|
-
// Mozilla, Safari, ...
|
|
170
|
-
this.httpRequest = new XMLHttpRequest()
|
|
171
|
-
} else if (window.ActiveXObject) {
|
|
172
|
-
// IE
|
|
173
|
-
try {
|
|
174
|
-
this.httpRequest = new ActiveXObject('Msxml2.XMLHTTP')
|
|
175
|
-
} catch (e) {
|
|
176
|
-
try {
|
|
177
|
-
this.httpRequest = new ActiveXObject('Microsoft.XMLHTTP')
|
|
178
|
-
} catch (e) {}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
if (!this.httpRequest) {
|
|
183
|
-
warn('Giving up :( Cannot create an XMLHTTP instance')
|
|
184
|
-
return false
|
|
185
|
-
}
|
|
186
|
-
this.httpRequest.withCredentials = this.withCredentials
|
|
187
|
-
this.httpRequest.open('GET', url)
|
|
188
|
-
this.httpRequest.onreadystatechange = this.onDataReceived.bind(this)
|
|
189
|
-
|
|
190
|
-
return true
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
_makeRequestJsonp(url) {
|
|
194
|
-
jsonp(url, {}, (self, data) => {
|
|
195
|
-
if (!data) return
|
|
196
|
-
|
|
197
|
-
this.data = data
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
_abortRequest() {
|
|
202
|
-
if (this.httpRequest) this.httpRequest.abort()
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
onDataReceived() {
|
|
206
|
-
var { dataFormat = 'text' } = this.state
|
|
207
|
-
|
|
208
|
-
if (this.httpRequest.readyState === 4) {
|
|
209
|
-
if (this.httpRequest.status === 200) {
|
|
210
|
-
var data = this.httpRequest.responseText
|
|
211
|
-
|
|
212
|
-
if (!data) return
|
|
213
|
-
|
|
214
|
-
this.data = this._convertDataFormat(data, dataFormat)
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
callAjax() {
|
|
220
|
-
var { dataFormat = 'text' } = this.state
|
|
221
|
-
|
|
222
|
-
if (dataFormat == 'jsonp') {
|
|
223
|
-
this._makeRequestJsonp(this.substitute(this.url, this))
|
|
224
|
-
} else {
|
|
225
|
-
if (!this._makeRequest(this.substitute(this.url, this))) return
|
|
226
|
-
|
|
227
|
-
this.httpRequest.send()
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
_draw(context) {
|
|
232
|
-
var { left, top, width, height } = this.bounds
|
|
233
|
-
|
|
234
|
-
context.beginPath()
|
|
235
|
-
this.drawImage(context, Restful.image, left, top, width, height)
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
ondblclick(e) {
|
|
239
|
-
if (!this.url) {
|
|
240
|
-
warn(WARN_NO_URL)
|
|
241
|
-
return
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
this.callAjax()
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
get controls() {}
|
|
248
|
-
|
|
249
|
-
get nature() {
|
|
250
|
-
return NATURE
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
Component.register('restful', Restful)
|
package/test/basic-test.html
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
-->
|
|
5
|
-
<!doctype html>
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
-
|
|
11
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
12
|
-
<script src="../../web-component-tester/browser.js"></script>
|
|
13
|
-
|
|
14
|
-
<!-- Step 1: import the element to test -->
|
|
15
|
-
<link rel="import" href="../things-scene-restful.html">
|
|
16
|
-
</head>
|
|
17
|
-
<body>
|
|
18
|
-
|
|
19
|
-
<!-- You can use the document as a place to set up your fixtures. -->
|
|
20
|
-
<test-fixture id="things-scene-restful-fixture">
|
|
21
|
-
<template>
|
|
22
|
-
<things-scene-restful>
|
|
23
|
-
<h2>things-scene-restful</h2>
|
|
24
|
-
</things-scene-restful>
|
|
25
|
-
</template>
|
|
26
|
-
</test-fixture>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
suite('<things-scene-restful>', function() {
|
|
30
|
-
|
|
31
|
-
var myEl;
|
|
32
|
-
|
|
33
|
-
setup(function() {
|
|
34
|
-
myEl = fixture('things-scene-restful-fixture');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('defines the "author" property', function() {
|
|
38
|
-
assert.equal(myEl.author.name, 'Dimitri Glazkov');
|
|
39
|
-
assert.equal(myEl.author.image, 'http://addyosmani.com/blog/wp-content/uploads/2013/04/unicorn.jpg');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
test('says hello', function() {
|
|
43
|
-
assert.equal(myEl.sayHello(), 'things-scene-restful says, Hello World!');
|
|
44
|
-
|
|
45
|
-
var greetings = myEl.sayHello('greetings Earthlings');
|
|
46
|
-
assert.equal(greetings, 'things-scene-restful says, greetings Earthlings');
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
test('fires lasers', function(done) {
|
|
50
|
-
myEl.addEventListener('things-scene-restful-lasers', function(event) {
|
|
51
|
-
assert.equal(event.detail.sound, 'Pew pew!');
|
|
52
|
-
done();
|
|
53
|
-
});
|
|
54
|
-
myEl.fireLasers();
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
test('distributed children', function() {
|
|
58
|
-
var els = myEl.getContentChildren();
|
|
59
|
-
assert.equal(els.length, 1, 'one distributed node');
|
|
60
|
-
assert.equal(els[0], myEl.querySelector('h2'), 'content distributed correctly');
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
</script>
|
|
65
|
-
|
|
66
|
-
</body>
|
|
67
|
-
</html>
|
package/test/index.html
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@license
|
|
3
|
-
Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
-
-->
|
|
5
|
-
<!DOCTYPE html>
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<meta charset="utf-8">
|
|
9
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
|
10
|
-
|
|
11
|
-
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
|
12
|
-
<script src="../../web-component-tester/browser.js"></script>
|
|
13
|
-
</head>
|
|
14
|
-
<body>
|
|
15
|
-
<script>
|
|
16
|
-
// Load and run all tests (.html, .js):
|
|
17
|
-
WCT.loadSuites([
|
|
18
|
-
'basic-test.html',
|
|
19
|
-
'basic-test.html?dom=shadow'
|
|
20
|
-
]);
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import './util'
|
|
6
|
-
|
|
7
|
-
import { expect } from 'chai'
|
|
8
|
-
|
|
9
|
-
import '../../bower_components/things-scene-core/things-scene-min'
|
|
10
|
-
import { Restful } from '../../src/index'
|
|
11
|
-
|
|
12
|
-
describe('Restful', function () {
|
|
13
|
-
|
|
14
|
-
var board;
|
|
15
|
-
|
|
16
|
-
beforeEach(function () {
|
|
17
|
-
board = scene.create({
|
|
18
|
-
model: {
|
|
19
|
-
components: [{
|
|
20
|
-
id: 'restful',
|
|
21
|
-
type: 'restful'
|
|
22
|
-
}]
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('component should be found by its id.', function () {
|
|
28
|
-
|
|
29
|
-
var component = board.findById('restful')
|
|
30
|
-
|
|
31
|
-
expect(!!component).not.to.equal(false);
|
|
32
|
-
});
|
|
33
|
-
});
|
package/test/unit/util.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
var noop = () => {}
|
|
6
|
-
|
|
7
|
-
global.Canvas = require('canvas');
|
|
8
|
-
|
|
9
|
-
Canvas.prototype.setAttribute = noop;
|
|
10
|
-
Canvas.prototype.style = {};
|
|
11
|
-
|
|
12
|
-
global.Image = Canvas.Image;
|
|
13
|
-
global.screen = {
|
|
14
|
-
width: 1280,
|
|
15
|
-
height: 800
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
global.window = global;
|
|
19
|
-
|
|
20
|
-
global.addEventListener = noop;
|
|
21
|
-
global.location = {};
|
|
22
|
-
global.getComputedStyle = noop;
|
package/things-scene.config.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import icon from './assets/restful.png';
|
|
2
|
-
|
|
3
|
-
var templates = [{
|
|
4
|
-
type: 'restful',
|
|
5
|
-
description: 'restful client',
|
|
6
|
-
group: 'dataSource', /* line|shape|textAndMedia|chartAndGauge|table|container|dataSource|IoT|3D|warehouse|form|etc */
|
|
7
|
-
icon,
|
|
8
|
-
model: {
|
|
9
|
-
type: "restful",
|
|
10
|
-
left: 10,
|
|
11
|
-
top: 10,
|
|
12
|
-
width: 100,
|
|
13
|
-
height: 100,
|
|
14
|
-
hidden: true,
|
|
15
|
-
dataFormat: 'json'
|
|
16
|
-
}
|
|
17
|
-
}];
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
templates
|
|
21
|
-
};
|
package/translations/en.json
DELETED
package/translations/ko.json
DELETED