@mantha911/ng-echarts 0.1.0-rc.18 → 0.1.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/README.md +9 -5
- package/fesm2022/mantha911-ng-echarts-area.mjs +34 -21
- package/fesm2022/mantha911-ng-echarts-area.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-bar.mjs +35 -22
- package/fesm2022/mantha911-ng-echarts-bar.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-calendar.mjs +13 -14
- package/fesm2022/mantha911-ng-echarts-calendar.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-composed.mjs +64 -26
- package/fesm2022/mantha911-ng-echarts-composed.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-core.mjs +219 -43
- package/fesm2022/mantha911-ng-echarts-core.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-line.mjs +34 -21
- package/fesm2022/mantha911-ng-echarts-line.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-pie.mjs +81 -48
- package/fesm2022/mantha911-ng-echarts-pie.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-radial.mjs +13 -14
- package/fesm2022/mantha911-ng-echarts-radial.mjs.map +1 -1
- package/fesm2022/mantha911-ng-echarts-sankey.mjs +13 -14
- package/fesm2022/mantha911-ng-echarts-sankey.mjs.map +1 -1
- package/package.json +1 -1
- package/types/mantha911-ng-echarts-composed.d.ts +3 -0
- package/types/mantha911-ng-echarts-core.d.ts +40 -1
- package/types/mantha911-ng-echarts-pie.d.ts +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.0-rc.21 — Documentation correction
|
|
4
|
+
|
|
5
|
+
- Correct packaged availability/version guidance after rc.19 publication, and document pagination and named composed stacks by their introduction versions.
|
|
6
|
+
- Preserve rc.20 runtime/declarations, dependencies, licensing, notices and all archived candidates. Human release gates remain pending.
|
|
7
|
+
|
|
8
|
+
## 0.1.0-rc.20 — Verified local candidate
|
|
9
|
+
|
|
10
|
+
- Add optional named bar stacks to composed charts on the existing shared scale, with signed end caps, raw point actions and independent supplied line values.
|
|
11
|
+
- Preserve the verified rc.19 performance/Angular artifact and all earlier archives. Human release gates remain pending.
|
|
12
|
+
|
|
13
|
+
## 0.1.0-rc.19 — Verified local candidate
|
|
14
|
+
|
|
15
|
+
- Reconcile renderer recovery, legend visibility and transient plot previews with dependent signals; explicitly phase browser rendering while retaining mixed CSS-color and focus operations.
|
|
16
|
+
- Add opt-in `tablePageSize` to bar, line, area, composed and pie tables, with keyboard paging, bounded row creation and original-row selection events. The default remains a complete table.
|
|
17
|
+
- Skip stack-end scans for unstacked bars.
|
|
18
|
+
- Preserve the published rc.18 archive and all earlier artifacts. Publication and deferred human release gates are unchanged.
|
|
19
|
+
|
|
3
20
|
## 0.1.0-rc.18 — 14 November 2026
|
|
4
21
|
|
|
5
22
|
- Prepare the first experimental public prerelease as `@mantha911/ng-echarts`, with matching focused imports, guides and isolated consumers.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Angular chart library
|
|
2
2
|
|
|
3
|
-
Experimental standalone Angular 22 components using Apache ECharts. Public prerelease identity: `@mantha911/ng-echarts`.
|
|
3
|
+
Experimental standalone Angular 22 components using Apache ECharts. Public prerelease identity: `@mantha911/ng-echarts`. Current candidate: `0.1.0-rc.21`. Public prereleases use the `next` tag; consult the repository publication record for the current registry version. Original library code is MIT licensed; preserve `LICENSE`, `THIRD_PARTY_NOTICES.md`, and the `third-party/` notices. The API is experimental; human screen-reader interpretation remains unreviewed at the user’s request.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -13,10 +13,10 @@ npm install @mantha911/ng-echarts@next echarts@6.1.0
|
|
|
13
13
|
For a retained exact local candidate:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
npm install /absolute/path/to/mantha911-ng-echarts-0.1.0-rc.
|
|
16
|
+
npm install /absolute/path/to/mantha911-ng-echarts-0.1.0-rc.21.tgz echarts@6.1.0
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
Retain the tarball at the lockfile's recorded path, or store it in the consumer's `vendor/` directory. Commit the lockfile and use `npm ci` for repeat installs. Repack and reinstall to consume source changes.
|
|
19
|
+
Retain the tarball at the lockfile's recorded path, or store it in the consumer's `vendor/` directory. Commit the lockfile and use `npm ci` for repeat installs. Repack and reinstall to consume source changes. Table pagination is available since rc.19. Named composed bar stacks require rc.20 or later. The exact local candidate includes both; a registry install must resolve a version containing the features you use.
|
|
20
20
|
|
|
21
21
|
No global ECharts registration, library stylesheet, Angular provider or React runtime is required. The package supplies scoped styles and a lazy Canvas renderer. Give its containing card a nonzero width. Cartesian/radar/pie plot height defaults to 320 px, with native controls adding to total height; radial progress defaults to 240 px and calendar/Sankey use family-specific layouts.
|
|
22
22
|
|
|
@@ -101,13 +101,13 @@ Tested: Angular/CLI 22.2.6, TypeScript 6.0.3, ECharts 6.1.0, RxJS 7.8.2, Node 24
|
|
|
101
101
|
|
|
102
102
|
The starting measured envelope is 200 categories × three Cartesian series or 12 pie/donut categories on the recorded M2 Pro machine. Stress fixtures use 2,000 Cartesian or 100 pie/donut categories; these are observations, not hard limits or portable latency guarantees. Outside labels may shorten/hide collisions; expanded tables have separate costs.
|
|
103
103
|
|
|
104
|
-
Focused imports keep unrelated engines out. Line and area intentionally share ECharts' Line engine. Root imports preserve class identity but include combined registrations. Deep paths and core `ɵ` exports are unsupported implementation APIs. Size checks count all lazy chunks, excluding Angular/RxJS peers: gzip/Brotli caps are 200,000/175,000 bytes per family, 10,000/9,000 for core,
|
|
104
|
+
Focused imports keep unrelated engines out. Line and area intentionally share ECharts' Line engine. Root imports preserve class identity but include combined registrations. Deep paths and core `ɵ` exports are unsupported implementation APIs. Size checks count all lazy chunks, excluding Angular/RxJS peers: gzip/Brotli caps are 200,000/175,000 bytes per family, 10,000/9,000 for core, 222,000/190,000 for root, and 206,000/178,000 for root-frame emitted orphan chunks (zero reachable engine modules).
|
|
105
105
|
|
|
106
106
|
Raw ECharts options, custom tooltip templates, time/logarithmic axes, server plot images/export, brushes, advanced decoration and additional chart families are outside the MVP. APIs remain experimental. Automated acceptance passes; human interpretation and final artifact/release gates remain pending.
|
|
107
107
|
|
|
108
108
|
## Composed charts
|
|
109
109
|
|
|
110
|
-
The post-MVP `ComposedChart` and `ComposedSeries<T>` exports in `/composed` combine vertical bars and lines on one category/value scale. Every descriptor adds `kind: 'bar' | 'line'` to the shared series fields; lines accept `smooth` and `showPoints`. Supply comparable units. The renderer uses supplied trend values; the demo computes its trailing mean separately. Dual axes
|
|
110
|
+
The post-MVP `ComposedChart` and `ComposedSeries<T>` exports in `/composed` combine vertical bars and lines on one category/value scale. Every descriptor adds `kind: 'bar' | 'line'` to the shared series fields; lines accept `smooth` and `showPoints`. Supply comparable units. The renderer uses supplied trend values; the demo computes its trailing mean separately. Bars optionally accept a nonempty `stack` name: equal names stack by sign; omitted names keep bars grouped. Lines remain independent supplied values. Dual axes and area composition remain outside this increment. Named composed stacks require rc.20 or later; published rc.18 does not contain this API.
|
|
111
111
|
|
|
112
112
|
## Controlled bar selection
|
|
113
113
|
|
|
@@ -146,3 +146,7 @@ Experimental Sankey flows: `SankeyChart`, `SankeyNode`, `SankeyLink` and `Sankey
|
|
|
146
146
|
Charts reserve plot space during loading, empty and error states and retain unavailable controls as inert layout space. Pie legends include raw values and locale-formatted visible shares; opt into `[showTotal]="true"` for a center total when `innerRadius >= 0.4`. Calendar and Sankey accept `valueLabel` (default `Value`) to name the measure in tooltips. These features ship in private rc.11 and the docs-only rc.12 successor. Earlier archives retain their original bytes; no public registry release is implied.
|
|
147
147
|
|
|
148
148
|
The compatibility root reexports bar, line, area, pie/donut and composed components plus `ChartFrame` and applicable types. Radar, radial progress, calendar and Sankey require their focused entries. Original API documentation is at [the repository docs index](https://github.com/phalla-doll/ng-echarts#documents). Private rc.15 includes opt-in bar `previewEnabled` / `pointPreview` for transient pointer/table-focus context, settled-input reconciliation and Escape cancellation. Earlier archives, including rc.13/rc.14 and the documentation-only rc.12, retain their original bytes and scoped evidence.
|
|
149
|
+
|
|
150
|
+
## Optional table pagination since rc.19
|
|
151
|
+
|
|
152
|
+
Bar, line, area, composed and pie accept `[tablePageSize]="50"`. The default `null` renders the complete table. A positive safe integer limits table row creation to the current page while the plot retains every observation. Previous/Next buttons preserve keyboard focus and announce the visible row range. Replacing the data array or page size restarts at the first page; collapsing and reopening retains the page. Off-page rows remain available through paging, with original-row selection events and hidden-series values preserved. Radar, calendar and Sankey retain their existing bounded tables.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { ChangeDetectionStrategy, Component, InjectionToken, inject, input } from "@angular/core";
|
|
3
|
-
import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵbuildCurveOptions } from "@mantha911/ng-echarts/core";
|
|
3
|
+
import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵTablePager, ɵbuildCurveOptions } from "@mantha911/ng-echarts/core";
|
|
4
4
|
const AREA_RENDERER_LOADER = new InjectionToken("Area renderer loader", {
|
|
5
5
|
providedIn: "root",
|
|
6
6
|
factory: () => () => import("./mantha911-ng-echarts-area-area-renderer-DQmIKv7N.mjs").then((module) => module.createAreaRenderer)
|
|
@@ -116,25 +116,34 @@ var AreaChart = class AreaChart extends ɵCartesianChart {
|
|
|
116
116
|
},
|
|
117
117
|
usesInheritance: true,
|
|
118
118
|
ngImport: i0,
|
|
119
|
-
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
119
|
+
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
120
120
|
styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"],
|
|
121
|
-
dependencies: [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
dependencies: [
|
|
122
|
+
{
|
|
123
|
+
kind: "component",
|
|
124
|
+
type: ChartFrame,
|
|
125
|
+
selector: "nec-chart-frame",
|
|
126
|
+
inputs: ["title", "description"]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
kind: "component",
|
|
130
|
+
type: ɵChartStage,
|
|
131
|
+
selector: "nec-chart-stage",
|
|
132
|
+
inputs: [
|
|
133
|
+
"state",
|
|
134
|
+
"height",
|
|
135
|
+
"retryable",
|
|
136
|
+
"retryLabel"
|
|
137
|
+
],
|
|
138
|
+
outputs: ["retry"]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
kind: "component",
|
|
142
|
+
type: ɵTablePager,
|
|
143
|
+
selector: "nec-table-pager",
|
|
144
|
+
inputs: ["pagination", "label"]
|
|
145
|
+
}
|
|
146
|
+
],
|
|
138
147
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
139
148
|
});
|
|
140
149
|
};
|
|
@@ -147,9 +156,13 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
147
156
|
type: Component,
|
|
148
157
|
args: [{
|
|
149
158
|
selector: "nec-area-chart",
|
|
150
|
-
imports: [
|
|
159
|
+
imports: [
|
|
160
|
+
ChartFrame,
|
|
161
|
+
ɵChartStage,
|
|
162
|
+
ɵTablePager
|
|
163
|
+
],
|
|
151
164
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
152
|
-
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
165
|
+
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
153
166
|
styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"]
|
|
154
167
|
}]
|
|
155
168
|
}],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mantha911-ng-echarts-area.mjs","names":[],"sources":["../../../projects/chart-library/area/src/lib/area-browser.ts","../../../projects/chart-library/area/src/lib/area-options.ts","../../../projects/chart-library/area/src/lib/area-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { AreaOption } from './area-options';\nexport const AREA_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<AreaOption>>\n>('Area renderer loader', {\n providedIn: 'root',\n factory: () => () => import('./area-renderer').then((module) => module.createAreaRenderer),\n});\n","import type { LineSeriesOption } from 'echarts/charts';\nimport {\n ɵbuildCurveOptions,\n type ɵCartesianContext,\n type ɵCurveOption,\n} from '@mantha911/ng-echarts/core';\nexport type AreaOption = ɵCurveOption;\nfunction alphaColor(color: string, factor: number): string {\n if (/^#[\\da-f]{6}$/i.test(color))\n return `rgba(${[1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16)).join(',')},${factor})`;\n const rgba = color.match(\n /^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)(?:\\s*,\\s*([\\d.]+))?\\s*\\)$/,\n );\n return rgba\n ? `rgba(${rgba[1]},${rgba[2]},${rgba[3]},${Number(rgba[4] ?? 1) * factor})`\n : 'transparent';\n}\nexport function buildAreaOptions<T>(\n context: ɵCartesianContext<T>,\n smooth: boolean,\n showPoints: boolean,\n stacked: boolean,\n gradient: boolean,\n): AreaOption {\n const options = ɵbuildCurveOptions(context, smooth, showPoints);\n if (!Array.isArray(options.series)) throw new Error('Expected curve series');\n return {\n ...options,\n series: options.series.map((item): LineSeriesOption => {\n const color = typeof item.lineStyle?.color === 'string' ? item.lineStyle.color : '#047857';\n return {\n ...item,\n stack: stacked ? 'total' : undefined,\n stackStrategy: 'samesign',\n triggerEvent: true,\n areaStyle: {\n opacity: 1,\n color: gradient\n ? {\n type: 'linear',\n x: 0,\n y: 0,\n x2: 0,\n y2: 1,\n colorStops: [\n { offset: 0, color: alphaColor(color, 0.22) },\n { offset: 1, color: alphaColor(color, 0.04) },\n ],\n }\n : alphaColor(color, 0.16),\n },\n };\n }),\n };\n}\n","import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { AREA_RENDERER_LOADER } from './area-browser';\nimport { buildAreaOptions, type AreaOption } from './area-options';\n@Component({\n selector: 'nec-area-chart',\n imports: [ChartFrame, ɵChartStage],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AreaChart<T extends object> extends ɵCartesianChart<T, AreaOption> {\n readonly smooth = input(false);\n readonly showPoints = input(false);\n readonly stacked = input(false);\n readonly gradient = input(true);\n private readonly loader = inject(AREA_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return {\n smooth: this.smooth(),\n showPoints: this.showPoints(),\n stacked: this.stacked(),\n gradient: this.gradient(),\n };\n }\n protected override familyError() {\n return typeof this.smooth() === 'boolean' &&\n typeof this.showPoints() === 'boolean' &&\n typeof this.stacked() === 'boolean' &&\n typeof this.gradient() === 'boolean'\n ? null\n : 'Area settings must be booleans.';\n }\n protected override buildOptions(context: ɵCartesianContext<T>): AreaOption {\n return buildAreaOptions(\n context,\n this.smooth(),\n this.showPoints(),\n this.stacked(),\n this.gradient(),\n );\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >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AAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UCnBtB;EAyHA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MD9GY;GAAU,UAAA;GAAA,QAAA,CAAA,SAAA,aAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAW,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,OAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQtB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAVrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,SACjB,CAAC,YAAY,WAAW;GAAC,iBAMjB,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"mantha911-ng-echarts-area.mjs","names":[],"sources":["../../../projects/chart-library/area/src/lib/area-browser.ts","../../../projects/chart-library/area/src/lib/area-options.ts","../../../projects/chart-library/area/src/lib/area-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { ɵPlotRendererFactory } from '@mantha911/ng-echarts/core';\nimport type { AreaOption } from './area-options';\nexport const AREA_RENDERER_LOADER = new InjectionToken<\n () => Promise<ɵPlotRendererFactory<AreaOption>>\n>('Area renderer loader', {\n providedIn: 'root',\n factory: () => () => import('./area-renderer').then((module) => module.createAreaRenderer),\n});\n","import type { LineSeriesOption } from 'echarts/charts';\nimport {\n ɵbuildCurveOptions,\n type ɵCartesianContext,\n type ɵCurveOption,\n} from '@mantha911/ng-echarts/core';\nexport type AreaOption = ɵCurveOption;\nfunction alphaColor(color: string, factor: number): string {\n if (/^#[\\da-f]{6}$/i.test(color))\n return `rgba(${[1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16)).join(',')},${factor})`;\n const rgba = color.match(\n /^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)(?:\\s*,\\s*([\\d.]+))?\\s*\\)$/,\n );\n return rgba\n ? `rgba(${rgba[1]},${rgba[2]},${rgba[3]},${Number(rgba[4] ?? 1) * factor})`\n : 'transparent';\n}\nexport function buildAreaOptions<T>(\n context: ɵCartesianContext<T>,\n smooth: boolean,\n showPoints: boolean,\n stacked: boolean,\n gradient: boolean,\n): AreaOption {\n const options = ɵbuildCurveOptions(context, smooth, showPoints);\n if (!Array.isArray(options.series)) throw new Error('Expected curve series');\n return {\n ...options,\n series: options.series.map((item): LineSeriesOption => {\n const color = typeof item.lineStyle?.color === 'string' ? item.lineStyle.color : '#047857';\n return {\n ...item,\n stack: stacked ? 'total' : undefined,\n stackStrategy: 'samesign',\n triggerEvent: true,\n areaStyle: {\n opacity: 1,\n color: gradient\n ? {\n type: 'linear',\n x: 0,\n y: 0,\n x2: 0,\n y2: 1,\n colorStops: [\n { offset: 0, color: alphaColor(color, 0.22) },\n { offset: 1, color: alphaColor(color, 0.04) },\n ],\n }\n : alphaColor(color, 0.16),\n },\n };\n }),\n };\n}\n","import { ChangeDetectionStrategy, Component, inject, input } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵTablePager,\n ɵCartesianChart,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { AREA_RENDERER_LOADER } from './area-browser';\nimport { buildAreaOptions, type AreaOption } from './area-options';\n@Component({\n selector: 'nec-area-chart',\n imports: [ChartFrame, ɵChartStage, ɵTablePager],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AreaChart<T extends object> extends ɵCartesianChart<T, AreaOption> {\n readonly smooth = input(false);\n readonly showPoints = input(false);\n readonly stacked = input(false);\n readonly gradient = input(true);\n private readonly loader = inject(AREA_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override familyConfiguration() {\n return {\n smooth: this.smooth(),\n showPoints: this.showPoints(),\n stacked: this.stacked(),\n gradient: this.gradient(),\n };\n }\n protected override familyError() {\n return typeof this.smooth() === 'boolean' &&\n typeof this.showPoints() === 'boolean' &&\n typeof this.stacked() === 'boolean' &&\n typeof this.gradient() === 'boolean'\n ? null\n : 'Area settings must be booleans.';\n }\n protected override buildOptions(context: ɵCartesianContext<T>): AreaOption {\n return buildAreaOptions(\n context,\n this.smooth(),\n this.showPoints(),\n this.stacked(),\n this.gradient(),\n );\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {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A;GAAA;GAAA,YAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,SAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,UAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UCpBtB;EA0HA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MD9GY;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,aAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA,CAAA,cAAA,OAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQnC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAS,YAAA,CAAA;EAVrB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAgB,SACjB;IAAC;IAAY;IAAa;GAAW;GAAC,iBAM9B,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
2
|
import { ChangeDetectionStrategy, Component, InjectionToken, computed, inject, input, output } from "@angular/core";
|
|
3
|
-
import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵbuildCartesianOptions } from "@mantha911/ng-echarts/core";
|
|
3
|
+
import { ChartFrame, ɵCartesianChart, ɵChartStage, ɵTablePager, ɵbuildCartesianOptions } from "@mantha911/ng-echarts/core";
|
|
4
4
|
const BAR_RENDERER_LOADER = new InjectionToken("Bar renderer loader", {
|
|
5
5
|
providedIn: "root",
|
|
6
6
|
factory: () => () => import("./mantha911-ng-echarts-bar-bar-renderer-B7Rupncx.mjs").then((module) => module.createBarRenderer)
|
|
@@ -79,7 +79,7 @@ function buildBarOptions(model, hiddenIds, tokens, layout, stacked, gradient, an
|
|
|
79
79
|
},
|
|
80
80
|
data: model.rows.map((row) => {
|
|
81
81
|
const value = row.points[index]?.value ?? null;
|
|
82
|
-
const outer = value !== null && value !== 0 && !model.series.some((later, laterIndex) => {
|
|
82
|
+
const outer = stacked && value !== null && value !== 0 && !model.series.some((later, laterIndex) => {
|
|
83
83
|
const other = row.points[laterIndex]?.value ?? 0;
|
|
84
84
|
return laterIndex > index && !hiddenIds.has(later.id) && other !== 0 && Math.sign(other) === Math.sign(value);
|
|
85
85
|
});
|
|
@@ -272,25 +272,34 @@ var BarChart = class BarChart extends ɵCartesianChart {
|
|
|
272
272
|
},
|
|
273
273
|
usesInheritance: true,
|
|
274
274
|
ngImport: i0,
|
|
275
|
-
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
275
|
+
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
276
276
|
styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"],
|
|
277
|
-
dependencies: [
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
"
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
277
|
+
dependencies: [
|
|
278
|
+
{
|
|
279
|
+
kind: "component",
|
|
280
|
+
type: ChartFrame,
|
|
281
|
+
selector: "nec-chart-frame",
|
|
282
|
+
inputs: ["title", "description"]
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
kind: "component",
|
|
286
|
+
type: ɵChartStage,
|
|
287
|
+
selector: "nec-chart-stage",
|
|
288
|
+
inputs: [
|
|
289
|
+
"state",
|
|
290
|
+
"height",
|
|
291
|
+
"retryable",
|
|
292
|
+
"retryLabel"
|
|
293
|
+
],
|
|
294
|
+
outputs: ["retry"]
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
kind: "component",
|
|
298
|
+
type: ɵTablePager,
|
|
299
|
+
selector: "nec-table-pager",
|
|
300
|
+
inputs: ["pagination", "label"]
|
|
301
|
+
}
|
|
302
|
+
],
|
|
294
303
|
changeDetection: i0.ChangeDetectionStrategy.OnPush
|
|
295
304
|
});
|
|
296
305
|
};
|
|
@@ -303,9 +312,13 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
303
312
|
type: Component,
|
|
304
313
|
args: [{
|
|
305
314
|
selector: "nec-bar-chart",
|
|
306
|
-
imports: [
|
|
315
|
+
imports: [
|
|
316
|
+
ChartFrame,
|
|
317
|
+
ɵChartStage,
|
|
318
|
+
ɵTablePager
|
|
319
|
+
],
|
|
307
320
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
308
|
-
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
321
|
+
template: "<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n",
|
|
309
322
|
styles: [":host{display:block;min-width:0}.plot{width:100%}.plot[hidden]{display:none}.legend{display:flex;flex-wrap:wrap;gap:.5rem;margin:1rem 0}button{padding:.5rem .75rem;border:1px solid var(--nec-border, #d6dce5);border-radius:.375rem;color:inherit;background:transparent;font:inherit;cursor:pointer}button:focus-visible,.table-scroll:focus-visible{outline:3px solid var(--nec-focus, #648dff);outline-offset:3px}.swatch{display:inline-block;width:.75rem;height:.75rem;border-radius:.125rem;margin-right:.375rem}.visibility{margin-left:.5rem;font-size:.75rem}.table-toggle{margin:.25rem 0}.table-scroll{overflow-x:auto;margin-top:1rem}table{width:100%;border-collapse:collapse;font-variant-numeric:tabular-nums;text-align:left}caption{padding:.5rem;text-align:left;font-weight:600}th,td{padding:.5rem;border-bottom:1px solid var(--nec-border, #d6dce5)}td{white-space:nowrap}.selected-row{background:color-mix(in srgb,var(--nec-text, #18202c) 5%,transparent)}.selected-row th{box-shadow:inset 2px 0 var(--nec-text, #18202c)}.selection-label{display:block;margin-top:2px;color:var(--nec-muted, #536176);font-size:.6875rem;font-weight:500}.legend button{position:relative;display:inline-flex;align-items:center;gap:6px}.legend button:hover{background:color-mix(in srgb,var(--nec-text, #18202c) 4%,transparent)}.legend button[aria-pressed=false]{border-style:dashed;color:var(--nec-muted, #536176)}.legend button[aria-pressed=false] .swatch{opacity:.35}.pie-legend{display:grid;grid-template-columns:repeat(auto-fit,minmax(108px,1fr));gap:8px}.pie-legend button{display:grid;grid-template-columns:8px minmax(0,1fr);gap:2px 6px;padding:8px 10px;min-width:0;text-align:left}.legend-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.legend-values{grid-column:2;display:flex;justify-content:space-between;gap:6px;font-size:11px;font-variant-numeric:tabular-nums;color:var(--nec-muted, #536176)}.donut-total{position:absolute;inset:0;margin:auto;width:min(36%,140px);height:fit-content;text-align:center;pointer-events:none}.donut-total strong{display:block;font-size:clamp(18px,3vw,26px);line-height:1.25;font-weight:600;letter-spacing:-.5px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.donut-total span{display:block;margin-top:4px;font-size:11px;line-height:16px;color:var(--nec-muted, #536176);overflow-wrap:anywhere}@media(max-width:600px){.pie-legend{grid-template-columns:repeat(2,minmax(0,1fr))}}.legend-values{flex-wrap:wrap;min-width:0}.legend-values>span{min-width:0;overflow-wrap:anywhere}.donut-total strong,.donut-total span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}\n", ".chart-controls{min-height:52px}.chart-controls[inert]{visibility:hidden;pointer-events:none}.plot-message{position:absolute;inset:0;display:grid;align-content:center;justify-items:center;padding:20px;margin:0;box-sizing:border-box;text-align:center;color:var(--nec-muted, #536176);font-size:13px;line-height:1.6;pointer-events:none}.visibility:not(.legend-note){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.scale-context{margin:0 0 8px;color:var(--nec-muted, #536176);font-size:12px;line-height:20px}.plot-message>span{max-width:34ch;padding:10px 12px;border-radius:6px;background:var(--nec-background, #fff)}\n"]
|
|
310
323
|
}]
|
|
311
324
|
}],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mantha911-ng-echarts-bar.mjs","names":[],"sources":["../../../projects/chart-library/bar/src/lib/bar-browser.ts","../../../projects/chart-library/bar/src/lib/bar-options.ts","../../../projects/chart-library/bar/src/lib/bar-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { BarRendererFactory } from './plot-controller';\nexport {\n ɵbrowserPlotEnvironment as browserPlotEnvironment,\n ɵreadCartesianTheme as readBarTheme,\n} from '@mantha911/ng-echarts/core';\nexport const BAR_RENDERER_LOADER = new InjectionToken<() => Promise<BarRendererFactory>>(\n 'Bar renderer loader',\n {\n providedIn: 'root',\n factory: () => () => import('./bar-renderer').then((module) => module.createBarRenderer),\n },\n);\n","// The first two default palette colors are adapted from EvilCharts (2026 Gurbinder, MIT).\n// See docs/UPSTREAM_PROVENANCE.md and third-party/evilcharts-LICENSE.txt in the package.\nimport type { BarSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport type { BarModel } from './bar-model';\nimport type { BarLayout } from '@mantha911/ng-echarts/core';\n\nexport type BarOption = ComposeOption<\n BarSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport {\n ɵdefaultCartesianTheme as defaultBarTheme,\n ɵescapeTooltipText as escapeTooltipText,\n} from '@mantha911/ng-echarts/core';\nexport type { ɵCartesianThemeTokens as BarThemeTokens } from '@mantha911/ng-echarts/core';\nimport { ɵbuildCartesianOptions } from '@mantha911/ng-echarts/core';\nimport type { ɵCartesianThemeTokens as BarThemeTokens } from '@mantha911/ng-echarts/core';\nfunction baseColor(color: string): string {\n if (/^#[\\da-f]{6}$/i.test(color)) {\n return `rgba(${[1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16)).join(',')},0.3)`;\n }\n const rgba = color.match(/^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)(?:\\s*,\\s*([\\d.]+))?/);\n return rgba ? `rgba(${rgba[1]},${rgba[2]},${rgba[3]},${Number(rgba[4] ?? 1) * 0.3})` : color;\n}\n\nexport function buildBarOptions<T>(\n model: Exclude<BarModel<T>, { kind: 'error' }>,\n hiddenIds: ReadonlySet<string>,\n tokens: BarThemeTokens,\n layout: BarLayout,\n stacked: boolean,\n gradient: boolean,\n animation: boolean,\n format: (value: number) => string,\n categoryTicks: readonly string[] = model.rows.map((row) => row.category),\n selectedRowIds: ReadonlySet<string> = new Set(),\n): BarOption {\n const horizontal = layout === 'horizontal';\n const selected = selectedRowIds.size > 0 && model.rows.some((row) => selectedRowIds.has(row.id));\n const base = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n horizontal,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = horizontal ? base.yAxis : base.xAxis;\n const selectedAxis = () => ({\n ...categoryAxis,\n // A category band remains visible for zero/missing values or hidden series.\n splitArea: {\n show: true,\n interval: 0,\n areaStyle: {\n color: model.rows.map((row) =>\n selectedRowIds.has(row.id) ? tokens.border : 'transparent',\n ),\n opacity: 0.3,\n },\n },\n data: model.rows.map((row) => ({\n value: row.id,\n textStyle: selectedRowIds.has(row.id) ? { color: tokens.text, fontWeight: 600 } : undefined,\n })),\n });\n return {\n ...base,\n ...(selected ? (horizontal ? { yAxis: selectedAxis() } : { xAxis: selectedAxis() }) : {}),\n series: model.series.flatMap((item, index): BarSeriesOption[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n return [\n {\n id: item.id,\n name: item.label,\n type: 'bar',\n stack: stacked ? 'total' : undefined,\n barMaxWidth: 48,\n itemStyle: {\n borderRadius: stacked ? 0 : 3,\n color: gradient\n ? {\n type: 'linear',\n x: 0,\n y: 0,\n x2: horizontal ? 1 : 0,\n y2: horizontal ? 0 : 1,\n colorStops: [\n { offset: 0, color },\n { offset: 0.2, color },\n { offset: 0.9, color: baseColor(color) },\n { offset: 1, color: baseColor(color) },\n ],\n }\n : color,\n },\n data: model.rows.map((row) => {\n const value = row.points[index]?.value ?? null;\n const outer =\n value !== null &&\n value !== 0 &&\n !model.series.some((later, laterIndex) => {\n const other = row.points[laterIndex]?.value ?? 0;\n return (\n laterIndex > index &&\n !hiddenIds.has(later.id) &&\n other !== 0 &&\n Math.sign(other) === Math.sign(value)\n );\n });\n const cap = horizontal\n ? value! < 0\n ? [3, 0, 0, 3]\n : [0, 3, 3, 0]\n : value! < 0\n ? [0, 0, 3, 3]\n : [3, 3, 0, 0];\n return {\n id: row.id,\n value: value ?? '-',\n ...(stacked || selected\n ? {\n itemStyle: {\n ...(stacked ? { borderRadius: outer ? cap : 0 } : {}),\n ...(selected ? { opacity: selectedRowIds.has(row.id) ? 1 : 0.35 } : {}),\n },\n }\n : {}),\n };\n }),\n },\n ];\n }),\n };\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵCartesianChart,\n type BarLayout,\n type PointPreview,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { BAR_RENDERER_LOADER } from './bar-browser';\nimport { buildBarOptions } from './bar-options';\nimport type { BarRenderOptions } from './bar-render-options';\nexport interface BarRangeSelection<T> {\n readonly fromRowId: string;\n readonly toRowId: string;\n readonly rowIds: readonly string[];\n readonly rows: readonly T[];\n readonly source: 'plot';\n}\n@Component({\n selector: 'nec-bar-chart',\n imports: [ChartFrame, ɵChartStage],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BarChart<T extends object> extends ɵCartesianChart<T, BarRenderOptions> {\n readonly rangeSelection = input(false);\n readonly previewEnabled = input(false);\n readonly pointPreview = output<PointPreview<T> | null>();\n readonly rangeSelect = output<BarRangeSelection<T>>();\n readonly layout = input<BarLayout>('vertical');\n readonly stacked = input(false);\n readonly gradient = input(false);\n readonly selectedRowId = input<string | null>(null);\n readonly selectedRowIds = input<readonly string[] | null>(null);\n private readonly selectedIds = computed<ReadonlySet<string>>(() => {\n const model = this.model();\n const available = new Set(model.kind === 'error' ? [] : model.rows.map((row) => row.id));\n const multiple = this.selectedRowIds();\n const requested =\n multiple === null ? [this.selectedRowId()] : Array.isArray(multiple) ? multiple : [];\n return new Set(\n requested.filter((id): id is string => typeof id === 'string' && available.has(id)),\n );\n });\n private readonly loader = inject(BAR_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override canPreview(): boolean {\n return this.previewEnabled() && !this.rangeSelection();\n }\n protected override observePreviews(): boolean {\n // Range mode suppresses events without replaying focused values on Escape.\n return this.previewEnabled();\n }\n protected override emitPreview(point: PointPreview<T> | null): void {\n this.pointPreview.emit(point);\n }\n protected override familyConfiguration() {\n return {\n rangeSelection: this.rangeSelection(),\n layout: this.layout(),\n stacked: this.stacked(),\n gradient: this.gradient(),\n selectedRowId: this.selectedRowId(),\n selectedRowIds: this.selectedRowIds(),\n };\n }\n protected override rowSelectionId(): string | null {\n const ids = this.selectedIds();\n return ids.size === 1 ? (ids.values().next().value ?? null) : null;\n }\n protected override rowIsSelected(id: string): boolean {\n return this.selectedIds().has(id);\n }\n protected override familyError() {\n if (typeof this.previewEnabled() !== 'boolean') return 'Preview enabled must be a boolean.';\n if (typeof this.rangeSelection() !== 'boolean') return 'Range selection must be a boolean.';\n if (!['vertical', 'horizontal'].includes(this.layout())) return 'Chart layout is invalid.';\n if (this.selectedRowId() !== null && typeof this.selectedRowId() !== 'string')\n return 'Selected row ID must be a string or null.';\n const ids = this.selectedRowIds();\n return ids === null || (Array.isArray(ids) && ids.every((id) => typeof id === 'string'))\n ? null\n : 'Selected row IDs must be an array of strings or null.';\n }\n protected override selectRange(ids: readonly string[], snapshot: unknown): void {\n const model = this.model();\n if (\n snapshot !== model ||\n !this.rangeSelection() ||\n this.state().kind !== 'ready' ||\n model.kind === 'error' ||\n !ids.length\n )\n return;\n const first = model.rows.findIndex((row) => row.id === ids[0]);\n const last = model.rows.findIndex((row) => row.id === ids.at(-1));\n if (first < 0 || last < first) return;\n const rows = model.rows.slice(first, last + 1);\n if (rows.length !== ids.length || rows.some((row, index) => row.id !== ids[index])) return;\n this.resetPointPreview();\n this.rangeSelect.emit({\n fromRowId: rows[0]!.id,\n toRowId: rows.at(-1)!.id,\n rowIds: rows.map((row) => row.id),\n rows: this.data().slice(first, last + 1),\n source: 'plot',\n });\n }\n protected override buildOptions(context: ɵCartesianContext<T>): BarRenderOptions {\n return {\n chart: buildBarOptions(\n context.model,\n context.hiddenIds,\n context.tokens,\n this.layout(),\n this.stacked(),\n this.gradient(),\n context.animation,\n context.format,\n context.categoryTicks,\n this.selectedIds(),\n ),\n range: this.rangeSelection()\n ? {\n snapshot: context.model,\n ids: context.model.rows.map((row) => row.id),\n horizontal: this.layout() === 'horizontal',\n color: context.tokens.muted,\n fill: context.tokens.border,\n }\n : null,\n };\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n"],"mappings":";;;AAMA,MAAa,sBAAsB,IAAI,eACrC,uBACA;CACE,YAAY;CACZ,qBAAqB,OAAO,uDAAiB,CAAC,MAAM,WAAW,OAAO,iBAAiB;AACxF,CAAA;ACQH,SAAS,UAAU,OAAa;CAC9B,IAAI,iBAAiB,KAAK,KAAK,GAC7B,OAAO,QAAQ;EAAC;EAAG;EAAG;CAAC,CAAC,CAAC,KAAK,WAAW,OAAO,SAAS,MAAM,MAAM,QAAQ,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,EAAC;CAE1G,MAAM,OAAO,MAAM,MAAM,uEAAuE;CAChG,OAAO,OAAO,QAAQ,KAAK,GAAE,GAAI,KAAK,GAAE,GAAI,KAAK,GAAE,GAAI,OAAO,KAAK,MAAM,CAAC,IAAI,GAAG,KAAM;AACzF;AAEA,SAAgB,gBACd,OACA,WACA,QACA,QACA,SACA,UACA,WACA,QACA,gBAAmC,MAAM,KAAK,KAAK,QAAQ,IAAI,QAAQ,GACvE,iCAAsC,IAAI,IAAG,GAAE;C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A,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,cAAA;GAAA,aAAA;EAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UC7BrB;EAyHA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA,CAAA;GAAA,MAAA;GAAA,MDpGY;GAAU,UAAA;GAAA,QAAA,CAAA,SAAA,aAAA;EAAA,GAAA;GAAA,MAAA;GAAA,MAAE;GAAW,UAAA;GAAA,QAAA;IAAA;IAAA;IAAA;IAAA;GAAA;GAAA,SAAA,CAAA,OAAA;EAAA,CAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQtB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAVpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,SAChB,CAAC,YAAY,WAAW;GAAC,iBAMjB,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"mantha911-ng-echarts-bar.mjs","names":[],"sources":["../../../projects/chart-library/bar/src/lib/bar-browser.ts","../../../projects/chart-library/bar/src/lib/bar-options.ts","../../../projects/chart-library/bar/src/lib/bar-chart.ts","../../../projects/chart-library/core/src/lib/cartesian-chart.html"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport type { BarRendererFactory } from './plot-controller';\nexport {\n ɵbrowserPlotEnvironment as browserPlotEnvironment,\n ɵreadCartesianTheme as readBarTheme,\n} from '@mantha911/ng-echarts/core';\nexport const BAR_RENDERER_LOADER = new InjectionToken<() => Promise<BarRendererFactory>>(\n 'Bar renderer loader',\n {\n providedIn: 'root',\n factory: () => () => import('./bar-renderer').then((module) => module.createBarRenderer),\n },\n);\n","// The first two default palette colors are adapted from EvilCharts (2026 Gurbinder, MIT).\n// See docs/UPSTREAM_PROVENANCE.md and third-party/evilcharts-LICENSE.txt in the package.\nimport type { BarSeriesOption } from 'echarts/charts';\nimport type { GridComponentOption, TooltipComponentOption } from 'echarts/components';\nimport type { ComposeOption } from 'echarts/core';\nimport type { BarModel } from './bar-model';\nimport type { BarLayout } from '@mantha911/ng-echarts/core';\n\nexport type BarOption = ComposeOption<\n BarSeriesOption | GridComponentOption | TooltipComponentOption\n>;\n\nexport {\n ɵdefaultCartesianTheme as defaultBarTheme,\n ɵescapeTooltipText as escapeTooltipText,\n} from '@mantha911/ng-echarts/core';\nexport type { ɵCartesianThemeTokens as BarThemeTokens } from '@mantha911/ng-echarts/core';\nimport { ɵbuildCartesianOptions } from '@mantha911/ng-echarts/core';\nimport type { ɵCartesianThemeTokens as BarThemeTokens } from '@mantha911/ng-echarts/core';\nfunction baseColor(color: string): string {\n if (/^#[\\da-f]{6}$/i.test(color)) {\n return `rgba(${[1, 3, 5].map((offset) => Number.parseInt(color.slice(offset, offset + 2), 16)).join(',')},0.3)`;\n }\n const rgba = color.match(/^rgba?\\(\\s*([\\d.]+)\\s*,\\s*([\\d.]+)\\s*,\\s*([\\d.]+)(?:\\s*,\\s*([\\d.]+))?/);\n return rgba ? `rgba(${rgba[1]},${rgba[2]},${rgba[3]},${Number(rgba[4] ?? 1) * 0.3})` : color;\n}\n\nexport function buildBarOptions<T>(\n model: Exclude<BarModel<T>, { kind: 'error' }>,\n hiddenIds: ReadonlySet<string>,\n tokens: BarThemeTokens,\n layout: BarLayout,\n stacked: boolean,\n gradient: boolean,\n animation: boolean,\n format: (value: number) => string,\n categoryTicks: readonly string[] = model.rows.map((row) => row.category),\n selectedRowIds: ReadonlySet<string> = new Set(),\n): BarOption {\n const horizontal = layout === 'horizontal';\n const selected = selectedRowIds.size > 0 && model.rows.some((row) => selectedRowIds.has(row.id));\n const base = ɵbuildCartesianOptions(\n model,\n hiddenIds,\n tokens,\n horizontal,\n animation,\n format,\n categoryTicks,\n );\n const categoryAxis = horizontal ? base.yAxis : base.xAxis;\n const selectedAxis = () => ({\n ...categoryAxis,\n // A category band remains visible for zero/missing values or hidden series.\n splitArea: {\n show: true,\n interval: 0,\n areaStyle: {\n color: model.rows.map((row) =>\n selectedRowIds.has(row.id) ? tokens.border : 'transparent',\n ),\n opacity: 0.3,\n },\n },\n data: model.rows.map((row) => ({\n value: row.id,\n textStyle: selectedRowIds.has(row.id) ? { color: tokens.text, fontWeight: 600 } : undefined,\n })),\n });\n return {\n ...base,\n ...(selected ? (horizontal ? { yAxis: selectedAxis() } : { xAxis: selectedAxis() }) : {}),\n series: model.series.flatMap((item, index): BarSeriesOption[] => {\n if (hiddenIds.has(item.id)) return [];\n const color = tokens.series[index % tokens.series.length] ?? '#047857';\n return [\n {\n id: item.id,\n name: item.label,\n type: 'bar',\n stack: stacked ? 'total' : undefined,\n barMaxWidth: 48,\n itemStyle: {\n borderRadius: stacked ? 0 : 3,\n color: gradient\n ? {\n type: 'linear',\n x: 0,\n y: 0,\n x2: horizontal ? 1 : 0,\n y2: horizontal ? 0 : 1,\n colorStops: [\n { offset: 0, color },\n { offset: 0.2, color },\n { offset: 0.9, color: baseColor(color) },\n { offset: 1, color: baseColor(color) },\n ],\n }\n : color,\n },\n data: model.rows.map((row) => {\n const value = row.points[index]?.value ?? null;\n const outer =\n stacked &&\n value !== null &&\n value !== 0 &&\n !model.series.some((later, laterIndex) => {\n const other = row.points[laterIndex]?.value ?? 0;\n return (\n laterIndex > index &&\n !hiddenIds.has(later.id) &&\n other !== 0 &&\n Math.sign(other) === Math.sign(value)\n );\n });\n const cap = horizontal\n ? value! < 0\n ? [3, 0, 0, 3]\n : [0, 3, 3, 0]\n : value! < 0\n ? [0, 0, 3, 3]\n : [3, 3, 0, 0];\n return {\n id: row.id,\n value: value ?? '-',\n ...(stacked || selected\n ? {\n itemStyle: {\n ...(stacked ? { borderRadius: outer ? cap : 0 } : {}),\n ...(selected ? { opacity: selectedRowIds.has(row.id) ? 1 : 0.35 } : {}),\n },\n }\n : {}),\n };\n }),\n },\n ];\n }),\n };\n}\n","import { ChangeDetectionStrategy, Component, computed, inject, input, output } from '@angular/core';\nimport {\n ChartFrame,\n ɵChartStage,\n ɵTablePager,\n ɵCartesianChart,\n type BarLayout,\n type PointPreview,\n type ɵCartesianContext,\n} from '@mantha911/ng-echarts/core';\nimport { BAR_RENDERER_LOADER } from './bar-browser';\nimport { buildBarOptions } from './bar-options';\nimport type { BarRenderOptions } from './bar-render-options';\nexport interface BarRangeSelection<T> {\n readonly fromRowId: string;\n readonly toRowId: string;\n readonly rowIds: readonly string[];\n readonly rows: readonly T[];\n readonly source: 'plot';\n}\n@Component({\n selector: 'nec-bar-chart',\n imports: [ChartFrame, ɵChartStage, ɵTablePager],\n templateUrl: '../../../core/src/lib/cartesian-chart.html',\n styleUrls: [\n '../../../core/src/lib/cartesian-chart.css',\n '../../../core/src/lib/chart-controls.css',\n ],\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class BarChart<T extends object> extends ɵCartesianChart<T, BarRenderOptions> {\n readonly rangeSelection = input(false);\n readonly previewEnabled = input(false);\n readonly pointPreview = output<PointPreview<T> | null>();\n readonly rangeSelect = output<BarRangeSelection<T>>();\n readonly layout = input<BarLayout>('vertical');\n readonly stacked = input(false);\n readonly gradient = input(false);\n readonly selectedRowId = input<string | null>(null);\n readonly selectedRowIds = input<readonly string[] | null>(null);\n private readonly selectedIds = computed<ReadonlySet<string>>(() => {\n const model = this.model();\n const available = new Set(model.kind === 'error' ? [] : model.rows.map((row) => row.id));\n const multiple = this.selectedRowIds();\n const requested =\n multiple === null ? [this.selectedRowId()] : Array.isArray(multiple) ? multiple : [];\n return new Set(\n requested.filter((id): id is string => typeof id === 'string' && available.has(id)),\n );\n });\n private readonly loader = inject(BAR_RENDERER_LOADER);\n protected override renderer() {\n return this.loader();\n }\n protected override canPreview(): boolean {\n return this.previewEnabled() && !this.rangeSelection();\n }\n protected override observePreviews(): boolean {\n // Range mode suppresses events without replaying focused values on Escape.\n return this.previewEnabled();\n }\n protected override emitPreview(point: PointPreview<T> | null): void {\n this.pointPreview.emit(point);\n }\n protected override familyConfiguration() {\n return {\n rangeSelection: this.rangeSelection(),\n layout: this.layout(),\n stacked: this.stacked(),\n gradient: this.gradient(),\n selectedRowId: this.selectedRowId(),\n selectedRowIds: this.selectedRowIds(),\n };\n }\n protected override rowSelectionId(): string | null {\n const ids = this.selectedIds();\n return ids.size === 1 ? (ids.values().next().value ?? null) : null;\n }\n protected override rowIsSelected(id: string): boolean {\n return this.selectedIds().has(id);\n }\n protected override familyError() {\n if (typeof this.previewEnabled() !== 'boolean') return 'Preview enabled must be a boolean.';\n if (typeof this.rangeSelection() !== 'boolean') return 'Range selection must be a boolean.';\n if (!['vertical', 'horizontal'].includes(this.layout())) return 'Chart layout is invalid.';\n if (this.selectedRowId() !== null && typeof this.selectedRowId() !== 'string')\n return 'Selected row ID must be a string or null.';\n const ids = this.selectedRowIds();\n return ids === null || (Array.isArray(ids) && ids.every((id) => typeof id === 'string'))\n ? null\n : 'Selected row IDs must be an array of strings or null.';\n }\n protected override selectRange(ids: readonly string[], snapshot: unknown): void {\n const model = this.model();\n if (\n snapshot !== model ||\n !this.rangeSelection() ||\n this.state().kind !== 'ready' ||\n model.kind === 'error' ||\n !ids.length\n )\n return;\n const first = model.rows.findIndex((row) => row.id === ids[0]);\n const last = model.rows.findIndex((row) => row.id === ids.at(-1));\n if (first < 0 || last < first) return;\n const rows = model.rows.slice(first, last + 1);\n if (rows.length !== ids.length || rows.some((row, index) => row.id !== ids[index])) return;\n this.resetPointPreview();\n this.rangeSelect.emit({\n fromRowId: rows[0]!.id,\n toRowId: rows.at(-1)!.id,\n rowIds: rows.map((row) => row.id),\n rows: this.data().slice(first, last + 1),\n source: 'plot',\n });\n }\n protected override buildOptions(context: ɵCartesianContext<T>): BarRenderOptions {\n return {\n chart: buildBarOptions(\n context.model,\n context.hiddenIds,\n context.tokens,\n this.layout(),\n this.stacked(),\n this.gradient(),\n context.animation,\n context.format,\n context.categoryTicks,\n this.selectedIds(),\n ),\n range: this.rangeSelection()\n ? {\n snapshot: context.model,\n ids: context.model.rows.map((row) => row.id),\n horizontal: this.layout() === 'horizontal',\n color: context.tokens.muted,\n fill: context.tokens.border,\n }\n : null,\n };\n }\n}\n","<nec-chart-frame\n [title]=\"title()\"\n [description]=\"description()\"\n [style.--_nec-default-background]=\"tokens().background\"\n [style.--_nec-default-text]=\"tokens().text\"\n [style.--_nec-default-muted]=\"tokens().muted\"\n [style.--_nec-default-border]=\"tokens().border\"\n>\n @let currentState = state();\n\n <nec-chart-stage\n [state]=\"currentState\"\n [height]=\"plotHeight()\"\n [retryable]=\"rendererError()\"\n (retry)=\"retryRenderer()\"\n >\n <div\n #plot\n class=\"plot\"\n [hidden]=\"currentState.kind !== 'ready'\"\n [style.height.px]=\"plotHeight()\"\n aria-hidden=\"true\"\n ></div>\n\n @if (currentState.kind === 'ready' && allSeriesHidden()) {\n <div class=\"plot-message\" role=\"status\">\n <span>All series are hidden. Choose a series below.</span>\n </div>\n }\n </nec-chart-stage>\n <div\n class=\"chart-controls\"\n [attr.inert]=\"currentState.kind !== 'ready' ? '' : null\"\n [attr.aria-hidden]=\"currentState.kind !== 'ready' ? 'true' : null\"\n >\n <div class=\"legend\" aria-label=\"Chart series\">\n @for (item of legendItems(); track item.id) {\n <button\n type=\"button\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-pressed]=\"item.visible\"\n (click)=\"toggleSeries(item.id)\"\n >\n <span class=\"swatch\" [style.background]=\"item.color\" aria-hidden=\"true\"></span>\n {{ item.label }}\n <span class=\"visibility\" [class.legend-note]=\"false\">{{\n item.visible ? 'Visible' : 'Hidden'\n }}</span>\n </button>\n }\n </div>\n @if (showDataTable()) {\n <button\n type=\"button\"\n class=\"table-toggle\"\n [disabled]=\"currentState.kind !== 'ready'\"\n [attr.aria-expanded]=\"tableExpanded()\"\n (click)=\"toggleTable()\"\n >\n {{ tableExpanded() ? 'Hide data table' : 'Show data table' }}\n </button>\n @if (tableExpanded() && currentState.kind === 'ready') {\n <nec-table-pager [pagination]=\"tablePagination\" [label]=\"title()\" />\n <div\n class=\"table-scroll\"\n tabindex=\"0\"\n role=\"region\"\n [attr.aria-label]=\"title() + ' data table'\"\n >\n <table>\n <caption>\n {{\n title()\n }}\n values\n </caption>\n <thead>\n <tr>\n <th scope=\"col\">Category</th>\n @for (item of legendItems(); track item.id) {\n <th scope=\"col\">{{ item.label }}</th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of tableRows(); track row.id) {\n <tr\n [class.selected-row]=\"row.selected\"\n [attr.aria-current]=\"row.current ? 'true' : null\"\n >\n <th scope=\"row\">\n {{ row.category }}\n @if (row.selected) {\n <span class=\"selection-label\">Selected</span>\n }\n </th>\n @for (cell of row.cells; track cell.seriesId) {\n <td>\n @if (cell.value !== null) {\n <button\n type=\"button\"\n [attr.aria-label]=\"cell.actionLabel\"\n [attr.data-preview-row]=\"row.id\"\n [attr.data-preview-series]=\"cell.seriesId\"\n (click)=\"selectPoint(cell, 'table')\"\n >\n {{ cell.text }}\n </button>\n } @else {\n <span>{{ cell.text }}</span>\n }\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n </div>\n }\n }\n </div>\n</nec-chart-frame>\n"],"mappings":";;;AAMA,MAAa,sBAAsB,IAAI,eACrC,uBACA;CACE,YAAY;CACZ,qBAAqB,OAAO,uDAAiB,CAAC,MAAM,WAAW,OAAO,iBAAiB;AACxF,CAAA;ACQH,SAAS,UAAU,OAAa;CAC9B,IAAI,iBAAiB,KAAK,KAAK,GAC7B,OAAO,QAAQ;EAAC;EAAG;EAAG;CAAC,CAAC,CAAC,KAAK,WAAW,OAAO,SAAS,MAAM,MAAM,QAAQ,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,EAAC;CAE1G,MAAM,OAAO,MAAM,MAAM,uEAAuE;CAChG,OAAO,OAAO,QAAQ,KAAK,GAAE,GAAI,KAAK,GAAE,GAAI,KAAK,GAAE,GAAI,OAAO,KAAK,MAAM,CAAC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A;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,eAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,gBAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,cAAA;GAAA,aAAA;EAAA;EAAA,iBAAA;EAAA,UAAA;EAAA,UC9BrB;EA0HA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,cAAA;GAAA;IAAA,MAAA;IAAA,MDpGY;IAAU,UAAA;IAAA,QAAA,CAAA,SAAA,aAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA;KAAA;KAAA;KAAA;KAAA;IAAA;IAAA,SAAA,CAAA,OAAA;GAAA;GAAA;IAAA,MAAA;IAAA,MAAE;IAAW,UAAA;IAAA,QAAA,CAAA,cAAA,OAAA;GAAA;EAAA;EAAA,iBAAA,GAAA,wBAAA;CAAA,CAAA;;AAQnC,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAQ,YAAA,CAAA;EAVpB,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAe,SAChB;IAAC;IAAY;IAAa;GAAW;GAAC,iBAM9B,wBAAwB;GAAM,UAAA;GAAA,QAAA,CAAA,wjFAAA,wrBAAA;EAAA,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { i as normalizeCalendarData, n as calendarColors, r as calendarMonths } from "./mantha911-ng-echarts-calendar-calendar-options-HP6gA6Ig.mjs";
|
|
2
2
|
import { isPlatformBrowser } from "@angular/common";
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
|
-
import { ApplicationRef, ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, PLATFORM_ID, afterNextRender, afterRenderEffect, computed,
|
|
4
|
+
import { ApplicationRef, ChangeDetectionStrategy, Component, DestroyRef, ElementRef, InjectionToken, PLATFORM_ID, afterNextRender, afterRenderEffect, computed, inject, input, linkedSignal, output, signal, viewChild } from "@angular/core";
|
|
5
5
|
import { ChartFrame, ɵChartFocusKeeper, ɵChartStage, ɵPlotController, ɵbrowserPlotEnvironment, ɵcreateValueFormatting, ɵdefaultCartesianTheme, ɵreadCartesianTheme, ɵresolveCartesianState } from "@mantha911/ng-echarts/core";
|
|
6
6
|
const CALENDAR_RENDERER_LOADER = new InjectionToken("Calendar renderer loader", {
|
|
7
7
|
providedIn: "root",
|
|
@@ -44,7 +44,12 @@ var CalendarHeatmap = class CalendarHeatmap {
|
|
|
44
44
|
controller = null;
|
|
45
45
|
focusKeeper = null;
|
|
46
46
|
removeMotionListener = null;
|
|
47
|
-
rendererError =
|
|
47
|
+
rendererError = linkedSignal(() => {
|
|
48
|
+
this.model();
|
|
49
|
+
this.settings();
|
|
50
|
+
this.formatting();
|
|
51
|
+
return false;
|
|
52
|
+
}, ...ngDevMode ? [{ debugName: "rendererError" }] : /* istanbul ignore next */ []);
|
|
48
53
|
model = computed(() => normalizeCalendarData(this.data(), this.dateKey(), this.valueKey(), this.year(), this.max()), ...ngDevMode ? [{ debugName: "model" }] : /* istanbul ignore next */ []);
|
|
49
54
|
formatting = computed(() => {
|
|
50
55
|
const model = this.model();
|
|
@@ -133,12 +138,6 @@ var CalendarHeatmap = class CalendarHeatmap {
|
|
|
133
138
|
});
|
|
134
139
|
}
|
|
135
140
|
constructor() {
|
|
136
|
-
effect(() => {
|
|
137
|
-
this.model();
|
|
138
|
-
this.settings();
|
|
139
|
-
this.formatting();
|
|
140
|
-
this.rendererError.set(false);
|
|
141
|
-
});
|
|
142
141
|
afterNextRender(() => {
|
|
143
142
|
if (!isPlatformBrowser(this.platform)) return;
|
|
144
143
|
this.application.whenStable().then(() => {
|
|
@@ -157,7 +156,7 @@ var CalendarHeatmap = class CalendarHeatmap {
|
|
|
157
156
|
}
|
|
158
157
|
});
|
|
159
158
|
});
|
|
160
|
-
afterRenderEffect(() => {
|
|
159
|
+
afterRenderEffect({ mixedReadWrite: () => {
|
|
161
160
|
if (!this.browserReady()) return;
|
|
162
161
|
const theme = this.theme();
|
|
163
162
|
this.themeRevision();
|
|
@@ -170,16 +169,16 @@ var CalendarHeatmap = class CalendarHeatmap {
|
|
|
170
169
|
} catch {
|
|
171
170
|
this.rendererError.set(true);
|
|
172
171
|
}
|
|
173
|
-
});
|
|
174
|
-
afterRenderEffect(() => {
|
|
172
|
+
} });
|
|
173
|
+
afterRenderEffect({ write: () => {
|
|
175
174
|
this.browserReady();
|
|
176
175
|
this.controller?.update(this.options());
|
|
177
|
-
});
|
|
178
|
-
afterRenderEffect(() => {
|
|
176
|
+
} });
|
|
177
|
+
afterRenderEffect({ mixedReadWrite: () => {
|
|
179
178
|
this.state();
|
|
180
179
|
this.months();
|
|
181
180
|
this.focusKeeper?.restore();
|
|
182
|
-
});
|
|
181
|
+
} });
|
|
183
182
|
this.destroyRef.onDestroy(() => {
|
|
184
183
|
this.removeMotionListener?.();
|
|
185
184
|
this.controller?.destroy();
|