@agridea/suibi-module 0.1.0-preview.9159a63 → 0.1.0-preview.9c2f7b8
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 +70 -70
- package/dist/elements/browser/suibi-module-latest.js +70 -70
- package/dist/elements/browser/suibi-module.v0.1.0-preview.9c2f7b8.js +78 -0
- package/dist/elements/browser/version.txt +1 -1
- package/dist/types/app/components/inline-table/inline-table.component.d.ts +64 -5
- package/dist/types/app/components/inline-table/inline-table.types.d.ts +87 -2
- package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-dashboard.component.d.ts +2 -0
- package/dist/types/app/core/i18n/i18n.service.d.ts +1 -0
- package/dist/types/app/core/metadata/suibi-metadata.types.d.ts +1 -1
- package/dist/types/app/core/navigation/navigation.service.d.ts +7 -0
- package/dist/types/app/core/planning/planning-balance.service.d.ts +1 -0
- package/dist/types/app/core/utils/custom-unit.util.d.ts +38 -0
- package/dist/types/app/core/utils/object.util.d.ts +17 -0
- package/dist/types/app/core/validation/ajv-custom.d.ts +1 -0
- package/dist/types/app/core/validation/global-validation.service.d.ts +2 -0
- package/dist/types/app/jsonforms/renderers/layout/group/module-toggle-group.renderer.d.ts +3 -1
- package/dist/types/app/nutrient-cycle/animal-stock/{animal-stock-detail.component.d.ts → animal-stock-detail/animal-stock-detail.component.d.ts} +2 -2
- package/dist/types/app/nutrient-cycle/animal-stock/{animal-stock-list.component.d.ts → animal-stock-list/animal-stock-list.component.d.ts} +1 -1
- package/dist/types/app/nutrient-cycle/animal-stock/{animal-stock-master-detail.component.d.ts → animal-stock-master-detail/animal-stock-master-detail.component.d.ts} +2 -2
- package/dist/types/app/nutrient-cycle/animal-stock/index.d.ts +3 -3
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-master-detail/farm-manure-trading-master-detail.component.d.ts +19 -0
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-table/farm-manure-trading-table.component.d.ts +35 -0
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-table/farm-manure-trading-table.config.d.ts +24 -0
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading.types.d.ts +4 -0
- package/dist/types/app/nutrient-cycle/farm-manure-trading/index.d.ts +3 -3
- package/dist/types/app/nutrient-cycle/farm-manure-trading/transaction-unit.util.d.ts +2 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/arable-land-table/arable-land-table.component.d.ts +22 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/arable-land-table/arable-land-table.config.d.ts +9 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/crop-harvest-table/crop-harvest-table.component.d.ts +21 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/crop-harvest-table/crop-harvest-table.config.d.ts +13 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/{field-cultivation-detail.component.d.ts → field-cultivation-detail/field-cultivation-detail.component.d.ts} +2 -2
- package/dist/types/app/nutrient-cycle/field-cultivation/{field-cultivation-general.component.d.ts → field-cultivation-general/field-cultivation-general.component.d.ts} +2 -4
- package/dist/types/app/nutrient-cycle/field-cultivation/{field-cultivation-list.component.d.ts → field-cultivation-list/field-cultivation-list.component.d.ts} +1 -1
- package/dist/types/app/nutrient-cycle/field-cultivation/field-cultivation-master-detail/field-cultivation-master-detail.component.d.ts +29 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/field-cultivation.types.d.ts +4 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/fodder-cropland-table/fodder-cropland-table.component.d.ts +28 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/fodder-cropland-table/fodder-cropland-table.config.d.ts +16 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/index.d.ts +8 -3
- package/dist/types/app/nutrient-cycle/field-cultivation/special-crops-table/special-crops-table.component.d.ts +29 -0
- package/dist/types/app/nutrient-cycle/field-cultivation/special-crops-table/special-crops-table.config.d.ts +61 -0
- package/dist/types/app/nutrient-cycle/field-spreading/fertiliser-table/fertiliser-table.component.d.ts +19 -5
- package/dist/types/app/nutrient-cycle/field-spreading/field-spreading.component.d.ts +2 -0
- package/dist/types/app/nutrient-cycle/field-spreading/field-spreading.types.d.ts +1 -0
- package/dist/types/app/nutrient-cycle/field-spreading/ingredient.util.d.ts +8 -0
- package/dist/types/app/nutrient-cycle/field-spreading/recycling-table/recycling-table.component.d.ts +14 -4
- package/dist/types/app/nutrient-cycle/field-spreading/recycling-table/recycling-table.config.d.ts +4 -3
- package/dist/types/app/nutrient-cycle/field-spreading/recycling-table/recycling-transaction-unit.util.d.ts +4 -0
- package/dist/types/app/nutrient-cycle/fodder/fodder-master-detail/fodder-master-detail.component.d.ts +25 -0
- package/dist/types/app/nutrient-cycle/fodder/fodder-table/fodder-table.component.d.ts +28 -0
- package/dist/types/app/nutrient-cycle/fodder/fodder-table/fodder-table.config.d.ts +9 -0
- package/dist/types/app/nutrient-cycle/fodder/fodder.types.d.ts +7 -0
- package/dist/types/app/nutrient-cycle/fodder/index.d.ts +2 -3
- package/dist/types/app/nutrient-cycle/fodder/ingredient.util.d.ts +8 -0
- package/dist/types/app/nutrient-cycle/storage/index.d.ts +3 -3
- package/dist/types/app/nutrient-cycle/storage/{storage-detail.component.d.ts → storage-detail/storage-detail.component.d.ts} +3 -3
- package/dist/types/app/nutrient-cycle/storage/{storage-general.component.d.ts → storage-general/storage-general.component.d.ts} +4 -4
- package/dist/types/app/nutrient-cycle/storage/{storage-list.component.d.ts → storage-list/storage-list.component.d.ts} +4 -1
- package/dist/types/app/nutrient-cycle/storage/{storage-master-detail.component.d.ts → storage-master-detail/storage-master-detail.component.d.ts} +5 -2
- package/package.json +1 -1
- package/dist/elements/browser/suibi-module.v0.1.0-preview.9159a63.js +0 -78
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-detail.component.d.ts +0 -26
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-list.component.d.ts +0 -22
- package/dist/types/app/nutrient-cycle/farm-manure-trading/farm-manure-trading-master-detail.component.d.ts +0 -25
- package/dist/types/app/nutrient-cycle/field-cultivation/field-cultivation-master-detail.component.d.ts +0 -37
- package/dist/types/app/nutrient-cycle/fodder/fodder-detail.component.d.ts +0 -31
- package/dist/types/app/nutrient-cycle/fodder/fodder-list.component.d.ts +0 -20
- package/dist/types/app/nutrient-cycle/fodder/fodder-master-detail.component.d.ts +0 -37
- /package/dist/elements/browser/{suibi-module.v0.1.0-preview.9159a63.css → suibi-module.v0.1.0-preview.9c2f7b8.css} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.0-preview.
|
|
1
|
+
0.1.0-preview.9c2f7b8 9c2f7b8
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { MatCheckboxChange } from '@angular/material/checkbox';
|
|
1
2
|
import { BaseCodeListEntry } from '../../jsonforms/shared/option-sources/code-lists';
|
|
2
|
-
import { InlineColumnDef, InlineTableConfig } from './inline-table.types';
|
|
3
|
+
import { InlineColumnDef, InlineTableConfig, InlineCellErrorResolver } from './inline-table.types';
|
|
3
4
|
/**
|
|
4
5
|
* InlineTableComponent — generic inline-editable table for array-of-objects data.
|
|
5
6
|
*
|
|
@@ -26,6 +27,8 @@ import { InlineColumnDef, InlineTableConfig } from './inline-table.types';
|
|
|
26
27
|
*/
|
|
27
28
|
export declare class InlineTableComponent {
|
|
28
29
|
private readonly i18n;
|
|
30
|
+
private readonly host;
|
|
31
|
+
constructor();
|
|
29
32
|
/** Table configuration — columns, labels, and the row factory. Acts as the "uischema". */
|
|
30
33
|
readonly config: import("@angular/core").InputSignal<InlineTableConfig>;
|
|
31
34
|
/** Current array of row objects. Each key maps to a column's `key` or sub-array path. */
|
|
@@ -38,17 +41,35 @@ export declare class InlineTableComponent {
|
|
|
38
41
|
/**
|
|
39
42
|
* Optional business-logic transform applied after every cell edit — before emission.
|
|
40
43
|
*
|
|
41
|
-
* Signature: `(changedKey, newValue, updatedRow) => transformedRow`
|
|
44
|
+
* Signature: `(changedKey, newValue, updatedRow, previousRow) => transformedRow`
|
|
42
45
|
*
|
|
43
46
|
* - `changedKey`: the `InlineColumnDef.key` of the edited column.
|
|
44
47
|
* - `newValue`: the raw new value (string, number, or null).
|
|
45
48
|
* - `updatedRow`: the row object already reflecting the edit.
|
|
49
|
+
* - `previousRow`: the row as it was before the edit — needed when the side-effect
|
|
50
|
+
* depends on the replaced value (e.g. converting a quantity on a unit switch).
|
|
46
51
|
* - Return the row (possibly further mutated) that should be stored.
|
|
47
52
|
*
|
|
48
53
|
* Use this for cross-field side-effects such as pre-populating nutrient % columns
|
|
49
54
|
* when a product is selected. For forms without such logic, omit this input.
|
|
50
55
|
*/
|
|
51
|
-
readonly rowTransform: import("@angular/core").InputSignal<((changedKey: string, newValue: unknown, row: Record<string, unknown>) => Record<string, unknown>) | null>;
|
|
56
|
+
readonly rowTransform: import("@angular/core").InputSignal<((changedKey: string, newValue: unknown, row: Record<string, unknown>, previousRow?: Record<string, unknown>) => Record<string, unknown>) | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Optional per-cell validation resolver — returns a translated error message
|
|
59
|
+
* shown under the cell (cell turns red via `mat-form-field-invalid`), or `null`
|
|
60
|
+
* when valid. Inline tables bypass JSONForms/AJV, so business rules that must
|
|
61
|
+
* be visible while typing (e.g. percentage caps) are surfaced through this hook.
|
|
62
|
+
*/
|
|
63
|
+
readonly cellError: import("@angular/core").InputSignal<InlineCellErrorResolver | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Index of the row to visually highlight (e.g. after a validation-error deep-link).
|
|
66
|
+
* Also triggers a scrollIntoView so the row is on screen.
|
|
67
|
+
*/
|
|
68
|
+
readonly highlightRowIndex: import("@angular/core").InputSignal<number | null>;
|
|
69
|
+
/** Resolves the per-cell error message via the optional `cellError` input (null = valid). */
|
|
70
|
+
errorForCell(row: Record<string, unknown>, col: InlineColumnDef): string | null;
|
|
71
|
+
/** True when any column of the row reports an error — drives the row-level red tint. */
|
|
72
|
+
rowHasError(row: Record<string, unknown>): boolean;
|
|
52
73
|
/** Extracts a px value from a grid-format width string (e.g. 'minmax(120px, 1fr)' → '120px'). */
|
|
53
74
|
colMinWidth(width?: string): string;
|
|
54
75
|
/** Total table width = sum of all column px values + 40px for the delete column. */
|
|
@@ -62,8 +83,12 @@ export declare class InlineTableComponent {
|
|
|
62
83
|
readonly emptyHint: import("@angular/core").Signal<string>;
|
|
63
84
|
/** Returns the option array for a select column from the shared CODE_LISTS map. */
|
|
64
85
|
getOptions(col: InlineColumnDef): BaseCodeListEntry[];
|
|
86
|
+
/** Options for a select column, narrowed per row when the column defines `optionsFilter`. */
|
|
87
|
+
optionsForRow(col: InlineColumnDef, row: Record<string, unknown>): BaseCodeListEntry[];
|
|
65
88
|
/**
|
|
66
89
|
* Returns the localized display label for a code-list option.
|
|
90
|
+
* - `optionLabelKey`: translates the i18n key returned by the column's resolver — for
|
|
91
|
+
* literal option lists whose labels live in the locales rather than in master data.
|
|
67
92
|
* - `optionDisplay: 'id'`: returns `String(entry.id)` (e.g. "kg", "t").
|
|
68
93
|
* - default (`'label'`): uses `descriptor.designation_eng / designation_deu`;
|
|
69
94
|
* falls back to `String(entry.id)` when no descriptor is present.
|
|
@@ -72,6 +97,7 @@ export declare class InlineTableComponent {
|
|
|
72
97
|
/**
|
|
73
98
|
* Reads the current cell value for a column from a row object.
|
|
74
99
|
*
|
|
100
|
+
* - `valueResolver` columns: fully derived value (e.g. from master data).
|
|
75
101
|
* - Simple field: returns `row[col.key]`.
|
|
76
102
|
* - Sub-array field: navigates `row[arrayPath]`, finds the entry matching
|
|
77
103
|
* `arrayKeyField === arrayKeyValue`, and returns `entry[arrayValueField]`.
|
|
@@ -84,14 +110,47 @@ export declare class InlineTableComponent {
|
|
|
84
110
|
private setValue;
|
|
85
111
|
/** Called when a `mat-select` selection changes. */
|
|
86
112
|
onSelectChange(rowIdx: number, col: InlineColumnDef, value: unknown): void;
|
|
87
|
-
/** Called on `(
|
|
113
|
+
/** Called on `(input)` of a number `<input>` — parses the string value and guards NaN.
|
|
114
|
+
* Uses `input` (not `change`) so every keystroke commits immediately: relying on blur
|
|
115
|
+
* meant edits were lost whenever the table was destroyed before the field lost focus
|
|
116
|
+
* (e.g. navigating to another page), even though switching same-page tabs hid the bug
|
|
117
|
+
* since mat-tab-group keeps inactive tab content mounted. */
|
|
88
118
|
onNumberChange(rowIdx: number, col: InlineColumnDef, event: Event): void;
|
|
89
|
-
/** Called on `(
|
|
119
|
+
/** Called on `(input)` of a text `<input>` (see onNumberChange for why not `(change)`). */
|
|
90
120
|
onTextChange(rowIdx: number, col: InlineColumnDef, event: Event): void;
|
|
121
|
+
/** Called when a `mat-checkbox` is toggled. */
|
|
122
|
+
onCheckboxChange(rowIdx: number, col: InlineColumnDef, change: MatCheckboxChange): void;
|
|
123
|
+
/** Whether the cell widget is disabled for this row (per-row constraint hook). */
|
|
124
|
+
isCellDisabled(col: InlineColumnDef, row: Record<string, unknown>): boolean;
|
|
91
125
|
/** Appends a blank row produced by `config.createRow()`. */
|
|
92
126
|
addRow(): void;
|
|
93
127
|
/** Removes the row at `idx` from the array. */
|
|
94
128
|
removeRow(idx: number): void;
|
|
129
|
+
/** Ids of the expanded sub-rows panels, keyed `${rowIdx}:${col.key}` (UI-only state). */
|
|
130
|
+
private readonly expandedSubrows;
|
|
131
|
+
isSubrowsExpanded(rowIdx: number, col: InlineColumnDef): boolean;
|
|
132
|
+
toggleSubrows(rowIdx: number, col: InlineColumnDef): void;
|
|
133
|
+
/** Reads the nested key/value entries of a sub-rows column (never null). */
|
|
134
|
+
getSubEntries(row: Record<string, unknown>, col: InlineColumnDef): Record<string, unknown>[];
|
|
135
|
+
/** Options for the key select of a sub-rows column. */
|
|
136
|
+
getSubrowOptions(col: InlineColumnDef): BaseCodeListEntry[];
|
|
137
|
+
/** Localized label for a sub-entry key (descriptor designation, id as fallback). */
|
|
138
|
+
subrowKeyLabel(col: InlineColumnDef, keyValue: unknown): string;
|
|
139
|
+
/** Collapsed-cell summary, e.g. "Bovins 25 %, Porcs 75 %" ('–' when empty). */
|
|
140
|
+
subrowsSummary(row: Record<string, unknown>, col: InlineColumnDef): string;
|
|
141
|
+
/** Sum of the value fields of all sub-entries. */
|
|
142
|
+
subEntryTotal(row: Record<string, unknown>, col: InlineColumnDef): number;
|
|
143
|
+
/** Whether the sub-entry values sum to the configured expected total. */
|
|
144
|
+
subEntryTotalOk(row: Record<string, unknown>, col: InlineColumnDef): boolean;
|
|
145
|
+
addSubEntry(rowIdx: number, col: InlineColumnDef): void;
|
|
146
|
+
removeSubEntry(rowIdx: number, col: InlineColumnDef, subIdx: number): void;
|
|
147
|
+
onSubEntryKeyChange(rowIdx: number, col: InlineColumnDef, subIdx: number, value: unknown): void;
|
|
148
|
+
/** Commits on every keystroke (not on blur) — same rationale as `onNumberChange`.
|
|
149
|
+
* When `expectedTotal` is set, the value is clamped to the remaining share so the
|
|
150
|
+
* sum can never exceed it; smaller intermediate keystrokes still go through. */
|
|
151
|
+
onSubEntryValueChange(rowIdx: number, col: InlineColumnDef, subIdx: number, event: Event): void;
|
|
152
|
+
/** Writes the sub-entry array back to the row, runs rowTransform, emits rowsChange. */
|
|
153
|
+
private updateSubEntries;
|
|
95
154
|
/**
|
|
96
155
|
* Core change handler: sets the new value on the row, applies the optional
|
|
97
156
|
* `rowTransform` for any cross-field side-effects, then emits the updated array.
|
|
@@ -11,8 +11,58 @@
|
|
|
11
11
|
* To reuse the table for a different domain, create a new config file and a thin
|
|
12
12
|
* wrapper component. Only the config changes; the rendering component stays the same.
|
|
13
13
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
import type { BaseCodeListEntry } from '../../jsonforms/shared/option-sources/code-lists';
|
|
15
|
+
/** Supported cell widget types. Extend with new literal types as needed.
|
|
16
|
+
* 'readonly' renders the resolved value as plain text (no input) — for columns
|
|
17
|
+
* that are fully derived from other fields and must not be user-editable.
|
|
18
|
+
* 'checkbox' renders a boolean mat-checkbox bound to a true/false row field.
|
|
19
|
+
* 'subrows' renders an expandable editor for a nested list of key/percentage
|
|
20
|
+
* pairs (e.g. manureDerivation[]) — see `InlineSubrowsConfig`. */
|
|
21
|
+
export type InlineCellType = 'select' | 'number' | 'text' | 'readonly' | 'checkbox' | 'subrows';
|
|
22
|
+
/**
|
|
23
|
+
* Per-cell validation resolver — returns a translated error message to display
|
|
24
|
+
* under the cell, or `null` when the cell is valid. Passed as the `cellError`
|
|
25
|
+
* input of InlineTableComponent for domain tables that bypass JSONForms/AJV
|
|
26
|
+
* (inline tables are not schema-validated, so business rules like percentage
|
|
27
|
+
* caps must be surfaced visually through this hook).
|
|
28
|
+
*/
|
|
29
|
+
export type InlineCellErrorResolver = (row: Record<string, unknown>, col: InlineColumnDef) => string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Configuration for a `type: 'subrows'` column — an expandable editor for a nested
|
|
32
|
+
* array of `{ key, value }` entries (e.g. manureDerivation: zoologicalAnimal +
|
|
33
|
+
* percentageAllocation). The collapsed cell shows a joined summary; expanding it
|
|
34
|
+
* opens a floating panel with one select + number input per entry, an add button,
|
|
35
|
+
* and a total indicator (green when the sum matches `expectedTotal`).
|
|
36
|
+
*/
|
|
37
|
+
export interface InlineSubrowsConfig {
|
|
38
|
+
/** Path to the nested array on the row object (e.g. `'manureDerivation'`). */
|
|
39
|
+
arrayPath: string;
|
|
40
|
+
/** Field holding the code-list key in each sub-entry (e.g. `'zoologicalAnimal'`). */
|
|
41
|
+
keyField: string;
|
|
42
|
+
/** Key into the shared `CODE_LISTS` map for the key select options. */
|
|
43
|
+
keyCodeListKey: string;
|
|
44
|
+
/** i18n key for the key sub-column header inside the panel. */
|
|
45
|
+
keyLabelKey: string;
|
|
46
|
+
/** Field holding the numeric share in each sub-entry (e.g. `'percentageAllocation'`). */
|
|
47
|
+
valueField: string;
|
|
48
|
+
/** i18n key for the value sub-column header inside the panel. */
|
|
49
|
+
valueLabelKey: string;
|
|
50
|
+
/** i18n key for the "add sub-entry" button label. */
|
|
51
|
+
addLabelKey: string;
|
|
52
|
+
/** i18n key for the expand toggle label (collapsed state). */
|
|
53
|
+
expandLabelKey: string;
|
|
54
|
+
/** i18n key for the collapse toggle label (expanded state). */
|
|
55
|
+
collapseLabelKey: string;
|
|
56
|
+
/** i18n key for the total indicator label. */
|
|
57
|
+
totalLabelKey: string;
|
|
58
|
+
/** Expected sum of the value fields (e.g. 100) — the indicator turns green on exact
|
|
59
|
+
* match (no more, no less) and entered values are clamped so the sum never exceeds it. */
|
|
60
|
+
expectedTotal?: number;
|
|
61
|
+
/** Min for the value number input (default 0). */
|
|
62
|
+
valueMin?: number;
|
|
63
|
+
/** Max for the value number input (default: none). */
|
|
64
|
+
valueMax?: number;
|
|
65
|
+
}
|
|
16
66
|
/**
|
|
17
67
|
* Definition for a single column in an inline table.
|
|
18
68
|
*
|
|
@@ -55,6 +105,24 @@ export interface InlineColumnDef {
|
|
|
55
105
|
* human-readable (e.g. unit codes like "kg", "t", "l").
|
|
56
106
|
*/
|
|
57
107
|
optionDisplay?: 'label' | 'id';
|
|
108
|
+
/**
|
|
109
|
+
* For `type: 'select'` — optional per-row narrowing of the code-list options,
|
|
110
|
+
* e.g. to restrict the product list based on another cell of the same row.
|
|
111
|
+
* Evaluated for every option of every row, so keep it cheap.
|
|
112
|
+
*/
|
|
113
|
+
optionsFilter?: (entry: BaseCodeListEntry, row: Record<string, unknown>) => boolean;
|
|
114
|
+
/**
|
|
115
|
+
* For `type: 'select'` — resolve an option's label through an i18n key instead of the
|
|
116
|
+
* master-data descriptor (for literal option lists whose labels live in the locales,
|
|
117
|
+
* e.g. a row-type selector). Takes precedence over `optionDisplay`.
|
|
118
|
+
*/
|
|
119
|
+
optionLabelKey?: (entry: BaseCodeListEntry) => string;
|
|
120
|
+
/**
|
|
121
|
+
* Optional i18n key for an explanatory tooltip shown via an info icon next to
|
|
122
|
+
* the column header (e.g. to explain a checkbox whose effect is not obvious).
|
|
123
|
+
* Omit for columns that need no extra explanation.
|
|
124
|
+
*/
|
|
125
|
+
tooltipKey?: string;
|
|
58
126
|
/**
|
|
59
127
|
* CSS grid column-sizing token, e.g. `'minmax(140px, 2fr)'` or `'84px'`.
|
|
60
128
|
* These values are joined to build the `grid-template-columns` style on the table.
|
|
@@ -70,6 +138,18 @@ export interface InlineColumnDef {
|
|
|
70
138
|
* Defaults to `'any'` when omitted, allowing any decimal.
|
|
71
139
|
*/
|
|
72
140
|
step?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Custom cell-value resolver — takes precedence over the default read path.
|
|
143
|
+
* Use this for `type: 'readonly'` columns whose value is derived from master
|
|
144
|
+
* data or other cells (e.g. a standard yield looked up from the selected crop)
|
|
145
|
+
* and therefore does not live on the row object.
|
|
146
|
+
*/
|
|
147
|
+
valueResolver?: (row: Record<string, unknown>) => unknown;
|
|
148
|
+
/**
|
|
149
|
+
* Per-row disabling of the cell widget (e.g. grey out the yield input when the
|
|
150
|
+
* selected crop does not permit yield input). Evaluated per row, keep it cheap.
|
|
151
|
+
*/
|
|
152
|
+
disabledForRow?: (row: Record<string, unknown>) => boolean;
|
|
73
153
|
/**
|
|
74
154
|
* Sub-array navigation config — for columns whose value lives inside a nested array
|
|
75
155
|
* on the row object (e.g. `ingredient[].quantity`).
|
|
@@ -90,6 +170,11 @@ export interface InlineColumnDef {
|
|
|
90
170
|
arrayKeyField?: string;
|
|
91
171
|
arrayKeyValue?: string;
|
|
92
172
|
arrayValueField?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Sub-rows editor config — required when `type: 'subrows'`, ignored otherwise.
|
|
175
|
+
* Drives the expandable key/percentage pair editor (see `InlineSubrowsConfig`).
|
|
176
|
+
*/
|
|
177
|
+
subrows?: InlineSubrowsConfig;
|
|
93
178
|
}
|
|
94
179
|
/**
|
|
95
180
|
* Full configuration for one inline-table instance — the "uischema" equivalent.
|
package/dist/types/app/components/suissebilanz-dashboard/suissebilanz-dashboard.component.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ import { SuisseBilanzMetricsService } from './suissebilanz-metrics.service';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class SuisseBilanzDashboardComponent {
|
|
13
13
|
readonly embedded: import("@angular/core").InputSignal<boolean>;
|
|
14
|
+
/** Shows the official PDF download link even when `embedded` (header hidden). */
|
|
15
|
+
readonly showPdfButton: import("@angular/core").InputSignal<boolean>;
|
|
14
16
|
protected readonly planning: PlanningBalanceService;
|
|
15
17
|
private readonly sanitizer;
|
|
16
18
|
protected readonly metricsService: SuisseBilanzMetricsService;
|
|
@@ -8,6 +8,7 @@ export declare class I18nService {
|
|
|
8
8
|
readonly jsonFormsI18n: Signal<{
|
|
9
9
|
locale: Locale;
|
|
10
10
|
translate: JsonFormsTranslator;
|
|
11
|
+
translateError: (error: unknown, translate: JsonFormsTranslator) => string;
|
|
11
12
|
}>;
|
|
12
13
|
setLocale(locale: Locale): void;
|
|
13
14
|
/** Returns true if the given string is a supported locale key. */
|
|
@@ -58,6 +58,11 @@ export declare class NavigationService {
|
|
|
58
58
|
type: StorageEntryType;
|
|
59
59
|
index: number;
|
|
60
60
|
} | null>;
|
|
61
|
+
/** Selected field spreading row context (category/tab + row index) — used by validation deep-links */
|
|
62
|
+
readonly selectedFieldSpreadingDetail: import("@angular/core").WritableSignal<{
|
|
63
|
+
category: FieldSpreadingCategory;
|
|
64
|
+
index: number;
|
|
65
|
+
} | null>;
|
|
61
66
|
/** True if currently viewing animal stock detail (not list) */
|
|
62
67
|
readonly isAnimalStockDetailView: import("@angular/core").Signal<boolean>;
|
|
63
68
|
/** True if currently on animal stock page (list or detail) */
|
|
@@ -81,6 +86,8 @@ export declare class NavigationService {
|
|
|
81
86
|
navigateToFodderDetail(mode: FodderMode, index: number, category?: FodderCategory): void;
|
|
82
87
|
navigateToFodderList(): void;
|
|
83
88
|
navigateToFieldSpreading(category?: FieldSpreadingCategory): void;
|
|
89
|
+
/** Deep-link to a specific row of a field spreading tab (e.g. from a validation error). */
|
|
90
|
+
navigateToFieldSpreadingDetail(category: FieldSpreadingCategory, index: number): void;
|
|
84
91
|
navigateToFieldCultivationDetail(tab: Exclude<FieldCultivationTab, 'general'>, index: number): void;
|
|
85
92
|
navigateToFieldCultivationList(tab?: FieldCultivationTab): void;
|
|
86
93
|
navigateToStorageDetail(type: StorageEntryType, index: number): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface CustomUnit {
|
|
2
|
+
/** Unit code stored on the row (e.g. 'ha', 't', 'dt'). */
|
|
3
|
+
code: string;
|
|
4
|
+
/** API base unit this custom unit converts to (e.g. 'm2', 'kg'). */
|
|
5
|
+
baseUnit: string;
|
|
6
|
+
/** Multiplier from the custom unit to its base unit (1 ha = 10'000 m2 → 10000). */
|
|
7
|
+
factor: number;
|
|
8
|
+
descriptor?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare const CUSTOM_UNITS: readonly CustomUnit[];
|
|
11
|
+
/** True when the unit code is a custom display unit (not an API base unit). */
|
|
12
|
+
export declare function isCustomUnit(unit: unknown): boolean;
|
|
13
|
+
/** Base unit a quantity can be converted to: the custom unit's `baseUnit`, or the unit
|
|
14
|
+
* itself when it already is a base (or unknown) unit. */
|
|
15
|
+
export declare function baseUnitOf(unit: string | null | undefined): string | null | undefined;
|
|
16
|
+
/** Custom units convertible to the given base unit (e.g. 'kg' → [t, dt]). */
|
|
17
|
+
export declare function customUnitsForBaseUnit(baseUnit: string): CustomUnit[];
|
|
18
|
+
/**
|
|
19
|
+
* Builds a filter (compatible with the inline table's `optionsFilter`) keeping only the
|
|
20
|
+
* units compatible with the given context base unit — i.e. the base unit itself plus its
|
|
21
|
+
* custom units. Pass a nullable base (e.g. derived from a product's matterState): `null`
|
|
22
|
+
* keeps the full list (nothing derived yet).
|
|
23
|
+
*
|
|
24
|
+
* Works on any entry shape exposing `id` (and `baseUnit` for custom units).
|
|
25
|
+
*/
|
|
26
|
+
export declare function unitOptionsForBaseUnit<T extends {
|
|
27
|
+
id: string | number;
|
|
28
|
+
}>(contextBaseUnit: string | null | undefined): (entry: T) => boolean;
|
|
29
|
+
/** Converts a quantity expressed in a custom unit to its base unit; pass-through for
|
|
30
|
+
* base/unknown units and null quantities. */
|
|
31
|
+
export declare function convertToBaseUnit(quantity: number | null | undefined, unit: string | null | undefined): {
|
|
32
|
+
quantity: number | null | undefined;
|
|
33
|
+
unit: string | null | undefined;
|
|
34
|
+
};
|
|
35
|
+
/** Converts a quantity between two units sharing the same base unit (kg ↔ t ↔ dt,
|
|
36
|
+
* m2 ↔ ha). Returns the quantity unchanged when either unit is missing or the units
|
|
37
|
+
* are incompatible (different base units). */
|
|
38
|
+
export declare function convertQuantityBetween(quantity: number | null | undefined, fromUnit: string | null | undefined, toUnit: string | null | undefined): number | null | undefined;
|
|
@@ -22,3 +22,20 @@ export declare function deepEqual(a: unknown, b: unknown): boolean;
|
|
|
22
22
|
* @returns A deep copy of the value
|
|
23
23
|
*/
|
|
24
24
|
export declare function deepClone<T>(value: T): T;
|
|
25
|
+
export declare function stripIncompleteIngredients<T>(value: T): T;
|
|
26
|
+
/**
|
|
27
|
+
* Sanitizes the planning payload: the calculation API (OpenAPI, no `nullable: true`
|
|
28
|
+
* anywhere) accepts an optional field as *absent* but rejects it when present with a
|
|
29
|
+
* null value ("must be string/number"). The working data model normalizes optional
|
|
30
|
+
* fields to null, so strip them at the submission boundary — mirroring what
|
|
31
|
+
* `stripIncompleteIngredients` does for ingredient slots.
|
|
32
|
+
*
|
|
33
|
+
* - inside `fieldCultivation` entry collections (fodderCropland, arableLand, special,
|
|
34
|
+
* feedingOfCropHarvest, dispenseOfCropHarvest): any null property is dropped
|
|
35
|
+
* (fieldName, userSpecificPlantName, yieldPerSquareMeasure, effectiveYield, …)
|
|
36
|
+
* - `nutrientCycle.fodder.trading.<collection>[].quantity`: null → dropped
|
|
37
|
+
*/
|
|
38
|
+
export declare function sanitizePlanningPayload(data: NaebiDataLike): NaebiDataLike;
|
|
39
|
+
/** Structural type so object.util stays free of a NaebiData import (circular-safe). */
|
|
40
|
+
type NaebiDataLike = Record<string, unknown>;
|
|
41
|
+
export {};
|
|
@@ -9,6 +9,7 @@ import Ajv from 'ajv';
|
|
|
9
9
|
*
|
|
10
10
|
* Custom keywords:
|
|
11
11
|
* - `permittedStableSystem`: Validates stable system against animal category constraints
|
|
12
|
+
* - `proportionSum`: Validates the sum of one numeric field across array items
|
|
12
13
|
*
|
|
13
14
|
* @param options - Additional AJV options to merge with defaults
|
|
14
15
|
*/
|
|
@@ -25,6 +25,8 @@ export interface EnrichedValidationError extends ErrorObject {
|
|
|
25
25
|
targetFodderCategory?: FodderCategory;
|
|
26
26
|
/** Category tab inside field spreading */
|
|
27
27
|
targetFieldSpreadingCategory?: FieldSpreadingCategory;
|
|
28
|
+
/** Row index inside a field spreading tab (fertiliser/recycling) */
|
|
29
|
+
targetFieldSpreadingIndex?: number;
|
|
28
30
|
/** Category tab inside field cultivation */
|
|
29
31
|
targetFieldCultivationTab?: FieldCultivationTab;
|
|
30
32
|
/** Field cultivation detail index */
|
|
@@ -20,17 +20,19 @@ export declare class ModuleToggleGroupRenderer extends JsonFormsBaseRenderer<Gro
|
|
|
20
20
|
private readonly cdr;
|
|
21
21
|
private subscription?;
|
|
22
22
|
protected readonly _hidden: import("@angular/core").WritableSignal<boolean>;
|
|
23
|
+
protected readonly _enabled: import("@angular/core").WritableSignal<boolean>;
|
|
23
24
|
protected readonly _label: import("@angular/core").WritableSignal<string | undefined>;
|
|
24
25
|
protected readonly _description: import("@angular/core").WritableSignal<string | undefined>;
|
|
25
26
|
protected readonly _modules: import("@angular/core").WritableSignal<ModuleCard[]>;
|
|
26
27
|
readonly labelId: string;
|
|
27
28
|
hidden: () => boolean;
|
|
29
|
+
enabled: () => boolean;
|
|
28
30
|
label: () => string | undefined;
|
|
29
31
|
description: () => string | undefined;
|
|
30
32
|
modules: () => ModuleCard[];
|
|
31
33
|
ngOnInit(): void;
|
|
32
34
|
ngOnDestroy(): void;
|
|
33
|
-
/** Flip a single module boolean in the JSONForms data store. */
|
|
35
|
+
/** Flip a single module boolean in the JSONForms data store. No-op while the group is disabled. */
|
|
34
36
|
toggle(dataPath: string): void;
|
|
35
37
|
}
|
|
36
38
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonSchema, UISchemaElement } from '@jsonforms/core';
|
|
2
|
-
import { AnimalStockRow } from '
|
|
2
|
+
import { AnimalStockRow } from '../animal-stock.types';
|
|
3
3
|
import { ErrorObject } from 'ajv';
|
|
4
4
|
export declare class AnimalStockDetailComponent {
|
|
5
5
|
private readonly i18n;
|
|
@@ -10,7 +10,7 @@ export declare class AnimalStockDetailComponent {
|
|
|
10
10
|
itemSchema: import("@angular/core").Signal<JsonSchema>;
|
|
11
11
|
private readonly baseUi;
|
|
12
12
|
localizedUi: import("@angular/core").Signal<UISchemaElement>;
|
|
13
|
-
jsonFormsData: import("@angular/core").Signal<(AnimalStockRow & import("
|
|
13
|
+
jsonFormsData: import("@angular/core").Signal<(AnimalStockRow & import("../../../core/schemas/ui-helper-registry").UiHelperDefinitions) | null>;
|
|
14
14
|
readonly renderers: {
|
|
15
15
|
tester: import("@jsonforms/core").RankedTester;
|
|
16
16
|
renderer: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CdkDragDrop } from '@angular/cdk/drag-drop';
|
|
2
|
-
import { AnimalStockRow } from '
|
|
2
|
+
import { AnimalStockRow } from '../animal-stock.types';
|
|
3
3
|
export declare class AnimalStockListComponent {
|
|
4
4
|
private readonly masterData;
|
|
5
5
|
rows: import("@angular/core").InputSignal<AnimalStockRow[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnimalStockRow } from '
|
|
2
|
-
import { LifetimePerformance } from '
|
|
1
|
+
import { AnimalStockRow } from '../animal-stock.types';
|
|
2
|
+
import { LifetimePerformance } from '../../lifetime-performance/lifetime-performance.types';
|
|
3
3
|
export declare class AnimalStockMasterDetailComponent {
|
|
4
4
|
private readonly dataSvc;
|
|
5
5
|
private readonly navigationSvc;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './animal-stock-list.component';
|
|
2
|
-
export * from './animal-stock-detail.component';
|
|
3
|
-
export * from './animal-stock-master-detail.component';
|
|
1
|
+
export * from './animal-stock-list/animal-stock-list.component';
|
|
2
|
+
export * from './animal-stock-detail/animal-stock-detail.component';
|
|
3
|
+
export * from './animal-stock-master-detail/animal-stock-master-detail.component';
|
|
4
4
|
export * from './animal-stock.types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FarmManureTradingSupply, FarmManureTradingDispense } from '../farm-manure-trading.types';
|
|
2
|
+
/**
|
|
3
|
+
* Farm manure trading page — two inline tables (supply "Reprises" / dispense
|
|
4
|
+
* "Cessions") editing `nutrientCycle.farmManureTrading` directly. The former
|
|
5
|
+
* master-detail round-trip (list + JSONForms detail pane) was replaced by inline
|
|
6
|
+
* editing, so validation deep-links (`selectedFarmManureTrading`) are merely
|
|
7
|
+
* consumed and cleared — there is no detail pane left to open (fodder pattern).
|
|
8
|
+
*/
|
|
9
|
+
export declare class FarmManureTradingMasterDetailComponent {
|
|
10
|
+
private readonly dataSvc;
|
|
11
|
+
private readonly navigationSvc;
|
|
12
|
+
constructor();
|
|
13
|
+
readonly supplyRows: import("@angular/core").Signal<FarmManureTradingSupply[]>;
|
|
14
|
+
readonly dispenseRows: import("@angular/core").Signal<FarmManureTradingDispense[]>;
|
|
15
|
+
onSupplyChange(rows: FarmManureTradingSupply[]): void;
|
|
16
|
+
onDispenseChange(rows: FarmManureTradingDispense[]): void;
|
|
17
|
+
private patchRows;
|
|
18
|
+
private cloneTrading;
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { InlineTableConfig } from '../../../components/inline-table/inline-table.types';
|
|
2
|
+
import { FarmManureTradingMode } from '../../../core/navigation/navigation.service';
|
|
3
|
+
import { FarmManureTradingSupply, FarmManureTradingDispense } from '../farm-manure-trading.types';
|
|
4
|
+
type TradingRow = FarmManureTradingSupply | FarmManureTradingDispense;
|
|
5
|
+
/**
|
|
6
|
+
* FarmManureTradingTableComponent — thin wrapper around InlineTableComponent.
|
|
7
|
+
*
|
|
8
|
+
* Responsibilities:
|
|
9
|
+
* 1. Provides the per-mode column/section config (the "uischema").
|
|
10
|
+
* 2. Bridges typed `FarmManureTradingSupply[]`/`Dispense[]` to/from the generic
|
|
11
|
+
* `Record<string, unknown>[]` API of InlineTableComponent.
|
|
12
|
+
* 3. Supplies `deriveUnits` as a `rowTransform` — the base `transactionUnit` ('kg'/'m3')
|
|
13
|
+
* and every ingredient's `unit` ('kg/t'/'kg/m3') are derived from the selected
|
|
14
|
+
* product's matterState; the user may switch to a custom unit sharing the same base
|
|
15
|
+
* (t, dt for kg), which converts the entered quantity on the fly.
|
|
16
|
+
*/
|
|
17
|
+
export declare class FarmManureTradingTableComponent {
|
|
18
|
+
readonly mode: import("@angular/core").InputSignal<FarmManureTradingMode>;
|
|
19
|
+
readonly entries: import("@angular/core").InputSignal<TradingRow[]>;
|
|
20
|
+
readonly entriesChange: import("@angular/core").OutputEmitterRef<TradingRow[]>;
|
|
21
|
+
protected readonly config: import("@angular/core").Signal<InlineTableConfig>;
|
|
22
|
+
/** Cast typed entries to generic Record[] for InlineTableComponent. */
|
|
23
|
+
readonly rowsForTable: import("@angular/core").Signal<Record<string, unknown>[]>;
|
|
24
|
+
/** Cast generic output back to typed trading rows. */
|
|
25
|
+
onRowsChange(rows: Record<string, unknown>[]): void;
|
|
26
|
+
/**
|
|
27
|
+
* Row transform deriving the ingredient units from the product's matterState on each
|
|
28
|
+
* edit, and handling `transactionUnit`:
|
|
29
|
+
* - product change (or missing unit on legacy rows): reset to the derived base unit,
|
|
30
|
+
* - unit switch: convert the entered quantity from the previous to the new unit
|
|
31
|
+
* (both share the same base), so the transacted amount is preserved.
|
|
32
|
+
*/
|
|
33
|
+
readonly deriveUnits: (changedKey: string, newValue: unknown, row: Record<string, unknown>, previousRow?: Record<string, unknown>) => Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column and section configuration for the Farm Manure Trading inline tables.
|
|
3
|
+
*
|
|
4
|
+
* This is the "uischema" for the supply ("Reprises") and dispense ("Cessions")
|
|
5
|
+
* tables — one InlineTableConfig per mode, mirroring recycling-table.config.ts.
|
|
6
|
+
* Columns:
|
|
7
|
+
* - Product: typeOfManureRecyclingProduct (code list filtered per mode)
|
|
8
|
+
* - Quantity: quantity (number)
|
|
9
|
+
* - Unit: transactionUnit (readonly — derived from the product's
|
|
10
|
+
* matterState, never user-editable, per the API spec)
|
|
11
|
+
* - Origin: manureDerivation[] (expandable key/share pair editor,
|
|
12
|
+
* expected total 100 %)
|
|
13
|
+
* - Nutrients: Ntot, Nsol (molecularFormula 'Nlos'), P₂O₅, K₂O, Mg read/written
|
|
14
|
+
* via the ingredient[] sub-array (same 5 nutrients as recycling).
|
|
15
|
+
* - Nutrient unit: readonly, derived from the product's matterState (kg/t | kg/m³).
|
|
16
|
+
*/
|
|
17
|
+
import type { InlineTableConfig } from '../../../components/inline-table/inline-table.types';
|
|
18
|
+
import type { FarmManureTradingMode } from '../../../core/navigation/navigation.service';
|
|
19
|
+
/** Nutrient formulas tracked per trading entry, in display order. 'Nlos' = soluble nitrogen
|
|
20
|
+
* (matches the `molecularFormula` enum from assets/master-data/substances.json — there is no 'NSol'). */
|
|
21
|
+
export declare const TRADING_NUTRIENT_COLUMNS: readonly ["Ntot", "Nlos", "P2O5", "K2O", "Mg"];
|
|
22
|
+
export type TradingNutrientFormula = (typeof TRADING_NUTRIENT_COLUMNS)[number];
|
|
23
|
+
/** Builds the inline-table config for one mode ('supply' | 'dispense'). */
|
|
24
|
+
export declare function createTradingTableConfig(mode: FarmManureTradingMode): InlineTableConfig;
|
|
@@ -10,6 +10,8 @@ export interface ManureDerivation {
|
|
|
10
10
|
export interface FarmManureTradingSupply {
|
|
11
11
|
quantity?: number;
|
|
12
12
|
typeOfManureRecyclingProduct?: string;
|
|
13
|
+
/** Host-only free text: persisted in the emitted dossier, stripped before API calls. */
|
|
14
|
+
productDesignation?: string;
|
|
13
15
|
transactionUnit?: string;
|
|
14
16
|
manureDerivation?: ManureDerivation[];
|
|
15
17
|
ingredient?: ManureIngredient[];
|
|
@@ -17,6 +19,8 @@ export interface FarmManureTradingSupply {
|
|
|
17
19
|
export interface FarmManureTradingDispense {
|
|
18
20
|
quantity?: number;
|
|
19
21
|
typeOfManureRecyclingProduct?: string;
|
|
22
|
+
/** Host-only free text: persisted in the emitted dossier, stripped before API calls. */
|
|
23
|
+
productDesignation?: string;
|
|
20
24
|
transactionUnit?: string;
|
|
21
25
|
manureDerivation?: ManureDerivation[];
|
|
22
26
|
ingredient?: ManureIngredient[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './farm-manure-trading-
|
|
2
|
-
export * from './farm-manure-trading-
|
|
3
|
-
export * from './farm-manure-trading-master-detail.component';
|
|
1
|
+
export * from './farm-manure-trading-table/farm-manure-trading-table.component';
|
|
2
|
+
export * from './farm-manure-trading-table/farm-manure-trading-table.config';
|
|
3
|
+
export * from './farm-manure-trading-master-detail/farm-manure-trading-master-detail.component';
|
|
4
4
|
export * from './farm-manure-trading.types';
|
|
@@ -1 +1,3 @@
|
|
|
1
1
|
export declare function deriveTransactionUnit(productCode: string | null | undefined): string | undefined;
|
|
2
|
+
/** Derives the mandatory ingredient unit ('kg/t' or 'kg/m3') from the product's matterState. */
|
|
3
|
+
export declare function deriveTradingIngredientUnit(productCode: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FieldCultivationArableLand } from '../field-cultivation.types';
|
|
2
|
+
/**
|
|
3
|
+
* ArableLandTableComponent — thin wrapper around InlineTableComponent for the
|
|
4
|
+
* "Grandes cultures" tab: arable-land entries are edited directly in the table
|
|
5
|
+
* (no detail pane). The config provides the columns; the rowTransform clears the
|
|
6
|
+
* yield-related fields when the newly selected crop does not permit yield input.
|
|
7
|
+
*/
|
|
8
|
+
export declare class ArableLandTableComponent {
|
|
9
|
+
readonly entries: import("@angular/core").InputSignal<FieldCultivationArableLand[]>;
|
|
10
|
+
readonly entriesChange: import("@angular/core").OutputEmitterRef<FieldCultivationArableLand[]>;
|
|
11
|
+
/** Column/section config (constant — no signal needed). */
|
|
12
|
+
protected readonly config: import("../../../components/inline-table/inline-table.types").InlineTableConfig;
|
|
13
|
+
/** Cast typed entries to the generic Record[] expected by InlineTableComponent. */
|
|
14
|
+
readonly rowsForTable: import("@angular/core").Signal<Record<string, unknown>[]>;
|
|
15
|
+
onRowsChange(rows: Record<string, unknown>[]): void;
|
|
16
|
+
/**
|
|
17
|
+
* Crop change: clear yield + divergence when the new crop forbids yield input,
|
|
18
|
+
* so no stale values linger under the now-disabled cells. Requirement corrections
|
|
19
|
+
* are special-crops-only (SUIBIL-1143): strip them so they never reach the emitted JSON.
|
|
20
|
+
*/
|
|
21
|
+
readonly enforceArableRules: (changedKey: string, newValue: unknown, row: Record<string, unknown>, previousRow?: Record<string, unknown>) => Record<string, unknown>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Column and section configuration for the arable-land inline table ("Grandes cultures").
|
|
3
|
+
*
|
|
4
|
+
* Replaces the former list + JSONForms detail pane for arable land: the main entry
|
|
5
|
+
* fields are edited directly in the table. The crop dropdown reuses the
|
|
6
|
+
* `agronomicCropCategoryArableLand` code list as-is, keeping its existing order.
|
|
7
|
+
*/
|
|
8
|
+
import type { InlineTableConfig } from '../../../components/inline-table/inline-table.types';
|
|
9
|
+
export declare const ARABLE_LAND_TABLE_CONFIG: InlineTableConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FieldCultivationCropHarvest } from '../field-cultivation.types';
|
|
2
|
+
import { CropHarvestTableKind } from './crop-harvest-table.config';
|
|
3
|
+
/**
|
|
4
|
+
* CropHarvestTableComponent — thin wrapper around InlineTableComponent for one of the
|
|
5
|
+
* two crop-harvest tables of the "Général" tab (fed / dispensed).
|
|
6
|
+
*
|
|
7
|
+
* Rows without a selected crop (freshly added) exist only in the local `uiRows`
|
|
8
|
+
* state and are emitted upstream once a crop is picked, so no empty rows ever
|
|
9
|
+
* reach the data store (fodder `uiRows` pattern).
|
|
10
|
+
*/
|
|
11
|
+
export declare class CropHarvestTableComponent {
|
|
12
|
+
readonly entries: import("@angular/core").InputSignal<FieldCultivationCropHarvest[]>;
|
|
13
|
+
readonly kind: import("@angular/core").InputSignal<CropHarvestTableKind>;
|
|
14
|
+
readonly entriesChange: import("@angular/core").OutputEmitterRef<FieldCultivationCropHarvest[]>;
|
|
15
|
+
readonly config: import("@angular/core").Signal<import("../../../components/inline-table/inline-table.types").InlineTableConfig>;
|
|
16
|
+
/** Rows as last edited locally (may contain not-yet-committed empty rows); null = follow data. */
|
|
17
|
+
private readonly uiRows;
|
|
18
|
+
readonly rowsForTable: import("@angular/core").Signal<Record<string, unknown>[]>;
|
|
19
|
+
constructor();
|
|
20
|
+
onRowsChange(rows: Record<string, unknown>[]): void;
|
|
21
|
+
}
|