@masterteam/components 0.0.193 → 0.0.194

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": "@masterteam/components",
3
- "version": "0.0.193",
3
+ "version": "0.0.194",
4
4
  "publishConfig": {
5
5
  "directory": "../../../dist/masterteam/components",
6
6
  "linkDirectory": true,
@@ -1,6 +1,6 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { AfterViewInit, InjectionToken, Type } from '@angular/core';
3
- import { LookupMatrixFieldConfig, LookupOptionItemConfig, LookupMatrixCellConfig, SchedulePredecessorFieldRuntimeContext, EntityListFieldRuntimeContext, ScheduleItemSelectorFieldRuntimeContext, LookupCheckListPropertyConfig } from '@masterteam/components';
2
+ import { AfterViewInit, InjectionToken, Type, OnInit } from '@angular/core';
3
+ import { LookupMatrixFieldConfig, LookupOptionItemConfig, LookupMatrixCellConfig, SchedulePredecessorFieldRuntimeContext, EntityListFieldRuntimeContext, ScheduleItemSelectorFieldRuntimeContext, LookupCheckListPropertyConfig, LookupModuleCheckListFieldRuntimeContext } from '@masterteam/components';
4
4
  import { ControlValueAccessor, Validators, NgControl } from '@angular/forms';
5
5
  import { HttpContext } from '@angular/common/http';
6
6
  import { ColumnDef, TableAction } from '@masterteam/components/table';
@@ -401,6 +401,41 @@ declare class ScheduleItemSelectorField implements ControlValueAccessor {
401
401
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<ScheduleItemSelectorField, "mt-schedule-item-selector-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "propertyKey": { "alias": "propertyKey"; "required": false; "isSignal": true; }; "selectionMode": { "alias": "selectionMode"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; "context": { "alias": "context"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
402
402
  }
403
403
 
404
+ /**
405
+ * Inputs for the injected checklist form (one instance per field). It loads the
406
+ * scope module form once and renders a collapsible section per lookup item.
407
+ * Passed via `ngComponentOutlet` inputs.
408
+ */
409
+ interface LookupCheckListFormInputs {
410
+ /** Lookup items rendered as collapsible sections. */
411
+ lookupOptions: LookupOptionItemConfig[];
412
+ /** Property keys to render in each section form. */
413
+ propertyKeys: string[];
414
+ /** Scope module id whose form is loaded once via `process-form-load`. */
415
+ moduleId: number | string | null;
416
+ /** Current level id. */
417
+ levelId: number | string | null;
418
+ /** Current workspace instance id. */
419
+ levelDataId: number | string | null;
420
+ /** Current aggregated value (array of `{ lookupKey, props }`). */
421
+ value: unknown;
422
+ /** Whether the field is read-only. */
423
+ readonly: boolean;
424
+ /** Called whenever the aggregated checklist value changes. */
425
+ valueChange: (value: unknown) => void;
426
+ /** Called whenever the aggregated validity changes (true = incomplete). */
427
+ validityChange: (invalid: boolean) => void;
428
+ }
429
+ /**
430
+ * Token used by `mt-lookup-module-check-list-field` to render the checklist
431
+ * sections + per-section forms via `@masterteam/forms`'s `mt-client-form`
432
+ * machinery (`/api/process-form-load`, loaded once). Apps register it with
433
+ * `provideLookupModuleCheckListForm()` from
434
+ * `@masterteam/forms/lookup-module-check-list-form`. When the token is not
435
+ * registered, the field falls back to plain text inputs per property.
436
+ */
437
+ declare const LOOKUP_CHECK_LIST_FORM_COMPONENT: InjectionToken<Type<unknown>>;
438
+
404
439
  /** Stored entry as persisted in the property value array. */
405
440
  interface StoredCheckListProp {
406
441
  key: string;
@@ -410,42 +445,82 @@ interface StoredCheckListEntry {
410
445
  lookupKey: string;
411
446
  props: StoredCheckListProp[];
412
447
  }
413
- /** Internal editable entry — prop values keyed by property key. */
414
- interface CheckListEntry {
448
+ /** A collapsible section bound to one lookup item. */
449
+ interface CheckListSection {
415
450
  lookupKey: string;
416
- values: Record<string, string>;
451
+ label: string;
417
452
  }
418
- declare class LookupModuleCheckListField implements ControlValueAccessor {
453
+ declare class LookupModuleCheckListField implements ControlValueAccessor, OnInit {
419
454
  readonly label: _angular_core.InputSignal<string>;
420
455
  readonly readonly: _angular_core.InputSignal<boolean>;
421
456
  readonly required: _angular_core.InputSignal<boolean>;
422
- /** Lookup items the user can pick for each checklist entry. */
457
+ /** Lookup items rendered as collapsible checklist sections. */
423
458
  readonly lookupOptions: _angular_core.InputSignal<LookupOptionItemConfig[]>;
424
- /** Module property keys/labels captured per checklist entry. */
459
+ /** Module property keys/labels (used by the text fallback + labels). */
425
460
  readonly propertyFields: _angular_core.InputSignal<LookupCheckListPropertyConfig[]>;
426
- protected readonly entries: _angular_core.WritableSignal<CheckListEntry[]>;
461
+ /** Scope module id whose form is loaded for each section. */
462
+ readonly scopeId: _angular_core.InputSignal<string | number | null>;
463
+ /** Property keys to render in each section form. */
464
+ readonly propertyKeys: _angular_core.InputSignal<string[]>;
465
+ /** Runtime ids needed to load each section form. */
466
+ readonly runtimeContext: _angular_core.InputSignal<LookupModuleCheckListFieldRuntimeContext | null>;
467
+ /** Per-lookupKey captured values, keyed by property key. */
468
+ private readonly sectionValues;
469
+ private readonly expandedKeys;
427
470
  protected readonly disabled: _angular_core.WritableSignal<boolean>;
471
+ /** True when a section's required inner fields are unfilled. */
472
+ private readonly incomplete;
428
473
  ngControl: NgControl | null;
474
+ /**
475
+ * Rich checklist form provided by `@masterteam/forms`
476
+ * (`provideLookupModuleCheckListForm()`). When absent the field falls back to
477
+ * plain text inputs per property.
478
+ */
479
+ protected readonly formComponent: _angular_core.Type<unknown> | null;
429
480
  protected readonly isReadonly: _angular_core.Signal<boolean>;
481
+ protected readonly sections: _angular_core.Signal<CheckListSection[]>;
482
+ /** Use the rich form only when registered and the runtime context is ready. */
483
+ protected readonly useRichForm: _angular_core.Signal<boolean>;
484
+ /**
485
+ * The last externally-written value (via `writeValue`). Passed to the rich
486
+ * form as its initial value. It is intentionally NOT updated from the form's
487
+ * own `valueChange` — feeding emitted values back as an input would create an
488
+ * infinite change-detection loop.
489
+ */
490
+ private readonly incomingValue;
430
491
  private onTouched;
431
492
  private onModelChange;
493
+ private control;
494
+ private validatorAttached;
495
+ /**
496
+ * Validator attached imperatively to the host control. Attaching it here
497
+ * (rather than via an `NG_VALIDATORS` provider) avoids a circular dependency
498
+ * with the self-injected `NgControl` used as the value accessor.
499
+ */
500
+ private readonly checklistValidator;
501
+ /** Stable callbacks so the outlet inputs object stays referentially calm. */
502
+ private readonly emitValue;
503
+ private readonly emitValidity;
432
504
  constructor();
505
+ ngOnInit(): void;
506
+ private ensureValidator;
433
507
  writeValue(value: unknown): void;
434
508
  registerOnChange(fn: (value: StoredCheckListEntry[] | null) => void): void;
435
509
  registerOnTouched(fn: () => void): void;
436
510
  setDisabledState(isDisabled: boolean): void;
437
- protected addEntry(): void;
438
- protected removeEntry(index: number): void;
439
- protected setLookupKey(index: number, lookupKey: unknown): void;
440
- protected setPropValue(index: number, key: string, value: string): void;
441
- protected lookupLabel(lookupKey: string): string;
442
- private emit;
511
+ protected readonly formInputs: _angular_core.Signal<LookupCheckListFormInputs>;
512
+ protected isExpanded(lookupKey: string): boolean;
513
+ protected toggle(lookupKey: string): void;
514
+ protected hasValues(lookupKey: string): boolean;
515
+ protected fieldValue(lookupKey: string, propKey: string): string;
516
+ protected setFieldValue(lookupKey: string, propKey: string, value: string): void;
517
+ private pushModelValue;
518
+ private buildPayload;
443
519
  private normalizeIncoming;
444
520
  private extractEntries;
445
- private coerceToString;
446
521
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<LookupModuleCheckListField, never>;
447
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<LookupModuleCheckListField, "mt-lookup-module-check-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "lookupOptions": { "alias": "lookupOptions"; "required": false; "isSignal": true; }; "propertyFields": { "alias": "propertyFields"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
522
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<LookupModuleCheckListField, "mt-lookup-module-check-list-field", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "lookupOptions": { "alias": "lookupOptions"; "required": false; "isSignal": true; }; "propertyFields": { "alias": "propertyFields"; "required": false; "isSignal": true; }; "scopeId": { "alias": "scopeId"; "required": false; "isSignal": true; }; "propertyKeys": { "alias": "propertyKeys"; "required": false; "isSignal": true; }; "runtimeContext": { "alias": "runtimeContext"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
448
523
  }
449
524
 
450
- export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField };
451
- export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, EntityListAddDialogInputs, SchemaConnectionConfig, SourceLevelState };
525
+ export { ENTITY_LIST_ADD_DIALOG_COMPONENT, EntityListField, LOOKUP_CHECK_LIST_FORM_COMPONENT, LookupMatrixField, LookupModuleCheckListField, ScheduleItemSelectorField, SchedulePredecessorField, SchemaConnectionField };
526
+ export type { ConnectionPayload, ConnectionSource, ConnectionSourceLevel, EntityListAddDialogInputs, LookupCheckListFormInputs, SchemaConnectionConfig, SourceLevelState };
@@ -410,7 +410,7 @@ declare class EntityAttachment {
410
410
  readonly data: _angular_core.InputSignal<EntityData | undefined>;
411
411
  readonly name: _angular_core.InputSignal<string | undefined>;
412
412
  readonly shape: _angular_core.InputSignal<"compact" | "default">;
413
- readonly value: _angular_core.InputSignal<string | EntityAttachmentValue | EntityAttachmentItemValue | null | undefined>;
413
+ readonly value: _angular_core.InputSignal<string | EntityAttachmentItemValue | EntityAttachmentValue | null | undefined>;
414
414
  readonly endPoint: _angular_core.InputSignal<string>;
415
415
  readonly context: _angular_core.InputSignal<HttpContext | undefined>;
416
416
  private readonly httpClient;
@@ -51,13 +51,21 @@ declare class LocationField implements ControlValueAccessor, OnDestroy {
51
51
  protected readonly isInvalid: typeof isInvalid;
52
52
  private readonly modal;
53
53
  private readonly transloco;
54
+ private readonly document;
54
55
  private readonly http;
55
56
  private readonly searchTerms;
57
+ /**
58
+ * Bumped every time a value is committed (select / manual entry / clear /
59
+ * external write). A blur cleanup scheduled before a commit is ignored once
60
+ * it fires, preventing it from undoing a value selected in the meantime.
61
+ */
62
+ private committedValueVersion;
63
+ private blurCleanupHandle;
56
64
  private inputFocused;
57
- private selectionSettling;
65
+ private suggestionPointerActive;
66
+ private hasUncommittedSearchText;
58
67
  private ignoreSearchResultsUntilNextSearch;
59
- private clearSuggestionsWhenAutocompleteSettles;
60
- private suggestionsClearFallbackHandle;
68
+ private readonly handleDocumentPointerDown;
61
69
  protected onTouched: () => void;
62
70
  private onModelChange;
63
71
  constructor();
@@ -66,22 +74,32 @@ declare class LocationField implements ControlValueAccessor, OnDestroy {
66
74
  query: string;
67
75
  }): void;
68
76
  protected onFocus(): void;
77
+ protected onBlur(): void;
69
78
  protected onSelect(event: {
70
79
  originalEvent: Event;
71
80
  value: LocationValue;
72
81
  }): void;
73
82
  protected onClear(): void;
74
- protected onAutocompleteHide(): void;
83
+ protected onSuggestionPointerDown(): void;
75
84
  protected openManualDialog(): void;
76
85
  writeValue(value: unknown): void;
77
86
  registerOnChange(fn: (value: LocationValue | null) => void): void;
78
87
  registerOnTouched(fn: () => void): void;
79
88
  setDisabledState(disabled: boolean): void;
80
- private setValue;
81
- private deferSuggestionsClearUntilAutocompleteSettles;
82
- private clearSuggestionsAfterAutocompleteSettled;
83
- private cancelDeferredSuggestionsClear;
84
- private cancelSuggestionsClearFallback;
89
+ private commitValue;
90
+ private isOwnAutocompleteOption;
91
+ private getInputElement;
92
+ private cancelPendingBlurCleanup;
93
+ /**
94
+ * On blur, reconcile the free-typed input text with the committed value:
95
+ * a selected location keeps showing its display name, exact-match text is
96
+ * kept, and anything else (stale or unmatched typing) is discarded. This
97
+ * replaces PrimeNG `forceSelection`, which raced with async suggestions.
98
+ */
99
+ private resetUncommittedSearch;
100
+ private clearInput;
101
+ private writeInput;
102
+ private clearSearchState;
85
103
  private searchLocations;
86
104
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<LocationField, never>;
87
105
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<LocationField, "mt-location-field", never, { "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "readonly": { "alias": "readonly"; "required": false; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "minLength": { "alias": "minLength"; "required": false; "isSignal": true; }; "configuration": { "alias": "configuration"; "required": false; "isSignal": true; }; "searchUrl": { "alias": "searchUrl"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
@@ -239,7 +239,7 @@ declare class Table {
239
239
  captionStartContent: _angular_core.Signal<TemplateRef<any> | undefined>;
240
240
  captionEndContent: _angular_core.Signal<TemplateRef<any> | undefined>;
241
241
  emptyContent: _angular_core.Signal<TemplateRef<any> | undefined>;
242
- paginatorPosition: _angular_core.InputSignal<"end" | "start" | "center">;
242
+ paginatorPosition: _angular_core.InputSignal<"center" | "end" | "start">;
243
243
  alwaysShowPaginator: _angular_core.InputSignalWithTransform<boolean, unknown>;
244
244
  rowsPerPageOptions: _angular_core.InputSignal<number[]>;
245
245
  pageSize: _angular_core.ModelSignal<number>;
@@ -248,7 +248,7 @@ declare class Table {
248
248
  filterTerm: _angular_core.ModelSignal<string>;
249
249
  groupBy: _angular_core.ModelSignal<string | null>;
250
250
  sortField: _angular_core.WritableSignal<string | null>;
251
- sortDirection: _angular_core.WritableSignal<"asc" | "desc" | null>;
251
+ sortDirection: _angular_core.WritableSignal<"desc" | "asc" | null>;
252
252
  confirmationService: ConfirmationService;
253
253
  private readonly exportService;
254
254
  private readonly transloco;
@@ -579,16 +579,31 @@ interface LookupCheckListPropertyConfig {
579
579
  /** Human-readable label shown next to the input. */
580
580
  label: string;
581
581
  }
582
+ interface LookupModuleCheckListFieldRuntimeContext {
583
+ /** Current level id — passed to `process-form-load` for each section form. */
584
+ levelId?: number | string | null;
585
+ /** Current workspace instance id — passed to `process-form-load`. */
586
+ levelDataId?: number | string | null;
587
+ }
582
588
  declare class LookupModuleCheckListFieldConfig extends BaseFieldConfig {
583
- /** Lookup items the user can pick for each checklist entry. */
589
+ /** Lookup items rendered as collapsible checklist sections. */
584
590
  lookupOptions: LookupOptionItemConfig[];
585
591
  /** Module property keys/labels captured per checklist entry. */
586
592
  propertyFields: LookupCheckListPropertyConfig[];
593
+ /** Scope module id whose form is loaded for each section. */
594
+ scopeId: number | string | null;
595
+ /** Property keys to render in each section form (`allowedFieldKeys`). */
596
+ propertyKeys: string[];
597
+ /** Runtime ids needed to load each section form. */
598
+ runtimeContext: LookupModuleCheckListFieldRuntimeContext | null;
587
599
  /** Raw property configuration (lookup id, scope/module id, properties). */
588
600
  configuration: any;
589
601
  constructor(config: Omit<BaseFieldConstructorConfig, 'type'> & {
590
602
  lookupOptions?: LookupOptionItemConfig[];
591
603
  propertyFields?: LookupCheckListPropertyConfig[];
604
+ scopeId?: number | string | null;
605
+ propertyKeys?: string[];
606
+ runtimeContext?: LookupModuleCheckListFieldRuntimeContext | null;
592
607
  configuration?: any;
593
608
  });
594
609
  }
@@ -949,4 +964,4 @@ declare class MTDateFormatPipe implements PipeTransform {
949
964
  }
950
965
 
951
966
  export { BaseFacade, BaseFieldConfig, CheckboxFieldConfig, ColorPickerFieldConfig, CrudStateBase, DEFAULT_MT_DATE_FORMATS, DateFieldConfig, EditorFieldConfig, EntityListFieldConfig, IconFieldConfig, LocationFieldConfig, LookupMatrixFieldConfig, LookupModuleCheckListFieldConfig, MTDateFormatPipe, MT_DATE_FORMATS, MultiSelectFieldConfig, NumberFieldConfig, PickListFieldConfig, REQUEST_CONTEXT, RadioButtonFieldConfig, RadioCardsFieldConfig, ScheduleItemSelectorFieldConfig, SchedulePredecessorFieldConfig, SchemaConnectionFieldConfig, SelectFieldConfig, SliderFieldConfig, SpacerFieldConfig, TextFieldConfig, TextareaFieldConfig, ToggleFieldConfig, UploadFileFieldConfig, UserSearchFieldConfig, ValidatorConfig, changeBackgroundColor, changePrimaryColor, changeTextColor, createCustomValidator, createEntityAdapter, endLoading, generateTailwindPalette, getContrastColor, getLightColor, handleApiRequest, isInvalid, provideMTComponents, provideMTConfirmation, provideMTDateFormats, provideMTMessages, setLoadingError, startLoading, toAngularDateFormat, wrapValidatorWithMessage };
952
- export type { ApiRequestConfig, BaseFieldConstructorConfig, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, EntityListFieldRuntimeContext, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, FormulaConditionConfig, FormulaConditionMode, FormulaRuntimeMessage, FormulaRuntimeMessageCode, FormulaValidationRuleConfig, FormulaValidationSeverity, LayoutConfig, LoadingStateShape, LookupCheckListPropertyConfig, LookupMatrixCellConfig, LookupOptionItemConfig, MTDateFormatType, MTDateFormats, MTThemeOptions, PaletteShade, QueryResult, RequestContextConfig, Response, ResponsiveColSpan, ScheduleItemSelectorFieldRuntimeContext, SchedulePredecessorFieldRuntimeContext, SectionConfig, ValidatorType };
967
+ export type { ApiRequestConfig, BaseFieldConstructorConfig, CrudCreateConfig, CrudDeleteConfig, CrudLoadConfig, CrudUpdateConfig, DynamicFieldConfig, DynamicFormConfig, EntityAdapter, EntityListFieldRuntimeContext, FieldRelationAction, FieldRelationConfig, FieldState, FieldType, FormulaConditionConfig, FormulaConditionMode, FormulaRuntimeMessage, FormulaRuntimeMessageCode, FormulaValidationRuleConfig, FormulaValidationSeverity, LayoutConfig, LoadingStateShape, LookupCheckListPropertyConfig, LookupMatrixCellConfig, LookupModuleCheckListFieldRuntimeContext, LookupOptionItemConfig, MTDateFormatType, MTDateFormats, MTThemeOptions, PaletteShade, QueryResult, RequestContextConfig, Response, ResponsiveColSpan, ScheduleItemSelectorFieldRuntimeContext, SchedulePredecessorFieldRuntimeContext, SectionConfig, ValidatorType };