@mantha911/ng-echarts 0.1.0-rc.18 → 0.1.0-rc.21

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 +1 @@
1
- {"version":3,"file":"mantha911-ng-echarts-calendar.mjs","names":[],"sources":["../../../projects/chart-library/calendar/src/lib/calendar-browser.ts","../../../projects/chart-library/calendar/src/lib/calendar-heatmap.ts","../../../projects/chart-library/calendar/src/lib/calendar-heatmap.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { CalendarView } from './calendar-options';\nexport const CALENDAR_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<CalendarView>>\n>('Calendar renderer loader', {\n providedIn: 'root',\n factory: () => () => import('./calendar-renderer').then((m) => m.createCalendarRenderer),\n});\n\n/** ECharts Calendar uses local Date arithmetic. A civil-date skip must not\n * silently place two observations in the same cell; native tables stay exact. */\nexport function calendarDatesExistLocally(dates: readonly string[]): boolean {\n return dates.every((date) => {\n const [year, month, day] = date.split('-').map(Number) as [number, number, number];\n const local = new Date(year, month - 1, day);\n return (\n local.getFullYear() === year && local.getMonth() === month - 1 && local.getDate() === day\n );\n });\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n afterRenderEffect,\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n effect,\n ElementRef,\n inject,\n input,\n output,\n PLATFORM_ID,\n signal,\n viewChild,\n} from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵPlotController,\n ɵChartFocusKeeper,\n ɵbrowserPlotEnvironment,\n ɵreadCartesianTheme,\n ɵdefaultCartesianTheme,\n ɵcreateValueFormatting,\n ɵresolveCartesianState,\n type ɵCartesianThemeTokens,\n type ChartTheme,\n type ValueFormatter,\n type NumericKey,\n type StringKey,\n} from '@mantha911/ng-echarts/core';\nimport {\n normalizeCalendarData,\n calendarMonths,\n type CalendarPointSelection,\n} from './calendar-model';\nimport { calendarColors, type CalendarView } from './calendar-options';\nimport { CALENDAR_RENDERER_LOADER, calendarDatesExistLocally } from './calendar-browser';\n@Component({\n selector: 'nec-calendar-heatmap',\n imports: [ChartFrame, ɵChartStage],\n templateUrl: './calendar-heatmap.html',\n styleUrls: ['./calendar-heatmap.css', '../../../core/src/lib/chart-controls.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CalendarHeatmap<T extends object> {\n readonly title = input.required<string>();\n readonly description = input('');\n readonly valueLabel = input('Value');\n readonly data = input.required<readonly T[]>();\n readonly dateKey = input.required<StringKey<T>>();\n readonly valueKey = input.required<NumericKey<T>>();\n readonly year = input.required<number>();\n readonly max = input.required<number>();\n readonly pointSelect = output<CalendarPointSelection<T>>();\n readonly theme = input<ChartTheme>('light');\n readonly themeRevision = input(0);\n readonly locale = input('en-US');\n readonly numberFormatOptions = input<Intl.NumberFormatOptions>();\n readonly valueFormatter = input<ValueFormatter>();\n readonly loading = input(false);\n readonly error = input<string | null>(null);\n readonly animation = input(true);\n\n private readonly loader = inject(CALENDAR_RENDERER_LOADER);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly application = inject(ApplicationRef);\n private readonly platform = inject(PLATFORM_ID);\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly browserReady = signal(false);\n private readonly reducedMotion = signal(false);\n private readonly measuredTheme = signal<ɵCartesianThemeTokens | null>(null);\n private controller: ɵPlotController<CalendarView> | null = null;\n private focusKeeper: ɵChartFocusKeeper | null = null;\n private removeMotionListener: (() => void) | null = null;\n protected readonly rendererError = signal(false);\n protected readonly model = computed(() =>\n normalizeCalendarData(this.data(), this.dateKey(), this.valueKey(), this.year(), this.max()),\n );\n private readonly formatting = computed(() => {\n const model = this.model();\n return ɵcreateValueFormatting(\n this.locale(),\n this.numberFormatOptions(),\n this.valueFormatter(),\n model.kind === 'error'\n ? []\n : [\n 0,\n model.max / 4,\n model.max / 2,\n model.max * 0.75,\n model.max,\n ...model.days.map((day) => day.value),\n ],\n );\n });\n private readonly settings = computed(() => ({\n title: this.title(),\n valueLabel: this.valueLabel(),\n theme: this.theme(),\n themeRevision: this.themeRevision(),\n animation: this.animation(),\n loading: this.loading(),\n error: this.error(),\n }));\n protected readonly tokens = computed(\n () => this.measuredTheme() ?? ɵdefaultCartesianTheme(this.theme()),\n );\n protected readonly localDatesAvailable = computed(() => {\n const model = this.model();\n return (\n !this.browserReady() ||\n model.kind !== 'ready' ||\n calendarDatesExistLocally(model.days.map((day) => day.date))\n );\n });\n protected readonly colors = computed(() => calendarColors(this.tokens()));\n protected readonly scale = computed(() => {\n const model = this.model();\n return model.kind === 'error'\n ? []\n : Array.from({ length: 4 }, (_, i) => {\n const lower = model.max * (i / 4),\n upper = model.max * ((i + 1) / 4);\n return {\n color: this.colors()[i]!,\n upperText: this.formatting().format(upper),\n label: `More than ${this.formatting().format(lower)} to ${this.formatting().format(upper)}`,\n };\n });\n });\n protected readonly intervalLabel = computed(() =>\n this.scale()\n .map((step) => step.label)\n .join('; '),\n );\n protected readonly months = computed(() => {\n const model = this.model();\n return model.kind === 'error'\n ? []\n : calendarMonths.map((name, index) => ({\n name,\n days: model.days\n .filter((day) => day.month === index + 1)\n .map((day) => ({\n ...day,\n text: day.value === null ? 'No data' : this.formatting().format(day.value),\n })),\n }));\n });\n protected readonly zeroLabel = computed(() => this.formatting().format(0));\n protected readonly maximumLabel = computed(() => this.formatting().format(this.max()));\n protected readonly state = computed(() => {\n const settings = this.settings();\n const configurationError =\n typeof settings.valueLabel !== 'string' || !settings.valueLabel.trim()\n ? 'Value label must be nonempty text.'\n : typeof settings.title !== 'string' || !settings.title.trim()\n ? 'Calendar title must be nonempty text.'\n : !['light', 'dark'].includes(settings.theme) || !Number.isFinite(settings.themeRevision)\n ? 'Calendar theme configuration is invalid.'\n : typeof settings.animation !== 'boolean' || typeof settings.loading !== 'boolean'\n ? 'Calendar animation and loading settings must be booleans.'\n : this.formatting().error;\n const state = ɵresolveCartesianState(\n settings.error,\n typeof settings.loading === 'boolean' && settings.loading,\n this.model(),\n this.rendererError(),\n configurationError,\n );\n return state.kind === 'loading'\n ? { ...state, message: 'Loading calendar…' }\n : state.kind === 'empty'\n ? { ...state, message: 'No calendar observations available.' }\n : state;\n });\n private readonly options = computed<CalendarView | null>(() => {\n const model = this.model();\n return this.state().kind === 'ready' && model.kind === 'ready' && this.localDatesAvailable()\n ? {\n year: model.year,\n max: model.max,\n days: model.days,\n tokens: this.tokens(),\n animation: this.animation() && !this.reducedMotion(),\n format: this.formatting().format,\n valueLabel: this.valueLabel(),\n }\n : null;\n });\n protected selectDate(date: string, source: 'plot' | 'table'): void {\n const model = this.model();\n if (this.state().kind !== 'ready' || model.kind !== 'ready') return;\n const day = model.days.find((day) => day.date === date);\n if (day?.value == null || day.row === null) return;\n this.pointSelect.emit({ date, value: day.value, row: day.row, source });\n }\n constructor() {\n effect(() => {\n this.model();\n this.settings();\n this.formatting();\n this.rendererError.set(false);\n });\n afterNextRender(() => {\n if (!isPlatformBrowser(this.platform)) return;\n void this.application.whenStable().then(() => {\n if (this.destroyRef.destroyed) return;\n try {\n const preference = window.matchMedia('(prefers-reduced-motion: reduce)');\n this.reducedMotion.set(preference.matches);\n const onMotion = (event: MediaQueryListEvent) => this.reducedMotion.set(event.matches);\n preference.addEventListener('change', onMotion);\n this.removeMotionListener = () => preference.removeEventListener('change', onMotion);\n this.controller = new ɵPlotController(\n this.plot().nativeElement,\n ɵbrowserPlotEnvironment(() => this.loader(), this.host.nativeElement),\n (point) => this.selectDate(point.rowId, 'plot'),\n () => this.rendererError.set(true),\n );\n this.focusKeeper = new ɵChartFocusKeeper(this.host.nativeElement);\n this.browserReady.set(true);\n } catch {\n this.rendererError.set(true);\n }\n });\n });\n afterRenderEffect(() => {\n if (!this.browserReady()) return;\n const theme = this.theme();\n this.themeRevision();\n try {\n this.measuredTheme.set(\n ɵreadCartesianTheme<{ value: number }>(\n this.host.nativeElement,\n theme,\n [{ id: 'calendar', key: 'value', label: this.title() }],\n this.plot().nativeElement,\n ),\n );\n } catch {\n this.rendererError.set(true);\n }\n });\n afterRenderEffect(() => {\n this.browserReady();\n this.controller?.update(this.options());\n });\n afterRenderEffect(() => {\n this.state();\n this.months();\n this.focusKeeper?.restore();\n });\n this.destroyRef.onDestroy(() => {\n this.removeMotionListener?.();\n this.controller?.destroy();\n this.focusKeeper?.destroy();\n });\n }\n protected retryRenderer(): void {\n this.rendererError.set(false);\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n class=\"calendar-stage\"\n [state]=\"currentState\"\n [height]=\"null\"\n [retryable]=\"rendererError()\"\n retryLabel=\"Retry calendar\"\n (retry)=\"retryRenderer()\"\n >\n <div\n class=\"calendar-viewport\"\n [hidden]=\"currentState.kind !== 'ready' || !localDatesAvailable()\"\n >\n <div #plot class=\"plot\" aria-hidden=\"true\"></div>\n </div>\n </nec-chart-stage>\n <div\n class=\"chart-controls calendar-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n @if (!localDatesAvailable()) {\n <p role=\"status\">\n This timezone skips a date in {{ year() }}. Explore the exact daily values below.\n </p>\n }\n <div\n class=\"calendar-scale\"\n [hidden]=\"!localDatesAvailable()\"\n role=\"group\"\n aria-label=\"Calendar color scale\"\n >\n <span class=\"scale-item\"><i class=\"missing\" aria-hidden=\"true\"></i>No data</span>\n <span class=\"scale-item\"\n ><i [style.background]=\"tokens().border\" aria-hidden=\"true\"></i>{{ zeroLabel() }}</span\n >\n <span class=\"scale-ramp\"\n ><span>Up to</span>\n @for (step of scale(); track $index) {\n <span class=\"scale-step\" [attr.title]=\"step.label\"\n ><i [style.background]=\"step.color\" aria-hidden=\"true\"></i\n ><span>{{ step.upperText }}</span></span\n >\n }\n </span>\n </div>\n <details class=\"calendar-data\">\n <summary class=\"table-toggle\">Explore daily data</summary>\n <p class=\"table-help\">\n Monday-first calendar. Blank dates mean no data; zero is a recorded value. Positive values\n use four equal intervals up to {{ maximumLabel() }}.\n </p>\n @if (currentState.kind === 'ready') {\n @for (month of months(); track month.name) {\n <details class=\"calendar-month\">\n <summary>{{ month.name }} {{ year() }}</summary>\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"month.name + ' daily values'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n —\n {{\n month.name\n }}\n {{\n year()\n }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Date</th>\n <th scope=\"col\">Value</th>\n </tr>\n </thead>\n <tbody>\n @for (day of month.days; track day.date) {\n <tr>\n <th scope=\"row\">{{ day.date }}</th>\n <td>\n @if (day.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'Select ' + day.date + ': ' + day.text\"\n (click)=\"selectDate(day.date, 'table')\"\n >\n {{ day.text }}\n </button>\n } @else {\n <span>{{ day.text }}</span>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n </details>\n }\n }\n </details>\n </div>\n</nec-chart-frame>\n"],"mappings":";;;;;AAGA,MAAa,2BAA2B,IAAI,eAE1C,4BAA4B;CAC5B,YAAY;CACZ,qBAAqB,OAAO,iEAAsB,CAAC,MAAM,MAAM,EAAE,sBAAsB;AACxF,CAAA;AAID,SAAgB,0BAA0B,OAAwB;CAChE,OAAO,MAAM,OAAO,SAAQ;EAC1B,MAAM,CAAC,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;EACrD,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,GAA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AAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,qBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,gBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"mantha911-ng-echarts-calendar.mjs","names":[],"sources":["../../../projects/chart-library/calendar/src/lib/calendar-browser.ts","../../../projects/chart-library/calendar/src/lib/calendar-heatmap.ts","../../../projects/chart-library/calendar/src/lib/calendar-heatmap.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { CalendarView } from './calendar-options';\nexport const CALENDAR_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<CalendarView>>\n>('Calendar renderer loader', {\n providedIn: 'root',\n factory: () => () => import('./calendar-renderer').then((m) => m.createCalendarRenderer),\n});\n\n/** ECharts Calendar uses local Date arithmetic. A civil-date skip must not\n * silently place two observations in the same cell; native tables stay exact. */\nexport function calendarDatesExistLocally(dates: readonly string[]): boolean {\n return dates.every((date) => {\n const [year, month, day] = date.split('-').map(Number) as [number, number, number];\n const local = new Date(year, month - 1, day);\n return (\n local.getFullYear() === year && local.getMonth() === month - 1 && local.getDate() === day\n );\n });\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n afterRenderEffect,\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n ElementRef,\n inject,\n input,\n linkedSignal,\n output,\n PLATFORM_ID,\n signal,\n viewChild,\n} from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵPlotController,\n ɵChartFocusKeeper,\n ɵbrowserPlotEnvironment,\n ɵreadCartesianTheme,\n ɵdefaultCartesianTheme,\n ɵcreateValueFormatting,\n ɵresolveCartesianState,\n type ɵCartesianThemeTokens,\n type ChartTheme,\n type ValueFormatter,\n type NumericKey,\n type StringKey,\n} from '@mantha911/ng-echarts/core';\nimport {\n normalizeCalendarData,\n calendarMonths,\n type CalendarPointSelection,\n} from './calendar-model';\nimport { calendarColors, type CalendarView } from './calendar-options';\nimport { CALENDAR_RENDERER_LOADER, calendarDatesExistLocally } from './calendar-browser';\n@Component({\n selector: 'nec-calendar-heatmap',\n imports: [ChartFrame, ɵChartStage],\n templateUrl: './calendar-heatmap.html',\n styleUrls: ['./calendar-heatmap.css', '../../../core/src/lib/chart-controls.css'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CalendarHeatmap<T extends object> {\n readonly title = input.required<string>();\n readonly description = input('');\n readonly valueLabel = input('Value');\n readonly data = input.required<readonly T[]>();\n readonly dateKey = input.required<StringKey<T>>();\n readonly valueKey = input.required<NumericKey<T>>();\n readonly year = input.required<number>();\n readonly max = input.required<number>();\n readonly pointSelect = output<CalendarPointSelection<T>>();\n readonly theme = input<ChartTheme>('light');\n readonly themeRevision = input(0);\n readonly locale = input('en-US');\n readonly numberFormatOptions = input<Intl.NumberFormatOptions>();\n readonly valueFormatter = input<ValueFormatter>();\n readonly loading = input(false);\n readonly error = input<string | null>(null);\n readonly animation = input(true);\n\n private readonly loader = inject(CALENDAR_RENDERER_LOADER);\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly destroyRef = inject(DestroyRef);\n private readonly application = inject(ApplicationRef);\n private readonly platform = inject(PLATFORM_ID);\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n private readonly browserReady = signal(false);\n private readonly reducedMotion = signal(false);\n private readonly measuredTheme = signal<ɵCartesianThemeTokens | null>(null);\n private controller: ɵPlotController<CalendarView> | null = null;\n private focusKeeper: ɵChartFocusKeeper | null = null;\n private removeMotionListener: (() => void) | null = null;\n // A failed renderer stays failed until retry or a relevant input changes.\n protected readonly rendererError = linkedSignal(() => {\n this.model();\n this.settings();\n this.formatting();\n return false;\n });\n protected readonly model = computed(() =>\n normalizeCalendarData(this.data(), this.dateKey(), this.valueKey(), this.year(), this.max()),\n );\n private readonly formatting = computed(() => {\n const model = this.model();\n return ɵcreateValueFormatting(\n this.locale(),\n this.numberFormatOptions(),\n this.valueFormatter(),\n model.kind === 'error'\n ? []\n : [\n 0,\n model.max / 4,\n model.max / 2,\n model.max * 0.75,\n model.max,\n ...model.days.map((day) => day.value),\n ],\n );\n });\n private readonly settings = computed(() => ({\n title: this.title(),\n valueLabel: this.valueLabel(),\n theme: this.theme(),\n themeRevision: this.themeRevision(),\n animation: this.animation(),\n loading: this.loading(),\n error: this.error(),\n }));\n protected readonly tokens = computed(\n () => this.measuredTheme() ?? ɵdefaultCartesianTheme(this.theme()),\n );\n protected readonly localDatesAvailable = computed(() => {\n const model = this.model();\n return (\n !this.browserReady() ||\n model.kind !== 'ready' ||\n calendarDatesExistLocally(model.days.map((day) => day.date))\n );\n });\n protected readonly colors = computed(() => calendarColors(this.tokens()));\n protected readonly scale = computed(() => {\n const model = this.model();\n return model.kind === 'error'\n ? []\n : Array.from({ length: 4 }, (_, i) => {\n const lower = model.max * (i / 4),\n upper = model.max * ((i + 1) / 4);\n return {\n color: this.colors()[i]!,\n upperText: this.formatting().format(upper),\n label: `More than ${this.formatting().format(lower)} to ${this.formatting().format(upper)}`,\n };\n });\n });\n protected readonly intervalLabel = computed(() =>\n this.scale()\n .map((step) => step.label)\n .join('; '),\n );\n protected readonly months = computed(() => {\n const model = this.model();\n return model.kind === 'error'\n ? []\n : calendarMonths.map((name, index) => ({\n name,\n days: model.days\n .filter((day) => day.month === index + 1)\n .map((day) => ({\n ...day,\n text: day.value === null ? 'No data' : this.formatting().format(day.value),\n })),\n }));\n });\n protected readonly zeroLabel = computed(() => this.formatting().format(0));\n protected readonly maximumLabel = computed(() => this.formatting().format(this.max()));\n protected readonly state = computed(() => {\n const settings = this.settings();\n const configurationError =\n typeof settings.valueLabel !== 'string' || !settings.valueLabel.trim()\n ? 'Value label must be nonempty text.'\n : typeof settings.title !== 'string' || !settings.title.trim()\n ? 'Calendar title must be nonempty text.'\n : !['light', 'dark'].includes(settings.theme) || !Number.isFinite(settings.themeRevision)\n ? 'Calendar theme configuration is invalid.'\n : typeof settings.animation !== 'boolean' || typeof settings.loading !== 'boolean'\n ? 'Calendar animation and loading settings must be booleans.'\n : this.formatting().error;\n const state = ɵresolveCartesianState(\n settings.error,\n typeof settings.loading === 'boolean' && settings.loading,\n this.model(),\n this.rendererError(),\n configurationError,\n );\n return state.kind === 'loading'\n ? { ...state, message: 'Loading calendar…' }\n : state.kind === 'empty'\n ? { ...state, message: 'No calendar observations available.' }\n : state;\n });\n private readonly options = computed<CalendarView | null>(() => {\n const model = this.model();\n return this.state().kind === 'ready' && model.kind === 'ready' && this.localDatesAvailable()\n ? {\n year: model.year,\n max: model.max,\n days: model.days,\n tokens: this.tokens(),\n animation: this.animation() && !this.reducedMotion(),\n format: this.formatting().format,\n valueLabel: this.valueLabel(),\n }\n : null;\n });\n protected selectDate(date: string, source: 'plot' | 'table'): void {\n const model = this.model();\n if (this.state().kind !== 'ready' || model.kind !== 'ready') return;\n const day = model.days.find((day) => day.date === date);\n if (day?.value == null || day.row === null) return;\n this.pointSelect.emit({ date, value: day.value, row: day.row, source });\n }\n constructor() {\n afterNextRender(() => {\n if (!isPlatformBrowser(this.platform)) return;\n void this.application.whenStable().then(() => {\n if (this.destroyRef.destroyed) return;\n try {\n const preference = window.matchMedia('(prefers-reduced-motion: reduce)');\n this.reducedMotion.set(preference.matches);\n const onMotion = (event: MediaQueryListEvent) => this.reducedMotion.set(event.matches);\n preference.addEventListener('change', onMotion);\n this.removeMotionListener = () => preference.removeEventListener('change', onMotion);\n this.controller = new ɵPlotController(\n this.plot().nativeElement,\n ɵbrowserPlotEnvironment(() => this.loader(), this.host.nativeElement),\n (point) => this.selectDate(point.rowId, 'plot'),\n () => this.rendererError.set(true),\n );\n this.focusKeeper = new ɵChartFocusKeeper(this.host.nativeElement);\n this.browserReady.set(true);\n } catch {\n this.rendererError.set(true);\n }\n });\n });\n // Resolving CSS colors writes a probe and immediately reads its computed color.\n afterRenderEffect({\n mixedReadWrite: () => {\n if (!this.browserReady()) return;\n const theme = this.theme();\n this.themeRevision();\n try {\n this.measuredTheme.set(\n ɵreadCartesianTheme<{ value: number }>(\n this.host.nativeElement,\n theme,\n [{ id: 'calendar', key: 'value', label: this.title() }],\n this.plot().nativeElement,\n ),\n );\n } catch {\n this.rendererError.set(true);\n }\n },\n });\n // Option updates only schedule rendering or dispose the previous plot.\n afterRenderEffect({\n write: () => {\n this.browserReady();\n this.controller?.update(this.options());\n },\n });\n // Focus restoration checks current DOM ownership before changing focus.\n afterRenderEffect({\n mixedReadWrite: () => {\n this.state();\n this.months();\n this.focusKeeper?.restore();\n },\n });\n this.destroyRef.onDestroy(() => {\n this.removeMotionListener?.();\n this.controller?.destroy();\n this.focusKeeper?.destroy();\n });\n }\n protected retryRenderer(): void {\n this.rendererError.set(false);\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n class=\"calendar-stage\"\n [state]=\"currentState\"\n [height]=\"null\"\n [retryable]=\"rendererError()\"\n retryLabel=\"Retry calendar\"\n (retry)=\"retryRenderer()\"\n >\n <div\n class=\"calendar-viewport\"\n [hidden]=\"currentState.kind !== 'ready' || !localDatesAvailable()\"\n >\n <div #plot class=\"plot\" aria-hidden=\"true\"></div>\n </div>\n </nec-chart-stage>\n <div\n class=\"chart-controls calendar-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n @if (!localDatesAvailable()) {\n <p role=\"status\">\n This timezone skips a date in {{ year() }}. Explore the exact daily values below.\n </p>\n }\n <div\n class=\"calendar-scale\"\n [hidden]=\"!localDatesAvailable()\"\n role=\"group\"\n aria-label=\"Calendar color scale\"\n >\n <span class=\"scale-item\"><i class=\"missing\" aria-hidden=\"true\"></i>No data</span>\n <span class=\"scale-item\"\n ><i [style.background]=\"tokens().border\" aria-hidden=\"true\"></i>{{ zeroLabel() }}</span\n >\n <span class=\"scale-ramp\"\n ><span>Up to</span>\n @for (step of scale(); track $index) {\n <span class=\"scale-step\" [attr.title]=\"step.label\"\n ><i [style.background]=\"step.color\" aria-hidden=\"true\"></i\n ><span>{{ step.upperText }}</span></span\n >\n }\n </span>\n </div>\n <details class=\"calendar-data\">\n <summary class=\"table-toggle\">Explore daily data</summary>\n <p class=\"table-help\">\n Monday-first calendar. Blank dates mean no data; zero is a recorded value. Positive values\n use four equal intervals up to {{ maximumLabel() }}.\n </p>\n @if (currentState.kind === 'ready') {\n @for (month of months(); track month.name) {\n <details class=\"calendar-month\">\n <summary>{{ month.name }} {{ year() }}</summary>\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"month.name + ' daily values'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n —\n {{\n month.name\n }}\n {{\n year()\n }}\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Date</th>\n <th scope=\"col\">Value</th>\n </tr>\n </thead>\n <tbody>\n @for (day of month.days; track day.date) {\n <tr>\n <th scope=\"row\">{{ day.date }}</th>\n <td>\n @if (day.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"'Select ' + day.date + ': ' + day.text\"\n (click)=\"selectDate(day.date, 'table')\"\n >\n {{ day.text }}\n </button>\n } @else {\n <span>{{ day.text }}</span>\n }\n </td>\n </tr>\n }\n </tbody>\n </table>\n </div>\n </details>\n }\n }\n </details>\n </div>\n</nec-chart-frame>\n"],"mappings":";;;;;AAGA,MAAa,2BAA2B,IAAI,eAE1C,4BAA4B;CAC5B,YAAY;CACZ,qBAAqB,OAAO,iEAAsB,CAAC,MAAM,MAAM,EAAE,sBAAsB;AACxF,CAAA;AAID,SAAgB,0BAA0B,OAAwB;CAChE,OAAO,MAAM,OAAO,SAAQ;EAC1B,MAAM,CAAC,MAAM,OAAO,OAAO,KAAK,MAAM,GAAG,CAAC,CAAC,IAAI,MAAM;EACrD,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,GAAG,GAAG;EAC3C,OACE,MAAM,YAAW,MAAO,QAAQ,MAAM,SAAQ,MAAO,QAAQ,KAAK,MAAM,QAAO,MAAO;CAE1F,CAAC;AACH;AC4BA,IAAa,kBAAb,MAAa,gBAAe;CACjB,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAChC,cAAc,MAAM,IAAG,GAAA,YAAA,CAAA,EAAA,WAAA,cAAA,CAAA,+BAAA,CAAA,CAAA;CACvB,aAAa,MAAM,SA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AA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,MAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAM,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import * as i0 from "@angular/core";
2
2
  import { ChangeDetectionStrategy, Component, InjectionToken, inject } from "@angular/core";
3
- import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵbuildCartesianOptions } from "@mantha911/ng-echarts/core";
3
+ import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵTablePager, ɵbuildCartesianOptions } from "@mantha911/ng-echarts/core";
4
4
  const COMPOSED_RENDERER_LOADER = new InjectionToken("Composed renderer loader", {
5
5
  providedIn: "root",
6
6
  factory: () => () => import("./mantha911-ng-echarts-composed-composed-renderer-C9EFo56K.mjs").then((module) => module.createComposedRenderer)
@@ -19,10 +19,31 @@ function buildComposedOptions(context, series) {
19
19
  series: series.flatMap((item, index) => {
20
20
  if (hiddenIds.has(item.id)) return [];
21
21
  const color = tokens.series[index % tokens.series.length] ?? "#047857";
22
- const data = model.rows.map((row) => ({
23
- id: row.id,
24
- value: row.points[index]?.value ?? "-"
25
- }));
22
+ const data = model.rows.map((row) => {
23
+ const value = row.points[index]?.value ?? null;
24
+ let borderRadius = 0;
25
+ if (item.kind === "bar" && item.stack !== void 0 && value !== null && value !== 0) {
26
+ if (!series.some((later, laterIndex) => {
27
+ const other = row.points[laterIndex]?.value ?? 0;
28
+ return laterIndex > index && later.kind === "bar" && later.stack === item.stack && !hiddenIds.has(later.id) && other !== 0 && Math.sign(other) === Math.sign(value);
29
+ })) borderRadius = value < 0 ? [
30
+ 0,
31
+ 0,
32
+ 2,
33
+ 2
34
+ ] : [
35
+ 2,
36
+ 2,
37
+ 0,
38
+ 0
39
+ ];
40
+ }
41
+ return {
42
+ id: row.id,
43
+ value: value ?? "-",
44
+ ...item.kind === "bar" && item.stack !== void 0 ? { itemStyle: { borderRadius } } : {}
45
+ };
46
+ });
26
47
  const identity = {
27
48
  id: item.id,
28
49
  name: item.label,
@@ -31,11 +52,13 @@ function buildComposedOptions(context, series) {
31
52
  return item.kind === "bar" ? [{
32
53
  ...identity,
33
54
  type: "bar",
55
+ stack: item.stack,
56
+ stackStrategy: "samesign",
34
57
  z: 2,
35
58
  barMaxWidth: 48,
36
59
  itemStyle: {
37
60
  color,
38
- borderRadius: 2
61
+ borderRadius: item.stack === void 0 ? 2 : 0
39
62
  }
40
63
  }] : [{
41
64
  ...identity,
@@ -68,6 +91,8 @@ function composedSeriesError(series) {
68
91
  for (const item of series) {
69
92
  if (!item || !["bar", "line"].includes(item.kind)) return "Composed series require a 'bar' or 'line' kind.";
70
93
  if (item.kind === "bar" && (item.smooth !== void 0 || item.showPoints !== void 0)) return "Line settings cannot be used on bar series.";
94
+ if (item.kind === "bar" && item.stack !== void 0 && (typeof item.stack !== "string" || !item.stack.trim() || item.stack !== item.stack.trim())) return "Bar stack names must be nonempty strings without surrounding whitespace.";
95
+ if (item.kind === "line" && item.stack !== void 0) return "Stack settings cannot be used on line series.";
71
96
  if (item.kind === "line" && (item.smooth !== void 0 && typeof item.smooth !== "boolean" || item.showPoints !== void 0 && typeof item.showPoints !== "boolean")) return "Line settings must be booleans.";
72
97
  }
73
98
  return null;
@@ -102,25 +127,34 @@ var ComposedChart = class ComposedChart extends ɵCartesianChart {
102
127
  selector: "nec-composed-chart",
103
128
  usesInheritance: true,
104
129
  ngImport: i0,
105
- template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
130
+ template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
106
131
  styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"],
107
- dependencies: [{
108
- kind: "component",
109
- type: ChartFrame,
110
- selector: "nec-chart-frame",
111
- inputs: ["title", "description"]
112
- }, {
113
- kind: "component",
114
- type: ɵChartStage,
115
- selector: "nec-chart-stage",
116
- inputs: [
117
- "state",
118
- "height",
119
- "retryable",
120
- "retryLabel"
121
- ],
122
- outputs: ["retry"]
123
- }],
132
+ dependencies: [
133
+ {
134
+ kind: "component",
135
+ type: ChartFrame,
136
+ selector: "nec-chart-frame",
137
+ inputs: ["title", "description"]
138
+ },
139
+ {
140
+ kind: "component",
141
+ type: ɵChartStage,
142
+ selector: "nec-chart-stage",
143
+ inputs: [
144
+ "state",
145
+ "height",
146
+ "retryable",
147
+ "retryLabel"
148
+ ],
149
+ outputs: ["retry"]
150
+ },
151
+ {
152
+ kind: "component",
153
+ type: ɵTablePager,
154
+ selector: "nec-table-pager",
155
+ inputs: ["pagination", "label"]
156
+ }
157
+ ],
124
158
  changeDetection: i0.ChangeDetectionStrategy.OnPush
125
159
  });
126
160
  };
@@ -133,9 +167,13 @@ i0.ɵɵngDeclareClassMetadata({
133
167
  type: Component,
134
168
  args: [{
135
169
  selector: "nec-composed-chart",
136
- imports: [ChartFrame, ɵChartStage],
170
+ imports: [
171
+ ChartFrame,
172
+ ɵChartStage,
173
+ ɵTablePager
174
+ ],
137
175
  changeDetection: ChangeDetectionStrategy.OnPush,
138
- template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
176
+ template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
139
177
  styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"]
140
178
  }]
141
179
  }]
@@ -1 +1 @@
1
- {"version":3,"file":"mantha911-ng-echarts-composed.mjs","names":[],"sources":["../../../projects/chart-library/composed/src/lib/composed-browser.ts","../../../projects/chart-library/composed/src/lib/composed-options.ts","../../../projects/chart-library/composed/src/lib/composed-types.ts","../../../projects/chart-library/composed/src/lib/composed-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { ComposedOption } from './composed-options';\nexport const COMPOSED_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<ComposedOption>>\n>('Composed renderer loader', {\n providedIn: 'root',\n factory: () => () =>\n import('./composed-renderer').then((module) => module.createComposedRenderer),\n});\n","import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport { ɵbuildCartesianOptions, type ɵCartesianContext } from '@mantha911/ng-echarts/core';\nimport type { ComposedSeries } from './composed-types';\nexport type ComposedOption = ComposeOption<\n BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport function buildComposedOptions<T>(\n context: ɵCartesianContext<T>,\n series: readonly ComposedSeries<T>[],\n): ComposedOption {\n const { model, hiddenIds, tokens, animation, format, categoryTicks } = context;\n const common = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n false,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = common.xAxis;\n if (categoryAxis.type !== 'category') throw new Error('Expected category axis');\n return {\n ...common,\n // Keep category centers stable even while every bar is hidden.\n xAxis: { ...categoryAxis, boundaryGap: true },\n series: series.flatMap((item, index): (BarSeriesOption | LineSeriesOption)[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n const data = model.rows.map((row) => ({\n id: row.id,\n value: row.points[index]?.value ?? '-',\n }));\n const identity = { id: item.id, name: item.label, data };\n return item.kind === 'bar'\n ? [\n {\n ...identity,\n type: 'bar',\n z: 2,\n barMaxWidth: 48,\n itemStyle: { color, borderRadius: 2 },\n },\n ]\n : [\n {\n ...identity,\n type: 'line',\n z: 3,\n smooth: item.smooth ?? false,\n showSymbol: item.showPoints ?? true,\n connectNulls: false,\n symbol: 'diamond',\n clip: false,\n symbolSize: 7,\n triggerEvent: 'line',\n lineStyle: { color, width: 2.5, type: 'dashed', cap: 'round' },\n itemStyle: { color: tokens.background, borderColor: color, borderWidth: 2 },\n },\n ];\n }),\n };\n}\n","import type { ChartSeries } from '@mantha911/ng-echarts/core';\n\nexport interface ComposedBarSeries<T> extends ChartSeries<T> {\n readonly kind: 'bar';\n readonly smooth?: never;\n readonly showPoints?: never;\n}\nexport interface ComposedLineSeries<T> extends ChartSeries<T> {\n readonly kind: 'line';\n readonly smooth?: boolean;\n readonly showPoints?: boolean;\n}\n/** Series share one category axis and one numeric scale; measures must use comparable units. */\nexport type ComposedSeries<T> = ComposedBarSeries<T> | ComposedLineSeries<T>;\n\nexport function composedSeriesError<T>(series: readonly ComposedSeries<T>[]): string | null {\n if (!Array.isArray(series)) return 'Chart data and series must be arrays.';\n for (const item of series) {\n if (!item || !['bar', 'line'].includes(item.kind))\n return \"Composed series require a 'bar' or 'line' kind.\";\n if (item.kind === 'bar' && (item.smooth !== undefined || item.showPoints !== undefined))\n return 'Line settings cannot be used on bar series.';\n if (\n item.kind === 'line' &&\n ((item.smooth !== undefined && typeof item.smooth !== 'boolean') ||\n (item.showPoints !== undefined && typeof item.showPoints !== 'boolean'))\n )\n return 'Line settings must be booleans.';\n }\n return null;\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { COMPOSED_RENDERER_LOADER } from './composed-browser';\nimport { buildComposedOptions, type ComposedOption } from './composed-options';\nimport { composedSeriesError, type ComposedSeries } from './composed-types';\n@Component({\n selector: 'nec-composed-chart',\n imports: [ChartFrame, ɵChartStage],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ComposedChart<T extends object> extends ɵCartesianChart<\n T,\n ComposedOption,\n ComposedSeries<T>\n> {\n private readonly loader = inject(COMPOSED_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return this.series();\n }\n protected override familyError() {\n return composedSeriesError(this.series());\n }\n protected override buildOptions(context: ɵCartesianContext<T>): ComposedOption {\n return buildComposedOptions(context, this.series());\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n"],"mappings":";;;AAGA,MAAa,2BAA2B,IAAI,eAE1C,4BAA4B;CAC5B,YAAY;CACZ,qBACE,OAAO,iEAAsB,CAAC,MAAM,WAAW,OAAO,sBAAsB;AAC/E,CAAA;ACAD,SAAgB,qBACd,SACA,QAAoC;CAEpC,MAAM,EAAE,OAAO,WAAW,QAAQ,WAAW,QAAQ,kBAAkB;CACvE,MAAM,SAAS,uBACb,OACA,WACA,QACA,OACA,WACA,QACA,aAAa;CAEf,MAAM,eAAe,OAAO;CAC5B,IAAI,aAAa,SAAS,YAAY,MAAM,IAAI,MAAM,wBAAwB;CAC9E,OAAO;EACL,GAAG;EAEH,OAAO;GAAE,GAAG;GAAc,aAAa;EAAI;EAC3C,QAAQ,OAAO,SAAS,MAAM,UAAiD;GAC7E,IAAI,UAAU,IA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AmB;EACpC,OAAO,KAAK,OAAM;CACpB;CACmB,cAAW;EAC5B,OAAO,oBAAoB,KAAK,OAAM,CAAE;CAC1C;CACmB,aAAa,SAA6B;EAC3D,OAAO,qBAAqB,SAAS,KAAK,OAAM,CAAE;CACpD;CAjBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAa,MAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAb,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAa,cAAA;EAAA,UAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UCpB1B;EAyHA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD7GY;GAAU,UAAA;GAAA,QAAA,CAAA,SAAA,aAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAW,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,OAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQtB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAa,YAAA,CAAA;EAVzB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAoB,SACrB,CAAC,YAAY,WAAW;GAAC,iBAMjB,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
1
+ {"version":3,"file":"mantha911-ng-echarts-composed.mjs","names":[],"sources":["../../../projects/chart-library/composed/src/lib/composed-browser.ts","../../../projects/chart-library/composed/src/lib/composed-options.ts","../../../projects/chart-library/composed/src/lib/composed-types.ts","../../../projects/chart-library/composed/src/lib/composed-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { ComposedOption } from './composed-options';\nexport const COMPOSED_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<ComposedOption>>\n>('Composed renderer loader', {\n providedIn: 'root',\n factory: () => () =>\n import('./composed-renderer').then((module) => module.createComposedRenderer),\n});\n","import type { BarSeriesOption, LineSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport { ɵbuildCartesianOptions, type ɵCartesianContext } from '@mantha911/ng-echarts/core';\nimport type { ComposedSeries } from './composed-types';\nexport type ComposedOption = ComposeOption<\n BarSeriesOption | LineSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport function buildComposedOptions<T>(\n context: ɵCartesianContext<T>,\n series: readonly ComposedSeries<T>[],\n): ComposedOption {\n const { model, hiddenIds, tokens, animation, format, categoryTicks } = context;\n const common = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n false,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = common.xAxis;\n if (categoryAxis.type !== 'category') throw new Error('Expected category axis');\n return {\n ...common,\n // Keep category centers stable even while every bar is hidden.\n xAxis: { ...categoryAxis, boundaryGap: true },\n series: series.flatMap((item, index): (BarSeriesOption | LineSeriesOption)[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n const data = model.rows.map((row) => {\n const value = row.points[index]?.value ?? null;\n let borderRadius: number | number[] = 0;\n if (item.kind === 'bar' && item.stack !== undefined && value !== null && value !== 0) {\n const covered = series.some((later, laterIndex) => {\n const other = row.points[laterIndex]?.value ?? 0;\n return (\n laterIndex > index &&\n later.kind === 'bar' &&\n later.stack === item.stack &&\n !hiddenIds.has(later.id) &&\n other !== 0 &&\n Math.sign(other) === Math.sign(value)\n );\n });\n if (!covered) borderRadius = value < 0 ? [0, 0, 2, 2] : [2, 2, 0, 0];\n }\n return {\n id: row.id,\n value: value ?? '-',\n ...(item.kind === 'bar' && item.stack !== undefined\n ? { itemStyle: { borderRadius } }\n : {}),\n };\n });\n const identity = { id: item.id, name: item.label, data };\n return item.kind === 'bar'\n ? [\n {\n ...identity,\n type: 'bar',\n stack: item.stack,\n stackStrategy: 'samesign',\n z: 2,\n barMaxWidth: 48,\n itemStyle: { color, borderRadius: item.stack === undefined ? 2 : 0 },\n },\n ]\n : [\n {\n ...identity,\n type: 'line',\n z: 3,\n smooth: item.smooth ?? false,\n showSymbol: item.showPoints ?? true,\n connectNulls: false,\n symbol: 'diamond',\n clip: false,\n symbolSize: 7,\n triggerEvent: 'line',\n lineStyle: { color, width: 2.5, type: 'dashed', cap: 'round' },\n itemStyle: { color: tokens.background, borderColor: color, borderWidth: 2 },\n },\n ];\n }),\n };\n}\n","import type { ChartSeries } from '@mantha911/ng-echarts/core';\n\nexport interface ComposedBarSeries<T> extends ChartSeries<T> {\n readonly kind: 'bar';\n /** Bars with the same nonempty name stack by sign; omission keeps a grouped bar. */\n readonly stack?: string;\n readonly smooth?: never;\n readonly showPoints?: never;\n}\nexport interface ComposedLineSeries<T> extends ChartSeries<T> {\n readonly kind: 'line';\n readonly stack?: never;\n readonly smooth?: boolean;\n readonly showPoints?: boolean;\n}\n/** Series share one category axis and one numeric scale; measures must use comparable units. */\nexport type ComposedSeries<T> = ComposedBarSeries<T> | ComposedLineSeries<T>;\n\nexport function composedSeriesError<T>(series: readonly ComposedSeries<T>[]): string | null {\n if (!Array.isArray(series)) return 'Chart data and series must be arrays.';\n for (const item of series) {\n if (!item || !['bar', 'line'].includes(item.kind))\n return \"Composed series require a 'bar' or 'line' kind.\";\n if (item.kind === 'bar' && (item.smooth !== undefined || item.showPoints !== undefined))\n return 'Line settings cannot be used on bar series.';\n if (\n item.kind === 'bar' &&\n item.stack !== undefined &&\n (typeof item.stack !== 'string' || !item.stack.trim() || item.stack !== item.stack.trim())\n )\n return 'Bar stack names must be nonempty strings without surrounding whitespace.';\n if (item.kind === 'line' && item.stack !== undefined)\n return 'Stack settings cannot be used on line series.';\n if (\n item.kind === 'line' &&\n ((item.smooth !== undefined && typeof item.smooth !== 'boolean') ||\n (item.showPoints !== undefined && typeof item.showPoints !== 'boolean'))\n )\n return 'Line settings must be booleans.';\n }\n return null;\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵTablePager,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { COMPOSED_RENDERER_LOADER } from './composed-browser';\nimport { buildComposedOptions, type ComposedOption } from './composed-options';\nimport { composedSeriesError, type ComposedSeries } from './composed-types';\n@Component({\n selector: 'nec-composed-chart',\n imports: [ChartFrame, ɵChartStage, ɵTablePager],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ComposedChart<T extends object> extends ɵCartesianChart<\n T,\n ComposedOption,\n ComposedSeries<T>\n> {\n private readonly loader = inject(COMPOSED_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return this.series();\n }\n protected override familyError() {\n return composedSeriesError(this.series());\n }\n protected override buildOptions(context: ɵCartesianContext<T>): ComposedOption {\n return buildComposedOptions(context, this.series());\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n"],"mappings":";;;AAGA,MAAa,2BAA2B,IAAI,eAE1C,4BAA4B;CAC5B,YAAY;CACZ,qBACE,OAAO,iEAAsB,CAAC,MAAM,WAAW,OAAO,sBAAsB;AAC/E,CAAA;ACAD,SAAgB,qBACd,SACA,QAAoC;CAEpC,MAAM,EAAE,OAAO,WAAW,QAAQ,WAAW,QAAQ,kBAAkB;CACvE,MAAM,SAAS,uBACb,OACA,WACA,QACA,OACA,WACA,QACA,aAAa;CAEf,MAAM,eAAe,OAAO;CAC5B,IAAI,aAAa,SAAS,YAAY,MAAM,IAAI,MAAM,wBAAwB;CAC9E,OAAO;EACL,GAAG;EAEH,OAAO;GAAE,GAAG;GAAc,aAAa;EAAI;EAC3C,QAAQ,OAAO,SAAS,MAAM,UAAiD;GAC7E,IAAI,UAAU,IAAI,KAAK,EAAE,GAAG,OAAO,CAAA;GACnC,MAAM,QAAQ,OAAO,OAAO,QAAQ,OAAO,OAAO,WAAW;GAC7D,MAAM,OAAO,MAAM,KAAK,KAAK,QAAO;IAClC,MAAM,QAAQ,IAAI,OAAO,MAAM,EAAE,SAAS;IAC1C,IAAI,eAAkC;IACtC,IAAI,KAAK,SAAS,SAAS,KAAK,UAAU,UAAa,UAAU,QAAQ,UAAU,GAYjF;SAAI,CAXY,OAAO,MAAM,OAAO,eAAc;MAChD,MAAM,QAAQ,IAAI,OAAO,WAAW,EAAE,SAAS;MAC/C,OACE,aAAa,SACb,MAAM,SAAS,SACf,MAAM,UAAU,KAAK,SACrB,CAAC,UAAU,IAAI,MAAM,EAAE,KACvB,UAAU,KACV,KAAK,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