@ajf/material 18.3.2 → 18.4.1

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.
@@ -12,32 +12,34 @@ import * as i10 from "./validation-condition-editor-dialog";
12
12
  import * as i11 from "./warning-condition-editor-dialog";
13
13
  import * as i12 from "./form-builder";
14
14
  import * as i13 from "./node-type-filter.pipe";
15
- import * as i14 from "@ajf/material/node-icon";
16
- import * as i15 from "@angular/common";
17
- import * as i16 from "@angular/cdk/drag-drop";
18
- import * as i17 from "@angular/forms";
19
- import * as i18 from "@angular/material/autocomplete";
20
- import * as i19 from "@angular/material/button";
21
- import * as i20 from "@angular/material/card";
22
- import * as i21 from "@angular/material/checkbox";
23
- import * as i22 from "@angular/material/chips";
24
- import * as i23 from "@angular/material/dialog";
25
- import * as i24 from "@angular/material/form-field";
26
- import * as i25 from "@angular/material/icon";
27
- import * as i26 from "@angular/material/input";
28
- import * as i27 from "@angular/material/list";
29
- import * as i28 from "@angular/material/menu";
30
- import * as i29 from "@angular/material/select";
31
- import * as i30 from "@angular/material/sidenav";
32
- import * as i31 from "@angular/material/slider";
33
- import * as i32 from "@angular/material/table";
34
- import * as i33 from "@angular/material/toolbar";
35
- import * as i34 from "@angular/material/tooltip";
36
- import * as i35 from "@ajf/core/transloco";
37
- import * as i36 from "@angular/material/expansion";
38
- import * as i37 from "@angular/material/slide-toggle";
15
+ import * as i14 from "./node-type-groups.pipe";
16
+ import * as i15 from "@ajf/material/node-icon";
17
+ import * as i16 from "@angular/common";
18
+ import * as i17 from "@angular/cdk/drag-drop";
19
+ import * as i18 from "@angular/forms";
20
+ import * as i19 from "@angular/material/autocomplete";
21
+ import * as i20 from "@angular/material/button";
22
+ import * as i21 from "@angular/material/card";
23
+ import * as i22 from "@angular/material/checkbox";
24
+ import * as i23 from "@angular/material/chips";
25
+ import * as i24 from "@angular/material/dialog";
26
+ import * as i25 from "@angular/material/form-field";
27
+ import * as i26 from "@angular/material/icon";
28
+ import * as i27 from "@angular/material/input";
29
+ import * as i28 from "@angular/material/list";
30
+ import * as i29 from "@angular/material/menu";
31
+ import * as i30 from "@angular/material/select";
32
+ import * as i31 from "ngx-mat-select-search";
33
+ import * as i32 from "@angular/material/sidenav";
34
+ import * as i33 from "@angular/material/slider";
35
+ import * as i34 from "@angular/material/table";
36
+ import * as i35 from "@angular/material/toolbar";
37
+ import * as i36 from "@angular/material/tooltip";
38
+ import * as i37 from "@ajf/core/transloco";
39
+ import * as i38 from "@angular/material/expansion";
40
+ import * as i39 from "@angular/material/slide-toggle";
39
41
  export declare class AjfFormBuilderModule {
40
42
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfFormBuilderModule, never>;
41
- static ɵmod: i0.ɵɵNgModuleDeclaration<AjfFormBuilderModule, [typeof i1.AjfFbBranchLine, typeof i2.AjfFbChoicesOriginEditor, typeof i3.AjfFbChoicesOriginEditorDialog, typeof i4.AjfFbConditionEditor, typeof i5.AjfFbConditionEditorDialog, typeof i6.AjfFbNodeEntry, typeof i7.AjfFbNodeProperties, typeof i8.AjfFbNodeTypeEntry, typeof i9.AjfFbStringIdentifierDialogComponent, typeof i10.AjfFbValidationConditionEditorDialog, typeof i11.AjfFbWarningConditionEditorDialog, typeof i12.AjfFormBuilder, typeof i13.NodeTypeFilterPipe], [typeof i14.AjfNodeIconModule, typeof i15.CommonModule, typeof i16.DragDropModule, typeof i17.FormsModule, typeof i18.MatAutocompleteModule, typeof i19.MatButtonModule, typeof i20.MatCardModule, typeof i21.MatCheckboxModule, typeof i22.MatChipsModule, typeof i23.MatDialogModule, typeof i24.MatFormFieldModule, typeof i25.MatIconModule, typeof i26.MatInputModule, typeof i27.MatListModule, typeof i28.MatMenuModule, typeof i29.MatSelectModule, typeof i30.MatSidenavModule, typeof i31.MatSliderModule, typeof i32.MatTableModule, typeof i33.MatToolbarModule, typeof i34.MatTooltipModule, typeof i17.ReactiveFormsModule, typeof i35.AjfTranslocoModule, typeof i36.MatExpansionModule, typeof i37.MatSlideToggleModule], [typeof i12.AjfFormBuilder]>;
43
+ static ɵmod: i0.ɵɵNgModuleDeclaration<AjfFormBuilderModule, [typeof i1.AjfFbBranchLine, typeof i2.AjfFbChoicesOriginEditor, typeof i3.AjfFbChoicesOriginEditorDialog, typeof i4.AjfFbConditionEditor, typeof i5.AjfFbConditionEditorDialog, typeof i6.AjfFbNodeEntry, typeof i7.AjfFbNodeProperties, typeof i8.AjfFbNodeTypeEntry, typeof i9.AjfFbStringIdentifierDialogComponent, typeof i10.AjfFbValidationConditionEditorDialog, typeof i11.AjfFbWarningConditionEditorDialog, typeof i12.AjfFormBuilder, typeof i13.NodeTypeFilterPipe, typeof i14.NodeTypeGroupsPipe], [typeof i15.AjfNodeIconModule, typeof i16.CommonModule, typeof i17.DragDropModule, typeof i18.FormsModule, typeof i19.MatAutocompleteModule, typeof i20.MatButtonModule, typeof i21.MatCardModule, typeof i22.MatCheckboxModule, typeof i23.MatChipsModule, typeof i24.MatDialogModule, typeof i25.MatFormFieldModule, typeof i26.MatIconModule, typeof i27.MatInputModule, typeof i28.MatListModule, typeof i29.MatMenuModule, typeof i30.MatSelectModule, typeof i31.NgxMatSelectSearchModule, typeof i32.MatSidenavModule, typeof i33.MatSliderModule, typeof i34.MatTableModule, typeof i35.MatToolbarModule, typeof i36.MatTooltipModule, typeof i18.ReactiveFormsModule, typeof i37.AjfTranslocoModule, typeof i38.MatExpansionModule, typeof i39.MatSlideToggleModule], [typeof i12.AjfFormBuilder]>;
42
44
  static ɵinj: i0.ɵɵInjectorDeclaration<AjfFormBuilderModule>;
43
45
  }
@@ -23,6 +23,19 @@ import { AjfAttachmentsOrigin, AjfChoicesOrigin, AjfField, AjfFieldType, AjfForm
23
23
  import { AjfCondition } from '@ajf/core/models';
24
24
  import { BehaviorSubject, Observable } from 'rxjs';
25
25
  import * as i0 from "@angular/core";
26
+ /**
27
+ * The categories the entries of the form builder field types palette are
28
+ * grouped into, in display order. The values are translation keys, rendered as
29
+ * the header of each group.
30
+ */
31
+ export declare const AjfFormBuilderNodeTypeCategories: {
32
+ readonly structure: "Structure";
33
+ readonly text: "Text";
34
+ readonly numeric: "Numeric";
35
+ readonly choices: "Choice fields";
36
+ readonly dateTime: "Date & time";
37
+ readonly advanced: "Advanced";
38
+ };
26
39
  export interface AjfFormBuilderNodeTypeEntry {
27
40
  label: string;
28
41
  nodeType: {
@@ -30,6 +43,13 @@ export interface AjfFormBuilderNodeTypeEntry {
30
43
  field?: AjfFieldType;
31
44
  };
32
45
  isSlide?: boolean;
46
+ /**
47
+ * The category the entry belongs to, one of
48
+ * {@link AjfFormBuilderNodeTypeCategories}. Entries sharing a category are
49
+ * rendered under a common header; entries without a category are rendered
50
+ * last, with no header.
51
+ */
52
+ category?: string;
33
53
  }
34
54
  export interface AjfFormBuilderNodeEntry {
35
55
  node: AjfNode;
@@ -79,6 +99,11 @@ export type AjfContainerNode = AjfSlide | AjfRepeatingSlide | AjfNodeGroup;
79
99
  export declare function cleanDefaultValue(value: any, node: AjfField<any>): string | null;
80
100
  export declare function flattenNodes(nodes: AjfNode[]): AjfNode[];
81
101
  export declare class AjfFormBuilderService {
102
+ /**
103
+ * The node types available in the palette, listed by category in display
104
+ * order. Entries of the same category are rendered under a common header, see
105
+ * {@link AjfFormBuilderNodeTypeCategories}.
106
+ */
82
107
  private _availableNodeTypes;
83
108
  /**
84
109
  * Available node types
@@ -20,8 +20,9 @@
20
20
  *
21
21
  */
22
22
  import { AjfChoicesOrigin, AjfForm } from '@ajf/core/forms';
23
+ import { BooleanInput } from '@angular/cdk/coercion';
23
24
  import { CdkDrag, CdkDragDrop } from '@angular/cdk/drag-drop';
24
- import { AfterContentInit, AfterViewChecked, ChangeDetectorRef, ElementRef, OnDestroy } from '@angular/core';
25
+ import { AfterContentInit, AfterViewChecked, ChangeDetectorRef, ElementRef, EventEmitter, OnDestroy } from '@angular/core';
25
26
  import { MatDialog } from '@angular/material/dialog';
26
27
  import { MatSlideToggleChange } from '@angular/material/slide-toggle';
27
28
  import { Observable } from 'rxjs';
@@ -35,6 +36,32 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
35
36
  private _form;
36
37
  get form(): AjfForm | undefined;
37
38
  set form(form: AjfForm | undefined);
39
+ /**
40
+ * True when the slides of the designer are kept expanded. Slides added later
41
+ * follow this state as well.
42
+ * It drives the "expand slides" toggle of the toolbar and can be set by the
43
+ * host, both one-way (`[expandSlides]="true"`) and two-way
44
+ * (`[(expandSlides)]="expanded"`).
45
+ */
46
+ private _expandSlides;
47
+ get expandSlides(): boolean;
48
+ set expandSlides(expandSlides: boolean);
49
+ /**
50
+ * Emits whenever the slides expansion state is changed from inside the form
51
+ * builder, i.e. by the toolbar controls.
52
+ */
53
+ readonly expandSlidesChange: EventEmitter<boolean>;
54
+ /**
55
+ * When true the form builder fills the whole height of its container: the
56
+ * field types palette, the designer and the properties panel stretch to the
57
+ * available height and scroll internally, instead of growing with their
58
+ * content. Requires the container to have a definite height.
59
+ */
60
+ private _fillHeight;
61
+ get fillHeight(): boolean;
62
+ set fillHeight(fillHeight: boolean);
63
+ static ngAcceptInputType_expandSlides: BooleanInput;
64
+ static ngAcceptInputType_fillHeight: BooleanInput;
38
65
  /**
39
66
  * Called to set form builder validation errors
40
67
  */
@@ -79,11 +106,23 @@ export declare class AjfFormBuilder implements AfterViewChecked, AfterContentIni
79
106
  onDrop(event: CdkDragDrop<AjfFormBuilderNodeEntry> | CdkDragDrop<AjfFormBuilderNodeTypeEntry>, content?: boolean): void;
80
107
  editChoicesOrigin(choicesOrigin: AjfChoicesOrigin<any>): void;
81
108
  editStringIdentifier(): void;
109
+ /**
110
+ * Expands all the slides of the designer and keeps the slides added later expanded.
111
+ */
82
112
  expandAll(): void;
113
+ /**
114
+ * Collapses all the slides of the designer and keeps the slides added later collapsed.
115
+ */
83
116
  collapseAll(): void;
84
117
  expandToggle(evt: MatSlideToggleChange): void;
118
+ /**
119
+ * Applies the slides expansion state to the service.
120
+ * @param expanded True to keep the slides expanded
121
+ * @param notify True to emit expandSlidesChange when the state changes
122
+ */
123
+ private _setSlidesExpanded;
85
124
  downloadAsXlsform(): Promise<void>;
86
125
  private _setCurrentForm;
87
126
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfFormBuilder, never>;
88
- static ɵcmp: i0.ɵɵComponentDeclaration<AjfFormBuilder, "ajf-form-builder", never, { "form": { "alias": "form"; "required": false; }; }, { "formBuilderValidation": "formBuilderValidation"; }, never, never, false, never>;
127
+ static ɵcmp: i0.ɵɵComponentDeclaration<AjfFormBuilder, "ajf-form-builder", never, { "form": { "alias": "form"; "required": false; }; "expandSlides": { "alias": "expandSlides"; "required": false; }; "fillHeight": { "alias": "fillHeight"; "required": false; }; }, { "expandSlidesChange": "expandSlidesChange"; "formBuilderValidation": "formBuilderValidation"; }, never, never, false, never>;
89
128
  }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright (C) Gnucoop soc. coop.
4
+ *
5
+ * This file is part of the Advanced JSON forms (ajf).
6
+ *
7
+ * Advanced JSON forms (ajf) is free software: you can redistribute it and/or
8
+ * modify it under the terms of the GNU Affero General Public License as
9
+ * published by the Free Software Foundation, either version 3 of the License,
10
+ * or (at your option) any later version.
11
+ *
12
+ * Advanced JSON forms (ajf) is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
15
+ * General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Affero General Public License
18
+ * along with Advanced JSON forms (ajf).
19
+ * If not, see http://www.gnu.org/licenses/.
20
+ *
21
+ */
22
+ import { PipeTransform } from '@angular/core';
23
+ import { AjfFormBuilderNodeTypeEntry } from './form-builder-service';
24
+ import * as i0 from "@angular/core";
25
+ /**
26
+ * A group of node types of the palette, rendered under a common header.
27
+ */
28
+ export interface AjfFormBuilderNodeTypeGroup {
29
+ /**
30
+ * The translation key of the group header. Empty for the group of the entries
31
+ * that have no category, which is rendered without a header.
32
+ */
33
+ category: string;
34
+ nodeTypes: AjfFormBuilderNodeTypeEntry[];
35
+ }
36
+ /**
37
+ * Groups the node types of the palette by category, keeping the categories in
38
+ * the order of their first entry. Applied after the search filter, so that the
39
+ * categories left without entries produce no header.
40
+ */
41
+ export declare class NodeTypeGroupsPipe implements PipeTransform {
42
+ transform(nodeTypes: AjfFormBuilderNodeTypeEntry[]): AjfFormBuilderNodeTypeGroup[];
43
+ static ɵfac: i0.ɵɵFactoryDeclaration<NodeTypeGroupsPipe, never>;
44
+ static ɵpipe: i0.ɵɵPipeDeclaration<NodeTypeGroupsPipe, "nodeTypeGroups", false>;
45
+ }
@@ -23,3 +23,4 @@ export * from './form-builder-module';
23
23
  export * from './form-builder-service';
24
24
  export * from './form-builder-utils';
25
25
  export * from './form-builder';
26
+ export * from './node-type-groups.pipe';
@@ -19,30 +19,24 @@
19
19
  * If not, see http://www.gnu.org/licenses/.
20
20
  *
21
21
  */
22
- import { AjfFormStringIdentifier } from '@ajf/core/forms';
23
- import { ChangeDetectorRef, OnDestroy } from '@angular/core';
24
- import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
25
- import { MatChipInputEvent } from '@angular/material/chips';
26
- import { MatTableDataSource } from '@angular/material/table';
22
+ import { AjfField } from '@ajf/core/forms';
23
+ import { OnDestroy } from '@angular/core';
24
+ import { FormControl } from '@angular/forms';
27
25
  import { Observable } from 'rxjs';
28
26
  import { AjfFormBuilderService } from './form-builder-service';
29
27
  import * as i0 from "@angular/core";
30
28
  export declare class AjfFbStringIdentifierDialogComponent implements OnDestroy {
31
29
  private _service;
32
- private _cdr;
33
- readonly dataSource: MatTableDataSource<AjfFormStringIdentifier>;
34
- readonly displayedColumns: string[];
35
- readonly fields$: Observable<string[]>;
36
- readonly separatorKeysCodes: number[];
30
+ readonly fields$: Observable<AjfField[]>;
31
+ readonly filteredFields$: Observable<AjfField[]>;
32
+ readonly searchFilterCtrl: FormControl<string>;
33
+ selectedFieldNames: string[];
34
+ private _fields;
35
+ private _fieldsSub;
37
36
  private _stringIdentifierSub;
38
- constructor(_service: AjfFormBuilderService, _cdr: ChangeDetectorRef);
39
- addRow(): void;
40
- deleteRow(rowIdx: number): void;
41
- addValue(row: AjfFormStringIdentifier, evt: MatChipInputEvent, valueInput: HTMLInputElement): void;
42
- removeValue(row: AjfFormStringIdentifier, value: string): void;
37
+ constructor(_service: AjfFormBuilderService);
43
38
  ngOnDestroy(): void;
44
39
  saveStringIdentifier(): void;
45
- selected(row: AjfFormStringIdentifier, evt: MatAutocompleteSelectedEvent): void;
46
40
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfFbStringIdentifierDialogComponent, never>;
47
41
  static ɵcmp: i0.ɵɵComponentDeclaration<AjfFbStringIdentifierDialogComponent, "ajf-fb-string-identifier-dialog", never, {}, {}, never, never, false, never>;
48
42
  }
@@ -26,6 +26,11 @@ import { AjfWarningAlertService } from './warning-alert-service';
26
26
  import * as i0 from "@angular/core";
27
27
  export declare class AjfRangeFieldComponent extends AjfRange {
28
28
  constructor(cdr: ChangeDetectorRef, service: AjfFormRendererService, was: AjfWarningAlertService);
29
+ /**
30
+ * True when no value has been selected yet, so that the slider is not
31
+ * rendered as if the minimum value had been picked.
32
+ */
33
+ isEmpty(value: unknown): boolean;
29
34
  enumerateStars(): number[];
30
35
  static ɵfac: i0.ɵɵFactoryDeclaration<AjfRangeFieldComponent, never>;
31
36
  static ɵcmp: i0.ɵɵComponentDeclaration<AjfRangeFieldComponent, "ajf-range", never, {}, {}, never, never, false, never>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ajf/material",
3
- "version": "18.3.2",
3
+ "version": "18.4.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "homepage": "https://github.com/gnucoop/ajf#readme",
15
15
  "peerDependencies": {
16
- "@ajf/core": "18.3.2",
16
+ "@ajf/core": "18.4.1",
17
17
  "@angular/animations": "^18.2.13",
18
18
  "@angular/cdk": "^18.2.14",
19
19
  "@angular/common": "^18.2.13",