@wemake4u/form-player 2.0.0 → 2.0.2

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": "@wemake4u/form-player",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "license": "MIT",
5
5
  "peerDependencies": {
6
6
  "@angular/cdk": "^22.2.0",
@@ -16,7 +16,7 @@
16
16
  "ag-charts-community": "^11.3.2",
17
17
  "util": "^0.12.5",
18
18
  "@wemake4u/interact": "^1.0.6",
19
- "@wemake4u/form-controls": "^2.0.0"
19
+ "@wemake4u/form-controls": "^2.0.2"
20
20
  },
21
21
  "dependencies": {
22
22
  "tslib": "^2.3.0",
@@ -322,6 +322,7 @@ export declare class FormService implements IEvaluatorProvider {
322
322
  remove(control: AbstractControl, path: Path, index: number): boolean;
323
323
  moveUp(control: AbstractControl, path: Path, index: number): boolean;
324
324
  moveDown(control: AbstractControl, path: Path, index: number): boolean;
325
+ resize(control: AbstractControl, path: Path, newSize: number): boolean;
325
326
  status(control: AbstractControl, path: Path, pathOptions?: PathOptions): FormControlStatus | undefined;
326
327
  updateAllValueAndValidity(control: AbstractControl, emitEvent?: boolean): void;
327
328
  getInvalidControls(control: AbstractControl): {
@@ -692,6 +693,14 @@ declare class FormBuilderService {
692
693
  static ɵprov: i0.ɵɵInjectableDeclaration<any>;
693
694
  }
694
695
  export type BrowserNavigation = 'none' | 'fragment' | 'queryParam';
696
+ /**
697
+ * Where the view scrolls when the active form changes:
698
+ * - `content`: start of the form content (title and fields);
699
+ * - `form`: start of the whole form player (progress stepper included);
700
+ * - `page`: top of the page (the document; nested scroll containers are not moved);
701
+ * - `none`: no scroll.
702
+ */
703
+ export type ScrollOnNavigate = 'content' | 'form' | 'page' | 'none';
695
704
  export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestroy, IEvaluatorProvider {
696
705
  private cdr;
697
706
  private destroyRef;
@@ -724,12 +733,16 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
724
733
  browserNavigation: BrowserNavigation;
725
734
  queryParamName: string;
726
735
  navSize: 'normal' | 'small';
736
+ /** Scroll applied when the active form changes (next/previous, side menu, stepper, goTo, browser history). */
737
+ scrollOnNavigate: ScrollOnNavigate;
727
738
  groupMode: FormGroupMode;
728
739
  updateMode: 'changes' | 'submit';
729
740
  valueChange: EventEmitter<any>;
730
741
  initialized: EventEmitter<FormGroup<any>>;
731
742
  activeNavChange: EventEmitter<any>;
732
743
  formDiv: ElementRef<HTMLDivElement>;
744
+ rootDiv?: ElementRef<HTMLDivElement>;
745
+ private readonly document;
733
746
  constructor(cdr: ChangeDetectorRef, destroyRef: DestroyRef, programmability: ProgrammabilityService, formBuilder: FormBuilderService, validationService: ValidationService, statusService: StatusService, eventService: EventService, registerService: RegisterService, languageService: LanguageService, subscribeService: SubscribeService, metadata: MetadataService, formService: FormService, dialog: DialogService, injector: Injector, router: Router, route: ActivatedRoute, scope: ScopeService);
734
747
  Texts: {
735
748
  i18n: {
@@ -771,6 +784,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
771
784
  InformationAbout: string;
772
785
  OpenMenu: string;
773
786
  CloseMenu: string;
787
+ Loading: string;
774
788
  LoadingFailed: string;
775
789
  ConfirmDelete: string;
776
790
  MoveUp: string;
@@ -794,6 +808,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
794
808
  SomethingWentWrong: string;
795
809
  TimeoutOccurred: string;
796
810
  GenericError: string;
811
+ ItemPosition: string;
812
+ ItemAdded: string;
813
+ ItemRemoved: string;
814
+ ItemMoved: string;
797
815
  };
798
816
  en: {
799
817
  TypeToSearch: string;
@@ -833,6 +851,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
833
851
  InformationAbout: string;
834
852
  OpenMenu: string;
835
853
  CloseMenu: string;
854
+ Loading: string;
836
855
  LoadingFailed: string;
837
856
  ConfirmDelete: string;
838
857
  MoveUp: string;
@@ -856,6 +875,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
856
875
  SomethingWentWrong: string;
857
876
  TimeoutOccurred: string;
858
877
  GenericError: string;
878
+ ItemPosition: string;
879
+ ItemAdded: string;
880
+ ItemRemoved: string;
881
+ ItemMoved: string;
859
882
  };
860
883
  de: {
861
884
  TypeToSearch: string;
@@ -895,6 +918,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
895
918
  InformationAbout: string;
896
919
  OpenMenu: string;
897
920
  CloseMenu: string;
921
+ Loading: string;
898
922
  LoadingFailed: string;
899
923
  ConfirmDelete: string;
900
924
  MoveUp: string;
@@ -918,6 +942,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
918
942
  SomethingWentWrong: string;
919
943
  TimeoutOccurred: string;
920
944
  GenericError: string;
945
+ ItemPosition: string;
946
+ ItemAdded: string;
947
+ ItemRemoved: string;
948
+ ItemMoved: string;
921
949
  };
922
950
  fr: {
923
951
  TypeToSearch: string;
@@ -957,6 +985,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
957
985
  InformationAbout: string;
958
986
  OpenMenu: string;
959
987
  CloseMenu: string;
988
+ Loading: string;
960
989
  LoadingFailed: string;
961
990
  ConfirmDelete: string;
962
991
  MoveUp: string;
@@ -980,6 +1009,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
980
1009
  SomethingWentWrong: string;
981
1010
  TimeoutOccurred: string;
982
1011
  GenericError: string;
1012
+ ItemPosition: string;
1013
+ ItemAdded: string;
1014
+ ItemRemoved: string;
1015
+ ItemMoved: string;
983
1016
  };
984
1017
  es: {
985
1018
  TypeToSearch: string;
@@ -1019,6 +1052,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1019
1052
  InformationAbout: string;
1020
1053
  OpenMenu: string;
1021
1054
  CloseMenu: string;
1055
+ Loading: string;
1022
1056
  LoadingFailed: string;
1023
1057
  ConfirmDelete: string;
1024
1058
  MoveUp: string;
@@ -1042,6 +1076,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1042
1076
  SomethingWentWrong: string;
1043
1077
  TimeoutOccurred: string;
1044
1078
  GenericError: string;
1079
+ ItemPosition: string;
1080
+ ItemAdded: string;
1081
+ ItemRemoved: string;
1082
+ ItemMoved: string;
1045
1083
  };
1046
1084
  pt: {
1047
1085
  TypeToSearch: string;
@@ -1081,6 +1119,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1081
1119
  InformationAbout: string;
1082
1120
  OpenMenu: string;
1083
1121
  CloseMenu: string;
1122
+ Loading: string;
1084
1123
  LoadingFailed: string;
1085
1124
  ConfirmDelete: string;
1086
1125
  MoveUp: string;
@@ -1104,6 +1143,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1104
1143
  SomethingWentWrong: string;
1105
1144
  TimeoutOccurred: string;
1106
1145
  GenericError: string;
1146
+ ItemPosition: string;
1147
+ ItemAdded: string;
1148
+ ItemRemoved: string;
1149
+ ItemMoved: string;
1107
1150
  };
1108
1151
  };
1109
1152
  TypeToSearch: string;
@@ -1143,6 +1186,7 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1143
1186
  InformationAbout: string;
1144
1187
  OpenMenu: string;
1145
1188
  CloseMenu: string;
1189
+ Loading: string;
1146
1190
  LoadingFailed: string;
1147
1191
  ConfirmDelete: string;
1148
1192
  MoveUp: string;
@@ -1166,6 +1210,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1166
1210
  SomethingWentWrong: string;
1167
1211
  TimeoutOccurred: string;
1168
1212
  GenericError: string;
1213
+ ItemPosition: string;
1214
+ ItemAdded: string;
1215
+ ItemRemoved: string;
1216
+ ItemMoved: string;
1169
1217
  };
1170
1218
  ngOnInit(): void;
1171
1219
  ngOnDestroy(): void;
@@ -1256,7 +1304,14 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1256
1304
  private clearFormArrays;
1257
1305
  private getCurrentForm;
1258
1306
  private disableAutoFocus;
1307
+ /**
1308
+ * Focuses the first field of the active form, once it is rendered. With `scroll` (form change) the view first scrolls
1309
+ * as set by `scrollOnNavigate`; the focus then does not scroll again (a first field lower in the form would hide its
1310
+ * start).
1311
+ */
1259
1312
  private autoFocus;
1313
+ /** Scrolls as set by `scrollOnNavigate`; false when no scroll is configured. */
1314
+ private scrollToActiveForm;
1260
1315
  private canRevealErrors;
1261
1316
  private hasPotentialNextForm;
1262
1317
  hasSilentErrors(): boolean;
@@ -1327,6 +1382,10 @@ export declare class DynamicFormComponent implements OnInit, OnChanges, OnDestro
1327
1382
  "alias": "navSize";
1328
1383
  "required": false;
1329
1384
  };
1385
+ "scrollOnNavigate": {
1386
+ "alias": "scrollOnNavigate";
1387
+ "required": false;
1388
+ };
1330
1389
  "groupMode": {
1331
1390
  "alias": "groupMode";
1332
1391
  "required": false;
@@ -1618,6 +1677,36 @@ export interface OrderModelItem {
1618
1677
  sort: 'asc' | 'desc';
1619
1678
  }
1620
1679
  export interface OrderModel extends Array<OrderModelItem> {}
1680
+ /**
1681
+ * Control of a `table` component rendered by the Sirio data grid (`DynamicFieldsComponent.useDataGrid`).
1682
+ * Same API as `TableControl` (ag-grid), so the form expressions work with both grids: filters and
1683
+ * sort use the ag-grid models, converted to the data grid ones (`ag-grid-model.ts`).
1684
+ *
1685
+ * It extends `TableControl` (overriding every method, nothing of ag-grid is used) so the code that
1686
+ * looks for the control by type (`getControlAs(name, TableControl)`) keeps working with both grids.
1687
+ *
1688
+ * When ag-grid is removed this content moves to `TableControl` (without the conversion, once the
1689
+ * forms use the data grid models) and `DataGridControl` is deleted.
1690
+ */
1691
+ export declare class DataGridControl extends TableControl {
1692
+ setFilter(filter: FilterModel): void;
1693
+ getFilter(): FilterModel;
1694
+ clearFilter(): void;
1695
+ getOrder(): OrderModel;
1696
+ setOrder(order: OrderModel): void;
1697
+ /** Evaluates the data source expression again (as `TableControl`) and reloads a server source. */
1698
+ refresh(): void;
1699
+ /** The data grid renders its rows from the data: nothing to redraw. */
1700
+ redraw(): void;
1701
+ private gridState;
1702
+ onLoadState(): void;
1703
+ onSaveState(): void;
1704
+ /** Restores the saved state; a state saved by ag-grid (`TableControl`) is ignored. */
1705
+ private restoreState;
1706
+ private get dataGrid();
1707
+ /** Filter keys and types of the grid columns, for the ag-grid model conversion. */
1708
+ private modelColumns;
1709
+ }
1621
1710
  export declare class ButtonControl extends Control {
1622
1711
  /** The registered element is the native button (wmSirioButton of @wemake4u/form-controls). */
1623
1712
  focus(): void;