ngx-dynamic-entity 0.0.1

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 (47) hide show
  1. package/esm2022/lib/field-types/checkbox-field.component.mjs +73 -0
  2. package/esm2022/lib/field-types/date-field.component.mjs +82 -0
  3. package/esm2022/lib/field-types/dropdown-field.component.mjs +83 -0
  4. package/esm2022/lib/field-types/entity-ref-field.component.mjs +117 -0
  5. package/esm2022/lib/field-types/multi-select-field.component.mjs +91 -0
  6. package/esm2022/lib/field-types/number-field.component.mjs +73 -0
  7. package/esm2022/lib/field-types/text-field.component.mjs +74 -0
  8. package/esm2022/lib/field-types/textarea-field.component.mjs +73 -0
  9. package/esm2022/lib/form/dynamic-field/dynamic-field.component.mjs +86 -0
  10. package/esm2022/lib/form/dynamic-form.component.mjs +167 -0
  11. package/esm2022/lib/providers/provide-ngx-dynamic-entity.mjs +23 -0
  12. package/esm2022/lib/services/config.service.mjs +58 -0
  13. package/esm2022/lib/services/entity-ref-registry.service.mjs +31 -0
  14. package/esm2022/lib/services/field-registry.service.mjs +50 -0
  15. package/esm2022/lib/services/hook-registry.service.mjs +26 -0
  16. package/esm2022/lib/services/rbac.service.mjs +52 -0
  17. package/esm2022/lib/services/validator-registry.service.mjs +49 -0
  18. package/esm2022/lib/services/version.service.mjs +40 -0
  19. package/esm2022/lib/table/dynamic-table.component.mjs +160 -0
  20. package/esm2022/lib/tokens/injection-tokens.mjs +16 -0
  21. package/esm2022/ngx-dynamic-entity.mjs +5 -0
  22. package/esm2022/public-api.mjs +26 -0
  23. package/fesm2022/ngx-dynamic-entity.mjs +1352 -0
  24. package/fesm2022/ngx-dynamic-entity.mjs.map +1 -0
  25. package/index.d.ts +5 -0
  26. package/lib/field-types/checkbox-field.component.d.ts +12 -0
  27. package/lib/field-types/date-field.component.d.ts +14 -0
  28. package/lib/field-types/dropdown-field.component.d.ts +13 -0
  29. package/lib/field-types/entity-ref-field.component.d.ts +26 -0
  30. package/lib/field-types/multi-select-field.component.d.ts +13 -0
  31. package/lib/field-types/number-field.component.d.ts +12 -0
  32. package/lib/field-types/text-field.component.d.ts +13 -0
  33. package/lib/field-types/textarea-field.component.d.ts +12 -0
  34. package/lib/form/dynamic-field/dynamic-field.component.d.ts +30 -0
  35. package/lib/form/dynamic-form.component.d.ts +52 -0
  36. package/lib/providers/provide-ngx-dynamic-entity.d.ts +29 -0
  37. package/lib/services/config.service.d.ts +25 -0
  38. package/lib/services/entity-ref-registry.service.d.ts +20 -0
  39. package/lib/services/field-registry.service.d.ts +22 -0
  40. package/lib/services/hook-registry.service.d.ts +12 -0
  41. package/lib/services/rbac.service.d.ts +32 -0
  42. package/lib/services/validator-registry.service.d.ts +19 -0
  43. package/lib/services/version.service.d.ts +26 -0
  44. package/lib/table/dynamic-table.component.d.ts +56 -0
  45. package/lib/tokens/injection-tokens.d.ts +16 -0
  46. package/package.json +37 -0
  47. package/public-api.d.ts +21 -0
@@ -0,0 +1,19 @@
1
+ import { ValidatorFn } from '@angular/forms';
2
+ import * as i0 from "@angular/core";
3
+ /**
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: {...} }).
7
+ */
8
+ export declare class ValidatorRegistryService {
9
+ private readonly consumerRegistry;
10
+ /**
11
+ * Resolve a validator key to a ValidatorFn.
12
+ * Supports parameterized built-ins like 'min:0', 'maxLength:255'.
13
+ */
14
+ resolve(validatorKey: string): ValidatorFn | null;
15
+ /** Resolve multiple validator keys into a ValidatorFn[] */
16
+ resolveAll(validatorKeys?: string[]): ValidatorFn[];
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<ValidatorRegistryService, never>;
18
+ static ɵprov: i0.ɵɵInjectableDeclaration<ValidatorRegistryService>;
19
+ }
@@ -0,0 +1,26 @@
1
+ import type { VersionedRecord, EntityConfig } from '@dynamic-entity/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * VersionService — checks config version staleness and migration strategy.
5
+ * ADR-005: Frontend strategy is 'strict' | 'graceful' only. Never 'auto'.
6
+ */
7
+ export declare class VersionService {
8
+ private readonly strategy;
9
+ /**
10
+ * Check if a record is stale compared to the current config version.
11
+ * Returns true if the record needs migration.
12
+ */
13
+ needsMigration(record: Partial<VersionedRecord>, config: EntityConfig): boolean;
14
+ /**
15
+ * Get the effective migration strategy for frontend use.
16
+ * Only 'strict' or 'graceful' — never 'auto' (ADR-005).
17
+ */
18
+ getStrategy(): 'strict' | 'graceful';
19
+ /**
20
+ * Determine if form submission should be blocked for a stale record.
21
+ * 'strict' → block; 'graceful' → allow with warning.
22
+ */
23
+ shouldBlockSubmit(record: Partial<VersionedRecord>, config: EntityConfig): boolean;
24
+ static ɵfac: i0.ɵɵFactoryDeclaration<VersionService, never>;
25
+ static ɵprov: i0.ɵɵInjectableDeclaration<VersionService>;
26
+ }
@@ -0,0 +1,56 @@
1
+ import { EventEmitter, OnChanges, SimpleChanges } from '@angular/core';
2
+ import type { EntityConfig, VersionedRecord } from '@dynamic-entity/core';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * DynamicTableComponent — renders entity records as a searchable, sortable, paginated table.
6
+ * Columns determined by FieldConfig.tableColumn === true.
7
+ * Cell masking applied via RbacService (defense-in-depth).
8
+ * Pagination, sort, and search emit events — parent controls data fetching (smart/dumb pattern).
9
+ */
10
+ export declare class DynamicTableComponent implements OnChanges {
11
+ config: EntityConfig;
12
+ data: VersionedRecord[];
13
+ userRoles: string[];
14
+ language: string;
15
+ loading: boolean;
16
+ error: string | null;
17
+ totalRecords: number;
18
+ pageSize: number;
19
+ currentPage: number;
20
+ rowClick: EventEmitter<VersionedRecord>;
21
+ rowEdit: EventEmitter<VersionedRecord>;
22
+ rowDelete: EventEmitter<VersionedRecord>;
23
+ pageChange: EventEmitter<number>;
24
+ pageSizeChange: EventEmitter<number>;
25
+ sortChange: EventEmitter<{
26
+ field: string;
27
+ dir: 'asc' | 'desc';
28
+ }>;
29
+ searchChange: EventEmitter<string>;
30
+ private readonly rbacService;
31
+ private readonly versionService;
32
+ readonly sortField: import("@angular/core").WritableSignal<string>;
33
+ readonly sortDir: import("@angular/core").WritableSignal<"asc" | "desc">;
34
+ readonly searchTerm: import("@angular/core").WritableSignal<string>;
35
+ readonly tableColumns: import("@angular/core").Signal<import("@dynamic-entity/core").FieldConfig[]>;
36
+ get permissions(): {
37
+ canView: boolean;
38
+ canEdit: boolean;
39
+ canDelete: boolean;
40
+ };
41
+ get totalPages(): number;
42
+ ngOnChanges(_changes: SimpleChanges): void;
43
+ private columnMaskCache;
44
+ private _resolveColumnMasks;
45
+ isCellMasked(fieldId: string): boolean;
46
+ getCellValue(record: VersionedRecord, fieldId: string): string;
47
+ needsMigration(record: VersionedRecord): boolean;
48
+ getColumnLabel(fieldId: string): string;
49
+ onSort(fieldId: string): void;
50
+ onSearch(event: Event): void;
51
+ onPageChange(page: number): void;
52
+ onEdit(event: Event, record: VersionedRecord): void;
53
+ onDelete(event: Event, record: VersionedRecord): void;
54
+ static ɵfac: i0.ɵɵFactoryDeclaration<DynamicTableComponent, never>;
55
+ static ɵcmp: i0.ɵɵComponentDeclaration<DynamicTableComponent, "ngx-dynamic-table", never, { "config": { "alias": "config"; "required": false; }; "data": { "alias": "data"; "required": false; }; "userRoles": { "alias": "userRoles"; "required": false; }; "language": { "alias": "language"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "error": { "alias": "error"; "required": false; }; "totalRecords": { "alias": "totalRecords"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "currentPage": { "alias": "currentPage"; "required": false; }; }, { "rowClick": "rowClick"; "rowEdit": "rowEdit"; "rowDelete": "rowDelete"; "pageChange": "pageChange"; "pageSizeChange": "pageSizeChange"; "sortChange": "sortChange"; "searchChange": "searchChange"; }, never, never, true, never>;
56
+ }
@@ -0,0 +1,16 @@
1
+ import { InjectionToken } from '@angular/core';
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>;
5
+ /** Roles that see XXXXXXXXX for masked fields (ADR-003) */
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 */
10
+ 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[]>>>;
13
+ /** Registry: validator key → ValidatorFn */
14
+ export declare const VALIDATOR_REGISTRY: InjectionToken<Map<string, any>>;
15
+ /** Registry: hook key → async (data, context) => data */
16
+ export declare const HOOK_REGISTRY: InjectionToken<Map<string, Function>>;
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "ngx-dynamic-entity",
3
+ "version": "0.0.1",
4
+ "description": "Angular 17 standalone UI library for dynamic entity forms and tables.",
5
+ "peerDependencies": {
6
+ "@angular/common": "^17.0.0",
7
+ "@angular/core": "^17.0.0",
8
+ "@angular/forms": "^17.0.0",
9
+ "@dynamic-entity/core": "0.0.1",
10
+ "rxjs": "^7.0.0"
11
+ },
12
+ "keywords": [
13
+ "angular",
14
+ "dynamic-entity",
15
+ "dynamic-forms",
16
+ "dynamic-table",
17
+ "rbac"
18
+ ],
19
+ "license": "MIT",
20
+ "sideEffects": false,
21
+ "module": "fesm2022/ngx-dynamic-entity.mjs",
22
+ "typings": "index.d.ts",
23
+ "exports": {
24
+ "./package.json": {
25
+ "default": "./package.json"
26
+ },
27
+ ".": {
28
+ "types": "./index.d.ts",
29
+ "esm2022": "./esm2022/ngx-dynamic-entity.mjs",
30
+ "esm": "./esm2022/ngx-dynamic-entity.mjs",
31
+ "default": "./fesm2022/ngx-dynamic-entity.mjs"
32
+ }
33
+ },
34
+ "dependencies": {
35
+ "tslib": "^2.3.0"
36
+ }
37
+ }
@@ -0,0 +1,21 @@
1
+ export * from './lib/tokens/injection-tokens';
2
+ export * from './lib/providers/provide-ngx-dynamic-entity';
3
+ export * from './lib/services/config.service';
4
+ export * from './lib/services/field-registry.service';
5
+ export * from './lib/services/hook-registry.service';
6
+ export * from './lib/services/validator-registry.service';
7
+ export * from './lib/services/entity-ref-registry.service';
8
+ export * from './lib/services/version.service';
9
+ export * from './lib/services/rbac.service';
10
+ export * from './lib/form/dynamic-form.component';
11
+ export * from './lib/form/dynamic-field/dynamic-field.component';
12
+ export * from './lib/table/dynamic-table.component';
13
+ export * from './lib/field-types/text-field.component';
14
+ export * from './lib/field-types/textarea-field.component';
15
+ export * from './lib/field-types/number-field.component';
16
+ export * from './lib/field-types/checkbox-field.component';
17
+ export * from './lib/field-types/date-field.component';
18
+ export * from './lib/field-types/dropdown-field.component';
19
+ export * from './lib/field-types/multi-select-field.component';
20
+ 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';