@ids-group-ltd/ids-design-system 0.14.0 → 0.14.1
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/CHANGELOG.md +330 -4
- package/components.md +81 -43
- package/design-system.md +2 -0
- package/docs/agent/INDEX.md +2 -1
- package/docs/agent/charts/column-series-component.md +1 -1
- package/docs/agent/charts/ds-bar-chart.md +2 -1
- package/docs/agent/charts/ds-chart.md +1 -1
- package/docs/agent/charts/ds-config.md +3 -1
- package/docs/agent/charts/ds-line-chart.md +3 -3
- package/docs/agent/charts/ds-pie-chart.md +4 -3
- package/docs/agent/feedback/ds-alert.md +1 -0
- package/docs/agent/feedback/ds-badge.md +1 -1
- package/docs/agent/feedback/ds-banner.md +1 -0
- package/docs/agent/feedback/ds-skeleton.md +2 -2
- package/docs/agent/feedback/ds-tag.md +1 -1
- package/docs/agent/forms/ds-autocomplete.md +2 -2
- package/docs/agent/forms/ds-button.md +1 -1
- package/docs/agent/forms/ds-color-picker.md +1 -1
- package/docs/agent/forms/ds-date-picker.md +2 -2
- package/docs/agent/forms/ds-filter-bar.md +1 -1
- package/docs/agent/forms/ds-icon-button.md +1 -1
- package/docs/agent/forms/ds-input.md +1 -1
- package/docs/agent/forms/ds-multi-select.md +2 -2
- package/docs/agent/forms/ds-otp-input.md +1 -1
- package/docs/agent/forms/ds-search.md +2 -2
- package/docs/agent/forms/ds-split-button.md +1 -1
- package/docs/agent/forms/ds-textarea.md +1 -1
- package/docs/agent/foundations/tokens.md +1 -1
- package/docs/agent/navigation/ds-app-layout.md +2 -2
- package/docs/agent/navigation/ds-auth-layout.md +4 -4
- package/docs/agent/navigation/ds-page-header.md +1 -1
- package/docs/agent/platform/ds-config.md +2 -3
- package/docs/agent/platform/ds-intl.md +33 -0
- package/docs/agent/surfaces/ds-accordion.md +2 -2
- package/docs/agent/tables/ds-table.md +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +9 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +21 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +9 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +8 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +13 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +5 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +12 -8
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +21 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs +35 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-bar-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +7 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +4 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +4 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-data-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-legend.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs +22 -29
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart-tooltip.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs +91 -67
- package/fesm2022/ids-group-ltd-ids-design-system-components-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +9 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs +20 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-column-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +16 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +7 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +12 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +13 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs +36 -29
- package/fesm2022/ids-group-ltd-ids-design-system-components-funnel-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs +13 -9
- package/fesm2022/ids-group-ltd-ids-design-system-components-heatmap-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +3 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +5 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs +23 -20
- package/fesm2022/ids-group-ltd-ids-design-system-components-line-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +26 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +15 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +5 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +13 -7
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +2 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +7 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +12 -11
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs +51 -16
- package/fesm2022/ids-group-ltd-ids-design-system-components-pie-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs +17 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-scatter-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +4 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +4 -2
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +20 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +6 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +6 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs +16 -13
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-columns.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs +9 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-table-export.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +19 -18
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +9 -5
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +5 -4
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +12 -10
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +8 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +5 -3
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs +14 -15
- package/fesm2022/ids-group-ltd-ids-design-system-components-waterfall-chart.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +271 -73
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +359 -3
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +1 -1
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.10.0.json +1 -1
- package/migrations/0.10.1.json +1 -1
- package/migrations/0.14.0.json +28 -4
- package/migrations/0.14.1.json +856 -0
- package/package.json +1 -1
- package/schematics/check-overrides/index.cjs +56 -0
- package/schematics/check-overrides/scan.cjs +74 -0
- package/schematics/check-overrides/schema.json +19 -0
- package/schematics/check-overrides/surface.json +2304 -0
- package/schematics/collection.json +5 -0
- package/styles/_chart-interactive.scss +33 -0
- package/styles/_field-box.scss +12 -0
- package/styles/_overlay-motion.scss +6 -4
- package/styles/_tokens-charts.scss +1 -1
- package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +11 -2
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +4 -0
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +5 -5
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +7 -4
- package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +5 -3
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +4 -0
- package/types/ids-group-ltd-ids-design-system-components-bar-chart.d.ts +18 -10
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +2 -2
- package/types/ids-group-ltd-ids-design-system-components-chart-data-table.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-chart-legend.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-chart-tooltip.d.ts +1 -4
- package/types/ids-group-ltd-ids-design-system-components-chart.d.ts +38 -18
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-column-chart.d.ts +9 -8
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +9 -3
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +9 -4
- package/types/ids-group-ltd-ids-design-system-components-funnel-chart.d.ts +11 -9
- package/types/ids-group-ltd-ids-design-system-components-heatmap-chart.d.ts +7 -5
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-line-chart.d.ts +13 -10
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +11 -6
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-pie-chart.d.ts +24 -10
- package/types/ids-group-ltd-ids-design-system-components-scatter-chart.d.ts +8 -5
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +7 -3
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +3 -2
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +3 -1
- package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +5 -1
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +6 -4
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +5 -2
- package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-table-export.d.ts +1 -0
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +10 -5
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +6 -2
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +3 -0
- package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +2 -0
- package/types/ids-group-ltd-ids-design-system-components-waterfall-chart.d.ts +7 -5
- package/types/ids-group-ltd-ids-design-system-components.d.ts +44 -21
- package/types/ids-group-ltd-ids-design-system-core.d.ts +408 -11
- package/types/ids-group-ltd-ids-design-system.d.ts +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ids-group-ltd-ids-design-system-components-waterfall-chart.mjs","sources":["../../../src/lib/components/waterfall-chart/waterfall-chart.math.ts","../../../src/lib/components/waterfall-chart/waterfall-marks.component.ts","../../../src/lib/components/waterfall-chart/waterfall-marks.component.html","../../../src/lib/components/waterfall-chart/waterfall-chart.component.ts","../../../src/lib/components/waterfall-chart/waterfall-chart.component.html","../../../src/lib/components/waterfall-chart/ids-group-ltd-ids-design-system-components-waterfall-chart.ts"],"sourcesContent":["import type {\n WaterfallChartBar,\n WaterfallChartStep,\n} from './waterfall-chart.types';\n\n/** Where each bar spans, walking the running sum from zero.\n *\n * Every row adds its own value to the sum, including a total - a closing total carries `0` and so\n * prints the sum reached. A delta then spans from the sum before it to the sum after; a total or a\n * subtotal stands on zero and reaches the sum, which is what makes it a figure rather than a\n * change. A non-finite reading adds nothing rather than poisoning every bar after it.\n *\n * @internal */\nexport function waterfallSteps(\n data: readonly WaterfallChartBar[],\n): readonly WaterfallChartStep[] {\n let running = 0;\n\n return data.map((datum) => {\n const from = running;\n const value = Number.isFinite(datum.value) ? datum.value : 0;\n running += value;\n const standsOnZero = datum.kind === 'total' || datum.kind === 'subtotal';\n\n return {\n label: datum.label,\n from: standsOnZero ? 0 : from,\n to: running,\n direction: standsOnZero ? 'total' : value < 0 ? 'decrease' : 'increase',\n };\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n inject,\n input,\n numberAttribute,\n} from '@angular/core';\nimport { CHART_SCALES } from '@ids-group-ltd/ids-design-system/components/chart';\nimport type { ChartValueFormat } from '@ids-group-ltd/ids-design-system/core';\nimport type { WaterfallChartStep } from './waterfall-chart.types';\n\n/** Distance from a bar's own tip to its value label's baseline. */\nconst VALUE_LABEL_GAP = 8;\n\n/**\n * The two things a waterfall needs that a column series cannot carry: the dashed rule chaining one\n * bar to the next, and a value label that prints its own sign.\n *\n * The label lives here rather than on the column series because the sign is not a property of the\n * number - a delta of `130` reads `+130` and a total of `800` reads `800` - and a series-wide\n * formatter sees only the value, never which of the two it is holding.\n *\n * Hosted on a `<g>` rather than an element of its own: an element the SVG specification does not\n * know is not rendered, and neither are its descendants. Written as `<svg:g dsWaterfallMarks>`.\n *\n * @internal\n */\n@Component({\n // The repository's `component-selector` rule asks for an element selector, and one cannot work\n // inside a canvas - see the same exemption on `g[dsColumnSeries]`.\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'g[dsWaterfallMarks]',\n standalone: true,\n templateUrl: './waterfall-marks.component.html',\n styleUrl: './waterfall-marks.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WaterfallMarksComponent {\n private readonly scales = inject(CHART_SCALES);\n\n readonly steps = input<readonly WaterfallChartStep[]>([]);\n\n /** The reading each label prints: a delta's own change, a total's running sum. */\n readonly labelValues = input<readonly number[]>([]);\n\n readonly showValues = input(true);\n\n readonly showConnectors = input(true);\n\n readonly valueFormat = input<ChartValueFormat>((value) => String(value));\n\n /** The share of a category's band the bars take, so the connector starts where the bar ends. */\n readonly columnWidthRatio = input(0.8, { transform: numberAttribute });\n\n protected readonly markWidth = computed(\n () => this.scales.bandWidth() * this.columnWidthRatio(),\n );\n\n /** One rule per gap between two bars, drawn at the level they share - the level the left bar\n * ended on. Without it the bars read as five separate columns instead of one chain. */\n protected readonly connectors = computed(() => {\n const toX = this.scales.xPosition();\n const toY = this.scales.yPosition();\n const steps = this.steps();\n const half = this.markWidth() / 2;\n\n return steps.slice(0, -1).map((step, index) => ({\n key: `${index}-${step.label}`,\n x1: toX(index) + half,\n x2: toX(index + 1) - half,\n y: toY(step.to),\n }));\n });\n\n protected readonly labels = computed(() => {\n const toX = this.scales.xPosition();\n const toY = this.scales.yPosition();\n const format = this.valueFormat();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => {\n const reading = values[index] ?? step.to - step.from;\n const tip = Math.min(toY(step.from), toY(step.to));\n const sign = step.direction === 'increase' && reading > 0 ? '+' : '';\n\n return {\n key: `${index}-${step.label}`,\n x: toX(index),\n y: tip - VALUE_LABEL_GAP,\n text: `${sign}${format(reading, 'tooltip')}`,\n };\n });\n });\n}\n","<svg:g\n class=\"waterfall-marks\"\n aria-hidden=\"true\">\n @if (showConnectors()) {\n @for (connector of connectors(); track connector.key) {\n <svg:line\n class=\"connector\"\n [attr.x1]=\"connector.x1\"\n [attr.x2]=\"connector.x2\"\n [attr.y1]=\"connector.y\"\n [attr.y2]=\"connector.y\" />\n }\n }\n\n @if (showValues()) {\n @for (label of labels(); track label.key) {\n <svg:text\n class=\"value\"\n text-anchor=\"middle\"\n [attr.x]=\"label.x\"\n [attr.y]=\"label.y\">\n {{ label.text }}\n </svg:text>\n }\n }\n</svg:g>\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n input,\n numberAttribute,\n output,\n} from '@angular/core';\nimport {\n ChartComponent,\n ColumnSeriesComponent,\n} from '@ids-group-ltd/ids-design-system/components/chart';\nimport type { ColumnSeriesPoint } from '@ids-group-ltd/ids-design-system/components/chart';\nimport { SkeletonComponent } from '@ids-group-ltd/ids-design-system/components/skeleton';\nimport type {\n ChartDataTable,\n ChartFrame,\n ChartValueFormat,\n} from '@ids-group-ltd/ids-design-system/core';\nimport { waterfallSteps } from './waterfall-chart.math';\nimport { WaterfallMarksComponent } from './waterfall-marks.component';\nimport { ChartDataTableComponent } from '@ids-group-ltd/ids-design-system/components/chart-data-table';\nimport type { ChartDataRow } from '@ids-group-ltd/ids-design-system/components/chart-data-table';\nimport { resolveChartDefaults } from '@ids-group-ltd/ids-design-system/components';\nimport type {\n WaterfallChartBar,\n WaterfallChartStep,\n} from './waterfall-chart.types';\n\n/** What each direction is painted with. A total is the neutral series colour because it is not a\n * change at all, and reading it as one is the mistake the three-colour scheme exists to prevent. */\nconst DIRECTION_COLORS: Record<WaterfallChartStep['direction'], string> = {\n increase: 'var(--ds-chart-positive-color)',\n decrease: 'var(--ds-chart-negative-color)',\n total: 'var(--ds-chart-series-default-color)',\n};\n\nconst DIRECTION_WORDS: Record<WaterfallChartStep['direction'], string> = {\n increase: 'increase',\n decrease: 'decrease',\n total: 'total',\n};\n\n/**\n * A running total, bar by bar: what a figure started at, what moved it, and what it ended at.\n *\n * The one chart in the family that cannot be a mode on another, because it needs three things at\n * once - an accumulating level, bars pinned to zero for the totals, and its own three-colour\n * semantic. Colour never carries that semantic alone: every bar's label prints its own sign and\n * every bar's accessible name says \"increase\" or \"decrease\" in words.\n */\n@Component({\n selector: 'ds-waterfall-chart',\n standalone: true,\n exportAs: 'dsWaterfallChart',\n imports: [\n ChartComponent,\n ColumnSeriesComponent,\n SkeletonComponent,\n WaterfallMarksComponent,\n ChartDataTableComponent,\n ],\n templateUrl: './waterfall-chart.component.html',\n styleUrl: './waterfall-chart.component.scss',\n host: {\n '[class.framed]': \"frameResolved() === 'auto'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WaterfallChartComponent {\n /** The bars in the order they are read, which is the order they happened in - a waterfall is\n * never sorted, because the sequence is the meaning. */\n readonly data = input<readonly WaterfallChartBar[]>([]);\n\n /** Prints each bar's own reading above it, with its sign. */\n readonly showValues = input(true, { transform: booleanAttribute });\n\n /** The dashed rule chaining one bar to the next at the level they share. Without it the bars\n * read as separate columns rather than as one running total. */\n readonly showConnectors = input(true, { transform: booleanAttribute });\n\n /** Printed above the plot as the visible title, and reused as the annex table's caption. */\n readonly caption = input<string | null>(null);\n\n /** The accessible name. Generated from the steps when omitted, naming each one's direction in\n * words and the figure the chain ends at. */\n readonly summary = input<string | null>(null);\n\n /** A hint, not a count. Ticks snap to a round step. */\n readonly tickCount = input(5, { transform: numberAttribute });\n\n /** Turns on the click affordance and the keyboard route. `barClicked` fires whether or not\n * this is set. */\n readonly interactive = input(false, { transform: booleanAttribute });\n\n /** `'auto'` draws the bordered, padded box; `'none'` leaves it bare for a chart inside a card\n * the page has already drawn. Unset falls back to `DS_CONFIG.chart.frame`. */\n readonly frame = input<ChartFrame | null>(null);\n\n /** The annex table under the plot. Unset falls back to `DS_CONFIG.chart.dataTable`, then\n * `'none'`. It prints each step's direction, its own reading and the running total. */\n readonly dataTable = input<ChartDataTable | null>(null);\n\n /** Skeleton bars at the real count, so the page does not resize when the data lands. */\n readonly loading = input(false, { transform: booleanAttribute });\n\n /** Separate from an empty `data`: \"the request failed\" and \"there is nothing to show\" read the\n * same and mean opposite things. */\n readonly error = input(false, { transform: booleanAttribute });\n\n /** Shown in place of the plot when `data` is empty. Unset falls back to\n * `DS_CONFIG.chart.emptyText`. */\n readonly emptyText = input<string | null>(null);\n\n /** Shown in place of the plot while `error` is set. Unset falls back to\n * `DS_CONFIG.chart.errorText`. */\n readonly errorText = input<string | null>(null);\n\n /** Formats every value the chart prints - the axis ticks, the bar labels and the annex table.\n * The sign a delta carries is added around it, so a formatter never has to know about one. */\n readonly valueFormat = input<ChartValueFormat | null>(null);\n\n /** The clicked datum, as it was given. Fires on click and on Enter or Space. */\n readonly barClicked = output<WaterfallChartBar>();\n\n private readonly defaults = resolveChartDefaults(this);\n readonly frameResolved = this.defaults.frame;\n readonly dataTableResolved = this.defaults.dataTable;\n readonly emptyTextResolved = this.defaults.emptyText;\n readonly errorTextResolved = this.defaults.errorText;\n readonly valueFormatResolved = this.defaults.valueFormat;\n\n protected readonly isEmpty = computed(() => this.data().length === 0);\n\n protected readonly steps = computed(() => waterfallSteps(this.data()));\n\n protected readonly categories = computed(() =>\n this.steps().map((step) => step.label),\n );\n\n protected readonly offsets = computed(() =>\n this.steps().map((step) => ({ from: step.from, to: step.to })),\n );\n\n /** What each bar's label prints: a delta's own change, a total's running sum. The two are\n * different readings and only one of them takes a sign. */\n protected readonly labelValues = computed(() =>\n this.steps().map((step, index) =>\n step.direction === 'total' ? step.to : (this.data()[index]?.value ?? 0),\n ),\n );\n\n protected readonly points = computed<readonly ColumnSeriesPoint[]>(() => {\n const format = this.valueFormatResolved();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => {\n const datum = this.data()[index];\n const reading = values[index];\n const sign = step.direction === 'increase' && reading > 0 ? '+' : '';\n\n return {\n id: datum?.id ?? String(index),\n // The word is what carries the meaning where colour cannot - forced colours, a monochrome\n // print, a reader who cannot tell the two hues apart, and every screen reader.\n label: `${step.label}, ${DIRECTION_WORDS[step.direction]} ${sign}${format(reading, 'tooltip')}`,\n value: reading,\n color: DIRECTION_COLORS[step.direction],\n };\n });\n });\n\n protected readonly accessibleName = computed(() => {\n const given = this.summary();\n if (given) {\n return given;\n }\n const steps = this.steps();\n if (steps.length === 0) {\n return this.caption() ?? 'Waterfall chart';\n }\n const format = this.valueFormatResolved();\n const last = steps[steps.length - 1];\n const spoken = steps\n .map(\n (step, index) =>\n `${step.label} ${DIRECTION_WORDS[step.direction]} ${format(this.labelValues()[index], 'tooltip')}`,\n )\n .join(', ');\n\n return `${this.caption() ?? 'Waterfall'}: ${spoken}. Ends at ${format(last.to, 'tooltip')}.`;\n });\n\n protected readonly dataTableRows = computed<readonly ChartDataRow[]>(() =>\n this.tableRows().map((row) => ({\n key: row.key,\n cells: [\n row.label,\n row.direction,\n row.formattedValue,\n row.formattedRunningTotal,\n ],\n })),\n );\n\n protected readonly tableRows = computed(() => {\n const format = this.valueFormatResolved();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => ({\n key: `${index}-${step.label}`,\n label: step.label,\n direction: DIRECTION_WORDS[step.direction],\n formattedValue: format(values[index], 'tooltip'),\n formattedRunningTotal: format(step.to, 'tooltip'),\n }));\n });\n\n protected readonly skeletonBars = computed(() =>\n Array.from({ length: Math.max(this.data().length, 5) }),\n );\n\n protected onPointClicked(point: ColumnSeriesPoint): void {\n const datum = this.data().find(\n (entry, index) => (entry.id ?? String(index)) === point.id,\n );\n if (datum) {\n this.barClicked.emit(datum);\n }\n }\n}\n","<figure class=\"waterfall-chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorTextResolved() }}\n </p>\n } @else if (loading()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n @for (placeholder of skeletonBars(); track $index) {\n <ds-skeleton height=\"var(--_waterfall-chart-skeleton-height)\" />\n }\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyTextResolved() }}\n </p>\n } @else {\n <ds-chart\n frame=\"none\"\n [categories]=\"categories()\"\n [tickCount]=\"tickCount()\"\n [valueFormat]=\"valueFormatResolved()\"\n [interactive]=\"interactive()\"\n [summary]=\"accessibleName()\">\n <svg:g\n dsWaterfallMarks\n [steps]=\"steps()\"\n [labelValues]=\"labelValues()\"\n [showValues]=\"showValues()\"\n [showConnectors]=\"showConnectors()\"\n [valueFormat]=\"valueFormatResolved()\" />\n\n <svg:g\n dsColumnSeries\n showValues=\"false\"\n [data]=\"points()\"\n [offsets]=\"offsets()\"\n [interactive]=\"interactive()\"\n [valueFormat]=\"valueFormatResolved()\"\n (pointClicked)=\"onPointClicked($event)\" />\n </ds-chart>\n\n @if (dataTableResolved() !== 'none') {\n <ds-chart-data-table\n [columns]=\"['Step', 'Direction', 'Value', 'Running total']\"\n [rows]=\"dataTableRows()\"\n [caption]=\"caption()\"\n [open]=\"dataTableResolved() === 'visible'\" />\n }\n }\n</figure>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAKA;;;;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A,EAAA,CAAA;;4FAUd,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAnBnC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,EAAA,UAAA,EAClB,IAAI,EAAA,QAAA,EACN,kBAAkB,EAAA,OAAA,EACnB;wBACP,cAAc;wBACd,qBAAqB;wBACrB,iBAAiB;wBACjB,uBAAuB;wBACvB,uBAAuB;qBACxB,EAAA,IAAA,EAGK;AACJ,wBAAA,gBAAgB,EAAE,4BAA4B;AAC/C,qBAAA,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,EAAA,eAAA,EACxB,uBAAuB,CAAC,MAAM,EAAA,QAAA,EAAA,gpDAAA,EAAA,MAAA,EAAA,CAAA,++GAAA,CAAA,EAAA;;;AEtEjD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"ids-group-ltd-ids-design-system-components-waterfall-chart.mjs","sources":["../../../src/lib/components/waterfall-chart/waterfall-chart.math.ts","../../../src/lib/components/waterfall-chart/waterfall-marks.component.ts","../../../src/lib/components/waterfall-chart/waterfall-marks.component.html","../../../src/lib/components/waterfall-chart/waterfall-chart.component.ts","../../../src/lib/components/waterfall-chart/waterfall-chart.component.html","../../../src/lib/components/waterfall-chart/ids-group-ltd-ids-design-system-components-waterfall-chart.ts"],"sourcesContent":["import type {\n WaterfallChartBar,\n WaterfallChartStep,\n} from './waterfall-chart.types';\n\n/** Where each bar spans, walking the running sum from zero.\n *\n * Every row adds its own value to the sum, including a total - a closing total carries `0` and so\n * prints the sum reached. A delta then spans from the sum before it to the sum after; a total or a\n * subtotal stands on zero and reaches the sum, which is what makes it a figure rather than a\n * change. A non-finite reading adds nothing rather than poisoning every bar after it.\n *\n * @internal */\nexport function waterfallSteps(\n data: readonly WaterfallChartBar[],\n): readonly WaterfallChartStep[] {\n let running = 0;\n\n return data.map((datum) => {\n const from = running;\n const value = Number.isFinite(datum.value) ? datum.value : 0;\n running += value;\n const standsOnZero = datum.kind === 'total' || datum.kind === 'subtotal';\n\n return {\n label: datum.label,\n from: standsOnZero ? 0 : from,\n to: running,\n direction: standsOnZero ? 'total' : value < 0 ? 'decrease' : 'increase',\n };\n });\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n computed,\n inject,\n input,\n numberAttribute,\n} from '@angular/core';\nimport { CHART_SCALES } from '@ids-group-ltd/ids-design-system/components/chart';\nimport type { ChartValueFormat } from '@ids-group-ltd/ids-design-system/core';\nimport type { WaterfallChartStep } from './waterfall-chart.types';\n\n/** Distance from a bar's own tip to its value label's baseline. */\nconst VALUE_LABEL_GAP = 8;\n\n/**\n * The two things a waterfall needs that a column series cannot carry: the dashed rule chaining one\n * bar to the next, and a value label that prints its own sign.\n *\n * The label lives here rather than on the column series because the sign is not a property of the\n * number - a delta of `130` reads `+130` and a total of `800` reads `800` - and a series-wide\n * formatter sees only the value, never which of the two it is holding.\n *\n * Hosted on a `<g>` rather than an element of its own: an element the SVG specification does not\n * know is not rendered, and neither are its descendants. Written as `<svg:g dsWaterfallMarks>`.\n *\n * @internal\n */\n@Component({\n // The repository's `component-selector` rule asks for an element selector, and one cannot work\n // inside a canvas - see the same exemption on `g[dsColumnSeries]`.\n // eslint-disable-next-line @angular-eslint/component-selector\n selector: 'g[dsWaterfallMarks]',\n standalone: true,\n templateUrl: './waterfall-marks.component.html',\n styleUrl: './waterfall-marks.component.scss',\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class WaterfallMarksComponent {\n private readonly scales = inject(CHART_SCALES);\n\n readonly steps = input<readonly WaterfallChartStep[]>([]);\n\n /** The reading each label prints: a delta's own change, a total's running sum. */\n readonly labelValues = input<readonly number[]>([]);\n\n readonly showValues = input(true);\n\n readonly showConnectors = input(true);\n\n readonly valueFormat = input<ChartValueFormat>((value) => String(value));\n\n /** The share of a category's band the bars take, so the connector starts where the bar ends. */\n readonly columnWidthRatio = input(0.8, { transform: numberAttribute });\n\n protected readonly markWidth = computed(\n () => this.scales.bandWidth() * this.columnWidthRatio(),\n );\n\n /** One rule per gap between two bars, drawn at the level they share - the level the left bar\n * ended on. Without it the bars read as five separate columns instead of one chain. */\n protected readonly connectors = computed(() => {\n const toX = this.scales.xPosition();\n const toY = this.scales.yPosition();\n const steps = this.steps();\n const half = this.markWidth() / 2;\n\n return steps.slice(0, -1).map((step, index) => ({\n key: `${index}-${step.label}`,\n x1: toX(index) + half,\n x2: toX(index + 1) - half,\n y: toY(step.to),\n }));\n });\n\n protected readonly labels = computed(() => {\n const toX = this.scales.xPosition();\n const toY = this.scales.yPosition();\n const format = this.valueFormat();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => {\n const reading = values[index] ?? step.to - step.from;\n const tip = Math.min(toY(step.from), toY(step.to));\n const sign = step.direction === 'increase' && reading > 0 ? '+' : '';\n\n return {\n key: `${index}-${step.label}`,\n x: toX(index),\n y: tip - VALUE_LABEL_GAP,\n text: `${sign}${format(reading, 'tooltip')}`,\n };\n });\n });\n}\n","<svg:g\n class=\"waterfall-marks\"\n aria-hidden=\"true\">\n @if (showConnectors()) {\n @for (connector of connectors(); track connector.key) {\n <svg:line\n class=\"connector\"\n [attr.x1]=\"connector.x1\"\n [attr.x2]=\"connector.x2\"\n [attr.y1]=\"connector.y\"\n [attr.y2]=\"connector.y\" />\n }\n }\n\n @if (showValues()) {\n @for (label of labels(); track label.key) {\n <svg:text\n class=\"value\"\n text-anchor=\"middle\"\n [attr.x]=\"label.x\"\n [attr.y]=\"label.y\">\n {{ label.text }}\n </svg:text>\n }\n }\n</svg:g>\n","import {\n ChangeDetectionStrategy,\n Component,\n ViewEncapsulation,\n booleanAttribute,\n computed,\n inject,\n input,\n numberAttribute,\n output,\n} from '@angular/core';\nimport {\n ChartComponent,\n ColumnSeriesComponent,\n} from '@ids-group-ltd/ids-design-system/components/chart';\nimport type { ColumnSeriesPoint } from '@ids-group-ltd/ids-design-system/components/chart';\nimport { SkeletonComponent } from '@ids-group-ltd/ids-design-system/components/skeleton';\nimport { DS_INTL } from '@ids-group-ltd/ids-design-system/core';\nimport type {\n ChartDataTable,\n ChartFrame,\n ChartValueFormat,\n} from '@ids-group-ltd/ids-design-system/core';\nimport { waterfallSteps } from './waterfall-chart.math';\nimport { WaterfallMarksComponent } from './waterfall-marks.component';\nimport { ChartDataTableComponent } from '@ids-group-ltd/ids-design-system/components/chart-data-table';\nimport type { ChartDataRow } from '@ids-group-ltd/ids-design-system/components/chart-data-table';\nimport {\n resolveChartDefaults,\n chartRenderGate,\n CHART_RENDER_GATE_PASSED,\n} from '@ids-group-ltd/ids-design-system/components';\nimport type {\n WaterfallChartBar,\n WaterfallChartStep,\n} from './waterfall-chart.types';\n\n/** What each direction is painted with. A total is the neutral series colour because it is not a\n * change at all, and reading it as one is the mistake the three-colour scheme exists to prevent. */\nconst DIRECTION_COLORS: Record<WaterfallChartStep['direction'], string> = {\n increase: 'var(--ds-chart-positive-color)',\n decrease: 'var(--ds-chart-negative-color)',\n total: 'var(--ds-chart-series-default-color)',\n};\n\n/**\n * A running total, bar by bar: what a figure started at, what moved it, and what it ended at.\n *\n * The one chart in the family that cannot be a mode on another, because it needs three things at\n * once - an accumulating level, bars pinned to zero for the totals, and its own three-colour\n * semantic. Colour never carries that semantic alone: every bar's label prints its own sign and\n * every bar's accessible name says \"increase\" or \"decrease\" in words.\n */\n@Component({\n selector: 'ds-waterfall-chart',\n standalone: true,\n exportAs: 'dsWaterfallChart',\n imports: [\n ChartComponent,\n ColumnSeriesComponent,\n SkeletonComponent,\n WaterfallMarksComponent,\n ChartDataTableComponent,\n ],\n templateUrl: './waterfall-chart.component.html',\n styleUrl: './waterfall-chart.component.scss',\n host: {\n '[class.framed]': \"frameResolved() === 'auto'\",\n },\n encapsulation: ViewEncapsulation.Emulated,\n changeDetection: ChangeDetectionStrategy.OnPush,\n viewProviders: [{ provide: CHART_RENDER_GATE_PASSED, useValue: true }],\n})\nexport class WaterfallChartComponent {\n protected readonly renderReady = chartRenderGate();\n\n /** The bars in the order they are read, which is the order they happened in - a waterfall is\n * never sorted, because the sequence is the meaning. */\n readonly data = input<readonly WaterfallChartBar[]>([]);\n\n /** Prints each bar's own reading above it, with its sign. */\n readonly showValues = input(true, { transform: booleanAttribute });\n\n /** The dashed rule chaining one bar to the next at the level they share. Without it the bars\n * read as separate columns rather than as one running total. */\n readonly showConnectors = input(true, { transform: booleanAttribute });\n\n /** Printed above the plot as the visible title, and reused as the annex table's caption. */\n readonly caption = input<string | null>(null);\n\n /** The accessible name. Generated from the steps when omitted, naming each one's direction in\n * words and the figure the chain ends at. */\n readonly summary = input<string | null>(null);\n\n /** A hint, not a count. Ticks snap to a round step. */\n readonly tickCount = input(5, { transform: numberAttribute });\n\n /** Turns on the click affordance and the keyboard route. `barClicked` fires whether or not\n * this is set. */\n readonly interactive = input(false, { transform: booleanAttribute });\n\n /** `'auto'` draws the bordered, padded box; `'none'` leaves it bare for a chart inside a card\n * the page has already drawn. Unset falls back to `DS_CONFIG.chart.frame`. */\n readonly frame = input<ChartFrame | null>(null);\n\n /** The annex table under the plot. Unset falls back to `DS_CONFIG.chart.dataTable`, then\n * `'none'`. It prints each step's direction, its own reading and the running total. */\n readonly dataTable = input<ChartDataTable | null>(null);\n\n /** Skeleton bars at the real count, so the page does not resize when the data lands. */\n readonly loading = input(false, { transform: booleanAttribute });\n\n /** Separate from an empty `data`: \"the request failed\" and \"there is nothing to show\" read the\n * same and mean opposite things. */\n readonly error = input(false, { transform: booleanAttribute });\n\n /** Shown in place of the plot when `data` is empty. Unset falls back to\n * `DS_INTL.chart.empty`. */\n readonly emptyText = input<string | null>(null);\n\n /** Shown in place of the plot while `error` is set. Unset falls back to\n * `DS_INTL.chart.error`. */\n readonly errorText = input<string | null>(null);\n\n /** Formats every value the chart prints - the axis ticks, the bar labels and the annex table.\n * The sign a delta carries is added around it, so a formatter never has to know about one. */\n readonly valueFormat = input<ChartValueFormat | null>(null);\n\n /** The clicked datum, as it was given. Fires on click and on Enter or Space. */\n readonly barClicked = output<WaterfallChartBar>();\n\n private readonly defaults = resolveChartDefaults(this);\n protected readonly intl = inject(DS_INTL);\n readonly frameResolved = this.defaults.frame;\n readonly dataTableResolved = this.defaults.dataTable;\n readonly emptyTextResolved = this.defaults.emptyText;\n readonly errorTextResolved = this.defaults.errorText;\n readonly valueFormatResolved = this.defaults.valueFormat;\n\n protected readonly isEmpty = computed(() => this.data().length === 0);\n\n protected readonly steps = computed(() => waterfallSteps(this.data()));\n\n protected readonly categories = computed(() =>\n this.steps().map((step) => step.label),\n );\n\n protected readonly offsets = computed(() =>\n this.steps().map((step) => ({ from: step.from, to: step.to })),\n );\n\n /** What each bar's label prints: a delta's own change, a total's running sum. The two are\n * different readings and only one of them takes a sign. */\n protected readonly labelValues = computed(() =>\n this.steps().map((step, index) =>\n step.direction === 'total' ? step.to : (this.data()[index]?.value ?? 0),\n ),\n );\n\n protected readonly points = computed<readonly ColumnSeriesPoint[]>(() => {\n const format = this.valueFormatResolved();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => {\n const datum = this.data()[index];\n const reading = values[index];\n const sign = step.direction === 'increase' && reading > 0 ? '+' : '';\n\n return {\n id: datum?.id ?? String(index),\n // The word is what carries the meaning where colour cannot - forced colours, a monochrome\n // print, a reader who cannot tell the two hues apart, and every screen reader.\n label: `${step.label}, ${this.intl().chart[step.direction]} ${sign}${format(reading, 'tooltip')}`,\n value: reading,\n color: DIRECTION_COLORS[step.direction],\n };\n });\n });\n\n protected readonly accessibleName = computed(() => {\n const given = this.summary();\n if (given) {\n return given;\n }\n const words = this.intl().chart;\n const steps = this.steps();\n if (steps.length === 0) {\n return this.caption() ?? words.waterfallTitle;\n }\n const format = this.valueFormatResolved();\n const last = steps[steps.length - 1];\n const spoken = steps\n .map(\n (step, index) =>\n `${step.label} ${words[step.direction]} ${format(this.labelValues()[index], 'tooltip')}`,\n )\n .join(', ');\n\n return `${this.caption() ?? words.waterfallCaption}: ${spoken}. ${words.endsAt(format(last.to, 'tooltip'))}`;\n });\n\n protected readonly dataTableRows = computed<readonly ChartDataRow[]>(() =>\n this.tableRows().map((row) => ({\n key: row.key,\n cells: [\n row.label,\n row.direction,\n row.formattedValue,\n row.formattedRunningTotal,\n ],\n })),\n );\n\n protected readonly tableRows = computed(() => {\n const format = this.valueFormatResolved();\n const values = this.labelValues();\n\n return this.steps().map((step, index) => ({\n key: `${index}-${step.label}`,\n label: step.label,\n direction: this.intl().chart[step.direction],\n formattedValue: format(values[index], 'tooltip'),\n formattedRunningTotal: format(step.to, 'tooltip'),\n }));\n });\n\n protected readonly skeletonBars = computed(() =>\n Array.from({ length: Math.max(this.data().length, 5) }),\n );\n\n protected onPointClicked(point: ColumnSeriesPoint): void {\n const datum = this.data().find(\n (entry, index) => (entry.id ?? String(index)) === point.id,\n );\n if (datum) {\n this.barClicked.emit(datum);\n }\n }\n}\n","<figure class=\"waterfall-chart\">\n @if (caption()) {\n <figcaption>\n {{ caption() }}\n </figcaption>\n }\n\n @if (error()) {\n <p\n class=\"empty is-error\"\n role=\"status\">\n {{ errorTextResolved() }}\n </p>\n } @else if (loading() || !renderReady()) {\n <div\n class=\"skeleton\"\n aria-hidden=\"true\">\n @for (placeholder of skeletonBars(); track $index) {\n <ds-skeleton height=\"var(--_waterfall-chart-skeleton-height)\" [shimmer]=\"loading()\" />\n }\n </div>\n } @else if (isEmpty()) {\n <p class=\"empty\">\n {{ emptyTextResolved() }}\n </p>\n } @else {\n <ds-chart\n frame=\"none\"\n [categories]=\"categories()\"\n [tickCount]=\"tickCount()\"\n [valueFormat]=\"valueFormatResolved()\"\n [interactive]=\"interactive()\"\n [summary]=\"accessibleName()\">\n <svg:g\n dsWaterfallMarks\n [steps]=\"steps()\"\n [labelValues]=\"labelValues()\"\n [showValues]=\"showValues()\"\n [showConnectors]=\"showConnectors()\"\n [valueFormat]=\"valueFormatResolved()\" />\n\n <svg:g\n dsColumnSeries\n showValues=\"false\"\n [data]=\"points()\"\n [offsets]=\"offsets()\"\n [interactive]=\"interactive()\"\n [valueFormat]=\"valueFormatResolved()\"\n (pointClicked)=\"onPointClicked($event)\" />\n </ds-chart>\n\n @if (dataTableResolved() !== 'none') {\n <ds-chart-data-table\n [columns]=\"[\n intl().chart.stepColumn,\n intl().chart.directionColumn,\n intl().chart.valueColumn,\n intl().chart.runningTotalColumn,\n ]\"\n [rows]=\"dataTableRows()\"\n [caption]=\"caption()\"\n [open]=\"dataTableResolved() === 'visible'\" />\n }\n }\n</figure>\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAKA;;;;;;;AAOgB;AACV,SAAU,cAAc,CAC5B,IAAkC,EAAA;IAElC,IAAI,OAAO,GAAG,CAAC;AAEf,IAAA,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAI;QACxB,MAAM,IAAI,GAAG,OAAO;QACpB,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,GAAG,CAAC;QAC5D,OAAO,IAAI,KAAK;AAChB,QAAA,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU;QAExE,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,YAAY,GAAG,CAAC,GAAG,IAAI;AAC7B,YAAA,EAAE,EAAE,OAAO;AACX,YAAA,SAAS,EAAE,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG,CAAC,GAAG,UAAU,GAAG,UAAU;SACxE;AACH,IAAA,CAAC,CAAC;AACJ;;AClBA;AACA,MAAM,eAAe,GAAG,CAAC;AAEzB;;;;;;;;;;;;AAYG;MAYU,uBAAuB,CAAA;AACjB,IAAA,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;AAErC,IAAA,KAAK,GAAG,KAAK,CAAgC,EAAE,4EAAC;;AAGhD,IAAA,WAAW,GAAG,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AAA,SAAA,CAAA,EAAA,CAAA,EAAA,aAAA,EASV,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA;;4FAE3D,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBApBnC,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,oBAAoB,EAAA,UAAA,EAClB,IAAI,EAAA,QAAA,EACN,kBAAkB,EAAA,OAAA,EACnB;wBACP,cAAc;wBACd,qBAAqB;wBACrB,iBAAiB;wBACjB,uBAAuB;wBACvB,uBAAuB;qBACxB,EAAA,IAAA,EAGK;AACJ,wBAAA,gBAAgB,EAAE,4BAA4B;AAC/C,qBAAA,EAAA,aAAA,EACc,iBAAiB,CAAC,QAAQ,mBACxB,uBAAuB,CAAC,MAAM,EAAA,aAAA,EAChC,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAA,QAAA,EAAA,qzDAAA,EAAA,MAAA,EAAA,CAAA,++GAAA,CAAA,EAAA;;;AEvExE;;AAEG;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, computed, signal, PLATFORM_ID, DestroyRef, untracked, afterRenderEffect, TemplateRef, Directive, Injector,
|
|
3
|
-
import { DS_CONFIG, resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
|
|
2
|
+
import { inject, computed, signal, PLATFORM_ID, DestroyRef, InjectionToken, ElementRef, afterNextRender, NgZone, untracked, afterRenderEffect, TemplateRef, Directive, Injector, isDevMode, input, booleanAttribute, effect, DOCUMENT } from '@angular/core';
|
|
3
|
+
import { DS_CONFIG, DS_INTL, injectDsLocale, resolveWithConfig } from '@ids-group-ltd/ids-design-system/core';
|
|
4
4
|
import { isPlatformBrowser } from '@angular/common';
|
|
5
5
|
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { NgForm, FormGroupDirective, NgControl } from '@angular/forms';
|
|
@@ -105,39 +105,64 @@ function formatValue(value, locale) {
|
|
|
105
105
|
}
|
|
106
106
|
return numberFormatter(locale).format(value);
|
|
107
107
|
}
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
const chartFormats = new Map();
|
|
109
|
+
/** The built-in `valueFormat` in one locale: compact on a tick (`1.2M`), spelled out everywhere
|
|
110
|
+
* else (`1,248,392`). A caller-supplied formatter receives the same `location` and decides for
|
|
110
111
|
* itself; this is only the default.
|
|
111
112
|
*
|
|
112
113
|
* @internal */
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
function chartValueFormat(locale) {
|
|
115
|
+
let format = chartFormats.get(locale);
|
|
116
|
+
if (!format) {
|
|
117
|
+
const compact = new Intl.NumberFormat(locale, {
|
|
118
|
+
notation: 'compact',
|
|
119
|
+
maximumFractionDigits: 1,
|
|
120
|
+
});
|
|
121
|
+
const full = new Intl.NumberFormat(locale);
|
|
122
|
+
format = (value, location) => !Number.isFinite(value)
|
|
123
|
+
? '—'
|
|
124
|
+
: location === 'tick'
|
|
125
|
+
? compact.format(value)
|
|
126
|
+
: full.format(value);
|
|
127
|
+
chartFormats.set(locale, format);
|
|
128
|
+
}
|
|
129
|
+
return format;
|
|
130
|
+
}
|
|
131
|
+
const percentFormatters = new Map();
|
|
132
|
+
function percentFormatter(locale, digits) {
|
|
133
|
+
const key = `${locale}|${digits}`;
|
|
134
|
+
let formatter = percentFormatters.get(key);
|
|
135
|
+
if (!formatter) {
|
|
136
|
+
formatter = new Intl.NumberFormat(locale, {
|
|
137
|
+
style: 'percent',
|
|
138
|
+
minimumFractionDigits: digits,
|
|
139
|
+
maximumFractionDigits: digits,
|
|
140
|
+
});
|
|
141
|
+
percentFormatters.set(key, formatter);
|
|
116
142
|
}
|
|
117
|
-
return
|
|
118
|
-
? compactFormatter().format(value)
|
|
119
|
-
: numberFormatter(undefined).format(value);
|
|
120
|
-
}
|
|
121
|
-
let cachedCompactFormatter = null;
|
|
122
|
-
function compactFormatter() {
|
|
123
|
-
cachedCompactFormatter ??= new Intl.NumberFormat(undefined, {
|
|
124
|
-
notation: 'compact',
|
|
125
|
-
maximumFractionDigits: 1,
|
|
126
|
-
});
|
|
127
|
-
return cachedCompactFormatter;
|
|
143
|
+
return formatter;
|
|
128
144
|
}
|
|
129
145
|
/** @internal */
|
|
130
|
-
function formatPercent(value, total) {
|
|
146
|
+
function formatPercent(value, total, locale) {
|
|
131
147
|
if (!total || !Number.isFinite(value) || !Number.isFinite(total)) {
|
|
132
148
|
return '—';
|
|
133
149
|
}
|
|
134
|
-
const
|
|
150
|
+
const fraction = value / total;
|
|
151
|
+
const formatter = percentFormatter(locale, 1);
|
|
135
152
|
// A real share must never print as an exact zero: at one decimal, 214 of 987,654,321 rounds to
|
|
136
153
|
// "0.0%" beside a bar too short to see, and the row reads as nothing when it is not nothing.
|
|
137
|
-
if (
|
|
138
|
-
return
|
|
154
|
+
if (fraction !== 0 && Math.abs(fraction) < 0.0005) {
|
|
155
|
+
return fraction > 0
|
|
156
|
+
? `<${formatter.format(0.001)}`
|
|
157
|
+
: `>${formatter.format(-0.001)}`;
|
|
139
158
|
}
|
|
140
|
-
return
|
|
159
|
+
return formatter.format(fraction);
|
|
160
|
+
}
|
|
161
|
+
/** A whole-number percentage (the pie's largest-remainder shares), in `locale`.
|
|
162
|
+
*
|
|
163
|
+
* @internal */
|
|
164
|
+
function formatWholePercent(percent, locale) {
|
|
165
|
+
return percentFormatter(locale, 0).format(percent / 100);
|
|
141
166
|
}
|
|
142
167
|
/** Whole percentages that sum to exactly 100. Rounding each share on its own
|
|
143
168
|
* gives 33/33/33 for three equal parts, and a legend that visibly loses 1%.
|
|
@@ -196,7 +221,7 @@ function formatTick(value, step) {
|
|
|
196
221
|
* rather than subtracted from it, so a negative mark has no share rather than a misleading one.
|
|
197
222
|
*
|
|
198
223
|
* @internal */
|
|
199
|
-
function shareOfTotal(values, index) {
|
|
224
|
+
function shareOfTotal(values, index, locale) {
|
|
200
225
|
const value = values[index];
|
|
201
226
|
if (values.length < 2 || !Number.isFinite(value) || value <= 0) {
|
|
202
227
|
return '';
|
|
@@ -204,15 +229,15 @@ function shareOfTotal(values, index) {
|
|
|
204
229
|
const total = values
|
|
205
230
|
.filter((entry) => Number.isFinite(entry) && entry > 0)
|
|
206
231
|
.reduce((sum, entry) => sum + entry, 0);
|
|
207
|
-
return total > 0 ? formatPercent(value, total) : '';
|
|
232
|
+
return total > 0 ? formatPercent(value, total, locale) : '';
|
|
208
233
|
}
|
|
209
234
|
/** The same share, phrased for a tooltip line, where no column header stands above it to say what
|
|
210
235
|
* the percentage is OF.
|
|
211
236
|
*
|
|
212
237
|
* @internal */
|
|
213
|
-
function describeShare(values, index) {
|
|
214
|
-
const share = shareOfTotal(values, index);
|
|
215
|
-
return share ?
|
|
238
|
+
function describeShare(values, index, locale, phrase) {
|
|
239
|
+
const share = shareOfTotal(values, index, locale);
|
|
240
|
+
return share ? phrase(share) : '';
|
|
216
241
|
}
|
|
217
242
|
|
|
218
243
|
/** Container width as a signal. It is 0 under SSR, while the container is
|
|
@@ -234,16 +259,166 @@ function elementWidth(host) {
|
|
|
234
259
|
return width.asReadonly();
|
|
235
260
|
}
|
|
236
261
|
const widths = new WeakMap();
|
|
237
|
-
let observer = null;
|
|
262
|
+
let observer$1 = null;
|
|
238
263
|
// One observer for every chart on the page, so a resize is one callback with every entry in it
|
|
239
264
|
// rather than one callback per chart.
|
|
240
265
|
function sharedObserver() {
|
|
241
|
-
observer ??= new ResizeObserver((entries) => {
|
|
266
|
+
observer$1 ??= new ResizeObserver((entries) => {
|
|
242
267
|
for (const entry of entries) {
|
|
243
268
|
widths.get(entry.target)?.set(Math.round(entry.contentRect.width));
|
|
244
269
|
}
|
|
245
270
|
});
|
|
246
|
-
return observer;
|
|
271
|
+
return observer$1;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/** Provided by a chart that has already waited for the viewport, so the `ds-chart` it draws
|
|
275
|
+
* through builds at once instead of waiting a second time.
|
|
276
|
+
*
|
|
277
|
+
* @internal */
|
|
278
|
+
const CHART_RENDER_GATE_PASSED = new InjectionToken('CHART_RENDER_GATE_PASSED');
|
|
279
|
+
const builders = new WeakMap();
|
|
280
|
+
const near = new Map();
|
|
281
|
+
const ahead = new Map();
|
|
282
|
+
const observers = new Map();
|
|
283
|
+
let draining = false;
|
|
284
|
+
let idleScheduled = false;
|
|
285
|
+
let budgetMs = 8;
|
|
286
|
+
function drain() {
|
|
287
|
+
const start = performance.now();
|
|
288
|
+
for (const [host, build] of near) {
|
|
289
|
+
if (performance.now() - start > budgetMs) {
|
|
290
|
+
setTimeout(drain);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
near.delete(host);
|
|
294
|
+
build();
|
|
295
|
+
}
|
|
296
|
+
draining = false;
|
|
297
|
+
}
|
|
298
|
+
// An idle period with less than this left would run a chart's build into the next frame.
|
|
299
|
+
const IDLE_ROOM_MS = 12;
|
|
300
|
+
function buildWhileIdle(deadline) {
|
|
301
|
+
idleScheduled = false;
|
|
302
|
+
for (const [host, build] of ahead) {
|
|
303
|
+
if (deadline.timeRemaining() < IDLE_ROOM_MS) {
|
|
304
|
+
break;
|
|
305
|
+
}
|
|
306
|
+
ahead.delete(host);
|
|
307
|
+
build();
|
|
308
|
+
}
|
|
309
|
+
scheduleIdle();
|
|
310
|
+
}
|
|
311
|
+
function scheduleIdle() {
|
|
312
|
+
if (idleScheduled ||
|
|
313
|
+
!ahead.size ||
|
|
314
|
+
typeof requestIdleCallback === 'undefined') {
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
idleScheduled = true;
|
|
318
|
+
requestIdleCallback(buildWhileIdle);
|
|
319
|
+
}
|
|
320
|
+
function observer(root, margin, queue, schedule) {
|
|
321
|
+
let byMargin = observers.get(root);
|
|
322
|
+
if (!byMargin) {
|
|
323
|
+
byMargin = new Map();
|
|
324
|
+
observers.set(root, byMargin);
|
|
325
|
+
}
|
|
326
|
+
const key = `${queue === near ? 'near' : 'ahead'} ${margin}`;
|
|
327
|
+
let found = byMargin.get(key);
|
|
328
|
+
if (!found) {
|
|
329
|
+
found = new IntersectionObserver((entries) => {
|
|
330
|
+
for (const entry of entries) {
|
|
331
|
+
const build = builders.get(entry.target);
|
|
332
|
+
// A chart the reader has already scrolled past leaves the queue instead of being built
|
|
333
|
+
// behind them.
|
|
334
|
+
if (build && entry.isIntersecting) {
|
|
335
|
+
queue.set(entry.target, build);
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
queue.delete(entry.target);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
schedule();
|
|
342
|
+
}, { root, rootMargin: margin });
|
|
343
|
+
byMargin.set(key, found);
|
|
344
|
+
}
|
|
345
|
+
return found;
|
|
346
|
+
}
|
|
347
|
+
function scheduleDrain() {
|
|
348
|
+
if (near.size && !draining) {
|
|
349
|
+
draining = true;
|
|
350
|
+
setTimeout(drain);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// A margin on the root only widens the root: an element inside a scrolling container is clipped by
|
|
354
|
+
// that container first, so the container has to BE the root for the margin to reach past its edge.
|
|
355
|
+
// The overflow test alone is not enough - a box that only scrolls sideways computes `overflow-y:
|
|
356
|
+
// auto` too - so the container also has to be taller inside than out.
|
|
357
|
+
function scrollRoot(host) {
|
|
358
|
+
for (let node = host.parentElement; node; node = node.parentElement) {
|
|
359
|
+
const overflow = getComputedStyle(node).overflowY;
|
|
360
|
+
if ((overflow === 'auto' ||
|
|
361
|
+
overflow === 'scroll' ||
|
|
362
|
+
overflow === 'overlay') &&
|
|
363
|
+
node.scrollHeight > node.clientHeight) {
|
|
364
|
+
return node;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
/** Whether a chart may build its plot yet, under `DS_CONFIG.chart.rendering`. `true` from the
|
|
370
|
+
* start unless `deferUntilVisible` is on; with it on, `true` once the chart nears the viewport or
|
|
371
|
+
* is built ahead while the page is idle, and it stays `true`. Call from an injection context.
|
|
372
|
+
*
|
|
373
|
+
* @internal */
|
|
374
|
+
function chartRenderGate() {
|
|
375
|
+
const rendering = inject(DS_CONFIG).chart?.rendering;
|
|
376
|
+
// `skipSelf`: a preset provides the token to its own view, and must not read it back itself.
|
|
377
|
+
const passed = inject(CHART_RENDER_GATE_PASSED, {
|
|
378
|
+
optional: true,
|
|
379
|
+
skipSelf: true,
|
|
380
|
+
});
|
|
381
|
+
if (!rendering?.deferUntilVisible ||
|
|
382
|
+
passed ||
|
|
383
|
+
!isPlatformBrowser(inject(PLATFORM_ID)) ||
|
|
384
|
+
typeof IntersectionObserver === 'undefined') {
|
|
385
|
+
return signal(true).asReadonly();
|
|
386
|
+
}
|
|
387
|
+
const ready = signal(false, ...(ngDevMode ? [{ debugName: "ready" }] : /* istanbul ignore next */ []));
|
|
388
|
+
const host = inject(ElementRef).nativeElement;
|
|
389
|
+
budgetMs = rendering.frameBudgetMs ?? budgetMs;
|
|
390
|
+
const skipWhileOffscreen = rendering.skipWhileOffscreen ?? true;
|
|
391
|
+
let release = () => undefined;
|
|
392
|
+
afterNextRender(() => {
|
|
393
|
+
const root = scrollRoot(host);
|
|
394
|
+
const watchers = [
|
|
395
|
+
observer(root, rendering.visibleMargin ?? '10% 0px', near, scheduleDrain),
|
|
396
|
+
];
|
|
397
|
+
if (rendering.buildAheadWhileIdle ?? true) {
|
|
398
|
+
watchers.push(observer(root, rendering.buildAheadMargin ?? '100% 0px', ahead, scheduleIdle));
|
|
399
|
+
}
|
|
400
|
+
release = () => {
|
|
401
|
+
for (const watcher of watchers) {
|
|
402
|
+
watcher.unobserve(host);
|
|
403
|
+
}
|
|
404
|
+
near.delete(host);
|
|
405
|
+
ahead.delete(host);
|
|
406
|
+
};
|
|
407
|
+
builders.set(host, () => {
|
|
408
|
+
release();
|
|
409
|
+
if (skipWhileOffscreen) {
|
|
410
|
+
// `auto` remembers the height the chart last rendered at, so skipping it moves nothing.
|
|
411
|
+
host.style.contentVisibility = 'auto';
|
|
412
|
+
host.style.containIntrinsicBlockSize = 'auto 300px';
|
|
413
|
+
}
|
|
414
|
+
ready.set(true);
|
|
415
|
+
});
|
|
416
|
+
for (const watcher of watchers) {
|
|
417
|
+
watcher.observe(host);
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
inject(DestroyRef).onDestroy(() => release());
|
|
421
|
+
return ready.asReadonly();
|
|
247
422
|
}
|
|
248
423
|
|
|
249
424
|
/** A label turned 45 degrees takes this fraction of its width across the axis. 45 is where the
|
|
@@ -766,8 +941,7 @@ function rovingMarks(count) {
|
|
|
766
941
|
* event did not start on a mark.
|
|
767
942
|
*
|
|
768
943
|
* @internal */
|
|
769
|
-
function markOf(event) {
|
|
770
|
-
const scope = event.currentTarget;
|
|
944
|
+
function markOf(event, scope = event.currentTarget) {
|
|
771
945
|
const target = event.target;
|
|
772
946
|
if (!(scope instanceof Element) || !(target instanceof Element)) {
|
|
773
947
|
return null;
|
|
@@ -778,43 +952,74 @@ function markOf(event) {
|
|
|
778
952
|
}
|
|
779
953
|
return { element, index: Number(element.getAttribute('data-mark-index')) };
|
|
780
954
|
}
|
|
955
|
+
/** Focus arriving on and leaving a mark inside `scope`, heard from the document rather than from
|
|
956
|
+
* the marks' group: Chromium makes an SVG element focusable once it has a `focus`, `blur`,
|
|
957
|
+
* `focusin` or `focusout` listener, so a group that listened would take focus on a click and
|
|
958
|
+
* ring every mark it holds. Call from an injection context.
|
|
959
|
+
*
|
|
960
|
+
* @internal */
|
|
961
|
+
function listenForMarkFocus(scope, onFocus, onBlur) {
|
|
962
|
+
const zone = inject(NgZone);
|
|
963
|
+
const destroyRef = inject(DestroyRef);
|
|
964
|
+
afterNextRender(() => {
|
|
965
|
+
const host = scope.nativeElement;
|
|
966
|
+
const document = host.ownerDocument;
|
|
967
|
+
const forward = (handler) => (event) => {
|
|
968
|
+
const hit = handler && markOf(event, host);
|
|
969
|
+
if (hit) {
|
|
970
|
+
handler(event, hit);
|
|
971
|
+
}
|
|
972
|
+
};
|
|
973
|
+
const focusIn = forward(onFocus);
|
|
974
|
+
const focusOut = forward(onBlur);
|
|
975
|
+
// Outside the zone: every focus change on the page reaches every series, and the handlers
|
|
976
|
+
// write signals, which schedule the render they need.
|
|
977
|
+
zone.runOutsideAngular(() => {
|
|
978
|
+
document.addEventListener('focusin', focusIn);
|
|
979
|
+
document.addEventListener('focusout', focusOut);
|
|
980
|
+
});
|
|
981
|
+
destroyRef.onDestroy(() => {
|
|
982
|
+
document.removeEventListener('focusin', focusIn);
|
|
983
|
+
document.removeEventListener('focusout', focusOut);
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
}
|
|
781
987
|
|
|
782
|
-
function trendOf(values) {
|
|
988
|
+
function trendOf(values, words) {
|
|
783
989
|
const first = values[0];
|
|
784
990
|
const last = values[values.length - 1];
|
|
785
991
|
const rose = values.every((value, index) => index === 0 || value > values[index - 1]);
|
|
786
992
|
const fell = values.every((value, index) => index === 0 || value < values[index - 1]);
|
|
787
993
|
if (rose) {
|
|
788
|
-
return
|
|
994
|
+
return words.trendRisingThroughout;
|
|
789
995
|
}
|
|
790
996
|
if (fell) {
|
|
791
|
-
return
|
|
997
|
+
return words.trendFallingThroughout;
|
|
792
998
|
}
|
|
793
999
|
if (last > first) {
|
|
794
|
-
return
|
|
1000
|
+
return words.trendRisingOverall;
|
|
795
1001
|
}
|
|
796
1002
|
if (last < first) {
|
|
797
|
-
return
|
|
1003
|
+
return words.trendFallingOverall;
|
|
798
1004
|
}
|
|
799
|
-
return
|
|
1005
|
+
return words.trendFlat;
|
|
800
1006
|
}
|
|
801
1007
|
/** Where the readings sit against each reference line, appended to the description. A line the
|
|
802
1008
|
* reader cannot see is a line that does not exist for them, and its whole point is the
|
|
803
1009
|
* comparison, not its position. */
|
|
804
|
-
function describeThresholds(thresholds, points, format) {
|
|
1010
|
+
function describeThresholds(thresholds, points, format, words) {
|
|
805
1011
|
const total = points.length;
|
|
806
|
-
const noun = total === 1 ? 'point' : 'points';
|
|
807
1012
|
return thresholds
|
|
808
1013
|
.map((threshold) => {
|
|
809
|
-
const name = threshold.label ??
|
|
1014
|
+
const name = threshold.label ?? words.threshold;
|
|
810
1015
|
if (threshold.to == null) {
|
|
811
1016
|
const above = points.filter((point) => point.value > threshold.value).length;
|
|
812
|
-
return ` ${name
|
|
1017
|
+
return ` ${words.thresholdAbove(name, format(threshold.value), above, total)}`;
|
|
813
1018
|
}
|
|
814
1019
|
const low = Math.min(threshold.value, threshold.to);
|
|
815
1020
|
const high = Math.max(threshold.value, threshold.to);
|
|
816
1021
|
const inside = points.filter((point) => point.value >= low && point.value <= high).length;
|
|
817
|
-
return ` ${name
|
|
1022
|
+
return ` ${words.thresholdInside(name, format(low), format(high), inside, total)}`;
|
|
818
1023
|
})
|
|
819
1024
|
.join('');
|
|
820
1025
|
}
|
|
@@ -827,22 +1032,20 @@ function describeThresholds(thresholds, points, format) {
|
|
|
827
1032
|
* levels of chart description, and the encoding is the one thing a screen-reader user cannot use.
|
|
828
1033
|
*
|
|
829
1034
|
* @internal */
|
|
830
|
-
function describeSeries(label, points, format = formatValue, tableFollows = true, thresholds = []) {
|
|
1035
|
+
function describeSeries(words, label, points, format = formatValue, tableFollows = true, thresholds = []) {
|
|
831
1036
|
if (points.length === 0) {
|
|
832
|
-
return
|
|
1037
|
+
return words.noData(label);
|
|
833
1038
|
}
|
|
834
|
-
const pointer = describeThresholds(thresholds, points, format) +
|
|
835
|
-
(tableFollows ?
|
|
1039
|
+
const pointer = describeThresholds(thresholds, points, format, words) +
|
|
1040
|
+
(tableFollows ? ` ${words.tableFollows}` : '');
|
|
836
1041
|
if (points.length === 1) {
|
|
837
|
-
return `${label
|
|
1042
|
+
return `${words.onePoint(label, format(points[0].value), points[0].label)}${pointer}`;
|
|
838
1043
|
}
|
|
839
1044
|
const lowest = points.reduce((min, point) => point.value < min.value ? point : min);
|
|
840
1045
|
const highest = points.reduce((max, point) => point.value > max.value ? point : max);
|
|
841
|
-
return (`${label
|
|
842
|
-
`${
|
|
843
|
-
`${
|
|
844
|
-
`Highest in ${highest.label} at ${format(highest.value)}, ` +
|
|
845
|
-
`lowest in ${lowest.label} at ${format(lowest.value)}.${pointer}`);
|
|
1046
|
+
return (`${words.range(label, points.length, format(lowest.value), format(highest.value))} ` +
|
|
1047
|
+
`${trendOf(points.map((point) => point.value), words)}. ` +
|
|
1048
|
+
`${words.extremes(highest.label, format(highest.value), lowest.label, format(lowest.value))}${pointer}`);
|
|
846
1049
|
}
|
|
847
1050
|
|
|
848
1051
|
/**
|
|
@@ -1891,9 +2094,9 @@ function dropdownOverlay(overlay, trigger, extraPanelClass = []) {
|
|
|
1891
2094
|
},
|
|
1892
2095
|
};
|
|
1893
2096
|
}
|
|
1894
|
-
//
|
|
1895
|
-
//
|
|
1896
|
-
//
|
|
2097
|
+
// The teardown guarantee for the leave: a pane that is display:none, a consumer stylesheet
|
|
2098
|
+
// that removed the animation, and a 0s reduced-motion duration (whose animationend is not
|
|
2099
|
+
// reliably delivered) all end here. Comfortably past --ds-motion-exit-duration.
|
|
1897
2100
|
const LEAVE_TIMEOUT_MS = 400;
|
|
1898
2101
|
/**
|
|
1899
2102
|
* Close a DS overlay panel — instantly on a `'select'`, with a short fade on a
|
|
@@ -2140,14 +2343,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImpo
|
|
|
2140
2343
|
* child and, worse, a region created together with its text is the case screen
|
|
2141
2344
|
* readers reliably do not announce — there is no content CHANGE to fire on. The
|
|
2142
2345
|
* node here is created once, empty, and only its text changes.
|
|
2143
|
-
*
|
|
2144
|
-
* The text is English, which is the same debt every other library-invented string
|
|
2145
|
-
* in this package carries (see the localization item in `docs/todo.md`). It is a
|
|
2146
|
-
* count, so it is the cheapest of them to swap once a provider lands.
|
|
2147
2346
|
* @internal
|
|
2148
2347
|
*/
|
|
2149
2348
|
function announceOptionCount(count, active) {
|
|
2150
2349
|
const documentRef = inject(DOCUMENT);
|
|
2350
|
+
const intl = inject(DS_INTL);
|
|
2151
2351
|
const region = documentRef.createElement('div');
|
|
2152
2352
|
region.setAttribute('aria-live', 'polite');
|
|
2153
2353
|
region.setAttribute('aria-atomic', 'true');
|
|
@@ -2162,13 +2362,7 @@ function announceOptionCount(count, active) {
|
|
|
2162
2362
|
region.textContent = '';
|
|
2163
2363
|
return;
|
|
2164
2364
|
}
|
|
2165
|
-
|
|
2166
|
-
region.textContent =
|
|
2167
|
-
total === 0
|
|
2168
|
-
? 'No results'
|
|
2169
|
-
: total === 1
|
|
2170
|
-
? '1 result'
|
|
2171
|
-
: `${total} results`;
|
|
2365
|
+
region.textContent = intl().picker.resultCount(count());
|
|
2172
2366
|
});
|
|
2173
2367
|
}
|
|
2174
2368
|
|
|
@@ -2338,16 +2532,20 @@ function createTypeAhead() {
|
|
|
2338
2532
|
|
|
2339
2533
|
const NO_DATA_TABLE = signal(null, ...(ngDevMode ? [{ debugName: "NO_DATA_TABLE" }] : /* istanbul ignore next */ []));
|
|
2340
2534
|
const NO_LINGER = signal(null, ...(ngDevMode ? [{ debugName: "NO_LINGER" }] : /* istanbul ignore next */ []));
|
|
2341
|
-
/** Each resolved input → `DS_CONFIG.chart` → the built-in
|
|
2535
|
+
/** Each resolved input → `DS_CONFIG.chart` → the built-in; copy resolves input → `DS_INTL.chart`.
|
|
2536
|
+
* Call from an injection context.
|
|
2342
2537
|
*
|
|
2343
2538
|
* @internal */
|
|
2344
2539
|
function resolveChartDefaults(inputs) {
|
|
2540
|
+
const locale = injectDsLocale();
|
|
2541
|
+
const intl = inject(DS_INTL);
|
|
2345
2542
|
return {
|
|
2543
|
+
locale,
|
|
2346
2544
|
frame: resolveWithConfig(inputs.frame, (config) => config.chart?.frame, 'auto'),
|
|
2347
2545
|
dataTable: resolveWithConfig(inputs.dataTable ?? NO_DATA_TABLE, (config) => config.chart?.dataTable, 'none'),
|
|
2348
|
-
emptyText:
|
|
2349
|
-
errorText:
|
|
2350
|
-
valueFormat: resolveWithConfig(inputs.valueFormat, (config) => config.chart?.valueFormat,
|
|
2546
|
+
emptyText: computed(() => inputs.emptyText() ?? intl().chart.empty),
|
|
2547
|
+
errorText: computed(() => inputs.errorText() ?? intl().chart.error),
|
|
2548
|
+
valueFormat: resolveWithConfig(inputs.valueFormat, (config) => config.chart?.valueFormat, chartValueFormat(locale)),
|
|
2351
2549
|
tooltipLingerMs: resolveWithConfig(inputs.tooltipLingerMs ?? NO_LINGER, (config) => config.chart?.tooltipLingerMs, 0),
|
|
2352
2550
|
};
|
|
2353
2551
|
}
|
|
@@ -2356,5 +2554,5 @@ function resolveChartDefaults(inputs) {
|
|
|
2356
2554
|
* Generated bundle index. Do not edit.
|
|
2357
2555
|
*/
|
|
2358
2556
|
|
|
2359
|
-
export { CHART_HEAT_COLORS, CHART_RAMP_COLORS, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, areaPath, bandPath, bandScale, chartColors, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget,
|
|
2557
|
+
export { CHART_HEAT_COLORS, CHART_RAMP_COLORS, CHART_RENDER_GATE_PASSED, CHART_SERIES_COLORS, DS_FIELD_WARNING_KIND, DsBooleanControlValueAccessor, DsChipTemplateDirective, DsControlValueAccessor, DsCreateTemplateDirective, DsEmptyTemplateDirective, DsFieldBase, DsGroupLabelTemplateDirective, DsMessageBase, DsOptionTemplateDirective, DsPanelFooterTemplateDirective, DsPanelHeaderTemplateDirective, DsPickerTriggerDirective, DsStaticPreview, FieldClickFocusDirective, ProjectionDroppedDirective, announceOptionCount, areaPath, bandPath, bandScale, chartColors, chartRenderGate, chartValueFormat, chipFit, clearOnDetach, closeOnOutsidePointer, closeOnScroll, createTypeAhead, decimationTarget, describeSeries, describeShare, disposeWithLeave, domainMinOf, dropdownOverlay, dsAriaCurrent, dsDestination, elementWidth, focusIsInside, focusMark, formatPercent, formatTick, formatValue, formatWholePercent, forwardOverlayTokens, labelInterval, largestRemainder, leaveMark, linePath, lineSegments, linearScale, listenForMarkFocus, lttbDecimate, markAt, markOf, minMaxDecimate, needsDecimating, nextControlId, nextRovingIndex, niceDomain, overlayPlacementOf, panelClassesOf, pointScale, polylinePoints, prepareOverlayEnter, resolveBrandValue, resolveChartDefaults, resolveFieldMessage, rotationWouldFit, roundStepAtLeast, rovingMarks, scrollActiveOptionIntoView, shareOfTotal, staggerDelay, tickStep, tickValues, trimmedText, valueControlBridge };
|
|
2360
2558
|
//# sourceMappingURL=ids-group-ltd-ids-design-system-components.mjs.map
|