ngx-dynamic-entity 2.4.0 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-dynamic-entity",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Angular standalone UI library for rendering dynamic entity forms.",
5
5
  "//typings": "Local workspace resolution only: ng-packagr 21 writes types/ngx-dynamic-entity.d.ts into dist/package.json. Do NOT add a 'main' field here — ng-packagr does not generate one, so it would be copied verbatim and resolve wrongly in the published package.",
6
6
  "typings": "types/ngx-dynamic-entity.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": "^2.4.0",
11
+ "@dynamic-entity/core": "^2.5.0",
12
12
  "rxjs": "^7.0.0"
13
13
  },
14
14
  "keywords": [
@@ -1,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { InjectionToken, Type, EnvironmentProviders, WritableSignal, OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Provider } from '@angular/core';
3
- import { ReferenceOption, LocalizedText, EntityFormConfig, FormRule, ImportLookups, MappingPlan, CsvDelimiter, ImportResult, TemplateSpec, SheetGrid, CommonModuleEntry, EntityReferenceLoader, LookupListSource, RecordMigration, FileUploadHandler, FieldValidators, NestedFieldConfig, ReferenceLoaderContext, DropdownOption, LookupListValue, NestedTabConfig, RuleEvaluationResult, FieldScopeEntry, EvaluateFormRulesOptions, ImportColumn, MappingEntry, UnsupportedColumn, ImportRowError, SliderBounds } from '@dynamic-entity/core';
3
+ import { ReferenceOption, LocalizedText, EntityFormConfig, FormRule, ImportLookups, DateOrder, MappingPlan, CsvDelimiter, ImportResult, TemplateSpec, SheetGrid, CommonModuleEntry, EntityReferenceLoader, LookupListSource, RecordMigration, FileUploadHandler, FieldValidators, NestedFieldConfig, ReferenceLoaderContext, DropdownOption, LookupListValue, NestedTabConfig, RuleEvaluationResult, FieldScopeEntry, EvaluateFormRulesOptions, ImportColumn, MappingEntry, UnsupportedColumn, ImportRowError, SliderBounds } from '@dynamic-entity/core';
4
4
  export { AutoPatchConfig, CommonModuleEntry, ComponentClass, DropdownOption, EntityFormConfig, EntityPermissions, EntityReferenceConfig, EntityReferenceLoader, FieldTableConfig, FieldValidators, FileRef, FormRule, LocalizedText, NestedFieldConfig, NestedTabConfig, PatchOnTrueMapping, RbacContext, ReferenceLoaderContext, ReferenceOption, RichFieldType, RuleAction, RuleCondition, RuleEvaluationResult, VersionedRecord, formatDisplayValue, normalizeConfig, normalizeOption, resolveLabel, resolveOptionLabel, resolveOptionValue, valuesMatch } from '@dynamic-entity/core';
5
5
  import { ValidatorFn, AsyncValidatorFn, AbstractControl, ValidationErrors, FormGroup, FormArray } from '@angular/forms';
6
6
  import * as rxjs from 'rxjs';
@@ -129,6 +129,8 @@ declare const DEFAULT_UI_TEXT: {
129
129
  importDelimiterComma: string;
130
130
  importDelimiterSemicolon: string;
131
131
  importDelimiterTab: string;
132
+ importDateOrderMismatch: string;
133
+ importDateOrderUnconfirmed: string;
132
134
  importRowRejected: string;
133
135
  importRunImport: string;
134
136
  importImporting: string;
@@ -272,6 +274,15 @@ interface ImportContext {
272
274
  /** Values for any `listName` field, already resolved — core cannot reach `LOOKUP_REGISTRY`. */
273
275
  lookups?: ImportLookups;
274
276
  lang?: string;
277
+ /**
278
+ * The order of a date written in digits, such as `05/09/2026`: `DMY` for day first, `MDY`
279
+ * for month first. Without it, a date that reads two ways fails its row; it is never guessed.
280
+ *
281
+ * The local transport reads cells with it. A server transport reads with whatever its own
282
+ * router was given, so state the same order on both, or the review step shows one reading
283
+ * and the server stores another.
284
+ */
285
+ dateOrder?: DateOrder;
275
286
  }
276
287
  /** What a first look at an uploaded file yields. */
277
288
  interface ImportPreview {
@@ -289,7 +300,26 @@ interface ImportPreview {
289
300
  arrayBound?: number;
290
301
  /** The field separator a delimited-text file used. Absent for a workbook. */
291
302
  delimiter?: CsvDelimiter;
303
+ /**
304
+ * The order this transport will read a date written in digits in when it commits. Absent
305
+ * when it will read with none, or cannot say.
306
+ *
307
+ * The wizard reads the review sample with it, so the review shows what the commit will
308
+ * store. When the host stated a different order the wizard refuses to commit, and when the
309
+ * host stated one and the transport reports none it warns.
310
+ */
311
+ dateOrder?: DateOrder;
292
312
  }
313
+ /**
314
+ * How the order the host states compares with the one the transport reports it reads with.
315
+ *
316
+ * - `mismatch`: both state one and they differ. Committing would store dates read one way
317
+ * after a review that showed them the other, so nothing may be committed.
318
+ * - `unconfirmed`: the host states one and the transport reports none. The transport reads the
319
+ * file, so the host's order is not applied: worth a warning, not a refusal.
320
+ * - `agreed`: anything else. Only the transport stating one is fine: it is the one that reads.
321
+ */
322
+ declare function compareDateOrders(stated: DateOrder | undefined, reported: DateOrder | undefined): 'agreed' | 'mismatch' | 'unconfirmed';
293
323
  /**
294
324
  * Where the work happens.
295
325
  *
@@ -2092,16 +2122,21 @@ interface HttpImportTransportOptions {
2092
2122
  */
2093
2123
  warn?: (message: string) => void;
2094
2124
  }
2095
- /**
2096
- * Not `@Injectable`, and registered by value rather than by class.
2097
- *
2098
- * Its constructor takes options rather than dependencies, so there is nothing for an injector
2099
- * to resolve — and a consumer who wants two of them, pointed at two backends, gets that for
2100
- * free.
2101
- */
2102
2125
  declare class HttpImportTransport implements ImportTransport {
2103
2126
  private readonly options;
2127
+ /**
2128
+ * The date order each previewed file's server reported, for `commit` to compare against.
2129
+ * Keyed on the `File`, so it lives exactly as long as the file does.
2130
+ */
2131
+ private readonly reported;
2104
2132
  constructor(options: HttpImportTransportOptions);
2133
+ private warn;
2134
+ /**
2135
+ * The server reads the file, so its date order is the one that is applied. When the host
2136
+ * stated one and the server confirms none, the host's order does nothing there: say so, and
2137
+ * say what the server will do instead, which depends on how old it is.
2138
+ */
2139
+ private checkDateOrder;
2105
2140
  private get base();
2106
2141
  private get send();
2107
2142
  private entityOf;
@@ -2162,6 +2197,16 @@ declare class EntityImportComponent {
2162
2197
  */
2163
2198
  lookups?: ImportLookups;
2164
2199
  language: string;
2200
+ /**
2201
+ * The order of a date written in digits in the sheets this wizard imports: `DMY` for day
2202
+ * first, `MDY` for month first. Without it, a date that reads two ways (`05/09/2026`) is
2203
+ * shown, and imported, as an error rather than guessed.
2204
+ *
2205
+ * The transport reads the file, so the order it reports at preview is the one applied, and
2206
+ * the one the review step shows. If that differs from this, the wizard refuses to commit;
2207
+ * if the transport reports none, the wizard warns that this order is not being applied.
2208
+ */
2209
+ dateOrder?: DateOrder;
2165
2210
  /** Format asked of the transport when a template is downloaded. */
2166
2211
  templateFormat: TemplateFormat;
2167
2212
  /** The finished import, once it has run. */
@@ -2178,6 +2223,8 @@ declare class EntityImportComponent {
2178
2223
  protected readonly rowCount: i0.WritableSignal<number>;
2179
2224
  /** The separator a delimited file turned out to use, so the user can see how it was read. */
2180
2225
  protected readonly delimiter: i0.WritableSignal<CsvDelimiter>;
2226
+ /** The date order the transport said it will read with at commit, from its preview. */
2227
+ protected readonly reportedDateOrder: i0.WritableSignal<DateOrder>;
2181
2228
  protected readonly fileName: i0.WritableSignal<string>;
2182
2229
  protected readonly plan: i0.WritableSignal<MappingPlan>;
2183
2230
  protected readonly result: i0.WritableSignal<ImportResult>;
@@ -2229,13 +2276,20 @@ declare class EntityImportComponent {
2229
2276
  * exact and `failed` is absent.
2230
2277
  */
2231
2278
  protected failedRowCount(result: ImportResult): number;
2279
+ /** How the order the host states compares with the one the transport reads with. */
2280
+ protected dateOrderCheck(): 'agreed' | 'mismatch' | 'unconfirmed';
2281
+ /** The two orders, for a message that names them. Only asked for when they do not agree. */
2282
+ protected dateOrders(): {
2283
+ stated: string;
2284
+ reported: string;
2285
+ };
2232
2286
  /** The decimal mark the commit will read numbers with, so the preview reads them the same. */
2233
2287
  protected decimal(): '.' | ',';
2234
2288
  /** How the file's columns were split, in words — or nothing for a workbook. */
2235
2289
  protected delimiterText(): string | null;
2236
2290
  protected restart(): void;
2237
2291
  static ɵfac: i0.ɵɵFactoryDeclaration<EntityImportComponent, never>;
2238
- static ɵcmp: i0.ɵɵComponentDeclaration<EntityImportComponent, "ngx-entity-import", never, { "config": { "alias": "config"; "required": true; }; "rules": { "alias": "rules"; "required": false; }; "lookups": { "alias": "lookups"; "required": false; }; "language": { "alias": "language"; "required": false; }; "templateFormat": { "alias": "templateFormat"; "required": false; }; }, { "importComplete": "importComplete"; "templateReady": "templateReady"; }, never, never, true, never>;
2292
+ static ɵcmp: i0.ɵɵComponentDeclaration<EntityImportComponent, "ngx-entity-import", never, { "config": { "alias": "config"; "required": true; }; "rules": { "alias": "rules"; "required": false; }; "lookups": { "alias": "lookups"; "required": false; }; "language": { "alias": "language"; "required": false; }; "dateOrder": { "alias": "dateOrder"; "required": false; }; "templateFormat": { "alias": "templateFormat"; "required": false; }; }, { "importComplete": "importComplete"; "templateReady": "templateReady"; }, never, never, true, never>;
2239
2293
  }
2240
2294
 
2241
2295
  /** One target field, and which of the sheet's columns feeds it. */
@@ -2365,13 +2419,15 @@ declare class ImportPreviewComponent implements OnChanges {
2365
2419
  language: string;
2366
2420
  /** The decimal mark number cells use — the one the commit will read them with. */
2367
2421
  decimal: '.' | ',';
2422
+ /** The order of a date written in digits — the one the commit will read them in. */
2423
+ dateOrder?: DateOrder;
2368
2424
  protected readonly ui: UiTextService;
2369
2425
  /** The columns this plan fills, in the plan's own order. */
2370
2426
  protected readonly columns: i0.WritableSignal<ImportColumn[]>;
2371
2427
  protected readonly grid: i0.WritableSignal<PreviewRow[]>;
2372
2428
  ngOnChanges(): void;
2373
2429
  static ɵfac: i0.ɵɵFactoryDeclaration<ImportPreviewComponent, never>;
2374
- static ɵcmp: i0.ɵɵComponentDeclaration<ImportPreviewComponent, "ngx-import-preview", never, { "config": { "alias": "config"; "required": true; }; "plan": { "alias": "plan"; "required": true; }; "rows": { "alias": "rows"; "required": false; }; "lookups": { "alias": "lookups"; "required": false; }; "rules": { "alias": "rules"; "required": false; }; "language": { "alias": "language"; "required": false; }; "decimal": { "alias": "decimal"; "required": false; }; }, {}, never, never, true, never>;
2430
+ static ɵcmp: i0.ɵɵComponentDeclaration<ImportPreviewComponent, "ngx-import-preview", never, { "config": { "alias": "config"; "required": true; }; "plan": { "alias": "plan"; "required": true; }; "rows": { "alias": "rows"; "required": false; }; "lookups": { "alias": "lookups"; "required": false; }; "rules": { "alias": "rules"; "required": false; }; "language": { "alias": "language"; "required": false; }; "decimal": { "alias": "decimal"; "required": false; }; "dateOrder": { "alias": "dateOrder"; "required": false; }; }, {}, never, never, true, never>;
2375
2431
  }
2376
2432
 
2377
2433
  /** One field offered for the template, with the guidance that belongs to it. */
@@ -3607,5 +3663,5 @@ declare class TagsFieldComponent implements OnDestroy {
3607
3663
  static ɵcmp: i0.ɵɵComponentDeclaration<TagsFieldComponent, "ngx-tags-field", never, { "field": { "alias": "field"; "required": false; }; "language": { "alias": "language"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "masked": { "alias": "masked"; "required": false; }; "control": { "alias": "control"; "required": false; }; }, {}, never, never, true, never>;
3608
3664
  }
3609
3665
 
3610
- export { ASYNC_VALIDATOR_REGISTRY, ArrayFieldComponent, BooleanFieldComponent, COMMON_MODULES_REGISTRY, CONFIG_SOURCE, CascadeDataService, CheckboxFieldComponent, ColorFieldComponent, ConfigSourceService, CurrencyFieldComponent, DEFAULT_UI_TEXT, DEFAULT_VALIDATION_MESSAGES, DateFieldComponent, DateTimeFieldComponent, DropdownFieldComponent, DynamicFieldComponent, DynamicFormComponent, DynamicRecordFormComponent, ENTITY_REF_CACHE_STORE, ENTITY_REF_REGISTRY, EmailFieldComponent, EntityImportComponent, EntityRefFieldComponent, EntityRefRegistryService, EntityRefSelectionService, EntityReferenceService, FIELD_TYPE_REGISTRY, FIELD_TYPE_SETS, FieldRegistryService, FileFieldComponent, GroupFieldComponent, HOOK_REGISTRY, HookRegistryService, HttpImportTransport, IMPORT_TRANSPORT, ImageFieldComponent, ImportErrorsComponent, ImportMapperComponent, ImportPreviewComponent, ImportTemplateComponent, InMemoryEntityRefCacheStore, LOOKUP_REGISTRY, LocalImportTransport, LookupRegistryService, MARKDOWN_RENDERER, MASKED_PLACEHOLDER, MASKED_ROLES, MarkdownFieldComponent, MonthYearFieldComponent, MultiSelectFieldComponent, NumberFieldComponent, PasswordFieldComponent, PhoneFieldComponent, RECORD_MIGRATIONS, RadioFieldComponent, RatingFieldComponent, RbacService, RulesEvaluationService, SHEET_PARSER, SYSTEM_DEFAULT_CAN_EDIT, SliderFieldComponent, TagsFieldComponent, TextFieldComponent, TextareaFieldComponent, TimeFieldComponent, UI_TEXT, UPLOAD_HANDLER, UiTextService, UrlFieldComponent, VALIDATION_MESSAGES, VALIDATOR_REGISTRY, ValidationMessagesService, ValidatorRegistryService, builtInFieldTypes, defaultSheetParser, fieldDescribedBy, fieldDomId, nextFieldInstanceId, phoneValidator, provideBuiltInFieldTypes, provideFieldTypes, provideHttpImportTransport, provideNgxDynamicEntity, refreshChoiceOptions, resolveUiText, urlValidator };
3666
+ export { ASYNC_VALIDATOR_REGISTRY, ArrayFieldComponent, BooleanFieldComponent, COMMON_MODULES_REGISTRY, CONFIG_SOURCE, CascadeDataService, CheckboxFieldComponent, ColorFieldComponent, ConfigSourceService, CurrencyFieldComponent, DEFAULT_UI_TEXT, DEFAULT_VALIDATION_MESSAGES, DateFieldComponent, DateTimeFieldComponent, DropdownFieldComponent, DynamicFieldComponent, DynamicFormComponent, DynamicRecordFormComponent, ENTITY_REF_CACHE_STORE, ENTITY_REF_REGISTRY, EmailFieldComponent, EntityImportComponent, EntityRefFieldComponent, EntityRefRegistryService, EntityRefSelectionService, EntityReferenceService, FIELD_TYPE_REGISTRY, FIELD_TYPE_SETS, FieldRegistryService, FileFieldComponent, GroupFieldComponent, HOOK_REGISTRY, HookRegistryService, HttpImportTransport, IMPORT_TRANSPORT, ImageFieldComponent, ImportErrorsComponent, ImportMapperComponent, ImportPreviewComponent, ImportTemplateComponent, InMemoryEntityRefCacheStore, LOOKUP_REGISTRY, LocalImportTransport, LookupRegistryService, MARKDOWN_RENDERER, MASKED_PLACEHOLDER, MASKED_ROLES, MarkdownFieldComponent, MonthYearFieldComponent, MultiSelectFieldComponent, NumberFieldComponent, PasswordFieldComponent, PhoneFieldComponent, RECORD_MIGRATIONS, RadioFieldComponent, RatingFieldComponent, RbacService, RulesEvaluationService, SHEET_PARSER, SYSTEM_DEFAULT_CAN_EDIT, SliderFieldComponent, TagsFieldComponent, TextFieldComponent, TextareaFieldComponent, TimeFieldComponent, UI_TEXT, UPLOAD_HANDLER, UiTextService, UrlFieldComponent, VALIDATION_MESSAGES, VALIDATOR_REGISTRY, ValidationMessagesService, ValidatorRegistryService, builtInFieldTypes, compareDateOrders, defaultSheetParser, fieldDescribedBy, fieldDomId, nextFieldInstanceId, phoneValidator, provideBuiltInFieldTypes, provideFieldTypes, provideHttpImportTransport, provideNgxDynamicEntity, refreshChoiceOptions, resolveUiText, urlValidator };
3611
3667
  export type { ChoiceOptionHost, ConfigSourceHandler, DynamicFieldComponentContract, EntityRefCacheStore, EntityRefSelection, HookFn, HttpImportTransportOptions, ImportContext, ImportPreview, ImportTransport, InvalidField, MessageOrderEntry, NgxDynamicEntityConfig, RuleSyncContext, SheetParser, TemplateFormat, UiTextKey, UiTextOverrides, UiTextOverridesFor, UiTextParams, UiTextResolver, UiTextResolverFor, UiTextValue, ValidationMessage };