@smartnet360/svelte-components 0.0.14 â 0.0.16
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.
@@ -53,16 +53,32 @@
|
|
53
53
|
}
|
54
54
|
});
|
55
55
|
|
56
|
-
|
56
|
+
// Get available electrical tilts from antennas with the selected name and frequency
|
57
57
|
let availableElectricalTilts = $state<string[]>(['0']);
|
58
58
|
$effect(() => {
|
59
|
+
console.log('đ [TILTS] Effect triggered - updating available tilts:', {
|
60
|
+
antenna: internalSelectedAntenna?.name,
|
61
|
+
frequency: selectedFrequency,
|
62
|
+
currentTilts: availableElectricalTilts,
|
63
|
+
timestamp: new Date().toISOString()
|
64
|
+
});
|
65
|
+
|
66
|
+
let newTilts: string[] = ['0'];
|
67
|
+
|
59
68
|
if (internalSelectedAntenna) {
|
60
69
|
// Find ALL antennas with the same name and frequency to collect all electrical tilts
|
61
70
|
let sameName = antennas.filter(a => a.name === internalSelectedAntenna!.name);
|
71
|
+
console.log('đ [TILTS] Found antennas with same name:', sameName.length);
|
62
72
|
|
63
73
|
// If frequency is selected, filter by it
|
64
74
|
if (selectedFrequency) {
|
75
|
+
const beforeFilter = sameName.length;
|
65
76
|
sameName = sameName.filter(a => a.frequency === selectedFrequency);
|
77
|
+
console.log('đ [TILTS] After frequency filter:', {
|
78
|
+
before: beforeFilter,
|
79
|
+
after: sameName.length,
|
80
|
+
frequency: selectedFrequency
|
81
|
+
});
|
66
82
|
}
|
67
83
|
|
68
84
|
const allTilts = new Set<string>();
|
@@ -79,9 +95,20 @@
|
|
79
95
|
});
|
80
96
|
|
81
97
|
// Convert to sorted array
|
82
|
-
|
98
|
+
newTilts = Array.from(allTilts).sort((a, b) => parseFloat(a) - parseFloat(b));
|
99
|
+
|
100
|
+
console.log('â
[TILTS] Available tilts calculated:', {
|
101
|
+
from: availableElectricalTilts,
|
102
|
+
to: newTilts,
|
103
|
+
changed: JSON.stringify(availableElectricalTilts) !== JSON.stringify(newTilts)
|
104
|
+
});
|
83
105
|
} else {
|
84
|
-
|
106
|
+
console.log('âšī¸ [TILTS] No antenna selected, using default tilts');
|
107
|
+
}
|
108
|
+
|
109
|
+
// Only update if actually changed to prevent infinite loops
|
110
|
+
if (JSON.stringify(availableElectricalTilts) !== JSON.stringify(newTilts)) {
|
111
|
+
availableElectricalTilts = newTilts;
|
85
112
|
}
|
86
113
|
});
|
87
114
|
|
@@ -114,20 +141,146 @@
|
|
114
141
|
|
115
142
|
// Handle frequency selection
|
116
143
|
function handleFrequencyChange(frequency: number) {
|
144
|
+
console.log('đ [FREQ] handleFrequencyChange called:', {
|
145
|
+
requestedFrequency: frequency,
|
146
|
+
currentSelectedFrequency: selectedFrequency,
|
147
|
+
currentAntenna: internalSelectedAntenna?.name,
|
148
|
+
currentTiltIndex: internalElectricalTiltIndex,
|
149
|
+
availableTilts: availableElectricalTilts,
|
150
|
+
timestamp: new Date().toISOString()
|
151
|
+
});
|
152
|
+
|
153
|
+
const previousFrequency = selectedFrequency;
|
117
154
|
selectedFrequency = frequency;
|
118
155
|
|
119
|
-
|
120
|
-
|
156
|
+
console.log('đ [FREQ] Frequency state updated:', {
|
157
|
+
from: previousFrequency,
|
158
|
+
to: selectedFrequency,
|
159
|
+
changed: previousFrequency !== selectedFrequency
|
160
|
+
});
|
121
161
|
|
122
|
-
// Find the antenna with the new frequency and default tilt
|
123
162
|
if (internalSelectedAntenna) {
|
124
|
-
|
163
|
+
// STEP 1: Calculate available tilts for the new frequency
|
164
|
+
let sameName = antennas.filter(a => a.name === internalSelectedAntenna!.name && a.frequency === frequency);
|
165
|
+
|
166
|
+
console.log('đ [FREQ] Found antennas with same name and new frequency:', {
|
167
|
+
antennaName: internalSelectedAntenna.name,
|
168
|
+
frequency: frequency,
|
169
|
+
count: sameName.length
|
170
|
+
});
|
171
|
+
|
172
|
+
const allTilts = new Set<string>();
|
173
|
+
sameName.forEach(antenna => {
|
174
|
+
if (antenna.tilt) {
|
175
|
+
const tiltString = antenna.tilt.toString();
|
176
|
+
if (tiltString.includes(',')) {
|
177
|
+
tiltString.split(',').forEach(t => allTilts.add(t.trim()));
|
178
|
+
} else {
|
179
|
+
allTilts.add(tiltString);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
});
|
183
|
+
|
184
|
+
const newAvailableTilts = Array.from(allTilts).sort((a, b) => parseFloat(a) - parseFloat(b));
|
185
|
+
|
186
|
+
console.log('đ§ [FREQ] Calculated tilts for new frequency:', {
|
187
|
+
availableTilts: newAvailableTilts,
|
188
|
+
hasZeroTilt: newAvailableTilts.includes('0')
|
189
|
+
});
|
190
|
+
|
191
|
+
// STEP 2: Determine the best tilt index to use
|
192
|
+
let bestTiltIndex = 0;
|
193
|
+
let bestTiltValue = '0';
|
194
|
+
|
195
|
+
if (newAvailableTilts.length > 0) {
|
196
|
+
// Prefer '0' tilt if available, otherwise use first available
|
197
|
+
if (newAvailableTilts.includes('0')) {
|
198
|
+
bestTiltIndex = newAvailableTilts.indexOf('0');
|
199
|
+
bestTiltValue = '0';
|
200
|
+
} else {
|
201
|
+
bestTiltIndex = 0;
|
202
|
+
bestTiltValue = newAvailableTilts[0];
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
console.log('đ¯ [FREQ] Selected best tilt:', {
|
207
|
+
index: bestTiltIndex,
|
208
|
+
value: bestTiltValue,
|
209
|
+
reason: newAvailableTilts.includes('0') ? 'preferred 0 tilt' : 'first available tilt'
|
210
|
+
});
|
211
|
+
|
212
|
+
// STEP 3: Find antenna with the new frequency and best tilt
|
213
|
+
const antennaWithNewFreq = antennas.find(antenna => {
|
214
|
+
if (antenna.name !== internalSelectedAntenna!.name) return false;
|
215
|
+
if (antenna.frequency !== frequency) return false;
|
216
|
+
|
217
|
+
// Check if this antenna has the target tilt
|
218
|
+
if (antenna.tilt) {
|
219
|
+
const antennaTiltString = antenna.tilt.toString();
|
220
|
+
const antennaTilts = antennaTiltString.includes(',')
|
221
|
+
? antennaTiltString.split(',').map(t => t.trim())
|
222
|
+
: [antennaTiltString];
|
223
|
+
return antennaTilts.includes(bestTiltValue);
|
224
|
+
}
|
225
|
+
return bestTiltValue === '0';
|
226
|
+
});
|
227
|
+
|
228
|
+
console.log('đ¯ [FREQ] Antenna search result:', {
|
229
|
+
found: !!antennaWithNewFreq,
|
230
|
+
searchCriteria: {
|
231
|
+
name: internalSelectedAntenna.name,
|
232
|
+
frequency: frequency,
|
233
|
+
tiltValue: bestTiltValue
|
234
|
+
},
|
235
|
+
antenna: antennaWithNewFreq ? {
|
236
|
+
name: antennaWithNewFreq.name,
|
237
|
+
frequency: antennaWithNewFreq.frequency,
|
238
|
+
tilt: antennaWithNewFreq.tilt
|
239
|
+
} : null
|
240
|
+
});
|
241
|
+
|
125
242
|
if (antennaWithNewFreq) {
|
243
|
+
const previousAntenna = internalSelectedAntenna;
|
244
|
+
const previousTiltIndex = internalElectricalTiltIndex;
|
245
|
+
|
126
246
|
internalSelectedAntenna = antennaWithNewFreq;
|
247
|
+
internalElectricalTiltIndex = bestTiltIndex;
|
248
|
+
|
249
|
+
console.log('â
[FREQ] Antenna and tilt updated:', {
|
250
|
+
antenna: {
|
251
|
+
from: {
|
252
|
+
name: previousAntenna.name,
|
253
|
+
frequency: previousAntenna.frequency,
|
254
|
+
tilt: previousAntenna.tilt
|
255
|
+
},
|
256
|
+
to: {
|
257
|
+
name: antennaWithNewFreq.name,
|
258
|
+
frequency: antennaWithNewFreq.frequency,
|
259
|
+
tilt: antennaWithNewFreq.tilt
|
260
|
+
}
|
261
|
+
},
|
262
|
+
tiltIndex: {
|
263
|
+
from: previousTiltIndex,
|
264
|
+
to: bestTiltIndex
|
265
|
+
}
|
266
|
+
});
|
267
|
+
|
268
|
+
console.log('đ [FREQ] Calling onAntennaChange callback');
|
127
269
|
onAntennaChange?.(antennaWithNewFreq);
|
270
|
+
|
271
|
+
console.log('đ [FREQ] Calling onElectricalTiltChange callback with index', bestTiltIndex);
|
272
|
+
onElectricalTiltChange?.(bestTiltIndex);
|
273
|
+
} else {
|
274
|
+
console.warn('â ī¸ [FREQ] No antenna found for frequency, keeping current antenna');
|
275
|
+
// Reset tilt to 0 as fallback
|
276
|
+
internalElectricalTiltIndex = 0;
|
277
|
+
onElectricalTiltChange?.(0);
|
128
278
|
}
|
279
|
+
} else {
|
280
|
+
console.log('âšī¸ [FREQ] No current antenna selected');
|
281
|
+
internalElectricalTiltIndex = 0;
|
282
|
+
onElectricalTiltChange?.(0);
|
129
283
|
}
|
130
|
-
onElectricalTiltChange?.(0);
|
131
284
|
}
|
132
285
|
|
133
286
|
// Handle antenna selection
|
@@ -345,7 +498,16 @@
|
|
345
498
|
<button
|
346
499
|
type="button"
|
347
500
|
class="btn btn-sm {selectedFrequency === freq ? 'btn-primary' : 'btn-outline-secondary'}"
|
348
|
-
onclick={() =>
|
501
|
+
onclick={(e) => {
|
502
|
+
console.log('đąī¸ [FREQ] Button clicked:', {
|
503
|
+
frequency: freq,
|
504
|
+
currentSelectedFrequency: selectedFrequency,
|
505
|
+
isAlreadySelected: selectedFrequency === freq,
|
506
|
+
clickEvent: e.type,
|
507
|
+
timestamp: new Date().toISOString()
|
508
|
+
});
|
509
|
+
handleFrequencyChange(freq);
|
510
|
+
}}
|
349
511
|
>
|
350
512
|
{freq} MHz
|
351
513
|
</button>
|
@@ -39,12 +39,35 @@
|
|
39
39
|
|
40
40
|
// Handle antenna selection from controls
|
41
41
|
function handleAntenna1Change(antenna: Antenna | null) {
|
42
|
+
console.log('đĨ [PARENT] handleAntenna1Change called:', {
|
43
|
+
antenna: antenna ? {
|
44
|
+
name: antenna.name,
|
45
|
+
frequency: antenna.frequency,
|
46
|
+
tilt: antenna.tilt
|
47
|
+
} : null,
|
48
|
+
previousAntenna: selectedAntenna ? {
|
49
|
+
name: selectedAntenna.name,
|
50
|
+
frequency: selectedAntenna.frequency,
|
51
|
+
tilt: selectedAntenna.tilt
|
52
|
+
} : null,
|
53
|
+
timestamp: new Date().toISOString()
|
54
|
+
});
|
55
|
+
|
42
56
|
selectedAntenna = antenna;
|
43
57
|
if (antenna) {
|
44
58
|
// Update available electrical tilts based on selected antenna
|
59
|
+
const previousTilts = [...availableElectricalTilts];
|
45
60
|
availableElectricalTilts = antenna.tilt ?
|
46
61
|
antenna.tilt.split(',').map(t => t.trim()) :
|
47
62
|
['0', '2', '4', '6', '8'];
|
63
|
+
|
64
|
+
console.log('đ§ [PARENT] Updated available tilts and reset positions:', {
|
65
|
+
from: previousTilts,
|
66
|
+
to: availableElectricalTilts,
|
67
|
+
electricalTiltReset: ant1ElectricalTilt,
|
68
|
+
mechanicalTiltReset: ant1MechanicalTilt
|
69
|
+
});
|
70
|
+
|
48
71
|
ant1ElectricalTilt = 0;
|
49
72
|
ant1MechanicalTilt = 0;
|
50
73
|
}
|
@@ -60,10 +83,22 @@
|
|
60
83
|
|
61
84
|
// Handle electrical tilt changes from controls
|
62
85
|
function handleTilt1Change(tilt: number) {
|
86
|
+
console.log('đĨ [PARENT] handleTilt1Change called:', {
|
87
|
+
tilt,
|
88
|
+
previousTilt: ant1ElectricalTilt,
|
89
|
+
changed: tilt !== ant1ElectricalTilt,
|
90
|
+
timestamp: new Date().toISOString()
|
91
|
+
});
|
63
92
|
ant1ElectricalTilt = tilt;
|
64
93
|
}
|
65
94
|
|
66
95
|
function handleTilt2Change(tilt: number) {
|
96
|
+
console.log('đĨ [PARENT] handleTilt2Change called:', {
|
97
|
+
tilt,
|
98
|
+
previousTilt: ant2ElectricalTilt,
|
99
|
+
changed: tilt !== ant2ElectricalTilt,
|
100
|
+
timestamp: new Date().toISOString()
|
101
|
+
});
|
67
102
|
ant2ElectricalTilt = tilt;
|
68
103
|
}
|
69
104
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@smartnet360/svelte-components",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.16",
|
4
4
|
"scripts": {
|
5
5
|
"dev": "vite dev",
|
6
6
|
"build": "vite build && npm run prepack",
|
@@ -33,7 +33,9 @@
|
|
33
33
|
},
|
34
34
|
"peerDependencies": {
|
35
35
|
"plotly.js-dist-min": "^3.1.0",
|
36
|
-
"svelte": "^5.0.0"
|
36
|
+
"svelte": "^5.0.0",
|
37
|
+
"bootstrap": "^5.2.3",
|
38
|
+
"dexie": "^4.0.11"
|
37
39
|
},
|
38
40
|
"devDependencies": {
|
39
41
|
"@eslint/compat": "^1.2.5",
|
@@ -54,17 +56,15 @@
|
|
54
56
|
"svelte-check": "^4.0.0",
|
55
57
|
"typescript": "^5.0.0",
|
56
58
|
"typescript-eslint": "^8.20.0",
|
57
|
-
"vite": "^7.0.4"
|
59
|
+
"vite": "^7.0.4",
|
60
|
+
"@sveltejs/adapter-static": "^3.0.9",
|
61
|
+
"bootstrap": "^5.2.3",
|
62
|
+
"bootstrap-icons": "^1.13.1",
|
63
|
+
"dexie": "^4.0.11",
|
64
|
+
"plotly.js-dist-min": "^3.1.0"
|
58
65
|
},
|
59
66
|
"keywords": [
|
60
67
|
"svelte"
|
61
68
|
],
|
62
|
-
"dependencies": {
|
63
|
-
"bootstrap": "^5.2.3",
|
64
|
-
"plotly.js-dist-min": "^3.1.0",
|
65
|
-
"@sveltejs/adapter-static": "^3.0.9",
|
66
|
-
"bootstrap-icons": "^1.13.1",
|
67
|
-
"chart.js": "^4.4.9",
|
68
|
-
"dexie": "^4.0.11"
|
69
|
-
}
|
69
|
+
"dependencies": {}
|
70
70
|
}
|