@thatopen/components 2.4.0-alpha.6 → 2.4.0-alpha.7
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/fragments/Classifier/index.d.ts +10 -0
- package/dist/index.cjs +41 -0
- package/dist/index.min.cjs +1 -1
- package/dist/index.min.mjs +1 -1
- package/dist/index.mjs +41 -0
- package/dist/namespace.d.ts +3469 -3459
- package/package.json +1 -2
package/dist/index.mjs
CHANGED
|
@@ -24071,6 +24071,47 @@ const _Classifier = class _Classifier extends Component {
|
|
|
24071
24071
|
found.resetColor(ids);
|
|
24072
24072
|
}
|
|
24073
24073
|
}
|
|
24074
|
+
/**
|
|
24075
|
+
* Exports the computed classification to persists them and import them back
|
|
24076
|
+
* later for faster loading.
|
|
24077
|
+
*/
|
|
24078
|
+
export() {
|
|
24079
|
+
const exported = {};
|
|
24080
|
+
for (const systemName in this.list) {
|
|
24081
|
+
exported[systemName] = {};
|
|
24082
|
+
const system = this.list[systemName];
|
|
24083
|
+
for (const groupName in system) {
|
|
24084
|
+
const group = system[groupName];
|
|
24085
|
+
exported[systemName][groupName] = {
|
|
24086
|
+
map: FRAGS.FragmentUtils.export(group.map),
|
|
24087
|
+
name: group.name,
|
|
24088
|
+
id: group.id
|
|
24089
|
+
};
|
|
24090
|
+
}
|
|
24091
|
+
}
|
|
24092
|
+
return JSON.stringify(exported);
|
|
24093
|
+
}
|
|
24094
|
+
/**
|
|
24095
|
+
* Imports a classification previously exported with .export().
|
|
24096
|
+
* @param data the serialized classification to import.
|
|
24097
|
+
*/
|
|
24098
|
+
import(data) {
|
|
24099
|
+
const imported = JSON.parse(data);
|
|
24100
|
+
for (const systemName in imported) {
|
|
24101
|
+
if (!this.list[systemName]) {
|
|
24102
|
+
this.list[systemName] = {};
|
|
24103
|
+
}
|
|
24104
|
+
const system = imported[systemName];
|
|
24105
|
+
for (const groupName in system) {
|
|
24106
|
+
const group = system[groupName];
|
|
24107
|
+
this.list[systemName][groupName] = {
|
|
24108
|
+
map: FRAGS.FragmentUtils.import(group.map),
|
|
24109
|
+
name: group.name,
|
|
24110
|
+
id: group.id
|
|
24111
|
+
};
|
|
24112
|
+
}
|
|
24113
|
+
}
|
|
24114
|
+
}
|
|
24074
24115
|
saveItem(group, systemName, className, expressID, parentID = null) {
|
|
24075
24116
|
if (!this.list[systemName]) {
|
|
24076
24117
|
this.list[systemName] = {};
|