@agridea/suibi-module 0.1.0-preview.8c4fa92 → 0.1.0-preview.cf0616d
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/dist/elements/browser/main.js +67 -68
- package/dist/elements/browser/suibi-module-latest.js +67 -68
- package/dist/elements/browser/{suibi-module.v0.1.0-preview.8c4fa92.js → suibi-module.v0.1.0-preview.cf0616d.js} +67 -68
- package/dist/elements/browser/version.txt +1 -1
- package/dist/types/app/components/data-preview/data-preview.component.d.ts +1 -0
- package/dist/types/app/components/empty-state/empty-state.component.d.ts +2 -0
- package/dist/types/app/components/module-placeholder-page/module-placeholder-page.component.d.ts +6 -0
- package/dist/types/app/components/planning-result/planning-result.component.d.ts +3 -26
- package/dist/types/app/components/planning-result/planning-trigger.component.d.ts +13 -0
- package/dist/types/app/components/results-page/results-page.component.d.ts +4 -0
- package/dist/types/app/components/suissebilanz-dashboard/gauge-arc.component.d.ts +47 -0
- package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-dashboard.component.d.ts +24 -0
- package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-metrics.service.d.ts +21 -0
- package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-minibar.component.d.ts +19 -0
- package/dist/types/app/components/validation-page/validation-page.component.d.ts +17 -0
- package/dist/types/app/components/workflow-stepper/workflow-stepper.component.d.ts +4 -0
- package/dist/types/app/core/navigation/navigation.service.d.ts +1 -1
- package/dist/types/app/core/planning/planning-balance.service.d.ts +22 -3
- package/dist/types/app/core/planning/planning-balance.utils.d.ts +10 -0
- package/dist/types/app/header-bar.d.ts +1 -2
- package/dist/types/shared/material-icons.d.ts +3 -3
- package/package.json +1 -1
- /package/dist/elements/browser/{suibi-module.v0.1.0-preview.8c4fa92.css → suibi-module.v0.1.0-preview.cf0616d.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.0-preview.
|
|
1
|
+
0.1.0-preview.cf0616d cf0616d
|
|
@@ -7,5 +7,6 @@ export declare class DataPreviewComponent {
|
|
|
7
7
|
readonly planning: PlanningBalanceService;
|
|
8
8
|
readonly metadataPreview: import("@angular/core").Signal<import("../../../public-api").SuibiDataEventMetadata>;
|
|
9
9
|
constructor(naebi: NaebiDataService);
|
|
10
|
+
setPlanningEndpoint(value: string | null): void;
|
|
10
11
|
emitData(): void;
|
|
11
12
|
}
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Displays a faded icon, a primary message, and an optional hint line.
|
|
5
5
|
*/
|
|
6
6
|
export declare class EmptyStateComponent {
|
|
7
|
+
fontSet: import("@angular/core").InputSignal<string>;
|
|
8
|
+
icon: import("@angular/core").InputSignal<string>;
|
|
7
9
|
primaryText: import("@angular/core").InputSignal<string>;
|
|
8
10
|
/** Optional hint displayed below the primary message. */
|
|
9
11
|
secondaryText: import("@angular/core").InputSignal<string>;
|
|
@@ -1,28 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PlanningBalanceService, PlanningEndpoint } from '../../core/planning/planning-balance.service';
|
|
1
|
+
import { PlanningBalanceService } from '../../core/planning/planning-balance.service';
|
|
3
2
|
import { MasterDataService } from '../../core/master-data/master-data.service';
|
|
4
|
-
import type {
|
|
3
|
+
import type { CropRequirementRow, NutrientEntry, ValidationMessage } from '../../core/planning/planning-balance.types';
|
|
5
4
|
export declare class PlanningResultComponent {
|
|
5
|
+
readonly embedded: import("@angular/core").InputSignal<boolean>;
|
|
6
6
|
readonly planning: PlanningBalanceService;
|
|
7
|
-
private readonly naebi;
|
|
8
|
-
private readonly sanitizer;
|
|
9
7
|
readonly masterData: MasterDataService;
|
|
10
|
-
readonly selectedEndpoint: import("@angular/core").WritableSignal<PlanningEndpoint>;
|
|
11
8
|
private readonly result;
|
|
12
|
-
/**
|
|
13
|
-
* Merges interleaved kg/% rows from totalBalance into one row per nutrient
|
|
14
|
-
* for use in the Section-D summary table.
|
|
15
|
-
*/
|
|
16
|
-
readonly balanceRows: import("@angular/core").Signal<BalanceRow[]>;
|
|
17
|
-
/** Farm-wide gas emissions (NH₃, NO, N₂O, N₂). */
|
|
18
|
-
readonly farmEmissions: import("@angular/core").Signal<NutrientEntry[]>;
|
|
19
9
|
readonly validationMessages: import("@angular/core").Signal<ValidationMessage[]>;
|
|
20
|
-
/** Land area stats converted from m² → ha (÷ 10 000). */
|
|
21
|
-
readonly landStats: import("@angular/core").Signal<{
|
|
22
|
-
total: number;
|
|
23
|
-
fertilizable: number;
|
|
24
|
-
slurry: number;
|
|
25
|
-
} | null>;
|
|
26
10
|
/** Fodder net balance (positive = surplus, negative = deficit). */
|
|
27
11
|
readonly fodderTotal: import("@angular/core").Signal<import("../../core/planning/planning-balance.types").FodderQuantity | null>;
|
|
28
12
|
readonly animalStockTotals: import("@angular/core").Signal<import("../../core/planning/planning-balance.types").AnimalStock | null>;
|
|
@@ -46,14 +30,8 @@ export declare class PlanningResultComponent {
|
|
|
46
30
|
readonly cropRequirementRows: import("@angular/core").Signal<CropRequirementRow[]>;
|
|
47
31
|
readonly fodderDetail: import("@angular/core").Signal<import("../../core/planning/planning-balance.types").RequiredEffectiveYieldFromFodderCropland | null>;
|
|
48
32
|
readonly fodderEffectiveYield: import("@angular/core").Signal<import("../../core/planning/planning-balance.types").FodderQuantity | null>;
|
|
49
|
-
/** SafeResourceUrl for the PDF iframe, or null if no report is present. */
|
|
50
|
-
readonly pdfUrl: import("@angular/core").Signal<SafeResourceUrl | null>;
|
|
51
|
-
private _prevBlobUrl;
|
|
52
|
-
private readonly _blobCleanup;
|
|
53
33
|
/** Human-readable label for a molecular formula symbol. */
|
|
54
34
|
formulaLabel(f: string): string;
|
|
55
|
-
/** Returns CSS modifier class based on the balance percentage value. */
|
|
56
|
-
balancePctClass(pct: number | null): string;
|
|
57
35
|
/** Returns the quantity for a given formula from a nutrient entry list, or 0 if absent. */
|
|
58
36
|
reqValue(requirement: NutrientEntry[], formula: string): number;
|
|
59
37
|
/**
|
|
@@ -65,5 +43,4 @@ export declare class PlanningResultComponent {
|
|
|
65
43
|
sumStockNutrients(entries: NutrientEntry[]): NutrientEntry[];
|
|
66
44
|
/** Summary chips for Sections C & D (N avail. / P₂O₅ / K₂O / Mg). */
|
|
67
45
|
sumKeyNutrients(entries: NutrientEntry[]): NutrientEntry[];
|
|
68
|
-
runPlanning(): void;
|
|
69
46
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PlanningBalanceService } from '../../core/planning/planning-balance.service';
|
|
2
|
+
/**
|
|
3
|
+
* Extracted trigger UI for running the planning balance calculation.
|
|
4
|
+
* Contains: submit button and progress bar.
|
|
5
|
+
* Delegates actual HTTP call to `PlanningBalanceService`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class PlanningTriggerComponent {
|
|
8
|
+
readonly planning: PlanningBalanceService;
|
|
9
|
+
private readonly naebi;
|
|
10
|
+
/** When true, the submit button is disabled regardless of loading state. */
|
|
11
|
+
readonly hasErrors: import("@angular/core").InputSignal<boolean>;
|
|
12
|
+
runPlanning(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** Visual status driving arc colour and icon in the gauge. */
|
|
2
|
+
export type GaugeStatus = 'ok' | 'tolerated' | 'over' | 'under' | 'empty';
|
|
3
|
+
/** View-model for a single metric card in the SuisseBilanz dashboard. */
|
|
4
|
+
export interface GaugeMetric {
|
|
5
|
+
/** Stable key used for `@for` tracking (nutrient formula or 'rendement'). */
|
|
6
|
+
key: string;
|
|
7
|
+
/** Short display label — chemical formula or translated metric name. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Human-readable sub-label (nutrient description). */
|
|
10
|
+
sublabel: string;
|
|
11
|
+
/** Numeric value to display; `null` indicates no result yet. */
|
|
12
|
+
value: number | null;
|
|
13
|
+
/** Unit appended to the value inside the arc (e.g. '%' or ''). */
|
|
14
|
+
unit: string;
|
|
15
|
+
/** Derived status controlling arc colour and badge. */
|
|
16
|
+
status: GaugeStatus;
|
|
17
|
+
/** Upper bound of the gauge arc scale. */
|
|
18
|
+
maxGauge: number;
|
|
19
|
+
/** Short range description shown below the arc (e.g. '< 100 %'). */
|
|
20
|
+
rangeLabel: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Reusable semicircular SVG arc gauge.
|
|
24
|
+
*
|
|
25
|
+
* Renders a 180° arc gauge using pure inline SVG — no third-party library.
|
|
26
|
+
* All geometry is derived via `computed()` signals so the component is
|
|
27
|
+
* fully zoneless-safe and works without Zone.js triggers.
|
|
28
|
+
*
|
|
29
|
+
* The arc uses `pathLength="1"` so `stroke-dasharray` fractions map
|
|
30
|
+
* directly to 0–1 without floating-point arc-length estimation.
|
|
31
|
+
*/
|
|
32
|
+
export declare class GaugeArcComponent {
|
|
33
|
+
readonly value: import("@angular/core").InputSignal<number>;
|
|
34
|
+
readonly max: import("@angular/core").InputSignal<number>;
|
|
35
|
+
readonly status: import("@angular/core").InputSignal<GaugeStatus>;
|
|
36
|
+
protected readonly pct: import("@angular/core").Signal<number>;
|
|
37
|
+
protected readonly dashArray: import("@angular/core").Signal<string>;
|
|
38
|
+
protected readonly tickCoords: import("@angular/core").Signal<{
|
|
39
|
+
x1: number;
|
|
40
|
+
y1: number;
|
|
41
|
+
x2: number;
|
|
42
|
+
y2: number;
|
|
43
|
+
}>;
|
|
44
|
+
protected readonly fillColor: import("@angular/core").Signal<string>;
|
|
45
|
+
protected readonly displayValue: import("@angular/core").Signal<string>;
|
|
46
|
+
protected readonly ariaLabel: import("@angular/core").Signal<string>;
|
|
47
|
+
}
|
package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-dashboard.component.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SafeUrl } from '@angular/platform-browser';
|
|
2
|
+
import { PlanningBalanceService } from '../../core/planning/planning-balance.service';
|
|
3
|
+
import { GaugeStatus } from './gauge-arc.component';
|
|
4
|
+
import { SuisseBilanzMetricsService } from './suissebilanz-metrics.service';
|
|
5
|
+
/**
|
|
6
|
+
* Dashboard card displaying the 5 main SuisseBilanz metrics as semicircular
|
|
7
|
+
* SVG gauges. Derives all display data from `PlanningBalanceService` via
|
|
8
|
+
* computed signals — fully zoneless-safe, `OnPush`.
|
|
9
|
+
*
|
|
10
|
+
* Shows an empty-state panel when no planning result is available yet.
|
|
11
|
+
*/
|
|
12
|
+
export declare class SuisseBilanzDashboardComponent {
|
|
13
|
+
readonly embedded: import("@angular/core").InputSignal<boolean>;
|
|
14
|
+
protected readonly planning: PlanningBalanceService;
|
|
15
|
+
private readonly sanitizer;
|
|
16
|
+
protected readonly metricsService: SuisseBilanzMetricsService;
|
|
17
|
+
private readonly result;
|
|
18
|
+
protected readonly metrics: import("@angular/core").Signal<import("./gauge-arc.component").GaugeMetric[]>;
|
|
19
|
+
protected readonly officialPdfUrl: import("@angular/core").Signal<SafeUrl | null>;
|
|
20
|
+
private prevBlobUrl;
|
|
21
|
+
private readonly blobCleanup;
|
|
22
|
+
/** Maps a `GaugeStatus` to its Material icon name for the status badge. */
|
|
23
|
+
protected statusIcon(status: GaugeStatus): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { GaugeMetric } from './gauge-arc.component';
|
|
2
|
+
/**
|
|
3
|
+
* Shared source of truth for all SuisseBilanz metric view-models.
|
|
4
|
+
*
|
|
5
|
+
* Both the full dashboard card and the slim minibar consume this service so
|
|
6
|
+
* the derivation logic lives in exactly one place. Metrics re-compute via
|
|
7
|
+
* `computed()` when either the planning result or the locale signal changes.
|
|
8
|
+
*/
|
|
9
|
+
export declare class SuisseBilanzMetricsService {
|
|
10
|
+
private readonly planning;
|
|
11
|
+
private readonly i18n;
|
|
12
|
+
/** Wall-clock time of the most recent successful planning result. */
|
|
13
|
+
readonly lastUpdated: import("@angular/core").WritableSignal<Date | null>;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Five gauge view-models for N avail., P₂O₅, K₂O, Mg and Rendement prairies.
|
|
17
|
+
* Returns placeholder 'empty' metrics until the first planning result arrives.
|
|
18
|
+
*/
|
|
19
|
+
readonly metrics: import("@angular/core").Signal<GaugeMetric[]>;
|
|
20
|
+
private emptyMetric;
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { GaugeMetric, GaugeStatus } from './gauge-arc.component';
|
|
2
|
+
import { SuisseBilanzMetricsService } from './suissebilanz-metrics.service';
|
|
3
|
+
/**
|
|
4
|
+
* Slim, always-visible metrics card placed above the workflow stepper.
|
|
5
|
+
*
|
|
6
|
+
* Shows the same 5 SuisseBilanz metrics as the full dashboard card but in a
|
|
7
|
+
* compact single-row layout: metric label → bold coloured value → thin
|
|
8
|
+
* progress bar. Shares all data logic via `SuisseBilanzMetricsService`.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SuisseBilanzMinibarComponent {
|
|
11
|
+
protected readonly metricsService: SuisseBilanzMetricsService;
|
|
12
|
+
/** Returns the status colour for a given metric status. */
|
|
13
|
+
protected statusColor(status: GaugeStatus): string;
|
|
14
|
+
/**
|
|
15
|
+
* Maps the metric value to a 0–100 fill percentage for the progress bar,
|
|
16
|
+
* clamped so bars never overflow the track.
|
|
17
|
+
*/
|
|
18
|
+
protected fillPct(metric: GaugeMetric): number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
import { PlanningBalanceService } from '../../core/planning/planning-balance.service';
|
|
3
|
+
/**
|
|
4
|
+
* Final submission step: review validation status and submit the planning balance.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ValidationPageComponent {
|
|
7
|
+
/** Navigation callback for validation error clicks — provided by App to keep routing logic centralised. */
|
|
8
|
+
readonly onErrorSelected: import("@angular/core").InputSignal<(error: ErrorObject) => void>;
|
|
9
|
+
/** Navigation callback triggered after a fresh successful planning submission. */
|
|
10
|
+
readonly onSubmitSuccess: import("@angular/core").InputSignal<() => void>;
|
|
11
|
+
protected readonly planning: PlanningBalanceService;
|
|
12
|
+
private readonly globalValidation;
|
|
13
|
+
private lastHandledSuccessRequestId;
|
|
14
|
+
constructor();
|
|
15
|
+
protected readonly validationErrors: import("@angular/core").Signal<import("../../../public-api").EnrichedValidationError[]>;
|
|
16
|
+
protected readonly errorCount: import("@angular/core").Signal<number>;
|
|
17
|
+
}
|
|
@@ -39,10 +39,14 @@ export declare class WorkflowStepperComponent {
|
|
|
39
39
|
*/
|
|
40
40
|
readonly onNavigate: import("@angular/core").InputSignal<(page: PageId) => void>;
|
|
41
41
|
private readonly validationSvc;
|
|
42
|
+
private readonly planningSvc;
|
|
42
43
|
protected readonly pagesWithErrors: import("@angular/core").Signal<Set<PageId>>;
|
|
43
44
|
protected readonly isOnWorkflowPage: import("@angular/core").Signal<boolean>;
|
|
45
|
+
protected readonly hasPlanningResult: import("@angular/core").Signal<boolean>;
|
|
46
|
+
protected readonly isResultsStepDisabled: import("@angular/core").Signal<boolean>;
|
|
44
47
|
protected readonly clampedStepIndex: import("@angular/core").Signal<number>;
|
|
45
48
|
protected onSelectedIndexChange(index: number): void;
|
|
46
49
|
protected onStepperClick(event: MouseEvent): void;
|
|
47
50
|
private navigateTo;
|
|
51
|
+
private isStepDisabled;
|
|
48
52
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type PageId = 'welcome' | 'animal_stock' | 'data_preview' | 'storage' | 'field_spreading' | 'farm_manure_trading';
|
|
1
|
+
export type PageId = 'welcome' | 'animal_stock' | 'data_preview' | 'storage' | 'field_spreading' | 'farm_manure_trading' | 'field_cultivation' | 'validation' | 'results';
|
|
2
2
|
export type AnimalStockCategory = 'base' | 'formOfDetention' | 'feeding';
|
|
3
3
|
export type FarmManureTradingMode = 'supply' | 'dispense';
|
|
4
4
|
export type FarmManureTradingCategory = 'general' | 'derivation' | 'ingredients';
|
|
@@ -10,9 +10,28 @@ export type PlanningEndpoint = 'ebilanz' | 'blw';
|
|
|
10
10
|
* The ID counter ensures each call re-fetches even if the payload hasn't changed.
|
|
11
11
|
*/
|
|
12
12
|
export declare class PlanningBalanceService {
|
|
13
|
-
private readonly
|
|
13
|
+
private readonly http;
|
|
14
|
+
private readonly _value;
|
|
15
|
+
private readonly _error;
|
|
16
|
+
private readonly _isLoading;
|
|
17
|
+
private readonly _selectedEndpoint;
|
|
18
|
+
private readonly _lastStartedRequestId;
|
|
19
|
+
private readonly _lastCompletedRequestId;
|
|
20
|
+
private readonly _lastSuccessfulRequestId;
|
|
14
21
|
private _nextId;
|
|
15
|
-
|
|
22
|
+
private activeRequestId;
|
|
23
|
+
private activeRequestSub;
|
|
24
|
+
readonly planningResource: {
|
|
25
|
+
value: import("@angular/core").Signal<PlanningBalanceResponse | undefined>;
|
|
26
|
+
error: import("@angular/core").Signal<unknown>;
|
|
27
|
+
isLoading: import("@angular/core").Signal<boolean>;
|
|
28
|
+
hasValue: import("@angular/core").Signal<boolean>;
|
|
29
|
+
lastStartedRequestId: import("@angular/core").Signal<number>;
|
|
30
|
+
lastCompletedRequestId: import("@angular/core").Signal<number>;
|
|
31
|
+
lastSuccessfulRequestId: import("@angular/core").Signal<number>;
|
|
32
|
+
};
|
|
33
|
+
readonly selectedEndpoint: import("@angular/core").Signal<PlanningEndpoint>;
|
|
34
|
+
setSelectedEndpoint(endpoint: PlanningEndpoint): void;
|
|
16
35
|
/** Fire a new planning-balance request with the current NAEBI data payload. */
|
|
17
|
-
runPlanning(data: NaebiData, endpoint
|
|
36
|
+
runPlanning(data: NaebiData, endpoint?: PlanningEndpoint): void;
|
|
18
37
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BalanceRow, NutrientEntry } from './planning-balance.types';
|
|
2
|
+
/**
|
|
3
|
+
* Merges the interleaved kg / % rows from `totalBalance` into one `BalanceRow`
|
|
4
|
+
* per nutrient formula, preserving the canonical KEY_NUTRIENTS display order.
|
|
5
|
+
*
|
|
6
|
+
* The planning-balance API returns two `NutrientEntry` objects per formula
|
|
7
|
+
* (one with `unit === 'kg'`, one with `unit === '%'`). This function coalesces
|
|
8
|
+
* them so callers work with a single, normalised row.
|
|
9
|
+
*/
|
|
10
|
+
export declare function mergeBalanceRows(totalBalance: NutrientEntry[]): BalanceRow[];
|
|
@@ -2,8 +2,7 @@ import { Locale } from './core/i18n/i18n.service';
|
|
|
2
2
|
import { PageId } from './core/navigation/navigation.service';
|
|
3
3
|
/**
|
|
4
4
|
* HeaderBarComponent
|
|
5
|
-
*
|
|
6
|
-
* Main workflow navigation is delegated to WorkflowStepperComponent below the toolbar.
|
|
5
|
+
* Footer actions for quick access to data preview and the current save state.
|
|
7
6
|
*/
|
|
8
7
|
export declare class HeaderBarComponent {
|
|
9
8
|
locale: import("@angular/core").InputSignal<Locale>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Ensure the Material
|
|
2
|
+
* Ensure the Material icon stylesheets exist in the document <head> (SPA / non-shadow usage).
|
|
3
3
|
* Idempotent: returns immediately if DOM unavailable (SSR) or link already present.
|
|
4
4
|
*
|
|
5
5
|
* @param doc Optional document for testing / dependency injection.
|
|
6
6
|
*/
|
|
7
7
|
export declare function ensureMaterialIconsInHead(doc?: Document): void;
|
|
8
8
|
/**
|
|
9
|
-
* Ensure the Material
|
|
9
|
+
* Ensure the Material icon stylesheets are available inside a ShadowRoot so that
|
|
10
10
|
* icon ligatures render when the component is embedded as a Web Component.
|
|
11
11
|
* We prepend so icons load early without disturbing existing adopted stylesheets.
|
|
12
|
-
* Idempotent: guarded by
|
|
12
|
+
* Idempotent: each font link is guarded by its own custom attribute selector.
|
|
13
13
|
*
|
|
14
14
|
* @param shadow Target ShadowRoot; silently no-ops if null/undefined or DOM unavailable.
|
|
15
15
|
*/
|
package/package.json
CHANGED
|
File without changes
|