@smartnet360/svelte-components 0.0.134 → 0.0.136

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.
Files changed (43) hide show
  1. package/dist/core/CellHistory/CellHistoryPanel.svelte +178 -0
  2. package/dist/core/CellHistory/CellHistoryPanel.svelte.d.ts +4 -0
  3. package/dist/core/CellHistory/column-config.d.ts +26 -0
  4. package/dist/core/CellHistory/column-config.js +120 -0
  5. package/dist/core/CellHistory/index.d.ts +9 -0
  6. package/dist/core/CellHistory/index.js +10 -0
  7. package/dist/core/CellHistory/transformers.d.ts +16 -0
  8. package/dist/core/CellHistory/transformers.js +76 -0
  9. package/dist/core/CellHistory/types.d.ts +54 -0
  10. package/dist/core/CellHistory/types.js +6 -0
  11. package/dist/core/{CellTable → CellTableV2}/CellTable.svelte +7 -3
  12. package/dist/core/{CellTable → CellTableV2}/CellTable.svelte.d.ts +3 -0
  13. package/dist/core/{CellTable → CellTableV2}/CellTablePanel.svelte +87 -235
  14. package/dist/core/{CellTable → CellTableV2}/CellTablePanel.svelte.d.ts +16 -2
  15. package/dist/core/{CellTable → CellTableV2}/CellTableToolbar.svelte +0 -1
  16. package/dist/core/{CellTable → CellTableV2}/column-config.d.ts +11 -30
  17. package/dist/core/{CellTable → CellTableV2}/column-config.js +21 -220
  18. package/dist/core/CellTableV2/composables/index.d.ts +12 -0
  19. package/dist/core/CellTableV2/composables/index.js +9 -0
  20. package/dist/core/CellTableV2/composables/useColumnVisibility.svelte.d.ts +45 -0
  21. package/dist/core/CellTableV2/composables/useColumnVisibility.svelte.js +98 -0
  22. package/dist/core/CellTableV2/composables/usePersistence.svelte.d.ts +28 -0
  23. package/dist/core/CellTableV2/composables/usePersistence.svelte.js +101 -0
  24. package/dist/core/CellTableV2/composables/useScrollSpy.svelte.d.ts +44 -0
  25. package/dist/core/CellTableV2/composables/useScrollSpy.svelte.js +91 -0
  26. package/dist/core/CellTableV2/index.d.ts +12 -0
  27. package/dist/core/CellTableV2/index.js +14 -0
  28. package/dist/core/{CellTable → CellTableV2}/types.d.ts +3 -3
  29. package/dist/core/index.d.ts +2 -1
  30. package/dist/core/index.js +3 -1
  31. package/package.json +1 -1
  32. package/dist/core/CellTable/CellHistoryDemo.svelte +0 -240
  33. package/dist/core/CellTable/CellHistoryDemo.svelte.d.ts +0 -3
  34. package/dist/core/CellTable/CellTableDemo.svelte +0 -336
  35. package/dist/core/CellTable/CellTableDemo.svelte.d.ts +0 -3
  36. package/dist/core/CellTable/history-api-helper.d.ts +0 -79
  37. package/dist/core/CellTable/history-api-helper.js +0 -83
  38. package/dist/core/CellTable/index.d.ts +0 -15
  39. package/dist/core/CellTable/index.js +0 -20
  40. /package/dist/core/{CellTable → CellTableV2}/CellTableToolbar.svelte.d.ts +0 -0
  41. /package/dist/core/{CellTable → CellTableV2}/ColumnPicker.svelte +0 -0
  42. /package/dist/core/{CellTable → CellTableV2}/ColumnPicker.svelte.d.ts +0 -0
  43. /package/dist/core/{CellTable → CellTableV2}/types.js +0 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * useScrollSpy - ScrollSpy navigation composable
3
+ *
4
+ * Manages group-based scroll navigation for grouped tables.
5
+ * Uses Svelte 5 runes for reactive state.
6
+ */
7
+ import { usePersistence } from './usePersistence.svelte';
8
+ /**
9
+ * Create scrollspy navigation for a grouped table
10
+ */
11
+ export function useScrollSpy(options) {
12
+ const { storageKey, initialEnabled = false, persistSettings = true } = options;
13
+ // Persistence utilities
14
+ const persistence = usePersistence({ storageKey, enabled: persistSettings });
15
+ // Load initial state
16
+ const savedEnabled = persistence.loadString('scrollSpyEnabled', String(initialEnabled)) === 'true';
17
+ // Reactive state
18
+ let _groups = $state([]);
19
+ let _enabled = $state(savedEnabled);
20
+ /**
21
+ * Toggle scrollspy on/off
22
+ */
23
+ function toggle() {
24
+ _enabled = !_enabled;
25
+ persistence.saveString('scrollSpyEnabled', String(_enabled));
26
+ if (!_enabled) {
27
+ _groups = [];
28
+ }
29
+ }
30
+ /**
31
+ * Enable scrollspy
32
+ */
33
+ function enable() {
34
+ _enabled = true;
35
+ persistence.saveString('scrollSpyEnabled', 'true');
36
+ }
37
+ /**
38
+ * Disable scrollspy
39
+ */
40
+ function disable() {
41
+ _enabled = false;
42
+ persistence.saveString('scrollSpyEnabled', 'false');
43
+ _groups = [];
44
+ }
45
+ /**
46
+ * Update groups from table data
47
+ */
48
+ function updateGroups(table) {
49
+ if (!table || !_enabled) {
50
+ _groups = [];
51
+ return;
52
+ }
53
+ try {
54
+ _groups = table.getGroups();
55
+ }
56
+ catch (e) {
57
+ console.warn('Failed to get groups:', e);
58
+ _groups = [];
59
+ }
60
+ }
61
+ /**
62
+ * Scroll to a specific group
63
+ */
64
+ function scrollToGroup(table, key) {
65
+ if (!table)
66
+ return;
67
+ try {
68
+ table.scrollToGroup(key);
69
+ }
70
+ catch (e) {
71
+ console.warn('Failed to scroll to group:', e);
72
+ }
73
+ }
74
+ /**
75
+ * Clear groups
76
+ */
77
+ function clearGroups() {
78
+ _groups = [];
79
+ }
80
+ // Return with getters for reactivity
81
+ return {
82
+ get groups() { return _groups; },
83
+ get enabled() { return _enabled; },
84
+ toggle,
85
+ enable,
86
+ disable,
87
+ updateGroups,
88
+ scrollToGroup,
89
+ clearGroups
90
+ };
91
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * CellTableV2 - Main Exports
3
+ *
4
+ * Composable-based cell table components with reusable logic hooks.
5
+ */
6
+ export { default as CellTable } from './CellTable.svelte';
7
+ export { default as CellTablePanel } from './CellTablePanel.svelte';
8
+ export { default as CellTableToolbar } from './CellTableToolbar.svelte';
9
+ export { default as ColumnPicker } from './ColumnPicker.svelte';
10
+ export * from './composables';
11
+ export { DEFAULT_TECH_COLORS, DEFAULT_STATUS_COLORS, FBAND_COLORS, COLUMN_GROUPS, getColumnMetadata, getColumnsForPreset, getPresetVisibleFields, getAllColumns, } from './column-config';
12
+ export type { CellData, CellTableColumn, CellTableGroupField, CellTableProps, ColumnPreset, GroupOption, RowSelectionEvent, RowClickEvent, RowDblClickEvent, RowContextMenuEvent, DataChangeEvent, TechColorMap, StatusColorMap, } from './types';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * CellTableV2 - Main Exports
3
+ *
4
+ * Composable-based cell table components with reusable logic hooks.
5
+ */
6
+ // Core components
7
+ export { default as CellTable } from './CellTable.svelte';
8
+ export { default as CellTablePanel } from './CellTablePanel.svelte';
9
+ export { default as CellTableToolbar } from './CellTableToolbar.svelte';
10
+ export { default as ColumnPicker } from './ColumnPicker.svelte';
11
+ // Composables
12
+ export * from './composables';
13
+ // Column configuration
14
+ export { DEFAULT_TECH_COLORS, DEFAULT_STATUS_COLORS, FBAND_COLORS, COLUMN_GROUPS, getColumnMetadata, getColumnsForPreset, getPresetVisibleFields, getAllColumns, } from './column-config';
@@ -15,8 +15,9 @@ export type CellData = Cell;
15
15
  export type CellTableGroupField = CellGroupingField | 'none';
16
16
  /**
17
17
  * Column preset configurations
18
+ * Note: 'history' and 'kpi' presets moved to separate modules (CellHistory, CellKPI)
18
19
  */
19
- export type ColumnPreset = 'default' | 'compact' | 'full' | 'physical' | 'network' | 'planning' | 'compare' | 'kpi' | 'history';
20
+ export type ColumnPreset = 'default' | 'compact' | 'full' | 'physical' | 'network' | 'planning' | 'compare';
20
21
  /**
21
22
  * Column visibility configuration
22
23
  */
@@ -130,6 +131,7 @@ export interface CellTableColumn extends ColumnDefinition {
130
131
  }
131
132
  /**
132
133
  * Predefined column groups for presets
134
+ * Note: 'kpi' and 'history' groups moved to separate modules
133
135
  */
134
136
  export interface ColumnGroups {
135
137
  core: string[];
@@ -139,8 +141,6 @@ export interface ColumnGroups {
139
141
  atoll: string[];
140
142
  position: string[];
141
143
  compare: string[];
142
- kpi: string[];
143
- history: string[];
144
144
  }
145
145
  /**
146
146
  * Cell configuration history record
@@ -3,7 +3,8 @@ export * from './Charts/index.js';
3
3
  export * from './TreeView/index.js';
4
4
  export * from './Settings/index.js';
5
5
  export * from './logger/index.js';
6
- export * from './CellTable/index.js';
6
+ export * from './CellTableV2/index.js';
7
+ export * from './CellHistory/index.js';
7
8
  export * from './FeatureRegistry/index.js';
8
9
  export * from './Benchmark/index.js';
9
10
  export * from './Auth/index.js';
@@ -11,7 +11,9 @@ export * from './Settings/index.js';
11
11
  // Logger utility for debugging and monitoring
12
12
  export * from './logger/index.js';
13
13
  // CellTable - Tabulator-based cell data table with Bootstrap theming
14
- export * from './CellTable/index.js';
14
+ export * from './CellTableV2/index.js';
15
+ // CellHistory - Cell configuration history feature (uses CellTable)
16
+ export * from './CellHistory/index.js';
15
17
  // Map component - Mapbox GL + Deck.GL integration
16
18
  // TODO: Moved to top-level src/lib/map module
17
19
  // export * from './Map/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartnet360/svelte-components",
3
- "version": "0.0.134",
3
+ "version": "0.0.136",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
@@ -1,240 +0,0 @@
1
- <script lang="ts">
2
- import CellTablePanel from './CellTablePanel.svelte';
3
- import type { RowSelectionEvent, CellHistoryData } from './types';
4
-
5
- /**
6
- * Table-ready history record after transformation
7
- */
8
- interface HistoryTableRow {
9
- id: string;
10
- cellName: string;
11
- frequency: number;
12
- configDate: string;
13
- // Current values
14
- antenna: string;
15
- electricalTilt: number;
16
- mechanicalTilt: number;
17
- power: number;
18
- // Previous values for change comparison
19
- prevAntenna: string;
20
- prevElectricalTilt: number;
21
- prevMechanicalTilt: number;
22
- prevPower: number;
23
- // Virtual fields for the change columns
24
- antennaChange: string;
25
- etiltChange: number;
26
- mtiltChange: number;
27
- powerChange: number;
28
- }
29
-
30
- /**
31
- * Transform API history data to table-friendly format
32
- * Maps UPPER_CASE API fields to camelCase and adds virtual fields for change detection
33
- */
34
- function transformHistoryData(apiData: CellHistoryData[]): HistoryTableRow[] {
35
- return apiData.map((record, index) => ({
36
- id: `hist-${index}`,
37
- cellName: record.CELLNAME,
38
- frequency: record.FREQUENCY,
39
- configDate: record.CONFIG_DATE,
40
- // Current values
41
- antenna: record.ANTENNA_TYPE,
42
- electricalTilt: record.ELECTRONIC_TILT,
43
- mechanicalTilt: record.MECHANIC_TILT,
44
- power: record.ANTOUTPUTPWR,
45
- // Previous values for change comparison
46
- prevAntenna: record.PREV_ANTENNA_TYPE,
47
- prevElectricalTilt: record.PREV_ELECTRONIC_TILT,
48
- prevMechanicalTilt: record.PREV_MECHANIC_TILT,
49
- prevPower: record.PREV_ANTOUTPUTPWR,
50
- // Virtual fields for the change columns (needed for column filtering)
51
- antennaChange: record.ANTENNA_TYPE,
52
- etiltChange: record.ELECTRONIC_TILT,
53
- mtiltChange: record.MECHANIC_TILT,
54
- powerChange: record.ANTOUTPUTPWR,
55
- }));
56
- }
57
-
58
- /**
59
- * Example API data for cell configuration history
60
- */
61
- const EXAMPLE_HISTORY_DATA: CellHistoryData[] = [
62
- {
63
- CELLNAME: '1001141',
64
- FREQUENCY: 1800,
65
- CONFIG_DATE: '2025-12-03T23:00:00.000Z',
66
- ANTENNA_TYPE: 'AQU4521R01v06',
67
- PREV_ANTENNA_TYPE: 'AQU4521R01v06',
68
- ANTOUTPUTPWR: 20,
69
- PREV_ANTOUTPUTPWR: 20,
70
- MECHANIC_TILT: 1,
71
- PREV_MECHANIC_TILT: 1,
72
- ELECTRONIC_TILT: 10,
73
- PREV_ELECTRONIC_TILT: 9
74
- },
75
- {
76
- CELLNAME: '1001141',
77
- FREQUENCY: 1800,
78
- CONFIG_DATE: '2025-09-11T22:00:00.000Z',
79
- ANTENNA_TYPE: 'AQU4521R01v06',
80
- PREV_ANTENNA_TYPE: 'ADU451602v01',
81
- ANTOUTPUTPWR: 20,
82
- PREV_ANTOUTPUTPWR: 20,
83
- MECHANIC_TILT: 1,
84
- PREV_MECHANIC_TILT: 0,
85
- ELECTRONIC_TILT: 9,
86
- PREV_ELECTRONIC_TILT: 10
87
- },
88
- {
89
- CELLNAME: '1001141',
90
- FREQUENCY: 1800,
91
- CONFIG_DATE: '2021-02-15T23:00:00.000Z',
92
- ANTENNA_TYPE: 'ADU451602v01',
93
- PREV_ANTENNA_TYPE: 'ADU451602v01',
94
- ANTOUTPUTPWR: 20,
95
- PREV_ANTOUTPUTPWR: 20,
96
- MECHANIC_TILT: 0,
97
- PREV_MECHANIC_TILT: 2,
98
- ELECTRONIC_TILT: 10,
99
- PREV_ELECTRONIC_TILT: 10
100
- }
101
- ];
102
-
103
- let cellName = $state('1001141');
104
- let rawHistoryData = $state<CellHistoryData[]>(EXAMPLE_HISTORY_DATA);
105
- let historyData = $derived(transformHistoryData(rawHistoryData));
106
-
107
- function loadHistory() {
108
- // TODO: Replace with actual API call
109
- // For now, just reload the example data
110
- console.log(`Loading history for cell: ${cellName}`);
111
- rawHistoryData = EXAMPLE_HISTORY_DATA.filter(r => r.CELLNAME === cellName);
112
- }
113
-
114
- function handleSelectionChange(event: RowSelectionEvent) {
115
- console.log('Selection changed:', event.ids);
116
- }
117
-
118
- /**
119
- * Compare two selected history records
120
- */
121
- function handleCompareTwoRecords(record1: HistoryTableRow, record2: HistoryTableRow) {
122
- const params = new URLSearchParams();
123
-
124
- // Use antenna from both records
125
- if (record1.antenna) params.set('ant1', record1.antenna);
126
- if (record2.antenna) params.set('ant2', record2.antenna);
127
-
128
- // Use frequency (same for both records typically)
129
- params.set('freq1', String(record1.frequency || 1800));
130
- params.set('freq2', String(record2.frequency || 1800));
131
-
132
- // Use electrical tilt values
133
- params.set('etilt1', String(record1.electricalTilt || 0));
134
- params.set('etilt2', String(record2.electricalTilt || 0));
135
-
136
- // Use mechanical tilt values
137
- params.set('mtilt1', String(record1.mechanicalTilt || 0));
138
- params.set('mtilt2', String(record2.mechanicalTilt || 0));
139
-
140
- // Add config date as labels
141
- params.set('label1', `${record1.cellName} (${record1.configDate})`);
142
- params.set('label2', `${record2.cellName} (${record2.configDate})`);
143
-
144
- const url = `/apps/antenna-compare?${params.toString()}`;
145
- window.open(url, '_blank');
146
- }
147
- </script>
148
-
149
- <div class="cell-history-page vh-100 d-flex flex-column">
150
- <!-- Header -->
151
- <div class="demo-controls bg-light border-bottom px-3 py-2 d-flex align-items-center gap-3 flex-wrap">
152
- <div class="input-group input-group-sm" style="width: auto;">
153
- <span class="input-group-text">Cell Name</span>
154
- <input
155
- type="text"
156
- class="form-control"
157
- bind:value={cellName}
158
- style="width: 120px;"
159
- />
160
- <button class="btn btn-outline-primary" onclick={loadHistory}>
161
- <i class="bi bi-arrow-clockwise"></i> Load History
162
- </button>
163
- </div>
164
- <span class="badge bg-info">
165
- {historyData.length} records
166
- </span>
167
- <span class="text-muted small">
168
- Select 2 rows to compare antenna configurations
169
- </span>
170
- </div>
171
-
172
- <!-- CellTablePanel with history preset -->
173
- <div class="flex-grow-1 overflow-hidden">
174
- <CellTablePanel
175
- cells={historyData as unknown as import('./types').CellData[]}
176
- groupBy="none"
177
- storageKey="cell-history-table"
178
- groupOptions={[
179
- { value: 'none', label: 'No Grouping' },
180
- { value: 'antenna', label: 'Antenna Type' },
181
- { value: 'cellname', label: 'Cell Name' },
182
-
183
- ]}
184
- columnPreset="history"
185
- showColumnPresets={false}
186
- selectable={true}
187
- multiSelect={true}
188
- showToolbar={true}
189
- showExport={true}
190
- headerFilters={true}
191
- showDetailsSidebar={false}
192
- showScrollSpy={false}
193
- title="Cell Configuration History"
194
- onselectionchange={handleSelectionChange}
195
- >
196
- {#snippet footer({ selectedRows, selectedCount })}
197
- <div class="d-flex align-items-center justify-content-between">
198
- <span class="text-muted small">
199
- {#if selectedCount > 0}
200
- {selectedCount} record(s) selected
201
- {:else}
202
- Select rows to compare configurations
203
- {/if}
204
- </span>
205
- <div class="btn-group">
206
- <button
207
- type="button"
208
- class="btn btn-sm btn-outline-success"
209
- disabled={selectedCount !== 2}
210
- title={selectedCount === 2 ? 'Compare antenna patterns for selected dates' : 'Select exactly 2 records to compare'}
211
- onclick={() => handleCompareTwoRecords(selectedRows[0] as unknown as HistoryTableRow, selectedRows[1] as unknown as HistoryTableRow)}
212
- >
213
- <i class="bi bi-broadcast-pin"></i>
214
- <span class="d-none d-sm-inline ms-1">Compare Antennas</span>
215
- </button>
216
- <button
217
- type="button"
218
- class="btn btn-sm btn-outline-secondary"
219
- disabled={selectedCount === 0}
220
- onclick={() => console.log('Export:', selectedRows.map(r => r.configDate))}
221
- >
222
- <i class="bi bi-download"></i>
223
- <span class="d-none d-sm-inline ms-1">Export</span>
224
- </button>
225
- </div>
226
- </div>
227
- {/snippet}
228
- </CellTablePanel>
229
- </div>
230
- </div>
231
-
232
- <style>
233
- .cell-history-page {
234
- background: var(--bs-body-bg, #f8f9fa);
235
- }
236
-
237
- .demo-controls {
238
- flex-shrink: 0;
239
- }
240
- </style>
@@ -1,3 +0,0 @@
1
- declare const CellHistoryDemo: import("svelte").Component<Record<string, never>, {}, "">;
2
- type CellHistoryDemo = ReturnType<typeof CellHistoryDemo>;
3
- export default CellHistoryDemo;