@abi-software/scaffoldvuer 1.5.1 → 1.6.0
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/dist/scaffoldvuer.js +6679 -6823
- package/dist/scaffoldvuer.umd.cjs +37 -37
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/src/App.vue +10 -3
- package/src/components/ScaffoldTooltip.vue +4 -7
- package/src/components/ScaffoldTreeControls.vue +6 -0
- package/src/components/ScaffoldVuer.vue +155 -51
- package/src/components.d.ts +0 -3
- package/src/scripts/Search.js +60 -70
- package/src/components/CreateTooltipContent.vue +0 -201
package/src/scripts/Search.js
CHANGED
|
@@ -44,60 +44,47 @@ export class SearchIndex
|
|
|
44
44
|
this._searchEngine = new MiniSearch({
|
|
45
45
|
fields: ['path', 'name'],
|
|
46
46
|
storeFields: ['path'],
|
|
47
|
-
tokenize: (string, _fieldName) => string.split(
|
|
47
|
+
tokenize: (string, _fieldName) => string.split(/[\s/]+/), // indexing tokenizer
|
|
48
48
|
});
|
|
49
|
-
this.
|
|
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
|
-
}
|
|
49
|
+
this.idMaps = {};
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
addZincObject(zincObject, id)
|
|
70
53
|
//=======================
|
|
71
54
|
{
|
|
72
55
|
const path = zincObject.getRegion().getFullPath();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
56
|
+
let groupName = zincObject.groupName;
|
|
57
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
58
|
+
groupName = groupName.replaceAll('"', '');
|
|
59
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
60
|
+
const item = { path: fullPath, name: groupName, id };
|
|
61
|
+
this._searchEngine.add(item);
|
|
62
|
+
this.idMaps[id] = { path: fullPath, zincObject };
|
|
77
63
|
}
|
|
78
64
|
|
|
79
65
|
removeZincObject(zincObject, id)
|
|
80
66
|
//=======================
|
|
81
67
|
{
|
|
82
68
|
const path = zincObject.getRegion().getFullPath();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
69
|
+
let groupName = zincObject.groupName;
|
|
70
|
+
let fullPath = path ? `${path}/${zincObject.groupName}` : zincObject.groupName;
|
|
71
|
+
groupName = groupName.replaceAll('"', '');
|
|
72
|
+
fullPath = fullPath.replaceAll('"', '');
|
|
73
|
+
const item = { path: fullPath, name: groupName, id };
|
|
74
|
+
this._searchEngine.remove(item);
|
|
75
|
+
delete this.idMaps[id];
|
|
93
76
|
}
|
|
94
77
|
|
|
95
78
|
addRegion(region, id)
|
|
96
79
|
//=======================
|
|
97
80
|
{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
let path = region.getFullPath();
|
|
82
|
+
let regionName = region.getName();
|
|
83
|
+
path = path.replaceAll('"', '');
|
|
84
|
+
regionName = regionName.replaceAll('"', '');
|
|
85
|
+
const item = { path, name: regionName, id };
|
|
86
|
+
this._searchEngine.add(item);
|
|
87
|
+
this.idMaps[id] = { path, zincObject: region };
|
|
101
88
|
}
|
|
102
89
|
|
|
103
90
|
clearResults()
|
|
@@ -110,17 +97,32 @@ export class SearchIndex
|
|
|
110
97
|
//=======================
|
|
111
98
|
{
|
|
112
99
|
this._searchEngine.removeAll();
|
|
113
|
-
this.zincObjects.length = 0;
|
|
114
|
-
this.regions.length = 0;
|
|
100
|
+
//this.zincObjects.length = 0;
|
|
101
|
+
//this.regions.length = 0;
|
|
102
|
+
this.idMaps = {};
|
|
115
103
|
}
|
|
116
104
|
|
|
117
|
-
auto_suggest(text)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
105
|
+
auto_suggest(text) {
|
|
106
|
+
let results = [];
|
|
107
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
108
|
+
text = text.replaceAll(text.slice(0, 1), '')
|
|
109
|
+
results = this._searchEngine.search(text, {prefix: true, combineWith: 'AND'})
|
|
110
|
+
} else if (text.length > 1) {
|
|
111
|
+
results = this._searchEngine.search(text, {prefix: true})
|
|
112
|
+
}
|
|
113
|
+
const items = [];
|
|
114
|
+
results.forEach(r => {
|
|
115
|
+
if (r.id in this.idMaps) {
|
|
116
|
+
items.push(this.idMaps[r.id].path);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
const unique = [...new Set(items)];
|
|
120
|
+
const returned = [];
|
|
121
|
+
unique.forEach(u => returned.push({suggestion: '"' + u + '"'}));
|
|
122
|
+
return returned;
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
|
|
124
126
|
processResults(zincObjects, searchText) {
|
|
125
127
|
const result = {
|
|
126
128
|
regionPath: undefined,
|
|
@@ -145,11 +147,21 @@ export class SearchIndex
|
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
search(text) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
let results = undefined;
|
|
151
|
+
if (text.length > 2 && ["'", '"'].includes(text.slice(0, 1))) {
|
|
152
|
+
text = text.replaceAll(text.slice(0, 1), '')
|
|
153
|
+
console.log(text)
|
|
154
|
+
results = this._searchEngine.search(text, {prefix: true, combineWith: 'AND'})
|
|
155
|
+
} else if (text.length > 1) {
|
|
156
|
+
results = this._searchEngine.search(text, {prefix: true})
|
|
157
|
+
}
|
|
158
|
+
const zincResults = [];
|
|
159
|
+
results.forEach(r => {
|
|
160
|
+
if (r.id in this.idMaps) {
|
|
161
|
+
zincResults.push(this.idMaps[r.id].zincObject);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
return zincResults;
|
|
153
165
|
}
|
|
154
166
|
|
|
155
167
|
searchTerms(terms) {
|
|
@@ -174,25 +186,3 @@ export class SearchIndex
|
|
|
174
186
|
|
|
175
187
|
}
|
|
176
188
|
|
|
177
|
-
//==============================================================================
|
|
178
|
-
|
|
179
|
-
class SearchResults
|
|
180
|
-
{
|
|
181
|
-
constructor(results)
|
|
182
|
-
{
|
|
183
|
-
this.__results = results.sort((a, b) => (b.score - a.score));
|
|
184
|
-
this.__featureIds = results.map(r => r.featureId);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
get featureIds()
|
|
188
|
-
{
|
|
189
|
-
return this.__featureIds;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
get results()
|
|
193
|
-
{
|
|
194
|
-
return this.__results;
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
//==============================================================================
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<el-container class="create-container">
|
|
3
|
-
<el-header height="30px" class="header">
|
|
4
|
-
<div>Create {{ createData.shape }}</div>
|
|
5
|
-
</el-header>
|
|
6
|
-
<el-main class="slides-block">
|
|
7
|
-
<span class="create-text">
|
|
8
|
-
Primitives will be created in the
|
|
9
|
-
<br>
|
|
10
|
-
__annotation region
|
|
11
|
-
</span>
|
|
12
|
-
<el-row class="row" v-show="showPoint">
|
|
13
|
-
<el-col :offset="0" :span="8">
|
|
14
|
-
Position:
|
|
15
|
-
</el-col>
|
|
16
|
-
<el-col :offset="0" :span="16">
|
|
17
|
-
<el-row v-for="{ value, i } in createData.points" :key="i" class="value">
|
|
18
|
-
{{ i }}
|
|
19
|
-
</el-row>
|
|
20
|
-
</el-col>
|
|
21
|
-
</el-row>
|
|
22
|
-
<el-row class="row">
|
|
23
|
-
<el-col :offset="0" :span="8">
|
|
24
|
-
Region:
|
|
25
|
-
</el-col>
|
|
26
|
-
<el-col :offset="0" :span="16">
|
|
27
|
-
<el-input
|
|
28
|
-
v-model="region"
|
|
29
|
-
placeholder="__annotation"
|
|
30
|
-
size="small"
|
|
31
|
-
/>
|
|
32
|
-
</el-col>
|
|
33
|
-
</el-row>
|
|
34
|
-
<el-row class="row">
|
|
35
|
-
<el-col :offset="0" :span="8">
|
|
36
|
-
Group:
|
|
37
|
-
</el-col>
|
|
38
|
-
<el-col :offset="0" :span="16">
|
|
39
|
-
<el-input
|
|
40
|
-
v-model="group"
|
|
41
|
-
:placeholder="createData.shape"
|
|
42
|
-
size="small"
|
|
43
|
-
/>
|
|
44
|
-
</el-col>
|
|
45
|
-
</el-row>
|
|
46
|
-
<el-row>
|
|
47
|
-
<el-col :offset="0" :span="12">
|
|
48
|
-
<el-button
|
|
49
|
-
type="primary"
|
|
50
|
-
plain
|
|
51
|
-
@click="confirm"
|
|
52
|
-
>
|
|
53
|
-
{{ confirmText }}
|
|
54
|
-
</el-button>
|
|
55
|
-
</el-col>
|
|
56
|
-
<el-col :offset="0" :span="12">
|
|
57
|
-
<el-button
|
|
58
|
-
type="primary"
|
|
59
|
-
plain
|
|
60
|
-
@click="cancel"
|
|
61
|
-
>
|
|
62
|
-
Cancel
|
|
63
|
-
</el-button>
|
|
64
|
-
</el-col>
|
|
65
|
-
</el-row>
|
|
66
|
-
</el-main>
|
|
67
|
-
</el-container>
|
|
68
|
-
</template>
|
|
69
|
-
|
|
70
|
-
<script>
|
|
71
|
-
/* eslint-disable no-alert, no-console */
|
|
72
|
-
|
|
73
|
-
import {
|
|
74
|
-
ElButton as Button,
|
|
75
|
-
ElCol as Col,
|
|
76
|
-
ElContainer as Container,
|
|
77
|
-
ElHeader as Header,
|
|
78
|
-
ElInput as Input,
|
|
79
|
-
ElMain as Main,
|
|
80
|
-
|
|
81
|
-
} from "element-plus";
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* A component to control the opacity of the target object.
|
|
85
|
-
*/
|
|
86
|
-
export default {
|
|
87
|
-
name: "CreateTooltipContent",
|
|
88
|
-
components: {
|
|
89
|
-
Button,
|
|
90
|
-
Col,
|
|
91
|
-
Container,
|
|
92
|
-
Header,
|
|
93
|
-
Input,
|
|
94
|
-
Main,
|
|
95
|
-
},
|
|
96
|
-
props: {
|
|
97
|
-
createData: {
|
|
98
|
-
type: Object,
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
watch: {
|
|
102
|
-
"createData.shape": {
|
|
103
|
-
handler: function (value) {
|
|
104
|
-
this.group = value;
|
|
105
|
-
this.$emit("cancel-create");
|
|
106
|
-
},
|
|
107
|
-
immediate: true,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
computed: {
|
|
111
|
-
confirmText: function () {
|
|
112
|
-
if (this.createData.editingIndex > -1) {
|
|
113
|
-
return "Edit";
|
|
114
|
-
}
|
|
115
|
-
return "Confirm";
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
data: function () {
|
|
119
|
-
return {
|
|
120
|
-
group: "default",
|
|
121
|
-
region: "",
|
|
122
|
-
showPoint: false,
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
methods: {
|
|
126
|
-
confirm: function () {
|
|
127
|
-
this.$emit(
|
|
128
|
-
"confirm-create",
|
|
129
|
-
{
|
|
130
|
-
region: "__annotation/" + this.region,
|
|
131
|
-
group: this.group,
|
|
132
|
-
shape: this.createData.shape,
|
|
133
|
-
editingIndex: this.createData.editingIndex,
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
this.group = this.createData.shape;
|
|
137
|
-
},
|
|
138
|
-
cancel: function () {
|
|
139
|
-
this.$emit("cancel-create");
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
};
|
|
143
|
-
</script>
|
|
144
|
-
|
|
145
|
-
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
|
146
|
-
<style scoped lang="scss">
|
|
147
|
-
.header {
|
|
148
|
-
color: #606266;
|
|
149
|
-
line-height: 1;
|
|
150
|
-
padding: 8px 17px 1px 15px;
|
|
151
|
-
border-bottom: 1px solid #ebeef5;
|
|
152
|
-
font-size: 14px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.row {
|
|
156
|
-
margin: 4px;
|
|
157
|
-
text-align: left;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
:deep(.create-text) {
|
|
161
|
-
max-width: 220px;
|
|
162
|
-
height:35px;
|
|
163
|
-
font-size: 12px;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
.create-container {
|
|
168
|
-
width: 250px;
|
|
169
|
-
height: auto;
|
|
170
|
-
border-radius: 4px;
|
|
171
|
-
border: solid 1px #d8dce6;
|
|
172
|
-
background-color: #fff;
|
|
173
|
-
overflow-y: none;
|
|
174
|
-
user-select: auto;
|
|
175
|
-
pointer-events: auto;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.value {
|
|
179
|
-
font-size: 12px;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.input-box {
|
|
183
|
-
width: 42px;
|
|
184
|
-
border-radius: 4px;
|
|
185
|
-
border: 1px solid rgb(144, 147, 153);
|
|
186
|
-
background-color: var(--white);
|
|
187
|
-
font-weight: 500;
|
|
188
|
-
color: rgb(48, 49, 51);
|
|
189
|
-
margin-left: 8px;
|
|
190
|
-
height: 24px;
|
|
191
|
-
|
|
192
|
-
&.number-input {
|
|
193
|
-
width: 42px;
|
|
194
|
-
:deep(.el-input__wrapper) {
|
|
195
|
-
padding-left: 0px;
|
|
196
|
-
padding-right: 0px;
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
</style>
|