@cngx/common 0.1.0-rc.7 → 0.1.0-rc.8
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/card/README.md +2 -1
- package/data/README.md +10 -1
- package/dialog/README.md +23 -1
- package/fesm2022/cngx-common-a11y.mjs +125 -111
- package/fesm2022/cngx-common-a11y.mjs.map +1 -1
- package/fesm2022/cngx-common-audio.mjs +47 -5
- package/fesm2022/cngx-common-audio.mjs.map +1 -1
- package/fesm2022/cngx-common-card.mjs +300 -46
- package/fesm2022/cngx-common-card.mjs.map +1 -1
- package/fesm2022/cngx-common-chart.mjs +1176 -453
- package/fesm2022/cngx-common-chart.mjs.map +1 -1
- package/fesm2022/cngx-common-command.mjs +37 -10
- package/fesm2022/cngx-common-command.mjs.map +1 -1
- package/fesm2022/cngx-common-data.mjs +1318 -469
- package/fesm2022/cngx-common-data.mjs.map +1 -1
- package/fesm2022/cngx-common-dialog.mjs +151 -14
- package/fesm2022/cngx-common-dialog.mjs.map +1 -1
- package/fesm2022/cngx-common-display.mjs +340 -73
- package/fesm2022/cngx-common-display.mjs.map +1 -1
- package/fesm2022/cngx-common-interactive.mjs +1744 -952
- package/fesm2022/cngx-common-interactive.mjs.map +1 -1
- package/fesm2022/cngx-common-layout.mjs +841 -114
- package/fesm2022/cngx-common-layout.mjs.map +1 -1
- package/fesm2022/cngx-common-popover.mjs +350 -60
- package/fesm2022/cngx-common-popover.mjs.map +1 -1
- package/fesm2022/cngx-common-stepper.mjs +727 -317
- package/fesm2022/cngx-common-stepper.mjs.map +1 -1
- package/fesm2022/cngx-common-tabs.mjs +1601 -1243
- package/fesm2022/cngx-common-tabs.mjs.map +1 -1
- package/fesm2022/cngx-common-timeline.mjs +137 -53
- package/fesm2022/cngx-common-timeline.mjs.map +1 -1
- package/fesm2022/cngx-common.mjs +1 -1
- package/interactive/README.md +15 -4
- package/layout/README.md +21 -1
- package/package.json +3 -3
- package/popover/README.md +18 -2
- package/stepper/README.md +6 -4
- package/theming/components/cngx-accordion.css +1 -1
- package/theming/components/cngx-backdrop.css +12 -0
- package/theming/components/cngx-button-toggle.css +29 -3
- package/theming/components/cngx-data-grid.css +168 -1
- package/theming/components/cngx-dialog.css +13 -0
- package/theming/components/cngx-listbox.css +21 -12
- package/theming/components/cngx-menu.css +56 -16
- package/theming/components/cngx-popover.css +24 -0
- package/theming/components/cngx-recycler-placeholder.css +196 -0
- package/theming/components/cngx-ripple.css +1 -1
- package/theming/components/cngx-slider.css +32 -1
- package/theming/components/cngx-tooltip.css +12 -0
- package/timeline/README.md +155 -0
- package/types/cngx-common-a11y.d.ts +42 -18
- package/types/cngx-common-card.d.ts +201 -17
- package/types/cngx-common-chart.d.ts +343 -47
- package/types/cngx-common-command.d.ts +31 -8
- package/types/cngx-common-data.d.ts +581 -68
- package/types/cngx-common-dialog.d.ts +158 -3
- package/types/cngx-common-display.d.ts +356 -142
- package/types/cngx-common-interactive.d.ts +859 -210
- package/types/cngx-common-layout.d.ts +567 -28
- package/types/cngx-common-popover.d.ts +262 -39
- package/types/cngx-common-stepper.d.ts +366 -116
- package/types/cngx-common-tabs.d.ts +214 -50
- package/types/cngx-common-timeline.d.ts +82 -16
|
@@ -4,7 +4,9 @@ import { NgTemplateOutlet } from '@angular/common';
|
|
|
4
4
|
import * as i1 from '@cngx/common/layout';
|
|
5
5
|
import { CngxResizeObserver } from '@cngx/common/layout';
|
|
6
6
|
import { resolveAsyncView } from '@cngx/common/data';
|
|
7
|
-
import { nextUid } from '@cngx/core/utils';
|
|
7
|
+
import { numberFormatterFor, createOverrideMerge, nextUid, injectLocale, createMediaQuerySignal, createTransitionTracker, dateTimeFormatterFor } from '@cngx/core/utils';
|
|
8
|
+
import { formatMessage, createLanguageSection, createSectionBundle } from '@cngx/core/i18n';
|
|
9
|
+
import { clamp, arrayEqual } from '@cngx/utils';
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
12
|
* Pure-TS linear scale. Maps a numeric domain `[d0, d1]` to a numeric
|
|
@@ -69,7 +71,10 @@ function createBandScale(domain, range, padding = 0) {
|
|
|
69
71
|
const n = domain.length;
|
|
70
72
|
const span = r1 - r0;
|
|
71
73
|
const slot = n === 0 ? 0 : span / n;
|
|
72
|
-
|
|
74
|
+
// Clamp to the documented [0, 1) contract: padding >= 1 would flip
|
|
75
|
+
// the bandwidth negative and a negative padding would overlap bands.
|
|
76
|
+
const p = Math.min(Math.max(padding, 0), 1);
|
|
77
|
+
const inner = slot * (1 - p);
|
|
73
78
|
const offset = (slot - inner) / 2;
|
|
74
79
|
const lookup = new Map();
|
|
75
80
|
for (let i = 0; i < n; i++) {
|
|
@@ -388,6 +393,12 @@ function injectChartBuffer(opts) {
|
|
|
388
393
|
if (rafHandle !== null) {
|
|
389
394
|
return;
|
|
390
395
|
}
|
|
396
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
397
|
+
// SSR / non-browser: there is no frame to coalesce onto, so flush
|
|
398
|
+
// synchronously instead of dropping the push on the floor.
|
|
399
|
+
flush();
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
391
402
|
pending.set(true);
|
|
392
403
|
rafHandle = requestAnimationFrame(flush);
|
|
393
404
|
}
|
|
@@ -452,8 +463,13 @@ const CNGX_CHART_CONTEXT = new InjectionToken('CngxChartContext');
|
|
|
452
463
|
* error message so the consumer-class name surfaces at the call site
|
|
453
464
|
* rather than a generic guard string.
|
|
454
465
|
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
466
|
+
* Use it from custom layer directives mounted on `<svg:g>` hosts to
|
|
467
|
+
* read `plot`, the scales and `renderSvg` the same way the built-in
|
|
468
|
+
* layer atoms do.
|
|
469
|
+
*
|
|
470
|
+
* @category common/chart
|
|
471
|
+
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/chart/chart-context.ts
|
|
472
|
+
* @since 0.1.0
|
|
457
473
|
*/
|
|
458
474
|
function injectChartContext(consumerName) {
|
|
459
475
|
const ctx = inject(CNGX_CHART_CONTEXT, { optional: true });
|
|
@@ -505,6 +521,7 @@ class CngxThreshold {
|
|
|
505
521
|
value = input.required(...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
506
522
|
label = input(null, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
507
523
|
dashed = input(false, ...(ngDevMode ? [{ debugName: "dashed" }] : /* istanbul ignore next */ []));
|
|
524
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
508
525
|
ctx = injectChartContext('CngxThreshold');
|
|
509
526
|
bounds = computed(() => {
|
|
510
527
|
// Spans the plot, not the box - a threshold line running under
|
|
@@ -526,12 +543,12 @@ class CngxThreshold {
|
|
|
526
543
|
y1: y,
|
|
527
544
|
x2: b?.x2 ?? 0,
|
|
528
545
|
y2: y,
|
|
529
|
-
color:
|
|
546
|
+
color: this.color(),
|
|
530
547
|
dashed: this.dashed(),
|
|
531
548
|
};
|
|
532
549
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: thresholdGeomEqual });
|
|
533
550
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxThreshold, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
534
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxThreshold, isStandalone: true, selector: "[cngxThreshold]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dashed: { classPropertyName: "dashed", publicName: "dashed", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxThreshold }], exportAs: ["cngxThreshold"], ngImport: i0, template: `
|
|
551
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxThreshold, isStandalone: true, selector: "[cngxThreshold]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dashed: { classPropertyName: "dashed", publicName: "dashed", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxThreshold }], exportAs: ["cngxThreshold"], ngImport: i0, template: `
|
|
535
552
|
@if (bounds(); as g) {
|
|
536
553
|
@if (ctx.renderSvg()) {
|
|
537
554
|
<svg:line
|
|
@@ -540,6 +557,7 @@ class CngxThreshold {
|
|
|
540
557
|
[attr.y1]="g.y"
|
|
541
558
|
[attr.x2]="g.x2"
|
|
542
559
|
[attr.y2]="g.y"
|
|
560
|
+
[style.stroke]="color()"
|
|
543
561
|
[attr.stroke-dasharray]="dashed() ? '4 3' : null"
|
|
544
562
|
/>
|
|
545
563
|
}
|
|
@@ -561,7 +579,7 @@ class CngxThreshold {
|
|
|
561
579
|
</svg:text>
|
|
562
580
|
}
|
|
563
581
|
}
|
|
564
|
-
`, isInline: true, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
582
|
+
`, isInline: true, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}@media(forced-colors:active){.cngx-threshold__line{stroke:CanvasText!important}.cngx-threshold__label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
565
583
|
}
|
|
566
584
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxThreshold, decorators: [{
|
|
567
585
|
type: Component,
|
|
@@ -574,6 +592,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
574
592
|
[attr.y1]="g.y"
|
|
575
593
|
[attr.x2]="g.x2"
|
|
576
594
|
[attr.y2]="g.y"
|
|
595
|
+
[style.stroke]="color()"
|
|
577
596
|
[attr.stroke-dasharray]="dashed() ? '4 3' : null"
|
|
578
597
|
/>
|
|
579
598
|
}
|
|
@@ -595,8 +614,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
595
614
|
</svg:text>
|
|
596
615
|
}
|
|
597
616
|
}
|
|
598
|
-
`, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}\n"] }]
|
|
599
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dashed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashed", required: false }] }] } });
|
|
617
|
+
`, styles: [".cngx-threshold__line{stroke:var(--cngx-threshold-color, var(--cngx-chart-danger, currentColor));stroke-width:var(--cngx-threshold-stroke-width, 1px);fill:none;animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-threshold__label{fill:var(--cngx-threshold-text-color, var(--cngx-chart-danger, currentColor));font-size:var(--cngx-threshold-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-threshold-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-threshold-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-threshold__line,.cngx-threshold__label{animation:none}}@media(forced-colors:active){.cngx-threshold__line{stroke:CanvasText!important}.cngx-threshold__label{fill:CanvasText}}\n"] }]
|
|
618
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], dashed: [{ type: i0.Input, args: [{ isSignal: true, alias: "dashed", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
600
619
|
/** @internal */
|
|
601
620
|
function thresholdGeomEqual(a, b) {
|
|
602
621
|
if (a === b) {
|
|
@@ -613,9 +632,146 @@ function thresholdGeomEqual(a, b) {
|
|
|
613
632
|
a.dashed === b.dashed);
|
|
614
633
|
}
|
|
615
634
|
|
|
635
|
+
const FRACTION_OPTIONS = {
|
|
636
|
+
maximumSignificantDigits: 12,
|
|
637
|
+
useGrouping: false,
|
|
638
|
+
};
|
|
639
|
+
const INTEGER_OPTIONS = {
|
|
640
|
+
maximumFractionDigits: 0,
|
|
641
|
+
useGrouping: false,
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Strip floating-point arithmetic noise from a number destined for
|
|
645
|
+
* human-facing text and format it in `locale`: `6.6000000000000005`
|
|
646
|
+
* becomes `'6.6'` (`'6,6'` in `de`), `2.2` stays `'2.2'`, `25` stays
|
|
647
|
+
* `'25'`. 12 significant digits keep every sensible chart value intact
|
|
648
|
+
* while collapsing the trailing 1e-15 noise accumulated float math
|
|
649
|
+
* produces; integers keep every digit. No grouping, so en-US output
|
|
650
|
+
* matches the plain `String(v)` it replaced for every value `String`
|
|
651
|
+
* prints without an exponent; exponential magnitudes print positionally
|
|
652
|
+
* instead (`1e-7` -> `0.0000001`, `1e21` -> 22 digits). Non-finite values
|
|
653
|
+
* format in `locale` too (`∞`, `-∞`, `NaN`), never as the English
|
|
654
|
+
* `Infinity`.
|
|
655
|
+
*
|
|
656
|
+
* Shared by the default axis tick formatter, the default i18n summary
|
|
657
|
+
* and the SR data table, so all three read the same value the same way.
|
|
658
|
+
*
|
|
659
|
+
* @internal
|
|
660
|
+
*/
|
|
661
|
+
function formatChartNumber(v, locale) {
|
|
662
|
+
const options = Number.isInteger(v) ? INTEGER_OPTIONS : FRACTION_OPTIONS;
|
|
663
|
+
// Intl prints -0 as "-0"; String(-0) is "0".
|
|
664
|
+
return numberFormatterFor(locale, options).format(v === 0 ? 0 : v);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* The English chart section: the single source of the chart's English copy.
|
|
669
|
+
* `CNGX_CHART_I18N` defaults to it.
|
|
670
|
+
*
|
|
671
|
+
* @category common/chart/i18n
|
|
672
|
+
* @since 0.1.0
|
|
673
|
+
* @relatedTo CNGX_CHART_I18N
|
|
674
|
+
*/
|
|
675
|
+
const CNGX_CHART_LANGUAGE_EN = {
|
|
676
|
+
summary: '{trend}. Min {min}, max {max}, current {current}. {thresholds}',
|
|
677
|
+
summaryTrendUp: 'Trending up',
|
|
678
|
+
summaryTrendDown: 'Trending down',
|
|
679
|
+
summaryTrendFlat: 'Flat',
|
|
680
|
+
summaryNoThresholds: 'No thresholds.',
|
|
681
|
+
summaryThresholds: { one: 'One threshold crossing.', other: '{count} threshold crossings.' },
|
|
682
|
+
dataTable: 'Data table',
|
|
683
|
+
indexColumnLabel: '#',
|
|
684
|
+
valueColumnLabel: 'Value',
|
|
685
|
+
trendChangedUp: 'Trend changed to up',
|
|
686
|
+
trendChangedDown: 'Trend changed to down',
|
|
687
|
+
trendFlattened: 'Trend flattened',
|
|
688
|
+
thresholdAlert: 'Threshold {threshold} crossed',
|
|
689
|
+
connectionLost: 'Connection lost',
|
|
690
|
+
connectionReconnecting: 'Reconnecting',
|
|
691
|
+
connectionRestored: 'Connection restored',
|
|
692
|
+
empty: 'No data',
|
|
693
|
+
loading: 'Loading',
|
|
694
|
+
error: 'Error loading chart',
|
|
695
|
+
stackedBarEmpty: 'Empty stacked bar',
|
|
696
|
+
stackedBarSummary: 'Total {total}. {segments}.',
|
|
697
|
+
stackedBarSegmentTitle: '{label}: {value}',
|
|
698
|
+
listSeparator: ', ',
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
/** @internal The section word for each trend in the summary sentence. */
|
|
702
|
+
const SUMMARY_TREND_KEY = {
|
|
703
|
+
up: 'summaryTrendUp',
|
|
704
|
+
down: 'summaryTrendDown',
|
|
705
|
+
flat: 'summaryTrendFlat',
|
|
706
|
+
};
|
|
707
|
+
/** @internal The section phrase announced when the trend changes. */
|
|
708
|
+
const TREND_CHANGED_KEY = {
|
|
709
|
+
up: 'trendChangedUp',
|
|
710
|
+
down: 'trendChangedDown',
|
|
711
|
+
flat: 'trendFlattened',
|
|
712
|
+
};
|
|
713
|
+
/** @internal Turns a chart section into the token's keys for a locale. */
|
|
714
|
+
function chartBundleFrom(section, locale) {
|
|
715
|
+
const num = (v) => formatChartNumber(v, locale);
|
|
716
|
+
const segmentTitle = (label, value) => formatMessage(section.stackedBarSegmentTitle, { label, value }, locale);
|
|
717
|
+
return {
|
|
718
|
+
summary: ({ trend, min, max, current, thresholds }) => {
|
|
719
|
+
const trendText = section[SUMMARY_TREND_KEY[trend]];
|
|
720
|
+
const thresholdText = thresholds.length === 0
|
|
721
|
+
? section.summaryNoThresholds
|
|
722
|
+
: formatMessage(section.summaryThresholds, { count: thresholds.length }, locale);
|
|
723
|
+
return formatMessage(section.summary, {
|
|
724
|
+
trend: trendText,
|
|
725
|
+
min: num(min),
|
|
726
|
+
max: num(max),
|
|
727
|
+
current: num(current),
|
|
728
|
+
thresholds: thresholdText,
|
|
729
|
+
}, locale);
|
|
730
|
+
},
|
|
731
|
+
dataTable: () => section.dataTable,
|
|
732
|
+
indexColumnLabel: () => section.indexColumnLabel,
|
|
733
|
+
valueColumnLabel: () => section.valueColumnLabel,
|
|
734
|
+
trendChanged: (trend) => section[TREND_CHANGED_KEY[trend]],
|
|
735
|
+
thresholdAlert: (threshold) => formatMessage(section.thresholdAlert, { threshold: num(threshold) }, locale),
|
|
736
|
+
connectionLost: () => section.connectionLost,
|
|
737
|
+
connectionReconnecting: () => section.connectionReconnecting,
|
|
738
|
+
connectionRestored: () => section.connectionRestored,
|
|
739
|
+
empty: () => section.empty,
|
|
740
|
+
loading: () => section.loading,
|
|
741
|
+
error: () => section.error,
|
|
742
|
+
stackedBarEmpty: () => section.stackedBarEmpty,
|
|
743
|
+
stackedBarSummary: (total, segments) => formatMessage(section.stackedBarSummary, {
|
|
744
|
+
total: num(total),
|
|
745
|
+
segments: segments
|
|
746
|
+
.map((s) => segmentTitle(s.label, num(s.value)))
|
|
747
|
+
.join(section.listSeparator),
|
|
748
|
+
}, locale),
|
|
749
|
+
stackedBarSegmentTitle: segmentTitle,
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
/**
|
|
753
|
+
* The default chart copy for one section and one number locale - the single
|
|
754
|
+
* source every fallback path resolves against. Numbers inside the copy
|
|
755
|
+
* (summary min / max / current, threshold, stacked-bar values) format in
|
|
756
|
+
* `locale`; the words come from `section`.
|
|
757
|
+
*
|
|
758
|
+
* @internal
|
|
759
|
+
*/
|
|
760
|
+
const createChartI18nDefaults = chartBundleFrom;
|
|
761
|
+
/** @internal The English chart section with the active pack's chart section on top. */
|
|
762
|
+
const injectChartSection = createLanguageSection('chart', CNGX_CHART_LANGUAGE_EN);
|
|
763
|
+
/** @internal Builds and reads the token, formatted for the reading locale. */
|
|
764
|
+
const chartBundle = createSectionBundle({
|
|
765
|
+
section: injectChartSection,
|
|
766
|
+
toBundle: chartBundleFrom,
|
|
767
|
+
});
|
|
616
768
|
/**
|
|
617
|
-
* Injection token for chart i18n strings
|
|
618
|
-
*
|
|
769
|
+
* Injection token for chart i18n strings, a `Signal` so the copy follows a
|
|
770
|
+
* runtime language switch. Defaults to English via `factory:`, with numbers
|
|
771
|
+
* in the root app locale (`CNGX_LOCALE`, falling back to `LOCALE_ID`), read
|
|
772
|
+
* live. Override at app root with {@link provideChartI18n}; every key left
|
|
773
|
+
* at its default still follows the app locale at the use site, including a
|
|
774
|
+
* runtime `CNGX_LOCALE` flip.
|
|
619
775
|
*
|
|
620
776
|
* @category common/chart/i18n
|
|
621
777
|
* @wcag AA
|
|
@@ -624,48 +780,55 @@ function thresholdGeomEqual(a, b) {
|
|
|
624
780
|
*/
|
|
625
781
|
const CNGX_CHART_I18N = new InjectionToken('CngxChartI18n', {
|
|
626
782
|
providedIn: 'root',
|
|
627
|
-
factory: () => (
|
|
628
|
-
summary: ({ trend, min, max, current, thresholds }) => {
|
|
629
|
-
const trendText = trend === 'up' ? 'Trending up' : trend === 'down' ? 'Trending down' : 'Flat';
|
|
630
|
-
const thresholdText = thresholds.length === 0
|
|
631
|
-
? 'No thresholds.'
|
|
632
|
-
: thresholds.length === 1
|
|
633
|
-
? 'One threshold crossing.'
|
|
634
|
-
: `${thresholds.length} threshold crossings.`;
|
|
635
|
-
return `${trendText}. Min ${min}, max ${max}, current ${current}. ${thresholdText}`;
|
|
636
|
-
},
|
|
637
|
-
dataTable: () => 'Data table',
|
|
638
|
-
valueColumnLabel: () => 'Value',
|
|
639
|
-
trendChanged: (trend) => trend === 'up'
|
|
640
|
-
? 'Trend changed to up'
|
|
641
|
-
: trend === 'down'
|
|
642
|
-
? 'Trend changed to down'
|
|
643
|
-
: 'Trend flattened',
|
|
644
|
-
thresholdAlert: (threshold) => `Threshold ${threshold} crossed`,
|
|
645
|
-
connectionLost: () => 'Connection lost',
|
|
646
|
-
connectionReconnecting: () => 'Reconnecting',
|
|
647
|
-
connectionRestored: () => 'Connection restored',
|
|
648
|
-
empty: () => 'No data',
|
|
649
|
-
loading: () => 'Loading',
|
|
650
|
-
error: () => 'Error loading chart',
|
|
651
|
-
}),
|
|
783
|
+
factory: () => chartBundle.build(),
|
|
652
784
|
});
|
|
785
|
+
/** @internal */
|
|
786
|
+
function defineChartI18nFeature(fn) {
|
|
787
|
+
return Object.assign(fn, { _target: 'i18n' });
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Override chart copy via a partial bundle - unset keys keep the language
|
|
791
|
+
* pack's copy, or the English default, and keep following the app locale.
|
|
792
|
+
* Pass a `Signal` to switch the language at runtime.
|
|
793
|
+
*
|
|
794
|
+
* @category common/chart/i18n
|
|
795
|
+
*/
|
|
796
|
+
function withChartI18nLabels(overrides) {
|
|
797
|
+
return defineChartI18nFeature((bundle) => createOverrideMerge(bundle, overrides));
|
|
798
|
+
}
|
|
653
799
|
/**
|
|
654
|
-
* Provider
|
|
800
|
+
* Provider for the chart i18n bundle. The features apply on top of the
|
|
801
|
+
* active language pack, so a consumer localises only the keys they care
|
|
802
|
+
* about; every key left out keeps the pack's copy and follows the app locale.
|
|
655
803
|
*
|
|
656
804
|
* ```typescript
|
|
657
|
-
* providers: [
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
*
|
|
662
|
-
*
|
|
805
|
+
* providers: [
|
|
806
|
+
* provideChartI18n(
|
|
807
|
+
* withChartI18nLabels({
|
|
808
|
+
* dataTable: () => 'Datentabelle',
|
|
809
|
+
* }),
|
|
810
|
+
* ),
|
|
811
|
+
* ]
|
|
663
812
|
* ```
|
|
664
813
|
*
|
|
665
814
|
* @category common/chart/i18n
|
|
666
815
|
*/
|
|
667
|
-
function provideChartI18n(
|
|
668
|
-
return {
|
|
816
|
+
function provideChartI18n(...features) {
|
|
817
|
+
return {
|
|
818
|
+
provide: CNGX_CHART_I18N,
|
|
819
|
+
useFactory: () => chartBundle.build(features),
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
/**
|
|
823
|
+
* @internal - the chart i18n bundle for the reading site. Every key the
|
|
824
|
+
* token value leaves out, or leaves at its default, follows the use site's
|
|
825
|
+
* pack section and locale; a key the consumer set stays theirs verbatim.
|
|
826
|
+
* One signal per (token value, pack section, locale), shared by every chart
|
|
827
|
+
* part under one injector.
|
|
828
|
+
*/
|
|
829
|
+
function injectChartI18n() {
|
|
830
|
+
// resolve() fills every key the value leaves out from the complete section bundle.
|
|
831
|
+
return chartBundle.resolve(inject(CNGX_CHART_I18N));
|
|
669
832
|
}
|
|
670
833
|
|
|
671
834
|
/**
|
|
@@ -700,7 +863,8 @@ class CngxChartDataTable {
|
|
|
700
863
|
*/
|
|
701
864
|
id = input(undefined, ...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
702
865
|
defaultId = nextUid('cngx-chart-data-table');
|
|
703
|
-
i18n =
|
|
866
|
+
i18n = injectChartI18n();
|
|
867
|
+
locale = injectLocale();
|
|
704
868
|
/**
|
|
705
869
|
* Resolved host id - the explicit `[id]` input wins over the
|
|
706
870
|
* per-instance default. The host binding reads this signal so
|
|
@@ -708,8 +872,14 @@ class CngxChartDataTable {
|
|
|
708
872
|
* changes.
|
|
709
873
|
*/
|
|
710
874
|
resolvedId = computed(() => this.id() ?? this.defaultId, ...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
711
|
-
caption = computed(() => this.i18n.dataTable(), ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
712
|
-
|
|
875
|
+
caption = computed(() => this.i18n().dataTable(), ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
876
|
+
indexColumnLabel = computed(() => this.i18n().indexColumnLabel(), ...(ngDevMode ? [{ debugName: "indexColumnLabel" }] : /* istanbul ignore next */ []));
|
|
877
|
+
valueColumnLabel = computed(() => this.i18n().valueColumnLabel(), ...(ngDevMode ? [{ debugName: "valueColumnLabel" }] : /* istanbul ignore next */ []));
|
|
878
|
+
/** Noise-stripped display text in the app locale - see {@link formatChartNumber}. */
|
|
879
|
+
fmt = computed(() => {
|
|
880
|
+
const locale = this.locale();
|
|
881
|
+
return (v) => formatChartNumber(v, locale);
|
|
882
|
+
}, ...(ngDevMode ? [{ debugName: "fmt" }] : /* istanbul ignore next */ []));
|
|
713
883
|
rows = computed(() => {
|
|
714
884
|
const vs = this.values();
|
|
715
885
|
const out = new Array(vs.length);
|
|
@@ -741,15 +911,15 @@ class CngxChartDataTable {
|
|
|
741
911
|
</caption>
|
|
742
912
|
<thead>
|
|
743
913
|
<tr>
|
|
744
|
-
<th scope="col"
|
|
914
|
+
<th scope="col">{{ indexColumnLabel() }}</th>
|
|
745
915
|
<th scope="col">{{ valueColumnLabel() }}</th>
|
|
746
916
|
</tr>
|
|
747
917
|
</thead>
|
|
748
918
|
<tbody>
|
|
749
919
|
@for (row of rows(); track row.index) {
|
|
750
920
|
<tr>
|
|
751
|
-
<th scope="row">{{ row.index + 1 }}</th>
|
|
752
|
-
<td>{{ row.value }}</td>
|
|
921
|
+
<th scope="row">{{ fmt()(row.index + 1) }}</th>
|
|
922
|
+
<td>{{ fmt()(row.value) }}</td>
|
|
753
923
|
</tr>
|
|
754
924
|
}
|
|
755
925
|
</tbody>
|
|
@@ -770,15 +940,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
770
940
|
</caption>
|
|
771
941
|
<thead>
|
|
772
942
|
<tr>
|
|
773
|
-
<th scope="col"
|
|
943
|
+
<th scope="col">{{ indexColumnLabel() }}</th>
|
|
774
944
|
<th scope="col">{{ valueColumnLabel() }}</th>
|
|
775
945
|
</tr>
|
|
776
946
|
</thead>
|
|
777
947
|
<tbody>
|
|
778
948
|
@for (row of rows(); track row.index) {
|
|
779
949
|
<tr>
|
|
780
|
-
<th scope="row">{{ row.index + 1 }}</th>
|
|
781
|
-
<td>{{ row.value }}</td>
|
|
950
|
+
<th scope="row">{{ fmt()(row.index + 1) }}</th>
|
|
951
|
+
<td>{{ fmt()(row.value) }}</td>
|
|
782
952
|
</tr>
|
|
783
953
|
}
|
|
784
954
|
</tbody>
|
|
@@ -1009,6 +1179,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1009
1179
|
}]
|
|
1010
1180
|
}] });
|
|
1011
1181
|
|
|
1182
|
+
/**
|
|
1183
|
+
* Shared numeric helpers for the chart presets and the auto-summary.
|
|
1184
|
+
* Pure TS, no Angular dep, only the Level-0 `clamp` kernel imported -
|
|
1185
|
+
* which is why it lives in the core `chart/` folder: presets compose
|
|
1186
|
+
* `chart/`, so a helper both sides consume must not sit in `presets/`.
|
|
1187
|
+
* Internal - the presets and the summary are the API surface.
|
|
1188
|
+
*/
|
|
1189
|
+
/**
|
|
1190
|
+
* Single-pass min/max scan. Returns `null` for an empty input so the
|
|
1191
|
+
* caller decides its own fallback domain.
|
|
1192
|
+
*
|
|
1193
|
+
* @internal
|
|
1194
|
+
*/
|
|
1195
|
+
function scanMinMax(values) {
|
|
1196
|
+
if (values.length === 0) {
|
|
1197
|
+
return null;
|
|
1198
|
+
}
|
|
1199
|
+
let min = values[0];
|
|
1200
|
+
let max = values[0];
|
|
1201
|
+
for (let i = 1; i < values.length; i++) {
|
|
1202
|
+
const v = values[i];
|
|
1203
|
+
if (v < min) {
|
|
1204
|
+
min = v;
|
|
1205
|
+
}
|
|
1206
|
+
if (v > max) {
|
|
1207
|
+
max = v;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
return { min, max };
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Positional x-domain for an index-keyed preset series: `[0, n - 1]`,
|
|
1214
|
+
* falling back to `[0, 1]` below two points so the scale never
|
|
1215
|
+
* degenerates to a zero-width domain.
|
|
1216
|
+
*
|
|
1217
|
+
* @internal
|
|
1218
|
+
*/
|
|
1219
|
+
function presetIndexDomain(length) {
|
|
1220
|
+
return length < 2 ? [0, 1] : [0, length - 1];
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Value y-domain for a preset series: `[min, max]` of the data, padded
|
|
1224
|
+
* to `[v - 1, v + 1]` when the series is flat (a zero-height domain
|
|
1225
|
+
* would collapse the scale) and `[0, 1]` when it is empty.
|
|
1226
|
+
*
|
|
1227
|
+
* @internal
|
|
1228
|
+
*/
|
|
1229
|
+
function presetValueDomain(values) {
|
|
1230
|
+
const scan = scanMinMax(values);
|
|
1231
|
+
if (scan === null) {
|
|
1232
|
+
return [0, 1];
|
|
1233
|
+
}
|
|
1234
|
+
if (scan.min === scan.max) {
|
|
1235
|
+
return [scan.min - 1, scan.max + 1];
|
|
1236
|
+
}
|
|
1237
|
+
return [scan.min, scan.max];
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Position of `value` inside `[min, max]` as a ratio clamped to
|
|
1241
|
+
* `[0, 1]`. A degenerate range (`max <= min`) yields `0` - every
|
|
1242
|
+
* preset renders an empty fill rather than dividing by zero.
|
|
1243
|
+
*
|
|
1244
|
+
* @internal
|
|
1245
|
+
*/
|
|
1246
|
+
function clampedRatio(value, min, max) {
|
|
1247
|
+
if (max <= min) {
|
|
1248
|
+
return 0;
|
|
1249
|
+
}
|
|
1250
|
+
return clamp((value - min) / (max - min), 0, 1);
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1012
1253
|
/**
|
|
1013
1254
|
* Pure helper that derives a `CngxChartSummary` from already-projected
|
|
1014
1255
|
* numeric values plus a list of threshold values. The chart component
|
|
@@ -1029,20 +1270,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
1029
1270
|
* @internal
|
|
1030
1271
|
*/
|
|
1031
1272
|
function computeChartSummary(values, thresholds) {
|
|
1032
|
-
|
|
1273
|
+
const scan = scanMinMax(values);
|
|
1274
|
+
if (scan === null) {
|
|
1033
1275
|
return { trend: 'flat', min: 0, max: 0, current: 0, thresholds: [] };
|
|
1034
1276
|
}
|
|
1035
|
-
|
|
1036
|
-
let max = values[0];
|
|
1037
|
-
for (let i = 1; i < values.length; i++) {
|
|
1038
|
-
const v = values[i];
|
|
1039
|
-
if (v < min) {
|
|
1040
|
-
min = v;
|
|
1041
|
-
}
|
|
1042
|
-
if (v > max) {
|
|
1043
|
-
max = v;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1277
|
+
const { min, max } = scan;
|
|
1046
1278
|
const first = values[0];
|
|
1047
1279
|
const current = values[values.length - 1];
|
|
1048
1280
|
const range = max - min;
|
|
@@ -1134,9 +1366,13 @@ function createSignificantChangeTracker(summary) {
|
|
|
1134
1366
|
*
|
|
1135
1367
|
* - **mount** - tracks `mode()`; on change, destroys the previous backend,
|
|
1136
1368
|
* builds the new one via `factory`, mounts it, and seeds the first paint.
|
|
1137
|
-
* - **paint** - tracks `geometries()
|
|
1138
|
-
* dimensions
|
|
1139
|
-
*
|
|
1369
|
+
* - **paint** - tracks `geometries()`, the (structurally-deduped)
|
|
1370
|
+
* dimensions and the `(forced-colors: active)` /
|
|
1371
|
+
* `(prefers-color-scheme: dark)` media queries; repaints on every
|
|
1372
|
+
* geometry emission and invalidates the backend's color cache when the
|
|
1373
|
+
* dimensions or either media query actually change, so a contrast-theme
|
|
1374
|
+
* or OS colour-scheme switch repaints at once instead of after the next
|
|
1375
|
+
* resize.
|
|
1140
1376
|
*
|
|
1141
1377
|
* Both effects wrap their imperative renderer calls in `untracked()` so
|
|
1142
1378
|
* the renderer's own signal reads never feed back into the effect graph.
|
|
@@ -1160,6 +1396,11 @@ function createChartRendererController(deps) {
|
|
|
1160
1396
|
// the redundant re-paints / cache invalidations.
|
|
1161
1397
|
const dims = linkedSignal(() => deps.ctx.dimensions(), { ...(ngDevMode ? { debugName: "dims" } : /* istanbul ignore next */ {}), equal: dimensionsEqual });
|
|
1162
1398
|
let lastDims = untracked(dims);
|
|
1399
|
+
const view = deps.host.ownerDocument.defaultView;
|
|
1400
|
+
const forced = createMediaQuerySignal('(forced-colors: active)', deps.destroyRef, view);
|
|
1401
|
+
const darkScheme = createMediaQuerySignal('(prefers-color-scheme: dark)', deps.destroyRef, view);
|
|
1402
|
+
let lastForced = untracked(forced);
|
|
1403
|
+
let lastDark = untracked(darkScheme);
|
|
1163
1404
|
// Mount effect: rebuild the backend whenever the mode flips, then seed
|
|
1164
1405
|
// the first paint (the paint effect does not track `mode`, so the fresh
|
|
1165
1406
|
// backend would otherwise stay blank until the next geometry change).
|
|
@@ -1167,19 +1408,29 @@ function createChartRendererController(deps) {
|
|
|
1167
1408
|
const mode = deps.mode();
|
|
1168
1409
|
untracked(() => {
|
|
1169
1410
|
current?.destroy();
|
|
1170
|
-
current = deps.factory(mode, {
|
|
1411
|
+
current = deps.factory(mode, {
|
|
1412
|
+
ctx: deps.ctx,
|
|
1413
|
+
destroyRef: deps.destroyRef,
|
|
1414
|
+
forcedColors: forced,
|
|
1415
|
+
});
|
|
1171
1416
|
current.mount(deps.host, deps.ctx);
|
|
1172
1417
|
current.paint(deps.geometries());
|
|
1173
1418
|
});
|
|
1174
1419
|
});
|
|
1175
1420
|
// Paint effect: repaint on geometry change; invalidate the color cache
|
|
1176
|
-
// only when the deduped dimensions actually
|
|
1421
|
+
// only when the deduped dimensions or a palette media query actually
|
|
1422
|
+
// changed (a palette flip re-resolves colors like a theming reflow).
|
|
1177
1423
|
effect(() => {
|
|
1178
1424
|
const geometries = deps.geometries();
|
|
1179
1425
|
const nextDims = dims();
|
|
1426
|
+
const nextForced = forced();
|
|
1427
|
+
const nextDark = darkScheme();
|
|
1180
1428
|
untracked(() => {
|
|
1181
|
-
|
|
1429
|
+
const paletteChanged = nextForced !== lastForced || nextDark !== lastDark;
|
|
1430
|
+
if (nextDims !== lastDims || paletteChanged) {
|
|
1182
1431
|
lastDims = nextDims;
|
|
1432
|
+
lastForced = nextForced;
|
|
1433
|
+
lastDark = nextDark;
|
|
1183
1434
|
current?.invalidateColorCache?.();
|
|
1184
1435
|
}
|
|
1185
1436
|
current?.paint(geometries);
|
|
@@ -1192,6 +1443,112 @@ function createChartRendererController(deps) {
|
|
|
1192
1443
|
};
|
|
1193
1444
|
}
|
|
1194
1445
|
|
|
1446
|
+
/**
|
|
1447
|
+
* @internal Mount a hidden probe under `host` that resolves `CanvasText` /
|
|
1448
|
+
* `Canvas` to concrete colours. Two child spans carry the keywords and opt
|
|
1449
|
+
* out with `forced-color-adjust: none`; without it a forced `color: Canvas`
|
|
1450
|
+
* would compute to the forced text colour. The probe lives as long as the
|
|
1451
|
+
* renderer, so a re-read on a palette flip is two style reads and never a
|
|
1452
|
+
* host mutation inside `paint()`. Falls back to the keywords when the host
|
|
1453
|
+
* resolves nothing (jsdom).
|
|
1454
|
+
*/
|
|
1455
|
+
function createSystemColorProbe(host) {
|
|
1456
|
+
const doc = host.ownerDocument;
|
|
1457
|
+
const root = doc.createElement('span');
|
|
1458
|
+
root.className = 'cngx-chart__palette-probe';
|
|
1459
|
+
root.setAttribute('aria-hidden', 'true');
|
|
1460
|
+
root.style.display = 'none';
|
|
1461
|
+
const swatch = (keyword) => {
|
|
1462
|
+
const el = doc.createElement('span');
|
|
1463
|
+
el.style.setProperty('forced-color-adjust', 'none');
|
|
1464
|
+
el.style.color = keyword;
|
|
1465
|
+
root.appendChild(el);
|
|
1466
|
+
return el;
|
|
1467
|
+
};
|
|
1468
|
+
const ink = swatch('CanvasText');
|
|
1469
|
+
// Lowercase on purpose: CSS keywords are case-insensitive, and the
|
|
1470
|
+
// capitalised form reads as copy to the user-facing string guard.
|
|
1471
|
+
const canvas = swatch('canvas');
|
|
1472
|
+
host.appendChild(root);
|
|
1473
|
+
return {
|
|
1474
|
+
read: () => ({
|
|
1475
|
+
ink: getComputedStyle(ink).color || 'CanvasText',
|
|
1476
|
+
canvas: getComputedStyle(canvas).color || 'canvas',
|
|
1477
|
+
}),
|
|
1478
|
+
remove: () => root.remove(),
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
/**
|
|
1482
|
+
* @internal Line dash per step: solid, dashed, dotted, dash-dot. Same
|
|
1483
|
+
* values as the `stroke-dasharray` in the line layer's forced-colors CSS.
|
|
1484
|
+
*/
|
|
1485
|
+
const FORCED_LINE_DASHES = [[], [6, 3], [0.1, 4], [8, 3, 0.1, 3]];
|
|
1486
|
+
const stepMemo = new WeakMap();
|
|
1487
|
+
/**
|
|
1488
|
+
* @internal The forced-colors step of every geometry, `null` for the kinds
|
|
1489
|
+
* outside the cycle. Line, bar and scatter count, area, threshold and band
|
|
1490
|
+
* do not - the same rule as the SVG
|
|
1491
|
+
* `:nth-child(4n + k of .cngx-chart-series)` selectors. Memoised by the
|
|
1492
|
+
* array reference: the chart keeps the same geometries array while no
|
|
1493
|
+
* layer emits a new geometry, so repaints without data (resize, DPR or
|
|
1494
|
+
* palette flip) reuse the steps. A streaming chart gets a new array on
|
|
1495
|
+
* every data tick and recomputes one small array per frame.
|
|
1496
|
+
*/
|
|
1497
|
+
function forcedSeriesSteps(geometries) {
|
|
1498
|
+
const cached = stepMemo.get(geometries);
|
|
1499
|
+
if (cached) {
|
|
1500
|
+
return cached;
|
|
1501
|
+
}
|
|
1502
|
+
let series = 0;
|
|
1503
|
+
const steps = geometries.map((g) => {
|
|
1504
|
+
const counts = g.kind === 'line' || g.kind === 'bar' || g.kind === 'scatter';
|
|
1505
|
+
if (!counts) {
|
|
1506
|
+
return null;
|
|
1507
|
+
}
|
|
1508
|
+
const step = (series % 4);
|
|
1509
|
+
series++;
|
|
1510
|
+
return step;
|
|
1511
|
+
});
|
|
1512
|
+
stepMemo.set(geometries, steps);
|
|
1513
|
+
return steps;
|
|
1514
|
+
}
|
|
1515
|
+
const NO_HATCHES = { diagonal: null, horizontal: null };
|
|
1516
|
+
/**
|
|
1517
|
+
* @internal Build the hatch patterns the SVG chart draws as `<pattern>`
|
|
1518
|
+
* defs: a 4px tile with a 2px ink stripe on a Canvas gap (the gap keeps a
|
|
1519
|
+
* hatched mark readable where it overlaps another). The tile is drawn at
|
|
1520
|
+
* device-pixel size and scaled back through the pattern transform, so the
|
|
1521
|
+
* 0deg hatch maps one tile pixel to one device pixel and stays pure ink
|
|
1522
|
+
* and canvas on a high-DPR screen. The 45deg hatch is rotated and therefore
|
|
1523
|
+
* resampled; its stripe edges blend ink into canvas, as the SVG pattern's
|
|
1524
|
+
* do. Returns nulls when the host lacks `createPattern` or `DOMMatrix`; the
|
|
1525
|
+
* caller then fills with ink.
|
|
1526
|
+
*/
|
|
1527
|
+
function createForcedHatches(doc, target, colors, dpr) {
|
|
1528
|
+
if (typeof target.createPattern !== 'function' || typeof DOMMatrix !== 'function') {
|
|
1529
|
+
return NO_HATCHES;
|
|
1530
|
+
}
|
|
1531
|
+
const size = Math.max(1, Math.round(4 * dpr));
|
|
1532
|
+
const stripe = Math.max(1, Math.round(2 * dpr));
|
|
1533
|
+
const tile = doc.createElement('canvas');
|
|
1534
|
+
tile.width = size;
|
|
1535
|
+
tile.height = size;
|
|
1536
|
+
const t = tile.getContext('2d');
|
|
1537
|
+
if (!t) {
|
|
1538
|
+
return NO_HATCHES;
|
|
1539
|
+
}
|
|
1540
|
+
t.fillStyle = colors.canvas;
|
|
1541
|
+
t.fillRect(0, 0, size, size);
|
|
1542
|
+
t.fillStyle = colors.ink;
|
|
1543
|
+
t.fillRect(0, 0, size, stripe);
|
|
1544
|
+
const back = 4 / size;
|
|
1545
|
+
const diagonal = target.createPattern(tile, 'repeat');
|
|
1546
|
+
diagonal?.setTransform(new DOMMatrix().scale(back).rotate(45));
|
|
1547
|
+
const horizontal = target.createPattern(tile, 'repeat');
|
|
1548
|
+
horizontal?.setTransform(new DOMMatrix().scale(back));
|
|
1549
|
+
return { diagonal, horizontal };
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1195
1552
|
/**
|
|
1196
1553
|
* @internal Per-kind CSS custom-property fallback chain, resolved when a
|
|
1197
1554
|
* geometry emits `color: null`. Mirrors each layer atom's SVG cascade
|
|
@@ -1215,6 +1572,8 @@ const DEFAULT_AREA_OPACITY = 0.18;
|
|
|
1215
1572
|
const DEFAULT_BAND_OPACITY = 0.12;
|
|
1216
1573
|
/** @internal Fallback point-marker radius, matching the layers' CSS token defaults. */
|
|
1217
1574
|
const DEFAULT_POINT_RADIUS = 3;
|
|
1575
|
+
/** @internal Shared solid dash, so resetting after a dashed stroke allocates nothing. */
|
|
1576
|
+
const SOLID_DASH = [];
|
|
1218
1577
|
/**
|
|
1219
1578
|
* Canvas rendering backend. Mounts a `<canvas>` absolutely positioned
|
|
1220
1579
|
* over the chart's SVG frame and paints each {@link LayerGeometry} onto
|
|
@@ -1244,6 +1603,22 @@ const DEFAULT_POINT_RADIUS = 3;
|
|
|
1244
1603
|
* `overflow: visible` it now clips there too. Out-of-domain data is cut
|
|
1245
1604
|
* off on both paths.
|
|
1246
1605
|
*
|
|
1606
|
+
* Under forced colors the canvas follows the same contract as the SVG
|
|
1607
|
+
* layers, since the browser never forces canvas pixels: every mark paints
|
|
1608
|
+
* CanvasText, ignoring `[color]` and the colour tokens; areas and bands keep
|
|
1609
|
+
* their opacity; line, bar and scatter take the legend's four-step cycle by
|
|
1610
|
+
* series index (lines solid / dashed / dotted / dash-dot, bars and points
|
|
1611
|
+
* solid / 45deg hatch / hollow / 0deg hatch), with area, threshold and band
|
|
1612
|
+
* not counting. CanvasText and Canvas are resolved through a probe element
|
|
1613
|
+
* opted out of forcing and cached like the author colours. Chromium also
|
|
1614
|
+
* resolves the system keywords on a 2D context to the forced palette, but
|
|
1615
|
+
* other engines are unverified, so the backend paints the probed values.
|
|
1616
|
+
* The renderer controller watches `(forced-colors: active)` and
|
|
1617
|
+
* `(prefers-color-scheme: dark)` and invalidates the colour cache before
|
|
1618
|
+
* repainting on a flip, so a contrast-theme switch repaints at once. One
|
|
1619
|
+
* difference from SVG: a layer wrapped in an extra `<svg:g>` still counts
|
|
1620
|
+
* here, since the backend only sees the layer order.
|
|
1621
|
+
*
|
|
1247
1622
|
* @category common/chart/renderer
|
|
1248
1623
|
* @github https://github.com/cngxjs/cngx/blob/main/projects/common/chart/renderer/canvas-renderer.ts
|
|
1249
1624
|
* @since 0.1.0
|
|
@@ -1254,8 +1629,19 @@ function createCanvasRenderer(deps) {
|
|
|
1254
1629
|
let ctx2d = null;
|
|
1255
1630
|
let lastW = -1;
|
|
1256
1631
|
let lastH = -1;
|
|
1632
|
+
let lastGeometries = [];
|
|
1633
|
+
let dprCleanup = null;
|
|
1257
1634
|
const colorCache = new Map();
|
|
1258
1635
|
const numberCache = new Map();
|
|
1636
|
+
// Snapshot of deps.forcedColors, taken once per paint() so the per-mark
|
|
1637
|
+
// colour lookups do not re-read the signal.
|
|
1638
|
+
let forcedNow = false;
|
|
1639
|
+
// Forced system palette; cleared with colorCache so a flip re-probes it.
|
|
1640
|
+
let sysColors = null;
|
|
1641
|
+
let probe = null;
|
|
1642
|
+
// Hatch patterns for the forced cycle, per palette and DPR.
|
|
1643
|
+
let hatches = null;
|
|
1644
|
+
let hatchDpr = -1;
|
|
1259
1645
|
function readVar(name) {
|
|
1260
1646
|
return hostEl ? getComputedStyle(hostEl).getPropertyValue(name).trim() : '';
|
|
1261
1647
|
}
|
|
@@ -1275,7 +1661,53 @@ function createCanvasRenderer(deps) {
|
|
|
1275
1661
|
numberCache.set(name, value);
|
|
1276
1662
|
return value;
|
|
1277
1663
|
}
|
|
1664
|
+
/**
|
|
1665
|
+
* The forced system palette, probed once per palette and dropped by
|
|
1666
|
+
* `invalidateColorCache()`, so a forced-colors flip re-probes it.
|
|
1667
|
+
*/
|
|
1668
|
+
function systemColors() {
|
|
1669
|
+
sysColors ??= probe?.read() ?? { ink: 'CanvasText', canvas: 'canvas' };
|
|
1670
|
+
return sysColors;
|
|
1671
|
+
}
|
|
1672
|
+
function forcedHatches(c) {
|
|
1673
|
+
const dpr = globalThis.devicePixelRatio ?? 1;
|
|
1674
|
+
if (!hatches || hatchDpr !== dpr) {
|
|
1675
|
+
const doc = hostEl?.ownerDocument ?? document;
|
|
1676
|
+
hatches = createForcedHatches(doc, c, systemColors(), dpr);
|
|
1677
|
+
hatchDpr = dpr;
|
|
1678
|
+
}
|
|
1679
|
+
return hatches;
|
|
1680
|
+
}
|
|
1681
|
+
/**
|
|
1682
|
+
* Set the fill of a bar / scatter mark at its forced step and return the
|
|
1683
|
+
* ink ring width (0 = no ring): solid ink; diagonal hatch with a 1px ring;
|
|
1684
|
+
* hollow Canvas with a 1.5px ring; horizontal hatch with a 1px ring. A
|
|
1685
|
+
* missing pattern falls back to an ink fill. Mirrors the bar / scatter
|
|
1686
|
+
* layers' forced-colors CSS.
|
|
1687
|
+
*/
|
|
1688
|
+
function applyForcedMark(c, step) {
|
|
1689
|
+
const sys = systemColors();
|
|
1690
|
+
switch (step) {
|
|
1691
|
+
case 1:
|
|
1692
|
+
c.fillStyle = forcedHatches(c).diagonal ?? sys.ink;
|
|
1693
|
+
return 1;
|
|
1694
|
+
case 2:
|
|
1695
|
+
c.fillStyle = sys.canvas;
|
|
1696
|
+
return 1.5;
|
|
1697
|
+
case 3:
|
|
1698
|
+
c.fillStyle = forcedHatches(c).horizontal ?? sys.ink;
|
|
1699
|
+
return 1;
|
|
1700
|
+
default:
|
|
1701
|
+
c.fillStyle = sys.ink;
|
|
1702
|
+
return 0;
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1278
1705
|
function colorOf(color, kind) {
|
|
1706
|
+
// Forced colors: every mark paints CanvasText, ignoring the [color]
|
|
1707
|
+
// literal and the var chain (parity with the layers' !important rules).
|
|
1708
|
+
if (forcedNow) {
|
|
1709
|
+
return systemColors().ink;
|
|
1710
|
+
}
|
|
1279
1711
|
// An explicit literal color (e.g. [cngxLine] [color]="'#f00'") passes
|
|
1280
1712
|
// through untouched - no var resolution, no cache.
|
|
1281
1713
|
if (color !== null && !color.startsWith('--')) {
|
|
@@ -1350,6 +1782,29 @@ function createCanvasRenderer(deps) {
|
|
|
1350
1782
|
// Draw in logical pixels; the bitmap is scaled for the device.
|
|
1351
1783
|
ctx2d.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
1352
1784
|
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Repaint when the device-pixel ratio changes without any data change
|
|
1787
|
+
* (window dragged to another monitor, browser zoom). The paint path
|
|
1788
|
+
* re-reads the DPR via `sizeCanvas()`, but nothing triggers it on a
|
|
1789
|
+
* DPR-only change, so the bitmap stays at the old density and renders
|
|
1790
|
+
* blurry until the next data tick. A `resolution` media query fires
|
|
1791
|
+
* exactly on that edge; it matches only the current ratio, so it is
|
|
1792
|
+
* re-armed with the new ratio after every change.
|
|
1793
|
+
*/
|
|
1794
|
+
function watchDpr() {
|
|
1795
|
+
if (typeof matchMedia !== 'function') {
|
|
1796
|
+
return;
|
|
1797
|
+
}
|
|
1798
|
+
const mql = matchMedia(`(resolution: ${globalThis.devicePixelRatio ?? 1}dppx)`);
|
|
1799
|
+
const onChange = () => {
|
|
1800
|
+
dprCleanup?.();
|
|
1801
|
+
dprCleanup = null;
|
|
1802
|
+
paint(lastGeometries);
|
|
1803
|
+
watchDpr();
|
|
1804
|
+
};
|
|
1805
|
+
mql.addEventListener('change', onChange, { once: true });
|
|
1806
|
+
dprCleanup = () => mql.removeEventListener('change', onChange);
|
|
1807
|
+
}
|
|
1353
1808
|
function mount(host) {
|
|
1354
1809
|
hostEl = host;
|
|
1355
1810
|
const el = host.ownerDocument.createElement('canvas');
|
|
@@ -1361,31 +1816,44 @@ function createCanvasRenderer(deps) {
|
|
|
1361
1816
|
host.appendChild(el);
|
|
1362
1817
|
canvas = el;
|
|
1363
1818
|
ctx2d = el.getContext('2d');
|
|
1819
|
+
probe = createSystemColorProbe(host);
|
|
1364
1820
|
sizeCanvas();
|
|
1821
|
+
watchDpr();
|
|
1365
1822
|
// Teardown is owned by the renderer controller (it destroys on mode
|
|
1366
1823
|
// flip and on the chart's DestroyRef). Self-registering here would
|
|
1367
1824
|
// pile up one never-unregistered closure per svg<->canvas flip.
|
|
1368
1825
|
}
|
|
1369
1826
|
function paint(geometries) {
|
|
1827
|
+
lastGeometries = geometries;
|
|
1370
1828
|
const c = ctx2d;
|
|
1371
1829
|
if (!canvas || !c) {
|
|
1372
1830
|
return;
|
|
1373
1831
|
}
|
|
1374
1832
|
sizeCanvas();
|
|
1833
|
+
forcedNow = deps.forcedColors?.() ?? false;
|
|
1375
1834
|
const { width, height } = deps.ctx.dimensions();
|
|
1376
1835
|
c.clearRect(0, 0, width, height);
|
|
1377
|
-
|
|
1378
|
-
|
|
1836
|
+
const steps = forcedNow ? forcedSeriesSteps(geometries) : null;
|
|
1837
|
+
for (let i = 0; i < geometries.length; i++) {
|
|
1838
|
+
paintOne(c, geometries[i], steps?.[i] ?? null);
|
|
1379
1839
|
}
|
|
1380
1840
|
}
|
|
1381
|
-
function paintOne(c, g) {
|
|
1841
|
+
function paintOne(c, g, step) {
|
|
1382
1842
|
switch (g.kind) {
|
|
1383
1843
|
case 'line': {
|
|
1384
1844
|
c.strokeStyle = colorOf(g.color, 'line');
|
|
1385
1845
|
c.lineWidth = strokeWidthOf(g.strokeWidth);
|
|
1386
1846
|
c.lineJoin = 'round';
|
|
1387
1847
|
c.lineCap = 'round';
|
|
1848
|
+
// Forced colors: the legend's dash for this series step (round caps
|
|
1849
|
+
// turn the 0.1 dash into a dot, as in SVG).
|
|
1850
|
+
if (step !== null) {
|
|
1851
|
+
c.setLineDash(FORCED_LINE_DASHES[step]);
|
|
1852
|
+
}
|
|
1388
1853
|
c.stroke(new Path2D(g.d));
|
|
1854
|
+
if (step !== null) {
|
|
1855
|
+
c.setLineDash(SOLID_DASH);
|
|
1856
|
+
}
|
|
1389
1857
|
drawPointMarks(c, g.points, g.color, 'line', '--cngx-line-point-radius');
|
|
1390
1858
|
break;
|
|
1391
1859
|
}
|
|
@@ -1398,18 +1866,38 @@ function createCanvasRenderer(deps) {
|
|
|
1398
1866
|
break;
|
|
1399
1867
|
}
|
|
1400
1868
|
case 'bar': {
|
|
1869
|
+
const ring = step === null ? 0 : applyForcedMark(c, step);
|
|
1870
|
+
if (ring > 0) {
|
|
1871
|
+
c.strokeStyle = systemColors().ink;
|
|
1872
|
+
c.lineWidth = ring;
|
|
1873
|
+
}
|
|
1401
1874
|
for (const r of g.rects) {
|
|
1402
|
-
|
|
1875
|
+
if (step === null) {
|
|
1876
|
+
c.fillStyle = colorOf(r.color, 'bar');
|
|
1877
|
+
}
|
|
1403
1878
|
c.fillRect(r.x, r.y, r.w, r.h);
|
|
1879
|
+
if (ring > 0) {
|
|
1880
|
+
c.strokeRect(r.x, r.y, r.w, r.h);
|
|
1881
|
+
}
|
|
1404
1882
|
}
|
|
1405
1883
|
break;
|
|
1406
1884
|
}
|
|
1407
1885
|
case 'scatter': {
|
|
1886
|
+
const ring = step === null ? 0 : applyForcedMark(c, step);
|
|
1887
|
+
if (ring > 0) {
|
|
1888
|
+
c.strokeStyle = systemColors().ink;
|
|
1889
|
+
c.lineWidth = ring;
|
|
1890
|
+
}
|
|
1408
1891
|
for (const m of g.marks) {
|
|
1409
|
-
|
|
1892
|
+
if (step === null) {
|
|
1893
|
+
c.fillStyle = colorOf(m.color, 'scatter');
|
|
1894
|
+
}
|
|
1410
1895
|
c.beginPath();
|
|
1411
1896
|
c.arc(m.cx, m.cy, m.r, 0, Math.PI * 2);
|
|
1412
1897
|
c.fill();
|
|
1898
|
+
if (ring > 0) {
|
|
1899
|
+
c.stroke();
|
|
1900
|
+
}
|
|
1413
1901
|
}
|
|
1414
1902
|
break;
|
|
1415
1903
|
}
|
|
@@ -1436,16 +1924,25 @@ function createCanvasRenderer(deps) {
|
|
|
1436
1924
|
function invalidateColorCache() {
|
|
1437
1925
|
colorCache.clear();
|
|
1438
1926
|
numberCache.clear();
|
|
1927
|
+
sysColors = null;
|
|
1928
|
+
hatches = null;
|
|
1439
1929
|
}
|
|
1440
1930
|
function destroy() {
|
|
1931
|
+
dprCleanup?.();
|
|
1932
|
+
dprCleanup = null;
|
|
1933
|
+
lastGeometries = [];
|
|
1441
1934
|
canvas?.remove();
|
|
1442
1935
|
canvas = null;
|
|
1936
|
+
probe?.remove();
|
|
1937
|
+
probe = null;
|
|
1443
1938
|
ctx2d = null;
|
|
1444
1939
|
hostEl = null;
|
|
1445
1940
|
lastW = -1;
|
|
1446
1941
|
lastH = -1;
|
|
1447
1942
|
colorCache.clear();
|
|
1448
1943
|
numberCache.clear();
|
|
1944
|
+
sysColors = null;
|
|
1945
|
+
hatches = null;
|
|
1449
1946
|
}
|
|
1450
1947
|
return {
|
|
1451
1948
|
mode: 'canvas',
|
|
@@ -1729,8 +2226,13 @@ class CngxChart {
|
|
|
1729
2226
|
axes = contentChildren(CNGX_CHART_AXIS, { ...(ngDevMode ? { debugName: "axes" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1730
2227
|
thresholds = contentChildren(CngxThreshold, { ...(ngDevMode ? { debugName: "thresholds" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1731
2228
|
layers = contentChildren(CNGX_CHART_LAYER, { ...(ngDevMode ? { debugName: "layers" } : /* istanbul ignore next */ {}), descendants: true });
|
|
1732
|
-
i18n =
|
|
2229
|
+
i18n = injectChartI18n();
|
|
1733
2230
|
dataTableId = nextUid('cngx-chart-data-table');
|
|
2231
|
+
hatchId = nextUid('cngx-chart-hatch');
|
|
2232
|
+
hatchFill = {
|
|
2233
|
+
diagonal: `url(#${this.hatchId}-diagonal)`,
|
|
2234
|
+
horizontal: `url(#${this.hatchId}-horizontal)`,
|
|
2235
|
+
};
|
|
1734
2236
|
loadingSlot = contentChild(CngxChartLoading, ...(ngDevMode ? [{ debugName: "loadingSlot" }] : /* istanbul ignore next */ []));
|
|
1735
2237
|
emptySlot = contentChild(CngxChartEmpty, ...(ngDevMode ? [{ debugName: "emptySlot" }] : /* istanbul ignore next */ []));
|
|
1736
2238
|
errorSlot = contentChild(CngxChartError, ...(ngDevMode ? [{ debugName: "errorSlot" }] : /* istanbul ignore next */ []));
|
|
@@ -1818,6 +2320,22 @@ class CngxChart {
|
|
|
1818
2320
|
}
|
|
1819
2321
|
return 'none';
|
|
1820
2322
|
}, ...(ngDevMode ? [{ debugName: "connectionView" }] : /* istanbul ignore next */ []));
|
|
2323
|
+
/**
|
|
2324
|
+
* Text of the default connection overlay (a `role="alert"` /
|
|
2325
|
+
* `role="status"` live region). Only the connection view is tracked;
|
|
2326
|
+
* the copy is read untracked, so a runtime copy or locale flip does not
|
|
2327
|
+
* rewrite a shown announcement - the next transition speaks the new one.
|
|
2328
|
+
*/
|
|
2329
|
+
connectionOverlayText = computed(() => {
|
|
2330
|
+
const view = this.connectionView();
|
|
2331
|
+
return untracked(() => {
|
|
2332
|
+
const i18n = this.i18n();
|
|
2333
|
+
if (view === 'error') {
|
|
2334
|
+
return i18n.connectionLost();
|
|
2335
|
+
}
|
|
2336
|
+
return view === 'reconnecting' ? i18n.connectionReconnecting() : '';
|
|
2337
|
+
});
|
|
2338
|
+
}, ...(ngDevMode ? [{ debugName: "connectionOverlayText" }] : /* istanbul ignore next */ []));
|
|
1821
2339
|
/**
|
|
1822
2340
|
* Context for the connection-slot templates - the connection-channel
|
|
1823
2341
|
* twin of {@link errorContext}, carrying the live connection error.
|
|
@@ -1826,6 +2344,26 @@ class CngxChart {
|
|
|
1826
2344
|
const err = this.connectionState()?.error?.() ?? null;
|
|
1827
2345
|
return { ...this.slotContext(), $implicit: err, error: err };
|
|
1828
2346
|
}, ...(ngDevMode ? [{ debugName: "connectionCtx" }] : /* istanbul ignore next */ []));
|
|
2347
|
+
/**
|
|
2348
|
+
* Current/previous pair for the connection channel's status,
|
|
2349
|
+
* unbound-safe via the `'idle'` fallback.
|
|
2350
|
+
*/
|
|
2351
|
+
connectionTransition = createTransitionTracker(() => this.connectionState()?.status() ?? 'idle');
|
|
2352
|
+
/**
|
|
2353
|
+
* Text for the always-in-DOM polite live region that voices the
|
|
2354
|
+
* recovery transition. The lost/reconnecting overlays announce
|
|
2355
|
+
* themselves through their `role="alert"` / `role="status"` - but
|
|
2356
|
+
* on recovery they simply vanish, which is a silent state change
|
|
2357
|
+
* (Pillar 2). This computed says {@link CngxChartI18n.connectionRestored}
|
|
2358
|
+
* exactly on the error/refreshing -> success edge and clears again
|
|
2359
|
+
* on the next connection transition. Pure derivation, no `effect()`.
|
|
2360
|
+
*/
|
|
2361
|
+
connectionRestoredAnnouncement = computed(() => {
|
|
2362
|
+
const current = this.connectionTransition.current();
|
|
2363
|
+
const previous = this.connectionTransition.previous();
|
|
2364
|
+
const restored = current === 'success' && (previous === 'error' || previous === 'refreshing');
|
|
2365
|
+
return restored ? untracked(() => this.i18n().connectionRestored()) : '';
|
|
2366
|
+
}, ...(ngDevMode ? [{ debugName: "connectionRestoredAnnouncement" }] : /* istanbul ignore next */ []));
|
|
1829
2367
|
constructor() {
|
|
1830
2368
|
// The controller owns the mount / destroy / paint reactive lifecycle;
|
|
1831
2369
|
// its effects and teardown are held by this injection context's
|
|
@@ -1861,6 +2399,16 @@ class CngxChart {
|
|
|
1861
2399
|
'Compose multiple overlays inside a single overlay template.');
|
|
1862
2400
|
}
|
|
1863
2401
|
});
|
|
2402
|
+
afterNextRender(() => {
|
|
2403
|
+
const axes = this.axes();
|
|
2404
|
+
const horizontal = axes.filter((a) => isHorizontalPosition(a.position()));
|
|
2405
|
+
const vertical = axes.filter((a) => isVerticalPosition(a.position()));
|
|
2406
|
+
if (horizontal.length > 1 || vertical.length > 1) {
|
|
2407
|
+
console.warn('CngxChart: multiple axes share one orientation; only the first drives ' +
|
|
2408
|
+
'the scale, the rest render their line and ticks but their [domain] ' +
|
|
2409
|
+
'is silently ignored. Mount one X and one Y axis per chart.');
|
|
2410
|
+
}
|
|
2411
|
+
});
|
|
1864
2412
|
}
|
|
1865
2413
|
}
|
|
1866
2414
|
dataLength = computed(() => this.dataInput().length, ...(ngDevMode ? [{ debugName: "dataLength" }] : /* istanbul ignore next */ []));
|
|
@@ -2065,14 +2613,8 @@ class CngxChart {
|
|
|
2065
2613
|
* later.
|
|
2066
2614
|
*/
|
|
2067
2615
|
summary = computed(() => {
|
|
2068
|
-
const acc = this.summaryAccessor();
|
|
2069
|
-
const data = this.dataInput();
|
|
2070
|
-
const values = new Array(data.length);
|
|
2071
|
-
for (let i = 0; i < data.length; i++) {
|
|
2072
|
-
values[i] = acc(data[i], i);
|
|
2073
|
-
}
|
|
2074
2616
|
const thresholds = this.thresholds().map((t) => t.value());
|
|
2075
|
-
return computeChartSummary(
|
|
2617
|
+
return computeChartSummary(this.summaryValues(), thresholds);
|
|
2076
2618
|
}, { ...(ngDevMode ? { debugName: "summary" } : /* istanbul ignore next */ {}), equal: (a, b) => a.trend === b.trend &&
|
|
2077
2619
|
a.min === b.min &&
|
|
2078
2620
|
a.max === b.max &&
|
|
@@ -2117,7 +2659,7 @@ class CngxChart {
|
|
|
2117
2659
|
* Responsive mode is active when neither `[width]` nor `[height]` is
|
|
2118
2660
|
* bound. The host then fills its parent's width and derives height
|
|
2119
2661
|
* from the `--cngx-chart-aspect-ratio` CSS custom property (default
|
|
2120
|
-
* `
|
|
2662
|
+
* `5 / 2`). The resize observer feeds `dimensions()` which drives
|
|
2121
2663
|
* the SVG sizing + scale math, so axes and layer atoms re-flow
|
|
2122
2664
|
* reactively as the parent resizes.
|
|
2123
2665
|
*/
|
|
@@ -2149,21 +2691,26 @@ class CngxChart {
|
|
|
2149
2691
|
ariaLabelText = computed(() => {
|
|
2150
2692
|
const view = this.activeView();
|
|
2151
2693
|
if (view === 'skeleton') {
|
|
2152
|
-
return this.i18n.loading();
|
|
2694
|
+
return this.i18n().loading();
|
|
2153
2695
|
}
|
|
2154
2696
|
if (view === 'empty') {
|
|
2155
|
-
return this.i18n.empty();
|
|
2697
|
+
return this.i18n().empty();
|
|
2156
2698
|
}
|
|
2157
2699
|
if (view === 'error') {
|
|
2158
|
-
return this.i18n.error();
|
|
2700
|
+
return this.i18n().error();
|
|
2159
2701
|
}
|
|
2160
2702
|
const explicit = this.ariaLabel();
|
|
2161
2703
|
if (explicit !== null && explicit !== undefined && explicit !== '') {
|
|
2162
2704
|
return explicit;
|
|
2163
2705
|
}
|
|
2164
|
-
return this.i18n.summary(this.summary());
|
|
2706
|
+
return this.i18n().summary(this.summary());
|
|
2165
2707
|
}, ...(ngDevMode ? [{ debugName: "ariaLabelText" }] : /* istanbul ignore next */ []));
|
|
2166
|
-
/**
|
|
2708
|
+
/**
|
|
2709
|
+
* The single numeric projection of `data` through `summaryAccessor`.
|
|
2710
|
+
* Both {@link summary} and the data-table view derive from it, so the
|
|
2711
|
+
* projection runs once per data change and its `sameNumberArr` equal
|
|
2712
|
+
* stops the cascade when a refresh produces identical values.
|
|
2713
|
+
*/
|
|
2167
2714
|
summaryValues = computed(() => {
|
|
2168
2715
|
const acc = this.summaryAccessor();
|
|
2169
2716
|
const data = this.dataInput();
|
|
@@ -2188,7 +2735,7 @@ class CngxChart {
|
|
|
2188
2735
|
return this.dataInput().length > 1;
|
|
2189
2736
|
}, ...(ngDevMode ? [{ debugName: "tableActive" }] : /* istanbul ignore next */ []));
|
|
2190
2737
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2191
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChart, isStandalone: true, selector: "cngx-chart", inputs: { dataInput: { classPropertyName: "dataInput", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, preserveAspectRatio: { classPropertyName: "preserveAspectRatio", publicName: "preserveAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, summaryAccessor: { classPropertyName: "summaryAccessor", publicName: "summaryAccessor", isSignal: true, isRequired: false, transformFunction: null }, accessibleTable: { classPropertyName: "accessibleTable", publicName: "accessibleTable", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, connectionState: { classPropertyName: "connectionState", publicName: "connectionState", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "ariaLabelText()", "attr.aria-describedby": "dataTableId", "attr.aria-busy": "busy() ? \"true\" : null", "class.cngx-chart--responsive": "isResponsive()", "class.cngx-chart--content-hidden": "contentHidden()", "style.width.px": "width() ?? null", "style.aspect-ratio": "explicitAspectRatio()", "style.--cngx-chart-plot-block-start": "plotVars().blockStart", "style.--cngx-chart-plot-block-end": "plotVars().blockEnd", "style.--cngx-chart-plot-inline-start": "plotVars().inlineStart", "style.--cngx-chart-plot-inline-end": "plotVars().inlineEnd" } }, providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], queries: [{ propertyName: "axes", predicate: CNGX_CHART_AXIS, descendants: true, isSignal: true }, { propertyName: "thresholds", predicate: CngxThreshold, descendants: true, isSignal: true }, { propertyName: "layers", predicate: CNGX_CHART_LAYER, descendants: true, isSignal: true }, { propertyName: "loadingSlot", first: true, predicate: CngxChartLoading, descendants: true, isSignal: true }, { propertyName: "emptySlot", first: true, predicate: CngxChartEmpty, descendants: true, isSignal: true }, { propertyName: "errorSlot", first: true, predicate: CngxChartError, descendants: true, isSignal: true }, { propertyName: "connectionErrorSlot", first: true, predicate: CngxChartConnectionError, descendants: true, isSignal: true }, { propertyName: "reconnectingSlot", first: true, predicate: CngxChartReconnecting, descendants: true, isSignal: true }, { propertyName: "overlaySlot", first: true, predicate: CngxChartOverlay, descendants: true, isSignal: true }, { propertyName: "overlaySlots", predicate: CngxChartOverlay, isSignal: true }], exportAs: ["cngxChart"], hostDirectives: [{ directive: i1.CngxResizeObserver }], ngImport: i0, template: `
|
|
2738
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChart, isStandalone: true, selector: "cngx-chart", inputs: { dataInput: { classPropertyName: "dataInput", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, preserveAspectRatio: { classPropertyName: "preserveAspectRatio", publicName: "preserveAspectRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, summaryAccessor: { classPropertyName: "summaryAccessor", publicName: "summaryAccessor", isSignal: true, isRequired: false, transformFunction: null }, accessibleTable: { classPropertyName: "accessibleTable", publicName: "accessibleTable", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, connectionState: { classPropertyName: "connectionState", publicName: "connectionState", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "ariaLabelText()", "attr.aria-describedby": "dataTableId", "attr.aria-busy": "busy() ? \"true\" : null", "class.cngx-chart--responsive": "isResponsive()", "class.cngx-chart--content-hidden": "contentHidden()", "style.width.px": "width() ?? null", "style.aspect-ratio": "explicitAspectRatio()", "style.--cngx-chart-plot-block-start": "plotVars().blockStart", "style.--cngx-chart-plot-block-end": "plotVars().blockEnd", "style.--cngx-chart-plot-inline-start": "plotVars().inlineStart", "style.--cngx-chart-plot-inline-end": "plotVars().inlineEnd", "style.--_cngx-chart-hatch-diagonal": "hatchFill.diagonal", "style.--_cngx-chart-hatch-horizontal": "hatchFill.horizontal" } }, providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], queries: [{ propertyName: "axes", predicate: CNGX_CHART_AXIS, descendants: true, isSignal: true }, { propertyName: "thresholds", predicate: CngxThreshold, descendants: true, isSignal: true }, { propertyName: "layers", predicate: CNGX_CHART_LAYER, descendants: true, isSignal: true }, { propertyName: "loadingSlot", first: true, predicate: CngxChartLoading, descendants: true, isSignal: true }, { propertyName: "emptySlot", first: true, predicate: CngxChartEmpty, descendants: true, isSignal: true }, { propertyName: "errorSlot", first: true, predicate: CngxChartError, descendants: true, isSignal: true }, { propertyName: "connectionErrorSlot", first: true, predicate: CngxChartConnectionError, descendants: true, isSignal: true }, { propertyName: "reconnectingSlot", first: true, predicate: CngxChartReconnecting, descendants: true, isSignal: true }, { propertyName: "overlaySlot", first: true, predicate: CngxChartOverlay, descendants: true, isSignal: true }, { propertyName: "overlaySlots", predicate: CngxChartOverlay, isSignal: true }], exportAs: ["cngxChart"], hostDirectives: [{ directive: i1.CngxResizeObserver }], ngImport: i0, template: `
|
|
2192
2739
|
@switch (activeView()) {
|
|
2193
2740
|
@case ('skeleton') {
|
|
2194
2741
|
@if (loadingTpl(); as tpl) {
|
|
@@ -2207,7 +2754,7 @@ class CngxChart {
|
|
|
2207
2754
|
<ng-container *ngTemplateOutlet="tpl; context: slotContext()" />
|
|
2208
2755
|
</div>
|
|
2209
2756
|
} @else {
|
|
2210
|
-
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n.empty() }}</div>
|
|
2757
|
+
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n().empty() }}</div>
|
|
2211
2758
|
}
|
|
2212
2759
|
}
|
|
2213
2760
|
@case ('error') {
|
|
@@ -2217,7 +2764,7 @@ class CngxChart {
|
|
|
2217
2764
|
</div>
|
|
2218
2765
|
} @else {
|
|
2219
2766
|
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
2220
|
-
{{ i18n.error() }}
|
|
2767
|
+
{{ i18n().error() }}
|
|
2221
2768
|
</div>
|
|
2222
2769
|
}
|
|
2223
2770
|
}
|
|
@@ -2225,6 +2772,22 @@ class CngxChart {
|
|
|
2225
2772
|
@default {
|
|
2226
2773
|
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
2227
2774
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
2775
|
+
<svg:defs>
|
|
2776
|
+
<svg:pattern
|
|
2777
|
+
[attr.id]="hatchId + '-diagonal'"
|
|
2778
|
+
width="4"
|
|
2779
|
+
height="4"
|
|
2780
|
+
patternUnits="userSpaceOnUse"
|
|
2781
|
+
patternTransform="rotate(45)"
|
|
2782
|
+
>
|
|
2783
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2784
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2785
|
+
</svg:pattern>
|
|
2786
|
+
<svg:pattern [attr.id]="hatchId + '-horizontal'" width="4" height="4" patternUnits="userSpaceOnUse">
|
|
2787
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2788
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2789
|
+
</svg:pattern>
|
|
2790
|
+
</svg:defs>
|
|
2228
2791
|
<ng-content />
|
|
2229
2792
|
</svg>
|
|
2230
2793
|
@if (overlayTpl(); as tpl) {
|
|
@@ -2247,7 +2810,7 @@ class CngxChart {
|
|
|
2247
2810
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--error"
|
|
2248
2811
|
role="alert"
|
|
2249
2812
|
>
|
|
2250
|
-
{{
|
|
2813
|
+
{{ connectionOverlayText() }}
|
|
2251
2814
|
</div>
|
|
2252
2815
|
}
|
|
2253
2816
|
} @else if (connectionView() === 'reconnecting') {
|
|
@@ -2263,16 +2826,19 @@ class CngxChart {
|
|
|
2263
2826
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--reconnecting"
|
|
2264
2827
|
role="status"
|
|
2265
2828
|
>
|
|
2266
|
-
{{
|
|
2829
|
+
{{ connectionOverlayText() }}
|
|
2267
2830
|
</div>
|
|
2268
2831
|
}
|
|
2269
2832
|
}
|
|
2833
|
+
<span role="status" aria-live="polite" aria-atomic="true" class="cngx-chart__sr-status">{{
|
|
2834
|
+
connectionRestoredAnnouncement()
|
|
2835
|
+
}}</span>
|
|
2270
2836
|
<cngx-chart-data-table
|
|
2271
2837
|
[id]="dataTableId"
|
|
2272
2838
|
[values]="summaryValues()"
|
|
2273
2839
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
2274
2840
|
/>
|
|
2275
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
2841
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-chart .cngx-chart__hatch-ink{fill:CanvasText}cngx-chart .cngx-chart__hatch-gap{fill:Canvas}cngx-chart{display:inline-block;position:relative;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>.cngx-chart__canvas{position:absolute;inset:0;width:100%;height:100%;z-index:var(--cngx-chart-canvas-z, 0)}cngx-chart.cngx-chart--content-hidden>.cngx-chart__canvas{display:none}cngx-chart>svg{display:block;width:100%;height:100%}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__overlay-frame{position:absolute;inset-block-start:var(--cngx-chart-plot-block-start, 0px);inset-block-end:var(--cngx-chart-plot-block-end, 0px);inset-inline-start:var(--cngx-chart-plot-inline-start, 0px);inset-inline-end:var(--cngx-chart-plot-inline-end, 0px);z-index:var(--cngx-chart-overlay-z, 1);pointer-events:none}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}cngx-chart>.cngx-chart__connection-overlay{position:absolute;top:calc(var(--cngx-chart-plot-block-start, 0px) + var(--cngx-chart-connection-inset, .5rem));inset-inline-end:calc(var(--cngx-chart-plot-inline-end, 0px) + var(--cngx-chart-connection-inset, .5rem));max-inline-size:calc(100% - var(--cngx-chart-plot-inline-start, 0px) - var(--cngx-chart-plot-inline-end, 0px) - 2 * var(--cngx-chart-connection-inset, .5rem));display:flex;align-items:center;gap:var(--cngx-chart-connection-gap, .375rem);padding:var(--cngx-chart-connection-padding, .25rem .625rem);border-radius:var(--cngx-chart-connection-radius, 999px);font-size:var(--cngx-chart-connection-font-size, .75rem);line-height:1.4;pointer-events:none;box-shadow:var(--cngx-chart-connection-shadow, 0 1px 3px rgb(0 0 0 / .12))}cngx-chart>.cngx-chart__connection-overlay--error{background:var(--cngx-chart-connection-error-bg, var(--cngx-chart-danger, #d32f2f));color:var(--cngx-chart-connection-error-color, #fff)}cngx-chart>.cngx-chart__connection-overlay--reconnecting{background:var(--cngx-chart-connection-reconnecting-bg, rgb(0 0 0 / .72));color:var(--cngx-chart-connection-reconnecting-color, #fff)}cngx-chart>.cngx-chart__sr-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChartDataTable, selector: "cngx-chart-data-table", inputs: ["values", "hidden", "id"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2276
2842
|
}
|
|
2277
2843
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChart, decorators: [{
|
|
2278
2844
|
type: Component,
|
|
@@ -2291,6 +2857,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2291
2857
|
'[style.--cngx-chart-plot-block-end]': 'plotVars().blockEnd',
|
|
2292
2858
|
'[style.--cngx-chart-plot-inline-start]': 'plotVars().inlineStart',
|
|
2293
2859
|
'[style.--cngx-chart-plot-inline-end]': 'plotVars().inlineEnd',
|
|
2860
|
+
// Hatch fills the bar and scatter layers reference in forced colors.
|
|
2861
|
+
'[style.--_cngx-chart-hatch-diagonal]': 'hatchFill.diagonal',
|
|
2862
|
+
'[style.--_cngx-chart-hatch-horizontal]': 'hatchFill.horizontal',
|
|
2294
2863
|
}, hostDirectives: [CngxResizeObserver], providers: [{ provide: CNGX_CHART_CONTEXT, useExisting: CngxChart }], imports: [CngxChartDataTable, NgTemplateOutlet], template: `
|
|
2295
2864
|
@switch (activeView()) {
|
|
2296
2865
|
@case ('skeleton') {
|
|
@@ -2310,7 +2879,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2310
2879
|
<ng-container *ngTemplateOutlet="tpl; context: slotContext()" />
|
|
2311
2880
|
</div>
|
|
2312
2881
|
} @else {
|
|
2313
|
-
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n.empty() }}</div>
|
|
2882
|
+
<div class="cngx-chart__fallback" [attr.aria-hidden]="true">{{ i18n().empty() }}</div>
|
|
2314
2883
|
}
|
|
2315
2884
|
}
|
|
2316
2885
|
@case ('error') {
|
|
@@ -2320,7 +2889,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2320
2889
|
</div>
|
|
2321
2890
|
} @else {
|
|
2322
2891
|
<div class="cngx-chart__fallback cngx-chart__fallback--error" [attr.aria-hidden]="true">
|
|
2323
|
-
{{ i18n.error() }}
|
|
2892
|
+
{{ i18n().error() }}
|
|
2324
2893
|
</div>
|
|
2325
2894
|
}
|
|
2326
2895
|
}
|
|
@@ -2328,6 +2897,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2328
2897
|
@default {
|
|
2329
2898
|
<svg [attr.viewBox]="viewBox()" [attr.preserveAspectRatio]="preserveAspectRatio()">
|
|
2330
2899
|
<svg:title>{{ ariaLabelText() }}</svg:title>
|
|
2900
|
+
<svg:defs>
|
|
2901
|
+
<svg:pattern
|
|
2902
|
+
[attr.id]="hatchId + '-diagonal'"
|
|
2903
|
+
width="4"
|
|
2904
|
+
height="4"
|
|
2905
|
+
patternUnits="userSpaceOnUse"
|
|
2906
|
+
patternTransform="rotate(45)"
|
|
2907
|
+
>
|
|
2908
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2909
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2910
|
+
</svg:pattern>
|
|
2911
|
+
<svg:pattern [attr.id]="hatchId + '-horizontal'" width="4" height="4" patternUnits="userSpaceOnUse">
|
|
2912
|
+
<svg:rect class="cngx-chart__hatch-gap" width="4" height="4" />
|
|
2913
|
+
<svg:rect class="cngx-chart__hatch-ink" width="4" height="2" />
|
|
2914
|
+
</svg:pattern>
|
|
2915
|
+
</svg:defs>
|
|
2331
2916
|
<ng-content />
|
|
2332
2917
|
</svg>
|
|
2333
2918
|
@if (overlayTpl(); as tpl) {
|
|
@@ -2350,7 +2935,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2350
2935
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--error"
|
|
2351
2936
|
role="alert"
|
|
2352
2937
|
>
|
|
2353
|
-
{{
|
|
2938
|
+
{{ connectionOverlayText() }}
|
|
2354
2939
|
</div>
|
|
2355
2940
|
}
|
|
2356
2941
|
} @else if (connectionView() === 'reconnecting') {
|
|
@@ -2366,16 +2951,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2366
2951
|
class="cngx-chart__connection-overlay cngx-chart__connection-overlay--reconnecting"
|
|
2367
2952
|
role="status"
|
|
2368
2953
|
>
|
|
2369
|
-
{{
|
|
2954
|
+
{{ connectionOverlayText() }}
|
|
2370
2955
|
</div>
|
|
2371
2956
|
}
|
|
2372
2957
|
}
|
|
2958
|
+
<span role="status" aria-live="polite" aria-atomic="true" class="cngx-chart__sr-status">{{
|
|
2959
|
+
connectionRestoredAnnouncement()
|
|
2960
|
+
}}</span>
|
|
2373
2961
|
<cngx-chart-data-table
|
|
2374
2962
|
[id]="dataTableId"
|
|
2375
2963
|
[values]="summaryValues()"
|
|
2376
2964
|
[hidden]="!tableActive() || activeView() !== 'content'"
|
|
2377
2965
|
/>
|
|
2378
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
2966
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-chart .cngx-chart__hatch-ink{fill:CanvasText}cngx-chart .cngx-chart__hatch-gap{fill:Canvas}cngx-chart{display:inline-block;position:relative;max-width:100%}cngx-chart.cngx-chart--responsive{display:block;width:100%;aspect-ratio:var(--cngx-chart-aspect-ratio, 5 / 2)}cngx-chart>.cngx-chart__canvas{position:absolute;inset:0;width:100%;height:100%;z-index:var(--cngx-chart-canvas-z, 0)}cngx-chart.cngx-chart--content-hidden>.cngx-chart__canvas{display:none}cngx-chart>svg{display:block;width:100%;height:100%}cngx-chart>.cngx-chart__fallback-frame{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart>.cngx-chart__overlay-frame{position:absolute;inset-block-start:var(--cngx-chart-plot-block-start, 0px);inset-block-end:var(--cngx-chart-plot-block-end, 0px);inset-inline-start:var(--cngx-chart-plot-inline-start, 0px);inset-inline-end:var(--cngx-chart-plot-inline-end, 0px);z-index:var(--cngx-chart-overlay-z, 1);pointer-events:none}cngx-chart>.cngx-chart__loading{display:flex;align-items:center;justify-content:center;width:100%;height:100%}cngx-chart .cngx-chart__spinner{width:var(--cngx-chart-spinner-size, 32px);height:var(--cngx-chart-spinner-size, 32px);border:var(--cngx-chart-spinner-thickness, 3px) solid var(--cngx-chart-spinner-track, rgb(0 0 0 / .08));border-top-color:var(--cngx-chart-spinner-color, var(--cngx-chart-primary, currentColor));border-radius:50%;animation:cngx-chart-spin .8s linear infinite}cngx-chart>.cngx-chart__fallback{display:flex;align-items:center;justify-content:center;width:100%;height:100%;min-height:var(--cngx-chart-fallback-min-height, 48px);font-size:var(--cngx-chart-fallback-font-size, .875rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-chart-fallback-opacity, .7);padding:var(--cngx-chart-fallback-padding, 1rem);text-align:center;box-sizing:border-box}cngx-chart>.cngx-chart__fallback--error{color:var(--cngx-chart-danger, currentColor);opacity:1}cngx-chart>.cngx-chart__connection-overlay{position:absolute;top:calc(var(--cngx-chart-plot-block-start, 0px) + var(--cngx-chart-connection-inset, .5rem));inset-inline-end:calc(var(--cngx-chart-plot-inline-end, 0px) + var(--cngx-chart-connection-inset, .5rem));max-inline-size:calc(100% - var(--cngx-chart-plot-inline-start, 0px) - var(--cngx-chart-plot-inline-end, 0px) - 2 * var(--cngx-chart-connection-inset, .5rem));display:flex;align-items:center;gap:var(--cngx-chart-connection-gap, .375rem);padding:var(--cngx-chart-connection-padding, .25rem .625rem);border-radius:var(--cngx-chart-connection-radius, 999px);font-size:var(--cngx-chart-connection-font-size, .75rem);line-height:1.4;pointer-events:none;box-shadow:var(--cngx-chart-connection-shadow, 0 1px 3px rgb(0 0 0 / .12))}cngx-chart>.cngx-chart__connection-overlay--error{background:var(--cngx-chart-connection-error-bg, var(--cngx-chart-danger, #d32f2f));color:var(--cngx-chart-connection-error-color, #fff)}cngx-chart>.cngx-chart__connection-overlay--reconnecting{background:var(--cngx-chart-connection-reconnecting-bg, rgb(0 0 0 / .72));color:var(--cngx-chart-connection-reconnecting-color, #fff)}cngx-chart>.cngx-chart__sr-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}@keyframes cngx-chart-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){cngx-chart .cngx-chart__spinner{animation:none}}\n"] }]
|
|
2379
2967
|
}], ctorParameters: () => [], propDecorators: { dataInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], preserveAspectRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "preserveAspectRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], summaryAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "summaryAccessor", required: false }] }], accessibleTable: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessibleTable", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], connectionState: [{ type: i0.Input, args: [{ isSignal: true, alias: "connectionState", required: false }] }], axes: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_AXIS), { ...{ descendants: true }, isSignal: true }] }], thresholds: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxThreshold), { ...{ descendants: true }, isSignal: true }] }], layers: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CNGX_CHART_LAYER), { ...{ descendants: true }, isSignal: true }] }], loadingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartLoading), { isSignal: true }] }], emptySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartEmpty), { isSignal: true }] }], errorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartError), { isSignal: true }] }], connectionErrorSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartConnectionError), { isSignal: true }] }], reconnectingSlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartReconnecting), { isSignal: true }] }], overlaySlot: [{ type: i0.ContentChild, args: [i0.forwardRef(() => CngxChartOverlay), { isSignal: true }] }], overlaySlots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CngxChartOverlay), { isSignal: true }] }] } });
|
|
2380
2968
|
/** @internal */
|
|
2381
2969
|
function isHorizontalPosition(p) {
|
|
@@ -2502,16 +3090,22 @@ function toMs$1(v) {
|
|
|
2502
3090
|
class CngxChartAnnouncer {
|
|
2503
3091
|
/** The chart instance whose `significantChange()` this announcer voices. */
|
|
2504
3092
|
chart = input.required({ ...(ngDevMode ? { debugName: "chart" } : /* istanbul ignore next */ {}), alias: 'cngxChartAnnouncer' });
|
|
2505
|
-
i18n =
|
|
2506
|
-
/**
|
|
3093
|
+
i18n = injectChartI18n();
|
|
3094
|
+
/**
|
|
3095
|
+
* Polite (informational) text for trend flips; empty otherwise. The copy
|
|
3096
|
+
* is read untracked: only the chart event re-derives a live region, so a
|
|
3097
|
+
* copy or locale flip never re-speaks a shown announcement.
|
|
3098
|
+
*/
|
|
2507
3099
|
politeAnnouncement = computed(() => {
|
|
2508
3100
|
const ev = this.chart().significantChange();
|
|
2509
|
-
return ev?.kind === 'trend-flip' ? this.i18n.trendChanged(ev.to) : '';
|
|
3101
|
+
return ev?.kind === 'trend-flip' ? untracked(() => this.i18n().trendChanged(ev.to)) : '';
|
|
2510
3102
|
}, ...(ngDevMode ? [{ debugName: "politeAnnouncement" }] : /* istanbul ignore next */ []));
|
|
2511
|
-
/** Assertive (interrupting) text for threshold crossings; empty otherwise. */
|
|
3103
|
+
/** Assertive (interrupting) text for threshold crossings; empty otherwise. Copy untracked, as above. */
|
|
2512
3104
|
assertiveAnnouncement = computed(() => {
|
|
2513
3105
|
const ev = this.chart().significantChange();
|
|
2514
|
-
return ev?.kind === 'threshold-cross'
|
|
3106
|
+
return ev?.kind === 'threshold-cross'
|
|
3107
|
+
? untracked(() => this.i18n().thresholdAlert(ev.threshold))
|
|
3108
|
+
: '';
|
|
2515
3109
|
}, ...(ngDevMode ? [{ debugName: "assertiveAnnouncement" }] : /* istanbul ignore next */ []));
|
|
2516
3110
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartAnnouncer, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2517
3111
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.4", type: CngxChartAnnouncer, isStandalone: true, selector: "cngx-chart-announcer", inputs: { chart: { classPropertyName: "chart", publicName: "cngxChartAnnouncer", isSignal: true, isRequired: true, transformFunction: null } }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
|
|
@@ -2656,6 +3250,19 @@ class CngxAxis {
|
|
|
2656
3250
|
*/
|
|
2657
3251
|
axisLabel = input(null, { ...(ngDevMode ? { debugName: "axisLabel" } : /* istanbul ignore next */ {}), alias: 'label' });
|
|
2658
3252
|
ctx = inject(CNGX_CHART_CONTEXT);
|
|
3253
|
+
locale = injectLocale();
|
|
3254
|
+
/**
|
|
3255
|
+
* The bound `[format]`, or the default tick formatter bound to the app
|
|
3256
|
+
* locale (`CNGX_LOCALE`), so a locale flip re-formats the default labels.
|
|
3257
|
+
*/
|
|
3258
|
+
resolvedFormat = computed(() => {
|
|
3259
|
+
const fmt = this.format();
|
|
3260
|
+
if (fmt !== defaultTickFormat) {
|
|
3261
|
+
return fmt;
|
|
3262
|
+
}
|
|
3263
|
+
const locale = this.locale();
|
|
3264
|
+
return (v) => defaultTickFormat(v, locale);
|
|
3265
|
+
}, ...(ngDevMode ? [{ debugName: "resolvedFormat" }] : /* istanbul ignore next */ []));
|
|
2659
3266
|
/**
|
|
2660
3267
|
* Tick values to render. Resolution order:
|
|
2661
3268
|
* 1. `type='band'` and `[domain]` provided → one tick per domain
|
|
@@ -2785,7 +3392,7 @@ class CngxAxis {
|
|
|
2785
3392
|
* the label's width is exactly what overhangs the plot corner.
|
|
2786
3393
|
*/
|
|
2787
3394
|
longestTickLabel = computed(() => {
|
|
2788
|
-
const fmt = this.
|
|
3395
|
+
const fmt = this.resolvedFormat();
|
|
2789
3396
|
let longest = 0;
|
|
2790
3397
|
for (const v of this.tickValues()) {
|
|
2791
3398
|
const len = fmt(v).length;
|
|
@@ -2839,7 +3446,7 @@ class CngxAxis {
|
|
|
2839
3446
|
tickRenderings = computed(() => {
|
|
2840
3447
|
const pos = this.position();
|
|
2841
3448
|
const values = this.tickValues();
|
|
2842
|
-
const fmt = this.
|
|
3449
|
+
const fmt = this.resolvedFormat();
|
|
2843
3450
|
const plot = this.plot();
|
|
2844
3451
|
if (!plot) {
|
|
2845
3452
|
return [];
|
|
@@ -2929,7 +3536,7 @@ class CngxAxis {
|
|
|
2929
3536
|
}
|
|
2930
3537
|
}
|
|
2931
3538
|
}
|
|
2932
|
-
`, isInline: true, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3539
|
+
`, isInline: true, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}@media(forced-colors:active){.cngx-axis__line,.cngx-axis__tick-line,.cngx-axis__grid-line{stroke:CanvasText}.cngx-axis__grid-line{stroke-opacity:.35}.cngx-axis__tick-label,.cngx-axis__axis-label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
2933
3540
|
}
|
|
2934
3541
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxAxis, decorators: [{
|
|
2935
3542
|
type: Component,
|
|
@@ -2991,7 +3598,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
2991
3598
|
}
|
|
2992
3599
|
}
|
|
2993
3600
|
}
|
|
2994
|
-
`, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}\n"] }]
|
|
3601
|
+
`, styles: [".cngx-axis__line,.cngx-axis__tick-line{stroke:var(--cngx-axis-color, var(--cngx-chart-axis-color, currentColor));stroke-width:var(--cngx-axis-stroke-width, 1px);fill:none}.cngx-axis__tick-label{fill:var(--cngx-axis-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}.cngx-axis__grid-line{stroke:var(--cngx-axis-grid-color, var(--cngx-chart-grid-color, currentColor));stroke-opacity:var(--cngx-axis-grid-opacity, .6);stroke-width:var(--cngx-axis-grid-stroke-width, 1px);stroke-dasharray:var(--cngx-axis-grid-dasharray, 0);fill:none;pointer-events:none}.cngx-axis__axis-label{fill:var(--cngx-axis-axis-label-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-axis-axis-label-font-size, 12px);font-weight:var(--cngx-axis-axis-label-font-weight, 500)}@media(forced-colors:active){.cngx-axis__line,.cngx-axis__tick-line,.cngx-axis__grid-line{stroke:CanvasText}.cngx-axis__grid-line{stroke-opacity:.35}.cngx-axis__tick-label,.cngx-axis__axis-label{fill:CanvasText}}\n"] }]
|
|
2995
3602
|
}], propDecorators: { position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: true }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], domain: [{ type: i0.Input, args: [{ isSignal: true, alias: "domain", required: false }] }], tickCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "ticks", required: false }] }], format: [{ type: i0.Input, args: [{ isSignal: true, alias: "format", required: false }] }], showGrid: [{ type: i0.Input, args: [{ isSignal: true, alias: "grid", required: false }] }], axisLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }] } });
|
|
2996
3603
|
/** @internal */
|
|
2997
3604
|
function spread(start, end, count) {
|
|
@@ -3117,27 +3724,60 @@ function buildTickRendering(pos, offset, text, key, plot) {
|
|
|
3117
3724
|
* Default tick label formatter. Strips floating-point arithmetic
|
|
3118
3725
|
* noise from non-integer numbers - `6.6000000000000005` becomes
|
|
3119
3726
|
* `'6.6'`, `2.2` stays `'2.2'`, `25` stays `'25'` - without rounding
|
|
3120
|
-
* away meaningful precision
|
|
3121
|
-
*
|
|
3727
|
+
* away meaningful precision, in the app locale's decimal separator.
|
|
3728
|
+
* Dates go through cached `Intl` formatters ({@link formatDateTick});
|
|
3729
|
+
* other types fall through to `String(v)`. Consumers needing a richer
|
|
3730
|
+
* format bind `[format]`. `CngxAxis` calls it with the `CNGX_LOCALE`
|
|
3731
|
+
* value; the `en-US` default only applies to a direct call.
|
|
3122
3732
|
*
|
|
3123
3733
|
* @internal
|
|
3124
3734
|
*/
|
|
3125
|
-
function defaultTickFormat(v) {
|
|
3735
|
+
function defaultTickFormat(v, locale = 'en-US') {
|
|
3126
3736
|
if (typeof v === 'number') {
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
return String(v);
|
|
3132
|
-
}
|
|
3133
|
-
// 12 significant digits is more than enough for any sensible
|
|
3134
|
-
// chart domain while collapsing the trailing 1e-15 noise
|
|
3135
|
-
// produced by accumulated float math.
|
|
3136
|
-
return Number(v.toPrecision(12)).toString();
|
|
3737
|
+
return formatChartNumber(v, locale);
|
|
3738
|
+
}
|
|
3739
|
+
if (v instanceof Date) {
|
|
3740
|
+
return formatDateTick(v, locale);
|
|
3137
3741
|
}
|
|
3138
3742
|
return String(v);
|
|
3139
3743
|
}
|
|
3140
3744
|
/** @internal */
|
|
3745
|
+
const DATE_TICK_OPTIONS = { month: 'short', day: 'numeric' };
|
|
3746
|
+
/** @internal */
|
|
3747
|
+
const TIME_TICK_OPTIONS = { hour: '2-digit', minute: '2-digit' };
|
|
3748
|
+
/** @internal */
|
|
3749
|
+
const TIME_SECONDS_TICK_OPTIONS = {
|
|
3750
|
+
hour: '2-digit',
|
|
3751
|
+
minute: '2-digit',
|
|
3752
|
+
second: '2-digit',
|
|
3753
|
+
};
|
|
3754
|
+
/**
|
|
3755
|
+
* Compact Date tick label. `String(Date)` produces a ~60-character
|
|
3756
|
+
* string whose length flows into {@link CngxAxis.reservation} and
|
|
3757
|
+
* collapses the plot to a sliver of gutter. Instead: a date at local
|
|
3758
|
+
* midnight labels as a short date (`Sep 4`), any other instant as a
|
|
3759
|
+
* time (`09:14`, with seconds only when the instant carries them) -
|
|
3760
|
+
* the resolution a generated time-axis tick actually has. Formatters
|
|
3761
|
+
* come from the bounded `dateTimeFormatterFor` cache (constructing one
|
|
3762
|
+
* is expensive; the labels feed the gutter arithmetic on every tick
|
|
3763
|
+
* recompute).
|
|
3764
|
+
*
|
|
3765
|
+
* @internal
|
|
3766
|
+
*/
|
|
3767
|
+
function formatDateTick(v, locale) {
|
|
3768
|
+
if (Number.isNaN(v.getTime())) {
|
|
3769
|
+
return '';
|
|
3770
|
+
}
|
|
3771
|
+
const midnight = v.getHours() === 0 && v.getMinutes() === 0 && v.getSeconds() === 0 && v.getMilliseconds() === 0;
|
|
3772
|
+
if (midnight) {
|
|
3773
|
+
return dateTimeFormatterFor(locale, DATE_TICK_OPTIONS).format(v);
|
|
3774
|
+
}
|
|
3775
|
+
if (v.getSeconds() === 0 && v.getMilliseconds() === 0) {
|
|
3776
|
+
return dateTimeFormatterFor(locale, TIME_TICK_OPTIONS).format(v);
|
|
3777
|
+
}
|
|
3778
|
+
return dateTimeFormatterFor(locale, TIME_SECONDS_TICK_OPTIONS).format(v);
|
|
3779
|
+
}
|
|
3780
|
+
/** @internal */
|
|
3141
3781
|
function buildAxisLabelGeometry(pos, plot) {
|
|
3142
3782
|
// Local to the axis group, so the offsets stay as they were and only
|
|
3143
3783
|
// the centring runs along the plot extent instead of the box.
|
|
@@ -3273,6 +3913,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3273
3913
|
* and column; `[align]` aligns along the main axis (`start`, `center`,
|
|
3274
3914
|
* `end`).
|
|
3275
3915
|
*
|
|
3916
|
+
* Under forced colors the swatches turn into a four-step pattern by
|
|
3917
|
+
* entry index (solid, 45deg hatch, hollow, 0deg hatch). The stacked-bar
|
|
3918
|
+
* segments and the chart series carry the same step by index: lines as
|
|
3919
|
+
* solid, dashed, dotted, dash-dot; bars and scatter points as the swatch
|
|
3920
|
+
* patterns. Series count line, bar and scatter layers in source order
|
|
3921
|
+
* (areas, thresholds, bands and axes do not count), so list the entries
|
|
3922
|
+
* in the order of those layers.
|
|
3923
|
+
*
|
|
3276
3924
|
* @category common/chart/legend
|
|
3277
3925
|
* @docsKind primary
|
|
3278
3926
|
* @wcag AA
|
|
@@ -3284,6 +3932,12 @@ class CngxChartLegend {
|
|
|
3284
3932
|
items = input.required(...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
3285
3933
|
orientation = input('horizontal', ...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
3286
3934
|
align = input('start', ...(ngDevMode ? [{ debugName: "align" }] : /* istanbul ignore next */ []));
|
|
3935
|
+
locale = injectLocale();
|
|
3936
|
+
/** @internal Each item's value as display text; numbers in the app locale. */
|
|
3937
|
+
displayValues = computed(() => {
|
|
3938
|
+
const locale = this.locale();
|
|
3939
|
+
return this.items().map(({ value }) => typeof value === 'number' ? formatChartNumber(value, locale) : String(value));
|
|
3940
|
+
}, { ...(ngDevMode ? { debugName: "displayValues" } : /* istanbul ignore next */ {}), equal: arrayEqual });
|
|
3287
3941
|
flexAlign = computed(() => {
|
|
3288
3942
|
switch (this.align()) {
|
|
3289
3943
|
case 'center':
|
|
@@ -3296,7 +3950,7 @@ class CngxChartLegend {
|
|
|
3296
3950
|
}, ...(ngDevMode ? [{ debugName: "flexAlign" }] : /* istanbul ignore next */ []));
|
|
3297
3951
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartLegend, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3298
3952
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxChartLegend, isStandalone: true, selector: "cngx-chart-legend", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "list" }, properties: { "class.cngx-chart-legend--vertical": "orientation() === \"vertical\"", "style.justify-content": "flexAlign()" }, classAttribute: "cngx-chart-legend" }, exportAs: ["cngxChartLegend"], ngImport: i0, template: `
|
|
3299
|
-
@for (item of items(); track $index) {
|
|
3953
|
+
@for (item of items(); track $index; let i = $index) {
|
|
3300
3954
|
<span class="cngx-chart-legend__item" role="listitem">
|
|
3301
3955
|
<span
|
|
3302
3956
|
class="cngx-chart-legend__swatch"
|
|
@@ -3305,11 +3959,11 @@ class CngxChartLegend {
|
|
|
3305
3959
|
></span>
|
|
3306
3960
|
<span class="cngx-chart-legend__label">{{ item.label }}</span>
|
|
3307
3961
|
@if (item.value != null) {
|
|
3308
|
-
<span class="cngx-chart-legend__value">{{
|
|
3962
|
+
<span class="cngx-chart-legend__value">{{ displayValues()[i] }}</span>
|
|
3309
3963
|
}
|
|
3310
3964
|
</span>
|
|
3311
3965
|
}
|
|
3312
|
-
`, isInline: true, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3966
|
+
`, isInline: true, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}@media(forced-colors:active){cngx-chart-legend .cngx-chart-legend__swatch{forced-color-adjust:none;background:CanvasText!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+2) .cngx-chart-legend__swatch{background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+3) .cngx-chart-legend__swatch{background:Canvas!important;box-shadow:inset 0 0 0 1px CanvasText}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+4) .cngx-chart-legend__swatch{background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3313
3967
|
}
|
|
3314
3968
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxChartLegend, decorators: [{
|
|
3315
3969
|
type: Component,
|
|
@@ -3319,7 +3973,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3319
3973
|
'[class.cngx-chart-legend--vertical]': 'orientation() === "vertical"',
|
|
3320
3974
|
'[style.justify-content]': 'flexAlign()',
|
|
3321
3975
|
}, template: `
|
|
3322
|
-
@for (item of items(); track $index) {
|
|
3976
|
+
@for (item of items(); track $index; let i = $index) {
|
|
3323
3977
|
<span class="cngx-chart-legend__item" role="listitem">
|
|
3324
3978
|
<span
|
|
3325
3979
|
class="cngx-chart-legend__swatch"
|
|
@@ -3328,11 +3982,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3328
3982
|
></span>
|
|
3329
3983
|
<span class="cngx-chart-legend__label">{{ item.label }}</span>
|
|
3330
3984
|
@if (item.value != null) {
|
|
3331
|
-
<span class="cngx-chart-legend__value">{{
|
|
3985
|
+
<span class="cngx-chart-legend__value">{{ displayValues()[i] }}</span>
|
|
3332
3986
|
}
|
|
3333
3987
|
</span>
|
|
3334
3988
|
}
|
|
3335
|
-
`, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"] }]
|
|
3989
|
+
`, styles: ["cngx-chart-legend{display:flex;flex-wrap:wrap;gap:var(--cngx-chart-legend-gap, 12px);font-size:var(--cngx-chart-legend-font-size, .8125rem);color:var(--cngx-chart-legend-color, var(--cngx-chart-text-color, currentColor));align-items:center}cngx-chart-legend.cngx-chart-legend--vertical{flex-direction:column;align-items:flex-start}cngx-chart-legend .cngx-chart-legend__item{display:inline-flex;align-items:center;gap:var(--cngx-chart-legend-item-gap, 6px)}cngx-chart-legend .cngx-chart-legend__swatch{display:inline-block;width:var(--cngx-chart-legend-swatch-size, 12px);height:var(--cngx-chart-legend-swatch-size, 12px);background:var(--cngx-chart-primary, currentColor);border-radius:var(--cngx-chart-legend-swatch-radius, 2px)}@media(forced-colors:active){cngx-chart-legend .cngx-chart-legend__swatch{forced-color-adjust:none;background:CanvasText!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+2) .cngx-chart-legend__swatch{background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+3) .cngx-chart-legend__swatch{background:Canvas!important;box-shadow:inset 0 0 0 1px CanvasText}cngx-chart-legend .cngx-chart-legend__item:nth-child(4n+4) .cngx-chart-legend__swatch{background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}}cngx-chart-legend .cngx-chart-legend__value{color:var(--cngx-chart-legend-value-color, inherit);font-weight:var(--cngx-chart-legend-value-font-weight, 600);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}\n"] }]
|
|
3336
3990
|
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: true }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], align: [{ type: i0.Input, args: [{ isSignal: true, alias: "align", required: false }] }] } });
|
|
3337
3991
|
|
|
3338
3992
|
/**
|
|
@@ -3520,34 +4174,64 @@ function createPathBuilder(opts) {
|
|
|
3520
4174
|
let lastData = null;
|
|
3521
4175
|
let lastX = null;
|
|
3522
4176
|
let lastY = null;
|
|
4177
|
+
let lastSegments = [];
|
|
3523
4178
|
let lastResult = '';
|
|
3524
4179
|
let rebuilds = 0;
|
|
4180
|
+
const rebuild = (data, xScale, yScale) => {
|
|
4181
|
+
if (data === lastData && xScale === lastX && yScale === lastY) {
|
|
4182
|
+
return;
|
|
4183
|
+
}
|
|
4184
|
+
const runs = projectFiniteRuns(data, xAcc, yAcc, xScale, yScale);
|
|
4185
|
+
lastSegments = runs.map((run) => ({
|
|
4186
|
+
d: buildCurvePath(run, curve),
|
|
4187
|
+
firstX: run[0].x,
|
|
4188
|
+
lastX: run[run.length - 1].x,
|
|
4189
|
+
}));
|
|
4190
|
+
lastResult = lastSegments.map((s) => s.d).join(' ');
|
|
4191
|
+
lastData = data;
|
|
4192
|
+
lastX = xScale;
|
|
4193
|
+
lastY = yScale;
|
|
4194
|
+
rebuilds++;
|
|
4195
|
+
};
|
|
3525
4196
|
return {
|
|
3526
4197
|
build(data, xScale, yScale) {
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
lastX = xScale;
|
|
3534
|
-
lastY = yScale;
|
|
3535
|
-
lastResult = d;
|
|
3536
|
-
rebuilds++;
|
|
3537
|
-
return d;
|
|
4198
|
+
rebuild(data, xScale, yScale);
|
|
4199
|
+
return lastResult;
|
|
4200
|
+
},
|
|
4201
|
+
buildSegments(data, xScale, yScale) {
|
|
4202
|
+
rebuild(data, xScale, yScale);
|
|
4203
|
+
return lastSegments;
|
|
3538
4204
|
},
|
|
3539
4205
|
rebuildCount() {
|
|
3540
4206
|
return rebuilds;
|
|
3541
4207
|
},
|
|
3542
4208
|
};
|
|
3543
4209
|
}
|
|
3544
|
-
/**
|
|
3545
|
-
|
|
3546
|
-
|
|
4210
|
+
/**
|
|
4211
|
+
* Project every row and split the result at non-finite coordinates:
|
|
4212
|
+
* returns the runs of consecutive points whose `x` and `y` are both
|
|
4213
|
+
* finite. Non-finite rows appear in no run - they are the breaks.
|
|
4214
|
+
*
|
|
4215
|
+
* @internal
|
|
4216
|
+
*/
|
|
4217
|
+
function projectFiniteRuns(data, xAcc, yAcc, xScale, yScale) {
|
|
4218
|
+
const runs = [];
|
|
4219
|
+
let current = null;
|
|
3547
4220
|
for (let i = 0; i < data.length; i++) {
|
|
3548
|
-
|
|
4221
|
+
const x = xScale(xAcc(data[i], i));
|
|
4222
|
+
const y = yScale(yAcc(data[i], i));
|
|
4223
|
+
if (Number.isFinite(x) && Number.isFinite(y)) {
|
|
4224
|
+
if (current === null) {
|
|
4225
|
+
current = [];
|
|
4226
|
+
runs.push(current);
|
|
4227
|
+
}
|
|
4228
|
+
current.push({ x, y });
|
|
4229
|
+
}
|
|
4230
|
+
else {
|
|
4231
|
+
current = null;
|
|
4232
|
+
}
|
|
3549
4233
|
}
|
|
3550
|
-
return
|
|
4234
|
+
return runs;
|
|
3551
4235
|
}
|
|
3552
4236
|
|
|
3553
4237
|
/**
|
|
@@ -3632,13 +4316,13 @@ class CngxLine {
|
|
|
3632
4316
|
return g.kind === 'line' ? (g.points ?? EMPTY_POINTS) : EMPTY_POINTS;
|
|
3633
4317
|
}, ...(ngDevMode ? [{ debugName: "pointMarks" }] : /* istanbul ignore next */ []));
|
|
3634
4318
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxLine, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3635
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxLine, isStandalone: true, selector: "[cngxLine]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], exportAs: ["cngxLine"], ngImport: i0, template: `
|
|
4319
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxLine, isStandalone: true, selector: "[cngxLine]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], exportAs: ["cngxLine"], ngImport: i0, template: `
|
|
3636
4320
|
@if (ctx.renderSvg()) {
|
|
3637
4321
|
<svg:path
|
|
3638
4322
|
class="cngx-line"
|
|
3639
4323
|
[attr.d]="d()"
|
|
3640
4324
|
[attr.fill]="'none'"
|
|
3641
|
-
[
|
|
4325
|
+
[style.stroke]="color()"
|
|
3642
4326
|
[attr.stroke-width]="strokeWidth()"
|
|
3643
4327
|
[attr.stroke-linejoin]="'round'"
|
|
3644
4328
|
[attr.stroke-linecap]="'round'"
|
|
@@ -3647,17 +4331,17 @@ class CngxLine {
|
|
|
3647
4331
|
<svg:circle class="cngx-line__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3648
4332
|
}
|
|
3649
4333
|
}
|
|
3650
|
-
`, isInline: true, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4334
|
+
`, isInline: true, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}@media(forced-colors:active){.cngx-line{stroke:CanvasText!important}.cngx-line__point{fill:CanvasText}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-line{stroke-dasharray:6 3}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-line{stroke-dasharray:.1 4}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-line{stroke-dasharray:8 3 .1 3}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3651
4335
|
}
|
|
3652
4336
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxLine, decorators: [{
|
|
3653
4337
|
type: Component,
|
|
3654
|
-
args: [{ selector: '[cngxLine]', exportAs: 'cngxLine', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], template: `
|
|
4338
|
+
args: [{ selector: '[cngxLine]', exportAs: 'cngxLine', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxLine }], host: { class: 'cngx-chart-series' }, template: `
|
|
3655
4339
|
@if (ctx.renderSvg()) {
|
|
3656
4340
|
<svg:path
|
|
3657
4341
|
class="cngx-line"
|
|
3658
4342
|
[attr.d]="d()"
|
|
3659
4343
|
[attr.fill]="'none'"
|
|
3660
|
-
[
|
|
4344
|
+
[style.stroke]="color()"
|
|
3661
4345
|
[attr.stroke-width]="strokeWidth()"
|
|
3662
4346
|
[attr.stroke-linejoin]="'round'"
|
|
3663
4347
|
[attr.stroke-linecap]="'round'"
|
|
@@ -3666,7 +4350,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3666
4350
|
<svg:circle class="cngx-line__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3667
4351
|
}
|
|
3668
4352
|
}
|
|
3669
|
-
`, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}\n"] }]
|
|
4353
|
+
`, styles: [".cngx-line{stroke:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));stroke-width:var(--cngx-line-stroke-width, 1.5px);animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-line-enter{0%{opacity:0}to{opacity:1}}.cngx-line__point{r:var(--cngx-line-point-radius, 3px);fill:var(--cngx-line-color, var(--cngx-chart-primary, currentColor));animation:cngx-line-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-line,.cngx-line__point{animation:none}}@media(forced-colors:active){.cngx-line{stroke:CanvasText!important}.cngx-line__point{fill:CanvasText}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-line{stroke-dasharray:6 3}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-line{stroke-dasharray:.1 4}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-line{stroke-dasharray:8 3 .1 3}}\n"] }]
|
|
3670
4354
|
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
3671
4355
|
|
|
3672
4356
|
/**
|
|
@@ -3702,6 +4386,7 @@ class CngxArea {
|
|
|
3702
4386
|
accessor = input((d) => Number(d), ...(ngDevMode ? [{ debugName: "accessor" }] : /* istanbul ignore next */ []));
|
|
3703
4387
|
xAccessor = input(undefined, ...(ngDevMode ? [{ debugName: "xAccessor" }] : /* istanbul ignore next */ []));
|
|
3704
4388
|
opacity = input(null, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
|
|
4389
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
3705
4390
|
curve = input('linear', ...(ngDevMode ? [{ debugName: "curve" }] : /* istanbul ignore next */ []));
|
|
3706
4391
|
baseline = input(0, ...(ngDevMode ? [{ debugName: "baseline" }] : /* istanbul ignore next */ []));
|
|
3707
4392
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
@@ -3732,19 +4417,21 @@ class CngxArea {
|
|
|
3732
4417
|
}
|
|
3733
4418
|
const xScale = this.ctx.xScale();
|
|
3734
4419
|
const yScale = this.ctx.yScale();
|
|
3735
|
-
const upper = this.builder().build(data, xScale, yScale);
|
|
3736
4420
|
const baselineY = yScale(this.baseline());
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
return
|
|
4421
|
+
// Close every finite run to the baseline individually - a gap
|
|
4422
|
+
// (non-finite row) must stay unfilled, not be bridged by one
|
|
4423
|
+
// whole-path closure.
|
|
4424
|
+
return this.builder()
|
|
4425
|
+
.buildSegments(data, xScale, yScale)
|
|
4426
|
+
.map((seg) => `${seg.d} L ${seg.lastX} ${baselineY} L ${seg.firstX} ${baselineY} Z`)
|
|
4427
|
+
.join(' ');
|
|
3741
4428
|
}, { ...(ngDevMode ? { debugName: "d" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b });
|
|
3742
4429
|
geometry = computed(() => {
|
|
3743
4430
|
const op = this.opacity();
|
|
3744
4431
|
return {
|
|
3745
4432
|
kind: 'area',
|
|
3746
4433
|
d: this.d(),
|
|
3747
|
-
color:
|
|
4434
|
+
color: this.color(),
|
|
3748
4435
|
strokeWidth: null,
|
|
3749
4436
|
fill: null,
|
|
3750
4437
|
opacity: op == null ? null : Number(op),
|
|
@@ -3761,26 +4448,36 @@ class CngxArea {
|
|
|
3761
4448
|
return g.kind === 'area' ? (g.points ?? EMPTY_POINTS) : EMPTY_POINTS;
|
|
3762
4449
|
}, ...(ngDevMode ? [{ debugName: "pointMarks" }] : /* istanbul ignore next */ []));
|
|
3763
4450
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxArea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3764
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxArea, isStandalone: true, selector: "[cngxArea]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], exportAs: ["cngxArea"], ngImport: i0, template: `
|
|
4451
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxArea, isStandalone: true, selector: "[cngxArea]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, xAccessor: { classPropertyName: "xAccessor", publicName: "xAccessor", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, curve: { classPropertyName: "curve", publicName: "curve", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, points: { classPropertyName: "points", publicName: "points", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], exportAs: ["cngxArea"], ngImport: i0, template: `
|
|
3765
4452
|
@if (ctx.renderSvg()) {
|
|
3766
|
-
<svg:path
|
|
4453
|
+
<svg:path
|
|
4454
|
+
class="cngx-area"
|
|
4455
|
+
[attr.d]="d()"
|
|
4456
|
+
[style.fill]="color()"
|
|
4457
|
+
[style.fill-opacity]="opacity()"
|
|
4458
|
+
/>
|
|
3767
4459
|
@for (p of pointMarks(); track $index) {
|
|
3768
4460
|
<svg:circle class="cngx-area__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3769
4461
|
}
|
|
3770
4462
|
}
|
|
3771
|
-
`, isInline: true, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4463
|
+
`, isInline: true, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}@media(forced-colors:active){.cngx-area{fill:CanvasText!important}.cngx-area__point{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3772
4464
|
}
|
|
3773
4465
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxArea, decorators: [{
|
|
3774
4466
|
type: Component,
|
|
3775
4467
|
args: [{ selector: '[cngxArea]', exportAs: 'cngxArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxArea }], template: `
|
|
3776
4468
|
@if (ctx.renderSvg()) {
|
|
3777
|
-
<svg:path
|
|
4469
|
+
<svg:path
|
|
4470
|
+
class="cngx-area"
|
|
4471
|
+
[attr.d]="d()"
|
|
4472
|
+
[style.fill]="color()"
|
|
4473
|
+
[style.fill-opacity]="opacity()"
|
|
4474
|
+
/>
|
|
3778
4475
|
@for (p of pointMarks(); track $index) {
|
|
3779
4476
|
<svg:circle class="cngx-area__point" [attr.cx]="p.cx" [attr.cy]="p.cy" />
|
|
3780
4477
|
}
|
|
3781
4478
|
}
|
|
3782
|
-
`, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}\n"] }]
|
|
3783
|
-
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
4479
|
+
`, styles: [".cngx-area{fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));fill-opacity:var(--cngx-area-opacity, .18);stroke:none;animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-area-enter{0%{opacity:0}to{opacity:1}}.cngx-area__point{r:var(--cngx-area-point-radius, 3px);fill:var(--cngx-area-fill, var(--cngx-chart-primary, currentColor));animation:cngx-area-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@media(prefers-reduced-motion:reduce){.cngx-area,.cngx-area__point{animation:none}}@media(forced-colors:active){.cngx-area{fill:CanvasText!important}.cngx-area__point{fill:CanvasText}}\n"] }]
|
|
4480
|
+
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], xAccessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "xAccessor", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], curve: [{ type: i0.Input, args: [{ isSignal: true, alias: "curve", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], points: [{ type: i0.Input, args: [{ isSignal: true, alias: "points", required: false }] }] } });
|
|
3784
4481
|
|
|
3785
4482
|
/** @internal */
|
|
3786
4483
|
const FALLBACK_BASELINE = 0;
|
|
@@ -3815,6 +4512,7 @@ class CngxBar {
|
|
|
3815
4512
|
gap = input(0.1, ...(ngDevMode ? [{ debugName: "gap" }] : /* istanbul ignore next */ []));
|
|
3816
4513
|
baseline = input(FALLBACK_BASELINE, ...(ngDevMode ? [{ debugName: "baseline" }] : /* istanbul ignore next */ []));
|
|
3817
4514
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
4515
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
3818
4516
|
ctx = injectChartContext('CngxBar');
|
|
3819
4517
|
resolvedData = computed(() => {
|
|
3820
4518
|
const local = this.data();
|
|
@@ -3863,10 +4561,16 @@ class CngxBar {
|
|
|
3863
4561
|
}, { ...(ngDevMode ? { debugName: "rects" } : /* istanbul ignore next */ {}), equal: rectsEqual });
|
|
3864
4562
|
geometry = computed(() => ({
|
|
3865
4563
|
kind: 'bar',
|
|
3866
|
-
rects: this.rects().map((r) => ({
|
|
4564
|
+
rects: this.rects().map((r) => ({
|
|
4565
|
+
x: r.x,
|
|
4566
|
+
y: r.y,
|
|
4567
|
+
w: r.width,
|
|
4568
|
+
h: r.height,
|
|
4569
|
+
color: this.color(),
|
|
4570
|
+
})),
|
|
3867
4571
|
}), { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: barGeomEqual });
|
|
3868
4572
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3869
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBar, isStandalone: true, selector: "[cngxBar]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], exportAs: ["cngxBar"], ngImport: i0, template: `
|
|
4573
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBar, isStandalone: true, selector: "[cngxBar]", inputs: { accessor: { classPropertyName: "accessor", publicName: "accessor", isSignal: true, isRequired: false, transformFunction: null }, gap: { classPropertyName: "gap", publicName: "gap", isSignal: true, isRequired: false, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], exportAs: ["cngxBar"], ngImport: i0, template: `
|
|
3870
4574
|
@if (ctx.renderSvg()) {
|
|
3871
4575
|
@for (rect of rects(); track rect.key) {
|
|
3872
4576
|
<svg:rect
|
|
@@ -3875,14 +4579,15 @@ class CngxBar {
|
|
|
3875
4579
|
[attr.y]="rect.y"
|
|
3876
4580
|
[attr.width]="rect.width"
|
|
3877
4581
|
[attr.height]="rect.height"
|
|
4582
|
+
[style.fill]="color()"
|
|
3878
4583
|
/>
|
|
3879
4584
|
}
|
|
3880
4585
|
}
|
|
3881
|
-
`, isInline: true, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4586
|
+
`, isInline: true, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}@media(forced-colors:active){.cngx-bar{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-bar{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
3882
4587
|
}
|
|
3883
4588
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBar, decorators: [{
|
|
3884
4589
|
type: Component,
|
|
3885
|
-
args: [{ selector: '[cngxBar]', exportAs: 'cngxBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], template: `
|
|
4590
|
+
args: [{ selector: '[cngxBar]', exportAs: 'cngxBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBar }], host: { class: 'cngx-chart-series' }, template: `
|
|
3886
4591
|
@if (ctx.renderSvg()) {
|
|
3887
4592
|
@for (rect of rects(); track rect.key) {
|
|
3888
4593
|
<svg:rect
|
|
@@ -3891,11 +4596,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
3891
4596
|
[attr.y]="rect.y"
|
|
3892
4597
|
[attr.width]="rect.width"
|
|
3893
4598
|
[attr.height]="rect.height"
|
|
4599
|
+
[style.fill]="color()"
|
|
3894
4600
|
/>
|
|
3895
4601
|
}
|
|
3896
4602
|
}
|
|
3897
|
-
`, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}\n"] }]
|
|
3898
|
-
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
4603
|
+
`, styles: [".cngx-bar{fill:var(--cngx-bar-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 100%;transform-box:fill-box;animation:cngx-bar-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.2, .64, 1))}@keyframes cngx-bar-enter{0%{transform:scaleY(0);opacity:0}to{transform:scaleY(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-bar{animation:none}}@media(forced-colors:active){.cngx-bar{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-bar{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-bar{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"] }]
|
|
4604
|
+
}], propDecorators: { accessor: [{ type: i0.Input, args: [{ isSignal: true, alias: "accessor", required: false }] }], gap: [{ type: i0.Input, args: [{ isSignal: true, alias: "gap", required: false }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
3899
4605
|
/** @internal */
|
|
3900
4606
|
function barGeomEqual(a, b) {
|
|
3901
4607
|
if (a === b) {
|
|
@@ -3970,6 +4676,7 @@ class CngxScatter {
|
|
|
3970
4676
|
y = input.required(...(ngDevMode ? [{ debugName: "y" }] : /* istanbul ignore next */ []));
|
|
3971
4677
|
radius = input(3, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
3972
4678
|
data = input(undefined, ...(ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []));
|
|
4679
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
3973
4680
|
ctx = injectChartContext('CngxScatter');
|
|
3974
4681
|
resolvedData = computed(() => {
|
|
3975
4682
|
const local = this.data();
|
|
@@ -3998,28 +4705,40 @@ class CngxScatter {
|
|
|
3998
4705
|
const r = this.radius();
|
|
3999
4706
|
return {
|
|
4000
4707
|
kind: 'scatter',
|
|
4001
|
-
marks: this.circles().map((c) => ({ cx: c.cx, cy: c.cy, r, color:
|
|
4708
|
+
marks: this.circles().map((c) => ({ cx: c.cx, cy: c.cy, r, color: this.color() })),
|
|
4002
4709
|
};
|
|
4003
4710
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: scatterGeomEqual });
|
|
4004
4711
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScatter, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4005
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxScatter, isStandalone: true, selector: "[cngxScatter]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: true, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: true, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], exportAs: ["cngxScatter"], ngImport: i0, template: `
|
|
4712
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxScatter, isStandalone: true, selector: "[cngxScatter]", inputs: { x: { classPropertyName: "x", publicName: "x", isSignal: true, isRequired: true, transformFunction: null }, y: { classPropertyName: "y", publicName: "y", isSignal: true, isRequired: true, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-chart-series" }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], exportAs: ["cngxScatter"], ngImport: i0, template: `
|
|
4006
4713
|
@if (ctx.renderSvg()) {
|
|
4007
4714
|
@for (c of circles(); track c.key) {
|
|
4008
|
-
<svg:circle
|
|
4715
|
+
<svg:circle
|
|
4716
|
+
class="cngx-scatter"
|
|
4717
|
+
[attr.cx]="c.cx"
|
|
4718
|
+
[attr.cy]="c.cy"
|
|
4719
|
+
[attr.r]="radius()"
|
|
4720
|
+
[style.fill]="color()"
|
|
4721
|
+
/>
|
|
4009
4722
|
}
|
|
4010
4723
|
}
|
|
4011
|
-
`, isInline: true, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4724
|
+
`, isInline: true, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}@media(forced-colors:active){.cngx-scatter{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-scatter{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4012
4725
|
}
|
|
4013
4726
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxScatter, decorators: [{
|
|
4014
4727
|
type: Component,
|
|
4015
|
-
args: [{ selector: '[cngxScatter]', exportAs: 'cngxScatter', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], template: `
|
|
4728
|
+
args: [{ selector: '[cngxScatter]', exportAs: 'cngxScatter', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxScatter }], host: { class: 'cngx-chart-series' }, template: `
|
|
4016
4729
|
@if (ctx.renderSvg()) {
|
|
4017
4730
|
@for (c of circles(); track c.key) {
|
|
4018
|
-
<svg:circle
|
|
4731
|
+
<svg:circle
|
|
4732
|
+
class="cngx-scatter"
|
|
4733
|
+
[attr.cx]="c.cx"
|
|
4734
|
+
[attr.cy]="c.cy"
|
|
4735
|
+
[attr.r]="radius()"
|
|
4736
|
+
[style.fill]="color()"
|
|
4737
|
+
/>
|
|
4019
4738
|
}
|
|
4020
4739
|
}
|
|
4021
|
-
`, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}\n"] }]
|
|
4022
|
-
}], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: true }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: true }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }] } });
|
|
4740
|
+
`, styles: [".cngx-scatter{fill:var(--cngx-scatter-color, var(--cngx-chart-primary, currentColor));transform-origin:50% 50%;transform-box:fill-box;animation:cngx-scatter-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.34, 1.56, .64, 1)) backwards}@keyframes cngx-scatter-enter{0%{transform:scale(0);opacity:0}to{transform:scale(1);opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-scatter{animation:none}}@media(forced-colors:active){.cngx-scatter{fill:CanvasText!important}cngx-chart>svg>:nth-child(4n+2 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-diagonal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}cngx-chart>svg>:nth-child(4n+3 of.cngx-chart-series)>.cngx-scatter{fill:Canvas!important;stroke:CanvasText;stroke-width:1.5px}cngx-chart>svg>:nth-child(4n+4 of.cngx-chart-series)>.cngx-scatter{fill:var(--_cngx-chart-hatch-horizontal, CanvasText)!important;stroke:CanvasText;stroke-width:1px}}\n"] }]
|
|
4741
|
+
}], propDecorators: { x: [{ type: i0.Input, args: [{ isSignal: true, alias: "x", required: true }] }], y: [{ type: i0.Input, args: [{ isSignal: true, alias: "y", required: true }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
4023
4742
|
/** @internal */
|
|
4024
4743
|
function scatterGeomEqual(a, b) {
|
|
4025
4744
|
if (a === b) {
|
|
@@ -4085,6 +4804,7 @@ class CngxBand {
|
|
|
4085
4804
|
to = input.required(...(ngDevMode ? [{ debugName: "to" }] : /* istanbul ignore next */ []));
|
|
4086
4805
|
label = input(null, ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
4087
4806
|
opacity = input(null, ...(ngDevMode ? [{ debugName: "opacity" }] : /* istanbul ignore next */ []));
|
|
4807
|
+
color = input(null, ...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
4088
4808
|
ctx = injectChartContext('CngxBand');
|
|
4089
4809
|
rect = computed(() => {
|
|
4090
4810
|
// The plot, not the box: the band spans the area the marks live
|
|
@@ -4116,12 +4836,12 @@ class CngxBand {
|
|
|
4116
4836
|
y: r?.y ?? 0,
|
|
4117
4837
|
w: r?.width ?? 0,
|
|
4118
4838
|
h: r?.height ?? 0,
|
|
4119
|
-
color:
|
|
4839
|
+
color: this.color(),
|
|
4120
4840
|
opacity: op == null ? null : Number(op),
|
|
4121
4841
|
};
|
|
4122
4842
|
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: bandGeomEqual });
|
|
4123
4843
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBand, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4124
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBand, isStandalone: true, selector: "[cngxBand]", inputs: { from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBand }], exportAs: ["cngxBand"], ngImport: i0, template: `
|
|
4844
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBand, isStandalone: true, selector: "[cngxBand]", inputs: { from: { classPropertyName: "from", publicName: "from", isSignal: true, isRequired: true, transformFunction: null }, to: { classPropertyName: "to", publicName: "to", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, providers: [{ provide: CNGX_CHART_LAYER, useExisting: CngxBand }], exportAs: ["cngxBand"], ngImport: i0, template: `
|
|
4125
4845
|
@if (rect(); as r) {
|
|
4126
4846
|
@if (ctx.renderSvg()) {
|
|
4127
4847
|
<svg:rect
|
|
@@ -4130,7 +4850,8 @@ class CngxBand {
|
|
|
4130
4850
|
[attr.y]="r.y"
|
|
4131
4851
|
[attr.width]="r.width"
|
|
4132
4852
|
[attr.height]="r.height"
|
|
4133
|
-
[
|
|
4853
|
+
[style.fill]="color()"
|
|
4854
|
+
[style.fill-opacity]="opacity()"
|
|
4134
4855
|
/>
|
|
4135
4856
|
}
|
|
4136
4857
|
<!--
|
|
@@ -4150,7 +4871,7 @@ class CngxBand {
|
|
|
4150
4871
|
</svg:text>
|
|
4151
4872
|
}
|
|
4152
4873
|
}
|
|
4153
|
-
`, isInline: true, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4874
|
+
`, isInline: true, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}@media(forced-colors:active){.cngx-band__rect{fill:CanvasText!important}.cngx-band__label{fill:CanvasText}}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4154
4875
|
}
|
|
4155
4876
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBand, decorators: [{
|
|
4156
4877
|
type: Component,
|
|
@@ -4163,7 +4884,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4163
4884
|
[attr.y]="r.y"
|
|
4164
4885
|
[attr.width]="r.width"
|
|
4165
4886
|
[attr.height]="r.height"
|
|
4166
|
-
[
|
|
4887
|
+
[style.fill]="color()"
|
|
4888
|
+
[style.fill-opacity]="opacity()"
|
|
4167
4889
|
/>
|
|
4168
4890
|
}
|
|
4169
4891
|
<!--
|
|
@@ -4183,8 +4905,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4183
4905
|
</svg:text>
|
|
4184
4906
|
}
|
|
4185
4907
|
}
|
|
4186
|
-
`, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}\n"] }]
|
|
4187
|
-
}], propDecorators: { from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: true }] }], to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }] } });
|
|
4908
|
+
`, styles: [".cngx-band__rect{fill:var(--cngx-band-color, var(--cngx-chart-secondary, currentColor));fill-opacity:var(--cngx-band-opacity, .12);stroke:none;animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}.cngx-band__label{fill:var(--cngx-band-text-color, var(--cngx-chart-text-color, currentColor));font-size:var(--cngx-band-font-size, 11px);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate);animation:cngx-band-enter var(--cngx-chart-enter-duration, .48s) var(--cngx-chart-enter-easing, cubic-bezier(.4, 0, .2, 1))}@keyframes cngx-band-enter{0%{opacity:0}to{opacity:1}}@media(prefers-reduced-motion:reduce){.cngx-band__rect,.cngx-band__label{animation:none}}@media(forced-colors:active){.cngx-band__rect{fill:CanvasText!important}.cngx-band__label{fill:CanvasText}}\n"] }]
|
|
4909
|
+
}], propDecorators: { from: [{ type: i0.Input, args: [{ isSignal: true, alias: "from", required: true }] }], to: [{ type: i0.Input, args: [{ isSignal: true, alias: "to", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }] } });
|
|
4188
4910
|
/** @internal */
|
|
4189
4911
|
function bandGeomEqual(a, b) {
|
|
4190
4912
|
if (a === b) {
|
|
@@ -4217,7 +4939,7 @@ function bandGeomEqual(a, b) {
|
|
|
4217
4939
|
* @internal
|
|
4218
4940
|
*/
|
|
4219
4941
|
function injectPresetState(state) {
|
|
4220
|
-
const i18n =
|
|
4942
|
+
const i18n = injectChartI18n();
|
|
4221
4943
|
const activeView = computed(() => {
|
|
4222
4944
|
const s = state();
|
|
4223
4945
|
if (!s) {
|
|
@@ -4227,6 +4949,34 @@ function injectPresetState(state) {
|
|
|
4227
4949
|
}, ...(ngDevMode ? [{ debugName: "activeView" }] : /* istanbul ignore next */ []));
|
|
4228
4950
|
return { i18n, activeView };
|
|
4229
4951
|
}
|
|
4952
|
+
/**
|
|
4953
|
+
* Dev-mode guard for the named-role presets (`role="meter"` /
|
|
4954
|
+
* `role="img"`): warns once after first render when the host ended up
|
|
4955
|
+
* with no accessible name - an unnamed meter reads to AT as a bare
|
|
4956
|
+
* number with no subject. Same shape as the `cngx-status` warning.
|
|
4957
|
+
* Call from the preset's constructor (needs the injection context for
|
|
4958
|
+
* `ElementRef` and `afterNextRender`); no-op in production builds.
|
|
4959
|
+
*
|
|
4960
|
+
* @internal
|
|
4961
|
+
*/
|
|
4962
|
+
function warnIfUnnamedPreset(selector, hint, hasName) {
|
|
4963
|
+
if (!isDevMode()) {
|
|
4964
|
+
return;
|
|
4965
|
+
}
|
|
4966
|
+
const el = inject(ElementRef).nativeElement;
|
|
4967
|
+
afterNextRender(() => {
|
|
4968
|
+
if (hasName()) {
|
|
4969
|
+
return;
|
|
4970
|
+
}
|
|
4971
|
+
// The inputs say unnamed - a consumer can still name the host
|
|
4972
|
+
// externally via a plain aria-labelledby attribute.
|
|
4973
|
+
if (el.getAttribute('aria-label') || el.getAttribute('aria-labelledby')) {
|
|
4974
|
+
return;
|
|
4975
|
+
}
|
|
4976
|
+
console.warn(`${selector}: role="${el.getAttribute('role') ?? 'meter'}" has no accessible name - ` +
|
|
4977
|
+
`AT announces the value with no subject. ${hint}`);
|
|
4978
|
+
});
|
|
4979
|
+
}
|
|
4230
4980
|
|
|
4231
4981
|
/**
|
|
4232
4982
|
* Inline sparkline - a tiny line chart for KPI cards and dashboard
|
|
@@ -4264,48 +5014,26 @@ class CngxSparkline {
|
|
|
4264
5014
|
preset = injectPresetState(() => this.state());
|
|
4265
5015
|
i18n = this.preset.i18n;
|
|
4266
5016
|
activeView = this.preset.activeView;
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
yDomain = computed(() => {
|
|
4272
|
-
const d = this.data();
|
|
4273
|
-
if (d.length === 0) {
|
|
4274
|
-
return [0, 1];
|
|
4275
|
-
}
|
|
4276
|
-
let min = d[0];
|
|
4277
|
-
let max = d[0];
|
|
4278
|
-
for (let i = 1; i < d.length; i++) {
|
|
4279
|
-
const v = d[i];
|
|
4280
|
-
if (v < min) {
|
|
4281
|
-
min = v;
|
|
4282
|
-
}
|
|
4283
|
-
if (v > max) {
|
|
4284
|
-
max = v;
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
if (min === max) {
|
|
4288
|
-
return [min - 1, max + 1];
|
|
4289
|
-
}
|
|
4290
|
-
return [min, max];
|
|
4291
|
-
}, ...(ngDevMode ? [{ debugName: "yDomain" }] : /* istanbul ignore next */ []));
|
|
5017
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5018
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5019
|
+
xDomain = computed(() => presetIndexDomain(this.data().length), { ...(ngDevMode ? { debugName: "xDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
5020
|
+
yDomain = computed(() => presetValueDomain(this.data()), { ...(ngDevMode ? { debugName: "yDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
4292
5021
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSparkline, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4293
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSparkline, isStandalone: true, selector: "cngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-sparkline" }, exportAs: ["cngxSparkline"], ngImport: i0, template: `
|
|
5022
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxSparkline, isStandalone: true, selector: "cngx-sparkline", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, strokeWidth: { classPropertyName: "strokeWidth", publicName: "strokeWidth", isSignal: true, isRequired: false, transformFunction: null }, showArea: { classPropertyName: "showArea", publicName: "showArea", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-sparkline" }, exportAs: ["cngxSparkline"], ngImport: i0, template: `
|
|
4294
5023
|
@switch (activeView()) {
|
|
4295
5024
|
@case ('skeleton') {
|
|
4296
5025
|
<span
|
|
4297
5026
|
class="cngx-preset-skeleton"
|
|
4298
5027
|
[style.width.px]="width()"
|
|
4299
5028
|
[style.height.px]="height()"
|
|
4300
|
-
|
|
4301
|
-
[attr.aria-label]="i18n.loading()"
|
|
5029
|
+
aria-hidden="true"
|
|
4302
5030
|
></span>
|
|
4303
5031
|
}
|
|
4304
5032
|
@case ('empty') {
|
|
4305
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5033
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4306
5034
|
}
|
|
4307
5035
|
@case ('error') {
|
|
4308
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5036
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4309
5037
|
}
|
|
4310
5038
|
@case ('none') {}
|
|
4311
5039
|
@default {
|
|
@@ -4315,18 +5043,8 @@ class CngxSparkline {
|
|
|
4315
5043
|
[height]="height()"
|
|
4316
5044
|
[aria-label]="ariaLabel()"
|
|
4317
5045
|
>
|
|
4318
|
-
<svg:g
|
|
4319
|
-
|
|
4320
|
-
position="bottom"
|
|
4321
|
-
type="linear"
|
|
4322
|
-
[domain]="xDomain()"
|
|
4323
|
-
></svg:g>
|
|
4324
|
-
<svg:g
|
|
4325
|
-
cngxAxisDomain
|
|
4326
|
-
position="left"
|
|
4327
|
-
type="linear"
|
|
4328
|
-
[domain]="yDomain()"
|
|
4329
|
-
></svg:g>
|
|
5046
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5047
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4330
5048
|
@if (showArea()) {
|
|
4331
5049
|
<svg:g cngxArea [baseline]="yDomain()[0]"></svg:g>
|
|
4332
5050
|
}
|
|
@@ -4334,26 +5052,28 @@ class CngxSparkline {
|
|
|
4334
5052
|
</cngx-chart>
|
|
4335
5053
|
}
|
|
4336
5054
|
}
|
|
4337
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5055
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state", "connectionState"], exportAs: ["cngxChart"] }, { kind: "directive", type: CngxAxisDomain, selector: "[cngxAxisDomain]", inputs: ["position", "type", "domain"], exportAs: ["cngxAxisDomain"] }, { kind: "component", type: CngxLine, selector: "[cngxLine]", inputs: ["accessor", "xAccessor", "color", "strokeWidth", "curve", "data", "points"], exportAs: ["cngxLine"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "color", "curve", "baseline", "data", "points"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4338
5056
|
}
|
|
4339
5057
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxSparkline, decorators: [{
|
|
4340
5058
|
type: Component,
|
|
4341
|
-
args: [{ selector: 'cngx-sparkline', exportAs: 'cngxSparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxLine, CngxArea], host: {
|
|
5059
|
+
args: [{ selector: 'cngx-sparkline', exportAs: 'cngxSparkline', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxLine, CngxArea], host: {
|
|
5060
|
+
class: 'cngx-sparkline',
|
|
5061
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5062
|
+
}, template: `
|
|
4342
5063
|
@switch (activeView()) {
|
|
4343
5064
|
@case ('skeleton') {
|
|
4344
5065
|
<span
|
|
4345
5066
|
class="cngx-preset-skeleton"
|
|
4346
5067
|
[style.width.px]="width()"
|
|
4347
5068
|
[style.height.px]="height()"
|
|
4348
|
-
|
|
4349
|
-
[attr.aria-label]="i18n.loading()"
|
|
5069
|
+
aria-hidden="true"
|
|
4350
5070
|
></span>
|
|
4351
5071
|
}
|
|
4352
5072
|
@case ('empty') {
|
|
4353
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5073
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4354
5074
|
}
|
|
4355
5075
|
@case ('error') {
|
|
4356
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5076
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4357
5077
|
}
|
|
4358
5078
|
@case ('none') {}
|
|
4359
5079
|
@default {
|
|
@@ -4363,18 +5083,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4363
5083
|
[height]="height()"
|
|
4364
5084
|
[aria-label]="ariaLabel()"
|
|
4365
5085
|
>
|
|
4366
|
-
<svg:g
|
|
4367
|
-
|
|
4368
|
-
position="bottom"
|
|
4369
|
-
type="linear"
|
|
4370
|
-
[domain]="xDomain()"
|
|
4371
|
-
></svg:g>
|
|
4372
|
-
<svg:g
|
|
4373
|
-
cngxAxisDomain
|
|
4374
|
-
position="left"
|
|
4375
|
-
type="linear"
|
|
4376
|
-
[domain]="yDomain()"
|
|
4377
|
-
></svg:g>
|
|
5086
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5087
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4378
5088
|
@if (showArea()) {
|
|
4379
5089
|
<svg:g cngxArea [baseline]="yDomain()[0]"></svg:g>
|
|
4380
5090
|
}
|
|
@@ -4382,7 +5092,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4382
5092
|
</cngx-chart>
|
|
4383
5093
|
}
|
|
4384
5094
|
}
|
|
4385
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5095
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-sparkline{display:inline-block;line-height:0;--cngx-line-color: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor));--cngx-area-fill: var(--cngx-sparkline-color, var(--cngx-chart-primary, currentColor))}cngx-sparkline .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px);animation:cngx-preset-shimmer 1.4s linear infinite;background-image:linear-gradient(90deg,transparent 0,var(--cngx-skeleton-shimmer, rgb(255 255 255 / .3)) 50%,transparent 100%);background-size:200% 100%}cngx-sparkline .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);color:var(--cngx-chart-text-color, currentColor);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-sparkline .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}@keyframes cngx-preset-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){cngx-sparkline .cngx-preset-skeleton{animation:none}}\n"] }]
|
|
4386
5096
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], strokeWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "strokeWidth", required: false }] }], showArea: [{ type: i0.Input, args: [{ isSignal: true, alias: "showArea", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4387
5097
|
|
|
4388
5098
|
/**
|
|
@@ -4418,37 +5128,29 @@ class CngxMiniBar {
|
|
|
4418
5128
|
preset = injectPresetState(() => this.state());
|
|
4419
5129
|
i18n = this.preset.i18n;
|
|
4420
5130
|
activeView = this.preset.activeView;
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
return 100;
|
|
4434
|
-
}
|
|
4435
|
-
return ratio;
|
|
4436
|
-
}, ...(ngDevMode ? [{ debugName: "percent" }] : /* istanbul ignore next */ []));
|
|
5131
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5132
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5133
|
+
/**
|
|
5134
|
+
* Meter value attributes render only in the content view: keeping
|
|
5135
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5136
|
+
* announce a stale reading for a value that is not on screen.
|
|
5137
|
+
*/
|
|
5138
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5139
|
+
constructor() {
|
|
5140
|
+
warnIfUnnamedPreset('cngx-mini-bar', 'Bind [label] or [aria-label].', () => (this.ariaLabel() ?? this.label()) !== null);
|
|
5141
|
+
}
|
|
5142
|
+
percent = computed(() => clampedRatio(this.value(), this.min(), this.max()) * 100, ...(ngDevMode ? [{ debugName: "percent" }] : /* istanbul ignore next */ []));
|
|
4437
5143
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4438
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniBar, isStandalone: true, selector: "cngx-mini-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "min()", "attr.aria-valuemax": "max()", "attr.aria-label": "ariaLabel() ?? label()" }, classAttribute: "cngx-mini-bar" }, exportAs: ["cngxMiniBar"], ngImport: i0, template: `
|
|
5144
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniBar, isStandalone: true, selector: "cngx-mini-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? min() : null", "attr.aria-valuemax": "showsMeterValue() ? max() : null", "attr.aria-label": "ariaLabel() ?? label()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-mini-bar" }, exportAs: ["cngxMiniBar"], ngImport: i0, template: `
|
|
4439
5145
|
@switch (activeView()) {
|
|
4440
5146
|
@case ('skeleton') {
|
|
4441
|
-
<span
|
|
4442
|
-
class="cngx-preset-skeleton"
|
|
4443
|
-
[attr.aria-busy]="true"
|
|
4444
|
-
[attr.aria-label]="i18n.loading()"
|
|
4445
|
-
></span>
|
|
5147
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4446
5148
|
}
|
|
4447
5149
|
@case ('empty') {
|
|
4448
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5150
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4449
5151
|
}
|
|
4450
5152
|
@case ('error') {
|
|
4451
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5153
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4452
5154
|
}
|
|
4453
5155
|
@case ('none') {}
|
|
4454
5156
|
@default {
|
|
@@ -4460,31 +5162,28 @@ class CngxMiniBar {
|
|
|
4460
5162
|
</div>
|
|
4461
5163
|
}
|
|
4462
5164
|
}
|
|
4463
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5165
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__label{display:block;font-size:var(--cngx-mini-bar-label-font-size, .75rem);color:var(--cngx-mini-bar-label-color, inherit);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4464
5166
|
}
|
|
4465
5167
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniBar, decorators: [{
|
|
4466
5168
|
type: Component,
|
|
4467
5169
|
args: [{ selector: 'cngx-mini-bar', exportAs: 'cngxMiniBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4468
5170
|
role: 'meter',
|
|
4469
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4470
|
-
'[attr.aria-valuemin]': 'min()',
|
|
4471
|
-
'[attr.aria-valuemax]': 'max()',
|
|
5171
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5172
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? min() : null',
|
|
5173
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? max() : null',
|
|
4472
5174
|
'[attr.aria-label]': 'ariaLabel() ?? label()',
|
|
5175
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4473
5176
|
class: 'cngx-mini-bar',
|
|
4474
5177
|
}, template: `
|
|
4475
5178
|
@switch (activeView()) {
|
|
4476
5179
|
@case ('skeleton') {
|
|
4477
|
-
<span
|
|
4478
|
-
class="cngx-preset-skeleton"
|
|
4479
|
-
[attr.aria-busy]="true"
|
|
4480
|
-
[attr.aria-label]="i18n.loading()"
|
|
4481
|
-
></span>
|
|
5180
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4482
5181
|
}
|
|
4483
5182
|
@case ('empty') {
|
|
4484
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5183
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4485
5184
|
}
|
|
4486
5185
|
@case ('error') {
|
|
4487
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5186
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4488
5187
|
}
|
|
4489
5188
|
@case ('none') {}
|
|
4490
5189
|
@default {
|
|
@@ -4496,8 +5195,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4496
5195
|
</div>
|
|
4497
5196
|
}
|
|
4498
5197
|
}
|
|
4499
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4500
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5198
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-bar{display:inline-block;width:var(--cngx-mini-bar-width, 80px);--cngx-mini-bar-color: var(--cngx-bar-color, var(--cngx-chart-primary, currentColor))}cngx-mini-bar .cngx-mini-bar__label{display:block;font-size:var(--cngx-mini-bar-label-font-size, .75rem);color:var(--cngx-mini-bar-label-color, inherit);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-mini-bar .cngx-mini-bar__track{position:relative;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-mini-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px);overflow:hidden}cngx-mini-bar .cngx-mini-bar__fill{height:100%;background:var(--cngx-mini-bar-color);border-radius:inherit;transition:width var(--cngx-mini-bar-transition, .24s) ease-out}cngx-mini-bar .cngx-preset-skeleton{display:block;height:var(--cngx-mini-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-mini-bar-radius, 3px)}cngx-mini-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5199
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4501
5200
|
|
|
4502
5201
|
/**
|
|
4503
5202
|
* Mini deviation bar - a single-value indicator that diverges from a
|
|
@@ -4527,6 +5226,26 @@ class CngxDeviationBar {
|
|
|
4527
5226
|
preset = injectPresetState(() => this.state());
|
|
4528
5227
|
i18n = this.preset.i18n;
|
|
4529
5228
|
activeView = this.preset.activeView;
|
|
5229
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5230
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5231
|
+
/**
|
|
5232
|
+
* Meter value attributes render only in the content view: keeping
|
|
5233
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5234
|
+
* announce a stale reading for a value that is not on screen.
|
|
5235
|
+
*/
|
|
5236
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5237
|
+
constructor() {
|
|
5238
|
+
warnIfUnnamedPreset('cngx-deviation-bar', 'Bind [aria-label].', () => this.ariaLabel() !== null);
|
|
5239
|
+
}
|
|
5240
|
+
/**
|
|
5241
|
+
* The meter's valid range is centred on the baseline, not on zero:
|
|
5242
|
+
* a deviation bar with `[baseline]="100" [magnitude]="50"` reads
|
|
5243
|
+
* values in `[50, 150]`. Anchoring min/max at `±magnitude` alone
|
|
5244
|
+
* puts any non-zero-baseline reading outside its own declared range,
|
|
5245
|
+
* which is invalid meter semantics.
|
|
5246
|
+
*/
|
|
5247
|
+
minValue = computed(() => this.baseline() - this.magnitude(), ...(ngDevMode ? [{ debugName: "minValue" }] : /* istanbul ignore next */ []));
|
|
5248
|
+
maxValue = computed(() => this.baseline() + this.magnitude(), ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
4530
5249
|
geometry = computed(() => {
|
|
4531
5250
|
const v = this.value();
|
|
4532
5251
|
const b = this.baseline();
|
|
@@ -4539,27 +5258,28 @@ class CngxDeviationBar {
|
|
|
4539
5258
|
return null;
|
|
4540
5259
|
}
|
|
4541
5260
|
const positive = delta > 0;
|
|
4542
|
-
const ratio =
|
|
5261
|
+
const ratio = clampedRatio(Math.abs(delta), 0, m) * 50;
|
|
4543
5262
|
if (positive) {
|
|
4544
5263
|
return { positive, left: 50, width: ratio };
|
|
4545
5264
|
}
|
|
4546
5265
|
return { positive, left: 50 - ratio, width: ratio };
|
|
4547
|
-
}, ...(ngDevMode ?
|
|
5266
|
+
}, { ...(ngDevMode ? { debugName: "geometry" } : /* istanbul ignore next */ {}), equal: (a, b) => a === b ||
|
|
5267
|
+
(a !== null &&
|
|
5268
|
+
b !== null &&
|
|
5269
|
+
a.positive === b.positive &&
|
|
5270
|
+
a.left === b.left &&
|
|
5271
|
+
a.width === b.width) });
|
|
4548
5272
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDeviationBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDeviationBar, isStandalone: true, selector: "cngx-deviation-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, magnitude: { classPropertyName: "magnitude", publicName: "magnitude", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "
|
|
5273
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDeviationBar, isStandalone: true, selector: "cngx-deviation-bar", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, baseline: { classPropertyName: "baseline", publicName: "baseline", isSignal: true, isRequired: false, transformFunction: null }, magnitude: { classPropertyName: "magnitude", publicName: "magnitude", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? minValue() : null", "attr.aria-valuemax": "showsMeterValue() ? maxValue() : null", "attr.aria-label": "ariaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-deviation-bar" }, exportAs: ["cngxDeviationBar"], ngImport: i0, template: `
|
|
4550
5274
|
@switch (activeView()) {
|
|
4551
5275
|
@case ('skeleton') {
|
|
4552
|
-
<span
|
|
4553
|
-
class="cngx-preset-skeleton"
|
|
4554
|
-
[attr.aria-busy]="true"
|
|
4555
|
-
[attr.aria-label]="i18n.loading()"
|
|
4556
|
-
></span>
|
|
5276
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4557
5277
|
}
|
|
4558
5278
|
@case ('empty') {
|
|
4559
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5279
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4560
5280
|
}
|
|
4561
5281
|
@case ('error') {
|
|
4562
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5282
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4563
5283
|
}
|
|
4564
5284
|
@case ('none') {}
|
|
4565
5285
|
@default {
|
|
@@ -4577,31 +5297,28 @@ class CngxDeviationBar {
|
|
|
4577
5297
|
</div>
|
|
4578
5298
|
}
|
|
4579
5299
|
}
|
|
4580
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5300
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4581
5301
|
}
|
|
4582
5302
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDeviationBar, decorators: [{
|
|
4583
5303
|
type: Component,
|
|
4584
5304
|
args: [{ selector: 'cngx-deviation-bar', exportAs: 'cngxDeviationBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4585
5305
|
role: 'meter',
|
|
4586
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4587
|
-
'[attr.aria-valuemin]': '
|
|
4588
|
-
'[attr.aria-valuemax]': '
|
|
5306
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5307
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? minValue() : null',
|
|
5308
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? maxValue() : null',
|
|
4589
5309
|
'[attr.aria-label]': 'ariaLabel()',
|
|
5310
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4590
5311
|
class: 'cngx-deviation-bar',
|
|
4591
5312
|
}, template: `
|
|
4592
5313
|
@switch (activeView()) {
|
|
4593
5314
|
@case ('skeleton') {
|
|
4594
|
-
<span
|
|
4595
|
-
class="cngx-preset-skeleton"
|
|
4596
|
-
[attr.aria-busy]="true"
|
|
4597
|
-
[attr.aria-label]="i18n.loading()"
|
|
4598
|
-
></span>
|
|
5315
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4599
5316
|
}
|
|
4600
5317
|
@case ('empty') {
|
|
4601
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5318
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4602
5319
|
}
|
|
4603
5320
|
@case ('error') {
|
|
4604
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5321
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4605
5322
|
}
|
|
4606
5323
|
@case ('none') {}
|
|
4607
5324
|
@default {
|
|
@@ -4619,8 +5336,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4619
5336
|
</div>
|
|
4620
5337
|
}
|
|
4621
5338
|
}
|
|
4622
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4623
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], magnitude: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnitude", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5339
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-deviation-bar{display:inline-block;width:var(--cngx-deviation-bar-width, 100px);--cngx-deviation-positive: var(--cngx-chart-success, #1f9d55);--cngx-deviation-negative: var(--cngx-chart-danger, #d2452f)}cngx-deviation-bar .cngx-deviation-bar__track{position:relative;height:var(--cngx-deviation-bar-height, 6px);background:var( --cngx-deviation-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)) );border-radius:var(--cngx-deviation-bar-radius, 3px);overflow:hidden}cngx-deviation-bar .cngx-deviation-bar__baseline{position:absolute;left:50%;top:0;bottom:0;width:1px;background:var( --cngx-deviation-bar-baseline-color, var(--cngx-chart-axis-color, currentColor) );opacity:var(--cngx-deviation-bar-baseline-opacity, .5)}cngx-deviation-bar .cngx-deviation-bar__fill{position:absolute;top:0;bottom:0;transition:left var(--cngx-deviation-bar-transition, .24s) ease-out,width var(--cngx-deviation-bar-transition, .24s) ease-out}cngx-deviation-bar .cngx-deviation-bar__fill--positive{background:var(--cngx-deviation-positive)}cngx-deviation-bar .cngx-deviation-bar__fill--negative{background:var(--cngx-deviation-negative)}cngx-deviation-bar .cngx-preset-skeleton{display:block;height:var(--cngx-deviation-bar-height, 6px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-deviation-bar-radius, 3px)}cngx-deviation-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-deviation-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5340
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], baseline: [{ type: i0.Input, args: [{ isSignal: true, alias: "baseline", required: false }] }], magnitude: [{ type: i0.Input, args: [{ isSignal: true, alias: "magnitude", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4624
5341
|
|
|
4625
5342
|
/**
|
|
4626
5343
|
* Inline mini area - a tiny filled-area chart for KPI cards. Sibling
|
|
@@ -4648,48 +5365,26 @@ class CngxMiniArea {
|
|
|
4648
5365
|
preset = injectPresetState(() => this.state());
|
|
4649
5366
|
i18n = this.preset.i18n;
|
|
4650
5367
|
activeView = this.preset.activeView;
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
yDomain = computed(() => {
|
|
4656
|
-
const d = this.data();
|
|
4657
|
-
if (d.length === 0) {
|
|
4658
|
-
return [0, 1];
|
|
4659
|
-
}
|
|
4660
|
-
let min = d[0];
|
|
4661
|
-
let max = d[0];
|
|
4662
|
-
for (let i = 1; i < d.length; i++) {
|
|
4663
|
-
const v = d[i];
|
|
4664
|
-
if (v < min) {
|
|
4665
|
-
min = v;
|
|
4666
|
-
}
|
|
4667
|
-
if (v > max) {
|
|
4668
|
-
max = v;
|
|
4669
|
-
}
|
|
4670
|
-
}
|
|
4671
|
-
if (min === max) {
|
|
4672
|
-
return [min - 1, max + 1];
|
|
4673
|
-
}
|
|
4674
|
-
return [min, max];
|
|
4675
|
-
}, ...(ngDevMode ? [{ debugName: "yDomain" }] : /* istanbul ignore next */ []));
|
|
5368
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5369
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5370
|
+
xDomain = computed(() => presetIndexDomain(this.data().length), { ...(ngDevMode ? { debugName: "xDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
5371
|
+
yDomain = computed(() => presetValueDomain(this.data()), { ...(ngDevMode ? { debugName: "yDomain" } : /* istanbul ignore next */ {}), equal: sameNumberArr });
|
|
4676
5372
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniArea, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4677
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniArea, isStandalone: true, selector: "cngx-mini-area", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { classAttribute: "cngx-mini-area" }, exportAs: ["cngxMiniArea"], ngImport: i0, template: `
|
|
5373
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxMiniArea, isStandalone: true, selector: "cngx-mini-area", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, opacity: { classPropertyName: "opacity", publicName: "opacity", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-mini-area" }, exportAs: ["cngxMiniArea"], ngImport: i0, template: `
|
|
4678
5374
|
@switch (activeView()) {
|
|
4679
5375
|
@case ('skeleton') {
|
|
4680
5376
|
<span
|
|
4681
5377
|
class="cngx-preset-skeleton"
|
|
4682
5378
|
[style.width.px]="width()"
|
|
4683
5379
|
[style.height.px]="height()"
|
|
4684
|
-
|
|
4685
|
-
[attr.aria-label]="i18n.loading()"
|
|
5380
|
+
aria-hidden="true"
|
|
4686
5381
|
></span>
|
|
4687
5382
|
}
|
|
4688
5383
|
@case ('empty') {
|
|
4689
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5384
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4690
5385
|
}
|
|
4691
5386
|
@case ('error') {
|
|
4692
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5387
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4693
5388
|
}
|
|
4694
5389
|
@case ('none') {}
|
|
4695
5390
|
@default {
|
|
@@ -4699,42 +5394,34 @@ class CngxMiniArea {
|
|
|
4699
5394
|
[height]="height()"
|
|
4700
5395
|
[aria-label]="ariaLabel()"
|
|
4701
5396
|
>
|
|
4702
|
-
<svg:g
|
|
4703
|
-
|
|
4704
|
-
position="bottom"
|
|
4705
|
-
type="linear"
|
|
4706
|
-
[domain]="xDomain()"
|
|
4707
|
-
></svg:g>
|
|
4708
|
-
<svg:g
|
|
4709
|
-
cngxAxisDomain
|
|
4710
|
-
position="left"
|
|
4711
|
-
type="linear"
|
|
4712
|
-
[domain]="yDomain()"
|
|
4713
|
-
></svg:g>
|
|
5397
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5398
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4714
5399
|
<svg:g cngxArea [opacity]="opacity()" [baseline]="yDomain()[0]"></svg:g>
|
|
4715
5400
|
</cngx-chart>
|
|
4716
5401
|
}
|
|
4717
5402
|
}
|
|
4718
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5403
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], dependencies: [{ kind: "component", type: CngxChart, selector: "cngx-chart", inputs: ["data", "width", "height", "preserveAspectRatio", "aria-label", "summaryAccessor", "accessibleTable", "state", "connectionState"], exportAs: ["cngxChart"] }, { kind: "directive", type: CngxAxisDomain, selector: "[cngxAxisDomain]", inputs: ["position", "type", "domain"], exportAs: ["cngxAxisDomain"] }, { kind: "component", type: CngxArea, selector: "[cngxArea]", inputs: ["accessor", "xAccessor", "opacity", "color", "curve", "baseline", "data", "points"], exportAs: ["cngxArea"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4719
5404
|
}
|
|
4720
5405
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxMiniArea, decorators: [{
|
|
4721
5406
|
type: Component,
|
|
4722
|
-
args: [{ selector: 'cngx-mini-area', exportAs: 'cngxMiniArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxArea], host: {
|
|
5407
|
+
args: [{ selector: 'cngx-mini-area', exportAs: 'cngxMiniArea', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, imports: [CngxChart, CngxAxisDomain, CngxArea], host: {
|
|
5408
|
+
class: 'cngx-mini-area',
|
|
5409
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5410
|
+
}, template: `
|
|
4723
5411
|
@switch (activeView()) {
|
|
4724
5412
|
@case ('skeleton') {
|
|
4725
5413
|
<span
|
|
4726
5414
|
class="cngx-preset-skeleton"
|
|
4727
5415
|
[style.width.px]="width()"
|
|
4728
5416
|
[style.height.px]="height()"
|
|
4729
|
-
|
|
4730
|
-
[attr.aria-label]="i18n.loading()"
|
|
5417
|
+
aria-hidden="true"
|
|
4731
5418
|
></span>
|
|
4732
5419
|
}
|
|
4733
5420
|
@case ('empty') {
|
|
4734
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5421
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4735
5422
|
}
|
|
4736
5423
|
@case ('error') {
|
|
4737
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5424
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4738
5425
|
}
|
|
4739
5426
|
@case ('none') {}
|
|
4740
5427
|
@default {
|
|
@@ -4744,23 +5431,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4744
5431
|
[height]="height()"
|
|
4745
5432
|
[aria-label]="ariaLabel()"
|
|
4746
5433
|
>
|
|
4747
|
-
<svg:g
|
|
4748
|
-
|
|
4749
|
-
position="bottom"
|
|
4750
|
-
type="linear"
|
|
4751
|
-
[domain]="xDomain()"
|
|
4752
|
-
></svg:g>
|
|
4753
|
-
<svg:g
|
|
4754
|
-
cngxAxisDomain
|
|
4755
|
-
position="left"
|
|
4756
|
-
type="linear"
|
|
4757
|
-
[domain]="yDomain()"
|
|
4758
|
-
></svg:g>
|
|
5434
|
+
<svg:g cngxAxisDomain position="bottom" type="linear" [domain]="xDomain()"></svg:g>
|
|
5435
|
+
<svg:g cngxAxisDomain position="left" type="linear" [domain]="yDomain()"></svg:g>
|
|
4759
5436
|
<svg:g cngxArea [opacity]="opacity()" [baseline]="yDomain()[0]"></svg:g>
|
|
4760
5437
|
</cngx-chart>
|
|
4761
5438
|
}
|
|
4762
5439
|
}
|
|
4763
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5440
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-mini-area{display:inline-block;line-height:0;--cngx-area-fill: var(--cngx-mini-area-color, var(--cngx-chart-primary, currentColor))}cngx-mini-area .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-preset-skeleton-radius, 2px)}cngx-mini-area .cngx-preset-fallback{display:inline-block;line-height:normal;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-mini-area .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
4764
5441
|
}], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], opacity: [{ type: i0.Input, args: [{ isSignal: true, alias: "opacity", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4765
5442
|
|
|
4766
5443
|
/** @internal */
|
|
@@ -4769,7 +5446,10 @@ const TWO_PI = Math.PI * 2;
|
|
|
4769
5446
|
* Circular donut gauge - a single-value bounded indicator. Renders a
|
|
4770
5447
|
* background ring + a foreground arc whose length is proportional to
|
|
4771
5448
|
* `value / max`. Host carries `role="meter"`; the optional `[label]`
|
|
4772
|
-
* input renders
|
|
5449
|
+
* input renders a visible label inside the ring's centre and doubles
|
|
5450
|
+
* as the host's accessible name when `[aria-label]` is unbound - the
|
|
5451
|
+
* same fallback `CngxMiniBar` uses. A bound `[aria-label]` always
|
|
5452
|
+
* wins.
|
|
4773
5453
|
*
|
|
4774
5454
|
* @category common/chart/presets
|
|
4775
5455
|
* @docsKind primary
|
|
@@ -4792,6 +5472,17 @@ class CngxDonut {
|
|
|
4792
5472
|
preset = injectPresetState(() => this.state());
|
|
4793
5473
|
i18n = this.preset.i18n;
|
|
4794
5474
|
activeView = this.preset.activeView;
|
|
5475
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5476
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5477
|
+
/**
|
|
5478
|
+
* Meter value attributes render only in the content view: keeping
|
|
5479
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5480
|
+
* announce a stale reading for a value that is not on screen.
|
|
5481
|
+
*/
|
|
5482
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5483
|
+
constructor() {
|
|
5484
|
+
warnIfUnnamedPreset('cngx-donut', 'Bind [label] or [aria-label].', () => (this.ariaLabel() ?? this.label()) !== null);
|
|
5485
|
+
}
|
|
4795
5486
|
center = computed(() => this.size() / 2, ...(ngDevMode ? [{ debugName: "center" }] : /* istanbul ignore next */ []));
|
|
4796
5487
|
radius = computed(() => (this.size() - this.thickness()) / 2, ...(ngDevMode ? [{ debugName: "radius" }] : /* istanbul ignore next */ []));
|
|
4797
5488
|
circumference = computed(() => TWO_PI * this.radius(), ...(ngDevMode ? [{ debugName: "circumference" }] : /* istanbul ignore next */ []));
|
|
@@ -4801,30 +5492,24 @@ class CngxDonut {
|
|
|
4801
5492
|
}, ...(ngDevMode ? [{ debugName: "dasharray" }] : /* istanbul ignore next */ []));
|
|
4802
5493
|
dashoffset = computed(() => {
|
|
4803
5494
|
const c = this.circumference();
|
|
4804
|
-
|
|
4805
|
-
if (m <= 0) {
|
|
4806
|
-
return c;
|
|
4807
|
-
}
|
|
4808
|
-
const ratio = Math.min(Math.max(this.value() / m, 0), 1);
|
|
4809
|
-
return c * (1 - ratio);
|
|
5495
|
+
return c * (1 - clampedRatio(this.value(), 0, this.max()));
|
|
4810
5496
|
}, ...(ngDevMode ? [{ debugName: "dashoffset" }] : /* istanbul ignore next */ []));
|
|
4811
5497
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDonut, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4812
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDonut, isStandalone: true, selector: "cngx-donut", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "value()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "max()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-donut" }, exportAs: ["cngxDonut"], ngImport: i0, template: `
|
|
5498
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxDonut, isStandalone: true, selector: "cngx-donut", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, thickness: { classPropertyName: "thickness", publicName: "thickness", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? value() : null", "attr.aria-valuemin": "showsMeterValue() ? 0 : null", "attr.aria-valuemax": "showsMeterValue() ? max() : null", "attr.aria-label": "ariaLabel() ?? label()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-donut" }, exportAs: ["cngxDonut"], ngImport: i0, template: `
|
|
4813
5499
|
@switch (activeView()) {
|
|
4814
5500
|
@case ('skeleton') {
|
|
4815
5501
|
<span
|
|
4816
5502
|
class="cngx-preset-skeleton cngx-donut__skeleton"
|
|
4817
5503
|
[style.width.px]="size()"
|
|
4818
5504
|
[style.height.px]="size()"
|
|
4819
|
-
|
|
4820
|
-
[attr.aria-label]="i18n.loading()"
|
|
5505
|
+
aria-hidden="true"
|
|
4821
5506
|
></span>
|
|
4822
5507
|
}
|
|
4823
5508
|
@case ('empty') {
|
|
4824
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5509
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4825
5510
|
}
|
|
4826
5511
|
@case ('error') {
|
|
4827
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5512
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4828
5513
|
}
|
|
4829
5514
|
@case ('none') {}
|
|
4830
5515
|
@default {
|
|
@@ -4860,16 +5545,17 @@ class CngxDonut {
|
|
|
4860
5545
|
}
|
|
4861
5546
|
}
|
|
4862
5547
|
}
|
|
4863
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5548
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
4864
5549
|
}
|
|
4865
5550
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxDonut, decorators: [{
|
|
4866
5551
|
type: Component,
|
|
4867
5552
|
args: [{ selector: 'cngx-donut', exportAs: 'cngxDonut', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
4868
5553
|
role: 'meter',
|
|
4869
|
-
'[attr.aria-valuenow]': 'value()',
|
|
4870
|
-
'[attr.aria-valuemin]': '0',
|
|
4871
|
-
'[attr.aria-valuemax]': 'max()',
|
|
4872
|
-
'[attr.aria-label]': 'ariaLabel()',
|
|
5554
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? value() : null',
|
|
5555
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? 0 : null',
|
|
5556
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? max() : null',
|
|
5557
|
+
'[attr.aria-label]': 'ariaLabel() ?? label()',
|
|
5558
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
4873
5559
|
class: 'cngx-donut',
|
|
4874
5560
|
}, template: `
|
|
4875
5561
|
@switch (activeView()) {
|
|
@@ -4878,15 +5564,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4878
5564
|
class="cngx-preset-skeleton cngx-donut__skeleton"
|
|
4879
5565
|
[style.width.px]="size()"
|
|
4880
5566
|
[style.height.px]="size()"
|
|
4881
|
-
|
|
4882
|
-
[attr.aria-label]="i18n.loading()"
|
|
5567
|
+
aria-hidden="true"
|
|
4883
5568
|
></span>
|
|
4884
5569
|
}
|
|
4885
5570
|
@case ('empty') {
|
|
4886
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5571
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
4887
5572
|
}
|
|
4888
5573
|
@case ('error') {
|
|
4889
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5574
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
4890
5575
|
}
|
|
4891
5576
|
@case ('none') {}
|
|
4892
5577
|
@default {
|
|
@@ -4922,8 +5607,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
4922
5607
|
}
|
|
4923
5608
|
}
|
|
4924
5609
|
}
|
|
4925
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
4926
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5610
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-donut{display:inline-block;position:relative;line-height:0;--cngx-donut-color: var(--cngx-chart-primary, currentColor)}cngx-donut .cngx-donut__track{stroke:var(--cngx-donut-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)))}cngx-donut .cngx-donut__fill{stroke:var(--cngx-donut-color);transition:stroke-dashoffset var(--cngx-donut-transition, .32s) ease-out}cngx-donut .cngx-donut__label{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:var(--cngx-donut-label-font-size, .875rem);line-height:1;color:var(--cngx-chart-text-color, currentColor);unicode-bidi:var(--cngx-chart-numeric-bidi, isolate)}cngx-donut .cngx-preset-skeleton{display:inline-block;background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:50%}cngx-donut .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-donut .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5611
|
+
}], ctorParameters: () => [], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], thickness: [{ type: i0.Input, args: [{ isSignal: true, alias: "thickness", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
4927
5612
|
|
|
4928
5613
|
/**
|
|
4929
5614
|
* Bullet chart - Stephen Few's compact KPI visualisation. Three
|
|
@@ -4951,6 +5636,17 @@ class CngxBullet {
|
|
|
4951
5636
|
preset = injectPresetState(() => this.state());
|
|
4952
5637
|
i18n = this.preset.i18n;
|
|
4953
5638
|
activeView = this.preset.activeView;
|
|
5639
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5640
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5641
|
+
/**
|
|
5642
|
+
* Meter value attributes render only in the content view: keeping
|
|
5643
|
+
* `aria-valuenow` while the skeleton or error fallback shows would
|
|
5644
|
+
* announce a stale reading for a value that is not on screen.
|
|
5645
|
+
*/
|
|
5646
|
+
showsMeterValue = computed(() => this.activeView() === 'content', ...(ngDevMode ? [{ debugName: "showsMeterValue" }] : /* istanbul ignore next */ []));
|
|
5647
|
+
constructor() {
|
|
5648
|
+
warnIfUnnamedPreset('cngx-bullet', 'Bind [aria-label].', () => this.ariaLabel() !== null);
|
|
5649
|
+
}
|
|
4954
5650
|
maxValue = computed(() => {
|
|
4955
5651
|
const explicit = this.max();
|
|
4956
5652
|
if (explicit !== null && explicit > 0) {
|
|
@@ -4965,13 +5661,13 @@ class CngxBullet {
|
|
|
4965
5661
|
}
|
|
4966
5662
|
return m > 0 ? m : 1;
|
|
4967
5663
|
}, ...(ngDevMode ? [{ debugName: "maxValue" }] : /* istanbul ignore next */ []));
|
|
4968
|
-
actualPercent = computed(() =>
|
|
5664
|
+
actualPercent = computed(() => clampedRatio(this.actual(), 0, this.maxValue()) * 100, ...(ngDevMode ? [{ debugName: "actualPercent" }] : /* istanbul ignore next */ []));
|
|
4969
5665
|
targetPercent = computed(() => {
|
|
4970
5666
|
const t = this.target();
|
|
4971
5667
|
if (t === null) {
|
|
4972
5668
|
return 0;
|
|
4973
5669
|
}
|
|
4974
|
-
return
|
|
5670
|
+
return clampedRatio(t, 0, this.maxValue()) * 100;
|
|
4975
5671
|
}, ...(ngDevMode ? [{ debugName: "targetPercent" }] : /* istanbul ignore next */ []));
|
|
4976
5672
|
rangeRenderings = computed(() => {
|
|
4977
5673
|
const m = this.maxValue();
|
|
@@ -4980,27 +5676,23 @@ class CngxBullet {
|
|
|
4980
5676
|
const hi = Math.max(r.from, r.to);
|
|
4981
5677
|
return {
|
|
4982
5678
|
key: `${i}-${r.label ?? ''}`,
|
|
4983
|
-
left:
|
|
4984
|
-
width:
|
|
5679
|
+
left: clampedRatio(lo, 0, m) * 100,
|
|
5680
|
+
width: clampedRatio(hi - lo, 0, m) * 100,
|
|
4985
5681
|
color: r.color ?? null,
|
|
4986
5682
|
};
|
|
4987
5683
|
});
|
|
4988
|
-
}, ...(ngDevMode ?
|
|
5684
|
+
}, { ...(ngDevMode ? { debugName: "rangeRenderings" } : /* istanbul ignore next */ {}), equal: rangeRenderingsEqual });
|
|
4989
5685
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBullet, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4990
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBullet, isStandalone: true, selector: "cngx-bullet", inputs: { actual: { classPropertyName: "actual", publicName: "actual", isSignal: true, isRequired: true, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "actual()", "attr.aria-valuemin": "0", "attr.aria-valuemax": "maxValue()", "attr.aria-label": "ariaLabel()" }, classAttribute: "cngx-bullet" }, exportAs: ["cngxBullet"], ngImport: i0, template: `
|
|
5686
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxBullet, isStandalone: true, selector: "cngx-bullet", inputs: { actual: { classPropertyName: "actual", publicName: "actual", isSignal: true, isRequired: true, transformFunction: null }, target: { classPropertyName: "target", publicName: "target", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "meter" }, properties: { "attr.aria-valuenow": "showsMeterValue() ? actual() : null", "attr.aria-valuemin": "showsMeterValue() ? 0 : null", "attr.aria-valuemax": "showsMeterValue() ? maxValue() : null", "attr.aria-label": "ariaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-bullet" }, exportAs: ["cngxBullet"], ngImport: i0, template: `
|
|
4991
5687
|
@switch (activeView()) {
|
|
4992
5688
|
@case ('skeleton') {
|
|
4993
|
-
<span
|
|
4994
|
-
class="cngx-preset-skeleton"
|
|
4995
|
-
[attr.aria-busy]="true"
|
|
4996
|
-
[attr.aria-label]="i18n.loading()"
|
|
4997
|
-
></span>
|
|
5689
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
4998
5690
|
}
|
|
4999
5691
|
@case ('empty') {
|
|
5000
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5692
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5001
5693
|
}
|
|
5002
5694
|
@case ('error') {
|
|
5003
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5695
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5004
5696
|
}
|
|
5005
5697
|
@case ('none') {}
|
|
5006
5698
|
@default {
|
|
@@ -5027,31 +5719,28 @@ class CngxBullet {
|
|
|
5027
5719
|
</div>
|
|
5028
5720
|
}
|
|
5029
5721
|
}
|
|
5030
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5722
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5031
5723
|
}
|
|
5032
5724
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxBullet, decorators: [{
|
|
5033
5725
|
type: Component,
|
|
5034
5726
|
args: [{ selector: 'cngx-bullet', exportAs: 'cngxBullet', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
5035
5727
|
role: 'meter',
|
|
5036
|
-
'[attr.aria-valuenow]': 'actual()',
|
|
5037
|
-
'[attr.aria-valuemin]': '0',
|
|
5038
|
-
'[attr.aria-valuemax]': 'maxValue()',
|
|
5728
|
+
'[attr.aria-valuenow]': 'showsMeterValue() ? actual() : null',
|
|
5729
|
+
'[attr.aria-valuemin]': 'showsMeterValue() ? 0 : null',
|
|
5730
|
+
'[attr.aria-valuemax]': 'showsMeterValue() ? maxValue() : null',
|
|
5039
5731
|
'[attr.aria-label]': 'ariaLabel()',
|
|
5732
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5040
5733
|
class: 'cngx-bullet',
|
|
5041
5734
|
}, template: `
|
|
5042
5735
|
@switch (activeView()) {
|
|
5043
5736
|
@case ('skeleton') {
|
|
5044
|
-
<span
|
|
5045
|
-
class="cngx-preset-skeleton"
|
|
5046
|
-
[attr.aria-busy]="true"
|
|
5047
|
-
[attr.aria-label]="i18n.loading()"
|
|
5048
|
-
></span>
|
|
5737
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5049
5738
|
}
|
|
5050
5739
|
@case ('empty') {
|
|
5051
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5740
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5052
5741
|
}
|
|
5053
5742
|
@case ('error') {
|
|
5054
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5743
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5055
5744
|
}
|
|
5056
5745
|
@case ('none') {}
|
|
5057
5746
|
@default {
|
|
@@ -5078,21 +5767,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5078
5767
|
</div>
|
|
5079
5768
|
}
|
|
5080
5769
|
}
|
|
5081
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5082
|
-
}], propDecorators: { actual: [{ type: i0.Input, args: [{ isSignal: true, alias: "actual", required: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5770
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-bullet{display:block;width:var(--cngx-bullet-width, 200px);--cngx-bullet-actual-color: var(--cngx-chart-primary, currentColor);--cngx-bullet-target-color: var(--cngx-chart-text-color, currentColor)}cngx-bullet .cngx-bullet__track{position:relative;height:var(--cngx-bullet-height, 16px);background:var(--cngx-bullet-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .06)));border-radius:var(--cngx-bullet-radius, 2px);overflow:hidden}cngx-bullet .cngx-bullet__range{position:absolute;top:0;bottom:0;opacity:var(--cngx-bullet-range-opacity, .35)}cngx-bullet .cngx-bullet__actual{position:absolute;top:25%;bottom:25%;left:0;background:var(--cngx-bullet-actual-color);border-radius:var(--cngx-bullet-actual-radius, 1px);transition:width var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-bullet__target{position:absolute;top:10%;bottom:10%;width:2px;margin-left:-1px;background:var(--cngx-bullet-target-color);transition:left var(--cngx-bullet-transition, .24s) ease-out}cngx-bullet .cngx-preset-skeleton{display:block;height:var(--cngx-bullet-height, 16px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-bullet-radius, 2px)}cngx-bullet .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-bullet .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5771
|
+
}], ctorParameters: () => [], propDecorators: { actual: [{ type: i0.Input, args: [{ isSignal: true, alias: "actual", required: true }] }], target: [{ type: i0.Input, args: [{ isSignal: true, alias: "target", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], ranges: [{ type: i0.Input, args: [{ isSignal: true, alias: "ranges", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5083
5772
|
/** @internal */
|
|
5084
|
-
function
|
|
5085
|
-
if (
|
|
5086
|
-
return
|
|
5773
|
+
function rangeRenderingsEqual(a, b) {
|
|
5774
|
+
if (a === b) {
|
|
5775
|
+
return true;
|
|
5087
5776
|
}
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
return 0;
|
|
5777
|
+
if (a.length !== b.length) {
|
|
5778
|
+
return false;
|
|
5091
5779
|
}
|
|
5092
|
-
|
|
5093
|
-
|
|
5780
|
+
for (let i = 0; i < a.length; i++) {
|
|
5781
|
+
const x = a[i];
|
|
5782
|
+
const y = b[i];
|
|
5783
|
+
if (x.key !== y.key || x.left !== y.left || x.width !== y.width || x.color !== y.color) {
|
|
5784
|
+
return false;
|
|
5785
|
+
}
|
|
5094
5786
|
}
|
|
5095
|
-
return
|
|
5787
|
+
return true;
|
|
5096
5788
|
}
|
|
5097
5789
|
|
|
5098
5790
|
/**
|
|
@@ -5119,7 +5811,10 @@ class CngxStackedBar {
|
|
|
5119
5811
|
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
5120
5812
|
preset = injectPresetState(() => this.state());
|
|
5121
5813
|
i18n = this.preset.i18n;
|
|
5814
|
+
locale = injectLocale();
|
|
5122
5815
|
activeView = this.preset.activeView;
|
|
5816
|
+
/** True while the skeleton branch renders - the host announces busy, the span stays decorative. */
|
|
5817
|
+
busy = computed(() => this.activeView() === 'skeleton', ...(ngDevMode ? [{ debugName: "busy" }] : /* istanbul ignore next */ []));
|
|
5123
5818
|
resolvedTotal = computed(() => {
|
|
5124
5819
|
const explicit = this.total();
|
|
5125
5820
|
if (explicit !== null && explicit > 0) {
|
|
@@ -5133,6 +5828,8 @@ class CngxStackedBar {
|
|
|
5133
5828
|
}, ...(ngDevMode ? [{ debugName: "resolvedTotal" }] : /* istanbul ignore next */ []));
|
|
5134
5829
|
segmentRenderings = computed(() => {
|
|
5135
5830
|
const total = this.resolvedTotal();
|
|
5831
|
+
const locale = this.locale();
|
|
5832
|
+
const segmentTitle = this.i18n().stackedBarSegmentTitle;
|
|
5136
5833
|
let runningLeft = 0;
|
|
5137
5834
|
return this.segments().map((s, i) => {
|
|
5138
5835
|
const width = (s.value / total) * 100;
|
|
@@ -5143,39 +5840,47 @@ class CngxStackedBar {
|
|
|
5143
5840
|
left,
|
|
5144
5841
|
width,
|
|
5145
5842
|
color: s.color ?? null,
|
|
5146
|
-
|
|
5147
|
-
value: s.value,
|
|
5843
|
+
title: segmentTitle(s.label, formatChartNumber(s.value, locale)),
|
|
5148
5844
|
};
|
|
5149
5845
|
});
|
|
5150
|
-
}, ...(ngDevMode ?
|
|
5846
|
+
}, { ...(ngDevMode ? { debugName: "segmentRenderings" } : /* istanbul ignore next */ {}), equal: segmentRenderingsEqual });
|
|
5151
5847
|
effectiveAriaLabel = computed(() => {
|
|
5848
|
+
// Mirror the meter presets' state gating: outside the content view
|
|
5849
|
+
// the segment summary would name data that is not on screen -
|
|
5850
|
+
// "Empty stacked bar" while aria-busy announces a load in flight.
|
|
5851
|
+
const view = this.activeView();
|
|
5852
|
+
if (view === 'skeleton') {
|
|
5853
|
+
return this.i18n().loading();
|
|
5854
|
+
}
|
|
5855
|
+
if (view === 'empty') {
|
|
5856
|
+
return this.i18n().empty();
|
|
5857
|
+
}
|
|
5858
|
+
if (view === 'error') {
|
|
5859
|
+
return this.i18n().error();
|
|
5860
|
+
}
|
|
5152
5861
|
const explicit = this.ariaLabel();
|
|
5153
5862
|
if (explicit !== null && explicit !== '') {
|
|
5154
5863
|
return explicit;
|
|
5155
5864
|
}
|
|
5156
5865
|
const segments = this.segments();
|
|
5866
|
+
// The resolved bundle fills the optional stacked-bar keys from the
|
|
5867
|
+
// locale defaults when a direct useValue token override omits them.
|
|
5157
5868
|
if (segments.length === 0) {
|
|
5158
|
-
return
|
|
5869
|
+
return this.i18n().stackedBarEmpty();
|
|
5159
5870
|
}
|
|
5160
|
-
|
|
5161
|
-
const parts = segments.map((s) => `${s.label}: ${s.value}`);
|
|
5162
|
-
return `Total ${total}. ${parts.join(', ')}.`;
|
|
5871
|
+
return this.i18n().stackedBarSummary(this.resolvedTotal(), segments);
|
|
5163
5872
|
}, ...(ngDevMode ? [{ debugName: "effectiveAriaLabel" }] : /* istanbul ignore next */ []));
|
|
5164
5873
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStackedBar, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
5165
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStackedBar, isStandalone: true, selector: "cngx-stacked-bar", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "effectiveAriaLabel()" }, classAttribute: "cngx-stacked-bar" }, exportAs: ["cngxStackedBar"], ngImport: i0, template: `
|
|
5874
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.4", type: CngxStackedBar, isStandalone: true, selector: "cngx-stacked-bar", inputs: { segments: { classPropertyName: "segments", publicName: "segments", isSignal: true, isRequired: true, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "img" }, properties: { "attr.aria-label": "effectiveAriaLabel()", "attr.aria-busy": "busy() ? \"true\" : null" }, classAttribute: "cngx-stacked-bar" }, exportAs: ["cngxStackedBar"], ngImport: i0, template: `
|
|
5166
5875
|
@switch (activeView()) {
|
|
5167
5876
|
@case ('skeleton') {
|
|
5168
|
-
<span
|
|
5169
|
-
class="cngx-preset-skeleton"
|
|
5170
|
-
[attr.aria-busy]="true"
|
|
5171
|
-
[attr.aria-label]="i18n.loading()"
|
|
5172
|
-
></span>
|
|
5877
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5173
5878
|
}
|
|
5174
5879
|
@case ('empty') {
|
|
5175
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5880
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5176
5881
|
}
|
|
5177
5882
|
@case ('error') {
|
|
5178
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5883
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5179
5884
|
}
|
|
5180
5885
|
@case ('none') {}
|
|
5181
5886
|
@default {
|
|
@@ -5186,35 +5891,32 @@ class CngxStackedBar {
|
|
|
5186
5891
|
[style.left.%]="s.left"
|
|
5187
5892
|
[style.width.%]="s.width"
|
|
5188
5893
|
[style.background]="s.color"
|
|
5189
|
-
[attr.title]="s.
|
|
5894
|
+
[attr.title]="s.title"
|
|
5190
5895
|
[attr.aria-hidden]="true"
|
|
5191
5896
|
></div>
|
|
5192
5897
|
}
|
|
5193
5898
|
</div>
|
|
5194
5899
|
}
|
|
5195
5900
|
}
|
|
5196
|
-
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5901
|
+
`, isInline: true, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
5197
5902
|
}
|
|
5198
5903
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImport: i0, type: CngxStackedBar, decorators: [{
|
|
5199
5904
|
type: Component,
|
|
5200
5905
|
args: [{ selector: 'cngx-stacked-bar', exportAs: 'cngxStackedBar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, host: {
|
|
5201
5906
|
role: 'img',
|
|
5202
5907
|
'[attr.aria-label]': 'effectiveAriaLabel()',
|
|
5908
|
+
'[attr.aria-busy]': 'busy() ? "true" : null',
|
|
5203
5909
|
class: 'cngx-stacked-bar',
|
|
5204
5910
|
}, template: `
|
|
5205
5911
|
@switch (activeView()) {
|
|
5206
5912
|
@case ('skeleton') {
|
|
5207
|
-
<span
|
|
5208
|
-
class="cngx-preset-skeleton"
|
|
5209
|
-
[attr.aria-busy]="true"
|
|
5210
|
-
[attr.aria-label]="i18n.loading()"
|
|
5211
|
-
></span>
|
|
5913
|
+
<span class="cngx-preset-skeleton" aria-hidden="true"></span>
|
|
5212
5914
|
}
|
|
5213
5915
|
@case ('empty') {
|
|
5214
|
-
<span class="cngx-preset-fallback">{{ i18n.empty() }}</span>
|
|
5916
|
+
<span class="cngx-preset-fallback">{{ i18n().empty() }}</span>
|
|
5215
5917
|
}
|
|
5216
5918
|
@case ('error') {
|
|
5217
|
-
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n.error() }}</span>
|
|
5919
|
+
<span class="cngx-preset-fallback cngx-preset-fallback--error">{{ i18n().error() }}</span>
|
|
5218
5920
|
}
|
|
5219
5921
|
@case ('none') {}
|
|
5220
5922
|
@default {
|
|
@@ -5225,15 +5927,36 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5225
5927
|
[style.left.%]="s.left"
|
|
5226
5928
|
[style.width.%]="s.width"
|
|
5227
5929
|
[style.background]="s.color"
|
|
5228
|
-
[attr.title]="s.
|
|
5930
|
+
[attr.title]="s.title"
|
|
5229
5931
|
[attr.aria-hidden]="true"
|
|
5230
5932
|
></div>
|
|
5231
5933
|
}
|
|
5232
5934
|
</div>
|
|
5233
5935
|
}
|
|
5234
5936
|
}
|
|
5235
|
-
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits:
|
|
5937
|
+
`, styles: ["@layer cngx.tokens{@property --cngx-chart-primary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.66 .19 50);}@property --cngx-chart-secondary{syntax: \"<color>\"; inherits: true; initial-value: oklch(.65 .02 250);}@property --cngx-chart-danger{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .18 25);}@property --cngx-chart-success{syntax: \"<color>\"; inherits: true; initial-value: oklch(.55 .15 145);}@property --cngx-chart-grid-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.92 .005 250);}@property --cngx-chart-axis-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.5 .015 250);}@property --cngx-chart-text-color{syntax: \"<color>\"; inherits: true; initial-value: oklch(.25 .015 250);}@property --cngx-chart-aspect-ratio{syntax: \"*\"; inherits: true; initial-value: 5 / 2;}}:root{--cngx-chart-primary: var(--accent, var(--cngx-color-primary, oklch(.66 .19 50)));--cngx-chart-secondary: var( --accent-secondary, var(--cngx-color-text-muted, oklch(.65 .02 250)) );--cngx-chart-danger: var(--danger, var(--cngx-color-danger, oklch(.55 .18 25)));--cngx-chart-success: var(--success, var(--cngx-color-success, oklch(.55 .15 145)));--cngx-chart-grid-color: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-axis-color: var( --text-secondary, var(--cngx-color-text-muted, oklch(.5 .015 250)) );--cngx-chart-text-color: var(--text-primary, var(--cngx-color-text, oklch(.25 .015 250)));--cngx-skeleton-bg: color-mix(in oklch, currentColor 14%, transparent);--cngx-chart-numeric-bidi: isolate}@media(forced-colors:active){cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track,cngx-bullet.cngx-bullet .cngx-bullet__track,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track{background:Canvas}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__track:after,cngx-bullet.cngx-bullet .cngx-bullet__track:after,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__track:after,cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__track:after{content:\"\";position:absolute;inset:0;border-radius:inherit;pointer-events:none;forced-color-adjust:none;box-shadow:inset 0 0 0 1px CanvasText}cngx-mini-bar.cngx-mini-bar .cngx-mini-bar__fill,cngx-bullet.cngx-bullet .cngx-bullet__actual,cngx-bullet.cngx-bullet .cngx-bullet__target,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__fill,cngx-deviation-bar.cngx-deviation-bar .cngx-deviation-bar__baseline{background:CanvasText;opacity:1}cngx-bullet.cngx-bullet .cngx-bullet__range{forced-color-adjust:none;background:Canvas!important;box-shadow:inset -1px 0 0 GrayText;opacity:1}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment{forced-color-adjust:none;background:CanvasText!important;box-shadow:inset -2px 0 0 Canvas}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+2){background:repeating-linear-gradient(45deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+3){background:Canvas!important;box-shadow:inset -2px 0 0 Canvas,inset -3px 0 0 CanvasText,inset 0 0 0 1px CanvasText}cngx-stacked-bar.cngx-stacked-bar .cngx-stacked-bar__segment:nth-child(4n+4){background:repeating-linear-gradient(0deg,CanvasText 0 2px,Canvas 2px 4px)!important}cngx-donut.cngx-donut .cngx-donut__fill{stroke:CanvasText}cngx-donut.cngx-donut .cngx-donut__track{stroke:CanvasText;stroke-opacity:.6;stroke-dasharray:2 3}}\n", "cngx-stacked-bar{display:block;width:var(--cngx-stacked-bar-width, 200px)}cngx-stacked-bar .cngx-stacked-bar__track{position:relative;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-stacked-bar-track, var(--cngx-chart-grid-color, rgb(0 0 0 / .05)));border-radius:var(--cngx-stacked-bar-radius, 6px);overflow:hidden}cngx-stacked-bar .cngx-stacked-bar__segment{position:absolute;top:0;bottom:0;background:var(--cngx-stacked-bar-segment-color, var(--cngx-chart-primary, currentColor));transition:width var(--cngx-stacked-bar-transition, .24s) ease-out,left var(--cngx-stacked-bar-transition, .24s) ease-out}cngx-stacked-bar .cngx-preset-skeleton{display:block;height:var(--cngx-stacked-bar-height, 12px);background:var(--cngx-skeleton-bg, var(--cngx-chart-grid-color, rgb(0 0 0 / .08)));border-radius:var(--cngx-stacked-bar-radius, 6px)}cngx-stacked-bar .cngx-preset-fallback{display:inline-block;font-size:var(--cngx-preset-fallback-font-size, .75rem);opacity:var(--cngx-preset-fallback-opacity, .7)}cngx-stacked-bar .cngx-preset-fallback--error{color:var(--cngx-chart-danger, currentColor)}\n"] }]
|
|
5236
5938
|
}], propDecorators: { segments: [{ type: i0.Input, args: [{ isSignal: true, alias: "segments", required: true }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }] } });
|
|
5939
|
+
/** @internal */
|
|
5940
|
+
function segmentRenderingsEqual(a, b) {
|
|
5941
|
+
if (a === b) {
|
|
5942
|
+
return true;
|
|
5943
|
+
}
|
|
5944
|
+
if (a.length !== b.length) {
|
|
5945
|
+
return false;
|
|
5946
|
+
}
|
|
5947
|
+
for (let i = 0; i < a.length; i++) {
|
|
5948
|
+
const x = a[i];
|
|
5949
|
+
const y = b[i];
|
|
5950
|
+
if (x.key !== y.key ||
|
|
5951
|
+
x.left !== y.left ||
|
|
5952
|
+
x.width !== y.width ||
|
|
5953
|
+
x.color !== y.color ||
|
|
5954
|
+
x.title !== y.title) {
|
|
5955
|
+
return false;
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
return true;
|
|
5959
|
+
}
|
|
5237
5960
|
|
|
5238
5961
|
/**
|
|
5239
5962
|
* @module @cngx/common/chart
|
|
@@ -5248,5 +5971,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.4", ngImpor
|
|
|
5248
5971
|
* Generated bundle index. Do not edit.
|
|
5249
5972
|
*/
|
|
5250
5973
|
|
|
5251
|
-
export { CHART_SMALL_BREAKPOINT_PX, CNGX_CHART_AXIS, CNGX_CHART_CONTEXT, CNGX_CHART_I18N, CNGX_CHART_LAYER, CNGX_CHART_RENDERER_FACTORY, CNGX_CHART_RENDERER_THRESHOLD, CngxArea, CngxAxis, CngxAxisDomain, CngxBand, CngxBar, CngxBullet, CngxChart, CngxChartAnnouncer, CngxChartConnectionError, CngxChartEmpty, CngxChartError, CngxChartLegend, CngxChartLoading, CngxChartOverlay, CngxChartReconnecting, CngxDeviationBar, CngxDonut, CngxLine, CngxMiniArea, CngxMiniBar, CngxScatter, CngxSparkline, CngxStackedBar, CngxThreshold, buildCurvePath, createBandScale, createCanvasRenderer, createChartRendererController, createDefaultChartRenderer, createLinearScale, createOrdinalScale, createPathBuilder, createSignificantChangeTracker, createSvgRenderer, createTimeScale, downsampleLTTB, injectChartBuffer, provideChartI18n, provideChartRenderer, withChartRendererFactory, withChartRendererThreshold };
|
|
5974
|
+
export { CHART_SMALL_BREAKPOINT_PX, CNGX_CHART_AXIS, CNGX_CHART_CONTEXT, CNGX_CHART_I18N, CNGX_CHART_LANGUAGE_EN, CNGX_CHART_LAYER, CNGX_CHART_RENDERER_FACTORY, CNGX_CHART_RENDERER_THRESHOLD, CngxArea, CngxAxis, CngxAxisDomain, CngxBand, CngxBar, CngxBullet, CngxChart, CngxChartAnnouncer, CngxChartConnectionError, CngxChartEmpty, CngxChartError, CngxChartLegend, CngxChartLoading, CngxChartOverlay, CngxChartReconnecting, CngxDeviationBar, CngxDonut, CngxLine, CngxMiniArea, CngxMiniBar, CngxScatter, CngxSparkline, CngxStackedBar, CngxThreshold, buildCurvePath, createBandScale, createCanvasRenderer, createChartRendererController, createDefaultChartRenderer, createLinearScale, createOrdinalScale, createPathBuilder, createSignificantChangeTracker, createSvgRenderer, createTimeScale, downsampleLTTB, injectChartBuffer, injectChartContext, provideChartI18n, provideChartRenderer, withChartI18nLabels, withChartRendererFactory, withChartRendererThreshold };
|
|
5252
5975
|
//# sourceMappingURL=cngx-common-chart.mjs.map
|