@agridea/suibi-module 0.1.0-preview.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +120 -0
- package/dist/elements/browser/main.js +67 -0
- package/dist/elements/browser/polyfills.js +1 -0
- package/dist/elements/browser/styles.css +1 -0
- package/dist/elements/browser/suibi-module-latest.css +1 -0
- package/dist/elements/browser/suibi-module-latest.js +67 -0
- package/dist/elements/browser/suibi-module.v0.1.0-preview.8.css +1 -0
- package/dist/elements/browser/suibi-module.v0.1.0-preview.8.js +67 -0
- package/dist/elements/browser/suibi-theme-dark.css +1 -0
- package/dist/elements/browser/version.txt +1 -0
- package/dist/types/app/animal-stock/animal-stock-detail.component.d.ts +22 -0
- package/dist/types/app/animal-stock/animal-stock-list.component.d.ts +21 -0
- package/dist/types/app/animal-stock/animal-stock-master-detail.component.d.ts +21 -0
- package/dist/types/app/animal-stock/animal-stock.types.d.ts +69 -0
- package/dist/types/app/app.config.d.ts +2 -0
- package/dist/types/app/app.d.ts +26 -0
- package/dist/types/app/core/data/naebi-data.service.d.ts +232 -0
- package/dist/types/app/core/i18n/i18n.service.d.ts +20 -0
- package/dist/types/app/core/i18n/locales/de.d.ts +2 -0
- package/dist/types/app/core/i18n/locales/en.d.ts +2 -0
- package/dist/types/app/core/master-data/master-data.service.d.ts +18 -0
- package/dist/types/app/core/navigation/navigation.service.d.ts +53 -0
- package/dist/types/app/core/schemas/index.d.ts +18 -0
- package/dist/types/app/core/schemas/schema-merge.util.d.ts +26 -0
- package/dist/types/app/core/schemas/ui-helper-registry.d.ts +16 -0
- package/dist/types/app/core/validation/ajv-custom.d.ts +15 -0
- package/dist/types/app/core/validation/capabilities.d.ts +18 -0
- package/dist/types/app/core/validation/error-formatter.d.ts +19 -0
- package/dist/types/app/core/validation/global-validation.service.d.ts +32 -0
- package/dist/types/app/core/validation/validation-errors-panel.d.ts +36 -0
- package/dist/types/app/data-preview.d.ts +7 -0
- package/dist/types/app/header-bar.d.ts +19 -0
- package/dist/types/app/jsonforms/constraints/constraint-resolvers.d.ts +50 -0
- package/dist/types/app/jsonforms/filters/code-list-filter-resolvers.d.ts +60 -0
- package/dist/types/app/jsonforms/registry/renderers.registry.d.ts +26 -0
- package/dist/types/app/jsonforms/renderers/controls/selects/animal-category/animal-category-select.renderer.d.ts +21 -0
- package/dist/types/app/jsonforms/renderers/controls/selects/code-list/code-list-select.renderer.d.ts +20 -0
- package/dist/types/app/jsonforms/renderers/layout/constraint/constraint-layout.renderer.d.ts +30 -0
- package/dist/types/app/jsonforms/renderers/layout/group/base-group.renderer.d.ts +29 -0
- package/dist/types/app/jsonforms/renderers/layout/group/card-group.renderer.d.ts +6 -0
- package/dist/types/app/jsonforms/renderers/layout/group/group-testers.d.ts +4 -0
- package/dist/types/app/jsonforms/renderers/layout/group/logical-group.renderer.d.ts +6 -0
- package/dist/types/app/jsonforms/renderers/layout/group/plain-group.renderer.d.ts +6 -0
- package/dist/types/app/jsonforms/shared/base-control/base-select-control.d.ts +16 -0
- package/dist/types/app/jsonforms/shared/option-sources/code-lists.d.ts +11 -0
- package/dist/types/app/jsonforms/shared/validation/field-error.service.d.ts +18 -0
- package/dist/types/app/welcome-page.d.ts +4 -0
- package/dist/types/public-api.d.ts +4 -0
- package/dist/types/shared/material-icons.d.ts +16 -0
- package/package.json +90 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
import { AnimalStockCategory, PageId } from '../navigation/navigation.service';
|
|
3
|
+
export interface EnrichedValidationError extends ErrorObject {
|
|
4
|
+
/** Human-friendly field label (e.g., "Animal Category") */
|
|
5
|
+
fieldLabel?: string;
|
|
6
|
+
/** Navigation target: page */
|
|
7
|
+
targetPage?: PageId;
|
|
8
|
+
/** Navigation target: animal stock array index */
|
|
9
|
+
targetAnimalStockIndex?: number;
|
|
10
|
+
/** Navigation target: detail category (tab) */
|
|
11
|
+
targetCategory?: AnimalStockCategory;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* GlobalValidationService
|
|
15
|
+
* Validates the entire NaebiData structure using the root JSON Schema + AJV.
|
|
16
|
+
* Consolidates errors and enriches them with navigation metadata for deep-linking.
|
|
17
|
+
*
|
|
18
|
+
* Usage: Inject in App or top-level components; errors() signal exposes enriched errors.
|
|
19
|
+
*/
|
|
20
|
+
export declare class GlobalValidationService {
|
|
21
|
+
private readonly dataSvc;
|
|
22
|
+
private readonly ajv;
|
|
23
|
+
private readonly validateFn;
|
|
24
|
+
private readonly rawErrors;
|
|
25
|
+
readonly errors: import("@angular/core").Signal<EnrichedValidationError[]>;
|
|
26
|
+
constructor();
|
|
27
|
+
validate(): void;
|
|
28
|
+
private consolidateErrors;
|
|
29
|
+
private enrichErrors;
|
|
30
|
+
private inferCategory;
|
|
31
|
+
private inferFieldLabel;
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
/**
|
|
3
|
+
* ValidationErrorsPanelComponent
|
|
4
|
+
* Reusable expansion panel summarizing & listing AJV validation issues.
|
|
5
|
+
* - Collapsed summary shows count + error icon.
|
|
6
|
+
* - Expands to list formatted, translated messages (stable ordering).
|
|
7
|
+
* - Hides entirely when there are no errors.
|
|
8
|
+
* - Emits `errorSelected` when user clicks an error (for navigation).
|
|
9
|
+
* Inputs:
|
|
10
|
+
* errors: ErrorObject[] (raw / consolidated) – consumer decides consolidation strategy.
|
|
11
|
+
* clickable: boolean – when true, list items are interactive and emit selection events.
|
|
12
|
+
* Outputs:
|
|
13
|
+
* errorSelected: ErrorObject – emitted when user clicks an error item.
|
|
14
|
+
*/
|
|
15
|
+
export declare class ValidationErrorsPanelComponent {
|
|
16
|
+
/** Raw (or already consolidated) AJV errors */
|
|
17
|
+
errors: import("@angular/core").InputSignal<ErrorObject<string, Record<string, any>, unknown>[] | null | undefined>;
|
|
18
|
+
/** When true, list items are clickable and emit errorSelected */
|
|
19
|
+
clickable: import("@angular/core").InputSignal<boolean>;
|
|
20
|
+
/** Emitted when user clicks an error (only if clickable is true) */
|
|
21
|
+
errorSelected: import("@angular/core").OutputEmitterRef<ErrorObject<string, Record<string, any>, unknown>>;
|
|
22
|
+
private readonly i18n;
|
|
23
|
+
expanded: import("@angular/core").WritableSignal<boolean>;
|
|
24
|
+
hasErrors: import("@angular/core").Signal<boolean>;
|
|
25
|
+
/** Stable sort: by instancePath then keyword for predictability */
|
|
26
|
+
private sortedErrors;
|
|
27
|
+
formattedItems: import("@angular/core").Signal<{
|
|
28
|
+
message: string;
|
|
29
|
+
field: string;
|
|
30
|
+
error: ErrorObject<string, Record<string, any>, unknown>;
|
|
31
|
+
}[]>;
|
|
32
|
+
issueCountLabel: import("@angular/core").Signal<string>;
|
|
33
|
+
panelAriaLabel: import("@angular/core").Signal<string>;
|
|
34
|
+
collapse(): void;
|
|
35
|
+
onErrorClick(error: ErrorObject): void;
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Locale } from './core/i18n/i18n.service';
|
|
2
|
+
import { PageId } from './core/navigation/navigation.service';
|
|
3
|
+
/**
|
|
4
|
+
* HeaderBarComponent
|
|
5
|
+
* - Displays application title, navigation buttons and a compact custom locale switcher.
|
|
6
|
+
* - Emits events via provided callback inputs (parent supplies functions) to avoid outputs overhead inside shadow root.
|
|
7
|
+
*/
|
|
8
|
+
export declare class HeaderBarComponent {
|
|
9
|
+
locale: import("@angular/core").InputSignal<Locale>;
|
|
10
|
+
currentPage: import("@angular/core").InputSignal<PageId>;
|
|
11
|
+
onNavigate: import("@angular/core").InputSignal<(page: PageId) => void>;
|
|
12
|
+
onLocaleChange: import("@angular/core").InputSignal<(locale: Locale) => void>;
|
|
13
|
+
readonly locales: Locale[];
|
|
14
|
+
menuOpen: import("@angular/core").WritableSignal<boolean>;
|
|
15
|
+
toggleMenu(event?: Event): void;
|
|
16
|
+
closeMenu(): void;
|
|
17
|
+
choose(locale: Locale): void;
|
|
18
|
+
navigate(page: PageId): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constraint resolver registry enabling UI schema elements to declare dynamic
|
|
3
|
+
* visibility rules referencing domain-specific predicates. A resolver is a
|
|
4
|
+
* pure function returning a boolean. It receives a contextual accessor for
|
|
5
|
+
* current form data (root object) plus master-data + locale.
|
|
6
|
+
*
|
|
7
|
+
* UI schema structured example:
|
|
8
|
+
* {
|
|
9
|
+
* "type": "Constraint",
|
|
10
|
+
* "options": {
|
|
11
|
+
* "constraint": {
|
|
12
|
+
* "resolver": "animalCategory_isPermittedForConcentratedFeedstuffSummering",
|
|
13
|
+
* "args": ["#/animalCategoryPRIF"],
|
|
14
|
+
* "fallbackVisible": false
|
|
15
|
+
* }
|
|
16
|
+
* },
|
|
17
|
+
* "elements": [ { "type": "Group", ... } ]
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
import { MasterDataService } from '../../core/master-data/master-data.service';
|
|
21
|
+
import { I18nService } from '../../core/i18n/i18n.service';
|
|
22
|
+
export interface ConstraintCall {
|
|
23
|
+
resolver: string;
|
|
24
|
+
args?: unknown[];
|
|
25
|
+
fallbackVisible?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export type ConstraintConfig = ConstraintCall;
|
|
28
|
+
export interface ConstraintContext {
|
|
29
|
+
/** Root data object from JSONForms state */
|
|
30
|
+
data: unknown;
|
|
31
|
+
/** Dereference a JSON Pointer (starts with '#/'); returns undefined if invalid */
|
|
32
|
+
get<T = unknown>(pointer: string): T | undefined;
|
|
33
|
+
/** Master-data service */
|
|
34
|
+
masterData: MasterDataService;
|
|
35
|
+
/** Current locale (from I18nService) */
|
|
36
|
+
locale: string;
|
|
37
|
+
}
|
|
38
|
+
export type ConstraintResolver = (ctx: ConstraintContext, ...args: any[]) => boolean;
|
|
39
|
+
export declare function registerConstraint(name: string, fn: ConstraintResolver): void;
|
|
40
|
+
/**
|
|
41
|
+
* Evaluate a constraint configuration.
|
|
42
|
+
* @param cfg constraint object (or undefined => visible)
|
|
43
|
+
* @param data current form data root
|
|
44
|
+
* @param services injected service wrappers
|
|
45
|
+
* @param ctxOverrides optional context override (testing/extensibility)
|
|
46
|
+
*/
|
|
47
|
+
export declare function evaluateConstraint(cfg: ConstraintConfig | undefined, data: unknown, services: {
|
|
48
|
+
masterData: MasterDataService;
|
|
49
|
+
i18n: I18nService;
|
|
50
|
+
}, ctxOverrides?: Partial<ConstraintContext>): boolean;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code list filtering engine & resolver registry.
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Allow UI schema controls rendering code list selects to declaratively
|
|
5
|
+
* filter the available options based on current form data (JSONForms), master data,
|
|
6
|
+
* locale, and arbitrary domain predicates – without baking domain logic into the
|
|
7
|
+
* generic select renderer.
|
|
8
|
+
*
|
|
9
|
+
* UI schema extension example (implicit generic filter using entryField/valueFrom):
|
|
10
|
+
* {
|
|
11
|
+
* "type": "Control",
|
|
12
|
+
* "scope": "#/properties/formOfDetention/properties/stall/properties/stableManureRemovalFrequency",
|
|
13
|
+
* "options": {
|
|
14
|
+
* "codeList": { "filter": { "entryField": "permittedForStableSystem", "valueFrom": "#/formOfDetention/stall/stableSystem", "fallback": "all" } }
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
*
|
|
18
|
+
* Named resolver example:
|
|
19
|
+
* "filter": { "resolver": "stableManureRemoval_permittedForSystem", "args": ["#/formOfDetention/stall/stableSystem"], "fallback": "all" }
|
|
20
|
+
*/
|
|
21
|
+
import { MasterDataService } from '../../core/master-data/master-data.service';
|
|
22
|
+
import { I18nService } from '../../core/i18n/i18n.service';
|
|
23
|
+
import { BaseCodeListEntry } from '../shared/option-sources/code-lists';
|
|
24
|
+
export interface FilterContext {
|
|
25
|
+
data: unknown;
|
|
26
|
+
get<T = unknown>(pointer: string): T | undefined;
|
|
27
|
+
masterData: MasterDataService;
|
|
28
|
+
locale: string;
|
|
29
|
+
i18n: I18nService;
|
|
30
|
+
}
|
|
31
|
+
export type CodeListFilterResolver = (ctx: FilterContext, entry: BaseCodeListEntry, ...args: any[]) => boolean;
|
|
32
|
+
export interface LeafFilterCall {
|
|
33
|
+
resolver?: string;
|
|
34
|
+
args?: unknown[];
|
|
35
|
+
entryField?: string;
|
|
36
|
+
valueFrom?: string;
|
|
37
|
+
fallback?: 'all' | 'none';
|
|
38
|
+
}
|
|
39
|
+
export type FilterConfig = LeafFilterCall | {
|
|
40
|
+
all: FilterConfig[];
|
|
41
|
+
fallback?: 'all' | 'none';
|
|
42
|
+
} | {
|
|
43
|
+
any: FilterConfig[];
|
|
44
|
+
fallback?: 'all' | 'none';
|
|
45
|
+
} | {
|
|
46
|
+
not: FilterConfig;
|
|
47
|
+
fallback?: 'all' | 'none';
|
|
48
|
+
} | {
|
|
49
|
+
true: boolean;
|
|
50
|
+
fallback?: 'all' | 'none';
|
|
51
|
+
};
|
|
52
|
+
export declare function registerCodeListFilter(name: string, fn: CodeListFilterResolver): void;
|
|
53
|
+
/**
|
|
54
|
+
* Public entry to filter a list. Returns the provided list unchanged if cfg is falsy or
|
|
55
|
+
* if top-level fallback === 'all' and an unrecoverable error occurs.
|
|
56
|
+
*/
|
|
57
|
+
export declare function evaluateFilter(list: BaseCodeListEntry[], cfg: FilterConfig | undefined, services: {
|
|
58
|
+
masterData: MasterDataService;
|
|
59
|
+
i18n: I18nService;
|
|
60
|
+
}, data: unknown): BaseCodeListEntry[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AnimalCategorySelectRenderer } from '../renderers/controls/selects/animal-category/animal-category-select.renderer';
|
|
2
|
+
import { CodeListSelectRenderer } from '../renderers/controls/selects/code-list/code-list-select.renderer';
|
|
3
|
+
import { CardGroupRenderer } from '../renderers/layout/group/card-group.renderer';
|
|
4
|
+
import { PlainGroupRenderer } from '../renderers/layout/group/plain-group.renderer';
|
|
5
|
+
import { LogicalGroupRenderer } from '../renderers/layout/group/logical-group.renderer';
|
|
6
|
+
import { RankedTester } from '@jsonforms/core';
|
|
7
|
+
import { ConstraintLayoutRenderer } from '../renderers/layout/constraint/constraint-layout.renderer';
|
|
8
|
+
export declare const CUSTOM_JSONFORMS_RENDERERS: ({
|
|
9
|
+
tester: RankedTester;
|
|
10
|
+
renderer: typeof ConstraintLayoutRenderer;
|
|
11
|
+
} | {
|
|
12
|
+
tester: RankedTester;
|
|
13
|
+
renderer: typeof CardGroupRenderer;
|
|
14
|
+
} | {
|
|
15
|
+
tester: RankedTester;
|
|
16
|
+
renderer: typeof PlainGroupRenderer;
|
|
17
|
+
} | {
|
|
18
|
+
tester: RankedTester;
|
|
19
|
+
renderer: typeof LogicalGroupRenderer;
|
|
20
|
+
} | {
|
|
21
|
+
tester: RankedTester;
|
|
22
|
+
renderer: typeof AnimalCategorySelectRenderer;
|
|
23
|
+
} | {
|
|
24
|
+
tester: RankedTester;
|
|
25
|
+
renderer: typeof CodeListSelectRenderer;
|
|
26
|
+
})[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
2
|
+
import { RankedTester } from '@jsonforms/core';
|
|
3
|
+
import { BaseSelectControl } from '../../../../shared/base-control/base-select-control';
|
|
4
|
+
interface AnimalCategoryPrifEntry {
|
|
5
|
+
id: number;
|
|
6
|
+
animalGroup?: string;
|
|
7
|
+
descriptor?: {
|
|
8
|
+
designation_ita?: string;
|
|
9
|
+
[k: string]: unknown;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare class AnimalCategorySelectRenderer extends BaseSelectControl<number> {
|
|
13
|
+
options: AnimalCategoryPrifEntry[];
|
|
14
|
+
private readonly masterData;
|
|
15
|
+
constructor(jsonFormsService: JsonFormsAngularService);
|
|
16
|
+
getEventValue: (event: any) => any;
|
|
17
|
+
optLabel(opt: AnimalCategoryPrifEntry): string;
|
|
18
|
+
onSelectionChange(value: number): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const animalCategorySelectTester: RankedTester;
|
|
21
|
+
export {};
|
package/dist/types/app/jsonforms/renderers/controls/selects/code-list/code-list-select.renderer.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Signal } from '@angular/core';
|
|
2
|
+
import { JsonFormsAngularService } from '@jsonforms/angular';
|
|
3
|
+
import { RankedTester } from '@jsonforms/core';
|
|
4
|
+
import { BaseSelectControl } from '../../../../shared/base-control/base-select-control';
|
|
5
|
+
import { BaseCodeListEntry } from '../../../../shared/option-sources/code-lists';
|
|
6
|
+
export declare class CodeListSelectRenderer extends BaseSelectControl<number | string> {
|
|
7
|
+
private readonly masterData;
|
|
8
|
+
private readonly i18n;
|
|
9
|
+
private readonly formData;
|
|
10
|
+
private controlKey;
|
|
11
|
+
private listKey;
|
|
12
|
+
readonly options: Signal<BaseCodeListEntry[]>;
|
|
13
|
+
private readonly filterConfig;
|
|
14
|
+
readonly filteredOptions: Signal<BaseCodeListEntry[]>;
|
|
15
|
+
constructor(jsonFormsService: JsonFormsAngularService);
|
|
16
|
+
getEventValue: (event: any) => any;
|
|
17
|
+
optionLabel(opt: BaseCodeListEntry): string;
|
|
18
|
+
onSelectionChange(value: number | string): void;
|
|
19
|
+
}
|
|
20
|
+
export declare const codeListSelectTester: RankedTester;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { JsonFormsBaseRenderer } from '@jsonforms/angular';
|
|
2
|
+
import { Layout } from '@jsonforms/core';
|
|
3
|
+
/**
|
|
4
|
+
* Layout renderer for a custom UI schema element:
|
|
5
|
+
* { type: 'Constraint', options: { constraint: { resolver, args } }, elements: [ ... ] }
|
|
6
|
+
*
|
|
7
|
+
* It conditionally instantiates its children based on a named constraint
|
|
8
|
+
* resolver (see constraint-resolvers.ts). No additional DOM wrapper is added;
|
|
9
|
+
* children participate directly in surrounding layout.
|
|
10
|
+
*/
|
|
11
|
+
export declare class ConstraintLayoutRenderer extends JsonFormsBaseRenderer<Layout> {
|
|
12
|
+
private readonly service;
|
|
13
|
+
private childrenHost?;
|
|
14
|
+
private subscription;
|
|
15
|
+
private _elements;
|
|
16
|
+
private _schema;
|
|
17
|
+
private _path;
|
|
18
|
+
private _renderers;
|
|
19
|
+
private _cells;
|
|
20
|
+
private _constraintCfg;
|
|
21
|
+
private readonly masterData;
|
|
22
|
+
private readonly i18n;
|
|
23
|
+
private visible;
|
|
24
|
+
/** Test-only helper (not used in templates). */
|
|
25
|
+
isVisibleForTest(): boolean;
|
|
26
|
+
ngOnInit(): void;
|
|
27
|
+
ngOnDestroy(): void;
|
|
28
|
+
private renderChildren;
|
|
29
|
+
private pickRenderer;
|
|
30
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ChangeDetectorRef, OnDestroy, OnInit, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import { GroupLayout, JsonFormsCellRendererRegistryEntry, JsonFormsRendererRegistryEntry } from '@jsonforms/core';
|
|
3
|
+
import { JsonFormsAngularService, JsonFormsBaseRenderer } from '@jsonforms/angular';
|
|
4
|
+
export declare class BaseGroupRenderer extends JsonFormsBaseRenderer<GroupLayout> implements OnInit, OnDestroy {
|
|
5
|
+
protected readonly service: JsonFormsAngularService;
|
|
6
|
+
protected readonly cdr: ChangeDetectorRef;
|
|
7
|
+
protected _hidden: import("@angular/core").WritableSignal<boolean>;
|
|
8
|
+
protected _label: import("@angular/core").WritableSignal<string | undefined>;
|
|
9
|
+
protected _elements: import("@angular/core").WritableSignal<import("@jsonforms/core").UISchemaElement[]>;
|
|
10
|
+
protected _schema: import("@angular/core").WritableSignal<any>;
|
|
11
|
+
protected _path: import("@angular/core").WritableSignal<string>;
|
|
12
|
+
protected _renderers: import("@angular/core").WritableSignal<JsonFormsRendererRegistryEntry[]>;
|
|
13
|
+
protected _cells: import("@angular/core").WritableSignal<JsonFormsCellRendererRegistryEntry[] | undefined>;
|
|
14
|
+
protected _id: string;
|
|
15
|
+
hidden(): boolean;
|
|
16
|
+
label(): string | undefined;
|
|
17
|
+
labelId(): string | null;
|
|
18
|
+
elements(): import("@jsonforms/core").UISchemaElement[];
|
|
19
|
+
get currentPath(): string;
|
|
20
|
+
get currentSchema(): any;
|
|
21
|
+
registryRenderers(): JsonFormsRendererRegistryEntry[];
|
|
22
|
+
registryCells(): JsonFormsCellRendererRegistryEntry[] | undefined;
|
|
23
|
+
private subscription;
|
|
24
|
+
ngOnInit(): void;
|
|
25
|
+
ngOnDestroy(): void;
|
|
26
|
+
protected resolveHost(): ViewContainerRef | undefined;
|
|
27
|
+
protected renderChildren(): void;
|
|
28
|
+
private pickRenderer;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight abstraction for select-like JsonForms controls.
|
|
4
|
+
* Provides a uniform selection change handler and validation trigger.
|
|
5
|
+
* Concrete subclasses supply template + option source + label logic.
|
|
6
|
+
*
|
|
7
|
+
* Also injects custom validation errors from FieldErrorService into the FormControl
|
|
8
|
+
* so Angular Material mat-error displays them automatically.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseSelectControl<TValue = number> extends JsonFormsControl {
|
|
11
|
+
constructor(jsonFormsService: JsonFormsAngularService);
|
|
12
|
+
/** Override if event value extraction differs */
|
|
13
|
+
getEventValue: (event: any) => any;
|
|
14
|
+
/** Invoke when the user picks a new value. */
|
|
15
|
+
protected commitValue(value: TValue): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BaseCodeListEntry {
|
|
2
|
+
id: number | string;
|
|
3
|
+
[k: string]: unknown;
|
|
4
|
+
descriptor?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare const CODE_LISTS: Record<string, BaseCodeListEntry[]>;
|
|
7
|
+
export declare const PATH_TO_LIST_KEY: Array<{
|
|
8
|
+
regex: RegExp;
|
|
9
|
+
key: keyof typeof CODE_LISTS;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function resolveCodeListKey(tail: string): string | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ErrorObject } from 'ajv';
|
|
2
|
+
/**
|
|
3
|
+
* Service to share validation errors from JSONForms across custom renderers.
|
|
4
|
+
* Allows renderers to display field-specific errors from custom AJV keywords.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FieldErrorService {
|
|
7
|
+
private readonly errors;
|
|
8
|
+
/** Update the global error list from JSONForms validation */
|
|
9
|
+
setErrors(errors: ErrorObject[] | null): void;
|
|
10
|
+
/** Get error message for a specific field path */
|
|
11
|
+
getErrorForPath(scopeOrInstancePath: string): string | null;
|
|
12
|
+
/** Get all errors for a specific field path */
|
|
13
|
+
getErrorsForPath(scopeOrInstancePath: string): ErrorObject[];
|
|
14
|
+
/** Clear all errors */
|
|
15
|
+
clearErrors(): void;
|
|
16
|
+
private normalizeScope;
|
|
17
|
+
private normalizeInstancePath;
|
|
18
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { NaebiData } from './app/core/data/naebi-data.service';
|
|
2
|
+
export type { Locale } from './app/core/i18n/i18n.service';
|
|
3
|
+
export type { PageId, AnimalStockCategory } from './app/core/navigation/navigation.service';
|
|
4
|
+
export type { EnrichedValidationError } from './app/core/validation/global-validation.service';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ensure the Material Icons stylesheet exists in the document <head> (SPA / non-shadow usage).
|
|
3
|
+
* Idempotent: returns immediately if DOM unavailable (SSR) or link already present.
|
|
4
|
+
*
|
|
5
|
+
* @param doc Optional document for testing / dependency injection.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ensureMaterialIconsInHead(doc?: Document): void;
|
|
8
|
+
/**
|
|
9
|
+
* Ensure the Material Icons stylesheet is available inside a ShadowRoot so that
|
|
10
|
+
* icon ligatures render when the component is embedded as a Web Component.
|
|
11
|
+
* We prepend so icons load early without disturbing existing adopted stylesheets.
|
|
12
|
+
* Idempotent: guarded by a custom attribute selector.
|
|
13
|
+
*
|
|
14
|
+
* @param shadow Target ShadowRoot; silently no-ops if null/undefined or DOM unavailable.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ensureMaterialIconsInShadow(shadow: ShadowRoot | null | undefined): void;
|
package/package.json
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agridea/suibi-module",
|
|
3
|
+
"version": "0.1.0-preview.8",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"ng": "ng",
|
|
6
|
+
"start": "ng serve --host 0.0.0.0",
|
|
7
|
+
"build": "ng build",
|
|
8
|
+
"watch": "ng build --watch --configuration development",
|
|
9
|
+
"test": "CHROME_BIN=${CHROME_BIN:-/usr/bin/chromium} ng test --browsers=ChromeHeadless --watch=false",
|
|
10
|
+
"test:chrome": "CHROME_BIN=${CHROME_BIN:-/usr/bin/chromium} ng test --browsers=Chrome --watch=false",
|
|
11
|
+
"test:headless": "CHROME_BIN=${CHROME_BIN:-/usr/bin/chromium} ng test --browsers=ChromeHeadless --watch=false --no-progress",
|
|
12
|
+
"test:ci": "CI=true CHROME_BIN=${CHROME_BIN:-/usr/bin/chromium} ng test --browsers=ChromeHeadless --watch=false --no-progress",
|
|
13
|
+
"build:wc": "ng build --configuration elements && node scripts/alias-wc-bundle.mjs && npm run build:types",
|
|
14
|
+
"build:wc:dev": "ng build --configuration elements-dev",
|
|
15
|
+
"watch:wc": "bash -c 'node scripts/alias-wc-watch.mjs & ng build --configuration elements --watch'",
|
|
16
|
+
"watch:wc:dev": "bash -c 'node scripts/alias-wc-watch.mjs & ng build --configuration elements-dev --watch'",
|
|
17
|
+
"preserve:wc-demo": "npm run build:wc",
|
|
18
|
+
"serve:wc-demo": "http-server ./dist/elements/browser -o /demo/ -c-",
|
|
19
|
+
"serve:wc-demo:watch": "bash -c 'npm run watch:wc:dev & http-server ./dist/elements/browser -o /demo/ -c-'",
|
|
20
|
+
"build:types": "tsc -p tsconfig.types.json",
|
|
21
|
+
"md:fetch": "tsx scripts/master-data/fetch.ts",
|
|
22
|
+
"md:list": "tsx scripts/master-data/list.ts"
|
|
23
|
+
},
|
|
24
|
+
"prettier": {
|
|
25
|
+
"printWidth": 100,
|
|
26
|
+
"singleQuote": true,
|
|
27
|
+
"overrides": [
|
|
28
|
+
{
|
|
29
|
+
"files": "*.html",
|
|
30
|
+
"options": {
|
|
31
|
+
"parser": "angular"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"files": [
|
|
38
|
+
"dist/elements/browser/*.js",
|
|
39
|
+
"dist/elements/browser/*.css",
|
|
40
|
+
"dist/elements/browser/version.txt",
|
|
41
|
+
"dist/types/**/*",
|
|
42
|
+
"LICENSE",
|
|
43
|
+
"README.md"
|
|
44
|
+
],
|
|
45
|
+
"types": "dist/types/public-api.d.ts",
|
|
46
|
+
"exports": {
|
|
47
|
+
".": {
|
|
48
|
+
"types": "./dist/types/public-api.d.ts",
|
|
49
|
+
"default": "./dist/elements/browser/main.js"
|
|
50
|
+
},
|
|
51
|
+
"./wc": "./dist/elements/browser/main.js",
|
|
52
|
+
"./styles.css": "./dist/elements/browser/styles.css"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"registry": "https://registry.npmjs.org",
|
|
56
|
+
"access": "public"
|
|
57
|
+
},
|
|
58
|
+
"dependencies": {
|
|
59
|
+
"@angular/common": "^20.2.4",
|
|
60
|
+
"@angular/compiler": "^20.2.4",
|
|
61
|
+
"@angular/core": "^20.2.4",
|
|
62
|
+
"@angular/elements": "^20.2.4",
|
|
63
|
+
"@angular/forms": "^20.2.4",
|
|
64
|
+
"@angular/localize": "^20.2.4",
|
|
65
|
+
"@angular/material": "20.2.2",
|
|
66
|
+
"@angular/platform-browser": "^20.2.4",
|
|
67
|
+
"@angular/router": "^20.2.4",
|
|
68
|
+
"@jsonforms/angular": "^3.6.0",
|
|
69
|
+
"@jsonforms/angular-material": "^3.6.0",
|
|
70
|
+
"@jsonforms/core": "^3.6.0",
|
|
71
|
+
"rxjs": "~7.8.0",
|
|
72
|
+
"tslib": "^2.3.0"
|
|
73
|
+
},
|
|
74
|
+
"devDependencies": {
|
|
75
|
+
"@angular/build": "^20.2.2",
|
|
76
|
+
"@angular/cli": "^20.2.2",
|
|
77
|
+
"@angular/compiler-cli": "^20.2.4",
|
|
78
|
+
"@types/jasmine": "~5.1.0",
|
|
79
|
+
"http-server": "^14.1.1",
|
|
80
|
+
"jasmine-core": "~5.9.0",
|
|
81
|
+
"karma": "~6.4.0",
|
|
82
|
+
"karma-chrome-launcher": "~3.2.0",
|
|
83
|
+
"karma-coverage": "~2.2.0",
|
|
84
|
+
"karma-jasmine": "~5.1.0",
|
|
85
|
+
"karma-jasmine-html-reporter": "~2.1.0",
|
|
86
|
+
"ts-node": "^10.9.2",
|
|
87
|
+
"tsx": "^4.20.5",
|
|
88
|
+
"typescript": "~5.9.2"
|
|
89
|
+
}
|
|
90
|
+
}
|