ngx-dynamic-entity 0.0.1 → 1.0.0

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.
Files changed (84) hide show
  1. package/README.md +139 -0
  2. package/esm2022/lib/field-types/array-field.component.mjs +160 -0
  3. package/esm2022/lib/field-types/boolean-field.component.mjs +100 -0
  4. package/esm2022/lib/field-types/checkbox-field.component.mjs +49 -41
  5. package/esm2022/lib/field-types/currency-field.component.mjs +101 -0
  6. package/esm2022/lib/field-types/date-field.component.mjs +47 -39
  7. package/esm2022/lib/field-types/dropdown-field.component.mjs +145 -54
  8. package/esm2022/lib/field-types/email-field.component.mjs +101 -0
  9. package/esm2022/lib/field-types/entity-ref-field.component.mjs +134 -70
  10. package/esm2022/lib/field-types/file-field.component.mjs +156 -0
  11. package/esm2022/lib/field-types/group-field.component.mjs +89 -0
  12. package/esm2022/lib/field-types/image-field.component.mjs +168 -0
  13. package/esm2022/lib/field-types/month-year-field.component.mjs +151 -0
  14. package/esm2022/lib/field-types/multi-select-field.component.mjs +110 -56
  15. package/esm2022/lib/field-types/number-field.component.mjs +84 -41
  16. package/esm2022/lib/field-types/password-field.component.mjs +109 -0
  17. package/esm2022/lib/field-types/radio-field.component.mjs +152 -0
  18. package/esm2022/lib/field-types/text-field.component.mjs +82 -42
  19. package/esm2022/lib/field-types/textarea-field.component.mjs +52 -41
  20. package/esm2022/lib/form/dynamic-field/dynamic-field.component.mjs +44 -26
  21. package/esm2022/lib/form/dynamic-form.component.mjs +501 -67
  22. package/esm2022/lib/form/dynamic-record-form.component.mjs +469 -0
  23. package/esm2022/lib/providers/provide-field-types.mjs +72 -0
  24. package/esm2022/lib/providers/provide-ngx-dynamic-entity.mjs +3 -5
  25. package/esm2022/lib/services/cascade-data.service.mjs +129 -0
  26. package/esm2022/lib/services/config-source.service.mjs +67 -0
  27. package/esm2022/lib/services/entity-ref-cache.mjs +20 -0
  28. package/esm2022/lib/services/entity-ref-registry.service.mjs +3 -3
  29. package/esm2022/lib/services/entity-ref-selection.service.mjs +27 -0
  30. package/esm2022/lib/services/entity-reference.service.mjs +168 -0
  31. package/esm2022/lib/services/field-registry.service.mjs +35 -30
  32. package/esm2022/lib/services/file-upload.service.mjs +89 -0
  33. package/esm2022/lib/services/lookup-registry.service.mjs +246 -0
  34. package/esm2022/lib/services/rbac.service.mjs +5 -11
  35. package/esm2022/lib/services/rules-evaluation.service.mjs +27 -0
  36. package/esm2022/lib/services/validator-registry.service.mjs +24 -7
  37. package/esm2022/lib/tokens/injection-tokens.mjs +88 -7
  38. package/esm2022/public-api.mjs +14 -5
  39. package/fesm2022/ngx-dynamic-entity.mjs +3985 -876
  40. package/fesm2022/ngx-dynamic-entity.mjs.map +1 -1
  41. package/lib/field-types/array-field.component.d.ts +22 -0
  42. package/lib/field-types/boolean-field.component.d.ts +18 -0
  43. package/lib/field-types/checkbox-field.component.d.ts +3 -2
  44. package/lib/field-types/currency-field.component.d.ts +17 -0
  45. package/lib/field-types/date-field.component.d.ts +3 -2
  46. package/lib/field-types/dropdown-field.component.d.ts +24 -4
  47. package/lib/field-types/email-field.component.d.ts +15 -0
  48. package/lib/field-types/entity-ref-field.component.d.ts +24 -11
  49. package/lib/field-types/file-field.component.d.ts +25 -0
  50. package/lib/field-types/group-field.component.d.ts +17 -0
  51. package/lib/field-types/image-field.component.d.ts +30 -0
  52. package/lib/field-types/month-year-field.component.d.ts +28 -0
  53. package/lib/field-types/multi-select-field.component.d.ts +18 -4
  54. package/lib/field-types/number-field.component.d.ts +5 -2
  55. package/lib/field-types/password-field.component.d.ts +17 -0
  56. package/lib/field-types/radio-field.component.d.ts +33 -0
  57. package/lib/field-types/text-field.component.d.ts +5 -3
  58. package/lib/field-types/textarea-field.component.d.ts +4 -2
  59. package/lib/form/dynamic-field/dynamic-field.component.d.ts +20 -7
  60. package/lib/form/dynamic-form.component.d.ts +111 -19
  61. package/lib/form/dynamic-record-form.component.d.ts +169 -0
  62. package/lib/providers/provide-field-types.d.ts +24 -0
  63. package/lib/providers/provide-ngx-dynamic-entity.d.ts +12 -7
  64. package/lib/services/cascade-data.service.d.ts +45 -0
  65. package/lib/services/config-source.service.d.ts +14 -0
  66. package/lib/services/entity-ref-cache.d.ts +27 -0
  67. package/lib/services/entity-ref-registry.service.d.ts +4 -3
  68. package/lib/services/entity-ref-selection.service.d.ts +24 -0
  69. package/lib/services/entity-reference.service.d.ts +49 -0
  70. package/lib/services/field-registry.service.d.ts +17 -7
  71. package/lib/services/file-upload.service.d.ts +27 -0
  72. package/lib/services/lookup-registry.service.d.ts +94 -0
  73. package/lib/services/rbac.service.d.ts +4 -9
  74. package/lib/services/rules-evaluation.service.d.ts +17 -0
  75. package/lib/services/validator-registry.service.d.ts +5 -4
  76. package/lib/tokens/injection-tokens.d.ts +90 -7
  77. package/package.json +14 -3
  78. package/public-api.d.ts +11 -4
  79. package/esm2022/lib/services/config.service.mjs +0 -58
  80. package/esm2022/lib/services/version.service.mjs +0 -40
  81. package/esm2022/lib/table/dynamic-table.component.mjs +0 -160
  82. package/lib/services/config.service.d.ts +0 -25
  83. package/lib/services/version.service.d.ts +0 -26
  84. package/lib/table/dynamic-table.component.d.ts +0 -56
@@ -0,0 +1,94 @@
1
+ import { type WritableSignal } from '@angular/core';
2
+ import type { DropdownOption, LookupListValue, NestedFieldConfig } from '@dynamic-entity/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * LookupRegistryService — the cache in front of consumer-registered master lists.
6
+ *
7
+ * Three layers, deliberately the same shape as `EntityReferenceService`, because the problem is
8
+ * the same: one list is typically used by many fields across many entities.
9
+ * 1. **options** — resolved `DropdownOption[]` per (list name, lang).
10
+ * 2. **in-flight** — the pending Promise, so N fields on one list trigger one load, not N.
11
+ * 3. **labels** — synchronous value → text (parity plan §6.2). This is not a nicety: since
12
+ * `viewMode` defaults to true a record opens read-only, so rendering a stored value as
13
+ * text is the *first* thing a `listName` field has to do. An async-only registry would
14
+ * paint the raw stored value and then flip, on every record open.
15
+ *
16
+ * A failed load rejects and caches nothing, so one transient error does not serve an empty
17
+ * list forever — the same fix made for entity references in phase 5.
18
+ */
19
+ export declare class LookupRegistryService {
20
+ private readonly registry;
21
+ /** `listName|lang` -> resolved options. */
22
+ private readonly options;
23
+ /** `listName|lang` -> normalised values, so a consumer can reach `code` / `isSystemDefined`. */
24
+ private readonly values;
25
+ /** Loads in progress, keyed as above. */
26
+ private readonly inFlight;
27
+ /** `listName|lang|text` -> display text, for the synchronous read-only path. */
28
+ private readonly labels;
29
+ has(listName: string): boolean;
30
+ /**
31
+ * Options for a named list, from cache when present.
32
+ * Concurrent callers with the same key share one load.
33
+ */
34
+ load(listName: string, lang?: string): Promise<DropdownOption[]>;
35
+ /** Cached options without triggering a load. `undefined` when not loaded. */
36
+ peek(listName: string, lang?: string): DropdownOption[] | undefined;
37
+ /**
38
+ * Cached list values, carrying `_id`, `code`, `isSystemDefined` and `from`.
39
+ * The library never reads those; this is the seam for a consumer that needs them.
40
+ */
41
+ valuesFor(listName: string, lang?: string): LookupListValue[] | undefined;
42
+ /**
43
+ * Display text for a stored value, synchronously. `undefined` when the list has not loaded
44
+ * or holds no matching value — the caller keeps its own fallback, which is the stored text.
45
+ *
46
+ * Every language of an option is indexed, so a record saved under one language renders in
47
+ * another: a value stored as `'Aktiv'` resolves to `'Active'` under `lang: 'en'`.
48
+ */
49
+ labelFor(listName: string | undefined, value: unknown, lang?: string): string | undefined;
50
+ /** True when this field's options have to come from the registry. */
51
+ needsResolve(field: NestedFieldConfig | undefined): boolean;
52
+ /**
53
+ * The options to render right now, without awaiting: inline options, else whatever the
54
+ * registry already holds. Empty on a cold miss — pair with `resolveOptions`.
55
+ */
56
+ optionsFor(field: NestedFieldConfig | undefined, lang?: string): DropdownOption[];
57
+ /** The options for a field, loading the named list if needed. */
58
+ resolveOptions(field: NestedFieldConfig | undefined, lang?: string): Promise<DropdownOption[]>;
59
+ /** Drop everything cached for one list, leaving other lists intact. */
60
+ invalidate(listName: string): void;
61
+ clear(): void;
62
+ private cacheKey;
63
+ private labelKey;
64
+ /** Index an option under every language it carries, so any stored spelling finds it. */
65
+ private rememberLabels;
66
+ /** The texts a stored value could have been indexed under. */
67
+ private candidateTexts;
68
+ private invoke;
69
+ private toPromise;
70
+ private isSubscribable;
71
+ static ɵfac: i0.ɵɵFactoryDeclaration<LookupRegistryService, never>;
72
+ static ɵprov: i0.ɵɵInjectableDeclaration<LookupRegistryService>;
73
+ }
74
+ /** A choice field component, as far as option resolution is concerned. */
75
+ export interface ChoiceOptionHost {
76
+ readonly field: NestedFieldConfig | undefined;
77
+ readonly language: string;
78
+ readonly options: WritableSignal<DropdownOption[]>;
79
+ }
80
+ /**
81
+ * Point a choice component's `options` signal at the right source (parity plan §6.3).
82
+ *
83
+ * Called from the `field` / `language` input setters of `dropdown`, `radio` and `multiSelect` —
84
+ * the wiring is theirs, the decision is the service's, which is what keeps the ADR-008
85
+ * five-input contract intact: options are never pushed in as a sixth input.
86
+ *
87
+ * Setters rather than `ngOnChanges` on purpose. `ngOnChanges` only fires for inputs Angular
88
+ * itself sets, so a component whose `field` is assigned directly — which the field specs do,
89
+ * and any consumer holding a `ComponentRef` may do — would render no options at all.
90
+ *
91
+ * Paints synchronously first (inline options, or a warm list), then fills in when a cold list
92
+ * lands. The late result is dropped if the field or language changed while it was in flight.
93
+ */
94
+ export declare function refreshChoiceOptions(host: ChoiceOptionHost, lookups: LookupRegistryService): void;
@@ -1,9 +1,7 @@
1
- import type { EntityConfig, FieldConfig, TabConfig } from '@dynamic-entity/core';
1
+ import type { EntityFormConfig, NestedFieldConfig, NestedTabConfig } from '@dynamic-entity/core';
2
2
  import * as i0 from "@angular/core";
3
3
  /**
4
4
  * RbacService — ALL permission checks and masking logic live here.
5
- * CRITICAL SYNC: resolveEffectiveMask() must be identical to rbac.utils.js in dynamic-entity-server.
6
- * Changing one without the other is a critical production bug (ADR-003).
7
5
  */
8
6
  export declare class RbacService {
9
7
  private readonly maskedRoles;
@@ -12,17 +10,14 @@ export declare class RbacService {
12
10
  * hasPermission(roles, undefined) → true (no restriction).
13
11
  */
14
12
  hasPermission(userRoles: string[], requiredRoles?: string[]): boolean;
15
- /**
16
- * ADR-003: 3-level OR resolution.
17
- * MUST match rbac.utils.js resolveEffectiveMask() exactly.
18
- */
13
+ /** 3-level OR resolution */
19
14
  resolveEffectiveMask(formMask?: boolean, tabMask?: boolean, fieldMask?: boolean): boolean;
20
15
  /** Check if the user's roles include any masked role */
21
16
  isUserMaskedRole(userRoles: string[]): boolean;
22
17
  /** Determine if a specific field should be masked for this user */
23
- shouldMaskField(field: FieldConfig, tab: TabConfig | undefined, config: EntityConfig, userRoles: string[]): boolean;
18
+ shouldMaskField(field: NestedFieldConfig, tab: NestedTabConfig | undefined, config: EntityFormConfig, userRoles: string[]): boolean;
24
19
  /** Get view/edit/delete permissions for a config */
25
- getPermissions(config: EntityConfig, userRoles: string[]): {
20
+ getPermissions(config: EntityFormConfig, userRoles: string[]): {
26
21
  canView: boolean;
27
22
  canEdit: boolean;
28
23
  canDelete: boolean;
@@ -0,0 +1,17 @@
1
+ import type { EntityFormConfig, FormRule, RuleEvaluationResult } from '@dynamic-entity/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * RulesEvaluationService — evaluates dynamic form rules against active reactive form state.
5
+ */
6
+ export declare class RulesEvaluationService {
7
+ /**
8
+ * Evaluate rules against form values and optional original baseline values.
9
+ */
10
+ evaluate(rules: FormRule[] | undefined | null, values: Record<string, unknown>, originalValues?: Record<string, unknown>): RuleEvaluationResult;
11
+ /**
12
+ * Filter rules pertinent to a single tab.
13
+ */
14
+ filterForTab(rules: FormRule[] | undefined | null, tabId: string, config: EntityFormConfig): FormRule[];
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<RulesEvaluationService, never>;
16
+ static ɵprov: i0.ɵɵInjectableDeclaration<RulesEvaluationService>;
17
+ }
@@ -1,19 +1,20 @@
1
1
  import { ValidatorFn } from '@angular/forms';
2
+ import type { FieldValidators } from '@dynamic-entity/core';
2
3
  import * as i0 from "@angular/core";
3
4
  /**
4
- * ValidatorRegistryService — resolves validator key strings to Angular ValidatorFns.
5
- * Built-in validators: 'required', 'email', 'min:N', 'max:N', 'minLength:N', 'maxLength:N'.
6
- * Consumers can register custom validators via provideNgxDynamicEntity({ validators: {...} }).
5
+ * ValidatorRegistryService — resolves validator configs / key strings to Angular ValidatorFns.
7
6
  */
8
7
  export declare class ValidatorRegistryService {
9
8
  private readonly consumerRegistry;
10
9
  /**
11
- * Resolve a validator key to a ValidatorFn.
10
+ * Resolve a validator key string to a ValidatorFn.
12
11
  * Supports parameterized built-ins like 'min:0', 'maxLength:255'.
13
12
  */
14
13
  resolve(validatorKey: string): ValidatorFn | null;
15
14
  /** Resolve multiple validator keys into a ValidatorFn[] */
16
15
  resolveAll(validatorKeys?: string[]): ValidatorFn[];
16
+ /** Resolve a FieldValidators object or string[] into ValidatorFn[] */
17
+ resolveFromConfig(config?: FieldValidators | string[]): ValidatorFn[];
17
18
  static ɵfac: i0.ɵɵFactoryDeclaration<ValidatorRegistryService, never>;
18
19
  static ɵprov: i0.ɵɵInjectableDeclaration<ValidatorRegistryService>;
19
20
  }
@@ -1,16 +1,99 @@
1
1
  import { InjectionToken } from '@angular/core';
2
2
  import type { Type } from '@angular/core';
3
- /** Base URL for the dynamic-entity-server API */
4
- export declare const DYNAMIC_ENTITY_API_URL: InjectionToken<string>;
3
+ import type { CommonModuleEntry, EntityReferenceLoader, FileUploadHandler, LookupListSource } from '@dynamic-entity/core';
4
+ import { type EntityRefCacheStore } from '../services/entity-ref-cache';
5
5
  /** Roles that see XXXXXXXXX for masked fields (ADR-003) */
6
6
  export declare const MASKED_ROLES: InjectionToken<string[]>;
7
- /** Migration strategy for the frontend — 'strict' | 'graceful' only (ADR-005, never 'auto') */
8
- export declare const MIGRATION_STRATEGY: InjectionToken<"strict" | "graceful">;
9
- /** Registry: fieldType string → Angular component class */
7
+ /**
8
+ * Consumer **overrides**: fieldType string → Angular component class.
9
+ * Highest priority — beats anything registered through `provideFieldTypes()`.
10
+ */
10
11
  export declare const FIELD_TYPE_REGISTRY: InjectionToken<Map<string, Type<any>>>;
11
- /** Registry: entity key → async () => options[] loader function */
12
- export declare const ENTITY_REF_REGISTRY: InjectionToken<Map<string, () => Promise<any[]>>>;
12
+ /**
13
+ * Multi-provider of field-type sets, contributed by `provideFieldTypes()` /
14
+ * `provideBuiltInFieldTypes()`. Multi so several calls compose instead of clobbering;
15
+ * later sets win on key collision. This is the seam that keeps unused field components
16
+ * out of the bundle — nothing is imported until a set names it.
17
+ */
18
+ export declare const FIELD_TYPE_SETS: InjectionToken<Record<string, Type<any>>[]>;
19
+ /**
20
+ * Registry: entity key → option loader.
21
+ *
22
+ * A loader receives a `ReferenceLoaderContext` (`parentValue`, `filters`, `lang`) and may
23
+ * return an array, a Promise, or an Observable of `ReferenceOption[]`. `ctx` is optional,
24
+ * so a zero-arg loader (`() => svc.list()`) is still a valid registration.
25
+ */
26
+ export declare const ENTITY_REF_REGISTRY: InjectionToken<Map<string, EntityReferenceLoader>>;
27
+ /**
28
+ * Registry: list name → the values of a named master list (`field.listName`).
29
+ *
30
+ * A source may be the values themselves (array / Promise / Observable) or a **loader function**,
31
+ * which is what you want for anything fetched: a bare Promise is created when the provider is
32
+ * built, so every list would load whether or not a form uses it.
33
+ *
34
+ * Values are normalised by `normalizeLookupValues` — bare strings and `LocalizedText` are
35
+ * accepted alongside the full `{ code, name, sortOrder }` shape.
36
+ *
37
+ * @example
38
+ * provideNgxDynamicEntity({
39
+ * lookups: {
40
+ * employeeStatus: () => listService.getByName('employeeStatus'),
41
+ * grades: ['Junior', 'Senior'],
42
+ * },
43
+ * })
44
+ */
45
+ export declare const LOOKUP_REGISTRY: InjectionToken<Map<string, LookupListSource>>;
13
46
  /** Registry: validator key → ValidatorFn */
14
47
  export declare const VALIDATOR_REGISTRY: InjectionToken<Map<string, any>>;
15
48
  /** Registry: hook key → async (data, context) => data */
16
49
  export declare const HOOK_REGISTRY: InjectionToken<Map<string, Function>>;
50
+ /**
51
+ * Consumer-registered list of common module tabs (documents, audit, tasks, etc.).
52
+ * The library ships no built-in implementations. Consumers provide their own list
53
+ * so the builder's module-picker and the renderer's tab switcher know what's available.
54
+ *
55
+ * @example
56
+ * providers: [
57
+ * {
58
+ * provide: COMMON_MODULES_REGISTRY,
59
+ * useValue: [
60
+ * { id: 'documents', label: { en: 'Documents' }, component: 'app-documents-view' },
61
+ * { id: 'audit', label: { en: 'Audit Log' }, component: 'app-audit' },
62
+ * ] satisfies CommonModuleEntry[]
63
+ * }
64
+ * ]
65
+ */
66
+ export declare const COMMON_MODULES_REGISTRY: InjectionToken<CommonModuleEntry[]>;
67
+ /**
68
+ * Consumer-provided file/image upload handler.
69
+ * When supplied, image-field and file-field call it to persist the File and receive a stable
70
+ * URL back. Without it the field stores `{ file, name, size, mimeType }` for the consumer to
71
+ * upload on submit. May return the result directly, as a Promise, or as an Observable.
72
+ *
73
+ * @example
74
+ * { provide: UPLOAD_HANDLER, useFactory: () => (file: File) => myUploadService.upload(file) }
75
+ */
76
+ export declare const UPLOAD_HANDLER: InjectionToken<FileUploadHandler>;
77
+ /**
78
+ * Backing store for the entity-reference options cache. Defaults to in-memory.
79
+ * Provide your own to make the cache outlive a page refresh.
80
+ *
81
+ * @example
82
+ * { provide: ENTITY_REF_CACHE_STORE, useClass: SessionStorageRefCache }
83
+ */
84
+ export declare const ENTITY_REF_CACHE_STORE: InjectionToken<EntityRefCacheStore>;
85
+ /**
86
+ * Consumer-provided predicate function to check whether user roles can edit system default tabs or fields.
87
+ * Defaults to allowing edits if not provided.
88
+ */
89
+ /**
90
+ * Consumer-provided predicate function to check whether user roles can edit system default tabs or fields.
91
+ * Defaults to allowing edits if not provided.
92
+ */
93
+ export declare const SYSTEM_DEFAULT_CAN_EDIT: InjectionToken<(roles: string[]) => boolean>;
94
+ export type ConfigSourceHandler = (entityKey: string) => any;
95
+ /**
96
+ * Registry/Resolver for resolving an EntityFormConfig by entity key across entities (Phase 8).
97
+ * Enables cross-entity field referencing (`isReferenced`, `referencedEntityKey`, `referencedFieldId`, `hasDrift`).
98
+ */
99
+ export declare const CONFIG_SOURCE: InjectionToken<ConfigSourceHandler>;
package/package.json CHANGED
@@ -1,14 +1,26 @@
1
1
  {
2
2
  "name": "ngx-dynamic-entity",
3
- "version": "0.0.1",
3
+ "version": "1.0.0",
4
4
  "description": "Angular 17 standalone UI library for dynamic entity forms and tables.",
5
+ "typings": "index.d.ts",
6
+ "main": "./dist/fesm2022/ngx-dynamic-entity.mjs",
5
7
  "peerDependencies": {
8
+ "@angular/cdk": "^17.0.0",
6
9
  "@angular/common": "^17.0.0",
7
10
  "@angular/core": "^17.0.0",
8
11
  "@angular/forms": "^17.0.0",
9
- "@dynamic-entity/core": "0.0.1",
12
+ "@angular/material": "^17.0.0",
13
+ "@dynamic-entity/core": "^1.0.0",
10
14
  "rxjs": "^7.0.0"
11
15
  },
16
+ "peerDependenciesMeta": {
17
+ "@angular/cdk": {
18
+ "optional": true
19
+ },
20
+ "@angular/material": {
21
+ "optional": true
22
+ }
23
+ },
12
24
  "keywords": [
13
25
  "angular",
14
26
  "dynamic-entity",
@@ -19,7 +31,6 @@
19
31
  "license": "MIT",
20
32
  "sideEffects": false,
21
33
  "module": "fesm2022/ngx-dynamic-entity.mjs",
22
- "typings": "index.d.ts",
23
34
  "exports": {
24
35
  "./package.json": {
25
36
  "default": "./package.json"
package/public-api.d.ts CHANGED
@@ -1,15 +1,21 @@
1
1
  export * from './lib/tokens/injection-tokens';
2
2
  export * from './lib/providers/provide-ngx-dynamic-entity';
3
- export * from './lib/services/config.service';
3
+ export * from './lib/providers/provide-field-types';
4
4
  export * from './lib/services/field-registry.service';
5
5
  export * from './lib/services/hook-registry.service';
6
6
  export * from './lib/services/validator-registry.service';
7
7
  export * from './lib/services/entity-ref-registry.service';
8
- export * from './lib/services/version.service';
8
+ export * from './lib/services/entity-ref-selection.service';
9
+ export * from './lib/services/cascade-data.service';
10
+ export * from './lib/services/entity-reference.service';
11
+ export * from './lib/services/entity-ref-cache';
12
+ export * from './lib/services/lookup-registry.service';
9
13
  export * from './lib/services/rbac.service';
14
+ export * from './lib/services/rules-evaluation.service';
15
+ export * from './lib/services/config-source.service';
10
16
  export * from './lib/form/dynamic-form.component';
17
+ export * from './lib/form/dynamic-record-form.component';
11
18
  export * from './lib/form/dynamic-field/dynamic-field.component';
12
- export * from './lib/table/dynamic-table.component';
13
19
  export * from './lib/field-types/text-field.component';
14
20
  export * from './lib/field-types/textarea-field.component';
15
21
  export * from './lib/field-types/number-field.component';
@@ -18,4 +24,5 @@ export * from './lib/field-types/date-field.component';
18
24
  export * from './lib/field-types/dropdown-field.component';
19
25
  export * from './lib/field-types/multi-select-field.component';
20
26
  export * from './lib/field-types/entity-ref-field.component';
21
- export type { EntityConfig, FieldConfig, TabConfig, DropdownOption, FieldDependency, EntityHooks, VersionedRecord, EntityPermissions, RbacContext, MigrationStrategy, QueryOptions, PaginatedResult, } from '@dynamic-entity/core';
27
+ export { resolveLabel, resolveOptionLabel, resolveOptionValue, formatDisplayValue, valuesMatch, normalizeOption, normalizeConfig, } from '@dynamic-entity/core';
28
+ export type { EntityFormConfig, NestedTabConfig, NestedFieldConfig, FieldTableConfig, RichFieldType, LocalizedText, DropdownOption, VersionedRecord, EntityPermissions, RbacContext, FieldValidators, EntityReferenceConfig, EntityReferenceLoader, ReferenceOption, ReferenceLoaderContext, AutoPatchConfig, PatchOnTrueMapping, FileRef, FormRule, RuleCondition, RuleAction, RuleEvaluationResult, CommonModuleEntry, } from '@dynamic-entity/core';
@@ -1,58 +0,0 @@
1
- import { Injectable, inject } from '@angular/core';
2
- import { HttpClient } from '@angular/common/http';
3
- import { map, shareReplay } from 'rxjs/operators';
4
- import { DYNAMIC_ENTITY_API_URL } from '../tokens/injection-tokens';
5
- import * as i0 from "@angular/core";
6
- /**
7
- * ConfigService — fetches entity configs from the dynamic-entity-server API.
8
- * Uses shareReplay(1) to cache per config key — avoids duplicate HTTP requests.
9
- * Following ONEHERMES smart service pattern: Observable$ + shareReplay.
10
- */
11
- export class ConfigService {
12
- http = inject(HttpClient);
13
- apiUrl = inject(DYNAMIC_ENTITY_API_URL, { optional: true }) ?? '';
14
- cache = new Map();
15
- /** Get a config by entity key. Cached via shareReplay(1). */
16
- getConfig(entity) {
17
- if (!this.cache.has(entity)) {
18
- const config$ = this.http
19
- .get(`${this.apiUrl}/config/${entity}`)
20
- .pipe(map(res => res.data), // ADR-004: Success guarantees data
21
- shareReplay(1));
22
- this.cache.set(entity, config$);
23
- }
24
- return this.cache.get(entity);
25
- }
26
- /** List all configs */
27
- listConfigs() {
28
- return this.http
29
- .get(`${this.apiUrl}/config`)
30
- .pipe(map(res => res.data)); // ADR-004: Success guarantees data
31
- }
32
- /** Create a new config */
33
- saveConfig(config) {
34
- return this.http
35
- .post(`${this.apiUrl}/config`, config)
36
- .pipe(map(res => res.data));
37
- }
38
- /** Update an existing config */
39
- updateConfig(entity, updates) {
40
- return this.http
41
- .put(`${this.apiUrl}/config/${entity}`, updates)
42
- .pipe(map(res => {
43
- this.invalidate(entity);
44
- return res.data;
45
- }));
46
- }
47
- /** Invalidate cache for an entity (call after config update) */
48
- invalidate(entity) {
49
- this.cache.delete(entity);
50
- }
51
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConfigService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
52
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConfigService, providedIn: 'root' });
53
- }
54
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ConfigService, decorators: [{
55
- type: Injectable,
56
- args: [{ providedIn: 'root' }]
57
- }] });
58
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZmlnLnNlcnZpY2UuanMiLCJzb3VyY2VSb290IjoiIi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cbiAgICAgICAgfSlcbiAgICAgICk7XG4gIH1cblxuICAvKiogSW52YWxpZGF0ZSBjYWNoZSBmb3IgYW4gZW50aXR5IChjYWxsIGFmdGVyIGNvbmZpZyB1cGRhdGUpICovXG4gIGludmFsaWRhdGUoZW50aXR5OiBzdHJpbmcpOiB2b2lkIHtcbiAgICB0aGlzLmNhY2hlLmRlbGV0ZShlbnRpdHkpO1xuICB9XG59XG4iXX0=
@@ -1,40 +0,0 @@
1
- import { Injectable, inject } from '@angular/core';
2
- import { MIGRATION_STRATEGY } from '../tokens/injection-tokens';
3
- import * as i0 from "@angular/core";
4
- /**
5
- * VersionService — checks config version staleness and migration strategy.
6
- * ADR-005: Frontend strategy is 'strict' | 'graceful' only. Never 'auto'.
7
- */
8
- export class VersionService {
9
- strategy = inject(MIGRATION_STRATEGY, { optional: true }) ?? 'graceful';
10
- /**
11
- * Check if a record is stale compared to the current config version.
12
- * Returns true if the record needs migration.
13
- */
14
- needsMigration(record, config) {
15
- if (!record._configVersion)
16
- return false;
17
- return record._configVersion < config.version || !!record._needsMigration;
18
- }
19
- /**
20
- * Get the effective migration strategy for frontend use.
21
- * Only 'strict' or 'graceful' — never 'auto' (ADR-005).
22
- */
23
- getStrategy() {
24
- return this.strategy === 'strict' ? 'strict' : 'graceful';
25
- }
26
- /**
27
- * Determine if form submission should be blocked for a stale record.
28
- * 'strict' → block; 'graceful' → allow with warning.
29
- */
30
- shouldBlockSubmit(record, config) {
31
- return this.getStrategy() === 'strict' && this.needsMigration(record, config);
32
- }
33
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VersionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
34
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VersionService, providedIn: 'root' });
35
- }
36
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: VersionService, decorators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