@smartnet360/svelte-components 0.0.76 → 0.0.77
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.
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const BASE_LAT = 37.7749;
|
|
11
11
|
const BASE_LNG = -122.4194;
|
|
12
12
|
// Grid parameters for distributing sites
|
|
13
|
-
const NUM_SITES =
|
|
13
|
+
const NUM_SITES = 1700;
|
|
14
14
|
const GRID_SIZE = 10; // 10×10 grid
|
|
15
15
|
const LAT_SPACING = 0.01; // ~1.1 km spacing
|
|
16
16
|
const LNG_SPACING = 0.015; // ~1.1 km spacing (adjusted for longitude)
|
|
@@ -56,7 +56,16 @@
|
|
|
56
56
|
let treeStore = $state<Writable<TreeStoreValue> | null>(null);
|
|
57
57
|
let level1 = $state<Exclude<CellGroupingField, 'none'>>(store.groupingConfig.level1);
|
|
58
58
|
let level2 = $state<CellGroupingField>(store.groupingConfig.level2);
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
// Track checked paths separately to avoid re-filtering on expand/collapse
|
|
61
|
+
let checkedPaths = $state<Set<string>>(new Set());
|
|
62
|
+
|
|
63
|
+
// When checkedPaths change, re-run the filter
|
|
64
|
+
$effect(() => {
|
|
65
|
+
const newFilteredCells = getFilteredCells(checkedPaths, store.cellsFilteredByStatus);
|
|
66
|
+
store.setFilteredCells(newFilteredCells);
|
|
67
|
+
});
|
|
68
|
+
|
|
60
69
|
// Track config for localStorage invalidation
|
|
61
70
|
const STORAGE_CONFIG_KEY = 'cellular-cell-filter:config';
|
|
62
71
|
|
|
@@ -100,24 +109,30 @@
|
|
|
100
109
|
persistState: true,
|
|
101
110
|
defaultExpandAll: false
|
|
102
111
|
});
|
|
103
|
-
|
|
112
|
+
|
|
104
113
|
// Subscribe to tree changes and update filtered cells
|
|
105
114
|
if (treeStore) {
|
|
115
|
+
// This subscription now only syncs the checkedPaths state
|
|
116
|
+
// The $effect above will handle the actual filtering
|
|
106
117
|
const unsub = treeStore.subscribe((treeValue: TreeStoreValue) => {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
// getCheckedPaths() is expensive, so check if tree is initializing
|
|
119
|
+
if (treeValue.isInitializing) return;
|
|
120
|
+
|
|
121
|
+
const newCheckedPaths = new Set(treeValue.getCheckedPaths());
|
|
122
|
+
|
|
123
|
+
// Avoid unnecessary updates if the set hasn't changed
|
|
124
|
+
if (
|
|
125
|
+
newCheckedPaths.size !== checkedPaths.size ||
|
|
126
|
+
![...newCheckedPaths].every((path) => checkedPaths.has(path))
|
|
127
|
+
) {
|
|
128
|
+
checkedPaths = newCheckedPaths;
|
|
129
|
+
}
|
|
115
130
|
});
|
|
116
|
-
|
|
131
|
+
|
|
117
132
|
return () => unsub();
|
|
118
133
|
}
|
|
119
134
|
}
|
|
120
|
-
|
|
135
|
+
|
|
121
136
|
onMount(() => {
|
|
122
137
|
rebuildTree();
|
|
123
138
|
});
|