@abi-software/scaffoldvuer 0.2.2-beta.2 → 0.2.3-alpha
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/.eslintrc.js +12 -12
- package/CHANGELOG.md +316 -310
- package/LICENSE +201 -201
- package/README.md +164 -164
- package/babel.config.js +14 -14
- package/dist/scaffoldvuer-wc.common.js +183 -35
- package/dist/scaffoldvuer-wc.umd.js +183 -35
- package/dist/scaffoldvuer-wc.umd.min.js +183 -35
- package/dist/scaffoldvuer.common.js +1076 -717
- package/dist/scaffoldvuer.common.js.map +1 -1
- package/dist/scaffoldvuer.css +1 -1
- package/dist/scaffoldvuer.umd.js +1076 -717
- package/dist/scaffoldvuer.umd.js.map +1 -1
- package/dist/scaffoldvuer.umd.min.js +1 -1
- package/dist/scaffoldvuer.umd.min.js.map +1 -1
- package/package-lock.json +18119 -18121
- package/package.json +89 -89
- package/public/index.html +17 -17
- package/src/App.vue +669 -714
- package/src/ScaffoldVuer-wc.js +13 -13
- package/src/{components → app}/DropZone.vue +114 -114
- package/src/{components → app}/ModelsInformation.js +35 -35
- package/src/{components → app}/ModelsTable.vue +113 -113
- package/src/app/TextureDemos.js +114 -0
- package/src/assets/_variables.scss +43 -43
- package/src/assets/styles.scss +7 -7
- package/src/components/OpacityControls.vue +222 -222
- package/src/components/ScaffoldTooltip.vue +142 -141
- package/src/components/ScaffoldVuer.md +44 -44
- package/src/components/ScaffoldVuer.vue +1997 -1887
- package/src/components/TreeControls.vue +699 -691
- package/src/components/index.js +7 -7
- package/src/components/test.pdf +0 -0
- package/src/main.js +14 -14
- package/src/scripts/BaseModule.js +80 -80
- package/src/scripts/RendererModule.js +289 -289
- package/src/scripts/WebGL.js +94 -94
- package/src/scripts/annotation.js +5 -5
- package/src/scripts/eventNotifier.js +66 -66
- package/src/scripts/graphicsHighlight.js +134 -134
- package/src/scripts/organsRenderer.js +587 -606
- package/src/scripts/search.js +182 -153
- package/src/scripts/utilities.js +146 -43
- package/src/searchControls.vue +122 -0
- package/styleguide.config.js +22 -22
- package/vue.config.js +41 -41
- package/src/credential.json +0 -12
package/src/scripts/search.js
CHANGED
|
@@ -1,153 +1,182 @@
|
|
|
1
|
-
/******************************************************************************
|
|
2
|
-
|
|
3
|
-
Flatmap viewer and annotation tool
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2019 David Brooks
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|
|
18
|
-
|
|
19
|
-
******************************************************************************/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
//==============================================================================
|
|
23
|
-
|
|
24
|
-
import MiniSearch from 'minisearch';
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this._searchEngine.
|
|
84
|
-
this.
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
|
|
3
|
+
Flatmap viewer and annotation tool
|
|
4
|
+
|
|
5
|
+
Copyright (c) 2019 David Brooks
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
|
|
19
|
+
******************************************************************************/
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
//==============================================================================
|
|
23
|
+
|
|
24
|
+
import MiniSearch from 'minisearch';
|
|
25
|
+
|
|
26
|
+
import { createUnqiuesFromObjects } from './utilities';
|
|
27
|
+
|
|
28
|
+
//==============================================================================
|
|
29
|
+
|
|
30
|
+
// The properties of a feature we index and show
|
|
31
|
+
|
|
32
|
+
export const indexedProperties = [
|
|
33
|
+
'label',
|
|
34
|
+
'models',
|
|
35
|
+
'source'
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
//==============================================================================
|
|
39
|
+
|
|
40
|
+
export class SearchIndex
|
|
41
|
+
{
|
|
42
|
+
constructor()
|
|
43
|
+
{
|
|
44
|
+
this._searchEngine = new MiniSearch({
|
|
45
|
+
fields: ['path', 'name'],
|
|
46
|
+
storeFields: ['path'],
|
|
47
|
+
tokenize: (string, _fieldName) => string.split('"'), // indexing tokenizer
|
|
48
|
+
});
|
|
49
|
+
this._featureIds = [];
|
|
50
|
+
this.zincObjects = [];
|
|
51
|
+
this.regions = [];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
indexMetadata(featureId, metadata)
|
|
55
|
+
//================================
|
|
56
|
+
{
|
|
57
|
+
const textSeen = [];
|
|
58
|
+
for (const prop of indexedProperties) {
|
|
59
|
+
if (prop in metadata) {
|
|
60
|
+
const text = metadata[prop];
|
|
61
|
+
if (!textSeen.includes(text)) {
|
|
62
|
+
this.addTerm_(featureId, text);
|
|
63
|
+
textSeen.push(text);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
addZincObject(zincObject, id)
|
|
70
|
+
//=======================
|
|
71
|
+
{
|
|
72
|
+
const path = zincObject.getRegion().getFullPath();
|
|
73
|
+
const fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
74
|
+
const item = { path: fullPath, name: zincObject.groupName, id };
|
|
75
|
+
this._searchEngine.add(item, {fields: ['path', 'name']});
|
|
76
|
+
this.zincObjects.push(zincObject);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
addRegion(region, id)
|
|
80
|
+
//=======================
|
|
81
|
+
{
|
|
82
|
+
const item = { path: region.getFullPath(), name: region.getName(), id };
|
|
83
|
+
this._searchEngine.add(item, {fields: ['path', 'name']});
|
|
84
|
+
this.regions.push(region);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
clearResults()
|
|
88
|
+
//============
|
|
89
|
+
{
|
|
90
|
+
this._;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
removeAll()
|
|
94
|
+
//=======================
|
|
95
|
+
{
|
|
96
|
+
this._searchEngine.removeAll();
|
|
97
|
+
this.zincObjects.length = 0;
|
|
98
|
+
this.regions.length = 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
auto_suggest(text)
|
|
102
|
+
//================
|
|
103
|
+
{
|
|
104
|
+
const results = this._searchEngine.autoSuggest(text, {prefix: true});
|
|
105
|
+
return results;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
processResults(zincObjects, searchText) {
|
|
109
|
+
const result = {
|
|
110
|
+
regionPath: undefined,
|
|
111
|
+
label: `Search Results for \"`,
|
|
112
|
+
};
|
|
113
|
+
if (Array.isArray(searchText)) {
|
|
114
|
+
result.label += ','.join(searchText);
|
|
115
|
+
} else {
|
|
116
|
+
result.label += searchText;
|
|
117
|
+
}
|
|
118
|
+
result.label += `\"`;
|
|
119
|
+
if (zincObjects.length === 1) {
|
|
120
|
+
if (zincObjects[0].isRegion) {
|
|
121
|
+
result.regionPath = zincObjects[0].getFullPath();
|
|
122
|
+
} else if (zincObjects[0].isZincObject) {
|
|
123
|
+
result.regionPath = zincObjects[0].getRegion().getFullPath();
|
|
124
|
+
result.label = zincObjects[0].groupName;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
result["zincObjects"] = createUnqiuesFromObjects(zincObjects);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
search(text) {
|
|
132
|
+
const results = this._searchEngine.search(text, {prefix: true});
|
|
133
|
+
const zincResults = this.zincObjects.filter(zincObject => results.map(r => r.id).includes(zincObject.uuid));
|
|
134
|
+
const regionResults = this.regions.filter(region => results.map(r => r.id).includes(region.uuid));
|
|
135
|
+
zincResults.push(...regionResults);
|
|
136
|
+
return zincResults;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
searchTerms(terms) {
|
|
140
|
+
let results = [];
|
|
141
|
+
terms.forEach(term => {
|
|
142
|
+
const result = this.search(term);
|
|
143
|
+
results.push(...result);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
return results;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
searchAndProcessResult(terms) {
|
|
150
|
+
let zincObjectResults = [];
|
|
151
|
+
if (Array.isArray(terms)) {
|
|
152
|
+
zincObjectResults = this.searchTerms(terms);
|
|
153
|
+
} else {
|
|
154
|
+
zincObjectResults = this.search(terms);
|
|
155
|
+
}
|
|
156
|
+
return this.processResults(zincObjectResults, terms);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//==============================================================================
|
|
162
|
+
|
|
163
|
+
class SearchResults
|
|
164
|
+
{
|
|
165
|
+
constructor(results)
|
|
166
|
+
{
|
|
167
|
+
this.__results = results.sort((a, b) => (b.score - a.score));
|
|
168
|
+
this.__featureIds = results.map(r => r.featureId);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
get featureIds()
|
|
172
|
+
{
|
|
173
|
+
return this.__featureIds;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
get results()
|
|
177
|
+
{
|
|
178
|
+
return this.__results;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
//==============================================================================
|
package/src/scripts/utilities.js
CHANGED
|
@@ -1,43 +1,146 @@
|
|
|
1
|
-
export const createListFromPrimitives = (primitives, list) => {
|
|
2
|
-
if (primitives) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
export const createListFromPrimitives = (primitives, list) => {
|
|
2
|
+
if (primitives) {
|
|
3
|
+
let id = "";
|
|
4
|
+
primitives.forEach(primitive => {
|
|
5
|
+
id = primitive.uuid;
|
|
6
|
+
if (primitive.region) {
|
|
7
|
+
id = primitive.region.uuid + "/" + id;
|
|
8
|
+
}
|
|
9
|
+
if (primitive && primitive.getVisibility()) {
|
|
10
|
+
list.push(id);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
return list;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const extractAllFullPaths = (item, list) => {
|
|
18
|
+
let nodeName = "";
|
|
19
|
+
if (item.isRegion) {
|
|
20
|
+
nodeName = `__r${item.regionPath}`;
|
|
21
|
+
}
|
|
22
|
+
if (item.isPrimitives) {
|
|
23
|
+
nodeName = `${item.regionPath}/${item.label}`;
|
|
24
|
+
}
|
|
25
|
+
list.push(nodeName);
|
|
26
|
+
if (item.children)
|
|
27
|
+
item.children.forEach(child => extractAllFullPaths(child, list));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const findObjectsWithNames = (rootRegion, names, regionPath, transverse) => {
|
|
31
|
+
let targetRegion = rootRegion;
|
|
32
|
+
const targetObjects = [];
|
|
33
|
+
if (regionPath)
|
|
34
|
+
targetRegion = rootRegion.findChildFromPath(regionPath);
|
|
35
|
+
if (targetRegion) {
|
|
36
|
+
const isArray = Array.isArray(names);
|
|
37
|
+
let array = names;
|
|
38
|
+
if (!isArray) {
|
|
39
|
+
array = [array];
|
|
40
|
+
}
|
|
41
|
+
array.forEach(name => {
|
|
42
|
+
const temp = targetRegion.findObjectsWithGroupName(name, transverse);
|
|
43
|
+
targetObjects.push(...temp);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return targetObjects;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const getAllObjects = (scene) => {
|
|
50
|
+
let objects = scene.getRootRegion().getAllObjects(true);
|
|
51
|
+
let id = 1;
|
|
52
|
+
return objects.map(object => Object.assign(object, { id: id++ })); // Add id to each object
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const findObjectWithUUID = (objects, uuid, remove) => {
|
|
56
|
+
const index = objects.findIndex(obj => obj.uuid === uuid);
|
|
57
|
+
let object = undefined;
|
|
58
|
+
if (index > -1) {
|
|
59
|
+
object = objects[index];
|
|
60
|
+
if (remove) {
|
|
61
|
+
objects.splice(i, 1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return object;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export const convertUUIDsToFullPaths = (rootRegion, IDs) => {
|
|
68
|
+
const results = [];
|
|
69
|
+
if (rootRegion && IDs && IDs.length > 0) {
|
|
70
|
+
//a region to primitivs map list
|
|
71
|
+
const rpLists = {};
|
|
72
|
+
const reIDToPath = {};
|
|
73
|
+
const allRegions = [rootRegion, ...rootRegion.getChildRegions(true)];
|
|
74
|
+
let region = undefined;
|
|
75
|
+
let primitive = undefined;
|
|
76
|
+
let regionID = undefined;
|
|
77
|
+
|
|
78
|
+
IDs.forEach(id => {
|
|
79
|
+
const uuids = id.split("/");
|
|
80
|
+
regionID = uuids[0];
|
|
81
|
+
region = findObjectWithUUID(allRegions, regionID, false);
|
|
82
|
+
if (region) {
|
|
83
|
+
if (!reIDToPath[regionID]) {
|
|
84
|
+
reIDToPath[regionID] = region.getFullPath();
|
|
85
|
+
}
|
|
86
|
+
if (uuids[1]) {
|
|
87
|
+
if (!rpLists[regionID]) {
|
|
88
|
+
rpLists[regionID] = region.getAllObjects(false);
|
|
89
|
+
}
|
|
90
|
+
primitive = findObjectWithUUID(rpLists[regionID], uuids[1], true);
|
|
91
|
+
if (primitive) {
|
|
92
|
+
results.push(`${reIDToPath[regionID]}/${primitive.groupName}`);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
results.push(`__r/${reIDToPath[regionID]}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
return results;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const createUnqiuesFromObjects = (zincObjects) => {
|
|
104
|
+
if (zincObjects) {
|
|
105
|
+
const expanded = [];
|
|
106
|
+
zincObjects.forEach(obj => {
|
|
107
|
+
if (obj.isZincObject) {
|
|
108
|
+
expanded.push(obj);
|
|
109
|
+
} else if (obj.isRegion) {
|
|
110
|
+
expanded.push(...obj.getAllObjects(true));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const uniq = Object.values(
|
|
114
|
+
expanded.reduce((acc, obj) => ({ ...acc, [obj.uuid]: obj }), {})
|
|
115
|
+
);
|
|
116
|
+
return uniq;
|
|
117
|
+
}
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const getObjectsFromAnnotations = (scene, annotations) => {
|
|
122
|
+
const returned = {label: "Multiple selections", regionPath: "", objects: []};
|
|
123
|
+
if (annotations && scene) {
|
|
124
|
+
const rpList = {};
|
|
125
|
+
const rootRegion = scene.getRootRegion();
|
|
126
|
+
if (annotations.length > 0) {
|
|
127
|
+
returned.regionPath = annotations[0].data.region;
|
|
128
|
+
returned.label = annotations[0].data.group;
|
|
129
|
+
}
|
|
130
|
+
annotations.forEach(annotation => {
|
|
131
|
+
if (!annotation.data.region.includes(returned.regionPath)) {
|
|
132
|
+
returned.regionPath = "";
|
|
133
|
+
}
|
|
134
|
+
if (returned.label !== annotation.data.group) {
|
|
135
|
+
returned.label = "Multiple selections";
|
|
136
|
+
}
|
|
137
|
+
const region = rootRegion.findChildFromPath(annotation.data.region);
|
|
138
|
+
if (!rpList[region.uuid]) {
|
|
139
|
+
rpList[region.uuid] = region.getAllObjects(false);
|
|
140
|
+
}
|
|
141
|
+
const obj = findObjectWithUUID(rpList[region.uuid], annotation.data.uuid);
|
|
142
|
+
if (obj) returned.objects.push(obj);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
return returned;
|
|
146
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="search-container">
|
|
3
|
+
<div class="text search-text">
|
|
4
|
+
Search within display
|
|
5
|
+
</div>
|
|
6
|
+
<el-autocomplete class="search-box" placeholder="Search"
|
|
7
|
+
v-model="searchText"
|
|
8
|
+
:fetch-suggestions="fetchSuggestions"
|
|
9
|
+
@keyup.enter.native="$emit('search', searchText)"
|
|
10
|
+
@select="$emit('search', $event.value)"
|
|
11
|
+
:popper-append-to-body=false
|
|
12
|
+
popper-class="autocomplete-popper">
|
|
13
|
+
</el-autocomplete>
|
|
14
|
+
<map-svg-icon icon="magnifyingGlass" class="magnify"
|
|
15
|
+
@click.native="$emit('search', searchText)"/>
|
|
16
|
+
<div v-if="failedSearch" class="text not-found-text">
|
|
17
|
+
'{{failedSearch}}' not found
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
/* eslint-disable no-alert, no-console */
|
|
24
|
+
import Vue from "vue";
|
|
25
|
+
import { MapSvgIcon } from '@abi-software/svg-sprite';
|
|
26
|
+
import { Autocomplete } from "element-ui";
|
|
27
|
+
import lang from "element-ui/lib/locale/lang/en";
|
|
28
|
+
import locale from "element-ui/lib/locale";
|
|
29
|
+
|
|
30
|
+
locale.use(lang);
|
|
31
|
+
Vue.use(Autocomplete);
|
|
32
|
+
|
|
33
|
+
export default {
|
|
34
|
+
name: "SearchControls",
|
|
35
|
+
props: {
|
|
36
|
+
failedSearch: undefined,
|
|
37
|
+
},
|
|
38
|
+
components: {
|
|
39
|
+
MapSvgIcon,
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
fetchSuggestions: function(term, cb) {
|
|
43
|
+
if (term === "") {
|
|
44
|
+
cb([]);
|
|
45
|
+
} else {
|
|
46
|
+
this.$emit('fetch-suggestions', { term, cb });
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
data: function () {
|
|
51
|
+
return {
|
|
52
|
+
searchText: "",
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
59
|
+
<style scoped lang="scss">
|
|
60
|
+
@import "~element-ui/packages/theme-chalk/src/autocomplete";
|
|
61
|
+
|
|
62
|
+
.search-container {
|
|
63
|
+
display:flex;
|
|
64
|
+
flex-direction: row;
|
|
65
|
+
|
|
66
|
+
.text {
|
|
67
|
+
margin-left: 8px;
|
|
68
|
+
margin-top: 7px;
|
|
69
|
+
font-weight: 500;
|
|
70
|
+
-moz-user-select: none;
|
|
71
|
+
-webkit-user-select: none;
|
|
72
|
+
-ms-user-select: none;
|
|
73
|
+
user-select: none;
|
|
74
|
+
line-height:18px;
|
|
75
|
+
}
|
|
76
|
+
.search-text {
|
|
77
|
+
margin-top: 8px;
|
|
78
|
+
color: $grey;
|
|
79
|
+
font-size: 14px;
|
|
80
|
+
margin-left: 1rem;
|
|
81
|
+
}
|
|
82
|
+
.not-found-text {
|
|
83
|
+
margin-top: 8px;
|
|
84
|
+
color: $warning;
|
|
85
|
+
font-size: 0.8rem;
|
|
86
|
+
margin-left: 0.5rem;
|
|
87
|
+
}
|
|
88
|
+
.search-box {
|
|
89
|
+
margin-top: 2px;
|
|
90
|
+
margin-left:0.5rem;
|
|
91
|
+
height:28px;
|
|
92
|
+
width:137px;
|
|
93
|
+
::v-deep .el-input__inner {
|
|
94
|
+
background-color: $background;
|
|
95
|
+
height:28px;
|
|
96
|
+
line-height:28px;
|
|
97
|
+
border: 1px solid rgb(144, 147, 153);
|
|
98
|
+
border-radius: 4px;
|
|
99
|
+
&:focus {
|
|
100
|
+
border-color: $app-primary-color;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
.magnify {
|
|
105
|
+
margin-top: 2px;
|
|
106
|
+
margin-left:0.5rem;
|
|
107
|
+
background: $app-primary-color;
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
height:28px;
|
|
110
|
+
width:28px;
|
|
111
|
+
cursor: pointer;
|
|
112
|
+
&:hover {
|
|
113
|
+
box-shadow: -3px 2px 4px 0 rgba(0,0,0,0.25);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
::v-deep .autocomplete-popper {
|
|
117
|
+
min-width:137px!important;
|
|
118
|
+
width: auto!important;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
</style>
|