mn-angular-lib 1.0.92 → 1.0.94

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": "mn-angular-lib",
3
- "version": "1.0.92",
3
+ "version": "1.0.94",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.1.3",
6
6
  "@angular/core": "^21.1.3"
@@ -2604,6 +2604,24 @@ type OffsetPaginationStrategy = {
2604
2604
  pageSize: number;
2605
2605
  totalItems?: number;
2606
2606
  } & PaginationStrategy;
2607
+ /**
2608
+ * Lifecycle state of a collection's data, driving which chrome the component
2609
+ * renders: skeleton placeholders ({@link LOADING}), the rows or empty state
2610
+ * ({@link RETRIEVED}), or an error placeholder ({@link ERROR}).
2611
+ *
2612
+ * Preferred over the legacy boolean {@link MnCollectionDataSource.isDataLoading}.
2613
+ * Because the components are zoneless, a consumer that flips `state` to `ERROR`
2614
+ * (or `RETRIEVED`) must also emit on `dataRows` (e.g. `dataRows.next([])`) so the
2615
+ * component runs change detection and re-reads the new state.
2616
+ */
2617
+ declare enum MnCollectionState {
2618
+ /** Data is being (re)loaded; skeleton placeholders are shown. */
2619
+ LOADING = "LOADING",
2620
+ /** Data has loaded (possibly empty); rows or the empty state are shown. */
2621
+ RETRIEVED = "RETRIEVED",
2622
+ /** Loading failed; the error placeholder is shown. */
2623
+ ERROR = "ERROR"
2624
+ }
2607
2625
  type PaginationMode = 'none' | 'load-more' | 'paginated' | 'client-side-pagination' | 'infinite-scroll';
2608
2626
  type MnCollectionLabels = {
2609
2627
  loadMore?: string;
@@ -2628,9 +2646,25 @@ type MnCollectionDataSource<T> = {
2628
2646
  /** Translation key for the empty message. When set, the component resolves it via MnLanguageService. */
2629
2647
  emptyMessageKey?: string;
2630
2648
  emptyTemplate?: TemplateRef<unknown>;
2631
- isDataLoading: boolean;
2649
+ /**
2650
+ * Lifecycle state of the data. Preferred over {@link isDataLoading}; when set it
2651
+ * fully controls loading / error / empty rendering. Defaults to RETRIEVED when
2652
+ * neither `state` nor `isDataLoading` is provided.
2653
+ */
2654
+ state?: MnCollectionState;
2655
+ /**
2656
+ * @deprecated Use {@link state} instead. Legacy boolean loading flag, still
2657
+ * honoured when {@link state} is not set (`true` ⇒ LOADING, `false` ⇒ RETRIEVED).
2658
+ */
2659
+ isDataLoading?: boolean;
2632
2660
  /** Number of placeholder rows rendered while data is loading. Defaults to 5. */
2633
2661
  skeletonRowCount?: number;
2662
+ /** Message shown in the error placeholder when {@link state} is ERROR. */
2663
+ errorMessage?: string;
2664
+ /** Translation key for {@link errorMessage}; resolved via MnLanguageService. */
2665
+ errorMessageKey?: string;
2666
+ /** Custom template rendered in place of the default error placeholder. */
2667
+ errorTemplate?: TemplateRef<unknown>;
2634
2668
  canSearch: boolean;
2635
2669
  searchPlaceholder?: string;
2636
2670
  /** Translation key for the search placeholder. When set, the component resolves it via MnLanguageService. */
@@ -2864,6 +2898,17 @@ declare abstract class MnCollectionBase<T, DS extends MnCollectionDataSource<T>>
2864
2898
  /** Tracks the previous toolbar template reference for change detection. */
2865
2899
  private previousToolbarTemplate?;
2866
2900
  constructor();
2901
+ /**
2902
+ * Single source of truth for the data lifecycle: the explicit
2903
+ * {@link MnCollectionDataSource.state} when provided, otherwise derived from the
2904
+ * legacy {@link MnCollectionDataSource.isDataLoading} boolean. Every internal
2905
+ * loading check routes through this so both APIs stay in lockstep.
2906
+ */
2907
+ get collectionState(): MnCollectionState;
2908
+ /** Whether the collection is currently loading (skeleton placeholders shown). */
2909
+ get isLoadingState(): boolean;
2910
+ /** Whether loading failed (the error placeholder is shown instead of rows/empty). */
2911
+ get isErrorState(): boolean;
2867
2912
  /** Whether the component delegates search to the consumer (server-side). */
2868
2913
  get isServerSearched(): boolean;
2869
2914
  get isPaginated(): boolean;
@@ -5464,7 +5509,7 @@ type MnTabDataSource = {
5464
5509
  * Tab component that renders a horizontal tab bar.
5465
5510
  * Supports translation keys for labels via MnTranslatePipe.
5466
5511
  */
5467
- declare class MnTabComponent implements OnInit {
5512
+ declare class MnTabComponent implements DoCheck {
5468
5513
  /** Data source containing tab items and default active index. */
5469
5514
  dataSource: MnTabDataSource;
5470
5515
  /**
@@ -5486,18 +5531,32 @@ declare class MnTabComponent implements OnInit {
5486
5531
  * otherwise the number of known items, falling back to a default when none.
5487
5532
  */
5488
5533
  get skeletonTabs(): number[];
5489
- /** Initializes the default active tab based on the data source configuration. */
5490
- ngOnInit(): void;
5491
5534
  /**
5492
- * Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
5493
- * @param item - The tab item whose badge to resolve.
5535
+ * Re-resolves the active tab on every change-detection pass.
5536
+ *
5537
+ * The data source is often populated or rebuilt asynchronously (tabs that
5538
+ * depend on fetched data or permissions). Resolving the active tab only once
5539
+ * at init would leave {@link currentActive} pointing at a stale item — the
5540
+ * tab bar would then highlight nothing and swallow the first click — so the
5541
+ * selection is kept in sync with whatever the data source currently holds.
5494
5542
  */
5495
- getBadge(item: MnTabItem): number | undefined;
5543
+ ngDoCheck(): void;
5496
5544
  /**
5497
5545
  * Sets the given tab item as active, invoking deactivate/activate callbacks.
5498
5546
  * @param item - The tab item to activate.
5499
5547
  */
5500
5548
  setActive(item: MnTabItem): void;
5549
+ /**
5550
+ * Returns the resolved badge value for a tab item, supporting both plain numbers and Signal<number>.
5551
+ * @param item - The tab item whose badge to resolve.
5552
+ */
5553
+ getBadge(item: MnTabItem): number | undefined;
5554
+ /**
5555
+ * Ensures {@link currentActive} references a tab that still exists in the data
5556
+ * source, falling back to the configured default tab when the current
5557
+ * selection is missing or stale (e.g. after the items array is replaced).
5558
+ */
5559
+ private syncActiveTab;
5501
5560
  static ɵfac: i0.ɵɵFactoryDeclaration<MnTabComponent, never>;
5502
5561
  static ɵcmp: i0.ɵɵComponentDeclaration<MnTabComponent, "mn-tab", never, { "dataSource": { "alias": "dataSource"; "required": false; }; "scrollable": { "alias": "scrollable"; "required": false; }; "justified": { "alias": "justified"; "required": false; }; }, { "activeChange": "activeChange"; }, never, never, true, never>;
5503
5562
  }
@@ -6056,5 +6115,5 @@ type MnPreviewMessage = {
6056
6115
  */
6057
6116
  declare function enableMnPreviewMode(configService: MnConfigService, langService: MnLanguageService, allowedOrigins?: string[]): void;
6058
6117
 
6059
- export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
6118
+ export { API_BASE_URL, ActionStyle, BackdropMode, BaseModalBuilder, CALENDAR_CONFIG, CALENDAR_DATE_FORMATTER, CalendarDayComponent, CalendarEventComponent, CalendarEventDefaultComponent, CalendarEventLayoutService, CalendarMonthComponent, CalendarUtility, CalendarView, CalendarViewComponent, CalendarWeekComponent, CloseMode, ColumnSortType, ConfirmationModalBuilder, ConfirmationTone, CrudService, CustomModalBuilder, DEFAULT_CALENDAR_CONFIG, DEFAULT_MN_ALERT_CONFIG, DefaultCalendarDateFormatter, FieldAppearance, FieldKind, FormLayoutMode, FormModalBuilder, KeyboardMode, MN_ALERT_CONFIG, MN_CALENDAR_COMPONENT_NAME, MN_CALENDAR_CONFIG, MN_CHECKBOX_CONFIG, MN_DATETIME_CONFIG, MN_ICON_MAP, MN_INPUT_FIELD_CONFIG, MN_INSTANCE_ID, MN_LIB_DUAL_HORIZONTAL_IMAGE, MN_MULTI_SELECT_CONFIG, MN_SECTION_PATH, MN_SELECT_CONFIG, MN_TEXTAREA_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, MnBadge, MnButton, MnCheckbox, MnCollectionBase, MnCollectionPagination, MnCollectionState, MnConfigService, MnConfirmationBodyComponent, MnCustomBodyHostComponent, MnDatetime, MnDualHorizontalImage, MnFileInput, MnFormBodyComponent, MnGrid, MnHiddenBelowDirective, MnHttpService, MnIcon, MnIconAttributes, MnInformationCard, MnInputField, MnInstanceDirective, MnLanguageService, MnList, MnModalRef, MnModalService, MnModalShellComponent, MnMultiSelect, MnSectionDirective, MnSelect, MnSelectableCollectionBase, MnShowAboveDirective, MnShowBelowDirective, MnSkeleton, MnTabComponent, MnTable, MnTextarea, MnTranslatePipe, MnWizardBodyComponent, ModalBuilder, ModalCloseReason, ModalIntent, ModalKind, ModalSize, NavigationDirection, OptionState, SelectionMode, StepBuilder, StepState, SubmitMode, UpcomingEventRowComponent, UpcomingEventsComponent, ValidationCode, ValidationStatus, WizardFlowMode, WizardModalBuilder, dateTimeAdapter, defaultTextAdapter, enableMnPreviewMode, isTranslatable, mnAlertVariants, mnBadgeVariants, mnButtonVariants, mnCheckboxVariants, mnCheckboxWrapperVariants, mnDatetimeVariants, mnFileInputVariants, mnIconVariants, mnInformationCardVariants, mnInputFieldVariants, mnMultiSelectVariants, mnSelectVariants, mnSkeletonVariants, mnTextareaVariants, numberAdapter, pickAdapter, provideMnAlerts, provideMnCalendarConfig, provideMnComponentConfig, provideMnConfig, provideMnLanguage, resolveCalendarConfig };
6060
6119
  export type { AnimationOptions, ApiError, BaseModalConfig, CalendarButton, CalendarConfig, CalendarDateFormatter, CalendarEvent, CalendarEventData, CancellationActionConfig, CheckboxFieldConfig, ColorFieldConfig, ColorPreset, ColumnDay, ColumnDefinition, ColumnFilterOption, ColumnFilterState, ColumnFilterType, ColumnSkeleton, ConfirmationActionConfig, ConfirmationModalConfig, CrudConfig, CurrentTimeCalendarEvent, CursorPaginationStrategy, CustomFieldConfig, CustomModalConfig, DateFieldConfig, DatetimeFieldConfig, FailureResult, FieldDataSource, FieldRequiredCondition, FieldValidator, FieldVisibilityCondition, FileFieldConfig, FormFieldConfig, FormFieldGroup, FormModalConfig, FormRow, FormRowField, FormValidator, GridDataSource, GridLayout, GridSkeleton, HourRow, ListAppearance, ListDataSource, ListLabels, ListSkeleton, MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnBadgeTypes, MnBadgeVariants, MnButtonTypes, MnButtonVariants, MnCheckboxErrorMessageData, MnCheckboxErrorMessagesData, MnCheckboxProps, MnCheckboxUIConfig, MnCheckboxVariants, MnCheckboxWrapperVariants, MnCollectionDataSource, MnCollectionLabels, MnConfigFile, MnConfigSettings, MnConfigValue, MnDatetimeErrorMessageData, MnDatetimeErrorMessagesData, MnDatetimeMode, MnDatetimeProps, MnDatetimeUIConfig, MnDatetimeVariants, MnDomAttrs, MnDualHorizontalImageConfig, MnDualHorizontalImageTypes, MnErrorMessageData, MnErrorMessageFn, MnErrorMessagesData, MnFileDisplayItem, MnFileInputDisplayMode, MnFileInputErrorMessageData, MnFileInputErrorMessagesData, MnFileInputProps, MnFileInputUIConfig, MnFileInputVariants, MnIconTypes, MnIconVariants, MnImageType, MnInformationCardBaseData, MnInformationCardData, MnInformationCardVariants, MnInputAdapter, MnInputBaseProps, MnInputDateTimeProps, MnInputFieldProps, MnInputFieldUIConfig, MnInputProps, MnInputType, MnInputVariants, MnLanguageConfig, MnMultiSelectErrorMessageData, MnMultiSelectErrorMessagesData, MnMultiSelectOption, MnMultiSelectProps, MnMultiSelectUIConfig, MnMultiSelectVariants, MnPreviewMessage, MnQueryParams, MnSelectErrorMessageData, MnSelectErrorMessagesData, MnSelectOption, MnSelectProps, MnSelectUIConfig, MnSelectVariants, MnSelectableCollectionDataSource, MnShowInput, MnSkeletonProps, MnSkeletonShape, MnSkeletonVariantProps, MnTabDataSource, MnTabItem, MnTextareaErrorMessageData, MnTextareaErrorMessagesData, MnTextareaProps, MnTextareaUIConfig, MnTextareaVariants, MnTranslatable, MnTranslationMap, MnTranslations, MnValidationErrorArgs, ModalCancelHandler, ModalCloseEvent, ModalConfig, ModalFooterAction, ModalI18nLabels, ModalInputMap, ModalPollingConfig, ModalRef, ModalResultHandler, ModalStepId, MonthItem, MultiSelectFieldConfig, MultiSelectTableFieldConfig, NumberFieldConfig, OffsetPaginationStrategy, PaginationMode, PaginationStrategy, PasswordFieldConfig, Primitive, QueryParams, QueryValue, RatingFieldConfig, Result, ResultMeta, SelectFieldConfig, SelectOption, SingleSelectTableFieldConfig, SliderFieldConfig, SortState, StepBodyConfig, StepGuard, StepValidator, SuccessResult, TableAppearance, TableDataSource, TableLabels, TextFieldConfig, TextareaFieldConfig, ValidationResult, WizardBeforeCompleteValidator, WizardModalConfig, WizardResult, WizardStepChangeEvent, WizardStepChangeHandler, WizardStepConfig };