@openmfp/ngx 0.18.3 → 0.18.5

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,12 +1,12 @@
1
1
  {
2
2
  "name": "@openmfp/ngx",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/openmfp/webcomponents.git"
7
7
  },
8
8
  "dependencies": {
9
- "gridstack": "^13.0.0",
9
+ "gridstack": "^13.0.1",
10
10
  "tslib": "2.8.1"
11
11
  },
12
12
  "peerDependencies": {
@@ -2,8 +2,10 @@ import * as _angular_core from '@angular/core';
2
2
  import { OnInit, OnDestroy, Type } from '@angular/core';
3
3
  import { FormGroup, FormControl } from '@angular/forms';
4
4
  import * as _openmfp_ngx from '@openmfp/ngx';
5
+ import * as gridstack from 'gridstack';
6
+ import { Breakpoint, GridStackOptions } from 'gridstack';
7
+ import { GridStackEngine } from 'gridstack/dist/gridstack-engine';
5
8
  import { SafeHtml } from '@angular/platform-browser';
6
- import { GridStackOptions } from 'gridstack';
7
9
 
8
10
  /** Subset of fields of a generic resource that the table/form components rely on. */
9
11
  interface GenericResource extends Record<string, unknown> {
@@ -585,10 +587,43 @@ interface DashboardConfig {
585
587
  editable?: boolean;
586
588
  /** When `true`, the Edit View button is rendered before the custom actions instead of after. Defaults to `false`. */
587
589
  editButtonFirst?: boolean;
590
+ /** When provided, enable z-flow layout. */
591
+ zFlow?: {
592
+ /** Sets the height of each card in the z-flow layout. */
593
+ cardHeight: number;
594
+ };
595
+ }
596
+
597
+ /**
598
+ * Layout strategy applied at each breakpoint when Gridstack changes column
599
+ * count. See ColumnOptions in gridstack/dist/types.d.ts:27 for the full set.
600
+ */
601
+ type LayoutStrategy = 'compact' | 'list' | 'none';
602
+ type DashboardBreakpoint = Readonly<Required<Pick<Breakpoint, 'w' | 'c'>> & {
603
+ layout: LayoutStrategy;
604
+ }>;
605
+
606
+ interface EngineProfile {
607
+ /** GridStack engine class, or undefined to use GridStack's native engine. */
608
+ engineClass: typeof GridStackEngine | undefined;
609
+ /** Column breakpoint table fed to GridStack columnOpts. */
610
+ breakpoints: readonly DashboardBreakpoint[];
611
+ /** Column counts for [sm, md, lg, xl] page size. Pushed to CSS vars so the section grids match. */
612
+ sectionColumns: readonly [number, number, number, number];
613
+ /** When true, all loose cards get a fixed h/maxH from the engine's config. */
614
+ fixedCardHeight: boolean;
615
+ /** When true, the XL-page width swap (3↔4) runs. */
616
+ xlWidthSwap: boolean;
617
+ /** When true, the origin position is rendered. */
618
+ renderOriginPosition: boolean;
588
619
  }
589
620
 
590
621
  declare class Dashboard implements OnInit, OnDestroy {
591
622
  static registerAngularComponents(componentTypes: Type<unknown>[]): void;
623
+ private readonly hostEl;
624
+ private readonly injector;
625
+ private readonly sanitizer;
626
+ protected readonly i18n: DashboardI18nService;
592
627
  config: _angular_core.InputSignal<DashboardConfig>;
593
628
  sections: _angular_core.ModelSignal<SectionConfig[]>;
594
629
  cards: _angular_core.ModelSignal<CardConfig[]>;
@@ -603,30 +638,6 @@ declare class Dashboard implements OnInit, OnDestroy {
603
638
  action: ButtonSettings;
604
639
  }>;
605
640
  readonly unsavedChangesChange: _angular_core.OutputEmitterRef<boolean>;
606
- editMode: _angular_core.WritableSignal<boolean>;
607
- compactToolbar: _angular_core.WritableSignal<boolean>;
608
- toolbarMenuOpen: _angular_core.WritableSignal<boolean>;
609
- /** True once the user has dragged/resized any grid item while in edit mode. */
610
- private gridDirty;
611
- protected backgroundImageHeight: _angular_core.WritableSignal<number | null>;
612
- /** JSON snapshots of sections/cards taken on entering edit mode, used to detect changes. */
613
- private sectionsSnapshotJson;
614
- private cardsSnapshotJson;
615
- /**
616
- * True when the user is in edit mode AND has made any change (sections/cards
617
- * mutated, or grid items moved/resized). Resets when entering edit mode and
618
- * after save/cancel.
619
- */
620
- hasUnsavedChanges: _angular_core.Signal<boolean>;
621
- private sectionsSnapshot;
622
- private cardsSnapshot;
623
- private gridStackItems;
624
- private addCardBtn;
625
- private resizeObserver?;
626
- private readonly hostEl;
627
- private readonly injector;
628
- private readonly sanitizer;
629
- protected readonly i18n: DashboardI18nService;
630
641
  protected readonly i18nKeys: {
631
642
  readonly UNSAVED_CHANGES: "unsavedChanges";
632
643
  readonly EDIT_CARDS: "editCards";
@@ -643,19 +654,39 @@ declare class Dashboard implements OnInit, OnDestroy {
643
654
  readonly REMOVE_CARD: "removeCard";
644
655
  readonly RESIZABLE: "resizable";
645
656
  };
646
- protected safeTitle: _angular_core.Signal<SafeHtml>;
647
- protected safeDescription: _angular_core.Signal<SafeHtml | null>;
648
- protected gridOptions: _angular_core.Signal<GridStackOptions>;
657
+ /** True once the user has dragged/resized any grid item while in edit mode. */
658
+ private gridDirty;
659
+ private isXLPage;
660
+ editMode: _angular_core.WritableSignal<boolean>;
661
+ compactToolbar: _angular_core.WritableSignal<boolean>;
662
+ toolbarMenuOpen: _angular_core.WritableSignal<boolean>;
649
663
  cardDialogOpen: _angular_core.WritableSignal<boolean>;
650
664
  discardDialogOpen: _angular_core.WritableSignal<boolean>;
651
665
  unsavedNavDialogOpen: _angular_core.WritableSignal<boolean>;
652
- /** Callback that resumes the intercepted navigation once the user resolves the dialog. */
653
- private pendingNavigation;
654
- /** beforeunload handler kept on instance so add/removeEventListener pair up. */
655
- private readonly beforeUnloadHandler;
656
- customActions: _angular_core.Signal<ButtonSettings[]>;
657
- addedCardsIds: _angular_core.Signal<Set<string>>;
658
- editViewButton: _angular_core.Signal<{
666
+ backgroundImageHeight: _angular_core.WritableSignal<number | null>;
667
+ dragOriginStyle: _angular_core.WritableSignal<{
668
+ top: string;
669
+ left: string;
670
+ width: string;
671
+ height: string;
672
+ } | null>;
673
+ protected hasUnsavedChanges: _angular_core.Signal<boolean>;
674
+ protected safeTitle: _angular_core.Signal<SafeHtml>;
675
+ protected safeDescription: _angular_core.Signal<SafeHtml | null>;
676
+ protected engineProfile: _angular_core.Signal<EngineProfile>;
677
+ protected gridStackEngine: _angular_core.Signal<typeof gridstack.GridStackEngine | undefined>;
678
+ protected gridBreakpoints: _angular_core.Signal<Readonly<Required<Pick<gridstack.Breakpoint, "w" | "c">> & {
679
+ layout: "compact" | "list" | "none";
680
+ }>[]>;
681
+ protected columnVars: _angular_core.Signal<{
682
+ '--dashboard-cols-sm': number;
683
+ '--dashboard-cols-md': number;
684
+ '--dashboard-cols-lg': number;
685
+ '--dashboard-cols-xl': number;
686
+ }>;
687
+ protected customActions: _angular_core.Signal<ButtonSettings[]>;
688
+ protected addedCardsIds: _angular_core.Signal<Set<string>>;
689
+ protected editViewButton: _angular_core.Signal<{
659
690
  text: string;
660
691
  icon: string;
661
692
  endIcon?: string;
@@ -664,7 +695,7 @@ declare class Dashboard implements OnInit, OnDestroy {
664
695
  action?: (("openInModal" | "navigate" | "edit" | "delete") | (string & {})) | undefined;
665
696
  modalSettings?: _openmfp_ngx.ModalSettings;
666
697
  }>;
667
- editCardsButton: _angular_core.Signal<{
698
+ protected editCardsButton: _angular_core.Signal<{
668
699
  text: string;
669
700
  icon: string;
670
701
  endIcon?: string;
@@ -673,15 +704,22 @@ declare class Dashboard implements OnInit, OnDestroy {
673
704
  action?: (("openInModal" | "navigate" | "edit" | "delete") | (string & {})) | undefined;
674
705
  modalSettings?: _openmfp_ngx.ModalSettings;
675
706
  }>;
676
- sectionCards: _angular_core.Signal<(sectionId: string) => CardConfig[]>;
677
- cardsPosition: Map<string, {
678
- x?: number;
679
- y?: number;
680
- w?: number;
681
- h?: number;
682
- }>;
683
- looseCards: _angular_core.WritableSignal<CardConfig[]>;
684
- private newGridStackNodes;
707
+ protected sectionCards: _angular_core.Signal<(sectionId: string) => CardConfig[]>;
708
+ protected looseCards: _angular_core.WritableSignal<CardConfig[]>;
709
+ protected gridOptions: _angular_core.Signal<GridStackOptions>;
710
+ /** JSON snapshots of sections/cards taken on entering edit mode, used to detect changes. */
711
+ private sectionsSnapshotJson;
712
+ private cardsSnapshotJson;
713
+ private sectionsSnapshot;
714
+ private cardsSnapshot;
715
+ private gridStack;
716
+ private addCardBtn;
717
+ private resizeObserver?;
718
+ private cardsPosition;
719
+ /** Callback that resumes the intercepted navigation once the user resolves the dialog. */
720
+ private pendingNavigation;
721
+ /** beforeunload handler kept on instance so add/removeEventListener pair up. */
722
+ private readonly beforeUnloadHandler;
685
723
  constructor();
686
724
  ngOnInit(): void;
687
725
  ngOnDestroy(): void;
@@ -731,9 +769,16 @@ declare class Dashboard implements OnInit, OnDestroy {
731
769
  added: CardConfig[];
732
770
  removed: string[];
733
771
  }): void;
772
+ onDragStart(event: {
773
+ el: Element;
774
+ }): void;
775
+ onDragStop(): void;
734
776
  onGridChange(): void;
735
777
  private saveCardsPosition;
736
778
  private updateCardsPositions;
779
+ private getZFlowEngine;
780
+ private updateCardsForBreakpoint;
781
+ private changeCardSettingsForXlPage;
737
782
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<Dashboard, never>;
738
783
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<Dashboard, "mfp-dashboard", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "sections": { "alias": "sections"; "required": false; "isSignal": true; }; "cards": { "alias": "cards"; "required": false; "isSignal": true; }; "availableCards": { "alias": "availableCards"; "required": false; "isSignal": true; }; "language": { "alias": "language"; "required": false; "isSignal": true; }; }, { "sections": "sectionsChange"; "cards": "cardsChange"; "saved": "saved"; "actionButtonClick": "actionButtonClick"; "unsavedChangesChange": "unsavedChangesChange"; }, never, ["[slot=dashboard-subheader]"], true, never>;
739
784
  }
@@ -1379,5 +1424,11 @@ declare class WhatsNew {
1379
1424
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<WhatsNew, "mfp-whats-new", never, {}, {}, never, never, true, never>;
1380
1425
  }
1381
1426
 
1382
- export { BooleanValue, CARD_TYPES, Dashboard, DeclarativeForm, DeclarativeTable, DeclarativeTableCard, Favorites, LinkValue, ResourceField, SecretValue, ServiceStatusCard, TagListValue, VisitedServiceCard, WhatsNew };
1427
+ declare class MockCard {
1428
+ readonly title: _angular_core.InputSignal<string>;
1429
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<MockCard, never>;
1430
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<MockCard, "mfp-mock-card", never, { "title": { "alias": "title"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
1431
+ }
1432
+
1433
+ export { BooleanValue, CARD_TYPES, Dashboard, DeclarativeForm, DeclarativeTable, DeclarativeTableCard, Favorites, LinkValue, MockCard, ResourceField, SecretValue, ServiceStatusCard, TagListValue, VisitedServiceCard, WhatsNew };
1383
1434
  export type { ButtonSettings, CardConfig, CardsType, CssRule, DashboardButtonsSettings, DashboardConfig, DeleteResourceConfirmationConfig, FieldDefinition, FieldFilterDefinition, FormFieldChangeEvent, FormFieldDefinition, FormFieldErrors, GenericResource, IconDesignType, ModalSettings, MountCfg, PropertyField, ResourceFieldButtonClickEvent, ResourceFormConfig, RuleCondition, SectionConfig, ServiceStatusItem, ServiceStatusValue, TableCardButtonSettings, TableCardConfig, TableCardFormState, TableCardSearchConfig, TableConfig, TableFieldDefinition, TagSettings, TransformType, UiSettings, ValueRule };