wafer-map 4.0.53 → 4.0.55
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/LICENSE +201 -201
- package/README.md +180 -180
- package/README.zh-CN.md +214 -214
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +70 -70
- package/CHANGELOG.md +0 -1353
package/README.md
CHANGED
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
English | [简体中文](./README.zh-CN.md)
|
|
2
|
-
|
|
3
|
-
# wafer-map
|
|
4
|
-
SVG Map for react
|
|
5
|
-
|
|
6
|
-
<!--[](https://www.npmjs.com/package/react-fmap)
|
|
7
|
-
[](https://npmjs.org/package/react-fmap)-->
|
|
8
|
-
|
|
9
|
-
## Using
|
|
10
|
-
|
|
11
|
-
* install
|
|
12
|
-
|
|
13
|
-
`npm i wafer-map`
|
|
14
|
-
`yarn add wafer-map`
|
|
15
|
-
|
|
16
|
-
* using in react
|
|
17
|
-
|
|
18
|
-
```js
|
|
19
|
-
import React, { Component } from 'react';
|
|
20
|
-
import WaferMap from 'wafer-map';
|
|
21
|
-
|
|
22
|
-
class App extends Component {
|
|
23
|
-
render() {
|
|
24
|
-
const mapProps = {
|
|
25
|
-
mapId: '1',
|
|
26
|
-
componentWidth: 1920,
|
|
27
|
-
componentHeight: 1080
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<div className="App">
|
|
32
|
-
<WaferMap {...mapProps}/>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
> notice: mapId is the only mark on the map.
|
|
40
|
-
|
|
41
|
-
## Props
|
|
42
|
-
|
|
43
|
-
| Prop | default value | is required | description |
|
|
44
|
-
|--------|---------------|---------------|---------------|
|
|
45
|
-
| mapId | | true | map id |
|
|
46
|
-
| componentWidth | `1920` | false | Map the width of containers |
|
|
47
|
-
| componentHeight | `1080` | false | Map the height of containers |
|
|
48
|
-
| background | `#ddd` | false | Map container background color |
|
|
49
|
-
| visibleElement | `[]` | false | Displayable collection of element ids |
|
|
50
|
-
| visibleType | `[]` | false | Displayable collection of element types |
|
|
51
|
-
| visibleState | `[]` | false | Displayable collection of element states |
|
|
52
|
-
| clickableElement | `[]` |false| Clickable collection of element ids |
|
|
53
|
-
| clickableType | `[]` | false | Clickable collection of element types |
|
|
54
|
-
| clickableState | `[]` | false | Clickable collection of element states |
|
|
55
|
-
| onClick | | false | Radio callback method |
|
|
56
|
-
| onSelect | | false | Multi-select callback method |
|
|
57
|
-
| onClickError | | false | Select the callback method for the exception |
|
|
58
|
-
| mapZoom | `true` | false | Scale the map |
|
|
59
|
-
| mapMove | `true` | false | Move the map |
|
|
60
|
-
| multiple | `false` | false | Multiple switch |
|
|
61
|
-
| noName | `false` | false | Element names are not displayed on the map. |
|
|
62
|
-
| showPath | `false` | false | Display roadmap |
|
|
63
|
-
| markId | | false | The element id that needs to be tagged, such as '1'; If multiple, use string array format, such as ['1', '2'] |
|
|
64
|
-
| showStateIds | [] | false | Display different states of different elements, data structure:[{id: 1, state: 'XX', color: '#fff', text: ''}, {}] |
|
|
65
|
-
| reloadMap | | false | Reload the map |
|
|
66
|
-
| reloadFinish | | false | Reload the map to complete the callback |
|
|
67
|
-
| touchable | | false | Touch control |
|
|
68
|
-
| deleteId | | false | Delete selected element id |
|
|
69
|
-
| deleteFinish | | false | Callback after deleting selected element |
|
|
70
|
-
| tooltipContent | | false | Display tooltip |
|
|
71
|
-
| elementsColor | [] | false | Set color according to element id, data structure:[{id: 1, color: '#fff'}, {}] |
|
|
72
|
-
| pathStartSvg | | false | Guide start icon, this icon contains only elements inside svg, without svg tags |
|
|
73
|
-
| pathEndSvg | | false | Guide end icon, this icon contains only elements inside svg, without svg tags |
|
|
74
|
-
| pathStyle | | false | Guide leader style, style setting reference svg element attributes |
|
|
75
|
-
| markSvg | | false | Search anchor or mark icon, this icon contains only elements inside svg, without svg tags |
|
|
76
|
-
| selectedSvg | | false | Check icon, this icon contains only elements inside svg, without svg tags |
|
|
77
|
-
| defaultTooltipKey | | '' | You can customize the default key in the bubble, such as orgName |
|
|
78
|
-
| getSvgDom | | '' | Get viewerdom of SVG callback method |
|
|
79
|
-
| signatureKey | null | false | Signature key |
|
|
80
|
-
| restfulSignature | false | false | Controls whether to sign or not, when set to true, the signature key must be set to a valid value |
|
|
81
|
-
| textColor | #fff | false | elements text color |
|
|
82
|
-
|scaleFactorMax| 5 |false |maximum amount of scale a user can zoom in to
|
|
83
|
-
|scaleFactorMin | 0.5 |false | minimum amount of scale a user can zoom out of
|
|
84
|
-
| isGenders | `false` | false | Display male and female outsourcing type avatars before the name of the material |
|
|
85
|
-
|centerEleRate| 1 |false | Set the center material magnification
|
|
86
|
-
|centerElement | {} |false | Set the central material
|
|
87
|
-
|clickToCenter| {} |false | If set true when you click element will set it to center and zoom bigger.
|
|
88
|
-
|windowsTouchSupport| false |false | Whether Windows touch screen is supported.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
### onClickError Error Code
|
|
95
|
-
|
|
96
|
-
| code | description |
|
|
97
|
-
|--------|----------------|
|
|
98
|
-
| `100` | Selected elements that cannot be displayed |
|
|
99
|
-
| `101` | Selected elements that the ID cannot be selected |
|
|
100
|
-
| `102` | Selected elements that the types cannot be selected |
|
|
101
|
-
| `103` | Selected elements that the states cannot be selected |
|
|
102
|
-
| `104` | Multi-select mode cannot select different types at the same time |
|
|
103
|
-
|
|
104
|
-
### function
|
|
105
|
-
|
|
106
|
-
| name | props | return | description |
|
|
107
|
-
|--------|---------|----------|---------------|
|
|
108
|
-
| reloadElements | | | Reload the elements on the map |
|
|
109
|
-
| clearSelectElement | | | Clears the selected set of elements |
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
### tooltipContent example of use
|
|
113
|
-
|
|
114
|
-
tipObj is the object returned by this method
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
tooltipContent = (tooltipObj)=>{
|
|
118
|
-
const radius = 5;
|
|
119
|
-
const width = 150;
|
|
120
|
-
const height = 45;
|
|
121
|
-
return (
|
|
122
|
-
<g>
|
|
123
|
-
<path
|
|
124
|
-
fill="black"
|
|
125
|
-
fillOpacity="0.7"
|
|
126
|
-
d={`M0 0 l10 10 h ${width / 2 - 10 - radius}
|
|
127
|
-
a ${radius} ${radius} 90 0 1 ${radius} ${radius} v ${height}
|
|
128
|
-
a ${radius} ${radius} 90 0 1 ${-radius} ${radius} h ${2 * radius - width}
|
|
129
|
-
a ${radius} ${radius} 90 0 1 ${-radius} ${-radius} v ${-height}
|
|
130
|
-
a ${radius} ${radius} 90 0 1 ${radius} ${-radius} h ${width / 2 - 10 - radius} Z`}
|
|
131
|
-
/>
|
|
132
|
-
<text
|
|
133
|
-
dy="23"
|
|
134
|
-
dominantBaseline="text-before-edge"
|
|
135
|
-
fill="white"
|
|
136
|
-
textAnchor="middle"
|
|
137
|
-
>
|
|
138
|
-
{tooltipObj.orgName}
|
|
139
|
-
</text>
|
|
140
|
-
</g>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
```
|
|
144
|
-
tooltipObj对象需要从 getMapStationList这个方法里获取数据存入contentObj对象,获取完整的对象
|
|
145
|
-
|
|
146
|
-
```
|
|
147
|
-
*getMapStationList({ payload }, { call, put, select }) {
|
|
148
|
-
const { locationId } = yield select(state => state.swsCommon);
|
|
149
|
-
const param = payload || { locationId };
|
|
150
|
-
const { info } = yield select(state => state.login);
|
|
151
|
-
if (info && info.tenant_id) {
|
|
152
|
-
param.domainId = info.tenant_id;
|
|
153
|
-
}
|
|
154
|
-
const result = yield call(service.getMapStationList, { payload: param });
|
|
155
|
-
if (result && result.code === 0) {
|
|
156
|
-
const onMapList = [];
|
|
157
|
-
const visibleList = [];
|
|
158
|
-
result.data.forEach(item => {
|
|
159
|
-
if (item && item.elementId) {
|
|
160
|
-
visibleList.push(item.elementId);
|
|
161
|
-
onMapList.push({
|
|
162
|
-
id: item.elementId,
|
|
163
|
-
state: item.statusCode,
|
|
164
|
-
color: item.statusColor,
|
|
165
|
-
text: item.userNames || item.stationNum,
|
|
166
|
-
contentObj: item
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
yield put({
|
|
172
|
-
type: 'saveOrUpdateData',
|
|
173
|
-
payload: {
|
|
174
|
-
mapStationList: result.data,
|
|
175
|
-
stationsOnMap: onMapList,
|
|
176
|
-
visibleList,
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
1
|
+
English | [简体中文](./README.zh-CN.md)
|
|
2
|
+
|
|
3
|
+
# wafer-map
|
|
4
|
+
SVG Map for react
|
|
5
|
+
|
|
6
|
+
<!--[](https://www.npmjs.com/package/react-fmap)
|
|
7
|
+
[](https://npmjs.org/package/react-fmap)-->
|
|
8
|
+
|
|
9
|
+
## Using
|
|
10
|
+
|
|
11
|
+
* install
|
|
12
|
+
|
|
13
|
+
`npm i wafer-map`
|
|
14
|
+
`yarn add wafer-map`
|
|
15
|
+
|
|
16
|
+
* using in react
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
import React, { Component } from 'react';
|
|
20
|
+
import WaferMap from 'wafer-map';
|
|
21
|
+
|
|
22
|
+
class App extends Component {
|
|
23
|
+
render() {
|
|
24
|
+
const mapProps = {
|
|
25
|
+
mapId: '1',
|
|
26
|
+
componentWidth: 1920,
|
|
27
|
+
componentHeight: 1080
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className="App">
|
|
32
|
+
<WaferMap {...mapProps}/>
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> notice: mapId is the only mark on the map.
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
| Prop | default value | is required | description |
|
|
44
|
+
|--------|---------------|---------------|---------------|
|
|
45
|
+
| mapId | | true | map id |
|
|
46
|
+
| componentWidth | `1920` | false | Map the width of containers |
|
|
47
|
+
| componentHeight | `1080` | false | Map the height of containers |
|
|
48
|
+
| background | `#ddd` | false | Map container background color |
|
|
49
|
+
| visibleElement | `[]` | false | Displayable collection of element ids |
|
|
50
|
+
| visibleType | `[]` | false | Displayable collection of element types |
|
|
51
|
+
| visibleState | `[]` | false | Displayable collection of element states |
|
|
52
|
+
| clickableElement | `[]` |false| Clickable collection of element ids |
|
|
53
|
+
| clickableType | `[]` | false | Clickable collection of element types |
|
|
54
|
+
| clickableState | `[]` | false | Clickable collection of element states |
|
|
55
|
+
| onClick | | false | Radio callback method |
|
|
56
|
+
| onSelect | | false | Multi-select callback method |
|
|
57
|
+
| onClickError | | false | Select the callback method for the exception |
|
|
58
|
+
| mapZoom | `true` | false | Scale the map |
|
|
59
|
+
| mapMove | `true` | false | Move the map |
|
|
60
|
+
| multiple | `false` | false | Multiple switch |
|
|
61
|
+
| noName | `false` | false | Element names are not displayed on the map. |
|
|
62
|
+
| showPath | `false` | false | Display roadmap |
|
|
63
|
+
| markId | | false | The element id that needs to be tagged, such as '1'; If multiple, use string array format, such as ['1', '2'] |
|
|
64
|
+
| showStateIds | [] | false | Display different states of different elements, data structure:[{id: 1, state: 'XX', color: '#fff', text: ''}, {}] |
|
|
65
|
+
| reloadMap | | false | Reload the map |
|
|
66
|
+
| reloadFinish | | false | Reload the map to complete the callback |
|
|
67
|
+
| touchable | | false | Touch control |
|
|
68
|
+
| deleteId | | false | Delete selected element id |
|
|
69
|
+
| deleteFinish | | false | Callback after deleting selected element |
|
|
70
|
+
| tooltipContent | | false | Display tooltip |
|
|
71
|
+
| elementsColor | [] | false | Set color according to element id, data structure:[{id: 1, color: '#fff'}, {}] |
|
|
72
|
+
| pathStartSvg | | false | Guide start icon, this icon contains only elements inside svg, without svg tags |
|
|
73
|
+
| pathEndSvg | | false | Guide end icon, this icon contains only elements inside svg, without svg tags |
|
|
74
|
+
| pathStyle | | false | Guide leader style, style setting reference svg element attributes |
|
|
75
|
+
| markSvg | | false | Search anchor or mark icon, this icon contains only elements inside svg, without svg tags |
|
|
76
|
+
| selectedSvg | | false | Check icon, this icon contains only elements inside svg, without svg tags |
|
|
77
|
+
| defaultTooltipKey | | '' | You can customize the default key in the bubble, such as orgName |
|
|
78
|
+
| getSvgDom | | '' | Get viewerdom of SVG callback method |
|
|
79
|
+
| signatureKey | null | false | Signature key |
|
|
80
|
+
| restfulSignature | false | false | Controls whether to sign or not, when set to true, the signature key must be set to a valid value |
|
|
81
|
+
| textColor | #fff | false | elements text color |
|
|
82
|
+
|scaleFactorMax| 5 |false |maximum amount of scale a user can zoom in to
|
|
83
|
+
|scaleFactorMin | 0.5 |false | minimum amount of scale a user can zoom out of
|
|
84
|
+
| isGenders | `false` | false | Display male and female outsourcing type avatars before the name of the material |
|
|
85
|
+
|centerEleRate| 1 |false | Set the center material magnification
|
|
86
|
+
|centerElement | {} |false | Set the central material
|
|
87
|
+
|clickToCenter| {} |false | If set true when you click element will set it to center and zoom bigger.
|
|
88
|
+
|windowsTouchSupport| false |false | Whether Windows touch screen is supported.
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### onClickError Error Code
|
|
95
|
+
|
|
96
|
+
| code | description |
|
|
97
|
+
|--------|----------------|
|
|
98
|
+
| `100` | Selected elements that cannot be displayed |
|
|
99
|
+
| `101` | Selected elements that the ID cannot be selected |
|
|
100
|
+
| `102` | Selected elements that the types cannot be selected |
|
|
101
|
+
| `103` | Selected elements that the states cannot be selected |
|
|
102
|
+
| `104` | Multi-select mode cannot select different types at the same time |
|
|
103
|
+
|
|
104
|
+
### function
|
|
105
|
+
|
|
106
|
+
| name | props | return | description |
|
|
107
|
+
|--------|---------|----------|---------------|
|
|
108
|
+
| reloadElements | | | Reload the elements on the map |
|
|
109
|
+
| clearSelectElement | | | Clears the selected set of elements |
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### tooltipContent example of use
|
|
113
|
+
|
|
114
|
+
tipObj is the object returned by this method
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
tooltipContent = (tooltipObj)=>{
|
|
118
|
+
const radius = 5;
|
|
119
|
+
const width = 150;
|
|
120
|
+
const height = 45;
|
|
121
|
+
return (
|
|
122
|
+
<g>
|
|
123
|
+
<path
|
|
124
|
+
fill="black"
|
|
125
|
+
fillOpacity="0.7"
|
|
126
|
+
d={`M0 0 l10 10 h ${width / 2 - 10 - radius}
|
|
127
|
+
a ${radius} ${radius} 90 0 1 ${radius} ${radius} v ${height}
|
|
128
|
+
a ${radius} ${radius} 90 0 1 ${-radius} ${radius} h ${2 * radius - width}
|
|
129
|
+
a ${radius} ${radius} 90 0 1 ${-radius} ${-radius} v ${-height}
|
|
130
|
+
a ${radius} ${radius} 90 0 1 ${radius} ${-radius} h ${width / 2 - 10 - radius} Z`}
|
|
131
|
+
/>
|
|
132
|
+
<text
|
|
133
|
+
dy="23"
|
|
134
|
+
dominantBaseline="text-before-edge"
|
|
135
|
+
fill="white"
|
|
136
|
+
textAnchor="middle"
|
|
137
|
+
>
|
|
138
|
+
{tooltipObj.orgName}
|
|
139
|
+
</text>
|
|
140
|
+
</g>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
tooltipObj对象需要从 getMapStationList这个方法里获取数据存入contentObj对象,获取完整的对象
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
*getMapStationList({ payload }, { call, put, select }) {
|
|
148
|
+
const { locationId } = yield select(state => state.swsCommon);
|
|
149
|
+
const param = payload || { locationId };
|
|
150
|
+
const { info } = yield select(state => state.login);
|
|
151
|
+
if (info && info.tenant_id) {
|
|
152
|
+
param.domainId = info.tenant_id;
|
|
153
|
+
}
|
|
154
|
+
const result = yield call(service.getMapStationList, { payload: param });
|
|
155
|
+
if (result && result.code === 0) {
|
|
156
|
+
const onMapList = [];
|
|
157
|
+
const visibleList = [];
|
|
158
|
+
result.data.forEach(item => {
|
|
159
|
+
if (item && item.elementId) {
|
|
160
|
+
visibleList.push(item.elementId);
|
|
161
|
+
onMapList.push({
|
|
162
|
+
id: item.elementId,
|
|
163
|
+
state: item.statusCode,
|
|
164
|
+
color: item.statusColor,
|
|
165
|
+
text: item.userNames || item.stationNum,
|
|
166
|
+
contentObj: item
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
yield put({
|
|
172
|
+
type: 'saveOrUpdateData',
|
|
173
|
+
payload: {
|
|
174
|
+
mapStationList: result.data,
|
|
175
|
+
stationsOnMap: onMapList,
|
|
176
|
+
visibleList,
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
181
|
```
|