ngx-dynamic-entity 1.2.0 → 1.3.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.
- package/README.md +1 -1
- package/esm2022/lib/field-types/date-time-field.component.mjs +138 -0
- package/esm2022/lib/field-types/time-field.component.mjs +96 -0
- package/esm2022/lib/form/dynamic-field/dynamic-field.component.mjs +4 -3
- package/esm2022/lib/form/dynamic-form.component.mjs +13 -4
- package/esm2022/lib/form/dynamic-record-form.component.mjs +54 -17
- package/esm2022/lib/providers/provide-field-types.mjs +5 -2
- package/esm2022/public-api.mjs +4 -2
- package/fesm2022/ngx-dynamic-entity.mjs +295 -22
- package/fesm2022/ngx-dynamic-entity.mjs.map +1 -1
- package/lib/field-types/date-time-field.component.d.ts +30 -0
- package/lib/field-types/time-field.component.d.ts +27 -0
- package/lib/form/dynamic-form.component.d.ts +2 -0
- package/lib/form/dynamic-record-form.component.d.ts +19 -0
- package/package.json +2 -2
- package/public-api.d.ts +2 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import type { NestedFieldConfig } from '@dynamic-entity/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Date & Time field: a single `datetime-local` input.
|
|
6
|
+
*
|
|
7
|
+
* The type is stored as ISO 8601 UTC, per the same convention `date` follows, while the
|
|
8
|
+
* input works in the viewer's local zone — `datetime-local` has no offset, so the two
|
|
9
|
+
* conversions here are what keep a value stable across a round trip.
|
|
10
|
+
*/
|
|
11
|
+
export declare class DateTimeFieldComponent {
|
|
12
|
+
field: NestedFieldConfig;
|
|
13
|
+
control: AbstractControl;
|
|
14
|
+
language: string;
|
|
15
|
+
readonly: boolean;
|
|
16
|
+
masked: boolean;
|
|
17
|
+
get label(): string;
|
|
18
|
+
/** Stored ISO 8601 → the `YYYY-MM-DDTHH:mm` local form the input requires. */
|
|
19
|
+
get inputValue(): string;
|
|
20
|
+
/** The input's local `YYYY-MM-DDTHH:mm` → stored ISO 8601 UTC. */
|
|
21
|
+
onInput(value: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* Displays date *and* time. `DateFieldComponent` used `toLocaleDateString()` here, so a
|
|
24
|
+
* datetime read back through the field showed no time while the same value in the record
|
|
25
|
+
* summary — which goes through core's `formatDisplayValue` — showed it.
|
|
26
|
+
*/
|
|
27
|
+
formatDateTime(value: unknown): string;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DateTimeFieldComponent, never>;
|
|
29
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DateTimeFieldComponent, "ngx-date-time-field", never, { "field": { "alias": "field"; "required": false; }; "control": { "alias": "control"; "required": false; }; "language": { "alias": "language"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "masked": { "alias": "masked"; "required": false; }; }, {}, never, never, true, never>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AbstractControl } from '@angular/forms';
|
|
2
|
+
import type { NestedFieldConfig } from '@dynamic-entity/core';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Time field: a bare time of day, with no date and no zone attached.
|
|
6
|
+
*
|
|
7
|
+
* Stored as `HH:mm` — exactly the value `<input type="time">` reads and writes, so the
|
|
8
|
+
* control binds straight through with no conversion. That is the whole reason this is a
|
|
9
|
+
* separate type from `datetime`: a recurring 09:00 opening time is not a moment in time,
|
|
10
|
+
* and converting it to UTC would move it whenever the offset changed.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TimeFieldComponent {
|
|
13
|
+
field: NestedFieldConfig;
|
|
14
|
+
control: AbstractControl;
|
|
15
|
+
language: string;
|
|
16
|
+
readonly: boolean;
|
|
17
|
+
masked: boolean;
|
|
18
|
+
get label(): string;
|
|
19
|
+
/**
|
|
20
|
+
* Defers to core rather than parsing `HH:mm` locally. The other date-ish components each
|
|
21
|
+
* grew their own formatter, and `datetime` ended up showing one thing in the field and
|
|
22
|
+
* another in the record summary because the two drifted apart.
|
|
23
|
+
*/
|
|
24
|
+
formatTime(value: unknown): string;
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TimeFieldComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TimeFieldComponent, "ngx-time-field", never, { "field": { "alias": "field"; "required": false; }; "control": { "alias": "control"; "required": false; }; "language": { "alias": "language"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "masked": { "alias": "masked"; "required": false; }; }, {}, never, never, true, never>;
|
|
27
|
+
}
|
|
@@ -65,6 +65,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
|
|
|
65
65
|
reason: string;
|
|
66
66
|
error?: unknown;
|
|
67
67
|
}>;
|
|
68
|
+
private readonly cdr;
|
|
68
69
|
private readonly fb;
|
|
69
70
|
private readonly validatorRegistry;
|
|
70
71
|
private readonly hookRegistry;
|
|
@@ -88,6 +89,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
|
|
|
88
89
|
private fieldHosts?;
|
|
89
90
|
form: FormGroup;
|
|
90
91
|
private valueSub?;
|
|
92
|
+
private statusSub?;
|
|
91
93
|
private selectionSub?;
|
|
92
94
|
/** Previous values, for detecting `patchOnTrue` false→true transitions. */
|
|
93
95
|
private previousValues;
|
|
@@ -39,6 +39,8 @@ export declare class DynamicRecordFormComponent implements OnChanges {
|
|
|
39
39
|
}>;
|
|
40
40
|
dynamicFormComp?: DynamicFormComponent;
|
|
41
41
|
private readonly rulesEvaluation;
|
|
42
|
+
private readonly host;
|
|
43
|
+
private readonly injector;
|
|
42
44
|
readonly currentData: import("@angular/core").WritableSignal<Record<string, any>>;
|
|
43
45
|
readonly originalBaseline: import("@angular/core").WritableSignal<Record<string, any>>;
|
|
44
46
|
/**
|
|
@@ -174,6 +176,23 @@ export declare class DynamicRecordFormComponent implements OnChanges {
|
|
|
174
176
|
formatFieldLabel(field: NestedFieldConfig): string;
|
|
175
177
|
/** Summary values render through the shared core formatter, not a local stringifier. */
|
|
176
178
|
formatFieldValue(field: NestedFieldConfig): string;
|
|
179
|
+
/**
|
|
180
|
+
* Finds which tab — and, where the field lives one level down, which sub-tab — owns a
|
|
181
|
+
* field. The walk used to check top-level `fields` only, so every field in a sub-tab was
|
|
182
|
+
* simply not found and the jump did nothing at all.
|
|
183
|
+
*/
|
|
184
|
+
private locateField;
|
|
185
|
+
/**
|
|
186
|
+
* Switches to the tab holding `fieldId`, then scrolls it into view and moves focus to it.
|
|
187
|
+
*
|
|
188
|
+
* The wait for the new tab to render used to be a 50 ms `setTimeout`, which was wrong three
|
|
189
|
+
* ways: `document` is undefined on a server render, 50 ms is a guess that a large tab can
|
|
190
|
+
* outrun, and nothing cancelled the timer if the component went away first.
|
|
191
|
+
* `afterNextRender` fixes all three — it never runs on the server, it runs when the panel
|
|
192
|
+
* has actually rendered rather than when a guess expires, and it is tied to the injector so
|
|
193
|
+
* destroying the component cancels it. The query is scoped to this component's own element,
|
|
194
|
+
* so the library no longer reaches for the global `document` at all.
|
|
195
|
+
*/
|
|
177
196
|
jumpToField(fieldId: string): void;
|
|
178
197
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicRecordFormComponent, never>;
|
|
179
198
|
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicRecordFormComponent, "ngx-dynamic-record-form", never, { "config": { "alias": "config"; "required": false; }; "rules": { "alias": "rules"; "required": false; }; "initialData": { "alias": "initialData"; "required": false; }; "userRoles": { "alias": "userRoles"; "required": false; }; "language": { "alias": "language"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "error": { "alias": "error"; "required": false; }; "isReadOnly": { "alias": "isReadOnly"; "required": false; }; "readOnlyFields": { "alias": "readOnlyFields"; "required": false; }; "viewMode": { "alias": "viewMode"; "required": false; }; }, { "formSubmit": "formSubmit"; "formChange": "formChange"; "formReset": "formReset"; "sectionSave": "sectionSave"; }, never, never, true, never>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngx-dynamic-entity",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Angular standalone UI library for rendering dynamic entity forms.",
|
|
5
5
|
"//typings": "Local workspace resolution only: ng-packagr overwrites this with the correct in-tarball path ('index.d.ts') when generating dist/package.json. Do NOT add a 'main' field here — ng-packagr does not generate one, so it would be copied verbatim and resolve to dist/dist/... in the published package.",
|
|
6
6
|
"typings": "index.d.ts",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"@angular/common": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
9
9
|
"@angular/core": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
10
10
|
"@angular/forms": "^17.0.0 || ^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0 || ^22.0.0",
|
|
11
|
-
"@dynamic-entity/core": "^1.
|
|
11
|
+
"@dynamic-entity/core": "^1.3.0",
|
|
12
12
|
"rxjs": "^7.0.0"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
package/public-api.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export * from './lib/field-types/password-field.component';
|
|
|
27
27
|
export * from './lib/field-types/checkbox-field.component';
|
|
28
28
|
export * from './lib/field-types/boolean-field.component';
|
|
29
29
|
export * from './lib/field-types/date-field.component';
|
|
30
|
+
export * from './lib/field-types/date-time-field.component';
|
|
31
|
+
export * from './lib/field-types/time-field.component';
|
|
30
32
|
export * from './lib/field-types/month-year-field.component';
|
|
31
33
|
export * from './lib/field-types/dropdown-field.component';
|
|
32
34
|
export * from './lib/field-types/radio-field.component';
|