@smartnet360/svelte-components 0.0.135 → 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.
@@ -1,79 +0,0 @@
1
- /**
2
- * Cell History API Helper
3
- *
4
- * Transform functions for converting database records to frontend-ready format.
5
- * Use these in your API endpoint before sending the response.
6
- */
7
- /**
8
- * Raw database record format (Oracle/SQL style - UPPER_CASE)
9
- */
10
- export interface CellHistoryDbRecord {
11
- CELLNAME: string;
12
- CONFIG_DATE: string | Date;
13
- ANTENNA_TYPE: string;
14
- PREV_ANTENNA_TYPE: string;
15
- ANTOUTPUTPWR: number;
16
- PREV_ANTOUTPUTPWR: number;
17
- MECHANIC_TILT: number;
18
- PREV_MECHANIC_TILT: number;
19
- ELECTRONIC_TILT: number;
20
- PREV_ELECTRONIC_TILT: number;
21
- [key: string]: unknown;
22
- }
23
- /**
24
- * Frontend-ready API response format (camelCase)
25
- */
26
- export interface CellHistoryApiResponse {
27
- cellName: string;
28
- configDate: string;
29
- antenna: string;
30
- prevAntenna: string;
31
- power: number;
32
- prevPower: number;
33
- mechanicalTilt: number;
34
- prevMechanicalTilt: number;
35
- electricalTilt: number;
36
- prevElectricalTilt: number;
37
- hasChanges: boolean;
38
- changedFields: string[];
39
- }
40
- /**
41
- * Format a date to YYYY.MM.DD string
42
- */
43
- export declare function formatConfigDate(date: string | Date): string;
44
- /**
45
- * Transform a single database record to API response format
46
- */
47
- export declare function transformDbRecord(record: CellHistoryDbRecord): CellHistoryApiResponse;
48
- /**
49
- * Transform an array of database records to API response format
50
- *
51
- * @example
52
- * // In your API endpoint:
53
- * const dbRecords = await db.query('SELECT * FROM CELL_CONFIG_HISTORY WHERE CELLNAME = ?', [cellName]);
54
- * const response = transformDbRecords(dbRecords);
55
- * return json(response);
56
- */
57
- export declare function transformDbRecords(records: CellHistoryDbRecord[]): CellHistoryApiResponse[];
58
- /**
59
- * Example usage in a SvelteKit API endpoint:
60
- *
61
- * ```typescript
62
- * // src/routes/api/cell-history/[cellName]/+server.ts
63
- * import { json } from '@sveltejs/kit';
64
- * import { transformDbRecords } from './history-api-helper';
65
- * import { db } from '../../server/database';
66
- *
67
- * export async function GET({ params }) {
68
- * const { cellName } = params;
69
- *
70
- * const dbRecords = await db.query(`
71
- * SELECT * FROM CELL_CONFIG_HISTORY
72
- * WHERE CELLNAME = :cellName
73
- * ORDER BY CONFIG_DATE DESC
74
- * `, { cellName });
75
- *
76
- * return json(transformDbRecords(dbRecords));
77
- * }
78
- * ```
79
- */
@@ -1,83 +0,0 @@
1
- /**
2
- * Cell History API Helper
3
- *
4
- * Transform functions for converting database records to frontend-ready format.
5
- * Use these in your API endpoint before sending the response.
6
- */
7
- /**
8
- * Format a date to YYYY.MM.DD string
9
- */
10
- export function formatConfigDate(date) {
11
- const d = typeof date === 'string' ? new Date(date) : date;
12
- const year = d.getFullYear();
13
- const month = String(d.getMonth() + 1).padStart(2, '0');
14
- const day = String(d.getDate()).padStart(2, '0');
15
- return `${year}.${month}.${day}`;
16
- }
17
- /**
18
- * Transform a single database record to API response format
19
- */
20
- export function transformDbRecord(record) {
21
- // Detect which fields changed
22
- const changedFields = [];
23
- if (record.ANTENNA_TYPE !== record.PREV_ANTENNA_TYPE) {
24
- changedFields.push('antenna');
25
- }
26
- if (record.ANTOUTPUTPWR !== record.PREV_ANTOUTPUTPWR) {
27
- changedFields.push('power');
28
- }
29
- if (record.MECHANIC_TILT !== record.PREV_MECHANIC_TILT) {
30
- changedFields.push('mechanicalTilt');
31
- }
32
- if (record.ELECTRONIC_TILT !== record.PREV_ELECTRONIC_TILT) {
33
- changedFields.push('electricalTilt');
34
- }
35
- return {
36
- cellName: record.CELLNAME,
37
- configDate: formatConfigDate(record.CONFIG_DATE),
38
- antenna: record.ANTENNA_TYPE,
39
- prevAntenna: record.PREV_ANTENNA_TYPE,
40
- power: record.ANTOUTPUTPWR,
41
- prevPower: record.PREV_ANTOUTPUTPWR,
42
- mechanicalTilt: record.MECHANIC_TILT,
43
- prevMechanicalTilt: record.PREV_MECHANIC_TILT,
44
- electricalTilt: record.ELECTRONIC_TILT,
45
- prevElectricalTilt: record.PREV_ELECTRONIC_TILT,
46
- hasChanges: changedFields.length > 0,
47
- changedFields
48
- };
49
- }
50
- /**
51
- * Transform an array of database records to API response format
52
- *
53
- * @example
54
- * // In your API endpoint:
55
- * const dbRecords = await db.query('SELECT * FROM CELL_CONFIG_HISTORY WHERE CELLNAME = ?', [cellName]);
56
- * const response = transformDbRecords(dbRecords);
57
- * return json(response);
58
- */
59
- export function transformDbRecords(records) {
60
- return records.map(transformDbRecord);
61
- }
62
- /**
63
- * Example usage in a SvelteKit API endpoint:
64
- *
65
- * ```typescript
66
- * // src/routes/api/cell-history/[cellName]/+server.ts
67
- * import { json } from '@sveltejs/kit';
68
- * import { transformDbRecords } from './history-api-helper';
69
- * import { db } from '../../server/database';
70
- *
71
- * export async function GET({ params }) {
72
- * const { cellName } = params;
73
- *
74
- * const dbRecords = await db.query(`
75
- * SELECT * FROM CELL_CONFIG_HISTORY
76
- * WHERE CELLNAME = :cellName
77
- * ORDER BY CONFIG_DATE DESC
78
- * `, { cellName });
79
- *
80
- * return json(transformDbRecords(dbRecords));
81
- * }
82
- * ```
83
- */
@@ -1,15 +0,0 @@
1
- /**
2
- * CellTable Component - Exports
3
- *
4
- * A Bootstrap-themed Tabulator wrapper for displaying cell data
5
- */
6
- export { default as CellTable } from './CellTable.svelte';
7
- export { default as CellTableToolbar } from './CellTableToolbar.svelte';
8
- export { default as CellTablePanel } from './CellTablePanel.svelte';
9
- export { default as CellTableDemo } from './CellTableDemo.svelte';
10
- export { default as CellHistoryDemo } from './CellHistoryDemo.svelte';
11
- export { default as ColumnPicker } from './ColumnPicker.svelte';
12
- export { transformDbRecord, transformDbRecords, formatConfigDate, type CellHistoryDbRecord, type CellHistoryApiResponse } from './history-api-helper';
13
- export { generateCells, generateCellsFromPreset, getGeneratorInfo, GENERATOR_PRESETS, type CellGeneratorConfig, type GeneratorPreset } from '../../shared/demo';
14
- export type { CellData, CellTableGroupField, ColumnPreset, ColumnVisibility, TechColorMap, StatusColorMap, CellTableProps, RowSelectionEvent, RowClickEvent, RowDblClickEvent, RowContextMenuEvent, DataChangeEvent, CellTableColumn, ColumnGroups, CellHistoryData, GroupOption } from './types';
15
- export { DEFAULT_TECH_COLORS, DEFAULT_STATUS_COLORS, FBAND_COLORS, COLUMN_GROUPS, getAllColumns, getColumnsForPreset, getGroupHeaderFormatter, getColumnMetadata, getPresetVisibleFields, fbandSorter, cellNameSectorSorter, cellDataSorter, createTechFormatter, createStatusFormatter, createFbandFormatter, createHistoryChangeFormatter, historyDateFormatter, numberFormatter, coordinateFormatter, azimuthFormatter, heightFormatter, type ColumnMeta } from './column-config';
@@ -1,20 +0,0 @@
1
- /**
2
- * CellTable Component - Exports
3
- *
4
- * A Bootstrap-themed Tabulator wrapper for displaying cell data
5
- */
6
- // Components
7
- export { default as CellTable } from './CellTable.svelte';
8
- export { default as CellTableToolbar } from './CellTableToolbar.svelte';
9
- export { default as CellTablePanel } from './CellTablePanel.svelte';
10
- export { default as CellTableDemo } from './CellTableDemo.svelte';
11
- export { default as CellHistoryDemo } from './CellHistoryDemo.svelte';
12
- export { default as ColumnPicker } from './ColumnPicker.svelte';
13
- // History API helpers (for backend transformation)
14
- export { transformDbRecord, transformDbRecords, formatConfigDate } from './history-api-helper';
15
- // Re-export shared demo data utilities for convenience
16
- // Note: Cell type is NOT re-exported here to avoid conflicts with map-v2
17
- // Import Cell from '$lib/shared/demo' or '@smartnet360/svelte-components' directly
18
- export { generateCells, generateCellsFromPreset, getGeneratorInfo, GENERATOR_PRESETS } from '../../shared/demo';
19
- // Configuration utilities
20
- export { DEFAULT_TECH_COLORS, DEFAULT_STATUS_COLORS, FBAND_COLORS, COLUMN_GROUPS, getAllColumns, getColumnsForPreset, getGroupHeaderFormatter, getColumnMetadata, getPresetVisibleFields, fbandSorter, cellNameSectorSorter, cellDataSorter, createTechFormatter, createStatusFormatter, createFbandFormatter, createHistoryChangeFormatter, historyDateFormatter, numberFormatter, coordinateFormatter, azimuthFormatter, heightFormatter } from './column-config';
@@ -1,172 +0,0 @@
1
- /**
2
- * CellTable Component - Type Definitions
3
- *
4
- * Types for the Tabulator-based cell data table component
5
- */
6
- import type { ColumnDefinition, Options } from 'tabulator-tables';
7
- import type { Cell, CellGroupingField } from '../../shared/demo';
8
- /**
9
- * Cell data model - re-exported from shared for convenience
10
- */
11
- export type CellData = Cell;
12
- /**
13
- * Available grouping fields for the table - extends shared type with 'none' option
14
- */
15
- export type CellTableGroupField = CellGroupingField | 'none';
16
- /**
17
- * Column preset configurations
18
- */
19
- export type ColumnPreset = 'default' | 'compact' | 'full' | 'physical' | 'network' | 'planning' | 'compare' | 'kpi' | 'history';
20
- /**
21
- * Column visibility configuration
22
- */
23
- export interface ColumnVisibility {
24
- [key: string]: boolean;
25
- }
26
- /**
27
- * Grouping option for toolbar dropdown
28
- */
29
- export interface GroupOption {
30
- /** Field name to group by (or 'none') */
31
- value: string;
32
- /** Display label in dropdown */
33
- label: string;
34
- }
35
- /**
36
- * Technology color mapping
37
- */
38
- export interface TechColorMap {
39
- [tech: string]: string;
40
- }
41
- /**
42
- * Status color mapping
43
- */
44
- export interface StatusColorMap {
45
- [status: string]: string;
46
- }
47
- /**
48
- * CellTable component props
49
- */
50
- export interface CellTableProps {
51
- /** Cell data array to display */
52
- cells: CellData[];
53
- /** Field to group rows by */
54
- groupBy?: CellTableGroupField;
55
- /** Initial column preset */
56
- columnPreset?: ColumnPreset;
57
- /** Custom column visibility overrides */
58
- columnVisibility?: ColumnVisibility;
59
- /** Enable row selection */
60
- selectable?: boolean;
61
- /** Enable multi-row selection */
62
- multiSelect?: boolean;
63
- /** Table height (CSS value) */
64
- height?: string;
65
- /** Enable virtual DOM for large datasets */
66
- virtualDom?: boolean;
67
- /** Custom Tabulator options override */
68
- tabulatorOptions?: Partial<Options>;
69
- /** Technology color mapping */
70
- techColors?: TechColorMap;
71
- /** Status color mapping */
72
- statusColors?: StatusColorMap;
73
- /** Enable header filters */
74
- headerFilters?: boolean;
75
- /** Enable column resizing */
76
- resizableColumns?: boolean;
77
- /** Enable movable columns */
78
- movableColumns?: boolean;
79
- /** Persist column layout to localStorage */
80
- persistLayout?: boolean;
81
- /** Storage key for persisted layout */
82
- storageKey?: string;
83
- }
84
- /**
85
- * Row selection event data
86
- */
87
- export interface RowSelectionEvent {
88
- rows: CellData[];
89
- ids: string[];
90
- }
91
- /**
92
- * Row click event data
93
- */
94
- export interface RowClickEvent {
95
- row: CellData;
96
- event: MouseEvent;
97
- }
98
- /**
99
- * Row double-click event data
100
- */
101
- export interface RowDblClickEvent {
102
- row: CellData;
103
- event: MouseEvent;
104
- }
105
- /**
106
- * Row context menu (right-click) event data
107
- */
108
- export interface RowContextMenuEvent {
109
- row: CellData;
110
- event: MouseEvent;
111
- }
112
- /**
113
- * Data change event data
114
- */
115
- export interface DataChangeEvent {
116
- type: 'load' | 'update' | 'filter' | 'sort' | 'group';
117
- rowCount: number;
118
- filteredCount: number;
119
- }
120
- /**
121
- * Column definition with Bootstrap styling helpers
122
- */
123
- export interface CellTableColumn extends ColumnDefinition {
124
- /** Bootstrap badge variant for cell rendering */
125
- badgeVariant?: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'light' | 'dark';
126
- /** Use technology-based coloring */
127
- techColored?: boolean;
128
- /** Use status-based coloring */
129
- statusColored?: boolean;
130
- }
131
- /**
132
- * Predefined column groups for presets
133
- */
134
- export interface ColumnGroups {
135
- core: string[];
136
- physical: string[];
137
- network: string[];
138
- planning: string[];
139
- atoll: string[];
140
- position: string[];
141
- compare: string[];
142
- kpi: string[];
143
- history: string[];
144
- }
145
- /**
146
- * Cell configuration history record
147
- * Each record represents a point in time where a cell's configuration changed
148
- */
149
- export interface CellHistoryData {
150
- /** Cell name identifier */
151
- CELLNAME: string;
152
- /** Frequency in MHz (e.g., 1800, 2100, 3500) */
153
- FREQUENCY: number;
154
- /** Date of configuration change (ISO 8601 format) */
155
- CONFIG_DATE: string;
156
- /** Current antenna type at this config date */
157
- ANTENNA_TYPE: string;
158
- /** Previous antenna type before this change */
159
- PREV_ANTENNA_TYPE: string;
160
- /** Current antenna output power (dBm) */
161
- ANTOUTPUTPWR: number;
162
- /** Previous antenna output power */
163
- PREV_ANTOUTPUTPWR: number;
164
- /** Current mechanical tilt (degrees) */
165
- MECHANIC_TILT: number;
166
- /** Previous mechanical tilt */
167
- PREV_MECHANIC_TILT: number;
168
- /** Current electrical tilt (degrees) */
169
- ELECTRONIC_TILT: number;
170
- /** Previous electrical tilt */
171
- PREV_ELECTRONIC_TILT: number;
172
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * CellTable Component - Type Definitions
3
- *
4
- * Types for the Tabulator-based cell data table component
5
- */
6
- export {};