@lovebowls/leagueelements
Version:
League Elements package for LoveBowls
267 lines • 11 kB
TypeScript
export default LeagueElement;
declare class LeagueElement extends HTMLElement {
static get observedAttributes(): string[];
static TEAM_COLORS: string[];
shadow: ShadowRoot;
data: any;
selectedResultDate: any;
activeCalendarFilterDate: any;
leftPanelFlexBasis: any;
minRightPanelPixelWidth: number | null;
activeView: string;
pointsOverTimeChartData: {
dates: never[];
teamSeries: {};
allTeamNames: never[];
} | {
dates: never[];
teamSeries: {};
allTeamNames: never[];
} | {
dates: never[];
teamSeries: {};
allTeamNames: any[];
} | {
dates: never[];
teamSeries: {};
allTeamNames: any[];
} | {
dates: any[];
teamSeries: {};
allTeamNames: any[];
} | null;
selectedTeamsForGraph: Set<any>;
teamColors: {};
activeTrendGraphType: string;
tableFilter: string;
matchModalOpen: boolean;
matchModalData: Object | null;
matchModalTeams: any[];
matchModalMode: string;
lovebowlsTeams: any[];
_handleScheduleMatchEditBound: ((e: CustomEvent) => void) | null;
selectedTeamForSchedule: string | null;
get _isMobile(): boolean;
get _canEdit(): boolean;
connectedCallback(): void;
attributeChangedCallback(name: any, oldValue: any, newValue: any): void;
_parseAndLoadData(data: any): Promise<void>;
showError(message: any): void;
_fillTemplate(template: any): any;
render(): void;
tableRows: string | undefined;
_handleRecentMatchClickBound: ((e: any) => void) | undefined;
_handleAttentionMatchClickBound: ((e: any) => void) | undefined;
_handleUpcomingMatchClickBound: ((e: any) => void) | undefined;
setupPaging(): void;
setupResizer(): void;
/**
* Renders the form icons with tooltips for recent matches.
* @param {Array<Object>|string} [matches=[]] - An array of recent match objects or a form string
* Each object should have 'result' (W/D/L)
* and 'description' (the tooltip text).
* @returns {string} HTML string for the form icons.
*/
renderForm(matches?: Array<Object> | string): string;
/**
* Basic HTML escaping function to prevent XSS issues in tooltips.
* @param {string} unsafe - The string to escape.
* @returns {string} The escaped string.
*/
escapeHtml(unsafe?: string): string;
/**
* Formats a list of matches for tooltip display.
* If resultType is provided, only matches of that type are included.
* If not, all matches are included.
* @param {Array<Object>} matches - Array of match objects
* @param {string} teamId - The ID of the team to check the result for.
* @param {string} [resultType] - Optional: 'W', 'D', or 'L'
* @param {boolean} [displayVerb=true] - Whether to show the verb (Won/Lost/Drew)
* @returns {string} Tooltip string
*/
formatMatchList(matches: Array<Object> | undefined, teamId: string, resultType?: string, displayVerb?: boolean): string;
_getConflictingMatchKeys(): Set<any>;
setupTabs(): void;
_prepareMatrixData(): {
teams: any[];
teamMatches: Map<any, any>;
} | null;
_handleMatchSave(e: any): void;
_getFilteredLeagueData(): Object | null;
/**
* Sorts teams by their recent form using a weighted scoring system.
* More recent matches have higher weight in the calculation.
* @param {Array<Object>} stats - Array of team statistics objects
* @returns {Array<Object>} Teams sorted by form score (best form first)
*/
_sortByForm(stats: Array<Object>): Array<Object>;
/**
* Calculates a weighted form score based on recent match results.
* Uses a standard methodology: W=3pts, D=1pt, L=0pts with heavy recency weighting.
* Most recent matches have higher impact on the score.
* @param {Array<Object>} formMatches - Array of recent match objects with result and description
* @returns {number} Form score (0-3 range, proportionally scaled for fewer matches)
*/
_calculateFormScore(formMatches: Array<Object>): number;
_getTeamsFromLeagueData(): any;
setupTrendsViewInteractivity(): void;
renderTrendsViewContent(): string;
_preparePointsOverTimeData(): void;
_prepareShotsForVsAgainstData(): void;
shotsForVsAgainstData: {
teams: never[];
averageShotsFor: number;
averageShotsAgainst: number;
maxShotsFor: number;
maxShotsAgainst: number;
} | {
teams: never[];
averageShotsFor: number;
averageShotsAgainst: number;
maxShotsFor: number;
maxShotsAgainst: number;
} | {
teams: never[];
averageShotsFor: number;
averageShotsAgainst: number;
maxShotsFor: number;
maxShotsAgainst: number;
} | {
teams: never[];
averageShotsFor: number;
averageShotsAgainst: number;
maxShotsFor: number;
maxShotsAgainst: number;
} | {
teams: any[];
averageShotsFor: number;
averageShotsAgainst: number;
maxShotsFor: number;
maxShotsAgainst: number;
} | undefined;
_prepareFormOverTimeData(): void;
formOverTimeChartData: Object | {
dates: never[];
teamSeries: {};
allTeamNames: never[];
} | {
dates: never[];
teamSeries: {};
allTeamNames: never[];
} | undefined;
ensureTeamColors(): void;
_usedColorIndices: Set<any> | undefined;
drawPointsOverTimeSVG(): void;
drawShotsForVsAgainstSVG(): void;
/**
* Apply simple moving average smoothing to a data series
* @param {Array<number>} data - Array of numeric values to smooth
* @param {number} windowSize - Size of the smoothing window (default: 3)
* @returns {Array<number>} Smoothed data array
*/
_smoothDataSeries(data: Array<number>, windowSize?: number): Array<number>;
drawFormOverTimeSVG(): void;
setupTableFilterDropdown(): void;
setupTableRowEvents(): void;
/**
* Renders the rank movement indicator to be placed next to the position.
* @param {number|undefined} movement - The change in rank. Positive for up, negative for down, 0 for no change.
* @returns {string} HTML string for the movement indicator.
*/
renderRankMovementIndicator(movement: number | undefined): string;
/**
* @param {Array<Object>} matchesSubset - Array of match objects to calculate ranks from.
* @param {Array<string>} allTeamIdsInLeague - Array of all team IDs in the league.
* @returns {Object|null} A map of { teamId: rank }, or null if calculation isn't possible.
*/
_calculateRanksFromMatches(matchesSubset: Array<Object>, allTeamIdsInLeague: Array<string>): Object | null;
/**
* Calculate rank movements by comparing current table with table excluding most recent match day
* @param {Array<Object>} matchesSubset - All matches used for current table calculation
* @param {Array<string>} allTeamIdsInLeague - Array of all team IDs in the league
* @param {Array<Object>} currentStats - Current team statistics with ranks
* @returns {Object} Map of teamId to rank movement (positive = moved up, negative = moved down)
*/
_calculateRankMovements(matchesSubset: Array<Object>, allTeamIdsInLeague: Array<string>, currentStats: Array<Object>): Object;
/**
* Calculate rank movements specifically for form view
* @param {Array<Object>} matchesSubset - All matches used for current table calculation
* @param {Array<string>} allTeamIdsInLeague - Array of all team IDs in the league
* @param {Array<Object>} currentStats - Current team statistics with ranks
* @returns {Object} Map of teamId to rank movement
*/
_calculateFormRankMovements(matchesSubset: Array<Object>, allTeamIdsInLeague: Array<string>, currentStats: Array<Object>): Object;
/**
* Get all matches for a team up to a specific date, sorted by date (most recent first)
* @deprecated Use FormUtils.getTeamMatchesUpToDate instead
*/
_getTeamMatchesUpToDate(teamId: any, targetDate: any, allMatches: any): Object[];
/**
* Calculate form score at a specific date for a team
* @deprecated Use FormUtils.calculateFormScoreAtDate instead
*/
_calculateFormScoreAtDate(teamId: any, targetDate: any, allMatches: any): number;
/**
* Calculate form score from a specific set of matches for a team
* @deprecated Use FormUtils.calculateFormScoreFromMatches instead
*/
_calculateFormScoreFromMatches(matches: any, teamId: any): number;
/**
* Calculate basic statistics from matches (helper method for rank movement calculation)
* @param {Array<Object>} matches - Array of match objects
* @param {Array<string>} allTeamIdsInLeague - Array of all team IDs in the league
* @returns {Array<Object>} Array of team statistics
*/
_calculateStatsFromMatches(matches: Array<Object>, allTeamIdsInLeague: Array<string>): Array<Object>;
/**
* Open the match modal dialog.
* @param {Object} matchData
* @param {Array<Object>} teams - Array of team objects ({_id, name}) for dropdowns.
* @param {'edit'|'new'} mode
*/
openMatchModal(matchData: Object, teams: Array<Object>, mode?: "edit" | "new"): void;
/**
* Close the match modal dialog.
*/
closeMatchModal(): void;
/**
* Renders only the match modal without affecting the rest of the component
* @private
*/
private _renderMatchModal;
_handleRecentMatchClick(e: any): void;
_handleAttentionMatchClick(e: any): void;
_handleUpcomingMatchClick(e: any): void;
_handleUpcomingFixtureDateChange(e: any): void;
_handleCalendarDateChange(e: any): void;
parseLovebowlsTeams(teamsData: any): void;
_lovebowlsTeams: any[] | undefined;
_teamNameMap: {} | undefined;
getTeamDisplayName(teamId: any): any;
/**
* Get a shortened version of team name for mobile display
* @param {string} teamName - The full team name
* @return {string} - Shortened team name for mobile display
*/
_getShortTeamName(teamName: string): string;
get _table(): any;
_updateUI(): void;
_updateLeagueTable(table: any): void;
_updateMatrixView(table: any): void;
_updateFixturesView(table: any): void;
renderMatrix(): string;
_findMatchBetweenTeams(homeTeamId: any, awayTeamId: any): any;
setupMatrixEventListeners(): void;
/**
* Sets up event listeners for the schedule view and configures the component
* @private
*/
private _setupScheduleEventListeners;
/**
* Handles match edit events from the schedule component
* @param {CustomEvent} e - The event object
* @private
*/
private _handleScheduleMatchEdit;
}
//# sourceMappingURL=leagueElement.d.ts.map