ngwr 16.7.1 → 16.8.0
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.
- package/charts/donut-chart/styles/_index.scss +9 -3
- package/charts/meter-group/styles/_index.scss +8 -1
- package/charts/sparkline/styles/_index.scss +6 -3
- package/command-palette/styles/_index.scss +10 -0
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -1
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +17 -0
- package/fesm2022/ngwr-charts-core.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-donut-chart.mjs +54 -6
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +54 -6
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline-testing.mjs +27 -0
- package/fesm2022/ngwr-charts-sparkline-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +45 -4
- package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
- package/fesm2022/ngwr-checkbox.mjs +38 -3
- package/fesm2022/ngwr-checkbox.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +4 -3
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +39 -19
- package/fesm2022/ngwr-command-palette.mjs.map +1 -1
- package/fesm2022/ngwr-context-menu.mjs +7 -2
- package/fesm2022/ngwr-context-menu.mjs.map +1 -1
- package/fesm2022/ngwr-dialog.mjs +10 -7
- package/fesm2022/ngwr-dialog.mjs.map +1 -1
- package/fesm2022/ngwr-drawer.mjs +14 -8
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +2 -2
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ar.mjs +9 -2
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +9 -2
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +9 -2
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +9 -2
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +9 -2
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +9 -2
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +9 -2
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +9 -2
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +9 -2
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +9 -2
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +9 -2
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-kk.mjs +9 -2
- package/fesm2022/ngwr-i18n-kk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +9 -2
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +9 -2
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +9 -2
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +9 -2
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +9 -2
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +9 -2
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +9 -2
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +9 -2
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +9 -2
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +9 -2
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +33 -10
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +24 -10
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +2 -2
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +5 -3
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-overlay.mjs +51 -2
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +2 -2
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +22 -17
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-switch.mjs +33 -3
- package/fesm2022/ngwr-switch.mjs.map +1 -1
- package/fesm2022/ngwr-tour.mjs +8 -3
- package/fesm2022/ngwr-tour.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/i18n/ar.json +9 -2
- package/i18n/cs.json +9 -2
- package/i18n/de.json +9 -2
- package/i18n/en.json +9 -2
- package/i18n/es.json +9 -2
- package/i18n/fr.json +9 -2
- package/i18n/he.json +9 -2
- package/i18n/hi.json +9 -2
- package/i18n/id.json +9 -2
- package/i18n/it.json +9 -2
- package/i18n/ja.json +9 -2
- package/i18n/kk.json +9 -2
- package/i18n/ko.json +9 -2
- package/i18n/nl.json +9 -2
- package/i18n/pl.json +9 -2
- package/i18n/pt.json +9 -2
- package/i18n/ru.json +9 -2
- package/i18n/sv.json +9 -2
- package/i18n/tr.json +9 -2
- package/i18n/uk.json +9 -2
- package/i18n/vi.json +9 -2
- package/i18n/zh-TW.json +9 -2
- package/i18n/zh.json +9 -2
- package/llms-full.txt +4 -4
- package/package.json +1 -1
- package/schematics/use/rule.js +1 -0
- package/schematics/use/symbol-map.json +1 -0
- package/tour/styles/_index.scss +11 -7
- package/types/ngwr-charts-donut-chart-testing.d.ts +32 -3
- package/types/ngwr-charts-donut-chart.d.ts +45 -6
- package/types/ngwr-charts-meter-group-testing.d.ts +29 -1
- package/types/ngwr-charts-meter-group.d.ts +43 -4
- package/types/ngwr-charts-sparkline-testing.d.ts +32 -2
- package/types/ngwr-charts-sparkline.d.ts +42 -3
- package/types/ngwr-checkbox.d.ts +14 -0
- package/types/ngwr-color-picker-testing.d.ts +1 -1
- package/types/ngwr-command-palette.d.ts +2 -1
- package/types/ngwr-dialog.d.ts +11 -6
- package/types/ngwr-drawer.d.ts +12 -4
- package/types/ngwr-file-upload.d.ts +1 -1
- package/types/ngwr-input-number.d.ts +14 -2
- package/types/ngwr-input-otp.d.ts +2 -0
- package/types/ngwr-lightbox.d.ts +1 -0
- package/types/ngwr-overlay.d.ts +20 -1
- package/types/ngwr-slider.d.ts +3 -1
- package/types/ngwr-switch.d.ts +13 -0
- package/types/ngwr-version.d.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-donut-chart.mjs","names":[],"sources":["../../../projects/lib/charts/donut-chart/donut-chart.ts","../../../projects/lib/charts/donut-chart/donut-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport { Component, type ElementRef, ViewEncapsulation, computed, input, model, viewChild } from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport { WrChartState, useChartHover, useChartNumbers, useChartState, wrChartColor } from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDonutSegment } from './types';\n\n/**\n * A segment's contribution to the ring. `Math.max(0, NaN)` is NaN, and the running total\n * carries it forward — so one non-finite datum used to take out its own arc AND every arc\n * after it, writing the literal text `NaN` into the path `d`.\n */\nfunction weight(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\n/**\n * How wide a slice's hover target is at least, along the outer edge, in CSS px. A\n * slice narrower than that — a share of a percent or two, which at the default 200px\n * is a few px of arc — is a target no pointer lands on, so it gets a wider one; see\n * `hits`.\n */\nconst HIT_PX = 12;\n\n/**\n * The widest that target may grow, in radians, whatever the chart's size: on a 48px\n * chart 12px of arc is a third of a quarter turn, which would take too much of the\n * slices beside it.\n */\nconst MAX_HIT_ANGLE = Math.PI / 12;\n\n/**\n * Donut chart, and with `pie` a pie chart. Optional center text via inputs.\n *\n * @example\n * ```html\n * <wr-donut-chart [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Free', value: 40 }\n * ]\" centerLabel=\"Disk\" centerValue=\"60%\" />\n *\n * <wr-donut-chart [segments]=\"segments\" pie />\n * ```\n *\n * **The look is the chart theme's.** A slice with no `color` takes the next colour of\n * the shared palette (`--wr-chart-1` to `--wr-chart-8`), and every two slices are parted\n * by a line in `--wr-chart-separator`, 1px at any `size`. Hovering a slice or a legend\n * row dims the others.\n *\n * **The legend** is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), placed by\n * `legendPosition` and left out for a single slice unless `showLegend` asks for it. With\n * `toggleableLegend` its rows show and hide their slices through `hiddenSegments`.\n *\n * **Empty, loading, error.** With nothing to draw the chart keeps its ring as a track\n * and says \"No data\"; `loading` and `error` put their own message there in place of the\n * slices.\n *\n * @see https://ngwr.dev/charts/donut-chart\n */\n@Component({\n selector: 'wr-donut-chart',\n templateUrl: './donut-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the drawing.\n class: 'wr-donut-chart wr-chart--legend',\n '[class.wr-donut-chart--pie]': 'pie()',\n '[class.wr-donut-chart--gapless]': 'gapless()',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-donut-chart__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-donut-chart' }],\n})\nexport class WrDonutChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/donut-chart');\n // One listener pair for the whole chart: a slice and a sliver's wider target each\n // carry `data-wr-index`, and `data-wr-series` for the dim.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /**\n * The slices, drawn clockwise from twelve o'clock. A segment with no `color`\n * takes the next colour of the chart palette, `--wr-chart-1` to `--wr-chart-8`.\n */\n readonly segments = input<readonly WrDonutSegment[]>([]);\n\n /**\n * Accessible name of the drawing. The arcs carry no text and the legend is optional, so\n * with `showLegend: false` this and the centre text are the whole of what a screen reader\n * gets. Falls back to `donutChart.label`, or to `donutChart.pieLabel` with `pie`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly donutLabel = useI18nText(this.ariaLabel, 'donutChart.label', 'Donut chart');\n private readonly pieLabel = useI18nText(this.ariaLabel, 'donutChart.pieLabel', 'Pie chart');\n\n protected readonly resolvedAriaLabel = computed(() => (this.pie() ? this.pieLabel() : this.donutLabel()));\n\n /** Diameter in CSS pixels. @default 200 */\n readonly size = input(200, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 200)) });\n\n /**\n * Inner-ring thickness as a percent of radius (0–100). `0` fills to the centre, and\n * keeps the centre text; `pie` ignores it. @default 30\n */\n readonly thickness = input(30, {\n transform: (v: unknown): number => Math.min(100, Math.max(0, coerceNumberProperty(v, 30))),\n });\n\n /**\n * Draw a pie chart: every slice fills to the centre, whatever `thickness` says, and\n * the host takes the `wr-donut-chart--pie` modifier. A pie has no hole to print in, so\n * `centerValue` and `centerLabel` are not rendered. Everything else is the donut's: the\n * slices run clockwise from twelve o'clock, with the same gap between them, the legend\n * and its toggle, and the tooltip — which in a pie also opens from a wider, invisible\n * target over a slice too thin to point at (see `tooltip`). The drawing's name falls\n * back to `donutChart.pieLabel`. @default false\n */\n readonly pie = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draw the slices edge to edge, with no gap between them: each is stroked in its own\n * colour rather than the surface's, and the host takes the `wr-donut-chart--gapless`\n * modifier. The gap is a shape that tells two neighbours apart without hue, so with it\n * off only the colour change divides them; keep the legend or the tooltip on where the\n * chart has to read without hue. @default false\n */\n readonly gapless = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show the legend. `'auto'` shows it when there is something to tell apart - two\n * segments or more - and leaves it out for a single one; `true` shows it for one\n * segment too. @default 'auto'\n */\n readonly showLegend = input<boolean | 'auto', unknown>('auto', {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the chart as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a slice from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the chart's data is in flight: the slices give way to the loading\n * message, over the ring drawn as a track. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the slices give way to the error message. `loading`\n * wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is nothing to draw. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /**\n * Make each legend row a toggle button that shows and hides its slice, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its slice is\n * shown, so the legend becomes one tab stop per slice. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the slices that are hidden. Positions rather than\n * labels, since two slices may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden slice is left out of the ring, and the slices still shown RE-NORMALISE:\n * they share the whole ring between them, each at its share of their own total. A\n * donut reads as the parts of the whole it draws, so leaving the hidden slice's arc\n * as a gap would show a whole that no longer adds up, and turning a slice off is how\n * a reader asks \"of the rest, how much is each?\". The tooltip cannot open on a slice\n * that is not drawn. The legend keeps the hidden slice's row, struck through and with\n * its own value, so it can be shown again; the row says \"hidden\" to a screen reader as\n * well, through `aria-pressed` on a toggle and a visually hidden word otherwise. The\n * centre text is printed as given, so a host that writes a total there works it out\n * from this list. A position past the end of `segments` is kept and ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /** Bold value text in the center. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerValue = input<string>('');\n\n /** Smaller label under the value. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerLabel = input<string>('');\n\n /**\n * Whether the centre text renders: some is given, there is a hole to print it in, and\n * no state's message is there instead.\n */\n protected readonly showCenter = computed(\n () => !this.pie() && !this.state() && (!!this.centerValue() || !!this.centerLabel())\n );\n\n /**\n * Show a tooltip with the slice's label and value on hover. Pointer only — the legend\n * prints the same numbers, and with `showLegend` off `ariaLabel` is where to say\n * them. With `pie`, a slice too thin to land a pointer on, a sliver of a few degrees,\n * is hovered over a wider strip than it draws, through an invisible\n * `.wr-donut-chart__hit` over the pie: widened toward 12px of outer arc (15° on a\n * chart under about 92px) out of what the wider slices beside it can spare, each of\n * which keeps that much of its own. A sliver whose neighbours are slivers too, or\n * have little to spare, gets a narrower target or none, and is read in the legend.\n * The ring draws no such target.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes every value in the legend and the tooltip. `null` uses `Intl.NumberFormat`\n * in `LOCALE_ID`. The centre text is printed as given.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Each value as the legend and the tooltip print it: exact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n // Drawn in a 100×100 viewBox.\n private readonly outerR = 50;\n\n protected readonly innerR = computed(() => {\n const thickness = this.thickness();\n // A pie, or a thickness of 0: fill all the way to the center, not a zero-width ring.\n if (this.pie() || thickness === 0) return 0;\n return this.outerR * (1 - thickness / 100);\n });\n\n /** The sum the ring is divided by: the slices still shown (see `hiddenSegments`). */\n protected readonly total = computed(() => {\n const hidden = this.hidden();\n const sum = this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : weight(s.value)), 0);\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Resolved slices ready for the template — each carries its arc path.\n *\n * Angles are in the drawing's own frame, where 0 is three o'clock and a positive\n * angle turns clockwise, because y runs downwards. The ring starts a quarter turn\n * back from there, at twelve o'clock, which is where the input's JSDoc always said\n * it started and where a reader looks for the first slice; it used to start at three.\n */\n protected readonly slices = computed(() => {\n const total = this.total();\n const hidden = this.hidden();\n const origin = -Math.PI / 2;\n let cumulative = 0;\n return this.segments().map((s, i) => {\n const value = weight(s.value);\n const isHidden = hidden.has(i);\n // A hidden slice takes no turn of the ring, so the next slice starts where the last\n // shown one ended.\n const share = isHidden ? 0 : value;\n const startAngle = origin + (cumulative / total) * Math.PI * 2;\n cumulative += share;\n const endAngle = origin + (cumulative / total) * Math.PI * 2;\n return {\n label: s.label,\n value,\n // The segment's own figure, which a negative one keeps although it draws nothing:\n // the weight is the arc's, not the data's, and printing it named a \"0\" the data\n // never had. A value that is not a number has no figure to print.\n text: Number.isFinite(s.value) ? this.numbers.value(s.value) : '',\n color: s.color ?? wrChartColor(i),\n hidden: isHidden,\n path: isHidden ? '' : this.arcPath(startAngle, endAngle),\n percent: (share / total) * 100,\n startAngle,\n endAngle,\n midAngle: (startAngle + endAngle) / 2,\n };\n });\n });\n\n /**\n * In a pie, a wider hover target for every slice too thin to land a pointer on: an\n * invisible wedge over the slice, drawn above the pie, widened toward `HIT_PX` of outer\n * arc (`MAX_HIT_ANGLE` at most, which binds below about 92px) out of the wider slices\n * beside it.\n *\n * A wider slice gives away only what it can spare: it keeps `HIT_PX` of outer arc of its\n * own (the same `MAX_HIT_ANGLE` cap), however many slivers reach into it, so a slice\n * that was easy to point at stays easy, and its middle, where its own chip points, is\n * never covered. Two slivers reaching into one slice from either side split what it\n * spares. A sliver asks half its shortfall of each wider neighbour, or all of it of the\n * only one; what one side cannot give, the other gives if it can. Between two slivers\n * side by side the boundary stays their shared edge, so of a run of slivers only the two\n * at its ends grow, and the legend is where the rest are read — as it is for a sliver\n * whose neighbours have little to spare, which gets the narrower target they leave it.\n * A slice that draws nothing — a zero, or a hidden slice — has nothing to point at and\n * gets no target, and nor does one with no wider neighbour.\n *\n * Pie only, and only while the tooltip is on, which is all it is for: the ring draws\n * exactly what it drew before `pie` existed. The wedge is filled with nothing and\n * hit-tested through `pointer-events=\"fill\"`, which reads its interior whatever its\n * paint and never its unpainted stroke, so its edges are the ones computed here; it\n * paints in no theme and in no forced-colors palette.\n */\n protected readonly hits = computed(() => {\n if (!this.pie() || !this.tooltip() || this.state()) return [];\n const min = Math.min(MAX_HIT_ANGLE, HIT_PX / (this.size() / 2));\n const drawn = this.slices()\n .map((slice, index) => ({ index, start: slice.startAngle, end: slice.endAngle }))\n .filter(slice => slice.end - slice.start > 0);\n const count = drawn.length;\n if (count < 2) return [];\n const width = drawn.map(slice => slice.end - slice.start);\n const thin = width.map(w => w < min);\n const prev = (k: number): number => (k - 1 + count) % count;\n const next = (k: number): number => (k + 1) % count;\n // What each wider slice can give away and still keep `min` of its own.\n const spare = width.map((w, k) => (thin[k] ? 0 : w - min));\n // How far each sliver asks to reach on each side: into a wider neighbour only.\n const ask = width.map((w, k) => {\n if (!thin[k]) return { before: 0, after: 0 };\n const before = !thin[prev(k)];\n const after = !thin[next(k)];\n const share = (min - w) / (before && after ? 2 : 1);\n return { before: before ? share : 0, after: after ? share : 0 };\n });\n const reach = width.map(() => ({ before: 0, after: 0 }));\n // A wider slice is reached into by the sliver before it, past its own end, and by the\n // one after it, past its own start — the same sliver from both sides when there are\n // only two slices. Each gets what it asks while the two fit in the spare; past that,\n // at least half of it, and more where the other asks for less.\n width.forEach((_, j) => {\n if (thin[j]) return;\n const fromBefore = thin[prev(j)] ? ask[prev(j)].after : 0;\n const fromAfter = thin[next(j)] ? ask[next(j)].before : 0;\n const claims = (fromBefore > 0 ? 1 : 0) + (fromAfter > 0 ? 1 : 0);\n if (claims === 0) return;\n const fair = spare[j] / claims;\n const toBefore = Math.min(fromBefore, Math.max(fair, spare[j] - fromAfter));\n const toAfter = Math.min(fromAfter, Math.max(fair, spare[j] - fromBefore));\n if (toBefore > 0) reach[prev(j)].after = toBefore;\n if (toAfter > 0) reach[next(j)].before = toAfter;\n spare[j] = Math.max(0, spare[j] - toBefore - toAfter);\n });\n // What one side could not give, the other side gives out of what it has left.\n width.forEach((w, k) => {\n if (!thin[k]) return;\n let short = min - w - reach[k].before - reach[k].after;\n for (const [side, j] of [\n ['before', prev(k)],\n ['after', next(k)],\n ] as const) {\n if (short <= 0 || thin[j]) continue;\n const more = Math.min(short, spare[j]);\n reach[k][side] += more;\n spare[j] -= more;\n short -= more;\n }\n });\n return drawn.flatMap((slice, k) => {\n const { before, after } = reach[k];\n if (!thin[k] || before + after <= 0) return [];\n return [{ index: slice.index, path: this.arcPath(slice.start - before, slice.end + after) }];\n });\n });\n\n /**\n * The legend's rows: every slice, hidden ones included, each with its own figure — a\n * negative one included, which draws no slice — and no value at all for a segment whose\n * value is not a number.\n */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.slices().map(({ label, color, text }) => ({ label, color, value: text === '' ? null : text }))\n );\n\n /**\n * Whether the chart draws its legend: unless `legendPosition` is `none` or `showLegend`\n * is off, and under `showLegend=\"auto\"` only with two segments or more, since a single\n * slice has nothing to tell apart.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.legendItems().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the drawing, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the drawing rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /**\n * Whether the chart has nothing to draw: no segment, or none with a share to take. A\n * slice hidden from the legend still counts, so hiding every slice is not \"No data\".\n */\n private readonly empty = computed(() => this.segments().every(s => weight(s.value) === 0));\n\n /** What the chart shows in place of its slices, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: this.empty,\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n /**\n * The whole ring, or the whole disc of a pie, as one path: the frame the chart keeps\n * while it has no slice to draw - under a state, or with every slice hidden.\n */\n protected readonly track = computed(() =>\n this.state() || this.slices().every(slice => !slice.path) ? this.arcPath(0, Math.PI * 2) : null\n );\n\n /**\n * One tooltip for the whole chart, pointing at the hovered slice: at the middle of\n * its OUTER arc, on the side that part of the ring faces — above for a slice whose\n * middle is in the top quarter, below for the bottom one, beside it for the two at\n * three and nine o'clock. From there the chip sits clear of the ring, and the way\n * onto it runs straight out of the slice that opened it, over nothing else.\n *\n * Not the slice's `<path>` element: its box is most of the ring for any slice past\n * a quarter, so the chip would point at the middle of the chart. And not the middle\n * of the band: a chip there lies over the ring, under a pointer resting on it —\n * measured in Chromium, the inner half of a lower slice landed on its own chip. A\n * tiny slice keeps its own mid-angle, so the arrow says which sliver it is.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const slice = this.slices()[index];\n const svg = this.svg()?.nativeElement;\n // No slice is drawn under a state, so a chip open on one lets go.\n if (!slice?.path || !svg || this.state()) return null;\n const box = svg.getBoundingClientRect();\n // The drawing's y runs downwards, so a positive sine is the lower half.\n const cos = Math.cos(slice.midAngle);\n const sin = Math.sin(slice.midAngle);\n const side = Math.abs(cos) > Math.abs(sin) ? (cos > 0 ? 'right' : 'left') : sin > 0 ? 'bottom' : 'top';\n return {\n datum: { label: slice.label, value: slice.text, color: slice.color },\n anchor: {\n x: box.left + ((50 + this.outerR * cos) / 100) * box.width,\n y: box.top + ((50 + this.outerR * sin) / 100) * box.height,\n },\n side,\n };\n });\n\n // Helpers\n\n /** SVG path for one donut slice using outer and inner arcs. */\n private arcPath(start: number, end: number): string {\n const cx = 50;\n const cy = 50;\n const ro = this.outerR;\n const ri = this.innerR();\n const sweep = end - start;\n if (sweep <= 0) return '';\n // Full-circle slice — two halves so the arc can render.\n if (sweep >= Math.PI * 2 - 1e-6) {\n const path = [\n `M ${cx + ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx - ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx + ro} ${cy}`,\n ];\n if (ri > 0) {\n path.push(`M ${cx + ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx - ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx + ri} ${cy}`);\n }\n return path.join(' ');\n }\n const largeArc = sweep > Math.PI ? 1 : 0;\n const sox = cx + ro * Math.cos(start);\n const soy = cy + ro * Math.sin(start);\n const eox = cx + ro * Math.cos(end);\n const eoy = cy + ro * Math.sin(end);\n if (ri === 0) {\n return `M ${cx} ${cy} L ${sox.toFixed(2)} ${soy.toFixed(2)} A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)} Z`;\n }\n const eix = cx + ri * Math.cos(end);\n const eiy = cy + ri * Math.sin(end);\n const six = cx + ri * Math.cos(start);\n const siy = cy + ri * Math.sin(start);\n return [\n `M ${sox.toFixed(2)} ${soy.toFixed(2)}`,\n `A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)}`,\n `L ${eix.toFixed(2)} ${eiy.toFixed(2)}`,\n `A ${ri} ${ri} 0 ${largeArc} 0 ${six.toFixed(2)} ${siy.toFixed(2)}`,\n 'Z',\n ].join(' ');\n }\n}\n\nexport type { WrDonutSegment } from './types';\n","@let shown = state();\n\n<!-- The legend, drawn before the drawing or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. The key\n is `aria-hidden`: the row's text is its name, and the dot carries no word of its own. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-donut-chart__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div class=\"wr-donut-chart__surface\" [style.width.px]=\"size()\">\n <!-- The name sits on the DRAWING, not on this wrapper. `img` is a\n children-presentational role, so with it out here WebKit dropped the whole\n subtree — including the centre value and label, which are real text and are\n the headline datum the legend does not carry. -->\n <svg #svg viewBox=\"0 0 100 100\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @if (track(); as ring) {\n <!-- The frame the chart keeps with no slice to draw: the ring itself, as a track. -->\n <path class=\"wr-donut-chart__track\" [attr.d]=\"ring\" />\n }\n <!-- Every slice is stroked in the SURFACE colour (`--wr-donut-chart-slice-gap-color`,\n from the stylesheet), so adjacent arcs are separated by a visible gap rather than\n by the boundary between two fills. Without it the only thing dividing two slices\n is the colour change itself, and for a reader who cannot separate hue two\n neighbours merge into one arc and the chart reads as having fewer slices than it\n has. A gap is a shape, and it survives greyscale, printing and a monochrome\n display. The stroke does not scale with the drawing, so the gap is the same\n pixels at any `size`; its width is the stylesheet's. -->\n @if (!shown) {\n @for (slice of slices(); track $index) {\n <!-- A hidden slice draws nothing at all; the index stays the slice's own, which is\n what the tooltip looks it up by. `data-wr-index` is what the chart's one hover\n listener reads, and `data-wr-series` the slice's legend row, which the hover\n dims by. -->\n @if (!slice.hidden) {\n <path\n class=\"wr-donut-chart__slice\"\n [attr.d]=\"slice.path\"\n [attr.fill]=\"slice.color\"\n [style.--wr-donut-chart-slice-color]=\"slice.color\"\n [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"$index\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n <!-- A sliver's wider hover target in a pie, filled with nothing: see `hits`, which is\n empty for the ring and with the tooltip off. Last, so it wins the pointer over the\n slices it reaches into; `fill`, so the unpainted stroke is not hit-tested and the\n edges stay where `hits` put them. It carries its slice's index and legend row, so\n the hover reads it as the slice. -->\n @for (hit of hits(); track hit.index) {\n <path\n class=\"wr-donut-chart__hit\"\n [attr.d]=\"hit.path\"\n [attr.data-wr-index]=\"hit.index\"\n [attr.data-wr-series]=\"hit.index\"\n fill=\"none\"\n pointer-events=\"fill\"\n />\n }\n }\n </svg>\n <!-- Never with `pie`: a pie has no hole to print in. -->\n @if (showCenter()) {\n <div class=\"wr-donut-chart__center\">\n @if (centerValue()) {\n <div class=\"wr-donut-chart__center-value\">{{ centerValue() }}</div>\n }\n @if (centerLabel()) {\n <div class=\"wr-donut-chart__center-label\">{{ centerLabel() }}</div>\n }\n </div>\n }\n @if (shown) {\n <!-- Empty, loading or failed: the message, over the track the chart keeps. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AA6BA,SAAS,OAAO,OAAa;CAC3B,OAAO,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI;AACvD;AAQA,MAAM,SAAS;AAOf,MAAM,gBAAgB,KAAK,KAAK;AA+ChC,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;EAGrF,cAAc;GAAE,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;GAAG,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;EAAC,CAAE;CAChG;CAMS,WAAW,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAO/C,YA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AA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-donut-chart.mjs","names":[],"sources":["../../../projects/lib/charts/donut-chart/donut-chart.ts","../../../projects/lib/charts/donut-chart/donut-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n viewChild,\n} from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartColor,\n wrChartNumberFormat,\n} from 'ngwr/charts/core';\nimport { useI18nText, wrReadI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrDonutSegment } from './types';\n\n/**\n * A segment's contribution to the ring. `Math.max(0, NaN)` is NaN, and the running total\n * carries it forward — so one non-finite datum used to take out its own arc AND every arc\n * after it, writing the literal text `NaN` into the path `d`.\n */\nfunction weight(value: number): number {\n return Number.isFinite(value) ? Math.max(0, value) : 0;\n}\n\n/**\n * How wide a slice's hover target is at least, along the outer edge, in CSS px. A\n * slice narrower than that — a share of a percent or two, which at the default 200px\n * is a few px of arc — is a target no pointer lands on, so it gets a wider one; see\n * `hits`.\n */\nconst HIT_PX = 12;\n\n/**\n * The widest that target may grow, in radians, whatever the chart's size: on a 48px\n * chart 12px of arc is a third of a quarter turn, which would take too much of the\n * slices beside it.\n */\nconst MAX_HIT_ANGLE = Math.PI / 12;\n\n/**\n * Donut chart, and with `pie` a pie chart. Optional center text via inputs.\n *\n * @example\n * ```html\n * <wr-donut-chart [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Free', value: 40 }\n * ]\" centerLabel=\"Disk\" centerValue=\"60%\" />\n *\n * <wr-donut-chart [segments]=\"segments\" pie />\n * ```\n *\n * **The look is the chart theme's.** A slice with no `color` takes the next colour of\n * the shared palette (`--wr-chart-1` to `--wr-chart-8`), and every two slices are parted\n * by a line in `--wr-chart-separator`, 1px at any `size`. Hovering a slice or a legend\n * row dims the others.\n *\n * **The legend** is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), placed by\n * `legendPosition` and left out for a single slice unless `showLegend` asks for it. With\n * `toggleableLegend` its rows show and hide their slices through `hiddenSegments`.\n *\n * **Empty, loading, error.** With nothing to draw the chart keeps its ring as a track\n * and says \"No data\"; `loading` and `error` put their own message there in place of the\n * slices.\n *\n * **What a screen reader gets.** The drawing is one named `role=\"img\"`, so the figures are\n * in text only in the legend, which a single slice and `showLegend=\"false\"` leave out.\n * `dataTable` renders every slice shown with its value and its share as a table a reader\n * can walk cell by cell.\n *\n * @see https://ngwr.dev/charts/donut-chart\n */\n@Component({\n selector: 'wr-donut-chart',\n templateUrl: './donut-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the drawing.\n class: 'wr-donut-chart wr-chart--legend',\n '[class.wr-donut-chart--pie]': 'pie()',\n '[class.wr-donut-chart--gapless]': 'gapless()',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState, WrChartTable],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-donut-chart__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-donut-chart' }],\n})\nexport class WrDonutChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/donut-chart');\n // One listener pair for the whole chart: a slice and a sliver's wider target each\n // carry `data-wr-index`, and `data-wr-series` for the dim.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /**\n * The slices, drawn clockwise from twelve o'clock. A segment with no `color`\n * takes the next colour of the chart palette, `--wr-chart-1` to `--wr-chart-8`.\n */\n readonly segments = input<readonly WrDonutSegment[]>([]);\n\n /**\n * Accessible name of the drawing, and the caption of the data table. The arcs carry no\n * text and the legend is optional, so with `showLegend: false` this and the centre text\n * are the whole of what a screen reader gets unless `dataTable` renders the figures.\n * Falls back to `donutChart.label`, or to `donutChart.pieLabel` with `pie`.\n */\n readonly ariaLabel = input<string | null>(null);\n\n private readonly donutLabel = useI18nText(this.ariaLabel, 'donutChart.label', 'Donut chart');\n private readonly pieLabel = useI18nText(this.ariaLabel, 'donutChart.pieLabel', 'Pie chart');\n\n protected readonly resolvedAriaLabel = computed(() => (this.pie() ? this.pieLabel() : this.donutLabel()));\n\n /** Diameter in CSS pixels. @default 200 */\n readonly size = input(200, { transform: (v: unknown): number => Math.max(48, coerceNumberProperty(v, 200)) });\n\n /**\n * Inner-ring thickness as a percent of radius (0–100). `0` fills to the centre, and\n * keeps the centre text; `pie` ignores it. @default 30\n */\n readonly thickness = input(30, {\n transform: (v: unknown): number => Math.min(100, Math.max(0, coerceNumberProperty(v, 30))),\n });\n\n /**\n * Draw a pie chart: every slice fills to the centre, whatever `thickness` says, and\n * the host takes the `wr-donut-chart--pie` modifier. A pie has no hole to print in, so\n * `centerValue` and `centerLabel` are not rendered. Everything else is the donut's: the\n * slices run clockwise from twelve o'clock, with the same gap between them, the legend\n * and its toggle, and the tooltip — which in a pie also opens from a wider, invisible\n * target over a slice too thin to point at (see `tooltip`). The drawing's name falls\n * back to `donutChart.pieLabel`. @default false\n */\n readonly pie = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draw the slices edge to edge, with no gap between them: each is stroked in its own\n * colour rather than the surface's, and the host takes the `wr-donut-chart--gapless`\n * modifier. The gap is a shape that tells two neighbours apart without hue, so with it\n * off only the colour change divides them; keep the legend or the tooltip on where the\n * chart has to read without hue. @default false\n */\n readonly gapless = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Show the legend. `'auto'` shows it when there is something to tell apart - two\n * segments or more - and leaves it out for a single one; `true` shows it for one\n * segment too. @default 'auto'\n */\n readonly showLegend = input<boolean | 'auto', unknown>('auto', {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the chart as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a slice from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the chart's data is in flight: the slices give way to the loading\n * message, over the ring drawn as a track. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the slices give way to the error message. `loading`\n * wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is nothing to draw. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /**\n * Make each legend row a toggle button that shows and hides its slice, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its slice is\n * shown, so the legend becomes one tab stop per slice. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the slices that are hidden. Positions rather than\n * labels, since two slices may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden slice is left out of the ring, and the slices still shown RE-NORMALISE:\n * they share the whole ring between them, each at its share of their own total. A\n * donut reads as the parts of the whole it draws, so leaving the hidden slice's arc\n * as a gap would show a whole that no longer adds up, and turning a slice off is how\n * a reader asks \"of the rest, how much is each?\". The tooltip cannot open on a slice\n * that is not drawn. The legend keeps the hidden slice's row, struck through and with\n * its own value, so it can be shown again; the row says \"hidden\" to a screen reader as\n * well, through `aria-pressed` on a toggle and a visually hidden word otherwise. The\n * centre text is printed as given, so a host that writes a total there works it out\n * from this list. A position past the end of `segments` is kept and ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /** Bold value text in the center. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerValue = input<string>('');\n\n /** Smaller label under the value. Not rendered with `pie`, which has no hole to hold it. */\n readonly centerLabel = input<string>('');\n\n /**\n * Whether the centre text renders: some is given, there is a hole to print it in, and\n * no state's message is there instead.\n */\n protected readonly showCenter = computed(\n () => !this.pie() && !this.state() && (!!this.centerValue() || !!this.centerLabel())\n );\n\n /**\n * Show a tooltip with the slice's label and value on hover. Pointer only — the legend\n * prints the same numbers, and with `showLegend` off `ariaLabel` is where to say\n * them. With `pie`, a slice too thin to land a pointer on, a sliver of a few degrees,\n * is hovered over a wider strip than it draws, through an invisible\n * `.wr-donut-chart__hit` over the pie: widened toward 12px of outer arc (15° on a\n * chart under about 92px) out of what the wider slices beside it can spare, each of\n * which keeps that much of its own. A sliver whose neighbours are slivers too, or\n * have little to spare, gets a narrower target or none, and is read in the legend.\n * The ring draws no such target.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes every value in the legend, the tooltip and the data table. `null` uses\n * `Intl.NumberFormat` in `LOCALE_ID`. The centre text is printed as given.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the chart's figures as a table that only assistive technology reaches: a row\n * per slice shown, headed by its label, with its value as the legend writes it and its\n * share of the ring, a percentage in `LOCALE_ID`. A slice hidden through\n * `hiddenSegments` has no row, and a slice that draws nothing has an empty share. The\n * table gives way with the slices while the chart is empty, `loading` or in `error`.\n *\n * The drawing is one named `role=\"img\"`, which hides everything inside it, and the\n * legend is left out for a single slice and with `showLegend` off, so without the table\n * the numbers may be nowhere a screen reader can walk. It is rendered beside the\n * drawing, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The headings of the data table's two columns. */\n private readonly valueName = wrReadI18nText('donutChart.value', 'Value');\n private readonly shareName = wrReadI18nText('donutChart.share', 'Share');\n\n /** Each value as the legend, the tooltip and the data table print it: exact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly locale = inject(LOCALE_ID);\n /** Shares from one percent up, to one decimal. */\n private readonly shares = wrChartNumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Shares below one percent, to two significant digits, so a sliver does not read `0%`. */\n private readonly smallShares = wrChartNumberFormat(this.locale, { style: 'percent', maximumSignificantDigits: 2 });\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n // Drawn in a 100×100 viewBox.\n private readonly outerR = 50;\n\n protected readonly innerR = computed(() => {\n const thickness = this.thickness();\n // A pie, or a thickness of 0: fill all the way to the center, not a zero-width ring.\n if (this.pie() || thickness === 0) return 0;\n return this.outerR * (1 - thickness / 100);\n });\n\n /** The sum the ring is divided by: the slices still shown (see `hiddenSegments`). */\n protected readonly total = computed(() => {\n const hidden = this.hidden();\n const sum = this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : weight(s.value)), 0);\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Resolved slices ready for the template — each carries its arc path.\n *\n * Angles are in the drawing's own frame, where 0 is three o'clock and a positive\n * angle turns clockwise, because y runs downwards. The ring starts a quarter turn\n * back from there, at twelve o'clock, which is where the input's JSDoc always said\n * it started and where a reader looks for the first slice; it used to start at three.\n */\n protected readonly slices = computed(() => {\n const total = this.total();\n const hidden = this.hidden();\n const origin = -Math.PI / 2;\n let cumulative = 0;\n return this.segments().map((s, i) => {\n const value = weight(s.value);\n const isHidden = hidden.has(i);\n // A hidden slice takes no turn of the ring, so the next slice starts where the last\n // shown one ended.\n const share = isHidden ? 0 : value;\n const startAngle = origin + (cumulative / total) * Math.PI * 2;\n cumulative += share;\n const endAngle = origin + (cumulative / total) * Math.PI * 2;\n return {\n label: s.label,\n value,\n // The segment's own figure, which a negative one keeps although it draws nothing:\n // the weight is the arc's, not the data's, and printing it named a \"0\" the data\n // never had. A value that is not a number has no figure to print.\n text: Number.isFinite(s.value) ? this.numbers.value(s.value) : '',\n color: s.color ?? wrChartColor(i),\n hidden: isHidden,\n path: isHidden ? '' : this.arcPath(startAngle, endAngle),\n percent: (share / total) * 100,\n startAngle,\n endAngle,\n midAngle: (startAngle + endAngle) / 2,\n };\n });\n });\n\n /**\n * In a pie, a wider hover target for every slice too thin to land a pointer on: an\n * invisible wedge over the slice, drawn above the pie, widened toward `HIT_PX` of outer\n * arc (`MAX_HIT_ANGLE` at most, which binds below about 92px) out of the wider slices\n * beside it.\n *\n * A wider slice gives away only what it can spare: it keeps `HIT_PX` of outer arc of its\n * own (the same `MAX_HIT_ANGLE` cap), however many slivers reach into it, so a slice\n * that was easy to point at stays easy, and its middle, where its own chip points, is\n * never covered. Two slivers reaching into one slice from either side split what it\n * spares. A sliver asks half its shortfall of each wider neighbour, or all of it of the\n * only one; what one side cannot give, the other gives if it can. Between two slivers\n * side by side the boundary stays their shared edge, so of a run of slivers only the two\n * at its ends grow, and the legend is where the rest are read — as it is for a sliver\n * whose neighbours have little to spare, which gets the narrower target they leave it.\n * A slice that draws nothing — a zero, or a hidden slice — has nothing to point at and\n * gets no target, and nor does one with no wider neighbour.\n *\n * Pie only, and only while the tooltip is on, which is all it is for: the ring draws\n * exactly what it drew before `pie` existed. The wedge is filled with nothing and\n * hit-tested through `pointer-events=\"fill\"`, which reads its interior whatever its\n * paint and never its unpainted stroke, so its edges are the ones computed here; it\n * paints in no theme and in no forced-colors palette.\n */\n protected readonly hits = computed(() => {\n if (!this.pie() || !this.tooltip() || this.state()) return [];\n const min = Math.min(MAX_HIT_ANGLE, HIT_PX / (this.size() / 2));\n const drawn = this.slices()\n .map((slice, index) => ({ index, start: slice.startAngle, end: slice.endAngle }))\n .filter(slice => slice.end - slice.start > 0);\n const count = drawn.length;\n if (count < 2) return [];\n const width = drawn.map(slice => slice.end - slice.start);\n const thin = width.map(w => w < min);\n const prev = (k: number): number => (k - 1 + count) % count;\n const next = (k: number): number => (k + 1) % count;\n // What each wider slice can give away and still keep `min` of its own.\n const spare = width.map((w, k) => (thin[k] ? 0 : w - min));\n // How far each sliver asks to reach on each side: into a wider neighbour only.\n const ask = width.map((w, k) => {\n if (!thin[k]) return { before: 0, after: 0 };\n const before = !thin[prev(k)];\n const after = !thin[next(k)];\n const share = (min - w) / (before && after ? 2 : 1);\n return { before: before ? share : 0, after: after ? share : 0 };\n });\n const reach = width.map(() => ({ before: 0, after: 0 }));\n // A wider slice is reached into by the sliver before it, past its own end, and by the\n // one after it, past its own start — the same sliver from both sides when there are\n // only two slices. Each gets what it asks while the two fit in the spare; past that,\n // at least half of it, and more where the other asks for less.\n width.forEach((_, j) => {\n if (thin[j]) return;\n const fromBefore = thin[prev(j)] ? ask[prev(j)].after : 0;\n const fromAfter = thin[next(j)] ? ask[next(j)].before : 0;\n const claims = (fromBefore > 0 ? 1 : 0) + (fromAfter > 0 ? 1 : 0);\n if (claims === 0) return;\n const fair = spare[j] / claims;\n const toBefore = Math.min(fromBefore, Math.max(fair, spare[j] - fromAfter));\n const toAfter = Math.min(fromAfter, Math.max(fair, spare[j] - fromBefore));\n if (toBefore > 0) reach[prev(j)].after = toBefore;\n if (toAfter > 0) reach[next(j)].before = toAfter;\n spare[j] = Math.max(0, spare[j] - toBefore - toAfter);\n });\n // What one side could not give, the other side gives out of what it has left.\n width.forEach((w, k) => {\n if (!thin[k]) return;\n let short = min - w - reach[k].before - reach[k].after;\n for (const [side, j] of [\n ['before', prev(k)],\n ['after', next(k)],\n ] as const) {\n if (short <= 0 || thin[j]) continue;\n const more = Math.min(short, spare[j]);\n reach[k][side] += more;\n spare[j] -= more;\n short -= more;\n }\n });\n return drawn.flatMap((slice, k) => {\n const { before, after } = reach[k];\n if (!thin[k] || before + after <= 0) return [];\n return [{ index: slice.index, path: this.arcPath(slice.start - before, slice.end + after) }];\n });\n });\n\n /**\n * The legend's rows: every slice, hidden ones included, each with its own figure — a\n * negative one included, which draws no slice — and no value at all for a segment whose\n * value is not a number.\n */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.slices().map(({ label, color, text }) => ({ label, color, value: text === '' ? null : text }))\n );\n\n /**\n * Whether the chart draws its legend: unless `legendPosition` is `none` or `showLegend`\n * is off, and under `showLegend=\"auto\"` only with two segments or more, since a single\n * slice has nothing to tell apart.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.legendItems().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the drawing, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the drawing rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /**\n * Whether the chart has nothing to draw: no segment, or none with a share to take. A\n * slice hidden from the legend still counts, so hiding every slice is not \"No data\".\n */\n private readonly empty = computed(() => this.segments().every(s => weight(s.value) === 0));\n\n /** What the chart shows in place of its slices, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: this.empty,\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, a row per slice shown,\n * and its value and its share of the ring as the columns.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.slices()\n .filter(slice => !slice.hidden)\n .map(slice => {\n const share = slice.percent / 100;\n return {\n header: slice.label,\n cells: [slice.text, share > 0 ? (share < 0.01 ? this.smallShares : this.shares).format(share) : ''],\n };\n }),\n },\n ],\n }));\n\n /**\n * The whole ring, or the whole disc of a pie, as one path: the frame the chart keeps\n * while it has no slice to draw - under a state, or with every slice hidden.\n */\n protected readonly track = computed(() =>\n this.state() || this.slices().every(slice => !slice.path) ? this.arcPath(0, Math.PI * 2) : null\n );\n\n /**\n * One tooltip for the whole chart, pointing at the hovered slice: at the middle of\n * its OUTER arc, on the side that part of the ring faces — above for a slice whose\n * middle is in the top quarter, below for the bottom one, beside it for the two at\n * three and nine o'clock. From there the chip sits clear of the ring, and the way\n * onto it runs straight out of the slice that opened it, over nothing else.\n *\n * Not the slice's `<path>` element: its box is most of the ring for any slice past\n * a quarter, so the chip would point at the middle of the chart. And not the middle\n * of the band: a chip there lies over the ring, under a pointer resting on it —\n * measured in Chromium, the inner half of a lower slice landed on its own chip. A\n * tiny slice keeps its own mid-angle, so the arrow says which sliver it is.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const slice = this.slices()[index];\n const svg = this.svg()?.nativeElement;\n // No slice is drawn under a state, so a chip open on one lets go.\n if (!slice?.path || !svg || this.state()) return null;\n const box = svg.getBoundingClientRect();\n // The drawing's y runs downwards, so a positive sine is the lower half.\n const cos = Math.cos(slice.midAngle);\n const sin = Math.sin(slice.midAngle);\n const side = Math.abs(cos) > Math.abs(sin) ? (cos > 0 ? 'right' : 'left') : sin > 0 ? 'bottom' : 'top';\n return {\n datum: { label: slice.label, value: slice.text, color: slice.color },\n anchor: {\n x: box.left + ((50 + this.outerR * cos) / 100) * box.width,\n y: box.top + ((50 + this.outerR * sin) / 100) * box.height,\n },\n side,\n };\n });\n\n // Helpers\n\n /** SVG path for one donut slice using outer and inner arcs. */\n private arcPath(start: number, end: number): string {\n const cx = 50;\n const cy = 50;\n const ro = this.outerR;\n const ri = this.innerR();\n const sweep = end - start;\n if (sweep <= 0) return '';\n // Full-circle slice — two halves so the arc can render.\n if (sweep >= Math.PI * 2 - 1e-6) {\n const path = [\n `M ${cx + ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx - ro} ${cy}`,\n `A ${ro} ${ro} 0 1 1 ${cx + ro} ${cy}`,\n ];\n if (ri > 0) {\n path.push(`M ${cx + ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx - ri} ${cy}`, `A ${ri} ${ri} 0 1 0 ${cx + ri} ${cy}`);\n }\n return path.join(' ');\n }\n const largeArc = sweep > Math.PI ? 1 : 0;\n const sox = cx + ro * Math.cos(start);\n const soy = cy + ro * Math.sin(start);\n const eox = cx + ro * Math.cos(end);\n const eoy = cy + ro * Math.sin(end);\n if (ri === 0) {\n return `M ${cx} ${cy} L ${sox.toFixed(2)} ${soy.toFixed(2)} A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)} Z`;\n }\n const eix = cx + ri * Math.cos(end);\n const eiy = cy + ri * Math.sin(end);\n const six = cx + ri * Math.cos(start);\n const siy = cy + ri * Math.sin(start);\n return [\n `M ${sox.toFixed(2)} ${soy.toFixed(2)}`,\n `A ${ro} ${ro} 0 ${largeArc} 1 ${eox.toFixed(2)} ${eoy.toFixed(2)}`,\n `L ${eix.toFixed(2)} ${eiy.toFixed(2)}`,\n `A ${ri} ${ri} 0 ${largeArc} 0 ${six.toFixed(2)} ${siy.toFixed(2)}`,\n 'Z',\n ].join(' ');\n }\n}\n\nexport type { WrDonutSegment } from './types';\n","@let shown = state();\n\n<!-- The legend, drawn before the drawing or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. The key\n is `aria-hidden`: the row's text is its name, and the dot carries no word of its own. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-donut-chart__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div class=\"wr-donut-chart__surface\" [style.width.px]=\"size()\">\n <!-- The name sits on the DRAWING, not on this wrapper. `img` is a\n children-presentational role, so with it out here WebKit dropped the whole\n subtree — including the centre value and label, which are real text and are\n the headline datum the legend does not carry. -->\n <svg #svg viewBox=\"0 0 100 100\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\">\n @if (track(); as ring) {\n <!-- The frame the chart keeps with no slice to draw: the ring itself, as a track. -->\n <path class=\"wr-donut-chart__track\" [attr.d]=\"ring\" />\n }\n <!-- Every slice is stroked in the SURFACE colour (`--wr-donut-chart-slice-gap-color`,\n from the stylesheet), so adjacent arcs are separated by a visible gap rather than\n by the boundary between two fills. Without it the only thing dividing two slices\n is the colour change itself, and for a reader who cannot separate hue two\n neighbours merge into one arc and the chart reads as having fewer slices than it\n has. A gap is a shape, and it survives greyscale, printing and a monochrome\n display. The stroke does not scale with the drawing, so the gap is the same\n pixels at any `size`; its width is the stylesheet's. -->\n @if (!shown) {\n @for (slice of slices(); track $index) {\n <!-- A hidden slice draws nothing at all; the index stays the slice's own, which is\n what the tooltip looks it up by. `data-wr-index` is what the chart's one hover\n listener reads, and `data-wr-series` the slice's legend row, which the hover\n dims by. -->\n @if (!slice.hidden) {\n <path\n class=\"wr-donut-chart__slice\"\n [attr.d]=\"slice.path\"\n [attr.fill]=\"slice.color\"\n [style.--wr-donut-chart-slice-color]=\"slice.color\"\n [attr.data-wr-index]=\"$index\"\n [attr.data-wr-series]=\"$index\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n <!-- A sliver's wider hover target in a pie, filled with nothing: see `hits`, which is\n empty for the ring and with the tooltip off. Last, so it wins the pointer over the\n slices it reaches into; `fill`, so the unpainted stroke is not hit-tested and the\n edges stay where `hits` put them. It carries its slice's index and legend row, so\n the hover reads it as the slice. -->\n @for (hit of hits(); track hit.index) {\n <path\n class=\"wr-donut-chart__hit\"\n [attr.d]=\"hit.path\"\n [attr.data-wr-index]=\"hit.index\"\n [attr.data-wr-series]=\"hit.index\"\n fill=\"none\"\n pointer-events=\"fill\"\n />\n }\n }\n </svg>\n <!-- Never with `pie`: a pie has no hole to print in. -->\n @if (showCenter()) {\n <div class=\"wr-donut-chart__center\">\n @if (centerValue()) {\n <div class=\"wr-donut-chart__center-value\">{{ centerValue() }}</div>\n }\n @if (centerLabel()) {\n <div class=\"wr-donut-chart__center-label\">{{ centerLabel() }}</div>\n }\n </div>\n }\n @if (shown) {\n <!-- Empty, loading or failed: the message, over the track the chart keeps. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the drawing rather than inside its `img`,\n which would make them presentational. Clipped to nothing by its own stylesheet, so\n it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgDA,SAAS,OAAO,OAAa;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AA;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,aAAA,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,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
@@ -6,6 +6,17 @@ import { WrChartLegendHarness } from "ngwr/charts/chart-legend/testing";
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
8
8
|
*/
|
|
9
|
+
var TableRowHarness = class extends ComponentHarness {
|
|
10
|
+
static hostSelector = ".wr-chart-table tbody tr";
|
|
11
|
+
async read() {
|
|
12
|
+
const header = await this.locatorFor("th[scope=\"row\"]")();
|
|
13
|
+
const cells = await this.locatorForAll("td")();
|
|
14
|
+
return {
|
|
15
|
+
header: await header.text(),
|
|
16
|
+
cells: await Promise.all(cells.map((cell) => cell.text()))
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
};
|
|
9
20
|
const SLICE_SIZE = /(?:^|;)\s*--wr-meter-group-slice-size\s*:\s*([\d.]+)/;
|
|
10
21
|
var WrMeterGroupHarness = class WrMeterGroupHarness extends ComponentHarness {
|
|
11
22
|
static hostSelector = "wr-meter-group";
|
|
@@ -65,6 +76,22 @@ var WrMeterGroupHarness = class WrMeterGroupHarness extends ComponentHarness {
|
|
|
65
76
|
const values = await this.locatorForAll(".wr-meter-group__legend-value")();
|
|
66
77
|
return Promise.all(values.map((value) => value.text()));
|
|
67
78
|
}
|
|
79
|
+
async hasDataTable() {
|
|
80
|
+
return await this.locatorForOptional(".wr-chart-table")() !== null;
|
|
81
|
+
}
|
|
82
|
+
async getTableColumns() {
|
|
83
|
+
await this.assertDataTable("getTableColumns");
|
|
84
|
+
const headings = await this.locatorForAll(".wr-chart-table thead th[scope=\"col\"]")();
|
|
85
|
+
return Promise.all(headings.map((heading) => heading.text()));
|
|
86
|
+
}
|
|
87
|
+
async getTableRows() {
|
|
88
|
+
await this.assertDataTable("getTableRows");
|
|
89
|
+
const rows = await this.locatorForAll(TableRowHarness)();
|
|
90
|
+
return Promise.all(rows.map((row) => row.read()));
|
|
91
|
+
}
|
|
92
|
+
async assertDataTable(method) {
|
|
93
|
+
if (!await this.hasDataTable()) throw new Error(`WrMeterGroupHarness.${method}(): the meter renders no data table: \`dataTable\` is off, or there is nothing to tabulate. Ask hasDataTable() first.`);
|
|
94
|
+
}
|
|
68
95
|
};
|
|
69
96
|
export { WrMeterGroupHarness };
|
|
70
97
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-meter-group-testing.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/testing/wr-meter-group-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport { WrChartLegendHarness } from 'ngwr/charts/chart-legend/testing';\n\nimport type { WrMeterGroupHarnessFilters, WrMeterGroupSlice } from './types';\n\n/** The share of the bar the component writes onto a band, 0 to 1, out of its inline `style`. */\nconst SLICE_SIZE = /(?:^|;)\\s*--wr-meter-group-slice-size\\s*:\\s*([\\d.]+)/;\n\n/**\n * Test harness for `<wr-meter-group>` — one bar divided into labelled bands.\n *\n * **The bar is a single `progressbar`, and its value is the TOTAL.** The bands\n * themselves announce nothing: they carry a hover tooltip (or, with `tooltip` off, a\n * `title`) for a mouse and their share as an inline width, and the legend is where\n * their labels and values are readable. So a\n * spec that wants \"how much of each\" reads {@link getSlices} for the shares or\n * {@link getLegendLabels} / {@link getLegendValues} for what is printed, and one that\n * wants \"how full\" reads {@link getValue}.\n *\n * **A band's share is read off the `style` ATTRIBUTE, not through `getCssValue()`**,\n * and the difference is not cosmetic: `getCssValue()` is `getComputedStyle()`, and\n * `width` resolves to the USED value — so the declared `30%` comes straight back in\n * jsdom and arrives as `180px` on a 600px bar in a real browser, and the same harness\n * answered 30 here and 180 under a browser runner with nothing to say which one you\n * got.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrMeterGroupHarness extends ComponentHarness {\n static hostSelector = 'wr-meter-group';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrMeterGroupHarnessFilters = {}): HarnessPredicate<WrMeterGroupHarness> {\n return new HarnessPredicate(WrMeterGroupHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('sliceLabel', options.sliceLabel, async (harness, label) => {\n for (const printed of await harness.getLegendLabels()) {\n if (await HarnessPredicate.stringMatches(printed, label)) return true;\n }\n return false;\n });\n }\n\n private readonly bar = this.locatorFor('.wr-meter-group__bar');\n\n /** The role the bar announces — `progressbar`, for the total. */\n async getRole(): Promise<string | null> {\n return (await this.bar()).getAttribute('role');\n }\n\n /** The bar's accessible name. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.bar()).getAttribute('aria-label');\n }\n\n /** The total the bands add up to, from `aria-valuenow`. */\n async getValue(): Promise<number> {\n return this.numberAttribute('aria-valuenow', 'getValue');\n }\n\n /** The full capacity, from `aria-valuemax` — given, or the sum of the bands. */\n async getMax(): Promise<number> {\n return this.numberAttribute('aria-valuemax', 'getMax');\n }\n\n /**\n * A finite number off one of the bar's attributes, or a sentence saying which one it\n * lacks. `Number(null)` is `0`, so a lost binding read as an empty bar.\n */\n private async numberAttribute(name: string, method: string): Promise<number> {\n const raw = await (await this.bar()).getAttribute(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new Error(\n `WrMeterGroupHarness.${method}(): the bar carries ${name}=\"${raw ?? ''}\", which the component writes as a ` +\n 'finite number on every meter group.'\n );\n }\n return value;\n }\n\n /** The bands, in order, with the share of the bar each takes. A hidden segment draws no band. */\n async getSlices(): Promise<WrMeterGroupSlice[]> {\n const slices = await this.locatorForAll('.wr-meter-group__slice')();\n\n return Promise.all(\n slices.map(async slice => {\n // `data-label`, which the band carries whatever `tooltip` says. The `title`\n // this used to read is written only while the tooltip is off, so reading it\n // would answer `null` for every band of a default meter.\n const label = await slice.getAttribute('data-label');\n return { label, percent: WrMeterGroupHarness.percentOf(label, await slice.getAttribute('style')) };\n })\n );\n }\n\n /** Parse one band's declared share. See the class note on why this is not `getCssValue()`. */\n private static percentOf(label: string | null, style: string | null): number {\n const match = SLICE_SIZE.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrMeterGroupHarness.getSlices(): the band ${label === null ? '(untitled)' : `\"${label}\"`} carries no ` +\n `inline share of the bar (style: \"${style ?? ''}\"). The component writes one for every band, since the ` +\n 'total always falls back to 1 — so its absence is the bug, and reporting 0 would read as an empty band.'\n );\n }\n return Math.round(Number.parseFloat(match[1]) * 1e5) / 1e3;\n }\n\n /** Whether the legend is rendered (`showLegend`, and at least one band). */\n async hasLegend(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-meter-group__legend')()) !== null;\n }\n\n /**\n * The legend as a {@link WrChartLegendHarness}: each row's key and its hidden state\n * and, with `toggleableLegend`, the toggles that show and hide a segment.\n *\n * Throws when the group draws no legend (`showLegend` off, or no segments) rather\n * than answering with an empty one: {@link hasLegend} is the question for that.\n */\n async getLegendHarness(): Promise<WrChartLegendHarness> {\n const legend = await this.locatorForOptional(WrChartLegendHarness)();\n if (!legend) {\n throw new Error(\n 'WrMeterGroupHarness.getLegendHarness(): the group draws no legend — `showLegend` is off or there are no ' +\n 'segments. Ask hasLegend() first.'\n );\n }\n return legend;\n }\n\n /** The legend's labels, in order — hidden segments included, since their rows stay. */\n async getLegendLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-meter-group__legend-label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /** The legend's values, in order — empty when `showValues` is off. */\n async getLegendValues(): Promise<string[]> {\n const values = await this.locatorForAll('.wr-meter-group__legend-value')();\n return Promise.all(values.map(value => value.text()));\n }\n}\n"],"mappings":";;;;;;;;AAcA,MAAM,aAAa;AAsBnB,IAAa,sBAAb,MAAa,4BAA4B,iBAAgB;CACvD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAsC,CAAA,GAAE;EAClD,OAAO,IAAI,iBAAiB,qBAAqB,OAAO,CAAC,CACtD,UAAU,aAAa,QAAQ,YAAY,SAAS,UACnD,iBAAiB,cAAc,QAAQ,kBAAiB,GAAI,KAAK,CAAC,CACnE,CACA,UAAU,cAAc,QAAQ,YAAY,OAAO,SAAS,UAAS;GACpE,KAAK,MAAM,WAAW,MAAM,QAAQ,gBAAe,GACjD,IAAI,MAAM,iBAAiB,cAAc,SAAS,KAAK,GAAG,OAAO;GAEnE,OAAO;EACT,CAAC;CACL;CAEiB,MAAM,KAAK,WAAW,sBAAsB;CAG7D,MAAM,UAAO;EACX,QAAQ,MAAM,KAAK,IAAG,EAAA,CAAI,aAAa,MAAM;CAC/C;CAGA,MAAM,oBAAiB;EACrB,QAAQ,MAAM,KAAK,IAAG,EAAA,CAAI,aAAa,YAAY;CACrD;CAGA,MAAM,WAAQ;EACZ,OAAO,KAAK,gBAAgB,iBAAiB,UAAU;CACzD;CAGA,MAAM,SAAM;EACV,OAAO,KAAK,gBAAgB,iBAAiB,Q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kBAAe;EACnB,MAAM,SAAS,MAAM,KAAK,cAAc,+BAA+B,CAAC,CAAA;EACxE,OAAO,QAAQ,IAAI,OAAO,KAAI,UAAS,MAAM,KAAI,CAAE,CAAC;CACtD"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-meter-group-testing.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/testing/wr-meter-group-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport { WrChartLegendHarness } from 'ngwr/charts/chart-legend/testing';\n\nimport type { WrMeterGroupHarnessFilters, WrMeterGroupSlice, WrMeterGroupTableRow } from './types';\n\n/**\n * One body row of the meter's data table, so its header and cells are read off the row\n * they sit in rather than matched up by position across the whole table.\n */\nclass TableRowHarness extends ComponentHarness {\n static hostSelector = '.wr-chart-table tbody tr';\n\n async read(): Promise<WrMeterGroupTableRow> {\n const header = await this.locatorFor('th[scope=\"row\"]')();\n const cells = await this.locatorForAll('td')();\n return { header: await header.text(), cells: await Promise.all(cells.map(cell => cell.text())) };\n }\n}\n\n/** The share of the bar the component writes onto a band, 0 to 1, out of its inline `style`. */\nconst SLICE_SIZE = /(?:^|;)\\s*--wr-meter-group-slice-size\\s*:\\s*([\\d.]+)/;\n\n/**\n * Test harness for `<wr-meter-group>` — one bar divided into labelled bands.\n *\n * **The bar is a single `progressbar`, and its value is the TOTAL.** The bands\n * themselves announce nothing: they carry a hover tooltip (or, with `tooltip` off, a\n * `title`) for a mouse and their share as an inline width, and the legend is where\n * their labels and values are readable. So a\n * spec that wants \"how much of each\" reads {@link getSlices} for the shares or\n * {@link getLegendLabels} / {@link getLegendValues} for what is printed, and one that\n * wants \"how full\" reads {@link getValue}.\n *\n * **A band's share is read off the `style` ATTRIBUTE, not through `getCssValue()`**,\n * and the difference is not cosmetic: `getCssValue()` is `getComputedStyle()`, and\n * `width` resolves to the USED value — so the declared `30%` comes straight back in\n * jsdom and arrives as `180px` on a 600px bar in a real browser, and the same harness\n * answered 30 here and 180 under a browser runner with nothing to say which one you\n * got.\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrMeterGroupHarness extends ComponentHarness {\n static hostSelector = 'wr-meter-group';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrMeterGroupHarnessFilters = {}): HarnessPredicate<WrMeterGroupHarness> {\n return new HarnessPredicate(WrMeterGroupHarness, options)\n .addOption('ariaLabel', options.ariaLabel, (harness, label) =>\n HarnessPredicate.stringMatches(harness.getAccessibleName(), label)\n )\n .addOption('sliceLabel', options.sliceLabel, async (harness, label) => {\n for (const printed of await harness.getLegendLabels()) {\n if (await HarnessPredicate.stringMatches(printed, label)) return true;\n }\n return false;\n });\n }\n\n private readonly bar = this.locatorFor('.wr-meter-group__bar');\n\n /** The role the bar announces — `progressbar`, for the total. */\n async getRole(): Promise<string | null> {\n return (await this.bar()).getAttribute('role');\n }\n\n /** The bar's accessible name. */\n async getAccessibleName(): Promise<string | null> {\n return (await this.bar()).getAttribute('aria-label');\n }\n\n /** The total the bands add up to, from `aria-valuenow`. */\n async getValue(): Promise<number> {\n return this.numberAttribute('aria-valuenow', 'getValue');\n }\n\n /** The full capacity, from `aria-valuemax` — given, or the sum of the bands. */\n async getMax(): Promise<number> {\n return this.numberAttribute('aria-valuemax', 'getMax');\n }\n\n /**\n * A finite number off one of the bar's attributes, or a sentence saying which one it\n * lacks. `Number(null)` is `0`, so a lost binding read as an empty bar.\n */\n private async numberAttribute(name: string, method: string): Promise<number> {\n const raw = await (await this.bar()).getAttribute(name);\n const value = raw === null ? Number.NaN : Number.parseFloat(raw);\n if (!Number.isFinite(value)) {\n throw new Error(\n `WrMeterGroupHarness.${method}(): the bar carries ${name}=\"${raw ?? ''}\", which the component writes as a ` +\n 'finite number on every meter group.'\n );\n }\n return value;\n }\n\n /** The bands, in order, with the share of the bar each takes. A hidden segment draws no band. */\n async getSlices(): Promise<WrMeterGroupSlice[]> {\n const slices = await this.locatorForAll('.wr-meter-group__slice')();\n\n return Promise.all(\n slices.map(async slice => {\n // `data-label`, which the band carries whatever `tooltip` says. The `title`\n // this used to read is written only while the tooltip is off, so reading it\n // would answer `null` for every band of a default meter.\n const label = await slice.getAttribute('data-label');\n return { label, percent: WrMeterGroupHarness.percentOf(label, await slice.getAttribute('style')) };\n })\n );\n }\n\n /** Parse one band's declared share. See the class note on why this is not `getCssValue()`. */\n private static percentOf(label: string | null, style: string | null): number {\n const match = SLICE_SIZE.exec(style ?? '');\n if (!match) {\n throw new Error(\n `WrMeterGroupHarness.getSlices(): the band ${label === null ? '(untitled)' : `\"${label}\"`} carries no ` +\n `inline share of the bar (style: \"${style ?? ''}\"). The component writes one for every band, since the ` +\n 'total always falls back to 1 — so its absence is the bug, and reporting 0 would read as an empty band.'\n );\n }\n return Math.round(Number.parseFloat(match[1]) * 1e5) / 1e3;\n }\n\n /** Whether the legend is rendered (`showLegend`, and at least one band). */\n async hasLegend(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-meter-group__legend')()) !== null;\n }\n\n /**\n * The legend as a {@link WrChartLegendHarness}: each row's key and its hidden state\n * and, with `toggleableLegend`, the toggles that show and hide a segment.\n *\n * Throws when the group draws no legend (`showLegend` off, or no segments) rather\n * than answering with an empty one: {@link hasLegend} is the question for that.\n */\n async getLegendHarness(): Promise<WrChartLegendHarness> {\n const legend = await this.locatorForOptional(WrChartLegendHarness)();\n if (!legend) {\n throw new Error(\n 'WrMeterGroupHarness.getLegendHarness(): the group draws no legend — `showLegend` is off or there are no ' +\n 'segments. Ask hasLegend() first.'\n );\n }\n return legend;\n }\n\n /** The legend's labels, in order — hidden segments included, since their rows stay. */\n async getLegendLabels(): Promise<string[]> {\n const labels = await this.locatorForAll('.wr-meter-group__legend-label')();\n return Promise.all(labels.map(label => label.text()));\n }\n\n /** The legend's values, in order — empty when `showValues` is off. */\n async getLegendValues(): Promise<string[]> {\n const values = await this.locatorForAll('.wr-meter-group__legend-value')();\n return Promise.all(values.map(value => value.text()));\n }\n\n /** Whether the hidden data table is rendered (`dataTable`, while the meter draws its segments). */\n async hasDataTable(): Promise<boolean> {\n return (await this.locatorForOptional('.wr-chart-table')()) !== null;\n }\n\n /**\n * The data table's column headings: the value's name and the share's.\n *\n * Throws when the meter renders no table (`dataTable` off, or a state in the legend's\n * place) rather than answering with no columns.\n */\n async getTableColumns(): Promise<string[]> {\n await this.assertDataTable('getTableColumns');\n const headings = await this.locatorForAll('.wr-chart-table thead th[scope=\"col\"]')();\n return Promise.all(headings.map(heading => heading.text()));\n }\n\n /**\n * The data table's rows, one per segment shown, in the data's own order: its label, its\n * value and its share of the total, as a screen reader walks them. A segment hidden\n * through `hiddenSegments` has no row, and one that draws nothing an empty share.\n *\n * Throws when the meter renders no table, for the reason {@link getTableColumns} gives.\n */\n async getTableRows(): Promise<WrMeterGroupTableRow[]> {\n await this.assertDataTable('getTableRows');\n const rows = await this.locatorForAll(TableRowHarness)();\n return Promise.all(rows.map(row => row.read()));\n }\n\n private async assertDataTable(method: string): Promise<void> {\n if (!(await this.hasDataTable())) {\n throw new Error(\n `WrMeterGroupHarness.${method}(): the meter renders no data table: \\`dataTable\\` is off, or there ` +\n 'is nothing to tabulate. Ask hasDataTable() first.'\n );\n }\n }\n}\n"],"mappings":";;;;;;;;AAiBA,IAAM,kBAAN,cAA8B,iBAAgB;CAC5C,OAAO,eAAe;CAEtB,MAAM,OAAI;EACR,MAAM,SAAS,MAAM,KAAK,WAAW,mBAAiB,CAAC,CAAA;EACvD,MAAM,QAAQ,MAAM,KAAK,cAAc,IAAI,CAAC,CAAA;EAC5C,OAAO;GAAE,QAAQ,MAAM,OAAO,KAAI;GAAI,OAAO,MAAM,QAAQ,IAAI,MAAM,KAAI,SAAQ,KAAK,KAAI,CAAE,CAAC;EAAC;CAChG;;AAIF,MAAM,aAAa;AAsBnB,IAAa,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CAAA;EACtD,OAAO,QAAQ,IAAI,KAAK,KAAI,QAAO,IAAI,KAAI,CAAE,CAAC;CAChD;CAEQ,MAAM,gBAAgB,QAAc;EAC1C,IAAI,CAAE,MAAM,KAAK,aAAY,GAC3B,MAAM,IAAI,MACR,uBAAuB,OAAM,sHACwB;CAG3D"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, ViewEncapsulation, computed, input, model, viewChild, viewChildren } from "@angular/core";
|
|
2
|
+
import { Component, LOCALE_ID, ViewEncapsulation, computed, inject, input, model, viewChild, viewChildren } from "@angular/core";
|
|
3
3
|
import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
|
|
4
4
|
import { NgTemplateOutlet } from "@angular/common";
|
|
5
5
|
import { wrCheckStyles } from "ngwr/utils";
|
|
6
|
-
import { useI18nText } from "ngwr/i18n";
|
|
6
|
+
import { useI18nText, wrReadI18nText } from "ngwr/i18n";
|
|
7
7
|
import { WR_CHART_LEGEND_BLOCK, WrChartLegend } from "ngwr/charts/chart-legend";
|
|
8
|
-
import { WrChartState, useChartHover, useChartNumbers, useChartState, wrChartColor, wrChartRound } from "ngwr/charts/core";
|
|
8
|
+
import { WrChartState, WrChartTable, useChartHover, useChartNumbers, useChartState, wrChartColor, wrChartNumberFormat, wrChartRound } from "ngwr/charts/core";
|
|
9
9
|
import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
|
|
10
10
|
/**
|
|
11
11
|
* @license
|
|
@@ -58,7 +58,22 @@ var WrMeterGroup = class WrMeterGroup {
|
|
|
58
58
|
transform: wrCoerceChartTooltip
|
|
59
59
|
});
|
|
60
60
|
valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
|
|
61
|
+
dataTable = input(false, {
|
|
62
|
+
...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
|
|
63
|
+
transform: coerceBooleanProperty
|
|
64
|
+
});
|
|
65
|
+
valueName = wrReadI18nText("meterGroup.value", "Value");
|
|
66
|
+
shareName = wrReadI18nText("meterGroup.share", "Share");
|
|
61
67
|
numbers = useChartNumbers(this.valueFormat);
|
|
68
|
+
locale = inject(LOCALE_ID);
|
|
69
|
+
shares = wrChartNumberFormat(this.locale, {
|
|
70
|
+
style: "percent",
|
|
71
|
+
maximumFractionDigits: 1
|
|
72
|
+
});
|
|
73
|
+
smallShares = wrChartNumberFormat(this.locale, {
|
|
74
|
+
style: "percent",
|
|
75
|
+
maximumSignificantDigits: 2
|
|
76
|
+
});
|
|
62
77
|
barEl = viewChild.required("bar", ...ngDevMode ? [{ debugName: "barEl" }] : /* istanbul ignore next */ []);
|
|
63
78
|
sliceEls = viewChildren("slice", ...ngDevMode ? [{ debugName: "sliceEls" }] : /* istanbul ignore next */ []);
|
|
64
79
|
static amount(raw) {
|
|
@@ -113,6 +128,17 @@ var WrMeterGroup = class WrMeterGroup {
|
|
|
113
128
|
value: values ? text : null
|
|
114
129
|
}));
|
|
115
130
|
}, ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
|
|
131
|
+
tableData = computed(() => ({
|
|
132
|
+
caption: this.resolvedAriaLabel(),
|
|
133
|
+
columns: [this.valueName(), this.shareName()],
|
|
134
|
+
groups: [{ rows: this.slices().filter((slice) => !slice.hidden).map((slice) => {
|
|
135
|
+
const share = slice.percent / 100;
|
|
136
|
+
return {
|
|
137
|
+
header: slice.label,
|
|
138
|
+
cells: [slice.text, share > 0 ? (share < .01 ? this.smallShares : this.shares).format(share) : ""]
|
|
139
|
+
};
|
|
140
|
+
}) }]
|
|
141
|
+
}), ...ngDevMode ? [{ debugName: "tableData" }] : /* istanbul ignore next */ []);
|
|
116
142
|
tip = useChartTooltip(this.tooltip, (index) => {
|
|
117
143
|
const at = this.bands().findIndex((band) => band.index === index);
|
|
118
144
|
const band = this.bands()[at];
|
|
@@ -278,6 +304,13 @@ var WrMeterGroup = class WrMeterGroup {
|
|
|
278
304
|
isSignal: true,
|
|
279
305
|
isRequired: false,
|
|
280
306
|
transformFunction: null
|
|
307
|
+
},
|
|
308
|
+
dataTable: {
|
|
309
|
+
classPropertyName: "dataTable",
|
|
310
|
+
publicName: "dataTable",
|
|
311
|
+
isSignal: true,
|
|
312
|
+
isRequired: false,
|
|
313
|
+
transformFunction: null
|
|
281
314
|
}
|
|
282
315
|
},
|
|
283
316
|
outputs: { hiddenSegments: "hiddenSegmentsChange" },
|
|
@@ -298,7 +331,7 @@ var WrMeterGroup = class WrMeterGroup {
|
|
|
298
331
|
isSignal: true
|
|
299
332
|
}],
|
|
300
333
|
ngImport: i0,
|
|
301
|
-
template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n",
|
|
334
|
+
template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
|
|
302
335
|
dependencies: [
|
|
303
336
|
{
|
|
304
337
|
kind: "directive",
|
|
@@ -329,6 +362,12 @@ var WrMeterGroup = class WrMeterGroup {
|
|
|
329
362
|
type: WrChartState,
|
|
330
363
|
selector: "wr-chart-state",
|
|
331
364
|
inputs: ["kind", "label"]
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
kind: "component",
|
|
368
|
+
type: WrChartTable,
|
|
369
|
+
selector: "wr-chart-table",
|
|
370
|
+
inputs: ["data"]
|
|
332
371
|
}
|
|
333
372
|
],
|
|
334
373
|
viewProviders: [{
|
|
@@ -355,13 +394,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
355
394
|
imports: [
|
|
356
395
|
NgTemplateOutlet,
|
|
357
396
|
WrChartLegend,
|
|
358
|
-
WrChartState
|
|
397
|
+
WrChartState,
|
|
398
|
+
WrChartTable
|
|
359
399
|
],
|
|
360
400
|
viewProviders: [{
|
|
361
401
|
provide: WR_CHART_LEGEND_BLOCK,
|
|
362
402
|
useValue: "wr-meter-group"
|
|
363
403
|
}],
|
|
364
|
-
template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n"
|
|
404
|
+
template: "@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
|
|
365
405
|
}]
|
|
366
406
|
}],
|
|
367
407
|
ctorParameters: () => [],
|
|
@@ -489,6 +529,14 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
489
529
|
required: false
|
|
490
530
|
}]
|
|
491
531
|
}],
|
|
532
|
+
dataTable: [{
|
|
533
|
+
type: i0.Input,
|
|
534
|
+
args: [{
|
|
535
|
+
isSignal: true,
|
|
536
|
+
alias: "dataTable",
|
|
537
|
+
required: false
|
|
538
|
+
}]
|
|
539
|
+
}],
|
|
492
540
|
barEl: [{
|
|
493
541
|
type: i0.ViewChild,
|
|
494
542
|
args: ["bar", { isSignal: true }]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-charts-meter-group.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/meter-group.ts","../../../projects/lib/charts/meter-group/meter-group.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n input,\n model,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartColor,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMeterSegment } from './types';\n\n/**\n * Stacked-segment progress bar. Visualises a breakdown of a total —\n * disk usage, budget, vote share, etc. Each segment contributes a slice\n * proportional to its `value` relative to the sum of the segments shown (or the\n * explicit `max`).\n *\n * @example\n * ```html\n * <wr-meter-group\n * [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Reserved', value: 25, color: 'var(--wr-color-warning)' }\n * ]\"\n * [max]=\"100\"\n * />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their segments through `hiddenSegments`.\n * `legendPosition` puts it under the bar, over it or beside it.\n *\n * **On the chart theme.** A segment with no `color` takes the next colour of the chart\n * palette (`--wr-chart-1` to `-8`), solid, and a 1px line in the surface parts two\n * segments. Hovering a segment or its legend row dims the others. With no segment the\n * bar is an empty track with \"No data\" under it; `loading` and `error` put their own\n * message there.\n *\n * @see https://ngwr.dev/charts/meter-group\n */\n@Component({\n selector: 'wr-meter-group',\n templateUrl: './meter-group.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the bar.\n class: 'wr-meter-group wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-meter-group__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-meter-group' }],\n})\nexport class WrMeterGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/meter-group');\n // One pair of listeners on the host, not two on every band: the band under the pointer\n // is the nearest element up from it carrying `data-wr-index`, its segment's position.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /** Accessible name — the role needs one. Falls back to `meterGroup.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'meterGroup.label', 'Meter');\n\n /**\n * The parts of the bar, in order. Each segment is drawn as its share of `max` when\n * set, else of the sum of the segments shown, so they need not add up to anything in\n * particular.\n */\n readonly segments = input<readonly WrMeterSegment[]>([]);\n\n /** Explicit total, a capacity the segments fill. `0` (default) uses the sum of the segments shown. @default 0 */\n readonly max = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Show the labelled legend. `'auto'` leaves it out for a single segment, which has\n * nothing to tell apart; `true` shows it for one too, since the row carries the value.\n * @default true\n */\n readonly showLegend = input<boolean | 'auto', unknown>(true, {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the bar as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a segment from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the meter's data is in flight: the bar empties and the loading message\n * takes the legend's place. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The meter's data failed to load: the bar empties and the error message takes the\n * legend's place. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is no segment. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** Show each segment's value in the legend, next to its label. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its segment, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its segment is\n * shown, so the legend becomes one tab stop per segment. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the segments that are hidden. Positions rather than\n * labels, since two segments may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden segment is left out of the bar and out of the sum. With no `max`, the\n * segments still shown share the whole bar between them, each at its share of their\n * own total, as `wr-donut-chart`'s slices do: the bar is the whole of what it draws.\n * An explicit `max` is a capacity rather than a sum, so it stays, and the hidden\n * segment's share becomes empty track. Either way the bar announces the total of the\n * segments shown (`aria-valuenow`, `aria-valuetext`), since that is what it draws, and\n * the tooltip cannot open on a segment that is not drawn. The legend keeps the hidden\n * segment's row, struck through and with its own value, so it can be shown again; the\n * row says \"hidden\" to a screen reader as well, through `aria-pressed` on a toggle and\n * a visually hidden word otherwise. A position past the end of `segments` is kept and\n * ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /**\n * Show a tooltip with the segment's label and value on hover. It replaces the band's\n * `title`, which is written only while this is off — or the browser would open a\n * second copy a moment later.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes every value in the legend and the tooltip, and the total the bar announces\n * as `aria-valuetext`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n * `aria-valuenow` stays a number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** Each value as the legend, the tooltip and the bar print it: never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly barEl = viewChild.required<ElementRef<HTMLElement>>('bar');\n private readonly sliceEls = viewChildren<ElementRef<HTMLElement>>('slice');\n\n /**\n * A segment's contribution, floored at `0` and with anything non-finite read\n * as `0`. One `NaN` used to poison the whole bar: the sum is `NaN` as soon as\n * one value is, so the total fell back to `1` and every OTHER segment was\n * asked for a width of `value * 100`%, while `aria-valuenow` announced `NaN`.\n */\n private static amount(raw: number): number {\n return Number.isFinite(raw) ? Math.max(0, raw) : 0;\n }\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n /** What the segments still shown add up to (see `hiddenSegments`). */\n private readonly shownSum = computed(() => {\n const hidden = this.hidden();\n return this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : WrMeterGroup.amount(s.value)), 0);\n });\n\n protected readonly resolvedMax = computed(() => {\n const explicit = this.max();\n if (explicit > 0) return explicit;\n const sum = this.shownSum();\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Sum of the segments, for `aria-valuenow`. `role=\"progressbar\"` without it\n * announces no value at all, so the bar was invisible to assistive tech.\n *\n * Capped at the total, because segments summing past an explicit `max` used\n * to announce a value outside the range they were announced against.\n */\n protected readonly totalValue = computed(() => Math.min(this.resolvedMax(), this.shownSum()));\n\n /**\n * The total as the bar announces it — `aria-valuetext`, written the way the legend\n * writes each figure — so a `valueFormat` that adds a unit reaches a screen reader\n * too, rather than a bare percentage of `aria-valuemax`. The gauge does the same.\n */\n protected readonly totalText = computed(() => this.numbers.value(this.totalValue()));\n\n protected readonly slices = computed(() => {\n const hidden = this.hidden();\n const max = this.resolvedMax();\n return this.segments().map((segment, i) => ({\n index: i,\n label: segment.label,\n // The legend keeps a negative value visible — it is data the caller gave\n // us — but not a non-finite one, which reads as the literal text `NaN`.\n text: this.numbers.value(Number.isFinite(segment.value) ? segment.value : 0),\n color: segment.color ?? wrChartColor(i),\n hidden: hidden.has(i),\n percent: hidden.has(i) ? 0 : (WrMeterGroup.amount(segment.value) / max) * 100,\n }));\n });\n\n /**\n * The bands drawn, in order: every segment but the hidden ones. A hidden band is left\n * out rather than drawn at zero width, since a zero band still lays its gap over the\n * boundary and would leave a double one.\n */\n protected readonly bands = computed(() => {\n const shown = this.slices().filter(slice => !slice.hidden);\n let end = 0;\n return shown.map((slice, at) => {\n const size = slice.percent / 100;\n const start = end;\n end = Math.min(1, end + size);\n return {\n ...slice,\n /** Where its visible part starts, as a share of the bar: the end of the band before it. */\n start: wrChartRound(start, 5),\n /** Its share of the bar, 0 to 1. */\n size: wrChartRound(size, 5),\n /**\n * Where it ends, as a share of the bar from its start. Every band is as wide as the\n * bar and slid back so that it ends here, under the bands before it: its length on\n * screen is then a transform, and a new value lays nothing out.\n */\n end: wrChartRound(end, 5),\n /** Its place in the pile: the first band on top, so each covers the start of the next. */\n layer: shown.length - at,\n };\n });\n });\n\n /** The legend's rows: every segment, hidden ones included, with its value unless `showValues` is off. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() => {\n const values = this.showValues();\n return this.slices().map(({ label, color, text }) => ({ label, color, value: values ? text : null }));\n });\n\n /**\n * One tooltip for the whole bar, pointing at the hovered band, with the value as\n * the legend prints it. Asked by the segment's own position, and the drawn bands are\n * only the shown ones, so the band is found among them by that position.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const at = this.bands().findIndex(band => band.index === index);\n const band = this.bands()[at];\n const el = this.sliceEls()[at]?.nativeElement;\n if (!band || !el) return null;\n // The band's own box is as wide as the bar, most of it out of sight under the bands\n // before it, so the chip points at the part of the bar the band shows.\n const bar = this.barEl().nativeElement;\n const box = bar.getBoundingClientRect();\n const rtl = getComputedStyle(bar).direction === 'rtl';\n const width = (band.end - band.start) * box.width;\n const x = rtl ? box.right - band.end * box.width : box.left + band.start * box.width;\n return {\n datum: { label: band.label, value: band.text, color: band.color },\n anchor: { x, y: box.top, width, height: box.height },\n };\n });\n\n /**\n * Whether the meter draws its legend: unless `showLegend` is off, `legendPosition` is\n * `none`, or there is no segment. Under `showLegend=\"auto\"` a single segment draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.slices().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the bar, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the bar rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** What the meter shows in place of its legend, or `null` while it draws its segments. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.segments().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n}\n","@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<div\n #bar\n class=\"wr-meter-group__bar\"\n role=\"progressbar\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"resolvedMax()\"\n [attr.aria-valuenow]=\"totalValue()\"\n [attr.aria-valuetext]=\"totalText()\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoFA,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,oBAAoB;EAGrF,cAAc;GAAE,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;GAAG,QAAO,UAAS,KAAK,IAAI,MAAM,KAAK;EAAC,CAAE;CAChG;CAGS,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAE5B,oBAAoB,YAAY,KAAK,WAAW,oBAAoB,OAAO;CAOrF,WAAW,MAAiC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,WAAA,CAAA,+BAAA,CAAA,CAAA;CAG/C,MAAM,MAAM,GAAC;EAAA,GAA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AA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,kBAAA,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,GAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,sBAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,aAAA,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,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,UAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACR,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"ngwr-charts-meter-group.mjs","names":[],"sources":["../../../projects/lib/charts/meter-group/meter-group.ts","../../../projects/lib/charts/meter-group/meter-group.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n viewChild,\n viewChildren,\n} from '@angular/core';\n\nimport {\n WR_CHART_LEGEND_BLOCK,\n WrChartLegend,\n type WrChartLegendItem,\n type WrChartLegendPosition,\n} from 'ngwr/charts/chart-legend';\nimport {\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartState,\n wrChartColor,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText, wrReadI18nText } from 'ngwr/i18n';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrMeterSegment } from './types';\n\n/**\n * Stacked-segment progress bar. Visualises a breakdown of a total —\n * disk usage, budget, vote share, etc. Each segment contributes a slice\n * proportional to its `value` relative to the sum of the segments shown (or the\n * explicit `max`).\n *\n * @example\n * ```html\n * <wr-meter-group\n * [segments]=\"[\n * { label: 'Used', value: 60 },\n * { label: 'Reserved', value: 25, color: 'var(--wr-color-warning)' }\n * ]\"\n * [max]=\"100\"\n * />\n * ```\n *\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their segments through `hiddenSegments`.\n * `legendPosition` puts it under the bar, over it or beside it.\n *\n * **On the chart theme.** A segment with no `color` takes the next colour of the chart\n * palette (`--wr-chart-1` to `-8`), solid, and a 1px line in the surface parts two\n * segments. Hovering a segment or its legend row dims the others. With no segment the\n * bar is an empty track with \"No data\" under it; `loading` and `error` put their own\n * message there.\n *\n * **What a screen reader gets.** The bar is a `role=\"progressbar\"` that announces the\n * total, so each segment's figure is in text only in the legend, which `showLegend` and\n * `showValues` can leave out. `dataTable` renders every segment shown with its value and\n * its share of the total as a table a reader can walk cell by cell.\n *\n * @see https://ngwr.dev/charts/meter-group\n */\n@Component({\n selector: 'wr-meter-group',\n templateUrl: './meter-group.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the bar.\n class: 'wr-meter-group wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState, WrChartTable],\n // The legend's rows keep the classes this chart drew before it drew them through\n // `WrChartLegend`: `.wr-meter-group__legend-item`, `__swatch`, `__legend-label` and\n // `__legend-value`.\n viewProviders: [{ provide: WR_CHART_LEGEND_BLOCK, useValue: 'wr-meter-group' }],\n})\nexport class WrMeterGroup {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/meter-group');\n // One pair of listeners on the host, not two on every band: the band under the pointer\n // is the nearest element up from it carrying `data-wr-index`, its segment's position.\n useChartHover({ enter: index => this.tip.enter(index), leave: event => this.tip.leave(event) });\n }\n\n /** Accessible name — the role needs one. Also the caption of the data table. Falls back to `meterGroup.label`. */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'meterGroup.label', 'Meter');\n\n /**\n * The parts of the bar, in order. Each segment is drawn as its share of `max` when\n * set, else of the sum of the segments shown, so they need not add up to anything in\n * particular.\n */\n readonly segments = input<readonly WrMeterSegment[]>([]);\n\n /** Explicit total, a capacity the segments fill. `0` (default) uses the sum of the segments shown. @default 0 */\n readonly max = input(0, { transform: (v: unknown): number => Math.max(0, coerceNumberProperty(v, 0)) });\n\n /**\n * Show the labelled legend. `'auto'` leaves it out for a single segment, which has\n * nothing to tell apart; `true` shows it for one too, since the row carries the value.\n * @default true\n */\n readonly showLegend = input<boolean | 'auto', unknown>(true, {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the bar as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSegments` still\n * hides a segment from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the meter's data is in flight: the bar empties and the loading message\n * takes the legend's place. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The meter's data failed to load: the bar empties and the error message takes the\n * legend's place. `loading` wins while both are set. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown when there is no segment. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /** Show each segment's value in the legend, next to its label. @default true */\n readonly showValues = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its segment, through\n * `hiddenSegments`. A row is a `<button aria-pressed>`, pressed while its segment is\n * shown, so the legend becomes one tab stop per segment. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `segments` of the segments that are hidden. Positions rather than\n * labels, since two segments may share a label. A toggleable legend writes it, and a\n * host may bind it with or without one: `[(hiddenSegments)]`.\n *\n * A hidden segment is left out of the bar and out of the sum. With no `max`, the\n * segments still shown share the whole bar between them, each at its share of their\n * own total, as `wr-donut-chart`'s slices do: the bar is the whole of what it draws.\n * An explicit `max` is a capacity rather than a sum, so it stays, and the hidden\n * segment's share becomes empty track. Either way the bar announces the total of the\n * segments shown (`aria-valuenow`, `aria-valuetext`), since that is what it draws, and\n * the tooltip cannot open on a segment that is not drawn. The legend keeps the hidden\n * segment's row, struck through and with its own value, so it can be shown again; the\n * row says \"hidden\" to a screen reader as well, through `aria-pressed` on a toggle and\n * a visually hidden word otherwise. A position past the end of `segments` is kept and\n * ignored.\n */\n readonly hiddenSegments = model<readonly number[]>([]);\n\n /**\n * Show a tooltip with the segment's label and value on hover. It replaces the band's\n * `title`, which is written only while this is off — or the browser would open a\n * second copy a moment later.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes every value in the legend, the tooltip and the data table, and the total the\n * bar announces as `aria-valuetext`. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n * `aria-valuenow` stays a number.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /**\n * Render the meter's figures as a table that only assistive technology reaches: a row\n * per segment shown, headed by its label, with its value as the legend writes it and\n * its share of the total the bar is drawn against, a percentage in `LOCALE_ID`: of\n * `max` when one is set, else of the sum of the segments shown. A segment hidden\n * through `hiddenSegments` has no row, and one that draws nothing has an empty share.\n * The values are listed whatever `showValues` says. The table gives way with the legend\n * while the meter is empty, `loading` or in `error`.\n *\n * The bar announces the total alone, and the legend is optional, so without the table\n * the segments' figures may be nowhere a screen reader can walk. It is rendered beside\n * the bar, clipped to nothing: it takes no room, draws nothing and holds no tab stop.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /** The headings of the data table's two columns. */\n private readonly valueName = wrReadI18nText('meterGroup.value', 'Value');\n private readonly shareName = wrReadI18nText('meterGroup.share', 'Share');\n\n /** Each value as the legend, the tooltip, the data table and the bar print it: never compact, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly locale = inject(LOCALE_ID);\n /** Shares from one percent up, to one decimal. */\n private readonly shares = wrChartNumberFormat(this.locale, { style: 'percent', maximumFractionDigits: 1 });\n /** Shares below one percent, to two significant digits, so a sliver does not read `0%`. */\n private readonly smallShares = wrChartNumberFormat(this.locale, { style: 'percent', maximumSignificantDigits: 2 });\n\n private readonly barEl = viewChild.required<ElementRef<HTMLElement>>('bar');\n private readonly sliceEls = viewChildren<ElementRef<HTMLElement>>('slice');\n\n /**\n * A segment's contribution, floored at `0` and with anything non-finite read\n * as `0`. One `NaN` used to poison the whole bar: the sum is `NaN` as soon as\n * one value is, so the total fell back to `1` and every OTHER segment was\n * asked for a width of `value * 100`%, while `aria-valuenow` announced `NaN`.\n */\n private static amount(raw: number): number {\n return Number.isFinite(raw) ? Math.max(0, raw) : 0;\n }\n\n private readonly hidden = computed(() => new Set(this.hiddenSegments()));\n\n /** What the segments still shown add up to (see `hiddenSegments`). */\n private readonly shownSum = computed(() => {\n const hidden = this.hidden();\n return this.segments().reduce((acc, s, i) => acc + (hidden.has(i) ? 0 : WrMeterGroup.amount(s.value)), 0);\n });\n\n protected readonly resolvedMax = computed(() => {\n const explicit = this.max();\n if (explicit > 0) return explicit;\n const sum = this.shownSum();\n return sum > 0 ? sum : 1;\n });\n\n /**\n * Sum of the segments, for `aria-valuenow`. `role=\"progressbar\"` without it\n * announces no value at all, so the bar was invisible to assistive tech.\n *\n * Capped at the total, because segments summing past an explicit `max` used\n * to announce a value outside the range they were announced against.\n */\n protected readonly totalValue = computed(() => Math.min(this.resolvedMax(), this.shownSum()));\n\n /**\n * The total as the bar announces it — `aria-valuetext`, written the way the legend\n * writes each figure — so a `valueFormat` that adds a unit reaches a screen reader\n * too, rather than a bare percentage of `aria-valuemax`. The gauge does the same.\n */\n protected readonly totalText = computed(() => this.numbers.value(this.totalValue()));\n\n protected readonly slices = computed(() => {\n const hidden = this.hidden();\n const max = this.resolvedMax();\n return this.segments().map((segment, i) => ({\n index: i,\n label: segment.label,\n // The legend keeps a negative value visible — it is data the caller gave\n // us — but not a non-finite one, which reads as the literal text `NaN`.\n text: this.numbers.value(Number.isFinite(segment.value) ? segment.value : 0),\n color: segment.color ?? wrChartColor(i),\n hidden: hidden.has(i),\n percent: hidden.has(i) ? 0 : (WrMeterGroup.amount(segment.value) / max) * 100,\n }));\n });\n\n /**\n * The bands drawn, in order: every segment but the hidden ones. A hidden band is left\n * out rather than drawn at zero width, since a zero band still lays its gap over the\n * boundary and would leave a double one.\n */\n protected readonly bands = computed(() => {\n const shown = this.slices().filter(slice => !slice.hidden);\n let end = 0;\n return shown.map((slice, at) => {\n const size = slice.percent / 100;\n const start = end;\n end = Math.min(1, end + size);\n return {\n ...slice,\n /** Where its visible part starts, as a share of the bar: the end of the band before it. */\n start: wrChartRound(start, 5),\n /** Its share of the bar, 0 to 1. */\n size: wrChartRound(size, 5),\n /**\n * Where it ends, as a share of the bar from its start. Every band is as wide as the\n * bar and slid back so that it ends here, under the bands before it: its length on\n * screen is then a transform, and a new value lays nothing out.\n */\n end: wrChartRound(end, 5),\n /** Its place in the pile: the first band on top, so each covers the start of the next. */\n layer: shown.length - at,\n };\n });\n });\n\n /** The legend's rows: every segment, hidden ones included, with its value unless `showValues` is off. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() => {\n const values = this.showValues();\n return this.slices().map(({ label, color, text }) => ({ label, color, value: values ? text : null }));\n });\n\n /**\n * The figures for `dataTable`: the meter's name as the caption, a row per segment shown,\n * and its value and its share of the total as the columns.\n */\n protected readonly tableData = computed<WrChartTableData>(() => ({\n caption: this.resolvedAriaLabel(),\n columns: [this.valueName(), this.shareName()],\n groups: [\n {\n rows: this.slices()\n .filter(slice => !slice.hidden)\n .map(slice => {\n const share = slice.percent / 100;\n return {\n header: slice.label,\n cells: [slice.text, share > 0 ? (share < 0.01 ? this.smallShares : this.shares).format(share) : ''],\n };\n }),\n },\n ],\n }));\n\n /**\n * One tooltip for the whole bar, pointing at the hovered band, with the value as\n * the legend prints it. Asked by the segment's own position, and the drawn bands are\n * only the shown ones, so the band is found among them by that position.\n */\n protected readonly tip = useChartTooltip(this.tooltip, index => {\n const at = this.bands().findIndex(band => band.index === index);\n const band = this.bands()[at];\n const el = this.sliceEls()[at]?.nativeElement;\n if (!band || !el) return null;\n // The band's own box is as wide as the bar, most of it out of sight under the bands\n // before it, so the chip points at the part of the bar the band shows.\n const bar = this.barEl().nativeElement;\n const box = bar.getBoundingClientRect();\n const rtl = getComputedStyle(bar).direction === 'rtl';\n const width = (band.end - band.start) * box.width;\n const x = rtl ? box.right - band.end * box.width : box.left + band.start * box.width;\n return {\n datum: { label: band.label, value: band.text, color: band.color },\n anchor: { x, y: box.top, width, height: box.height },\n };\n });\n\n /**\n * Whether the meter draws its legend: unless `showLegend` is off, `legendPosition` is\n * `none`, or there is no segment. Under `showLegend=\"auto\"` a single segment draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.slices().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the bar, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the bar rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** What the meter shows in place of its legend, or `null` while it draws its segments. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: computed(() => this.segments().length === 0),\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n}\n","@let shown = state();\n\n<!-- The legend, drawn before the bar or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. A row's\n position is its segment's, which is the `data-wr-series` the segment's band carries. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-meter-group__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSegments\"\n ></ul>\n</ng-template>\n\n@if (!shown && legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Loading or failed, there is no total to announce: the bar is a named group, as the\n gauge's surface is, and the message below it is the live region. An empty meter\n still reads zero. -->\n@let reading = !shown || shown.kind === 'empty';\n<div\n #bar\n class=\"wr-meter-group__bar\"\n [attr.role]=\"reading ? 'progressbar' : 'group'\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-valuemin]=\"reading ? 0 : null\"\n [attr.aria-valuemax]=\"reading ? resolvedMax() : null\"\n [attr.aria-valuenow]=\"reading ? totalValue() : null\"\n [attr.aria-valuetext]=\"reading ? totalText() : null\"\n>\n <!-- Only the shown segments draw a band; each keeps its segment's own position, which\n is what the tooltip looks it up by. `data-label` is what the harness reads a band's\n label from; the `title` it used to read is only written while the tooltip is off.\n A band is as wide as the bar and slid back to end at `--wr-meter-group-slice-end`,\n under the bands before it, so its length is a transform; `-size` is its own share. -->\n @if (!shown || shown.kind === 'empty') {\n @for (slice of bands(); track slice.index) {\n <span\n #slice\n class=\"wr-meter-group__slice\"\n [attr.title]=\"tooltip() ? null : slice.label\"\n [attr.data-label]=\"slice.label\"\n [attr.data-wr-index]=\"slice.index\"\n [attr.data-wr-series]=\"slice.index\"\n [style.--wr-meter-group-slice-size]=\"slice.size\"\n [style.--wr-meter-group-slice-end]=\"slice.end\"\n [style.z-index]=\"slice.layer\"\n [style.background]=\"slice.color\"\n ></span>\n }\n }\n</div>\n\n@if (shown) {\n <!-- In the legend's place: a bar is too thin to carry a message over it. -->\n <div class=\"wr-meter-group__status\">\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n </div>\n} @else if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\n <!-- The figures for a screen reader, beside the bar rather than inside it: a\n `progressbar` makes its children presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;;AA8FA,IAAa,eAAb,MAAa,aAAY;CACvB,cAAA;EACE,IAAI,OAAO,cA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